net/qede: implement flow drop action
Add support to configure drop action in rte_flow infrastructure and add counter for dropped packets due to this filter action "rx_gft_filter_drop". Also, update supported flows and actions in qede guide. Signed-off-by: Shahed Shaikh <shshaikh@marvell.com>
This commit is contained in:
parent
0aa3e7b925
commit
2c0784eb88
@ -39,6 +39,7 @@ Supported Features
|
||||
- GENEVE Tunneling offload
|
||||
- VXLAN Tunneling offload
|
||||
- MPLSoUDP Tx Tunneling offload
|
||||
- Generic flow API
|
||||
|
||||
Non-supported Features
|
||||
----------------------
|
||||
@ -137,6 +138,44 @@ Driver compilation and testing
|
||||
Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
|
||||
for details.
|
||||
|
||||
RTE Flow Support
|
||||
----------------
|
||||
|
||||
QLogic FastLinQ QL4xxxx NICs has support for the following patterns and
|
||||
actions.
|
||||
|
||||
Patterns:
|
||||
|
||||
.. _table_qede_supported_flow_item_types:
|
||||
|
||||
.. table:: Item types
|
||||
|
||||
+----+--------------------------------+
|
||||
| # | Pattern Type |
|
||||
+====+================================+
|
||||
| 1 | RTE_FLOW_ITEM_TYPE_IPV4 |
|
||||
+----+--------------------------------+
|
||||
| 2 | RTE_FLOW_ITEM_TYPE_IPV6 |
|
||||
+----+--------------------------------+
|
||||
| 3 | RTE_FLOW_ITEM_TYPE_UDP |
|
||||
+----+--------------------------------+
|
||||
| 4 | RTE_FLOW_ITEM_TYPE_TCP |
|
||||
+----+--------------------------------+
|
||||
|
||||
Actions:
|
||||
|
||||
.. _table_qede_supported_ingress_action_types:
|
||||
|
||||
.. table:: Ingress action types
|
||||
|
||||
+----+--------------------------------+
|
||||
| # | Action Type |
|
||||
+====+================================+
|
||||
| 1 | RTE_FLOW_ACTION_TYPE_QUEUE |
|
||||
+----+--------------------------------+
|
||||
| 2 | RTE_FLOW_ACTION_TYPE_DROP |
|
||||
+----+--------------------------------+
|
||||
|
||||
SR-IOV: Prerequisites and Sample Application Notes
|
||||
--------------------------------------------------
|
||||
|
||||
|
@ -334,6 +334,7 @@ struct ecore_eth_stats_common {
|
||||
u64 rx_bcast_pkts;
|
||||
u64 mftag_filter_discards;
|
||||
u64 mac_filter_discards;
|
||||
u64 gft_filter_drop;
|
||||
u64 tx_ucast_bytes;
|
||||
u64 tx_mcast_bytes;
|
||||
u64 tx_bcast_bytes;
|
||||
|
@ -1782,6 +1782,8 @@ static void __ecore_get_vport_tstats(struct ecore_hwfn *p_hwfn,
|
||||
HILO_64_REGPAIR(tstats.mftag_filter_discard);
|
||||
p_stats->common.mac_filter_discards +=
|
||||
HILO_64_REGPAIR(tstats.eth_mac_filter_discard);
|
||||
p_stats->common.gft_filter_drop +=
|
||||
HILO_64_REGPAIR(tstats.eth_gft_drop_pkt);
|
||||
}
|
||||
|
||||
static void __ecore_get_vport_ustats_addrlen(struct ecore_hwfn *p_hwfn,
|
||||
@ -2140,9 +2142,7 @@ void ecore_arfs_mode_configure(struct ecore_hwfn *p_hwfn,
|
||||
enum _ecore_status_t
|
||||
ecore_configure_rfs_ntuple_filter(struct ecore_hwfn *p_hwfn,
|
||||
struct ecore_spq_comp_cb *p_cb,
|
||||
dma_addr_t p_addr, u16 length,
|
||||
u16 qid, u8 vport_id,
|
||||
bool b_is_add)
|
||||
struct ecore_ntuple_filter_params *p_params)
|
||||
{
|
||||
struct rx_update_gft_filter_data *p_ramrod = OSAL_NULL;
|
||||
struct ecore_spq_entry *p_ent = OSAL_NULL;
|
||||
@ -2151,14 +2151,6 @@ ecore_configure_rfs_ntuple_filter(struct ecore_hwfn *p_hwfn,
|
||||
u8 abs_vport_id = 0;
|
||||
enum _ecore_status_t rc = ECORE_NOTIMPL;
|
||||
|
||||
rc = ecore_fw_vport(p_hwfn, vport_id, &abs_vport_id);
|
||||
if (rc != ECORE_SUCCESS)
|
||||
return rc;
|
||||
|
||||
rc = ecore_fw_l2_queue(p_hwfn, qid, &abs_rx_q_id);
|
||||
if (rc != ECORE_SUCCESS)
|
||||
return rc;
|
||||
|
||||
/* Get SPQ entry */
|
||||
OSAL_MEMSET(&init_data, 0, sizeof(init_data));
|
||||
init_data.cid = ecore_spq_get_cid(p_hwfn);
|
||||
@ -2180,27 +2172,41 @@ ecore_configure_rfs_ntuple_filter(struct ecore_hwfn *p_hwfn,
|
||||
|
||||
p_ramrod = &p_ent->ramrod.rx_update_gft;
|
||||
|
||||
DMA_REGPAIR_LE(p_ramrod->pkt_hdr_addr, p_addr);
|
||||
p_ramrod->pkt_hdr_length = OSAL_CPU_TO_LE16(length);
|
||||
DMA_REGPAIR_LE(p_ramrod->pkt_hdr_addr, p_params->addr);
|
||||
p_ramrod->pkt_hdr_length = OSAL_CPU_TO_LE16(p_params->length);
|
||||
|
||||
p_ramrod->action_icid_valid = 0;
|
||||
p_ramrod->action_icid = 0;
|
||||
if (p_params->b_is_drop) {
|
||||
p_ramrod->vport_id = OSAL_CPU_TO_LE16(ETH_GFT_TRASHCAN_VPORT);
|
||||
} else {
|
||||
rc = ecore_fw_vport(p_hwfn, p_params->vport_id,
|
||||
&abs_vport_id);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
p_ramrod->rx_qid_valid = 1;
|
||||
p_ramrod->rx_qid = OSAL_CPU_TO_LE16(abs_rx_q_id);
|
||||
if (p_params->qid != ECORE_RFS_NTUPLE_QID_RSS) {
|
||||
rc = ecore_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 = OSAL_CPU_TO_LE16(abs_rx_q_id);
|
||||
}
|
||||
|
||||
p_ramrod->vport_id = OSAL_CPU_TO_LE16((u16)abs_vport_id);
|
||||
}
|
||||
|
||||
p_ramrod->flow_id_valid = 0;
|
||||
p_ramrod->flow_id = 0;
|
||||
|
||||
p_ramrod->vport_id = OSAL_CPU_TO_LE16((u16)abs_vport_id);
|
||||
p_ramrod->filter_action = b_is_add ? GFT_ADD_FILTER
|
||||
: GFT_DELETE_FILTER;
|
||||
p_ramrod->filter_action = p_params->b_is_add ? GFT_ADD_FILTER
|
||||
: GFT_DELETE_FILTER;
|
||||
|
||||
DP_VERBOSE(p_hwfn, ECORE_MSG_SP,
|
||||
"V[%0x], Q[%04x] - %s filter from 0x%lx [length %04xb]\n",
|
||||
abs_vport_id, abs_rx_q_id,
|
||||
b_is_add ? "Adding" : "Removing",
|
||||
(unsigned long)p_addr, length);
|
||||
p_params->b_is_add ? "Adding" : "Removing",
|
||||
(unsigned long)p_params->addr, p_params->length);
|
||||
|
||||
return ecore_spq_post(p_hwfn, p_ent, OSAL_NULL);
|
||||
}
|
||||
|
@ -448,6 +448,31 @@ void ecore_arfs_mode_configure(struct ecore_hwfn *p_hwfn,
|
||||
struct ecore_ptt *p_ptt,
|
||||
struct ecore_arfs_config_params *p_cfg_params);
|
||||
|
||||
struct ecore_ntuple_filter_params {
|
||||
/* Physically mapped address containing header of buffer to be used
|
||||
* as filter.
|
||||
*/
|
||||
dma_addr_t addr;
|
||||
|
||||
/* Length of header in bytes */
|
||||
u16 length;
|
||||
|
||||
/* Relative queue-id to receive classified packet */
|
||||
#define ECORE_RFS_NTUPLE_QID_RSS ((u16)-1)
|
||||
u16 qid;
|
||||
|
||||
/* Identifier can either be according to vport-id or vfid */
|
||||
bool b_is_vf;
|
||||
u8 vport_id;
|
||||
u8 vf_id;
|
||||
|
||||
/* true if this filter is to be added. Else to be removed */
|
||||
bool b_is_add;
|
||||
|
||||
/* If packet needs to be dropped */
|
||||
bool b_is_drop;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief - ecore_configure_rfs_ntuple_filter
|
||||
*
|
||||
@ -457,22 +482,12 @@ void ecore_arfs_mode_configure(struct ecore_hwfn *p_hwfn,
|
||||
* @params p_cb Used for ECORE_SPQ_MODE_CB,where client would initialize
|
||||
* it with cookie and callback function address, if not
|
||||
* using this mode then client must pass NULL.
|
||||
* @params p_addr p_addr is an actual packet header that needs to be
|
||||
* filter. It has to mapped with IO to read prior to
|
||||
* calling this, [contains 4 tuples- src ip, dest ip,
|
||||
* src port, dest port].
|
||||
* @params length length of p_addr header up to past the transport header.
|
||||
* @params qid receive packet will be directed to this queue.
|
||||
* @params vport_id
|
||||
* @params b_is_add flag to add or remove filter.
|
||||
*
|
||||
* @params p_params
|
||||
*/
|
||||
enum _ecore_status_t
|
||||
ecore_configure_rfs_ntuple_filter(struct ecore_hwfn *p_hwfn,
|
||||
struct ecore_spq_comp_cb *p_cb,
|
||||
dma_addr_t p_addr, u16 length,
|
||||
u16 qid, u8 vport_id,
|
||||
bool b_is_add);
|
||||
struct ecore_ntuple_filter_params *p_params);
|
||||
|
||||
/**
|
||||
* @brief - ecore_update_eth_rss_ind_table_entry
|
||||
|
@ -125,6 +125,8 @@ static const struct rte_qede_xstats_name_off qede_xstats_strings[] = {
|
||||
offsetof(struct ecore_eth_stats_common, mftag_filter_discards)},
|
||||
{"rx_mac_filter_discards",
|
||||
offsetof(struct ecore_eth_stats_common, mac_filter_discards)},
|
||||
{"rx_gft_filter_drop",
|
||||
offsetof(struct ecore_eth_stats_common, gft_filter_drop)},
|
||||
{"rx_hw_buffer_truncates",
|
||||
offsetof(struct ecore_eth_stats_common, brb_truncates)},
|
||||
{"rx_hw_buffer_discards",
|
||||
|
@ -179,6 +179,7 @@ struct qede_arfs_entry {
|
||||
uint32_t soft_id; /* unused for now */
|
||||
uint16_t pkt_len; /* actual packet length to match */
|
||||
uint16_t rx_queue; /* queue to be steered to */
|
||||
bool is_drop; /* drop action */
|
||||
const struct rte_memzone *mz; /* mz used to hold L2 frame */
|
||||
struct qede_arfs_tuple tuple;
|
||||
SLIST_ENTRY(qede_arfs_entry) list;
|
||||
|
@ -272,6 +272,7 @@ qede_config_arfs_filter(struct rte_eth_dev *eth_dev,
|
||||
{
|
||||
struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
|
||||
struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
|
||||
struct ecore_ntuple_filter_params params;
|
||||
char mz_name[RTE_MEMZONE_NAMESIZE] = {0};
|
||||
struct qede_arfs_entry *tmp = NULL;
|
||||
const struct rte_memzone *mz;
|
||||
@ -344,12 +345,18 @@ qede_config_arfs_filter(struct rte_eth_dev *eth_dev,
|
||||
ecore_arfs_mode_configure(p_hwfn, p_hwfn->p_arfs_ptt,
|
||||
&qdev->arfs_info.arfs);
|
||||
}
|
||||
|
||||
memset(¶ms, 0, sizeof(params));
|
||||
params.addr = (dma_addr_t)mz->iova;
|
||||
params.length = pkt_len;
|
||||
params.qid = arfs->rx_queue;
|
||||
params.vport_id = 0;
|
||||
params.b_is_add = add;
|
||||
params.b_is_drop = arfs->is_drop;
|
||||
|
||||
/* configure filter with ECORE_SPQ_MODE_EBLOCK */
|
||||
rc = ecore_configure_rfs_ntuple_filter(p_hwfn, NULL,
|
||||
(dma_addr_t)mz->iova,
|
||||
pkt_len,
|
||||
arfs->rx_queue,
|
||||
0, add);
|
||||
¶ms);
|
||||
if (rc == ECORE_SUCCESS) {
|
||||
if (add) {
|
||||
arfs->pkt_len = pkt_len;
|
||||
@ -1371,12 +1378,15 @@ qede_flow_parse_actions(struct rte_eth_dev *dev,
|
||||
flow->entry.rx_queue = queue->index;
|
||||
|
||||
break;
|
||||
|
||||
case RTE_FLOW_ACTION_TYPE_DROP:
|
||||
if (flow)
|
||||
flow->entry.is_drop = true;
|
||||
break;
|
||||
default:
|
||||
rte_flow_error_set(error, ENOTSUP,
|
||||
RTE_FLOW_ERROR_TYPE_ACTION,
|
||||
actions,
|
||||
"Action is not supported - only ACTION_TYPE_QUEUE supported");
|
||||
"Action is not supported - only ACTION_TYPE_QUEUE and ACTION_TYPE_DROP supported");
|
||||
return -rte_errno;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user