Commit 608e00d0 authored by Manish Chopra's avatar Manish Chopra Committed by David S. Miller

qed*: Support drop action classification

With this patch, User can configure for the supported
flows to be dropped. Added a stat "gft_filter_drop"
as well to be populated in ethtool for the dropped flows.

For example -

ethtool -N p5p1 flow-type udp4 dst-port 8000 action -1
ethtool -N p5p1 flow-type tcp4 scr-ip 192.168.8.1 action -1
Signed-off-by: default avatarManish Chopra <manish.chopra@cavium.com>
Signed-off-by: default avatarShahed Shaikh <shahed.shaikh@cavium.com>
Signed-off-by: default avatarAriel Elior <ariel.elior@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 39385ab0
...@@ -1677,6 +1677,8 @@ static void __qed_get_vport_tstats(struct qed_hwfn *p_hwfn, ...@@ -1677,6 +1677,8 @@ static void __qed_get_vport_tstats(struct qed_hwfn *p_hwfn,
HILO_64_REGPAIR(tstats.mftag_filter_discard); HILO_64_REGPAIR(tstats.mftag_filter_discard);
p_stats->common.mac_filter_discards += p_stats->common.mac_filter_discards +=
HILO_64_REGPAIR(tstats.eth_mac_filter_discard); HILO_64_REGPAIR(tstats.eth_mac_filter_discard);
p_stats->common.gft_filter_drop +=
HILO_64_REGPAIR(tstats.eth_gft_drop_pkt);
} }
static void __qed_get_vport_ustats_addrlen(struct qed_hwfn *p_hwfn, static void __qed_get_vport_ustats_addrlen(struct qed_hwfn *p_hwfn,
...@@ -2015,16 +2017,6 @@ qed_configure_rfs_ntuple_filter(struct qed_hwfn *p_hwfn, ...@@ -2015,16 +2017,6 @@ qed_configure_rfs_ntuple_filter(struct qed_hwfn *p_hwfn,
u8 abs_vport_id = 0; u8 abs_vport_id = 0;
int rc = -EINVAL; int rc = -EINVAL;
rc = qed_fw_vport(p_hwfn, p_params->vport_id, &abs_vport_id);
if (rc)
return rc;
if (p_params->qid != QED_RFS_NTUPLE_QID_RSS) {
rc = qed_fw_l2_queue(p_hwfn, p_params->qid, &abs_rx_q_id);
if (rc)
return rc;
}
/* Get SPQ entry */ /* Get SPQ entry */
memset(&init_data, 0, sizeof(init_data)); memset(&init_data, 0, sizeof(init_data));
init_data.cid = qed_spq_get_cid(p_hwfn); init_data.cid = qed_spq_get_cid(p_hwfn);
...@@ -2049,15 +2041,28 @@ qed_configure_rfs_ntuple_filter(struct qed_hwfn *p_hwfn, ...@@ -2049,15 +2041,28 @@ qed_configure_rfs_ntuple_filter(struct qed_hwfn *p_hwfn,
DMA_REGPAIR_LE(p_ramrod->pkt_hdr_addr, p_params->addr); DMA_REGPAIR_LE(p_ramrod->pkt_hdr_addr, p_params->addr);
p_ramrod->pkt_hdr_length = cpu_to_le16(p_params->length); p_ramrod->pkt_hdr_length = cpu_to_le16(p_params->length);
if (p_params->b_is_drop) {
p_ramrod->vport_id = cpu_to_le16(ETH_GFT_TRASHCAN_VPORT);
} else {
rc = qed_fw_vport(p_hwfn, p_params->vport_id, &abs_vport_id);
if (rc)
return rc;
if (p_params->qid != QED_RFS_NTUPLE_QID_RSS) { if (p_params->qid != QED_RFS_NTUPLE_QID_RSS) {
rc = qed_fw_l2_queue(p_hwfn, p_params->qid,
&abs_rx_q_id);
if (rc)
return rc;
p_ramrod->rx_qid_valid = 1; p_ramrod->rx_qid_valid = 1;
p_ramrod->rx_qid = cpu_to_le16(abs_rx_q_id); p_ramrod->rx_qid = cpu_to_le16(abs_rx_q_id);
} }
p_ramrod->vport_id = cpu_to_le16((u16)abs_vport_id);
}
p_ramrod->flow_id_valid = 0; p_ramrod->flow_id_valid = 0;
p_ramrod->flow_id = 0; p_ramrod->flow_id = 0;
p_ramrod->vport_id = cpu_to_le16((u16)abs_vport_id);
p_ramrod->filter_action = p_params->b_is_add ? GFT_ADD_FILTER p_ramrod->filter_action = p_params->b_is_add ? GFT_ADD_FILTER
: GFT_DELETE_FILTER; : GFT_DELETE_FILTER;
......
...@@ -75,6 +75,7 @@ struct qede_stats_common { ...@@ -75,6 +75,7 @@ struct qede_stats_common {
u64 rx_bcast_pkts; u64 rx_bcast_pkts;
u64 mftag_filter_discards; u64 mftag_filter_discards;
u64 mac_filter_discards; u64 mac_filter_discards;
u64 gft_filter_drop;
u64 tx_ucast_bytes; u64 tx_ucast_bytes;
u64 tx_mcast_bytes; u64 tx_mcast_bytes;
u64 tx_bcast_bytes; u64 tx_bcast_bytes;
......
...@@ -161,6 +161,7 @@ static const struct { ...@@ -161,6 +161,7 @@ static const struct {
QEDE_STAT(no_buff_discards), QEDE_STAT(no_buff_discards),
QEDE_PF_STAT(mftag_filter_discards), QEDE_PF_STAT(mftag_filter_discards),
QEDE_PF_STAT(mac_filter_discards), QEDE_PF_STAT(mac_filter_discards),
QEDE_PF_STAT(gft_filter_drop),
QEDE_STAT(tx_err_drop_pkts), QEDE_STAT(tx_err_drop_pkts),
QEDE_STAT(ttl0_discard), QEDE_STAT(ttl0_discard),
QEDE_STAT(packet_too_big_discard), QEDE_STAT(packet_too_big_discard),
......
...@@ -90,6 +90,7 @@ struct qede_arfs_fltr_node { ...@@ -90,6 +90,7 @@ struct qede_arfs_fltr_node {
bool filter_op; bool filter_op;
bool used; bool used;
u8 fw_rc; u8 fw_rc;
bool b_is_drop;
struct hlist_node node; struct hlist_node node;
}; };
...@@ -125,6 +126,7 @@ static void qede_configure_arfs_fltr(struct qede_dev *edev, ...@@ -125,6 +126,7 @@ static void qede_configure_arfs_fltr(struct qede_dev *edev,
params.length = n->buf_len; params.length = n->buf_len;
params.qid = rxq_id; params.qid = rxq_id;
params.b_is_add = add_fltr; params.b_is_add = add_fltr;
params.b_is_drop = n->b_is_drop;
if (n->vfid) { if (n->vfid) {
params.b_is_vf = true; params.b_is_vf = true;
...@@ -1445,6 +1447,9 @@ int qede_get_cls_rule_entry(struct qede_dev *edev, struct ethtool_rxnfc *cmd) ...@@ -1445,6 +1447,9 @@ int qede_get_cls_rule_entry(struct qede_dev *edev, struct ethtool_rxnfc *cmd)
fsp->ring_cookie |= ((u64)fltr->vfid) << fsp->ring_cookie |= ((u64)fltr->vfid) <<
ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF; ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF;
} }
if (fltr->b_is_drop)
fsp->ring_cookie = RX_CLS_FLOW_DISC;
unlock: unlock:
__qede_unlock(edev); __qede_unlock(edev);
return rc; return rc;
...@@ -1816,6 +1821,10 @@ static int qede_flow_spec_validate(struct qede_dev *edev, ...@@ -1816,6 +1821,10 @@ static int qede_flow_spec_validate(struct qede_dev *edev,
return -EINVAL; return -EINVAL;
} }
/* If drop requested then no need to validate other data */
if (fs->ring_cookie == RX_CLS_FLOW_DISC)
return 0;
if (ethtool_get_flow_spec_ring_vf(fs->ring_cookie)) if (ethtool_get_flow_spec_ring_vf(fs->ring_cookie))
return 0; return 0;
...@@ -1852,6 +1861,11 @@ static void qede_flow_set_destination(struct qede_dev *edev, ...@@ -1852,6 +1861,11 @@ static void qede_flow_set_destination(struct qede_dev *edev,
struct qede_arfs_fltr_node *n, struct qede_arfs_fltr_node *n,
struct ethtool_rx_flow_spec *fs) struct ethtool_rx_flow_spec *fs)
{ {
if (fs->ring_cookie == RX_CLS_FLOW_DISC) {
n->b_is_drop = true;
return;
}
n->vfid = ethtool_get_flow_spec_ring_vf(fs->ring_cookie); n->vfid = ethtool_get_flow_spec_ring_vf(fs->ring_cookie);
n->rxq_id = ethtool_get_flow_spec_ring(fs->ring_cookie); n->rxq_id = ethtool_get_flow_spec_ring(fs->ring_cookie);
n->next_rxq_id = n->rxq_id; n->next_rxq_id = n->rxq_id;
......
...@@ -347,6 +347,7 @@ void qede_fill_by_demand_stats(struct qede_dev *edev) ...@@ -347,6 +347,7 @@ void qede_fill_by_demand_stats(struct qede_dev *edev)
p_common->rx_bcast_pkts = stats.common.rx_bcast_pkts; p_common->rx_bcast_pkts = stats.common.rx_bcast_pkts;
p_common->mftag_filter_discards = stats.common.mftag_filter_discards; p_common->mftag_filter_discards = stats.common.mftag_filter_discards;
p_common->mac_filter_discards = stats.common.mac_filter_discards; p_common->mac_filter_discards = stats.common.mac_filter_discards;
p_common->gft_filter_drop = stats.common.gft_filter_drop;
p_common->tx_ucast_bytes = stats.common.tx_ucast_bytes; p_common->tx_ucast_bytes = stats.common.tx_ucast_bytes;
p_common->tx_mcast_bytes = stats.common.tx_mcast_bytes; p_common->tx_mcast_bytes = stats.common.tx_mcast_bytes;
......
...@@ -89,6 +89,9 @@ struct qed_ntuple_filter_params { ...@@ -89,6 +89,9 @@ struct qed_ntuple_filter_params {
/* true iff this filter is to be added. Else to be removed */ /* true iff this filter is to be added. Else to be removed */
bool b_is_add; bool b_is_add;
/* If flow needs to be dropped */
bool b_is_drop;
}; };
struct qed_dev_eth_info { struct qed_dev_eth_info {
......
...@@ -1129,6 +1129,7 @@ struct qed_eth_stats_common { ...@@ -1129,6 +1129,7 @@ struct qed_eth_stats_common {
u64 rx_bcast_pkts; u64 rx_bcast_pkts;
u64 mftag_filter_discards; u64 mftag_filter_discards;
u64 mac_filter_discards; u64 mac_filter_discards;
u64 gft_filter_drop;
u64 tx_ucast_bytes; u64 tx_ucast_bytes;
u64 tx_mcast_bytes; u64 tx_mcast_bytes;
u64 tx_bcast_bytes; u64 tx_bcast_bytes;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment