net/iavf: support rte flow with mask for FDIR
RFC PATCH v3 1/1 net/iavf: support rte flow with mask for FDIR
From: Ananth S <[email protected]>
This patch supports rte flow with mask for FDIR, including eth/ipv4/ipv6/tcp/udp flow items, where src/dst for ipv4/ipv6 and sport/dport for tcp/udp are realized by switch filter.
This patch additionally contains the fixes for the issues identified in the patch [21.11.5 v2].
This patch is based on DPDK v21.11.5 LTS [4e50ad4469f7c037e32de5aa3535d1cd25de0741], for customer cherry-pick.
--- drivers/common/iavf/virtchnl.h | 40 ++++- drivers/net/iavf/iavf_ethdev.c | 26 +++ drivers/net/iavf/iavf_fdir.c | 305 ++++++++++++++++++--------------- drivers/net/iavf/iavf_hash.c | 112 ++++++------ drivers/net/ice/ice_ethdev.c | 26 +++ lib/ethdev/rte_ethdev.h | 3 + 6 files changed, 320 insertions(+), 192 deletions(-)
drivers/common/iavf/virtchnl.h +38 -2
@@ -1482,6 +1482,8 @@ enum virtchnl_vfr_states { };#define VIRTCHNL_MAX_NUM_PROTO_HDRS 32 +#define VIRTCHNL_MAX_NUM_PROTO_HDRS_W_MSK 16 +#define VIRTCHNL_MAX_SIZE_RAW_PACKET 1024#define PROTO_HDR_SHIFT 5#define PROTO_HDR_FIELD_START (proto_hdr_type) \ (proto_hdr_type << PROTO_HDR_SHIFT)
@@ -1669,6 +1671,22 @@ struct virtchnl_proto_hdr {VIRTCHNL_CHECK_STRUCT_LEN (72 , virtchnl_proto_hdr); +struct virtchnl_proto_hdr_w_msk { +/* see enum virtchnl_proto_hdr_type */ +s32 type; +u32 pad; +/** +* binary buffer in network order for specific header type. +* For example, if type = VIRTCHNL_PROTO_HDR_IPV4, a IPv4 +* header is expected to be copied into the buffer. +*/ +u8 buffer_spec[64 ]; +/* binary buffer for bit-mask applied to specific header type */ +u8 buffer_mask[64 ]; +}; + +VIRTCHNL_CHECK_STRUCT_LEN (136 , virtchnl_proto_hdr_w_msk); +struct virtchnl_proto_hdrs {u8 tunnel_level;/**
@@ -1678,8 +1696,26 @@ struct virtchnl_proto_hdrs {* 2 - from the second inner layer * .... **/ -int count;/* the proto layers must < VIRTCHNL_MAX_NUM_PROTO_HDRS */ -struct virtchnl_proto_hdr proto_hdr[VIRTCHNL_MAX_NUM_PROTO_HDRS ]; +int count; +/** +* count must <= +* VIRTCHNL_MAX_NUM_PROTO_HDRS + VIRTCHNL_MAX_NUM_PROTO_HDRS_W_MSK +* count = 0 : select raw +* 1 < count <= VIRTCHNL_MAX_NUM_PROTO_HDRS : select proto_hdr +* count > VIRTCHNL_MAX_NUM_PROTO_HDRS : select proto_hdr_w_msk +* last valid index = count - VIRTCHNL_MAX_NUM_PROTO_HDRS +*/ +union { +struct virtchnl_proto_hdr + proto_hdr[VIRTCHNL_MAX_NUM_PROTO_HDRS ]; +struct virtchnl_proto_hdr_w_msk + proto_hdr_w_msk[VIRTCHNL_MAX_NUM_PROTO_HDRS_W_MSK ]; +struct { +u16 pkt_len; +u8 spec[VIRTCHNL_MAX_SIZE_RAW_PACKET ]; +u8 mask[VIRTCHNL_MAX_SIZE_RAW_PACKET ]; + } raw; + }; };VIRTCHNL_CHECK_STRUCT_LEN (2312 , virtchnl_proto_hdrs);
drivers/net/iavf/iavf_ethdev.c +26 -0
@@ -500,6 +500,11 @@ iavf_init_rss(struct iavf_adapter *adapter)uint16_t i, j, nb_q;int ret; +#ifdef RTE_ETHDEV_EXCL_Q +uint16_t q_index =0 ; +uint16_t excl_q =RSS_RETA_EXCL_Q_ID ; +#endif /* RTE_ETHDEV_EXCL_Q */ + rss_conf = &adapter->dev_data->dev_conf.rx_adv_conf.rss_conf; nb_q =RTE_MIN (adapter->dev_data->nb_rx_queues, vf->max_rss_qregion);
@@ -525,6 +530,27 @@ iavf_init_rss(struct iavf_adapter *adapter) j =0 ; vf->rss_lut[i] = j; } + +#ifdef RTE_ETHDEV_EXCL_Q +if (nb_q >1 ) { +if (excl_q > nb_q) { +/* if excl_q index is higher than the max_queue, assign default +* RSS LUT +*/ +for (i =0 ; i < vf->vf_res->rss_lut_size; i++) + vf->rss_lut[i] = i % nb_q; + + }else { +for (i =0 , q_index =0 ; i < vf->vf_res->rss_lut_size; i++, q_index++) { +/* Increment q_index to skip excl_q */ +if (q_index % nb_q == excl_q) + q_index++; + + vf->rss_lut[i] = q_index % (nb_q); + } + } + } +#endif /* RTE_ETHDEV_EXCL_Q */ /* send virtchnl ops to configure RSS */ ret =iavf_configure_rss_lut (adapter);if (ret)
drivers/net/iavf/iavf_fdir.c +171 -134
442 lines not on this page · raw message
drivers/net/iavf/iavf_hash.c +56 -56
274 lines not on this page · raw message
drivers/net/ice/ice_ethdev.c +26 -0
@@ -3197,6 +3197,11 @@ static int ice_init_rss(struct ice_pf *pf)bool is_safe_mode = pf->adapter->is_safe_mode;uint32_t reg; +#ifdef RTE_ETHDEV_EXCL_Q +uint16_t q_index =0 ; +uint16_t excl_q =RSS_RETA_EXCL_Q_ID ; +#endif /* RTE_ETHDEV_EXCL_Q */ + rss_conf = &dev_data->dev_conf.rx_adv_conf.rss_conf; nb_q = dev_data->nb_rx_queues; vsi->rss_key_size = ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE +
@@ -3253,6 +3258,27 @@ static int ice_init_rss(struct ice_pf *pf)for (i =0 ; i < vsi->rss_lut_size; i++) vsi->rss_lut[i] = i % nb_q; +#ifdef RTE_ETHDEV_EXCL_Q +if (nb_q >1 ) { +if (excl_q > nb_q) { +/* if excl_q index is higher than the max_queue, assign default +* RSS LUT +*/ +for (i =0 ; i < vsi->rss_lut_size; i++) + vsi->rss_lut[i] = i % nb_q; + + }else { +for (i =0 , q_index =0 ; i < vsi->rss_lut_size; i++, q_index++) { +/* Increment q_index to skip excl_q */ +if (q_index % nb_q == excl_q) + q_index++; + + vsi->rss_lut[i] = q_index % (nb_q); + } + } + } +#endif /* RTE_ETHDEV_EXCL_Q */ + lut_params.vsi_handle = vsi->idx; lut_params.lut_size = vsi->rss_lut_size; lut_params.lut_type =ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF ;
lib/ethdev/rte_ethdev.h +3 -0
@@ -160,6 +160,9 @@ extern "C" {#define RTE_ETHDEV_DEBUG_TX #endif +#define RTE_ETHDEV_EXCL_Q +#define RSS_RETA_EXCL_Q_ID 1 +#include <rte_compat.h> #include <rte_log.h> #include <rte_interrupts.h>
Signature · 1 line
2.31.1
Quoted 11 lines · On Mon, 25 Mar 2024 17:01:41 +0000 Ian Stokes <[email protected]> wrote:
From: Ananth S <[email protected]>
This patch supports rte flow with mask for FDIR, including eth/ipv4/ipv6/tcp/udp flow items, where src/dst for ipv4/ipv6 and sport/dport for tcp/udp are realized by switch filter.
This patch additionally contains the fixes for the issues identified in the patch [21.11.5 v2].
This patch is based on DPDK v21.11.5 LTS [
4e50ad4469f7c037e32de5aa3535d1cd25de0741], for customer cherry-pick.
If this is meant for stable then it should be sent to the stable maintainers. Or is it meant for upstream.