net/ice: add ice Flow Director driver
Subsystems (2)
v3 cover net/ice: add ice Flow Director driver
This patch series adds Flow Director support for Intel Ethernet Controller E810 series using RTE_FLOW
- Patch 01-02 are FDIR init,teardown and configuration
- Remaining patches are FDIR RTE_FLOW enablement
The patchset depends on:
http://patchwork.dpdk.org/project/dpdk/list/?series=6420
---
v3:
* Get flow id in flexible descriptor
* Add vxlan tunnel rule support
v2:
* Move to flexible descriptor.
* Distinguish tunnel and non-tunnel rule.
* Add uninit function for fdir engine.
* Fix coding style.
* Change patch organization.
* Add release notes.
Beilei Xing (2):
net/ice: enable flow director engine
net/ice: configure HW FDIR rule
Yahui Cao (6):
net/ice: add FDIR create and destroy
net/ice: enable FDIR queue group
net/ice: add FDIR counter resource init/release
net/ice: add FDIR counter support
net/ice: reject duplicate flow for FDIR
net/ice: add FDIR vxlan tunnel support
doc/guides/rel_notes/release_19_11.rst | 1 + drivers/net/ice/Makefile | 1 + drivers/net/ice/ice_ethdev.c | 107 +- drivers/net/ice/ice_ethdev.h | 88 ++ drivers/net/ice/ice_fdir_filter.c | 1630 ++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.c | 406 ++++++ drivers/net/ice/ice_rxtx.h | 9 + drivers/net/ice/meson.build | 3 +- 8 files changed, 2225 insertions(+), 20 deletions(-) create mode 100644 drivers/net/ice/ice_fdir_filter.c
Signature · 1 line
2.17.1
PATCH v3 1/8 net/ice: enable flow director engine
From: Beilei Xing <[email protected]>
Enable flow director engine, including initialization and teardown.
- Control VSI create and release.
- Queue pair allocated, set up and release.
- Programming packet create and release.
- FDIR profile create and release.
--- drivers/net/ice/Makefile | 1 + drivers/net/ice/ice_ethdev.c | 107 ++++++-- drivers/net/ice/ice_ethdev.h | 19 ++ drivers/net/ice/ice_fdir_filter.c | 225 +++++++++++++++++ drivers/net/ice/ice_rxtx.c | 406 ++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 9 + drivers/net/ice/meson.build | 3 +- 7 files changed, 750 insertions(+), 20 deletions(-) create mode 100644 drivers/net/ice/ice_fdir_filter.c
drivers/net/ice/Makefile +1 -0
@@ -62,6 +62,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_rxtx_vec_sse.c endif SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_switch_filter.c +SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_fdir_filter.c ifeq ($(findstring RTE_MACHINE_CPUFLAG_AVX2,$(CFLAGS)),RTE_MACHINE_CPUFLAG_AVX2) CC_AVX2_SUPPORT=1 else
drivers/net/ice/ice_ethdev.c +88 -19
188 lines not on this page · raw message
drivers/net/ice/ice_ethdev.h +19 -0
@@ -247,6 +247,17 @@ TAILQ_HEAD(ice_flow_list, rte_flow);struct ice_flow_parser_node ;TAILQ_HEAD (ice_parser_list, ice_flow_parser_node); +/** +* A structure used to define fields of a FDIR related info. +*/ +struct ice_fdir_info { +struct ice_vsi *fdir_vsi;/* pointer to fdir VSI structure */ +struct ice_tx_queue *txq; +struct ice_rx_queue *rxq; +void *prg_pkt;/* memory for fdir program packet */ +uint64_t dma_addr;/* physic address of packet memory*/ +}; +struct ice_pf {struct ice_adapter *adapter;/* The adapter this PF associate to */ struct ice_vsi *main_vsi;/* pointer to main VSI structure */
@@ -267,6 +278,9 @@ struct ice_pf {uint16_t lan_nb_qps;/* The number of queue pairs of LAN */ uint16_t base_queue;/* The base queue pairs index in the device */ uint8_t *proto_xtr;/* Protocol extraction type for all queues */ +uint16_t fdir_nb_qps;/* The number of queue pairs of Flow Director */ +uint16_t fdir_qp_offset; +struct ice_fdir_info fdir;/* flow director info */ struct ice_hw_port_stats stats_offset;struct ice_hw_port_stats stats;/* internal packet statistics, it should be excluded from the total */
@@ -350,6 +364,11 @@ struct ice_vsi_vlan_pvid_info {#define ICE_PF_TO_ETH_DEV (pf) \ (((struct ice_pf *)pf)->adapter->eth_dev) +struct ice_vsi * +ice_setup_vsi (struct ice_pf *pf,enum ice_vsi_type type); +int +ice_release_vsi (struct ice_vsi *vsi); +static inline int ice_align_floor (int n) {
drivers/net/ice/ice_fdir_filter.c new file +225 -0
225 lines not on this page · raw message
drivers/net/ice/ice_rxtx.c +406 -0
433 lines not on this page · raw message
drivers/net/ice/ice_rxtx.h +9 -0
@@ -37,6 +37,8 @@#define ICE_TX_MAX_FREE_BUF_SZ 64#define ICE_DESCS_PER_LOOP 4 +#define ICE_FDIR_PKT_LEN 512 +typedef void (*ice_rx_release_mbufs_t )(struct ice_rx_queue *rxq);typedef void (*ice_tx_release_mbufs_t )(struct ice_tx_queue *txq);
@@ -149,10 +151,16 @@ int ice_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);int ice_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id);int ice_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id);int ice_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id); +int ice_fdir_rx_queue_start (struct rte_eth_dev *dev,uint16_t rx_queue_id); +int ice_fdir_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id); +int ice_fdir_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id); +int ice_fdir_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id);void ice_rx_queue_release (void *rxq);void ice_tx_queue_release (void *txq);void ice_clear_queues (struct rte_eth_dev *dev);void ice_free_queues (struct rte_eth_dev *dev); +int ice_fdir_setup_tx_resources (struct ice_pf *pf); +int ice_fdir_setup_rx_resources (struct ice_pf *pf);uint16_t ice_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); uint16_t ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
@@ -190,4 +198,5 @@ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue, uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx2 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +int ice_fdir_programming (struct ice_pf *pf,struct ice_fltr_desc *fdir_desc);#endif /* _ICE_RXTX_H_ */
drivers/net/ice/meson.build +2 -1
@@ -10,7 +10,8 @@ sources = files( 'ice_ethdev.c', 'ice_rxtx.c', 'ice_switch_filter.c', - 'ice_generic_flow.c' + 'ice_generic_flow.c', + 'ice_fdir_filter.c' ) deps += ['hash']
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 1/8] net/ice: enable flow director engine
Hi Yahui,
two general comments:
1.Please make old versions of patches Superseded to facilitate review.
2. the two occurrences of rte_wmb can be removed, a similar patch has been reviewed by Qi. http://patches.dpdk.org/patch/59278/
/Gavin
Quoted 20 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Yahui Cao
Sent: Wednesday, September 25, 2019 5:53 AM
To: Qiming Yang <[email protected]>; Wenzhuo Lu <[email protected]>
Cc: [email protected]; Qi Zhang <[email protected]>; Xiaolong Ye <[email protected]>; Beilei Xing <[email protected]>; Yahui Cao <[email protected]>
Subject: [dpdk-dev] [PATCH v3 1/8] net/ice: enable flow director engineFrom: Beilei Xing <[email protected]>
Enable flow director engine, including initialization and teardown.
- Control VSI create and release.
- Queue pair allocated, set up and release.
- Programming packet create and release.
- FDIR profile create and release.Signed-off-by Beilei Xing <[email protected]>---
Re: [dpdk-dev] [PATCH v3 1/8] net/ice: enable flow director engine
Quoted 10 lines
-----Original Message-----
From: Gavin Hu (Arm Technology China) [mailto:[email protected]]
Sent: Wednesday, September 25, 2019 11:20 AM
To: Cao, Yahui <[email protected]>; Yang, Qiming <[email protected]>; Lu, Wenzhuo <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>; Ye, Xiaolong <[email protected]>; Xing, Beilei <[email protected]>; nd <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 1/8] net/ice: enable flow director engine
Quoted 6 lines
Hi Yahui,
two general comments:
1.Please make old versions of patches Superseded to facilitate review.
2. the two occurrences ofrte_wmbcan be removed, a similar patch has been reviewed by Qi. http://patches.dpdk.org/patch/59278/
Thanks for the comments, will be updated in v4.
Beilei
Quoted 24 lines
/Gavin
Quoted 21 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Yahui Cao
Sent: Wednesday, September 25, 2019 5:53 AM
To: Qiming Yang <[email protected]>; Wenzhuo Lu <[email protected]>
Cc: [email protected]; Qi Zhang <[email protected]>; Xiaolong Ye <[email protected]>; Beilei Xing <[email protected]>; Yahui Cao <[email protected]>
Subject: [dpdk-dev] [PATCH v3 1/8] net/ice: enable flow director engineFrom: Beilei Xing <[email protected]>
Enable flow director engine, including initialization and teardown.
- Control VSI create and release.
- Queue pair allocated, set up and release.
- Programming packet create and release.
- FDIR profile create and release.Signed-off-by Beilei Xing <[email protected]>---
Re: [dpdk-dev] [PATCH v3 1/8] net/ice: enable flow director engine
In reply to Gavin Hu (Arm Technology China)Thanks for the comments. Old version patches' states are changed.
-----Original Message-----
From: Gavin Hu (Arm Technology China) [mailto:[email protected]]
Sent: Wednesday, September 25, 2019 11:20 AM
To: Cao, Yahui <[email protected]>; Yang, Qiming <[email protected]>; Lu, Wenzhuo <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>; Ye, Xiaolong <[email protected]>; Xing, Beilei <[email protected]>; nd <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 1/8] net/ice: enable flow director engine
Hi Yahui,
two general comments:
1.Please make old versions of patches Superseded to facilitate review.
2. the two occurrences of rte_wmb can be removed, a similar patch has been reviewed by Qi. http://patches.dpdk.org/patch/59278/
/Gavin
Quoted 21 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Yahui Cao
Sent: Wednesday, September 25, 2019 5:53 AM
To: Qiming Yang <[email protected]>; Wenzhuo Lu <[email protected]>
Cc: [email protected]; Qi Zhang <[email protected]>; Xiaolong Ye <[email protected]>; Beilei Xing <[email protected]>; Yahui Cao <[email protected]>
Subject: [dpdk-dev] [PATCH v3 1/8] net/ice: enable flow director engineFrom: Beilei Xing <[email protected]>
Enable flow director engine, including initialization and teardown.
- Control VSI create and release.
- Queue pair allocated, set up and release.
- Programming packet create and release.
- FDIR profile create and release.Signed-off-by Beilei Xing <[email protected]>---
PATCH v3 2/8 net/ice: configure HW FDIR rule
In reply to Yahui CaoFrom: Beilei Xing <[email protected]>
This patch adds a HW FDIR rule to the FDIR HW table without adding a FDIR filter.
--- drivers/net/ice/ice_fdir_filter.c | 239 ++++++++++++++++++++++++++++++ 1 file changed, 239 insertions(+)
drivers/net/ice/ice_fdir_filter.c +239 -0
@@ -197,6 +197,245 @@ ice_fdir_teardown(struct ice_pf *pf)ice_fdir_prof_free (hw); } +static void +ice_fdir_prof_rm (struct ice_hw *hw,enum ice_fltr_ptype ptype,bool is_tunnel) +{ +struct ice_fd_hw_prof *hw_prof; +uint64_t prof_id; +uint16_t vsi_num; +int i; + +if (!hw->fdir_prof || !hw->fdir_prof[ptype]) +return ; + + hw_prof = hw->fdir_prof[ptype]; + + prof_id = ptype + is_tunnel *ICE_FLTR_PTYPE_MAX ; +for (i =0 ; i < hw_prof->cnt; i++) { +if (hw_prof->entry_h[i][is_tunnel]) { + vsi_num =ice_get_hw_vsi_num (hw, + hw_prof->vsi_h[i]); +ice_rem_prof_id_flow (hw,ICE_BLK_FD , + vsi_num, ptype); +ice_flow_rem_entry (hw, + hw_prof->entry_h[i][is_tunnel]); + hw_prof->entry_h[i][is_tunnel] =0 ; + } + } +ice_flow_rem_prof (hw,ICE_BLK_FD , prof_id); +rte_free (hw_prof->fdir_seg[is_tunnel]); + hw_prof->fdir_seg[is_tunnel] =NULL ; + +for (i =0 ; i < hw_prof->cnt; i++) + hw_prof->vsi_h[i] =0 ; + hw_prof->cnt =0 ; +} + +static int +ice_fdir_hw_tbl_conf (struct ice_pf *pf,struct ice_vsi *vsi, +struct ice_vsi *ctrl_vsi, +struct ice_flow_seg_info *seg, +enum ice_fltr_ptype ptype, +bool is_tunnel) +{ +struct ice_hw *hw =ICE_PF_TO_HW (pf); +enum ice_flow_dir dir =ICE_FLOW_RX ; +struct ice_flow_seg_info *ori_seg; +struct ice_fd_hw_prof *hw_prof; +struct ice_flow_prof *prof; +uint64_t entry_1 =0 ; +uint64_t entry_2 =0 ; +uint16_t vsi_num; +int ret; +uint64_t prof_id; + +if (!hw->fdir_prof) { + hw->fdir_prof = (struct ice_fd_hw_prof **) +ice_malloc (hw,ICE_FLTR_PTYPE_MAX * +sizeof (*hw->fdir_prof)); +if (!hw->fdir_prof) +return -ENOMEM ; + } +if (!hw->fdir_prof[ptype]) { + hw->fdir_prof[ptype] = (struct ice_fd_hw_prof *) +ice_malloc (hw,sizeof (**hw->fdir_prof)); +if (!hw->fdir_prof[ptype]) +return -ENOMEM ; + } + + hw_prof = hw->fdir_prof[ptype]; + ori_seg = hw_prof->fdir_seg[is_tunnel]; +if (ori_seg) { +if (!memcmp (ori_seg, seg,sizeof (*seg))) +return -EAGAIN ; +if (hw->fdir_fltr_cnt[ptype]) +return -EINVAL ; + +ice_fdir_prof_rm (hw, ptype, is_tunnel); + } + + prof_id = ptype + is_tunnel *ICE_FLTR_PTYPE_MAX ; + ret =ice_flow_add_prof (hw,ICE_BLK_FD , dir, prof_id, seg, + (is_tunnel) ?2 :1 ,NULL ,0 , &prof); +if (ret) +return ret; + ret =ice_flow_add_entry (hw,ICE_BLK_FD , prof_id, vsi->idx, + vsi->idx,ICE_FLOW_PRIO_NORMAL , + seg,NULL ,0 , &entry_1); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to add main VSI flow entry for %d." , + ptype); + goto err_add_prof; + } + ret =ice_flow_add_entry (hw,ICE_BLK_FD , prof_id, vsi->idx, + ctrl_vsi->idx,ICE_FLOW_PRIO_NORMAL , + seg,NULL ,0 , &entry_2); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to add control VSI flow entry for %d." , + ptype); + goto err_add_entry; + } + + hw_prof->cnt =0 ; + hw_prof->fdir_seg[is_tunnel] = seg; + hw_prof->vsi_h[hw_prof->cnt] = vsi->idx; + hw_prof->entry_h[hw_prof->cnt++][is_tunnel] = entry_1; + hw_prof->vsi_h[hw_prof->cnt] = ctrl_vsi->idx; + hw_prof->entry_h[hw_prof->cnt++][is_tunnel] = entry_2; + +return ret; + +err_add_entry: + vsi_num =ice_get_hw_vsi_num (hw, vsi->idx); +ice_rem_prof_id_flow (hw,ICE_BLK_FD , vsi_num, prof_id); +ice_flow_rem_entry (hw, entry_1); +err_add_prof: +ice_flow_rem_prof (hw,ICE_BLK_FD , prof_id); + +return ret; +} + +static void +ice_fdir_input_set_parse (uint64_t inset,enum ice_flow_field *field) +{ +uint32_t i, j; + +struct ice_inset_map { +uint64_t inset; +enum ice_flow_field fld; + }; +static const struct ice_inset_map ice_inset_map[] = { + {ICE_INSET_IPV4_SRC ,ICE_FLOW_FIELD_IDX_IPV4_SA }, + {ICE_INSET_IPV4_DST ,ICE_FLOW_FIELD_IDX_IPV4_DA }, + {ICE_INSET_IPV6_SRC ,ICE_FLOW_FIELD_IDX_IPV6_SA }, + {ICE_INSET_IPV6_DST ,ICE_FLOW_FIELD_IDX_IPV6_DA }, + {ICE_INSET_TCP_SRC_PORT ,ICE_FLOW_FIELD_IDX_TCP_SRC_PORT }, + {ICE_INSET_TCP_DST_PORT ,ICE_FLOW_FIELD_IDX_TCP_DST_PORT }, + {ICE_INSET_UDP_SRC_PORT ,ICE_FLOW_FIELD_IDX_UDP_SRC_PORT }, + {ICE_INSET_UDP_DST_PORT ,ICE_FLOW_FIELD_IDX_UDP_DST_PORT }, + {ICE_INSET_SCTP_SRC_PORT ,ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT }, + {ICE_INSET_SCTP_DST_PORT ,ICE_FLOW_FIELD_IDX_SCTP_DST_PORT }, + }; + +for (i =0 , j =0 ; i <RTE_DIM (ice_inset_map); i++) { +if (inset & ice_inset_map[i].inset) + field[j++] = ice_inset_map[i].fld; + } +} + +static int __rte_unused +ice_fdir_input_set_conf (struct ice_pf *pf,enum ice_fltr_ptype flow, +uint64_t input_set,bool is_tunnel) +{ +struct ice_flow_seg_info *seg, *seg_tun; +enum ice_flow_field field[ICE_FLOW_FIELD_IDX_MAX ]; +int i, ret; + +if (!input_set) +return -EINVAL ; + + seg = (struct ice_flow_seg_info *) +ice_malloc (hw,sizeof (*seg)); +if (!seg) { +PMD_DRV_LOG (ERR ,"No memory can be allocated" ); +return -ENOMEM ; + } + +for (i =0 ; i <ICE_FLOW_FIELD_IDX_MAX ; i++) + field[i] =ICE_FLOW_FIELD_IDX_MAX ; +ice_fdir_input_set_parse (input_set, field); + +switch (flow) { +case ICE_FLTR_PTYPE_NONF_IPV4_UDP : +ICE_FLOW_SET_HDRS (seg,ICE_FLOW_SEG_HDR_UDP | +ICE_FLOW_SEG_HDR_IPV4 ); +break ; +case ICE_FLTR_PTYPE_NONF_IPV4_TCP : +ICE_FLOW_SET_HDRS (seg,ICE_FLOW_SEG_HDR_TCP | +ICE_FLOW_SEG_HDR_IPV4 ); +break ; +case ICE_FLTR_PTYPE_NONF_IPV4_SCTP : +ICE_FLOW_SET_HDRS (seg,ICE_FLOW_SEG_HDR_SCTP | +ICE_FLOW_SEG_HDR_IPV4 ); +break ; +case ICE_FLTR_PTYPE_NONF_IPV4_OTHER : +ICE_FLOW_SET_HDRS (seg,ICE_FLOW_SEG_HDR_IPV4 ); +break ; +case ICE_FLTR_PTYPE_NONF_IPV6_UDP : +ICE_FLOW_SET_HDRS (seg,ICE_FLOW_SEG_HDR_UDP | +ICE_FLOW_SEG_HDR_IPV6 ); +break ; +case ICE_FLTR_PTYPE_NONF_IPV6_TCP : +ICE_FLOW_SET_HDRS (seg,ICE_FLOW_SEG_HDR_TCP | +ICE_FLOW_SEG_HDR_IPV6 ); +break ; +case ICE_FLTR_PTYPE_NONF_IPV6_SCTP : +ICE_FLOW_SET_HDRS (seg,ICE_FLOW_SEG_HDR_SCTP | +ICE_FLOW_SEG_HDR_IPV6 ); +break ; +case ICE_FLTR_PTYPE_NONF_IPV6_OTHER : +ICE_FLOW_SET_HDRS (seg,ICE_FLOW_SEG_HDR_IPV6 ); +break ; +default : +PMD_DRV_LOG (ERR ,"not supported filter type." ); +break ; + } + +for (i =0 ; field[i] !=ICE_FLOW_FIELD_IDX_MAX ; i++) { +ice_flow_set_fld (seg, field[i], +ICE_FLOW_FLD_OFF_INVAL , +ICE_FLOW_FLD_OFF_INVAL , +ICE_FLOW_FLD_OFF_INVAL , false); + } + +if (!is_tunnel) { + ret =ice_fdir_hw_tbl_conf (pf, pf->main_vsi, pf->fdir.fdir_vsi, + seg, flow, false); + }else { + seg_tun = (struct ice_flow_seg_info *) +ice_malloc (hw,sizeof (*seg) *ICE_FD_HW_SEG_MAX ); +if (!seg_tun) { +PMD_DRV_LOG (ERR ,"No memory can be allocated" ); +rte_free (seg); +return -ENOMEM ; + } +rte_memcpy (&seg_tun[1 ], seg,sizeof (*seg)); + ret =ice_fdir_hw_tbl_conf (pf, pf->main_vsi, pf->fdir.fdir_vsi, + seg_tun, flow, true); + } + +if (!ret) { +return ret; + }else if (ret <0 ) { +rte_free (seg); +if (is_tunnel) +rte_free (seg_tun); +return (ret == -EAGAIN ) ?0 : ret; + }else { +return ret; + } +} +static int ice_fdir_init (struct ice_adapter *ad) {
Signature · 1 line
2.17.1
PATCH v3 3/8 net/ice: add FDIR create and destroy
In reply to Yahui CaoAdd ice_create_fdir_filter to create a rule. If a flow is matched by flow director filter, filter rule will be set to HW. For now common pattern and queue/passthru/drop/mark actions are supported.
--- doc/guides/rel_notes/release_19_11.rst | 1 + drivers/net/ice/ice_ethdev.h | 6 + drivers/net/ice/ice_fdir_filter.c | 582 ++++++++++++++++++++++++- 3 files changed, 587 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_19_11.rst +1 -0
@@ -65,6 +65,7 @@ New Features Updated the Intel ice driver with new features and improvements, including: * Supported device-specific DDP package loading. + * Supported Flow Director filter based on generic filter framework. * Generic filter enhancement - Supported pipeline mode. - Supported new packet type like PPPoE for switch filter.
drivers/net/ice/ice_ethdev.h +6 -0
@@ -247,6 +247,11 @@ TAILQ_HEAD(ice_flow_list, rte_flow);struct ice_flow_parser_node ;TAILQ_HEAD (ice_parser_list, ice_flow_parser_node); +struct ice_fdir_filter_conf { +struct ice_fdir_fltr input; +uint64_t input_set; +}; +/** * A structure used to define fields of a FDIR related info. */
@@ -256,6 +261,7 @@ struct ice_fdir_info {struct ice_rx_queue *rxq;void *prg_pkt;/* memory for fdir program packet */ uint64_t dma_addr;/* physic address of packet memory*/ +struct ice_fdir_filter_conf conf; };struct ice_pf {
drivers/net/ice/ice_fdir_filter.c +580 -2
626 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 4/8 net/ice: enable FDIR queue group
In reply to Yahui CaoFDIR can send packet to a group of queues and distruibte it by RSS.
--- drivers/net/ice/ice_fdir_filter.c | 68 +++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)
drivers/net/ice/ice_fdir_filter.c +68 -0
@@ -10,6 +10,8 @@#define ICE_FDIR_IPV6_TC_OFFSET 20#define ICE_IPV6_TC_MASK (0xFF << ICE_FDIR_IPV6_TC_OFFSET) +#define ICE_FDIR_MAX_QREGION_SIZE 128 +#define ICE_FDIR_INSET_ETH_IPV4 (\ ICE_INSET_DMAC | \ ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_IPV4_TOS | \
@@ -619,6 +621,63 @@ static struct ice_flow_engine ice_fdir_engine = { .type = ICE_FLOW_ENGINE_FDIR, }; +static int +ice_fdir_parse_action_qregion (struct ice_pf *pf, +struct rte_flow_error *error, +const struct rte_flow_action *act, +struct ice_fdir_filter_conf *filter) +{ +const struct rte_flow_action_rss *rss = act->conf; +uint32_t i; + +if (act->type !=RTE_FLOW_ACTION_TYPE_RSS ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Invalid action." ); +return -rte_errno; + } + +if (rss->queue_num <=1 ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Queue region size can't be 0 or 1." ); +return -rte_errno; + } + +/* check if queue index for queue region is continuous */ +for (i =0 ; i < rss->queue_num -1 ; i++) { +if (rss->queue[i +1 ] != rss->queue[i] +1 ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Discontinuous queue region" ); +return -rte_errno; + } + } + +if (rss->queue[rss->queue_num -1 ] >= pf->dev_data->nb_rx_queues) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Invalid queue region indexes." ); +return -rte_errno; + } + +if (!(rte_is_power_of_2 (rss->queue_num) && + (rss->queue_num <=ICE_FDIR_MAX_QREGION_SIZE ))) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"The region size should be any of the following values:" +"1, 2, 4, 8, 16, 32, 64, 128 as long as the total number " +"of queues do not exceed the VSI allocation." ); +return -rte_errno; + } + + filter->input.q_index = rss->queue[0 ]; + filter->input.q_region =rte_fls_u32 (rss->queue_num) -1 ; + filter->input.dest_ctl =ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QGROUP ; + +return 0 ; +} + static int ice_fdir_parse_action(struct ice_adapter *ad, const struct rte_flow_action actions[],
@@ -630,6 +689,7 @@ ice_fdir_parse_action(struct ice_adapter *ad,const struct rte_flow_action_mark *mark_spec =NULL ;uint32_t dest_num =0 ;uint32_t mark_num =0 ; +int ret;for (; actions->type !=RTE_FLOW_ACTION_TYPE_END ; actions++) {switch (actions->type) {
@@ -664,6 +724,14 @@ ice_fdir_parse_action(struct ice_adapter *ad,ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QINDEX ; filter->input.q_index =0 ;break ; +case RTE_FLOW_ACTION_TYPE_RSS : + dest_num++; + + ret =ice_fdir_parse_action_qregion (pf, + error, actions, filter); +if (ret) +return ret; +break ;case RTE_FLOW_ACTION_TYPE_MARK : mark_num++;
Signature · 1 line
2.17.1
PATCH v3 5/8 net/ice: add FDIR counter resource init/release
In reply to Yahui CaoThe patch integrates the counter resource init/release into fdir's init/release scenario
--- drivers/net/ice/ice_ethdev.h | 33 +++++++++++ drivers/net/ice/ice_fdir_filter.c | 92 +++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+)
drivers/net/ice/ice_ethdev.h +33 -0
@@ -252,6 +252,37 @@ struct ice_fdir_filter_conf {uint64_t input_set; }; +#define ICE_FDIR_COUNTER_DEFAULT_POOL_SIZE 1 +#define ICE_FDIR_COUNTER_MAX_POOL_SIZE 32 +#define ICE_FDIR_COUNTERS_PER_BLOCK 256 +#define ICE_FDIR_COUNTER_INDEX (base_idx) \ + ((base_idx) * ICE_FDIR_COUNTERS_PER_BLOCK) +struct ice_fdir_counter { +TAILQ_ENTRY (ice_fdir_counter) next; +uint8_t shared; +uint32_t ref_cnt; +uint32_t id; +uint64_t hits; +uint64_t bytes; +uint32_t hw_index; +}; + +TAILQ_HEAD (ice_fdir_counter_list, ice_fdir_counter); + +struct ice_fdir_counter_pool { +TAILQ_ENTRY (ice_fdir_counter_pool) next; +struct ice_fdir_counter_list counter_list; +struct ice_fdir_counter counters[0 ]; +}; + +TAILQ_HEAD (ice_fdir_counter_pool_list, ice_fdir_counter_pool); + +struct ice_fdir_counter_pool_container { +struct ice_fdir_counter_pool_list pool_list; +struct ice_fdir_counter_pool *pools[ICE_FDIR_COUNTER_MAX_POOL_SIZE ]; +uint8_t index_free; +}; +/** * A structure used to define fields of a FDIR related info. */
@@ -262,6 +293,8 @@ struct ice_fdir_info {void *prg_pkt;/* memory for fdir program packet */ uint64_t dma_addr;/* physic address of packet memory*/ struct ice_fdir_filter_conf conf; + +struct ice_fdir_counter_pool_container counter; };struct ice_pf {
drivers/net/ice/ice_fdir_filter.c +92 -0
110 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 6/8 net/ice: add FDIR counter support
In reply to Yahui CaoThis patch add FDIR statistical counter support
and it includes RTE_FLOW count actions support
and query support.
RTE_FLOW count actions support id and shared.RTE_FLOW query record packet hits by default.
--- drivers/net/ice/ice_ethdev.h | 7 ++ drivers/net/ice/ice_fdir_filter.c | 179 +++++++++++++++++++++++++++++- 2 files changed, 185 insertions(+), 1 deletion(-)
drivers/net/ice/ice_ethdev.h +7 -0
@@ -249,6 +249,10 @@ TAILQ_HEAD(ice_parser_list, ice_flow_parser_node);struct ice_fdir_filter_conf {struct ice_fdir_fltr input; + +struct ice_fdir_counter *counter;/* flow specific counter context */ +struct rte_flow_action_count act_count; +uint64_t input_set; };
@@ -257,8 +261,11 @@ struct ice_fdir_filter_conf {#define ICE_FDIR_COUNTERS_PER_BLOCK 256#define ICE_FDIR_COUNTER_INDEX (base_idx) \ ((base_idx) * ICE_FDIR_COUNTERS_PER_BLOCK) +struct ice_fdir_counter_pool ; +struct ice_fdir_counter {TAILQ_ENTRY (ice_fdir_counter) next; +struct ice_fdir_counter_pool *pool;uint8_t shared;uint32_t ref_cnt;uint32_t id;
drivers/net/ice/ice_fdir_filter.c +178 -1
239 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 7/8 net/ice: reject duplicate flow for FDIR
In reply to Yahui CaoEnable duplication lookup for existing flow director rule entry.
--- drivers/net/ice/ice_ethdev.h | 17 +++ drivers/net/ice/ice_fdir_filter.c | 186 ++++++++++++++++++++++++++++-- 2 files changed, 196 insertions(+), 7 deletions(-)
drivers/net/ice/ice_ethdev.h +17 -0
@@ -256,6 +256,20 @@ struct ice_fdir_filter_conf {uint64_t input_set; }; +#define ICE_MAX_FDIR_FILTER_NUM (1024 * 16) + +struct ice_fdir_fltr_pattern { +enum ice_fltr_ptype flow_type; + +union { +struct ice_fdir_v4 v4; +struct ice_fdir_v6 v6; + } ip, mask; + +struct ice_fdir_extra ext_data; +struct ice_fdir_extra ext_mask; +}; +#define ICE_FDIR_COUNTER_DEFAULT_POOL_SIZE 1#define ICE_FDIR_COUNTER_MAX_POOL_SIZE 32#define ICE_FDIR_COUNTERS_PER_BLOCK 256
@@ -301,6 +315,9 @@ struct ice_fdir_info {uint64_t dma_addr;/* physic address of packet memory*/ struct ice_fdir_filter_conf conf; +struct ice_fdir_filter_conf **hash_map; +struct rte_hash *hash_table; +struct ice_fdir_counter_pool_container counter; };
drivers/net/ice/ice_fdir_filter.c +179 -7
255 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 8/8 net/ice: add FDIR vxlan tunnel support
In reply to Yahui CaoEnable FDIR vxlan tunnel matching for RTE_FLOW
--- drivers/net/ice/ice_ethdev.h | 6 ++ drivers/net/ice/ice_fdir_filter.c | 99 +++++++++++++++++++++++++++---- 2 files changed, 95 insertions(+), 10 deletions(-)
drivers/net/ice/ice_ethdev.h +6 -0
@@ -241,6 +241,11 @@ struct ice_vsi {bool offset_loaded; }; +enum ice_fdir_tunnel_type { +ICE_FDIR_TUNNEL_TYPE_NONE =0 , +ICE_FDIR_TUNNEL_TYPE_VXLAN , +}; +struct rte_flow ;TAILQ_HEAD (ice_flow_list, rte_flow);
@@ -249,6 +254,7 @@ TAILQ_HEAD(ice_parser_list, ice_flow_parser_node);struct ice_fdir_filter_conf {struct ice_fdir_fltr input; +enum ice_fdir_tunnel_type tunnel_type;struct ice_fdir_counter *counter;/* flow specific counter context */ struct rte_flow_action_count act_count;
drivers/net/ice/ice_fdir_filter.c +89 -10
195 lines not on this page · raw message
Signature · 1 line
2.17.1
v4 cover net/ice: add ice Flow Director driver
In reply to Yahui CaoThis patch series adds Flow Director support for Intel Ethernet Controller E810 series using RTE_FLOW
- Patch 01-02 are FDIR init,teardown and configuration
- Remaining patches are FDIR RTE_FLOW enablement
The patchset depends on:
http://patchwork.dpdk.org/project/dpdk/list/?series=6557
---
v4:
* Remove rte_wmb.
* Update input set mapping table.
* Remove all created profiles during teardown
* Fix tunnel rule duplication detection failure
* Change function name
v3:
* Get flow id in flexible descriptor
* Add vxlan tunnel rule support
v2:
* Move to flexible descriptor.
* Distinguish tunnel and non-tunnel rule.
* Add uninit function for fdir engine.
* Fix coding style.
* Change patch organization.
* Add release notes.
Beilei Xing (2):
net/ice: enable flow director engine
net/ice: configure HW FDIR rule
Yahui Cao (6):
net/ice: add FDIR create and destroy
net/ice: enable FDIR queue group
net/ice: add FDIR counter resource init/release
net/ice: add FDIR counter support
net/ice: reject duplicate flow for FDIR
net/ice: add FDIR vxlan tunnel support
doc/guides/rel_notes/release_19_11.rst | 1 + drivers/net/ice/Makefile | 1 + drivers/net/ice/ice_ethdev.c | 107 +- drivers/net/ice/ice_ethdev.h | 91 ++ drivers/net/ice/ice_fdir_filter.c | 1639 ++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.c | 403 ++++++ drivers/net/ice/ice_rxtx.h | 9 + drivers/net/ice/meson.build | 3 +- 8 files changed, 2234 insertions(+), 20 deletions(-) create mode 100644 drivers/net/ice/ice_fdir_filter.c
Signature · 1 line
2.17.1
PATCH v4 1/8 net/ice: enable flow director engine
From: Beilei Xing <[email protected]>
Enable flow director engine, including initialization and teardown.
- Control VSI create and release.
- Queue pair allocated, set up and release.
- Programming packet create and release.
- FDIR profile create and release.
--- drivers/net/ice/Makefile | 1 + drivers/net/ice/ice_ethdev.c | 107 ++++++-- drivers/net/ice/ice_ethdev.h | 19 ++ drivers/net/ice/ice_fdir_filter.c | 225 +++++++++++++++++ drivers/net/ice/ice_rxtx.c | 403 ++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 9 + drivers/net/ice/meson.build | 3 +- 7 files changed, 747 insertions(+), 20 deletions(-) create mode 100644 drivers/net/ice/ice_fdir_filter.c
drivers/net/ice/Makefile +1 -0
@@ -62,6 +62,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_rxtx_vec_sse.c endif SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_switch_filter.c +SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_fdir_filter.c ifeq ($(findstring RTE_MACHINE_CPUFLAG_AVX2,$(CFLAGS)),RTE_MACHINE_CPUFLAG_AVX2) CC_AVX2_SUPPORT=1 else
drivers/net/ice/ice_ethdev.c +88 -19
188 lines not on this page · raw message
drivers/net/ice/ice_ethdev.h +19 -0
@@ -247,6 +247,17 @@ TAILQ_HEAD(ice_flow_list, rte_flow);struct ice_flow_parser_node ;TAILQ_HEAD (ice_parser_list, ice_flow_parser_node); +/** +* A structure used to define fields of a FDIR related info. +*/ +struct ice_fdir_info { +struct ice_vsi *fdir_vsi;/* pointer to fdir VSI structure */ +struct ice_tx_queue *txq; +struct ice_rx_queue *rxq; +void *prg_pkt;/* memory for fdir program packet */ +uint64_t dma_addr;/* physic address of packet memory*/ +}; +struct ice_pf {struct ice_adapter *adapter;/* The adapter this PF associate to */ struct ice_vsi *main_vsi;/* pointer to main VSI structure */
@@ -267,6 +278,9 @@ struct ice_pf {uint16_t lan_nb_qps;/* The number of queue pairs of LAN */ uint16_t base_queue;/* The base queue pairs index in the device */ uint8_t *proto_xtr;/* Protocol extraction type for all queues */ +uint16_t fdir_nb_qps;/* The number of queue pairs of Flow Director */ +uint16_t fdir_qp_offset; +struct ice_fdir_info fdir;/* flow director info */ struct ice_hw_port_stats stats_offset;struct ice_hw_port_stats stats;/* internal packet statistics, it should be excluded from the total */
@@ -352,6 +366,11 @@ struct ice_vsi_vlan_pvid_info {#define ICE_PF_TO_ETH_DEV (pf) \ (((struct ice_pf *)pf)->adapter->eth_dev) +struct ice_vsi * +ice_setup_vsi (struct ice_pf *pf,enum ice_vsi_type type); +int +ice_release_vsi (struct ice_vsi *vsi); +static inline int ice_align_floor (int n) {
drivers/net/ice/ice_fdir_filter.c new file +225 -0
225 lines not on this page · raw message
drivers/net/ice/ice_rxtx.c +403 -0
430 lines not on this page · raw message
drivers/net/ice/ice_rxtx.h +9 -0
@@ -37,6 +37,8 @@#define ICE_TX_MAX_FREE_BUF_SZ 64#define ICE_DESCS_PER_LOOP 4 +#define ICE_FDIR_PKT_LEN 512 +typedef void (*ice_rx_release_mbufs_t )(struct ice_rx_queue *rxq);typedef void (*ice_tx_release_mbufs_t )(struct ice_tx_queue *txq);
@@ -149,10 +151,16 @@ int ice_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);int ice_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id);int ice_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id);int ice_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id); +int ice_fdir_rx_queue_start (struct rte_eth_dev *dev,uint16_t rx_queue_id); +int ice_fdir_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id); +int ice_fdir_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id); +int ice_fdir_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id);void ice_rx_queue_release (void *rxq);void ice_tx_queue_release (void *txq);void ice_clear_queues (struct rte_eth_dev *dev);void ice_free_queues (struct rte_eth_dev *dev); +int ice_fdir_setup_tx_resources (struct ice_pf *pf); +int ice_fdir_setup_rx_resources (struct ice_pf *pf);uint16_t ice_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); uint16_t ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
@@ -190,4 +198,5 @@ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue, uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx2 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +int ice_fdir_programming (struct ice_pf *pf,struct ice_fltr_desc *fdir_desc);#endif /* _ICE_RXTX_H_ */
drivers/net/ice/meson.build +2 -1
@@ -10,7 +10,8 @@ sources = files( 'ice_ethdev.c', 'ice_rxtx.c', 'ice_switch_filter.c', - 'ice_generic_flow.c' + 'ice_generic_flow.c', + 'ice_fdir_filter.c' ) deps += ['hash']
Signature · 1 line
2.17.1
PATCH v4 2/8 net/ice: configure HW FDIR rule
In reply to Yahui CaoFrom: Beilei Xing <[email protected]>
This patch adds a HW FDIR rule to the FDIR HW table without adding a FDIR filter.
--- drivers/net/ice/ice_ethdev.h | 1 + drivers/net/ice/ice_fdir_filter.c | 255 +++++++++++++++++++++++++++++- 2 files changed, 255 insertions(+), 1 deletion(-)
drivers/net/ice/ice_ethdev.h +1 -0
@@ -281,6 +281,7 @@ struct ice_pf {uint16_t fdir_nb_qps;/* The number of queue pairs of Flow Director */ uint16_t fdir_qp_offset;struct ice_fdir_info fdir;/* flow director info */ +uint16_t hw_prof_cnt[ICE_FLTR_PTYPE_MAX ][ICE_FD_HW_SEG_MAX ];struct ice_hw_port_stats stats_offset;struct ice_hw_port_stats stats;/* internal packet statistics, it should be excluded from the total */
drivers/net/ice/ice_fdir_filter.c +254 -1
269 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v4 3/8 net/ice: add FDIR create and destroy
In reply to Yahui CaoAdd ice_create_fdir_filter to create a rule. If a flow is matched by flow director filter, filter rule will be set to HW. For now common pattern and queue/passthru/drop/mark actions are supported.
--- doc/guides/rel_notes/release_19_11.rst | 1 + drivers/net/ice/ice_ethdev.h | 6 + drivers/net/ice/ice_fdir_filter.c | 575 ++++++++++++++++++++++++- 3 files changed, 580 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_19_11.rst +1 -0
@@ -63,6 +63,7 @@ New Features * Added support for device-specific DDP package loading. * Added support for handling Receive Flex Descriptor. * Added support for protocol extraction on per Rx queue. + * Added support for Flow Director filter based on generic filter framework. * Generic filter enhancement - Supported pipeline mode. - Supported new packet type like PPPoE for switch filter.
drivers/net/ice/ice_ethdev.h +6 -0
@@ -247,6 +247,11 @@ TAILQ_HEAD(ice_flow_list, rte_flow);struct ice_flow_parser_node ;TAILQ_HEAD (ice_parser_list, ice_flow_parser_node); +struct ice_fdir_filter_conf { +struct ice_fdir_fltr input; +uint64_t input_set; +}; +/** * A structure used to define fields of a FDIR related info. */
@@ -256,6 +261,7 @@ struct ice_fdir_info {struct ice_rx_queue *rxq;void *prg_pkt;/* memory for fdir program packet */ uint64_t dma_addr;/* physic address of packet memory*/ +struct ice_fdir_filter_conf conf; };struct ice_pf {
drivers/net/ice/ice_fdir_filter.c +573 -2
609 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v4 3/8] net/ice: add FDIR create and destroy
Quoted 5 lines · Yahui Cao
Add
ice_create_fdir_filterto create a rule. If a flow is matched by flow director filter, filter rule will be set to HW. For now common pattern and queue/passthru/drop/mark actions are supported.Signed-off-by Yahui Cao <[email protected]>
Off the topic.
This is the patch 60000 in patchwork!
Thanks to everyone contributed!
https://patches.dpdk.org/patch/60000/
The historical numbers from DPDK patchwork:
60000 - Sept. 27, 2019 (248 days) [ 8 months, 5 days / 35 weeks and 3 days ] 50000 - Jan. 22, 2019 (253 days)
40000 - May. 14, 2018 (217 days)
30000 - Oct. 9, 2017 (258 days)
20000 - Jan. 25, 2017 (372 days)
10000 - Jan. 20, 2016 (645 days)
00001 - April 16, 2014
It looks like pace is getting stabilized around ~250 days for 10K patch.
PATCH v4 4/8 net/ice: enable FDIR queue group
In reply to Yahui CaoFDIR can send packet to a group of queues and distruibte it by RSS.
--- drivers/net/ice/ice_fdir_filter.c | 68 +++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)
drivers/net/ice/ice_fdir_filter.c +68 -0
@@ -10,6 +10,8 @@#define ICE_FDIR_IPV6_TC_OFFSET 20#define ICE_IPV6_TC_MASK (0xFF << ICE_FDIR_IPV6_TC_OFFSET) +#define ICE_FDIR_MAX_QREGION_SIZE 128 +#define ICE_FDIR_INSET_ETH_IPV4 (\ ICE_INSET_DMAC | \ ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_IPV4_TOS | \
@@ -626,6 +628,63 @@ static struct ice_flow_engine ice_fdir_engine = { .type = ICE_FLOW_ENGINE_FDIR, }; +static int +ice_fdir_parse_action_qregion (struct ice_pf *pf, +struct rte_flow_error *error, +const struct rte_flow_action *act, +struct ice_fdir_filter_conf *filter) +{ +const struct rte_flow_action_rss *rss = act->conf; +uint32_t i; + +if (act->type !=RTE_FLOW_ACTION_TYPE_RSS ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Invalid action." ); +return -rte_errno; + } + +if (rss->queue_num <=1 ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Queue region size can't be 0 or 1." ); +return -rte_errno; + } + +/* check if queue index for queue region is continuous */ +for (i =0 ; i < rss->queue_num -1 ; i++) { +if (rss->queue[i +1 ] != rss->queue[i] +1 ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Discontinuous queue region" ); +return -rte_errno; + } + } + +if (rss->queue[rss->queue_num -1 ] >= pf->dev_data->nb_rx_queues) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Invalid queue region indexes." ); +return -rte_errno; + } + +if (!(rte_is_power_of_2 (rss->queue_num) && + (rss->queue_num <=ICE_FDIR_MAX_QREGION_SIZE ))) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"The region size should be any of the following values:" +"1, 2, 4, 8, 16, 32, 64, 128 as long as the total number " +"of queues do not exceed the VSI allocation." ); +return -rte_errno; + } + + filter->input.q_index = rss->queue[0 ]; + filter->input.q_region =rte_fls_u32 (rss->queue_num) -1 ; + filter->input.dest_ctl =ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QGROUP ; + +return 0 ; +} + static int ice_fdir_parse_action(struct ice_adapter *ad, const struct rte_flow_action actions[],
@@ -637,6 +696,7 @@ ice_fdir_parse_action(struct ice_adapter *ad,const struct rte_flow_action_mark *mark_spec =NULL ;uint32_t dest_num =0 ;uint32_t mark_num =0 ; +int ret;for (; actions->type !=RTE_FLOW_ACTION_TYPE_END ; actions++) {switch (actions->type) {
@@ -671,6 +731,14 @@ ice_fdir_parse_action(struct ice_adapter *ad,ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QINDEX ; filter->input.q_index =0 ;break ; +case RTE_FLOW_ACTION_TYPE_RSS : + dest_num++; + + ret =ice_fdir_parse_action_qregion (pf, + error, actions, filter); +if (ret) +return ret; +break ;case RTE_FLOW_ACTION_TYPE_MARK : mark_num++;
Signature · 1 line
2.17.1
PATCH v4 5/8 net/ice: add FDIR counter resource init/release
In reply to Yahui CaoThe patch integrates the counter resource init/release into fdir's init/release scenario
--- drivers/net/ice/ice_ethdev.h | 33 +++++++++++ drivers/net/ice/ice_fdir_filter.c | 92 +++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+)
drivers/net/ice/ice_ethdev.h +33 -0
@@ -252,6 +252,37 @@ struct ice_fdir_filter_conf {uint64_t input_set; }; +#define ICE_FDIR_COUNTER_DEFAULT_POOL_SIZE 1 +#define ICE_FDIR_COUNTER_MAX_POOL_SIZE 32 +#define ICE_FDIR_COUNTERS_PER_BLOCK 256 +#define ICE_FDIR_COUNTER_INDEX (base_idx) \ + ((base_idx) * ICE_FDIR_COUNTERS_PER_BLOCK) +struct ice_fdir_counter { +TAILQ_ENTRY (ice_fdir_counter) next; +uint8_t shared; +uint32_t ref_cnt; +uint32_t id; +uint64_t hits; +uint64_t bytes; +uint32_t hw_index; +}; + +TAILQ_HEAD (ice_fdir_counter_list, ice_fdir_counter); + +struct ice_fdir_counter_pool { +TAILQ_ENTRY (ice_fdir_counter_pool) next; +struct ice_fdir_counter_list counter_list; +struct ice_fdir_counter counters[0 ]; +}; + +TAILQ_HEAD (ice_fdir_counter_pool_list, ice_fdir_counter_pool); + +struct ice_fdir_counter_pool_container { +struct ice_fdir_counter_pool_list pool_list; +struct ice_fdir_counter_pool *pools[ICE_FDIR_COUNTER_MAX_POOL_SIZE ]; +uint8_t index_free; +}; +/** * A structure used to define fields of a FDIR related info. */
@@ -262,6 +293,8 @@ struct ice_fdir_info {void *prg_pkt;/* memory for fdir program packet */ uint64_t dma_addr;/* physic address of packet memory*/ struct ice_fdir_filter_conf conf; + +struct ice_fdir_counter_pool_container counter; };struct ice_pf {
drivers/net/ice/ice_fdir_filter.c +92 -0
110 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v4 6/8 net/ice: add FDIR counter support
In reply to Yahui CaoThis patch add FDIR statistical counter support
and it includes RTE_FLOW count actions support
and query support.
RTE_FLOW count actions support id and shared.RTE_FLOW query record packet hits by default.
--- drivers/net/ice/ice_ethdev.h | 7 ++ drivers/net/ice/ice_fdir_filter.c | 179 +++++++++++++++++++++++++++++- 2 files changed, 185 insertions(+), 1 deletion(-)
drivers/net/ice/ice_ethdev.h +7 -0
@@ -249,6 +249,10 @@ TAILQ_HEAD(ice_parser_list, ice_flow_parser_node);struct ice_fdir_filter_conf {struct ice_fdir_fltr input; + +struct ice_fdir_counter *counter;/* flow specific counter context */ +struct rte_flow_action_count act_count; +uint64_t input_set; };
@@ -257,8 +261,11 @@ struct ice_fdir_filter_conf {#define ICE_FDIR_COUNTERS_PER_BLOCK 256#define ICE_FDIR_COUNTER_INDEX (base_idx) \ ((base_idx) * ICE_FDIR_COUNTERS_PER_BLOCK) +struct ice_fdir_counter_pool ; +struct ice_fdir_counter {TAILQ_ENTRY (ice_fdir_counter) next; +struct ice_fdir_counter_pool *pool;uint8_t shared;uint32_t ref_cnt;uint32_t id;
drivers/net/ice/ice_fdir_filter.c +178 -1
239 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v4 7/8 net/ice: reject duplicate flow for FDIR
In reply to Yahui CaoEnable duplication lookup for existing flow director rule entry.
--- drivers/net/ice/ice_ethdev.h | 17 +++ drivers/net/ice/ice_fdir_filter.c | 186 ++++++++++++++++++++++++++++-- 2 files changed, 196 insertions(+), 7 deletions(-)
drivers/net/ice/ice_ethdev.h +17 -0
@@ -256,6 +256,20 @@ struct ice_fdir_filter_conf {uint64_t input_set; }; +#define ICE_MAX_FDIR_FILTER_NUM (1024 * 16) + +struct ice_fdir_fltr_pattern { +enum ice_fltr_ptype flow_type; + +union { +struct ice_fdir_v4 v4; +struct ice_fdir_v6 v6; + } ip, mask; + +struct ice_fdir_extra ext_data; +struct ice_fdir_extra ext_mask; +}; +#define ICE_FDIR_COUNTER_DEFAULT_POOL_SIZE 1#define ICE_FDIR_COUNTER_MAX_POOL_SIZE 32#define ICE_FDIR_COUNTERS_PER_BLOCK 256
@@ -301,6 +315,9 @@ struct ice_fdir_info {uint64_t dma_addr;/* physic address of packet memory*/ struct ice_fdir_filter_conf conf; +struct ice_fdir_filter_conf **hash_map; +struct rte_hash *hash_table; +struct ice_fdir_counter_pool_container counter; };
drivers/net/ice/ice_fdir_filter.c +179 -7
255 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v4 8/8 net/ice: add FDIR vxlan tunnel support
In reply to Yahui CaoEnable FDIR vxlan tunnel matching for RTE_FLOW
--- drivers/net/ice/ice_ethdev.h | 8 +++ drivers/net/ice/ice_fdir_filter.c | 101 +++++++++++++++++++++++++++--- 2 files changed, 99 insertions(+), 10 deletions(-)
drivers/net/ice/ice_ethdev.h +8 -0
@@ -241,6 +241,11 @@ struct ice_vsi {bool offset_loaded; }; +enum ice_fdir_tunnel_type { +ICE_FDIR_TUNNEL_TYPE_NONE =0 , +ICE_FDIR_TUNNEL_TYPE_VXLAN , +}; +struct rte_flow ;TAILQ_HEAD (ice_flow_list, rte_flow);
@@ -249,6 +254,7 @@ TAILQ_HEAD(ice_parser_list, ice_flow_parser_node);struct ice_fdir_filter_conf {struct ice_fdir_fltr input; +enum ice_fdir_tunnel_type tunnel_type;struct ice_fdir_counter *counter;/* flow specific counter context */ struct rte_flow_action_count act_count;
@@ -268,6 +274,8 @@ struct ice_fdir_fltr_pattern {struct ice_fdir_extra ext_data;struct ice_fdir_extra ext_mask; + +enum ice_fdir_tunnel_type tunnel_type; };#define ICE_FDIR_COUNTER_DEFAULT_POOL_SIZE 1
drivers/net/ice/ice_fdir_filter.c +91 -10
203 lines not on this page · raw message
Signature · 1 line
2.17.1
v5 cover net/ice: add ice Flow Director driver
In reply to Yahui CaoThis patch series adds Flow Director support for Intel Ethernet Controller E810 series using RTE_FLOW
- Patch 01-02 are FDIR init,teardown and configuration
- Remaining patches are FDIR RTE_FLOW enablement
The patchset depends on:
http://patchwork.dpdk.org/project/dpdk/list/?series=6557
---
v5:
* Add GTPU rule support
* Fix tunnel profile conflict issue
* Update filter counter
v4:
* Remove rte_wmb.
* Update input set mapping table.
* Remove all created profiles during teardown
* Fix tunnel rule duplication detection failure
* Change function name
v3:
* Get flow id in flexible descriptor
* Add vxlan tunnel rule support
v2:
* Move to flexible descriptor.
* Distinguish tunnel and non-tunnel rule.
* Add uninit function for fdir engine.
* Fix coding style.
* Change patch organization.
* Add release notes.
Beilei Xing (2):
net/ice: enable flow director engine
net/ice: configure HW FDIR rule
Yahui Cao (7):
net/ice: add FDIR create and destroy
net/ice: enable FDIR queue group
net/ice: add FDIR counter resource init/release
net/ice: add FDIR counter support
net/ice: reject duplicate flow for FDIR
net/ice: add FDIR vxlan tunnel support
net/ice: add FDIR GTPU tunnel support
doc/guides/rel_notes/release_19_11.rst | 1 + drivers/net/ice/Makefile | 1 + drivers/net/ice/ice_ethdev.c | 107 +- drivers/net/ice/ice_ethdev.h | 96 ++ drivers/net/ice/ice_fdir_filter.c | 1791 ++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.c | 403 ++++++ drivers/net/ice/ice_rxtx.h | 9 + drivers/net/ice/meson.build | 3 +- 8 files changed, 2391 insertions(+), 20 deletions(-) create mode 100644 drivers/net/ice/ice_fdir_filter.c
Signature · 1 line
2.17.1
PATCH v5 1/9 net/ice: enable flow director engine
From: Beilei Xing <[email protected]>
Enable flow director engine, including initialization and teardown.
- Control VSI create and release.
- Queue pair allocated, set up and release.
- Programming packet create and release.
- FDIR profile create and release.
--- drivers/net/ice/Makefile | 1 + drivers/net/ice/ice_ethdev.c | 107 ++++++-- drivers/net/ice/ice_ethdev.h | 19 ++ drivers/net/ice/ice_fdir_filter.c | 225 +++++++++++++++++ drivers/net/ice/ice_rxtx.c | 403 ++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 9 + drivers/net/ice/meson.build | 3 +- 7 files changed, 747 insertions(+), 20 deletions(-) create mode 100644 drivers/net/ice/ice_fdir_filter.c
drivers/net/ice/Makefile +1 -0
@@ -62,6 +62,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_rxtx_vec_sse.c endif SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_switch_filter.c +SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_fdir_filter.c ifeq ($(findstring RTE_MACHINE_CPUFLAG_AVX2,$(CFLAGS)),RTE_MACHINE_CPUFLAG_AVX2) CC_AVX2_SUPPORT=1 else
drivers/net/ice/ice_ethdev.c +88 -19
188 lines not on this page · raw message
drivers/net/ice/ice_ethdev.h +19 -0
@@ -247,6 +247,17 @@ TAILQ_HEAD(ice_flow_list, rte_flow);struct ice_flow_parser_node ;TAILQ_HEAD (ice_parser_list, ice_flow_parser_node); +/** +* A structure used to define fields of a FDIR related info. +*/ +struct ice_fdir_info { +struct ice_vsi *fdir_vsi;/* pointer to fdir VSI structure */ +struct ice_tx_queue *txq; +struct ice_rx_queue *rxq; +void *prg_pkt;/* memory for fdir program packet */ +uint64_t dma_addr;/* physic address of packet memory*/ +}; +struct ice_pf {struct ice_adapter *adapter;/* The adapter this PF associate to */ struct ice_vsi *main_vsi;/* pointer to main VSI structure */
@@ -267,6 +278,9 @@ struct ice_pf {uint16_t lan_nb_qps;/* The number of queue pairs of LAN */ uint16_t base_queue;/* The base queue pairs index in the device */ uint8_t *proto_xtr;/* Protocol extraction type for all queues */ +uint16_t fdir_nb_qps;/* The number of queue pairs of Flow Director */ +uint16_t fdir_qp_offset; +struct ice_fdir_info fdir;/* flow director info */ struct ice_hw_port_stats stats_offset;struct ice_hw_port_stats stats;/* internal packet statistics, it should be excluded from the total */
@@ -352,6 +366,11 @@ struct ice_vsi_vlan_pvid_info {#define ICE_PF_TO_ETH_DEV (pf) \ (((struct ice_pf *)pf)->adapter->eth_dev) +struct ice_vsi * +ice_setup_vsi (struct ice_pf *pf,enum ice_vsi_type type); +int +ice_release_vsi (struct ice_vsi *vsi); +static inline int ice_align_floor (int n) {
drivers/net/ice/ice_fdir_filter.c new file +225 -0
225 lines not on this page · raw message
drivers/net/ice/ice_rxtx.c +403 -0
430 lines not on this page · raw message
drivers/net/ice/ice_rxtx.h +9 -0
@@ -37,6 +37,8 @@#define ICE_TX_MAX_FREE_BUF_SZ 64#define ICE_DESCS_PER_LOOP 4 +#define ICE_FDIR_PKT_LEN 512 +typedef void (*ice_rx_release_mbufs_t )(struct ice_rx_queue *rxq);typedef void (*ice_tx_release_mbufs_t )(struct ice_tx_queue *txq);
@@ -149,10 +151,16 @@ int ice_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);int ice_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id);int ice_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id);int ice_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id); +int ice_fdir_rx_queue_start (struct rte_eth_dev *dev,uint16_t rx_queue_id); +int ice_fdir_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id); +int ice_fdir_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id); +int ice_fdir_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id);void ice_rx_queue_release (void *rxq);void ice_tx_queue_release (void *txq);void ice_clear_queues (struct rte_eth_dev *dev);void ice_free_queues (struct rte_eth_dev *dev); +int ice_fdir_setup_tx_resources (struct ice_pf *pf); +int ice_fdir_setup_rx_resources (struct ice_pf *pf);uint16_t ice_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); uint16_t ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
@@ -190,4 +198,5 @@ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue, uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx2 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +int ice_fdir_programming (struct ice_pf *pf,struct ice_fltr_desc *fdir_desc);#endif /* _ICE_RXTX_H_ */
drivers/net/ice/meson.build +2 -1
@@ -10,7 +10,8 @@ sources = files( 'ice_ethdev.c', 'ice_rxtx.c', 'ice_switch_filter.c', - 'ice_generic_flow.c' + 'ice_generic_flow.c', + 'ice_fdir_filter.c' ) deps += ['hash']
Signature · 1 line
2.17.1
PATCH v5 2/9 net/ice: configure HW FDIR rule
In reply to Yahui CaoFrom: Beilei Xing <[email protected]>
This patch adds a HW FDIR rule to the FDIR HW table without adding a FDIR filter.
--- drivers/net/ice/ice_ethdev.h | 2 + drivers/net/ice/ice_fdir_filter.c | 276 +++++++++++++++++++++++++++++- 2 files changed, 277 insertions(+), 1 deletion(-)
drivers/net/ice/ice_ethdev.h +2 -0
@@ -281,6 +281,8 @@ struct ice_pf {uint16_t fdir_nb_qps;/* The number of queue pairs of Flow Director */ uint16_t fdir_qp_offset;struct ice_fdir_info fdir;/* flow director info */ +uint16_t hw_prof_cnt[ICE_FLTR_PTYPE_MAX ][ICE_FD_HW_SEG_MAX ]; +uint16_t fdir_fltr_cnt[ICE_FLTR_PTYPE_MAX ][ICE_FD_HW_SEG_MAX ];struct ice_hw_port_stats stats_offset;struct ice_hw_port_stats stats;/* internal packet statistics, it should be excluded from the total */
drivers/net/ice/ice_fdir_filter.c +275 -1
290 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v5 3/9 net/ice: add FDIR create and destroy
In reply to Yahui CaoAdd ice_create_fdir_filter to create a rule. If a flow is matched by flow director filter, filter rule will be set to HW. For now common pattern and queue/passthru/drop/mark actions are supported.
--- doc/guides/rel_notes/release_19_11.rst | 1 + drivers/net/ice/ice_ethdev.h | 6 + drivers/net/ice/ice_fdir_filter.c | 579 ++++++++++++++++++++++++- 3 files changed, 583 insertions(+), 3 deletions(-)
doc/guides/rel_notes/release_19_11.rst +1 -0
@@ -63,6 +63,7 @@ New Features * Added support for device-specific DDP package loading. * Added support for handling Receive Flex Descriptor. * Added support for protocol extraction on per Rx queue. + * Added support for Flow Director filter based on generic filter framework. * Generic filter enhancement - Supported pipeline mode. - Supported new packet type like PPPoE for switch filter.
drivers/net/ice/ice_ethdev.h +6 -0
@@ -247,6 +247,11 @@ TAILQ_HEAD(ice_flow_list, rte_flow);struct ice_flow_parser_node ;TAILQ_HEAD (ice_parser_list, ice_flow_parser_node); +struct ice_fdir_filter_conf { +struct ice_fdir_fltr input; +uint64_t input_set; +}; +/** * A structure used to define fields of a FDIR related info. */
@@ -256,6 +261,7 @@ struct ice_fdir_info {struct ice_rx_queue *rxq;void *prg_pkt;/* memory for fdir program packet */ uint64_t dma_addr;/* physic address of packet memory*/ +struct ice_fdir_filter_conf conf; };struct ice_pf {
drivers/net/ice/ice_fdir_filter.c +576 -3
619 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v5 4/9 net/ice: enable FDIR queue group
In reply to Yahui CaoFDIR can send packet to a group of queues and distruibte it by RSS.
--- drivers/net/ice/ice_fdir_filter.c | 68 +++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)
drivers/net/ice/ice_fdir_filter.c +68 -0
@@ -10,6 +10,8 @@#define ICE_FDIR_IPV6_TC_OFFSET 20#define ICE_IPV6_TC_MASK (0xFF << ICE_FDIR_IPV6_TC_OFFSET) +#define ICE_FDIR_MAX_QREGION_SIZE 128 +#define ICE_FDIR_INSET_ETH_IPV4 (\ ICE_INSET_DMAC | \ ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_IPV4_TOS | \
@@ -649,6 +651,63 @@ static struct ice_flow_engine ice_fdir_engine = { .type = ICE_FLOW_ENGINE_FDIR, }; +static int +ice_fdir_parse_action_qregion (struct ice_pf *pf, +struct rte_flow_error *error, +const struct rte_flow_action *act, +struct ice_fdir_filter_conf *filter) +{ +const struct rte_flow_action_rss *rss = act->conf; +uint32_t i; + +if (act->type !=RTE_FLOW_ACTION_TYPE_RSS ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Invalid action." ); +return -rte_errno; + } + +if (rss->queue_num <=1 ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Queue region size can't be 0 or 1." ); +return -rte_errno; + } + +/* check if queue index for queue region is continuous */ +for (i =0 ; i < rss->queue_num -1 ; i++) { +if (rss->queue[i +1 ] != rss->queue[i] +1 ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Discontinuous queue region" ); +return -rte_errno; + } + } + +if (rss->queue[rss->queue_num -1 ] >= pf->dev_data->nb_rx_queues) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Invalid queue region indexes." ); +return -rte_errno; + } + +if (!(rte_is_power_of_2 (rss->queue_num) && + (rss->queue_num <=ICE_FDIR_MAX_QREGION_SIZE ))) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"The region size should be any of the following values:" +"1, 2, 4, 8, 16, 32, 64, 128 as long as the total number " +"of queues do not exceed the VSI allocation." ); +return -rte_errno; + } + + filter->input.q_index = rss->queue[0 ]; + filter->input.q_region =rte_fls_u32 (rss->queue_num) -1 ; + filter->input.dest_ctl =ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QGROUP ; + +return 0 ; +} + static int ice_fdir_parse_action(struct ice_adapter *ad, const struct rte_flow_action actions[],
@@ -660,6 +719,7 @@ ice_fdir_parse_action(struct ice_adapter *ad,const struct rte_flow_action_mark *mark_spec =NULL ;uint32_t dest_num =0 ;uint32_t mark_num =0 ; +int ret;for (; actions->type !=RTE_FLOW_ACTION_TYPE_END ; actions++) {switch (actions->type) {
@@ -694,6 +754,14 @@ ice_fdir_parse_action(struct ice_adapter *ad,ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QINDEX ; filter->input.q_index =0 ;break ; +case RTE_FLOW_ACTION_TYPE_RSS : + dest_num++; + + ret =ice_fdir_parse_action_qregion (pf, + error, actions, filter); +if (ret) +return ret; +break ;case RTE_FLOW_ACTION_TYPE_MARK : mark_num++;
Signature · 1 line
2.17.1
PATCH v5 5/9 net/ice: add FDIR counter resource init/release
In reply to Yahui CaoThe patch integrates the counter resource init/release into fdir's init/release scenario
--- drivers/net/ice/ice_ethdev.h | 33 +++++++++++ drivers/net/ice/ice_fdir_filter.c | 92 +++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+)
drivers/net/ice/ice_ethdev.h +33 -0
@@ -252,6 +252,37 @@ struct ice_fdir_filter_conf {uint64_t input_set; }; +#define ICE_FDIR_COUNTER_DEFAULT_POOL_SIZE 1 +#define ICE_FDIR_COUNTER_MAX_POOL_SIZE 32 +#define ICE_FDIR_COUNTERS_PER_BLOCK 256 +#define ICE_FDIR_COUNTER_INDEX (base_idx) \ + ((base_idx) * ICE_FDIR_COUNTERS_PER_BLOCK) +struct ice_fdir_counter { +TAILQ_ENTRY (ice_fdir_counter) next; +uint8_t shared; +uint32_t ref_cnt; +uint32_t id; +uint64_t hits; +uint64_t bytes; +uint32_t hw_index; +}; + +TAILQ_HEAD (ice_fdir_counter_list, ice_fdir_counter); + +struct ice_fdir_counter_pool { +TAILQ_ENTRY (ice_fdir_counter_pool) next; +struct ice_fdir_counter_list counter_list; +struct ice_fdir_counter counters[0 ]; +}; + +TAILQ_HEAD (ice_fdir_counter_pool_list, ice_fdir_counter_pool); + +struct ice_fdir_counter_pool_container { +struct ice_fdir_counter_pool_list pool_list; +struct ice_fdir_counter_pool *pools[ICE_FDIR_COUNTER_MAX_POOL_SIZE ]; +uint8_t index_free; +}; +/** * A structure used to define fields of a FDIR related info. */
@@ -262,6 +293,8 @@ struct ice_fdir_info {void *prg_pkt;/* memory for fdir program packet */ uint64_t dma_addr;/* physic address of packet memory*/ struct ice_fdir_filter_conf conf; + +struct ice_fdir_counter_pool_container counter; };struct ice_pf {
drivers/net/ice/ice_fdir_filter.c +92 -0
110 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v5 6/9 net/ice: add FDIR counter support
In reply to Yahui CaoThis patch add FDIR statistical counter support
and it includes RTE_FLOW count actions support
and query support.
RTE_FLOW count actions support id and shared.RTE_FLOW query record packet hits by default.
--- drivers/net/ice/ice_ethdev.h | 7 ++ drivers/net/ice/ice_fdir_filter.c | 179 +++++++++++++++++++++++++++++- 2 files changed, 185 insertions(+), 1 deletion(-)
drivers/net/ice/ice_ethdev.h +7 -0
@@ -249,6 +249,10 @@ TAILQ_HEAD(ice_parser_list, ice_flow_parser_node);struct ice_fdir_filter_conf {struct ice_fdir_fltr input; + +struct ice_fdir_counter *counter;/* flow specific counter context */ +struct rte_flow_action_count act_count; +uint64_t input_set; };
@@ -257,8 +261,11 @@ struct ice_fdir_filter_conf {#define ICE_FDIR_COUNTERS_PER_BLOCK 256#define ICE_FDIR_COUNTER_INDEX (base_idx) \ ((base_idx) * ICE_FDIR_COUNTERS_PER_BLOCK) +struct ice_fdir_counter_pool ; +struct ice_fdir_counter {TAILQ_ENTRY (ice_fdir_counter) next; +struct ice_fdir_counter_pool *pool;uint8_t shared;uint32_t ref_cnt;uint32_t id;
drivers/net/ice/ice_fdir_filter.c +178 -1
239 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v5 7/9 net/ice: reject duplicate flow for FDIR
In reply to Yahui CaoEnable duplication lookup for existing flow director rule entry.
--- drivers/net/ice/ice_ethdev.h | 17 +++ drivers/net/ice/ice_fdir_filter.c | 185 ++++++++++++++++++++++++++++-- 2 files changed, 195 insertions(+), 7 deletions(-)
drivers/net/ice/ice_ethdev.h +17 -0
@@ -256,6 +256,20 @@ struct ice_fdir_filter_conf {uint64_t input_set; }; +#define ICE_MAX_FDIR_FILTER_NUM (1024 * 16) + +struct ice_fdir_fltr_pattern { +enum ice_fltr_ptype flow_type; + +union { +struct ice_fdir_v4 v4; +struct ice_fdir_v6 v6; + } ip, mask; + +struct ice_fdir_extra ext_data; +struct ice_fdir_extra ext_mask; +}; +#define ICE_FDIR_COUNTER_DEFAULT_POOL_SIZE 1#define ICE_FDIR_COUNTER_MAX_POOL_SIZE 32#define ICE_FDIR_COUNTERS_PER_BLOCK 256
@@ -301,6 +315,9 @@ struct ice_fdir_info {uint64_t dma_addr;/* physic address of packet memory*/ struct ice_fdir_filter_conf conf; +struct ice_fdir_filter_conf **hash_map; +struct rte_hash *hash_table; +struct ice_fdir_counter_pool_container counter; };
drivers/net/ice/ice_fdir_filter.c +178 -7
253 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v5 8/9 net/ice: add FDIR vxlan tunnel support
In reply to Yahui CaoEnable FDIR vxlan tunnel matching for RTE_FLOW
--- drivers/net/ice/ice_ethdev.h | 8 +++ drivers/net/ice/ice_fdir_filter.c | 108 ++++++++++++++++++++++++++---- 2 files changed, 104 insertions(+), 12 deletions(-)
drivers/net/ice/ice_ethdev.h +8 -0
@@ -241,6 +241,11 @@ struct ice_vsi {bool offset_loaded; }; +enum ice_fdir_tunnel_type { +ICE_FDIR_TUNNEL_TYPE_NONE =0 , +ICE_FDIR_TUNNEL_TYPE_VXLAN , +}; +struct rte_flow ;TAILQ_HEAD (ice_flow_list, rte_flow);
@@ -249,6 +254,7 @@ TAILQ_HEAD(ice_parser_list, ice_flow_parser_node);struct ice_fdir_filter_conf {struct ice_fdir_fltr input; +enum ice_fdir_tunnel_type tunnel_type;struct ice_fdir_counter *counter;/* flow specific counter context */ struct rte_flow_action_count act_count;
@@ -268,6 +274,8 @@ struct ice_fdir_fltr_pattern {struct ice_fdir_extra ext_data;struct ice_fdir_extra ext_mask; + +enum ice_fdir_tunnel_type tunnel_type; };#define ICE_FDIR_COUNTER_DEFAULT_POOL_SIZE 1
drivers/net/ice/ice_fdir_filter.c +96 -12
232 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v5 9/9 net/ice: add FDIR GTPU tunnel support
In reply to Yahui CaoEnable FDIR GTPU matching for RTE_FLOW
--- drivers/net/ice/ice_ethdev.h | 4 + drivers/net/ice/ice_fdir_filter.c | 145 ++++++++++++++++++++++++++++-- 2 files changed, 140 insertions(+), 9 deletions(-)
drivers/net/ice/ice_ethdev.h +4 -0
@@ -244,6 +244,7 @@ struct ice_vsi {enum ice_fdir_tunnel_type {ICE_FDIR_TUNNEL_TYPE_NONE =0 ,ICE_FDIR_TUNNEL_TYPE_VXLAN , +ICE_FDIR_TUNNEL_TYPE_GTPU , };struct rte_flow ;
@@ -272,6 +273,9 @@ struct ice_fdir_fltr_pattern {struct ice_fdir_v6 v6; } ip, mask; +struct ice_fdir_udp_gtp gtpu_data; +struct ice_fdir_udp_gtp gtpu_mask; +struct ice_fdir_extra ext_data;struct ice_fdir_extra ext_mask;
drivers/net/ice/ice_fdir_filter.c +136 -9
235 lines not on this page · raw message
Signature · 1 line
2.17.1
Quoted 67 lines
-----Original Message-----
From: Cao, Yahui
Sent: Monday, September 30, 2019 7:46 PM
To: Yang, Qiming <[email protected]>; Lu, Wenzhuo <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>; Ye, Xiaolong <[email protected]>; Xing, Beilei <[email protected]>; Cao, Yahui <[email protected]>
Subject: [PATCH v5 0/9] net/ice: add ice Flow Director driverThis patch series adds Flow Director support for Intel Ethernet Controller E810 series using
RTE_FLOW- Patch 01-02 are FDIR init,teardown and configuration
- Remaining patches are FDIRRTE_FLOWenablementThe patchset depends on:
http://patchwork.dpdk.org/project/dpdk/list/?series=6557
---
v5:
* Add GTPU rule support
* Fix tunnel profile conflict issue
* Update filter counterv4:
* Removerte_wmb.
* Update input set mapping table.
* Remove all created profiles during teardown
* Fix tunnel rule duplication detection failure
* Change function namev3:
* Get flow id in flexible descriptor
* Add vxlan tunnel rule supportv2:
* Move to flexible descriptor.
* Distinguish tunnel and non-tunnel rule.
* Add uninit function for fdir engine.
* Fix coding style.
* Change patch organization.
* Add release notes.Beilei Xing (2):
net/ice: enable flow director engine
net/ice: configure HW FDIR ruleYahui Cao (7):
net/ice: add FDIR create and destroy
net/ice: enable FDIR queue group
net/ice: add FDIR counter resource init/release
net/ice: add FDIR counter support
net/ice: reject duplicate flow for FDIR
net/ice: add FDIR vxlan tunnel support
net/ice: add FDIR GTPU tunnel supportdoc/guides/rel_notes/release_19_11.rst | 1 + drivers/net/ice/Makefile | 1 + drivers/net/ice/ice_ethdev.c | 107 +- drivers/net/ice/ice_ethdev.h | 96 ++ drivers/net/ice/ice_fdir_filter.c | 1791 ++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.c | 403 ++++++ drivers/net/ice/ice_rxtx.h | 9 + drivers/net/ice/meson.build | 3 +- 8 files changed, 2391 insertions(+), 20 deletions(-) create mode 100644
Quoted 4 lines
drivers/net/ice/ice_fdir_filter.c--
2.17.1
v6 cover net/ice: add ice Flow Director driver
In reply to Yahui CaoThis patch series adds Flow Director support for Intel Ethernet Controller E810 series using RTE_FLOW
- Patch 01-02 are FDIR init,teardown and configuration
- Remaining patches are FDIR RTE_FLOW enablement
---
v6:
* Fix build error on different platform
v5:
* Add GTPU rule support
* Fix tunnel profile conflict issue
* Update filter counter
v4:
* Remove rte_wmb.
* Update input set mapping table.
* Remove all created profiles during teardown
* Fix tunnel rule duplication detection failure
* Change function name
v3:
* Get flow id in flexible descriptor
* Add vxlan tunnel rule support
v2:
* Move to flexible descriptor.
* Distinguish tunnel and non-tunnel rule.
* Add uninit function for fdir engine.
* Fix coding style.
* Change patch organization.
* Add release notes.
Beilei Xing (2):
net/ice: enable flow director engine
net/ice: configure HW FDIR rule
Yahui Cao (7):
net/ice: add FDIR create and destroy
net/ice: enable FDIR queue group
net/ice: add FDIR counter resource init/release
net/ice: add FDIR counter support
net/ice: reject duplicate flow for FDIR
net/ice: add FDIR vxlan tunnel support
net/ice: add FDIR GTPU tunnel support
doc/guides/rel_notes/release_19_11.rst | 1 + drivers/net/ice/Makefile | 1 + drivers/net/ice/ice_ethdev.c | 107 +- drivers/net/ice/ice_ethdev.h | 96 ++ drivers/net/ice/ice_fdir_filter.c | 1792 ++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.c | 403 ++++++ drivers/net/ice/ice_rxtx.h | 9 + drivers/net/ice/meson.build | 3 +- 8 files changed, 2392 insertions(+), 20 deletions(-) create mode 100644 drivers/net/ice/ice_fdir_filter.c
Signature · 1 line
2.17.1
PATCH v6 1/9 net/ice: enable flow director engine
From: Beilei Xing <[email protected]>
Enable flow director engine, including initialization and teardown.
- Control VSI create and release.
- Queue pair allocated, set up and release.
- Programming packet create and release.
- FDIR profile create and release.
--- drivers/net/ice/Makefile | 1 + drivers/net/ice/ice_ethdev.c | 107 ++++++-- drivers/net/ice/ice_ethdev.h | 19 ++ drivers/net/ice/ice_fdir_filter.c | 225 +++++++++++++++++ drivers/net/ice/ice_rxtx.c | 403 ++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 9 + drivers/net/ice/meson.build | 3 +- 7 files changed, 747 insertions(+), 20 deletions(-) create mode 100644 drivers/net/ice/ice_fdir_filter.c
drivers/net/ice/Makefile +1 -0
@@ -62,6 +62,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_rxtx_vec_sse.c endif SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_switch_filter.c +SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_fdir_filter.c ifeq ($(findstring RTE_MACHINE_CPUFLAG_AVX2,$(CFLAGS)),RTE_MACHINE_CPUFLAG_AVX2) CC_AVX2_SUPPORT=1 else
drivers/net/ice/ice_ethdev.c +88 -19
188 lines not on this page · raw message
drivers/net/ice/ice_ethdev.h +19 -0
@@ -247,6 +247,17 @@ TAILQ_HEAD(ice_flow_list, rte_flow);struct ice_flow_parser_node ;TAILQ_HEAD (ice_parser_list, ice_flow_parser_node); +/** +* A structure used to define fields of a FDIR related info. +*/ +struct ice_fdir_info { +struct ice_vsi *fdir_vsi;/* pointer to fdir VSI structure */ +struct ice_tx_queue *txq; +struct ice_rx_queue *rxq; +void *prg_pkt;/* memory for fdir program packet */ +uint64_t dma_addr;/* physic address of packet memory*/ +}; +struct ice_pf {struct ice_adapter *adapter;/* The adapter this PF associate to */ struct ice_vsi *main_vsi;/* pointer to main VSI structure */
@@ -267,6 +278,9 @@ struct ice_pf {uint16_t lan_nb_qps;/* The number of queue pairs of LAN */ uint16_t base_queue;/* The base queue pairs index in the device */ uint8_t *proto_xtr;/* Protocol extraction type for all queues */ +uint16_t fdir_nb_qps;/* The number of queue pairs of Flow Director */ +uint16_t fdir_qp_offset; +struct ice_fdir_info fdir;/* flow director info */ struct ice_hw_port_stats stats_offset;struct ice_hw_port_stats stats;/* internal packet statistics, it should be excluded from the total */
@@ -353,6 +367,11 @@ struct ice_vsi_vlan_pvid_info {#define ICE_PF_TO_ETH_DEV (pf) \ (((struct ice_pf *)pf)->adapter->eth_dev) +struct ice_vsi * +ice_setup_vsi (struct ice_pf *pf,enum ice_vsi_type type); +int +ice_release_vsi (struct ice_vsi *vsi); +static inline int ice_align_floor (int n) {
drivers/net/ice/ice_fdir_filter.c new file +225 -0
225 lines not on this page · raw message
drivers/net/ice/ice_rxtx.c +403 -0
430 lines not on this page · raw message
drivers/net/ice/ice_rxtx.h +9 -0
@@ -37,6 +37,8 @@#define ICE_TX_MAX_FREE_BUF_SZ 64#define ICE_DESCS_PER_LOOP 4 +#define ICE_FDIR_PKT_LEN 512 +typedef void (*ice_rx_release_mbufs_t )(struct ice_rx_queue *rxq);typedef void (*ice_tx_release_mbufs_t )(struct ice_tx_queue *txq);
@@ -149,10 +151,16 @@ int ice_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);int ice_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id);int ice_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id);int ice_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id); +int ice_fdir_rx_queue_start (struct rte_eth_dev *dev,uint16_t rx_queue_id); +int ice_fdir_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id); +int ice_fdir_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id); +int ice_fdir_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id);void ice_rx_queue_release (void *rxq);void ice_tx_queue_release (void *txq);void ice_clear_queues (struct rte_eth_dev *dev);void ice_free_queues (struct rte_eth_dev *dev); +int ice_fdir_setup_tx_resources (struct ice_pf *pf); +int ice_fdir_setup_rx_resources (struct ice_pf *pf);uint16_t ice_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); uint16_t ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
@@ -194,4 +202,5 @@ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue, uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx2 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +int ice_fdir_programming (struct ice_pf *pf,struct ice_fltr_desc *fdir_desc);#endif /* _ICE_RXTX_H_ */
drivers/net/ice/meson.build +2 -1
@@ -10,7 +10,8 @@ sources = files( 'ice_ethdev.c', 'ice_rxtx.c', 'ice_switch_filter.c', - 'ice_generic_flow.c' + 'ice_generic_flow.c', + 'ice_fdir_filter.c' ) deps += ['hash']
Signature · 1 line
2.17.1
PATCH v6 2/9 net/ice: configure HW FDIR rule
In reply to Yahui CaoFrom: Beilei Xing <[email protected]>
This patch adds a HW FDIR rule to the FDIR HW table without adding a FDIR filter.
--- drivers/net/ice/ice_ethdev.h | 2 + drivers/net/ice/ice_fdir_filter.c | 277 +++++++++++++++++++++++++++++- 2 files changed, 278 insertions(+), 1 deletion(-)
drivers/net/ice/ice_ethdev.h +2 -0
@@ -281,6 +281,8 @@ struct ice_pf {uint16_t fdir_nb_qps;/* The number of queue pairs of Flow Director */ uint16_t fdir_qp_offset;struct ice_fdir_info fdir;/* flow director info */ +uint16_t hw_prof_cnt[ICE_FLTR_PTYPE_MAX ][ICE_FD_HW_SEG_MAX ]; +uint16_t fdir_fltr_cnt[ICE_FLTR_PTYPE_MAX ][ICE_FD_HW_SEG_MAX ];struct ice_hw_port_stats stats_offset;struct ice_hw_port_stats stats;/* internal packet statistics, it should be excluded from the total */
drivers/net/ice/ice_fdir_filter.c +276 -1
291 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v6 3/9 net/ice: add FDIR create and destroy
In reply to Yahui CaoAdd ice_create_fdir_filter to create a rule. If a flow is matched by flow director filter, filter rule will be set to HW. For now common pattern and queue/passthru/drop/mark actions are supported.
--- doc/guides/rel_notes/release_19_11.rst | 1 + drivers/net/ice/ice_ethdev.h | 6 + drivers/net/ice/ice_fdir_filter.c | 579 ++++++++++++++++++++++++- 3 files changed, 583 insertions(+), 3 deletions(-)
doc/guides/rel_notes/release_19_11.rst +1 -0
@@ -99,6 +99,7 @@ New Features * Added support for device-specific DDP package loading. * Added support for handling Receive Flex Descriptor. * Added support for protocol extraction on per Rx queue. + * Added support for Flow Director filter based on generic filter framework. * Added support for the ``RTE_ETH_DEV_CLOSE_REMOVE`` flag. * Generic filter enhancement - Supported pipeline mode.
drivers/net/ice/ice_ethdev.h +6 -0
@@ -247,6 +247,11 @@ TAILQ_HEAD(ice_flow_list, rte_flow);struct ice_flow_parser_node ;TAILQ_HEAD (ice_parser_list, ice_flow_parser_node); +struct ice_fdir_filter_conf { +struct ice_fdir_fltr input; +uint64_t input_set; +}; +/** * A structure used to define fields of a FDIR related info. */
@@ -256,6 +261,7 @@ struct ice_fdir_info {struct ice_rx_queue *rxq;void *prg_pkt;/* memory for fdir program packet */ uint64_t dma_addr;/* physic address of packet memory*/ +struct ice_fdir_filter_conf conf; };struct ice_pf {
drivers/net/ice/ice_fdir_filter.c +576 -3
619 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v6 4/9 net/ice: enable FDIR queue group
In reply to Yahui CaoFDIR can send packet to a group of queues and distruibte it by RSS.
--- drivers/net/ice/ice_fdir_filter.c | 68 +++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)
drivers/net/ice/ice_fdir_filter.c +68 -0
@@ -10,6 +10,8 @@#define ICE_FDIR_IPV6_TC_OFFSET 20#define ICE_IPV6_TC_MASK (0xFF << ICE_FDIR_IPV6_TC_OFFSET) +#define ICE_FDIR_MAX_QREGION_SIZE 128 +#define ICE_FDIR_INSET_ETH_IPV4 (\ ICE_INSET_DMAC | \ ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_IPV4_TOS | \
@@ -650,6 +652,63 @@ static struct ice_flow_engine ice_fdir_engine = { .type = ICE_FLOW_ENGINE_FDIR, }; +static int +ice_fdir_parse_action_qregion (struct ice_pf *pf, +struct rte_flow_error *error, +const struct rte_flow_action *act, +struct ice_fdir_filter_conf *filter) +{ +const struct rte_flow_action_rss *rss = act->conf; +uint32_t i; + +if (act->type !=RTE_FLOW_ACTION_TYPE_RSS ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Invalid action." ); +return -rte_errno; + } + +if (rss->queue_num <=1 ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Queue region size can't be 0 or 1." ); +return -rte_errno; + } + +/* check if queue index for queue region is continuous */ +for (i =0 ; i < rss->queue_num -1 ; i++) { +if (rss->queue[i +1 ] != rss->queue[i] +1 ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Discontinuous queue region" ); +return -rte_errno; + } + } + +if (rss->queue[rss->queue_num -1 ] >= pf->dev_data->nb_rx_queues) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Invalid queue region indexes." ); +return -rte_errno; + } + +if (!(rte_is_power_of_2 (rss->queue_num) && + (rss->queue_num <=ICE_FDIR_MAX_QREGION_SIZE ))) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"The region size should be any of the following values:" +"1, 2, 4, 8, 16, 32, 64, 128 as long as the total number " +"of queues do not exceed the VSI allocation." ); +return -rte_errno; + } + + filter->input.q_index = rss->queue[0 ]; + filter->input.q_region =rte_fls_u32 (rss->queue_num) -1 ; + filter->input.dest_ctl =ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QGROUP ; + +return 0 ; +} + static int ice_fdir_parse_action(struct ice_adapter *ad, const struct rte_flow_action actions[],
@@ -661,6 +720,7 @@ ice_fdir_parse_action(struct ice_adapter *ad,const struct rte_flow_action_mark *mark_spec =NULL ;uint32_t dest_num =0 ;uint32_t mark_num =0 ; +int ret;for (; actions->type !=RTE_FLOW_ACTION_TYPE_END ; actions++) {switch (actions->type) {
@@ -695,6 +755,14 @@ ice_fdir_parse_action(struct ice_adapter *ad,ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QINDEX ; filter->input.q_index =0 ;break ; +case RTE_FLOW_ACTION_TYPE_RSS : + dest_num++; + + ret =ice_fdir_parse_action_qregion (pf, + error, actions, filter); +if (ret) +return ret; +break ;case RTE_FLOW_ACTION_TYPE_MARK : mark_num++;
Signature · 1 line
2.17.1
PATCH v6 5/9 net/ice: add FDIR counter resource init/release
In reply to Yahui CaoThe patch integrates the counter resource init/release into fdir's init/release scenario
--- drivers/net/ice/ice_ethdev.h | 33 +++++++++++ drivers/net/ice/ice_fdir_filter.c | 92 +++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+)
drivers/net/ice/ice_ethdev.h +33 -0
@@ -252,6 +252,37 @@ struct ice_fdir_filter_conf {uint64_t input_set; }; +#define ICE_FDIR_COUNTER_DEFAULT_POOL_SIZE 1 +#define ICE_FDIR_COUNTER_MAX_POOL_SIZE 32 +#define ICE_FDIR_COUNTERS_PER_BLOCK 256 +#define ICE_FDIR_COUNTER_INDEX (base_idx) \ + ((base_idx) * ICE_FDIR_COUNTERS_PER_BLOCK) +struct ice_fdir_counter { +TAILQ_ENTRY (ice_fdir_counter) next; +uint8_t shared; +uint32_t ref_cnt; +uint32_t id; +uint64_t hits; +uint64_t bytes; +uint32_t hw_index; +}; + +TAILQ_HEAD (ice_fdir_counter_list, ice_fdir_counter); + +struct ice_fdir_counter_pool { +TAILQ_ENTRY (ice_fdir_counter_pool) next; +struct ice_fdir_counter_list counter_list; +struct ice_fdir_counter counters[0 ]; +}; + +TAILQ_HEAD (ice_fdir_counter_pool_list, ice_fdir_counter_pool); + +struct ice_fdir_counter_pool_container { +struct ice_fdir_counter_pool_list pool_list; +struct ice_fdir_counter_pool *pools[ICE_FDIR_COUNTER_MAX_POOL_SIZE ]; +uint8_t index_free; +}; +/** * A structure used to define fields of a FDIR related info. */
@@ -262,6 +293,8 @@ struct ice_fdir_info {void *prg_pkt;/* memory for fdir program packet */ uint64_t dma_addr;/* physic address of packet memory*/ struct ice_fdir_filter_conf conf; + +struct ice_fdir_counter_pool_container counter; };struct ice_pf {
drivers/net/ice/ice_fdir_filter.c +92 -0
110 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v6 6/9 net/ice: add FDIR counter support
In reply to Yahui CaoThis patch add FDIR statistical counter support and it includes RTE_FLOW count actions support and query support.
RTE_FLOW count actions support id and shared. RTE_FLOW query record packet hits by default.
--- drivers/net/ice/ice_ethdev.h | 7 ++ drivers/net/ice/ice_fdir_filter.c | 179 +++++++++++++++++++++++++++++- 2 files changed, 185 insertions(+), 1 deletion(-)
drivers/net/ice/ice_ethdev.h +7 -0
@@ -249,6 +249,10 @@ TAILQ_HEAD(ice_parser_list, ice_flow_parser_node);struct ice_fdir_filter_conf {struct ice_fdir_fltr input; + +struct ice_fdir_counter *counter;/* flow specific counter context */ +struct rte_flow_action_count act_count; +uint64_t input_set; };
@@ -257,8 +261,11 @@ struct ice_fdir_filter_conf {#define ICE_FDIR_COUNTERS_PER_BLOCK 256#define ICE_FDIR_COUNTER_INDEX (base_idx) \ ((base_idx) * ICE_FDIR_COUNTERS_PER_BLOCK) +struct ice_fdir_counter_pool ; +struct ice_fdir_counter {TAILQ_ENTRY (ice_fdir_counter) next; +struct ice_fdir_counter_pool *pool;uint8_t shared;uint32_t ref_cnt;uint32_t id;
drivers/net/ice/ice_fdir_filter.c +178 -1
239 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v6 7/9 net/ice: reject duplicate flow for FDIR
In reply to Yahui CaoEnable duplication lookup for existing flow director rule entry.
--- drivers/net/ice/ice_ethdev.h | 17 +++ drivers/net/ice/ice_fdir_filter.c | 185 ++++++++++++++++++++++++++++-- 2 files changed, 195 insertions(+), 7 deletions(-)
drivers/net/ice/ice_ethdev.h +17 -0
@@ -256,6 +256,20 @@ struct ice_fdir_filter_conf {uint64_t input_set; }; +#define ICE_MAX_FDIR_FILTER_NUM (1024 * 16) + +struct ice_fdir_fltr_pattern { +enum ice_fltr_ptype flow_type; + +union { +struct ice_fdir_v4 v4; +struct ice_fdir_v6 v6; + } ip, mask; + +struct ice_fdir_extra ext_data; +struct ice_fdir_extra ext_mask; +}; +#define ICE_FDIR_COUNTER_DEFAULT_POOL_SIZE 1#define ICE_FDIR_COUNTER_MAX_POOL_SIZE 32#define ICE_FDIR_COUNTERS_PER_BLOCK 256
@@ -301,6 +315,9 @@ struct ice_fdir_info {uint64_t dma_addr;/* physic address of packet memory*/ struct ice_fdir_filter_conf conf; +struct ice_fdir_filter_conf **hash_map; +struct rte_hash *hash_table; +struct ice_fdir_counter_pool_container counter; };
drivers/net/ice/ice_fdir_filter.c +178 -7
253 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v6 8/9 net/ice: add FDIR vxlan tunnel support
In reply to Yahui CaoEnable FDIR vxlan tunnel matching for RTE_FLOW
--- drivers/net/ice/ice_ethdev.h | 8 +++ drivers/net/ice/ice_fdir_filter.c | 108 ++++++++++++++++++++++++++---- 2 files changed, 104 insertions(+), 12 deletions(-)
drivers/net/ice/ice_ethdev.h +8 -0
@@ -241,6 +241,11 @@ struct ice_vsi {bool offset_loaded; }; +enum ice_fdir_tunnel_type { +ICE_FDIR_TUNNEL_TYPE_NONE =0 , +ICE_FDIR_TUNNEL_TYPE_VXLAN , +}; +struct rte_flow ;TAILQ_HEAD (ice_flow_list, rte_flow);
@@ -249,6 +254,7 @@ TAILQ_HEAD(ice_parser_list, ice_flow_parser_node);struct ice_fdir_filter_conf {struct ice_fdir_fltr input; +enum ice_fdir_tunnel_type tunnel_type;struct ice_fdir_counter *counter;/* flow specific counter context */ struct rte_flow_action_count act_count;
@@ -268,6 +274,8 @@ struct ice_fdir_fltr_pattern {struct ice_fdir_extra ext_data;struct ice_fdir_extra ext_mask; + +enum ice_fdir_tunnel_type tunnel_type; };#define ICE_FDIR_COUNTER_DEFAULT_POOL_SIZE 1
drivers/net/ice/ice_fdir_filter.c +96 -12
232 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v6 9/9 net/ice: add FDIR GTPU tunnel support
In reply to Yahui CaoEnable FDIR GTPU matching for RTE_FLOW
--- drivers/net/ice/ice_ethdev.h | 4 + drivers/net/ice/ice_fdir_filter.c | 147 ++++++++++++++++++++++++++++-- 2 files changed, 141 insertions(+), 10 deletions(-)
drivers/net/ice/ice_ethdev.h +4 -0
@@ -244,6 +244,7 @@ struct ice_vsi {enum ice_fdir_tunnel_type {ICE_FDIR_TUNNEL_TYPE_NONE =0 ,ICE_FDIR_TUNNEL_TYPE_VXLAN , +ICE_FDIR_TUNNEL_TYPE_GTPU , };struct rte_flow ;
@@ -272,6 +273,9 @@ struct ice_fdir_fltr_pattern {struct ice_fdir_v6 v6; } ip, mask; +struct ice_fdir_udp_gtp gtpu_data; +struct ice_fdir_udp_gtp gtpu_mask; +struct ice_fdir_extra ext_data;struct ice_fdir_extra ext_mask;
drivers/net/ice/ice_fdir_filter.c +137 -10
245 lines not on this page · raw message
Signature · 1 line
2.17.1
v7 cover net/ice: add ice Flow Director driver
In reply to Yahui CaoThis patch series adds Flow Director support for Intel Ethernet Controller E810 series using RTE_FLOW
- Patch 01-02 are FDIR init,teardown and configuration
- Remaining patches are FDIR RTE_FLOW enablement
---
v7:
* Fix shared library build error
v6:
* Fix build error on different platform
v5:
* Add GTPU rule support
* Fix tunnel profile conflict issue
* Update filter counter
v4:
* Remove rte_wmb.
* Update input set mapping table.
* Remove all created profiles during teardown
* Fix tunnel rule duplication detection failure
* Change function name
v3:
* Get flow id in flexible descriptor
* Add vxlan tunnel rule support
v2:
* Move to flexible descriptor.
* Distinguish tunnel and non-tunnel rule.
* Add uninit function for fdir engine.
* Fix coding style.
* Change patch organization.
* Add release notes.
Beilei Xing (2):
net/ice: enable flow director engine
net/ice: configure HW FDIR rule
Yahui Cao (7):
net/ice: add FDIR create and destroy
net/ice: enable FDIR queue group
net/ice: add FDIR counter resource init/release
net/ice: add FDIR counter support
net/ice: reject duplicate flow for FDIR
net/ice: add FDIR vxlan tunnel support
net/ice: add FDIR GTPU tunnel support
doc/guides/rel_notes/release_19_11.rst | 1 + drivers/net/ice/Makefile | 3 +- drivers/net/ice/ice_ethdev.c | 107 +- drivers/net/ice/ice_ethdev.h | 96 ++ drivers/net/ice/ice_fdir_filter.c | 1792 ++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.c | 403 ++++++ drivers/net/ice/ice_rxtx.h | 9 + drivers/net/ice/meson.build | 3 +- 8 files changed, 2393 insertions(+), 21 deletions(-) create mode 100644 drivers/net/ice/ice_fdir_filter.c
Signature · 1 line
2.17.1
PATCH v7 1/9 net/ice: enable flow director engine
From: Beilei Xing <[email protected]>
Enable flow director engine, including initialization and teardown.
- Control VSI create and release.
- Queue pair allocated, set up and release.
- Programming packet create and release.
- FDIR profile create and release.
--- drivers/net/ice/Makefile | 1 + drivers/net/ice/ice_ethdev.c | 107 ++++++-- drivers/net/ice/ice_ethdev.h | 19 ++ drivers/net/ice/ice_fdir_filter.c | 225 +++++++++++++++++ drivers/net/ice/ice_rxtx.c | 403 ++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 9 + drivers/net/ice/meson.build | 3 +- 7 files changed, 747 insertions(+), 20 deletions(-) create mode 100644 drivers/net/ice/ice_fdir_filter.c
drivers/net/ice/Makefile +1 -0
@@ -62,6 +62,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_rxtx_vec_sse.c endif SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_switch_filter.c +SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_fdir_filter.c ifeq ($(findstring RTE_MACHINE_CPUFLAG_AVX2,$(CFLAGS)),RTE_MACHINE_CPUFLAG_AVX2) CC_AVX2_SUPPORT=1 else
drivers/net/ice/ice_ethdev.c +88 -19
188 lines not on this page · raw message
drivers/net/ice/ice_ethdev.h +19 -0
@@ -247,6 +247,17 @@ TAILQ_HEAD(ice_flow_list, rte_flow);struct ice_flow_parser_node ;TAILQ_HEAD (ice_parser_list, ice_flow_parser_node); +/** +* A structure used to define fields of a FDIR related info. +*/ +struct ice_fdir_info { +struct ice_vsi *fdir_vsi;/* pointer to fdir VSI structure */ +struct ice_tx_queue *txq; +struct ice_rx_queue *rxq; +void *prg_pkt;/* memory for fdir program packet */ +uint64_t dma_addr;/* physic address of packet memory*/ +}; +struct ice_pf {struct ice_adapter *adapter;/* The adapter this PF associate to */ struct ice_vsi *main_vsi;/* pointer to main VSI structure */
@@ -267,6 +278,9 @@ struct ice_pf {uint16_t lan_nb_qps;/* The number of queue pairs of LAN */ uint16_t base_queue;/* The base queue pairs index in the device */ uint8_t *proto_xtr;/* Protocol extraction type for all queues */ +uint16_t fdir_nb_qps;/* The number of queue pairs of Flow Director */ +uint16_t fdir_qp_offset; +struct ice_fdir_info fdir;/* flow director info */ struct ice_hw_port_stats stats_offset;struct ice_hw_port_stats stats;/* internal packet statistics, it should be excluded from the total */
@@ -353,6 +367,11 @@ struct ice_vsi_vlan_pvid_info {#define ICE_PF_TO_ETH_DEV (pf) \ (((struct ice_pf *)pf)->adapter->eth_dev) +struct ice_vsi * +ice_setup_vsi (struct ice_pf *pf,enum ice_vsi_type type); +int +ice_release_vsi (struct ice_vsi *vsi); +static inline int ice_align_floor (int n) {
drivers/net/ice/ice_fdir_filter.c new file +225 -0
225 lines not on this page · raw message
drivers/net/ice/ice_rxtx.c +403 -0
430 lines not on this page · raw message
drivers/net/ice/ice_rxtx.h +9 -0
@@ -37,6 +37,8 @@#define ICE_TX_MAX_FREE_BUF_SZ 64#define ICE_DESCS_PER_LOOP 4 +#define ICE_FDIR_PKT_LEN 512 +typedef void (*ice_rx_release_mbufs_t )(struct ice_rx_queue *rxq);typedef void (*ice_tx_release_mbufs_t )(struct ice_tx_queue *txq);
@@ -149,10 +151,16 @@ int ice_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);int ice_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id);int ice_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id);int ice_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id); +int ice_fdir_rx_queue_start (struct rte_eth_dev *dev,uint16_t rx_queue_id); +int ice_fdir_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id); +int ice_fdir_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id); +int ice_fdir_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id);void ice_rx_queue_release (void *rxq);void ice_tx_queue_release (void *txq);void ice_clear_queues (struct rte_eth_dev *dev);void ice_free_queues (struct rte_eth_dev *dev); +int ice_fdir_setup_tx_resources (struct ice_pf *pf); +int ice_fdir_setup_rx_resources (struct ice_pf *pf);uint16_t ice_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); uint16_t ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
@@ -194,4 +202,5 @@ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue, uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx2 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +int ice_fdir_programming (struct ice_pf *pf,struct ice_fltr_desc *fdir_desc);#endif /* _ICE_RXTX_H_ */
drivers/net/ice/meson.build +2 -1
@@ -10,7 +10,8 @@ sources = files( 'ice_ethdev.c', 'ice_rxtx.c', 'ice_switch_filter.c', - 'ice_generic_flow.c' + 'ice_generic_flow.c', + 'ice_fdir_filter.c' ) deps += ['hash']
Signature · 1 line
2.17.1
PATCH v7 2/9 net/ice: configure HW FDIR rule
In reply to Yahui CaoFrom: Beilei Xing <[email protected]>
This patch adds a HW FDIR rule to the FDIR HW table without adding a FDIR filter.
--- drivers/net/ice/ice_ethdev.h | 2 + drivers/net/ice/ice_fdir_filter.c | 277 +++++++++++++++++++++++++++++- 2 files changed, 278 insertions(+), 1 deletion(-)
drivers/net/ice/ice_ethdev.h +2 -0
@@ -281,6 +281,8 @@ struct ice_pf {uint16_t fdir_nb_qps;/* The number of queue pairs of Flow Director */ uint16_t fdir_qp_offset;struct ice_fdir_info fdir;/* flow director info */ +uint16_t hw_prof_cnt[ICE_FLTR_PTYPE_MAX ][ICE_FD_HW_SEG_MAX ]; +uint16_t fdir_fltr_cnt[ICE_FLTR_PTYPE_MAX ][ICE_FD_HW_SEG_MAX ];struct ice_hw_port_stats stats_offset;struct ice_hw_port_stats stats;/* internal packet statistics, it should be excluded from the total */
drivers/net/ice/ice_fdir_filter.c +276 -1
291 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v7 3/9 net/ice: add FDIR create and destroy
In reply to Yahui CaoAdd ice_create_fdir_filter to create a rule. If a flow is matched by flow director filter, filter rule will be set to HW. For now common pattern and queue/passthru/drop/mark actions are supported.
--- doc/guides/rel_notes/release_19_11.rst | 1 + drivers/net/ice/ice_ethdev.h | 6 + drivers/net/ice/ice_fdir_filter.c | 579 ++++++++++++++++++++++++- 3 files changed, 583 insertions(+), 3 deletions(-)
doc/guides/rel_notes/release_19_11.rst +1 -0
@@ -99,6 +99,7 @@ New Features * Added support for device-specific DDP package loading. * Added support for handling Receive Flex Descriptor. * Added support for protocol extraction on per Rx queue. + * Added support for Flow Director filter based on generic filter framework. * Added support for the ``RTE_ETH_DEV_CLOSE_REMOVE`` flag. * Generic filter enhancement - Supported pipeline mode.
drivers/net/ice/ice_ethdev.h +6 -0
@@ -247,6 +247,11 @@ TAILQ_HEAD(ice_flow_list, rte_flow);struct ice_flow_parser_node ;TAILQ_HEAD (ice_parser_list, ice_flow_parser_node); +struct ice_fdir_filter_conf { +struct ice_fdir_fltr input; +uint64_t input_set; +}; +/** * A structure used to define fields of a FDIR related info. */
@@ -256,6 +261,7 @@ struct ice_fdir_info {struct ice_rx_queue *rxq;void *prg_pkt;/* memory for fdir program packet */ uint64_t dma_addr;/* physic address of packet memory*/ +struct ice_fdir_filter_conf conf; };struct ice_pf {
drivers/net/ice/ice_fdir_filter.c +576 -3
619 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v7 4/9 net/ice: enable FDIR queue group
In reply to Yahui CaoFDIR can send packet to a group of queues and distruibte it by RSS.
--- drivers/net/ice/ice_fdir_filter.c | 68 +++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)
drivers/net/ice/ice_fdir_filter.c +68 -0
@@ -10,6 +10,8 @@#define ICE_FDIR_IPV6_TC_OFFSET 20#define ICE_IPV6_TC_MASK (0xFF << ICE_FDIR_IPV6_TC_OFFSET) +#define ICE_FDIR_MAX_QREGION_SIZE 128 +#define ICE_FDIR_INSET_ETH_IPV4 (\ ICE_INSET_DMAC | \ ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_IPV4_TOS | \
@@ -650,6 +652,63 @@ static struct ice_flow_engine ice_fdir_engine = { .type = ICE_FLOW_ENGINE_FDIR, }; +static int +ice_fdir_parse_action_qregion (struct ice_pf *pf, +struct rte_flow_error *error, +const struct rte_flow_action *act, +struct ice_fdir_filter_conf *filter) +{ +const struct rte_flow_action_rss *rss = act->conf; +uint32_t i; + +if (act->type !=RTE_FLOW_ACTION_TYPE_RSS ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Invalid action." ); +return -rte_errno; + } + +if (rss->queue_num <=1 ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Queue region size can't be 0 or 1." ); +return -rte_errno; + } + +/* check if queue index for queue region is continuous */ +for (i =0 ; i < rss->queue_num -1 ; i++) { +if (rss->queue[i +1 ] != rss->queue[i] +1 ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Discontinuous queue region" ); +return -rte_errno; + } + } + +if (rss->queue[rss->queue_num -1 ] >= pf->dev_data->nb_rx_queues) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"Invalid queue region indexes." ); +return -rte_errno; + } + +if (!(rte_is_power_of_2 (rss->queue_num) && + (rss->queue_num <=ICE_FDIR_MAX_QREGION_SIZE ))) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , act, +"The region size should be any of the following values:" +"1, 2, 4, 8, 16, 32, 64, 128 as long as the total number " +"of queues do not exceed the VSI allocation." ); +return -rte_errno; + } + + filter->input.q_index = rss->queue[0 ]; + filter->input.q_region =rte_fls_u32 (rss->queue_num) -1 ; + filter->input.dest_ctl =ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QGROUP ; + +return 0 ; +} + static int ice_fdir_parse_action(struct ice_adapter *ad, const struct rte_flow_action actions[],
@@ -661,6 +720,7 @@ ice_fdir_parse_action(struct ice_adapter *ad,const struct rte_flow_action_mark *mark_spec =NULL ;uint32_t dest_num =0 ;uint32_t mark_num =0 ; +int ret;for (; actions->type !=RTE_FLOW_ACTION_TYPE_END ; actions++) {switch (actions->type) {
@@ -695,6 +755,14 @@ ice_fdir_parse_action(struct ice_adapter *ad,ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QINDEX ; filter->input.q_index =0 ;break ; +case RTE_FLOW_ACTION_TYPE_RSS : + dest_num++; + + ret =ice_fdir_parse_action_qregion (pf, + error, actions, filter); +if (ret) +return ret; +break ;case RTE_FLOW_ACTION_TYPE_MARK : mark_num++;
Signature · 1 line
2.17.1
PATCH v7 5/9 net/ice: add FDIR counter resource init/release
In reply to Yahui CaoThe patch integrates the counter resource init/release into fdir's init/release scenario
--- drivers/net/ice/ice_ethdev.h | 33 +++++++++++ drivers/net/ice/ice_fdir_filter.c | 92 +++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+)
drivers/net/ice/ice_ethdev.h +33 -0
@@ -252,6 +252,37 @@ struct ice_fdir_filter_conf {uint64_t input_set; }; +#define ICE_FDIR_COUNTER_DEFAULT_POOL_SIZE 1 +#define ICE_FDIR_COUNTER_MAX_POOL_SIZE 32 +#define ICE_FDIR_COUNTERS_PER_BLOCK 256 +#define ICE_FDIR_COUNTER_INDEX (base_idx) \ + ((base_idx) * ICE_FDIR_COUNTERS_PER_BLOCK) +struct ice_fdir_counter { +TAILQ_ENTRY (ice_fdir_counter) next; +uint8_t shared; +uint32_t ref_cnt; +uint32_t id; +uint64_t hits; +uint64_t bytes; +uint32_t hw_index; +}; + +TAILQ_HEAD (ice_fdir_counter_list, ice_fdir_counter); + +struct ice_fdir_counter_pool { +TAILQ_ENTRY (ice_fdir_counter_pool) next; +struct ice_fdir_counter_list counter_list; +struct ice_fdir_counter counters[0 ]; +}; + +TAILQ_HEAD (ice_fdir_counter_pool_list, ice_fdir_counter_pool); + +struct ice_fdir_counter_pool_container { +struct ice_fdir_counter_pool_list pool_list; +struct ice_fdir_counter_pool *pools[ICE_FDIR_COUNTER_MAX_POOL_SIZE ]; +uint8_t index_free; +}; +/** * A structure used to define fields of a FDIR related info. */
@@ -262,6 +293,8 @@ struct ice_fdir_info {void *prg_pkt;/* memory for fdir program packet */ uint64_t dma_addr;/* physic address of packet memory*/ struct ice_fdir_filter_conf conf; + +struct ice_fdir_counter_pool_container counter; };struct ice_pf {
drivers/net/ice/ice_fdir_filter.c +92 -0
110 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v7 6/9 net/ice: add FDIR counter support
In reply to Yahui CaoThis patch add FDIR statistical counter support and it includes RTE_FLOW count actions support and query support.
RTE_FLOW count actions support id and shared. RTE_FLOW query record packet hits by default.
--- drivers/net/ice/ice_ethdev.h | 7 ++ drivers/net/ice/ice_fdir_filter.c | 179 +++++++++++++++++++++++++++++- 2 files changed, 185 insertions(+), 1 deletion(-)
drivers/net/ice/ice_ethdev.h +7 -0
@@ -249,6 +249,10 @@ TAILQ_HEAD(ice_parser_list, ice_flow_parser_node);struct ice_fdir_filter_conf {struct ice_fdir_fltr input; + +struct ice_fdir_counter *counter;/* flow specific counter context */ +struct rte_flow_action_count act_count; +uint64_t input_set; };
@@ -257,8 +261,11 @@ struct ice_fdir_filter_conf {#define ICE_FDIR_COUNTERS_PER_BLOCK 256#define ICE_FDIR_COUNTER_INDEX (base_idx) \ ((base_idx) * ICE_FDIR_COUNTERS_PER_BLOCK) +struct ice_fdir_counter_pool ; +struct ice_fdir_counter {TAILQ_ENTRY (ice_fdir_counter) next; +struct ice_fdir_counter_pool *pool;uint8_t shared;uint32_t ref_cnt;uint32_t id;
drivers/net/ice/ice_fdir_filter.c +178 -1
239 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v7 7/9 net/ice: reject duplicate flow for FDIR
In reply to Yahui CaoEnable duplication lookup for existing flow director rule entry.
--- drivers/net/ice/Makefile | 2 +- drivers/net/ice/ice_ethdev.h | 17 +++ drivers/net/ice/ice_fdir_filter.c | 185 ++++++++++++++++++++++++++++-- 3 files changed, 196 insertions(+), 8 deletions(-)
drivers/net/ice/Makefile +1 -1
@@ -13,7 +13,7 @@ CFLAGS += $(WERROR_FLAGS) CFLAGS += -DALLOW_EXPERIMENTAL_API LDLIBS += -lrte_eal -lrte_mbuf -lrte_ethdev -lrte_kvargs -LDLIBS += -lrte_bus_pci -lrte_mempool +LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_hash EXPORT_MAP := rte_pmd_ice_version.map
drivers/net/ice/ice_ethdev.h +17 -0
@@ -256,6 +256,20 @@ struct ice_fdir_filter_conf {uint64_t input_set; }; +#define ICE_MAX_FDIR_FILTER_NUM (1024 * 16) + +struct ice_fdir_fltr_pattern { +enum ice_fltr_ptype flow_type; + +union { +struct ice_fdir_v4 v4; +struct ice_fdir_v6 v6; + } ip, mask; + +struct ice_fdir_extra ext_data; +struct ice_fdir_extra ext_mask; +}; +#define ICE_FDIR_COUNTER_DEFAULT_POOL_SIZE 1#define ICE_FDIR_COUNTER_MAX_POOL_SIZE 32#define ICE_FDIR_COUNTERS_PER_BLOCK 256
@@ -301,6 +315,9 @@ struct ice_fdir_info {uint64_t dma_addr;/* physic address of packet memory*/ struct ice_fdir_filter_conf conf; +struct ice_fdir_filter_conf **hash_map; +struct rte_hash *hash_table; +struct ice_fdir_counter_pool_container counter; };
drivers/net/ice/ice_fdir_filter.c +178 -7
253 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v7 8/9 net/ice: add FDIR vxlan tunnel support
In reply to Yahui CaoEnable FDIR vxlan tunnel matching for RTE_FLOW
--- drivers/net/ice/ice_ethdev.h | 8 +++ drivers/net/ice/ice_fdir_filter.c | 108 ++++++++++++++++++++++++++---- 2 files changed, 104 insertions(+), 12 deletions(-)
drivers/net/ice/ice_ethdev.h +8 -0
@@ -241,6 +241,11 @@ struct ice_vsi {bool offset_loaded; }; +enum ice_fdir_tunnel_type { +ICE_FDIR_TUNNEL_TYPE_NONE =0 , +ICE_FDIR_TUNNEL_TYPE_VXLAN , +}; +struct rte_flow ;TAILQ_HEAD (ice_flow_list, rte_flow);
@@ -249,6 +254,7 @@ TAILQ_HEAD(ice_parser_list, ice_flow_parser_node);struct ice_fdir_filter_conf {struct ice_fdir_fltr input; +enum ice_fdir_tunnel_type tunnel_type;struct ice_fdir_counter *counter;/* flow specific counter context */ struct rte_flow_action_count act_count;
@@ -268,6 +274,8 @@ struct ice_fdir_fltr_pattern {struct ice_fdir_extra ext_data;struct ice_fdir_extra ext_mask; + +enum ice_fdir_tunnel_type tunnel_type; };#define ICE_FDIR_COUNTER_DEFAULT_POOL_SIZE 1
drivers/net/ice/ice_fdir_filter.c +96 -12
232 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v7 9/9 net/ice: add FDIR GTPU tunnel support
In reply to Yahui CaoEnable FDIR GTPU matching for RTE_FLOW
--- drivers/net/ice/ice_ethdev.h | 4 + drivers/net/ice/ice_fdir_filter.c | 147 ++++++++++++++++++++++++++++-- 2 files changed, 141 insertions(+), 10 deletions(-)
drivers/net/ice/ice_ethdev.h +4 -0
@@ -244,6 +244,7 @@ struct ice_vsi {enum ice_fdir_tunnel_type {ICE_FDIR_TUNNEL_TYPE_NONE =0 ,ICE_FDIR_TUNNEL_TYPE_VXLAN , +ICE_FDIR_TUNNEL_TYPE_GTPU , };struct rte_flow ;
@@ -272,6 +273,9 @@ struct ice_fdir_fltr_pattern {struct ice_fdir_v6 v6; } ip, mask; +struct ice_fdir_udp_gtp gtpu_data; +struct ice_fdir_udp_gtp gtpu_mask; +struct ice_fdir_extra ext_data;struct ice_fdir_extra ext_mask;
drivers/net/ice/ice_fdir_filter.c +137 -10
245 lines not on this page · raw message
Signature · 1 line
2.17.1
Quoted 59 lines · Yahui Cao
This patch series adds Flow Director support for Intel Ethernet Controller E810 series using
RTE_FLOW- Patch 01-02 are FDIR init,teardown and configuration
- Remaining patches are FDIRRTE_FLOWenablement---
v7:
* Fix shared library build errorv6:
* Fix build error on different platformv5:
* Add GTPU rule support
* Fix tunnel profile conflict issue
* Update filter counterv4:
* Removerte_wmb.
* Update input set mapping table.
* Remove all created profiles during teardown
* Fix tunnel rule duplication detection failure
* Change function namev3:
* Get flow id in flexible descriptor
* Add vxlan tunnel rule supportv2:
* Move to flexible descriptor.
* Distinguish tunnel and non-tunnel rule.
* Add uninit function for fdir engine.
* Fix coding style.
* Change patch organization.
* Add release notes.Beilei Xing (2):
net/ice: enable flow director engine
net/ice: configure HW FDIR ruleYahui Cao (7):
net/ice: add FDIR create and destroy
net/ice: enable FDIR queue group
net/ice: add FDIR counter resource init/release
net/ice: add FDIR counter support
net/ice: reject duplicate flow for FDIR
net/ice: add FDIR vxlan tunnel support
net/ice: add FDIR GTPU tunnel supportdoc/guides/rel_notes/release_19_11.rst | 1 + drivers/net/ice/Makefile | 3 +- drivers/net/ice/ice_ethdev.c | 107 +- drivers/net/ice/ice_ethdev.h | 96 ++ drivers/net/ice/ice_fdir_filter.c | 1792 ++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.c | 403 ++++++ drivers/net/ice/ice_rxtx.h | 9 + drivers/net/ice/meson.build | 3 +- 8 files changed, 2393 insertions(+), 21 deletions(-)
Quoted 5 lines
create mode 100644
drivers/net/ice/ice_fdir_filter.cSignature · 1 line
2.17.1
Series applied to dpdk-next-net-intel.
Thanks,
Xiaolong