add alternative AVX512 offload path
cover add alternative AVX512 offload path
Add alternative Rx/Tx offload path for AVX512, which can support Rx/Tx offload features, like checksum/vlan/RSS/QinQ offload.
Leyi Rong (2):
net/ice: add Tx AVX512 offload path
net/ice: add Rx AVX512 offload path
drivers/net/ice/ice_rxtx.c | 73 ++- drivers/net/ice/ice_rxtx.h | 10 + drivers/net/ice/ice_rxtx_vec_avx2.c | 2 +- drivers/net/ice/ice_rxtx_vec_avx512.c | 653 ++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx_vec_common.h | 127 ++++- drivers/net/ice/ice_rxtx_vec_sse.c | 2 +- 6 files changed, 825 insertions(+), 42 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/2 net/ice: add Tx AVX512 offload path
Add alternative Tx data path for AVX512 which can support partial Tx offload features, including Tx checksum offload, vlan/QinQ insertion offload.
--- drivers/net/ice/ice_rxtx.c | 27 ++++- drivers/net/ice/ice_rxtx.h | 3 + drivers/net/ice/ice_rxtx_vec_avx2.c | 2 +- drivers/net/ice/ice_rxtx_vec_avx512.c | 157 ++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx_vec_common.h | 104 ++++++++++++++--- drivers/net/ice/ice_rxtx_vec_sse.c | 2 +- 6 files changed, 271 insertions(+), 24 deletions(-)
drivers/net/ice/ice_rxtx.c +21 -6
@@ -8,6 +8,7 @@#include "rte_pmd_ice.h" #include "ice_rxtx.h" +#include "ice_rxtx_vec_common.h" #define ICE_TX_CKSUM_OFFLOAD_MASK ( \ PKT_TX_IP_CKSUM | \
@@ -3267,12 +3268,14 @@ ice_set_tx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ice_tx_queue *txq;int i; +int tx_check_ret;bool use_avx512 = false;bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_tx_vec_dev_check (dev) && -rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { + tx_check_ret =ice_tx_vec_dev_check (dev); +if (tx_check_ret >=0 && +rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { ad->tx_vec_allowed = true;for (i =0 ; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i];
@@ -3291,12 +3294,15 @@ ice_set_tx_function(struct rte_eth_dev *dev)PMD_DRV_LOG (NOTICE ,"AVX512 is not supported in build env" );#endif -if (!use_avx512 && +if (!use_avx512 && tx_check_ret ==ICE_VECTOR_PATH && (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 ||rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) use_avx2 = true; +if (!use_avx512 && tx_check_ret ==ICE_VECTOR_OFFLOAD_PATH ) + ad->tx_vec_allowed = false; + }else { ad->tx_vec_allowed = false; }
@@ -3305,9 +3311,18 @@ ice_set_tx_function(struct rte_eth_dev *dev)if (ad->tx_vec_allowed) {if (use_avx512) {#ifdef CC_AVX512_SUPPORT -PMD_DRV_LOG (NOTICE ,"Using AVX512 Vector Tx (port %d)." , - dev->data->port_id); - dev->tx_pkt_burst = ice_xmit_pkts_vec_avx512; +if (tx_check_ret ==ICE_VECTOR_OFFLOAD_PATH ) { +PMD_DRV_LOG (NOTICE , +"Using AVX512 OFFLOAD Vector Tx (port %d)." , + dev->data->port_id); + dev->tx_pkt_burst = + ice_xmit_pkts_vec_avx512_offload; + }else { +PMD_DRV_LOG (NOTICE , +"Using AVX512 Vector Tx (port %d)." , + dev->data->port_id); + dev->tx_pkt_burst = ice_xmit_pkts_vec_avx512; + }#endif }else { PMD_DRV_LOG(DEBUG, "Using %sVector Tx (port %d).",
drivers/net/ice/ice_rxtx.h +3 -0
@@ -261,6 +261,9 @@ uint16_t ice_recv_scattered_pkts_vec_avx512(void *rx_queue, uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx512 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t ice_xmit_pkts_vec_avx512_offload (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);int ice_tx_done_cleanup (void *txq,uint32_t free_cnt);int ice_get_monitor_addr (void *rx_queue,struct rte_power_monitor_cond *pmc);
drivers/net/ice/ice_rxtx_vec_avx2.c +1 -1
@@ -969,7 +969,7 @@ ice_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts, nb_pkts =RTE_MIN (nb_pkts, txq->tx_rs_thresh);if (txq->nb_tx_free < txq->tx_free_thresh) -ice_tx_free_bufs (txq); +ice_tx_free_bufs_vec (txq); nb_commit = nb_pkts = (uint16_t )RTE_MIN (txq->nb_tx_free, nb_pkts);if (unlikely (nb_pkts ==0 ))
drivers/net/ice/ice_rxtx_vec_avx512.c +157 -0
160 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_common.h +88 -16
145 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_sse.c +1 -1
@@ -702,7 +702,7 @@ ice_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts, nb_pkts =RTE_MIN (nb_pkts, txq->tx_rs_thresh);if (txq->nb_tx_free < txq->tx_free_thresh) -ice_tx_free_bufs (txq); +ice_tx_free_bufs_vec (txq); nb_pkts = (uint16_t )RTE_MIN (txq->nb_tx_free, nb_pkts); nb_commit = nb_pkts;
Signature · 1 line
2.17.1
PATCH 2/2 net/ice: add Rx AVX512 offload path
In reply to Leyi RongSplit AVX512 Rx data path into two, one is for basic, the other one can support additional Rx offload features, including Rx checksum offload, Rx vlan offload, RSS offload.
--- drivers/net/ice/ice_rxtx.c | 46 ++- drivers/net/ice/ice_rxtx.h | 7 + drivers/net/ice/ice_rxtx_vec_avx512.c | 496 ++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx_vec_common.h | 49 ++- 4 files changed, 567 insertions(+), 31 deletions(-)
drivers/net/ice/ice_rxtx.c +34 -12
@@ -1059,6 +1059,7 @@ ice_rx_queue_setup(struct rte_eth_dev *dev,uint32_t ring_size;uint16_t len;int use_def_burst_func =1 ; +uint64_t offloads; if (nb_desc % ICE_ALIGN_RING_DESC != 0 || nb_desc > ICE_MAX_RING_DESC ||
@@ -1068,6 +1069,8 @@ ice_rx_queue_setup(struct rte_eth_dev *dev,return -EINVAL ; } + offloads = rx_conf->offloads | dev->data->dev_conf.rxmode.offloads; +/* Free memory if needed */ if (dev->data->rx_queues[queue_idx]) {ice_rx_queue_release (dev->data->rx_queues[queue_idx]);
@@ -1088,6 +1091,7 @@ ice_rx_queue_setup(struct rte_eth_dev *dev, rxq->nb_rx_desc = nb_desc; rxq->rx_free_thresh = rx_conf->rx_free_thresh; rxq->queue_id = queue_idx; + rxq->offloads = offloads; rxq->reg_idx = vsi->base_queue + queue_idx; rxq->port_id = dev->data->port_id;
@@ -3052,12 +3056,14 @@ ice_set_rx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ice_rx_queue *rxq;int i; +int rx_check_ret;bool use_avx512 = false;bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_rx_vec_dev_check (dev) && ad->rx_bulk_alloc_allowed && -rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { + rx_check_ret =ice_rx_vec_dev_check (dev); +if (rx_check_ret >=0 && ad->rx_bulk_alloc_allowed && +rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { ad->rx_vec_allowed = true;for (i =0 ; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i];
@@ -3091,11 +3097,19 @@ ice_set_rx_function(struct rte_eth_dev *dev)if (dev->data->scattered_rx) {if (use_avx512) {#ifdef CC_AVX512_SUPPORT -PMD_DRV_LOG (NOTICE , -"Using AVX512 Vector Scattered Rx (port %d)." , - dev->data->port_id); - dev->rx_pkt_burst = - ice_recv_scattered_pkts_vec_avx512; +if (rx_check_ret ==ICE_VECTOR_OFFLOAD_PATH ) { +PMD_DRV_LOG (NOTICE , +"Using AVX512 OFFLOAD Vector Scattered Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_scattered_pkts_vec_avx512_offload; + }else { +PMD_DRV_LOG (NOTICE , +"Using AVX512 Vector Scattered Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_scattered_pkts_vec_avx512; + }#endif }else { PMD_DRV_LOG(DEBUG,
@@ -3109,11 +3123,19 @@ ice_set_rx_function(struct rte_eth_dev *dev) }else {if (use_avx512) {#ifdef CC_AVX512_SUPPORT -PMD_DRV_LOG (NOTICE , -"Using AVX512 Vector Rx (port %d)." , - dev->data->port_id); - dev->rx_pkt_burst = - ice_recv_pkts_vec_avx512; +if (rx_check_ret ==ICE_VECTOR_OFFLOAD_PATH ) { +PMD_DRV_LOG (NOTICE , +"Using AVX512 OFFLOAD Vector Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_pkts_vec_avx512_offload; + }else { +PMD_DRV_LOG (NOTICE , +"Using AVX512 Vector Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_pkts_vec_avx512; + }#endif }else { PMD_DRV_LOG(DEBUG,
drivers/net/ice/ice_rxtx.h +7 -0
@@ -88,6 +88,7 @@ struct ice_rx_queue {uint64_t xtr_ol_flag;/* Protocol extraction offload flag */ ice_rxd_to_pkt_fields_t rxd_to_pkt_fields;/* handle FlexiMD by RXDID */ ice_rx_release_mbufs_t rx_rel_mbufs; +uint64_t offloads; };struct ice_tx_entry {
@@ -256,9 +257,15 @@ uint16_t ice_xmit_pkts_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts);uint16_t ice_recv_pkts_vec_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t ice_recv_pkts_vec_avx512_offload (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts);uint16_t ice_recv_scattered_pkts_vec_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t ice_recv_scattered_pkts_vec_avx512_offload (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx512 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); uint16_t ice_xmit_pkts_vec_avx512_offload(void *tx_queue,
drivers/net/ice/ice_rxtx_vec_avx512.c +496 -0
520 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_common.h +30 -19
73 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 2/2] net/ice: add Rx AVX512 offload path
Quoted 7 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Leyi Rong
Sent: Wednesday, March 17, 2021 9:14 AM
To: Zhang, Qi Z <[email protected]>; Lu, Wenzhuo <[email protected]>
Cc: [email protected]; Rong, Leyi <[email protected]>
Subject: [dpdk-dev] [PATCH 2/2] net/ice: add Rx AVX512 offload path
Quoted 6 lines
Split AVX512 Rx data path into two, one is for basic, the other one can support additional Rx offload features, including Rx checksum offload, Rx vlan offload, RSS offload.
Signed-off-by Leyi Rong <[email protected]>Signed-off-by Wenzhuo Lu <[email protected]>
Hi Leyi and Wenzhou,
I'm a bit concerned over code-duplication of the RX datapath in this patch, as it duplicates the core desc-to-mbuf RX loop.
I loaded the following functions, and compared in "meld" to view the diff side-by-side, and it should be possible to "specialize" away the differences:_ice_recv_raw_pkts_vec_avx512() /* original */ _ice_recv_raw_pkts_vec_avx512_offload() /* with offload */
Specializing the implementation (adding "do_offload" parameter to _ice_recv_raw_pkts_vec_avx512()),
and branch on it with an if(do_offload) when the offload and non-offload paths behave differently.
When inlining that function the compiler will remove the branches, and you'll only have one version of the code to maintain, without any performance penalty.
If my suggestion around parameterizing, specializing and inlining isn't clear, please ask and I can try to explain better.
Regards, -Harry
<snip patch contents>
v3 cover add alternative AVX512 offload path
In reply to Leyi RongAdd alternative Rx/Tx offload path for AVX512, which can support Rx/Tx offload features, like checksum/vlan/RSS/QinQ offload.
---
v3:
- complete ice_dev_supported_ptypes_get() for new adding offload functions.
- complete tx/rx burst infos for new adding offload functions.
v2:
- add "do_offload" parameter to according functions for reducing code duplication.
Leyi Rong (2):
net/ice: add Tx AVX512 offload path
net/ice: add Rx AVX512 offload path
drivers/net/ice/ice_rxtx.c | 78 +++-- drivers/net/ice/ice_rxtx.h | 10 + drivers/net/ice/ice_rxtx_vec_avx2.c | 2 +- drivers/net/ice/ice_rxtx_vec_avx512.c | 403 +++++++++++++++++--------- drivers/net/ice/ice_rxtx_vec_common.h | 129 +++++++-- drivers/net/ice/ice_rxtx_vec_sse.c | 2 +- 6 files changed, 448 insertions(+), 176 deletions(-)
Signature · 1 line
2.17.1
PATCH v3 1/2 net/ice: add Tx AVX512 offload path
Add alternative Tx data path for AVX512 which can support partial Tx offload features, including Tx checksum offload, vlan/QinQ insertion offload.
--- drivers/net/ice/ice_rxtx.c | 28 +++++-- drivers/net/ice/ice_rxtx.h | 3 + drivers/net/ice/ice_rxtx_vec_avx2.c | 2 +- drivers/net/ice/ice_rxtx_vec_avx512.c | 58 +++++++++++--- drivers/net/ice/ice_rxtx_vec_common.h | 105 ++++++++++++++++++++++---- drivers/net/ice/ice_rxtx_vec_sse.c | 2 +- 6 files changed, 163 insertions(+), 35 deletions(-)
drivers/net/ice/ice_rxtx.c +22 -6
@@ -8,6 +8,7 @@#include "rte_pmd_ice.h" #include "ice_rxtx.h" +#include "ice_rxtx_vec_common.h" #define ICE_TX_CKSUM_OFFLOAD_MASK ( \ PKT_TX_IP_CKSUM | \
@@ -3267,12 +3268,14 @@ ice_set_tx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ice_tx_queue *txq;int i; +int tx_check_ret;bool use_avx512 = false;bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_tx_vec_dev_check (dev) && -rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { + tx_check_ret =ice_tx_vec_dev_check (dev); +if (tx_check_ret >=0 && +rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { ad->tx_vec_allowed = true;for (i =0 ; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i];
@@ -3291,12 +3294,15 @@ ice_set_tx_function(struct rte_eth_dev *dev)PMD_DRV_LOG (NOTICE ,"AVX512 is not supported in build env" );#endif -if (!use_avx512 && +if (!use_avx512 && tx_check_ret ==ICE_VECTOR_PATH && (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 ||rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) use_avx2 = true; +if (!use_avx512 && tx_check_ret ==ICE_VECTOR_OFFLOAD_PATH ) + ad->tx_vec_allowed = false; + }else { ad->tx_vec_allowed = false; }
@@ -3305,9 +3311,18 @@ ice_set_tx_function(struct rte_eth_dev *dev)if (ad->tx_vec_allowed) {if (use_avx512) {#ifdef CC_AVX512_SUPPORT -PMD_DRV_LOG (NOTICE ,"Using AVX512 Vector Tx (port %d)." , - dev->data->port_id); - dev->tx_pkt_burst = ice_xmit_pkts_vec_avx512; +if (tx_check_ret ==ICE_VECTOR_OFFLOAD_PATH ) { +PMD_DRV_LOG (NOTICE , +"Using AVX512 OFFLOAD Vector Tx (port %d)." , + dev->data->port_id); + dev->tx_pkt_burst = + ice_xmit_pkts_vec_avx512_offload; + }else { +PMD_DRV_LOG (NOTICE , +"Using AVX512 Vector Tx (port %d)." , + dev->data->port_id); + dev->tx_pkt_burst = ice_xmit_pkts_vec_avx512; + }#endif }else { PMD_DRV_LOG(DEBUG, "Using %sVector Tx (port %d).",
@@ -3343,6 +3358,7 @@ static const struct { #ifdef RTE_ARCH_X86 #ifdef CC_AVX512_SUPPORT { ice_xmit_pkts_vec_avx512, "Vector AVX512" }, + { ice_xmit_pkts_vec_avx512_offload, "Offload Vector AVX512" }, #endif { ice_xmit_pkts_vec_avx2, "Vector AVX2" }, { ice_xmit_pkts_vec, "Vector SSE" },
drivers/net/ice/ice_rxtx.h +3 -0
@@ -261,6 +261,9 @@ uint16_t ice_recv_scattered_pkts_vec_avx512(void *rx_queue, uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx512 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t ice_xmit_pkts_vec_avx512_offload (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);int ice_tx_done_cleanup (void *txq,uint32_t free_cnt);int ice_get_monitor_addr (void *rx_queue,struct rte_power_monitor_cond *pmc);
drivers/net/ice/ice_rxtx_vec_avx2.c +1 -1
@@ -969,7 +969,7 @@ ice_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts, nb_pkts =RTE_MIN (nb_pkts, txq->tx_rs_thresh);if (txq->nb_tx_free < txq->tx_free_thresh) -ice_tx_free_bufs (txq); +ice_tx_free_bufs_vec (txq); nb_commit = nb_pkts = (uint16_t )RTE_MIN (txq->nb_tx_free, nb_pkts);if (unlikely (nb_pkts ==0 ))
drivers/net/ice/ice_rxtx_vec_avx512.c +46 -12
128 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_common.h +90 -15
147 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_sse.c +1 -1
@@ -702,7 +702,7 @@ ice_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts, nb_pkts =RTE_MIN (nb_pkts, txq->tx_rs_thresh);if (txq->nb_tx_free < txq->tx_free_thresh) -ice_tx_free_bufs (txq); +ice_tx_free_bufs_vec (txq); nb_pkts = (uint16_t )RTE_MIN (txq->nb_tx_free, nb_pkts); nb_commit = nb_pkts;
Signature · 1 line
2.17.1
PATCH v3 2/2 net/ice: add Rx AVX512 offload path
In reply to Leyi RongSplit AVX512 Rx data path into two, one is for basic, the other one can support additional Rx offload features, including Rx checksum offload, Rx vlan offload, RSS offload.
--- drivers/net/ice/ice_rxtx.c | 50 +++- drivers/net/ice/ice_rxtx.h | 7 + drivers/net/ice/ice_rxtx_vec_avx512.c | 345 +++++++++++++++++--------- drivers/net/ice/ice_rxtx_vec_common.h | 50 ++-- 4 files changed, 298 insertions(+), 154 deletions(-)
drivers/net/ice/ice_rxtx.c +38 -12
@@ -1059,6 +1059,7 @@ ice_rx_queue_setup(struct rte_eth_dev *dev,uint32_t ring_size;uint16_t len;int use_def_burst_func =1 ; +uint64_t offloads; if (nb_desc % ICE_ALIGN_RING_DESC != 0 || nb_desc > ICE_MAX_RING_DESC ||
@@ -1068,6 +1069,8 @@ ice_rx_queue_setup(struct rte_eth_dev *dev,return -EINVAL ; } + offloads = rx_conf->offloads | dev->data->dev_conf.rxmode.offloads; +/* Free memory if needed */ if (dev->data->rx_queues[queue_idx]) {ice_rx_queue_release (dev->data->rx_queues[queue_idx]);
@@ -1088,6 +1091,7 @@ ice_rx_queue_setup(struct rte_eth_dev *dev, rxq->nb_rx_desc = nb_desc; rxq->rx_free_thresh = rx_conf->rx_free_thresh; rxq->queue_id = queue_idx; + rxq->offloads = offloads; rxq->reg_idx = vsi->base_queue + queue_idx; rxq->port_id = dev->data->port_id;
@@ -1990,7 +1994,9 @@ ice_dev_supported_ptypes_get(struct rte_eth_dev *dev) dev->rx_pkt_burst == ice_recv_scattered_pkts_vec ||#ifdef CC_AVX512_SUPPORT dev->rx_pkt_burst == ice_recv_pkts_vec_avx512 || + dev->rx_pkt_burst == ice_recv_pkts_vec_avx512_offload || dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx512 || + dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx512_offload || #endif dev->rx_pkt_burst == ice_recv_pkts_vec_avx2 || dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx2)
@@ -3052,12 +3058,14 @@ ice_set_rx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ice_rx_queue *rxq;int i; +int rx_check_ret;bool use_avx512 = false;bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_rx_vec_dev_check (dev) && ad->rx_bulk_alloc_allowed && -rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { + rx_check_ret =ice_rx_vec_dev_check (dev); +if (rx_check_ret >=0 && ad->rx_bulk_alloc_allowed && +rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { ad->rx_vec_allowed = true;for (i =0 ; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i];
@@ -3091,11 +3099,19 @@ ice_set_rx_function(struct rte_eth_dev *dev)if (dev->data->scattered_rx) {if (use_avx512) {#ifdef CC_AVX512_SUPPORT -PMD_DRV_LOG (NOTICE , -"Using AVX512 Vector Scattered Rx (port %d)." , - dev->data->port_id); - dev->rx_pkt_burst = - ice_recv_scattered_pkts_vec_avx512; +if (rx_check_ret ==ICE_VECTOR_OFFLOAD_PATH ) { +PMD_DRV_LOG (NOTICE , +"Using AVX512 OFFLOAD Vector Scattered Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_scattered_pkts_vec_avx512_offload; + }else { +PMD_DRV_LOG (NOTICE , +"Using AVX512 Vector Scattered Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_scattered_pkts_vec_avx512; + }#endif }else { PMD_DRV_LOG(DEBUG,
@@ -3109,11 +3125,19 @@ ice_set_rx_function(struct rte_eth_dev *dev) }else {if (use_avx512) {#ifdef CC_AVX512_SUPPORT -PMD_DRV_LOG (NOTICE , -"Using AVX512 Vector Rx (port %d)." , - dev->data->port_id); - dev->rx_pkt_burst = - ice_recv_pkts_vec_avx512; +if (rx_check_ret ==ICE_VECTOR_OFFLOAD_PATH ) { +PMD_DRV_LOG (NOTICE , +"Using AVX512 OFFLOAD Vector Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_pkts_vec_avx512_offload; + }else { +PMD_DRV_LOG (NOTICE , +"Using AVX512 Vector Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_pkts_vec_avx512; + }#endif }else { PMD_DRV_LOG(DEBUG,
@@ -3162,7 +3186,9 @@ static const struct { #ifdef RTE_ARCH_X86 #ifdef CC_AVX512_SUPPORT { ice_recv_scattered_pkts_vec_avx512, "Vector AVX512 Scattered" }, + { ice_recv_scattered_pkts_vec_avx512_offload, "Offload Vector AVX512 Scattered" }, { ice_recv_pkts_vec_avx512, "Vector AVX512" }, + { ice_recv_pkts_vec_avx512_offload, "Offload Vector AVX512" }, #endif { ice_recv_scattered_pkts_vec_avx2, "Vector AVX2 Scattered" }, { ice_recv_pkts_vec_avx2, "Vector AVX2" },
drivers/net/ice/ice_rxtx.h +7 -0
@@ -88,6 +88,7 @@ struct ice_rx_queue {uint64_t xtr_ol_flag;/* Protocol extraction offload flag */ ice_rxd_to_pkt_fields_t rxd_to_pkt_fields;/* handle FlexiMD by RXDID */ ice_rx_release_mbufs_t rx_rel_mbufs; +uint64_t offloads; };struct ice_tx_entry {
@@ -256,9 +257,15 @@ uint16_t ice_xmit_pkts_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts);uint16_t ice_recv_pkts_vec_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t ice_recv_pkts_vec_avx512_offload (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts);uint16_t ice_recv_scattered_pkts_vec_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t ice_recv_scattered_pkts_vec_avx512_offload (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx512 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); uint16_t ice_xmit_pkts_vec_avx512_offload(void *tx_queue,
drivers/net/ice/ice_rxtx_vec_avx512.c +221 -124
401 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_common.h +32 -18
75 lines not on this page · raw message
Signature · 1 line
2.17.1
v4 cover add alternative AVX512 offload path
In reply to Leyi RongAdd alternative Rx/Tx offload path for AVX512, which can support Rx/Tx offload features, like checksum/vlan/RSS/QinQ offload.
---
v4:
- code rebased.
v3:
- complete ice_dev_supported_ptypes_get() for new adding offload functions.
- complete tx/rx burst infos for new adding offload functions.
v2:
- add "do_offload" parameter to according functions for reducing code duplication.
Leyi Rong (2):
net/ice: add Tx AVX512 offload path
net/ice: add Rx AVX512 offload path
drivers/net/ice/ice_rxtx.c | 78 +++-- drivers/net/ice/ice_rxtx.h | 10 + drivers/net/ice/ice_rxtx_vec_avx2.c | 2 +- drivers/net/ice/ice_rxtx_vec_avx512.c | 403 +++++++++++++++++--------- drivers/net/ice/ice_rxtx_vec_common.h | 129 +++++++-- drivers/net/ice/ice_rxtx_vec_sse.c | 2 +- 6 files changed, 448 insertions(+), 176 deletions(-)
Signature · 1 line
2.17.1
PATCH v4 1/2 net/ice: add Tx AVX512 offload path
Add alternative Tx data path for AVX512 which can support partial Tx offload features, including Tx checksum offload, vlan/QinQ insertion offload.
--- drivers/net/ice/ice_rxtx.c | 28 +++++-- drivers/net/ice/ice_rxtx.h | 3 + drivers/net/ice/ice_rxtx_vec_avx2.c | 2 +- drivers/net/ice/ice_rxtx_vec_avx512.c | 58 +++++++++++--- drivers/net/ice/ice_rxtx_vec_common.h | 105 ++++++++++++++++++++++---- drivers/net/ice/ice_rxtx_vec_sse.c | 2 +- 6 files changed, 163 insertions(+), 35 deletions(-)
drivers/net/ice/ice_rxtx.c +22 -6
@@ -8,6 +8,7 @@#include "rte_pmd_ice.h" #include "ice_rxtx.h" +#include "ice_rxtx_vec_common.h" #define ICE_TX_CKSUM_OFFLOAD_MASK ( \ PKT_TX_IP_CKSUM | \
@@ -3267,12 +3268,14 @@ ice_set_tx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ice_tx_queue *txq;int i; +int tx_check_ret;bool use_avx512 = false;bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_tx_vec_dev_check (dev) && -rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { + tx_check_ret =ice_tx_vec_dev_check (dev); +if (tx_check_ret >=0 && +rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { ad->tx_vec_allowed = true;for (i =0 ; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i];
@@ -3291,12 +3294,15 @@ ice_set_tx_function(struct rte_eth_dev *dev)PMD_DRV_LOG (NOTICE ,"AVX512 is not supported in build env" );#endif -if (!use_avx512 && +if (!use_avx512 && tx_check_ret ==ICE_VECTOR_PATH && (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 ||rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) use_avx2 = true; +if (!use_avx512 && tx_check_ret ==ICE_VECTOR_OFFLOAD_PATH ) + ad->tx_vec_allowed = false; + }else { ad->tx_vec_allowed = false; }
@@ -3305,9 +3311,18 @@ ice_set_tx_function(struct rte_eth_dev *dev)if (ad->tx_vec_allowed) {if (use_avx512) {#ifdef CC_AVX512_SUPPORT -PMD_DRV_LOG (NOTICE ,"Using AVX512 Vector Tx (port %d)." , - dev->data->port_id); - dev->tx_pkt_burst = ice_xmit_pkts_vec_avx512; +if (tx_check_ret ==ICE_VECTOR_OFFLOAD_PATH ) { +PMD_DRV_LOG (NOTICE , +"Using AVX512 OFFLOAD Vector Tx (port %d)." , + dev->data->port_id); + dev->tx_pkt_burst = + ice_xmit_pkts_vec_avx512_offload; + }else { +PMD_DRV_LOG (NOTICE , +"Using AVX512 Vector Tx (port %d)." , + dev->data->port_id); + dev->tx_pkt_burst = ice_xmit_pkts_vec_avx512; + }#endif }else { PMD_DRV_LOG(DEBUG, "Using %sVector Tx (port %d).",
@@ -3343,6 +3358,7 @@ static const struct { #ifdef RTE_ARCH_X86 #ifdef CC_AVX512_SUPPORT { ice_xmit_pkts_vec_avx512, "Vector AVX512" }, + { ice_xmit_pkts_vec_avx512_offload, "Offload Vector AVX512" }, #endif { ice_xmit_pkts_vec_avx2, "Vector AVX2" }, { ice_xmit_pkts_vec, "Vector SSE" },
drivers/net/ice/ice_rxtx.h +3 -0
@@ -261,6 +261,9 @@ uint16_t ice_recv_scattered_pkts_vec_avx512(void *rx_queue, uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx512 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t ice_xmit_pkts_vec_avx512_offload (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);int ice_tx_done_cleanup (void *txq,uint32_t free_cnt);int ice_get_monitor_addr (void *rx_queue,struct rte_power_monitor_cond *pmc);
drivers/net/ice/ice_rxtx_vec_avx2.c +1 -1
@@ -853,7 +853,7 @@ ice_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts, nb_pkts =RTE_MIN (nb_pkts, txq->tx_rs_thresh);if (txq->nb_tx_free < txq->tx_free_thresh) -ice_tx_free_bufs (txq); +ice_tx_free_bufs_vec (txq); nb_commit = nb_pkts = (uint16_t )RTE_MIN (txq->nb_tx_free, nb_pkts);if (unlikely (nb_pkts ==0 ))
drivers/net/ice/ice_rxtx_vec_avx512.c +46 -12
128 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_common.h +90 -15
151 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_sse.c +1 -1
@@ -702,7 +702,7 @@ ice_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts, nb_pkts =RTE_MIN (nb_pkts, txq->tx_rs_thresh);if (txq->nb_tx_free < txq->tx_free_thresh) -ice_tx_free_bufs (txq); +ice_tx_free_bufs_vec (txq); nb_pkts = (uint16_t )RTE_MIN (txq->nb_tx_free, nb_pkts); nb_commit = nb_pkts;
Signature · 1 line
2.17.1
PATCH v4 2/2 net/ice: add Rx AVX512 offload path
In reply to Leyi RongSplit AVX512 Rx data path into two, one is for basic, the other one can support additional Rx offload features, including Rx checksum offload, Rx vlan offload, RSS offload.
--- drivers/net/ice/ice_rxtx.c | 50 +++- drivers/net/ice/ice_rxtx.h | 7 + drivers/net/ice/ice_rxtx_vec_avx512.c | 345 +++++++++++++++++--------- drivers/net/ice/ice_rxtx_vec_common.h | 50 ++-- 4 files changed, 298 insertions(+), 154 deletions(-)
drivers/net/ice/ice_rxtx.c +38 -12
@@ -1059,6 +1059,7 @@ ice_rx_queue_setup(struct rte_eth_dev *dev,uint32_t ring_size;uint16_t len;int use_def_burst_func =1 ; +uint64_t offloads; if (nb_desc % ICE_ALIGN_RING_DESC != 0 || nb_desc > ICE_MAX_RING_DESC ||
@@ -1068,6 +1069,8 @@ ice_rx_queue_setup(struct rte_eth_dev *dev,return -EINVAL ; } + offloads = rx_conf->offloads | dev->data->dev_conf.rxmode.offloads; +/* Free memory if needed */ if (dev->data->rx_queues[queue_idx]) {ice_rx_queue_release (dev->data->rx_queues[queue_idx]);
@@ -1088,6 +1091,7 @@ ice_rx_queue_setup(struct rte_eth_dev *dev, rxq->nb_rx_desc = nb_desc; rxq->rx_free_thresh = rx_conf->rx_free_thresh; rxq->queue_id = queue_idx; + rxq->offloads = offloads; rxq->reg_idx = vsi->base_queue + queue_idx; rxq->port_id = dev->data->port_id;
@@ -1990,7 +1994,9 @@ ice_dev_supported_ptypes_get(struct rte_eth_dev *dev) dev->rx_pkt_burst == ice_recv_scattered_pkts_vec ||#ifdef CC_AVX512_SUPPORT dev->rx_pkt_burst == ice_recv_pkts_vec_avx512 || + dev->rx_pkt_burst == ice_recv_pkts_vec_avx512_offload || dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx512 || + dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx512_offload || #endif dev->rx_pkt_burst == ice_recv_pkts_vec_avx2 || dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx2)
@@ -3052,12 +3058,14 @@ ice_set_rx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ice_rx_queue *rxq;int i; +int rx_check_ret;bool use_avx512 = false;bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_rx_vec_dev_check (dev) && ad->rx_bulk_alloc_allowed && -rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { + rx_check_ret =ice_rx_vec_dev_check (dev); +if (rx_check_ret >=0 && ad->rx_bulk_alloc_allowed && +rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { ad->rx_vec_allowed = true;for (i =0 ; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i];
@@ -3091,11 +3099,19 @@ ice_set_rx_function(struct rte_eth_dev *dev)if (dev->data->scattered_rx) {if (use_avx512) {#ifdef CC_AVX512_SUPPORT -PMD_DRV_LOG (NOTICE , -"Using AVX512 Vector Scattered Rx (port %d)." , - dev->data->port_id); - dev->rx_pkt_burst = - ice_recv_scattered_pkts_vec_avx512; +if (rx_check_ret ==ICE_VECTOR_OFFLOAD_PATH ) { +PMD_DRV_LOG (NOTICE , +"Using AVX512 OFFLOAD Vector Scattered Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_scattered_pkts_vec_avx512_offload; + }else { +PMD_DRV_LOG (NOTICE , +"Using AVX512 Vector Scattered Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_scattered_pkts_vec_avx512; + }#endif }else { PMD_DRV_LOG(DEBUG,
@@ -3109,11 +3125,19 @@ ice_set_rx_function(struct rte_eth_dev *dev) }else {if (use_avx512) {#ifdef CC_AVX512_SUPPORT -PMD_DRV_LOG (NOTICE , -"Using AVX512 Vector Rx (port %d)." , - dev->data->port_id); - dev->rx_pkt_burst = - ice_recv_pkts_vec_avx512; +if (rx_check_ret ==ICE_VECTOR_OFFLOAD_PATH ) { +PMD_DRV_LOG (NOTICE , +"Using AVX512 OFFLOAD Vector Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_pkts_vec_avx512_offload; + }else { +PMD_DRV_LOG (NOTICE , +"Using AVX512 Vector Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_pkts_vec_avx512; + }#endif }else { PMD_DRV_LOG(DEBUG,
@@ -3162,7 +3186,9 @@ static const struct { #ifdef RTE_ARCH_X86 #ifdef CC_AVX512_SUPPORT { ice_recv_scattered_pkts_vec_avx512, "Vector AVX512 Scattered" }, + { ice_recv_scattered_pkts_vec_avx512_offload, "Offload Vector AVX512 Scattered" }, { ice_recv_pkts_vec_avx512, "Vector AVX512" }, + { ice_recv_pkts_vec_avx512_offload, "Offload Vector AVX512" }, #endif { ice_recv_scattered_pkts_vec_avx2, "Vector AVX2 Scattered" }, { ice_recv_pkts_vec_avx2, "Vector AVX2" },
drivers/net/ice/ice_rxtx.h +7 -0
@@ -88,6 +88,7 @@ struct ice_rx_queue {uint64_t xtr_ol_flag;/* Protocol extraction offload flag */ ice_rxd_to_pkt_fields_t rxd_to_pkt_fields;/* handle FlexiMD by RXDID */ ice_rx_release_mbufs_t rx_rel_mbufs; +uint64_t offloads; };struct ice_tx_entry {
@@ -256,9 +257,15 @@ uint16_t ice_xmit_pkts_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts);uint16_t ice_recv_pkts_vec_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t ice_recv_pkts_vec_avx512_offload (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts);uint16_t ice_recv_scattered_pkts_vec_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t ice_recv_scattered_pkts_vec_avx512_offload (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx512 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); uint16_t ice_xmit_pkts_vec_avx512_offload(void *tx_queue,
drivers/net/ice/ice_rxtx_vec_avx512.c +221 -124
401 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_common.h +32 -18
75 lines not on this page · raw message
Signature · 1 line
2.17.1
v5 cover add alternative AVX512 offload path
In reply to Leyi RongAdd alternative Rx/Tx offload path for AVX512, which can support Rx/Tx offload features, like checksum/vlan/RSS/QinQ offload.
---
v5:
- fix bug [DPDK-26560] invalid checksum for tunnel packet.
v4:
- code rebased.
v3:
- complete ice_dev_supported_ptypes_get() for new adding offload functions.
- complete tx/rx burst infos for new adding offload functions.
v2:
- add "do_offload" parameter to according functions for reducing code duplication.
Leyi Rong (2):
net/ice: add Tx AVX512 offload path
net/ice: add Rx AVX512 offload path
drivers/net/ice/ice_rxtx.c | 78 +++-- drivers/net/ice/ice_rxtx.h | 10 + drivers/net/ice/ice_rxtx_vec_avx2.c | 2 +- drivers/net/ice/ice_rxtx_vec_avx512.c | 403 +++++++++++++++++--------- drivers/net/ice/ice_rxtx_vec_common.h | 130 +++++++-- drivers/net/ice/ice_rxtx_vec_sse.c | 2 +- 6 files changed, 449 insertions(+), 176 deletions(-)
Signature · 1 line
2.17.1
PATCH v5 1/2 net/ice: add Tx AVX512 offload path
Add alternative Tx data path for AVX512 which can support partial Tx offload features, including Tx checksum offload, vlan/QinQ insertion offload.
--- drivers/net/ice/ice_rxtx.c | 28 +++++-- drivers/net/ice/ice_rxtx.h | 3 + drivers/net/ice/ice_rxtx_vec_avx2.c | 2 +- drivers/net/ice/ice_rxtx_vec_avx512.c | 58 +++++++++++--- drivers/net/ice/ice_rxtx_vec_common.h | 106 ++++++++++++++++++++++---- drivers/net/ice/ice_rxtx_vec_sse.c | 2 +- 6 files changed, 164 insertions(+), 35 deletions(-)
drivers/net/ice/ice_rxtx.c +22 -6
@@ -8,6 +8,7 @@#include "rte_pmd_ice.h" #include "ice_rxtx.h" +#include "ice_rxtx_vec_common.h" #define ICE_TX_CKSUM_OFFLOAD_MASK ( \ PKT_TX_IP_CKSUM | \
@@ -3267,12 +3268,14 @@ ice_set_tx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ice_tx_queue *txq;int i; +int tx_check_ret;bool use_avx512 = false;bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_tx_vec_dev_check (dev) && -rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { + tx_check_ret =ice_tx_vec_dev_check (dev); +if (tx_check_ret >=0 && +rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { ad->tx_vec_allowed = true;for (i =0 ; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i];
@@ -3291,12 +3294,15 @@ ice_set_tx_function(struct rte_eth_dev *dev)PMD_DRV_LOG (NOTICE ,"AVX512 is not supported in build env" );#endif -if (!use_avx512 && +if (!use_avx512 && tx_check_ret ==ICE_VECTOR_PATH && (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 ||rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) &&rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_256 ) use_avx2 = true; +if (!use_avx512 && tx_check_ret ==ICE_VECTOR_OFFLOAD_PATH ) + ad->tx_vec_allowed = false; + }else { ad->tx_vec_allowed = false; }
@@ -3305,9 +3311,18 @@ ice_set_tx_function(struct rte_eth_dev *dev)if (ad->tx_vec_allowed) {if (use_avx512) {#ifdef CC_AVX512_SUPPORT -PMD_DRV_LOG (NOTICE ,"Using AVX512 Vector Tx (port %d)." , - dev->data->port_id); - dev->tx_pkt_burst = ice_xmit_pkts_vec_avx512; +if (tx_check_ret ==ICE_VECTOR_OFFLOAD_PATH ) { +PMD_DRV_LOG (NOTICE , +"Using AVX512 OFFLOAD Vector Tx (port %d)." , + dev->data->port_id); + dev->tx_pkt_burst = + ice_xmit_pkts_vec_avx512_offload; + }else { +PMD_DRV_LOG (NOTICE , +"Using AVX512 Vector Tx (port %d)." , + dev->data->port_id); + dev->tx_pkt_burst = ice_xmit_pkts_vec_avx512; + }#endif }else { PMD_DRV_LOG(DEBUG, "Using %sVector Tx (port %d).",
@@ -3343,6 +3358,7 @@ static const struct { #ifdef RTE_ARCH_X86 #ifdef CC_AVX512_SUPPORT { ice_xmit_pkts_vec_avx512, "Vector AVX512" }, + { ice_xmit_pkts_vec_avx512_offload, "Offload Vector AVX512" }, #endif { ice_xmit_pkts_vec_avx2, "Vector AVX2" }, { ice_xmit_pkts_vec, "Vector SSE" },
drivers/net/ice/ice_rxtx.h +3 -0
@@ -261,6 +261,9 @@ uint16_t ice_recv_scattered_pkts_vec_avx512(void *rx_queue, uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx512 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t ice_xmit_pkts_vec_avx512_offload (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);int ice_tx_done_cleanup (void *txq,uint32_t free_cnt);int ice_get_monitor_addr (void *rx_queue,struct rte_power_monitor_cond *pmc);
drivers/net/ice/ice_rxtx_vec_avx2.c +1 -1
@@ -853,7 +853,7 @@ ice_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts, nb_pkts =RTE_MIN (nb_pkts, txq->tx_rs_thresh);if (txq->nb_tx_free < txq->tx_free_thresh) -ice_tx_free_bufs (txq); +ice_tx_free_bufs_vec (txq); nb_commit = nb_pkts = (uint16_t )RTE_MIN (txq->nb_tx_free, nb_pkts);if (unlikely (nb_pkts ==0 ))
drivers/net/ice/ice_rxtx_vec_avx512.c +46 -12
128 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_common.h +91 -15
152 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_sse.c +1 -1
@@ -702,7 +702,7 @@ ice_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts, nb_pkts =RTE_MIN (nb_pkts, txq->tx_rs_thresh);if (txq->nb_tx_free < txq->tx_free_thresh) -ice_tx_free_bufs (txq); +ice_tx_free_bufs_vec (txq); nb_pkts = (uint16_t )RTE_MIN (txq->nb_tx_free, nb_pkts); nb_commit = nb_pkts;
Signature · 1 line
2.17.1
PATCH v5 2/2 net/ice: add Rx AVX512 offload path
In reply to Leyi RongSplit AVX512 Rx data path into two, one is for basic, the other one can support additional Rx offload features, including Rx checksum offload, Rx vlan offload, RSS offload.
--- drivers/net/ice/ice_rxtx.c | 50 +++- drivers/net/ice/ice_rxtx.h | 7 + drivers/net/ice/ice_rxtx_vec_avx512.c | 345 +++++++++++++++++--------- drivers/net/ice/ice_rxtx_vec_common.h | 52 ++-- 4 files changed, 299 insertions(+), 155 deletions(-)
drivers/net/ice/ice_rxtx.c +38 -12
@@ -1059,6 +1059,7 @@ ice_rx_queue_setup(struct rte_eth_dev *dev,uint32_t ring_size;uint16_t len;int use_def_burst_func =1 ; +uint64_t offloads; if (nb_desc % ICE_ALIGN_RING_DESC != 0 || nb_desc > ICE_MAX_RING_DESC ||
@@ -1068,6 +1069,8 @@ ice_rx_queue_setup(struct rte_eth_dev *dev,return -EINVAL ; } + offloads = rx_conf->offloads | dev->data->dev_conf.rxmode.offloads; +/* Free memory if needed */ if (dev->data->rx_queues[queue_idx]) {ice_rx_queue_release (dev->data->rx_queues[queue_idx]);
@@ -1088,6 +1091,7 @@ ice_rx_queue_setup(struct rte_eth_dev *dev, rxq->nb_rx_desc = nb_desc; rxq->rx_free_thresh = rx_conf->rx_free_thresh; rxq->queue_id = queue_idx; + rxq->offloads = offloads; rxq->reg_idx = vsi->base_queue + queue_idx; rxq->port_id = dev->data->port_id;
@@ -1990,7 +1994,9 @@ ice_dev_supported_ptypes_get(struct rte_eth_dev *dev) dev->rx_pkt_burst == ice_recv_scattered_pkts_vec ||#ifdef CC_AVX512_SUPPORT dev->rx_pkt_burst == ice_recv_pkts_vec_avx512 || + dev->rx_pkt_burst == ice_recv_pkts_vec_avx512_offload || dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx512 || + dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx512_offload || #endif dev->rx_pkt_burst == ice_recv_pkts_vec_avx2 || dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx2)
@@ -3052,12 +3058,14 @@ ice_set_rx_function(struct rte_eth_dev *dev)#ifdef RTE_ARCH_X86 struct ice_rx_queue *rxq;int i; +int rx_check_ret;bool use_avx512 = false;bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_rx_vec_dev_check (dev) && ad->rx_bulk_alloc_allowed && -rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { + rx_check_ret =ice_rx_vec_dev_check (dev); +if (rx_check_ret >=0 && ad->rx_bulk_alloc_allowed && +rte_vect_get_max_simd_bitwidth () >=RTE_VECT_SIMD_128 ) { ad->rx_vec_allowed = true;for (i =0 ; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i];
@@ -3091,11 +3099,19 @@ ice_set_rx_function(struct rte_eth_dev *dev)if (dev->data->scattered_rx) {if (use_avx512) {#ifdef CC_AVX512_SUPPORT -PMD_DRV_LOG (NOTICE , -"Using AVX512 Vector Scattered Rx (port %d)." , - dev->data->port_id); - dev->rx_pkt_burst = - ice_recv_scattered_pkts_vec_avx512; +if (rx_check_ret ==ICE_VECTOR_OFFLOAD_PATH ) { +PMD_DRV_LOG (NOTICE , +"Using AVX512 OFFLOAD Vector Scattered Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_scattered_pkts_vec_avx512_offload; + }else { +PMD_DRV_LOG (NOTICE , +"Using AVX512 Vector Scattered Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_scattered_pkts_vec_avx512; + }#endif }else { PMD_DRV_LOG(DEBUG,
@@ -3109,11 +3125,19 @@ ice_set_rx_function(struct rte_eth_dev *dev) }else {if (use_avx512) {#ifdef CC_AVX512_SUPPORT -PMD_DRV_LOG (NOTICE , -"Using AVX512 Vector Rx (port %d)." , - dev->data->port_id); - dev->rx_pkt_burst = - ice_recv_pkts_vec_avx512; +if (rx_check_ret ==ICE_VECTOR_OFFLOAD_PATH ) { +PMD_DRV_LOG (NOTICE , +"Using AVX512 OFFLOAD Vector Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_pkts_vec_avx512_offload; + }else { +PMD_DRV_LOG (NOTICE , +"Using AVX512 Vector Rx (port %d)." , + dev->data->port_id); + dev->rx_pkt_burst = + ice_recv_pkts_vec_avx512; + }#endif }else { PMD_DRV_LOG(DEBUG,
@@ -3162,7 +3186,9 @@ static const struct { #ifdef RTE_ARCH_X86 #ifdef CC_AVX512_SUPPORT { ice_recv_scattered_pkts_vec_avx512, "Vector AVX512 Scattered" }, + { ice_recv_scattered_pkts_vec_avx512_offload, "Offload Vector AVX512 Scattered" }, { ice_recv_pkts_vec_avx512, "Vector AVX512" }, + { ice_recv_pkts_vec_avx512_offload, "Offload Vector AVX512" }, #endif { ice_recv_scattered_pkts_vec_avx2, "Vector AVX2 Scattered" }, { ice_recv_pkts_vec_avx2, "Vector AVX2" },
drivers/net/ice/ice_rxtx.h +7 -0
@@ -88,6 +88,7 @@ struct ice_rx_queue {uint64_t xtr_ol_flag;/* Protocol extraction offload flag */ ice_rxd_to_pkt_fields_t rxd_to_pkt_fields;/* handle FlexiMD by RXDID */ ice_rx_release_mbufs_t rx_rel_mbufs; +uint64_t offloads; };struct ice_tx_entry {
@@ -256,9 +257,15 @@ uint16_t ice_xmit_pkts_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts);uint16_t ice_recv_pkts_vec_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t ice_recv_pkts_vec_avx512_offload (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts);uint16_t ice_recv_scattered_pkts_vec_avx512 (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t ice_recv_scattered_pkts_vec_avx512_offload (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts);uint16_t ice_xmit_pkts_vec_avx512 (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); uint16_t ice_xmit_pkts_vec_avx512_offload(void *tx_queue,
drivers/net/ice/ice_rxtx_vec_avx512.c +221 -124
401 lines not on this page · raw message
drivers/net/ice/ice_rxtx_vec_common.h +33 -19
77 lines not on this page · raw message
Signature · 1 line
2.17.1
Quoted 10 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Leyi Rong
Sent: Thursday, April 15, 2021 4:58 PM
To: Zhang, Qi Z <[email protected]>; Lu, Wenzhuo <[email protected]>
Cc: [email protected]; Rong, Leyi <[email protected]>
Subject: [dpdk-dev] [PATCH v5 0/2] add alternative AVX512 offload pathAdd alternative Rx/Tx offload path for AVX512, which can support Rx/Tx offload features, like checksum/vlan/RSS/QinQ offload.
Zhang, Qi Z
AppliedQuoted 18 lines
-----Original Message-----
From: Sun, QinX <[email protected]>
Sent: Friday, April 16, 2021 5:02 PM
To: Rong, Leyi <[email protected]>; Zhang, Qi Z <[email protected]>; Lu, Wenzhuo <[email protected]>
Cc: [email protected]; Sun, QinX <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v5 0/2] add alternative AVX512 offload pathQuoted 8 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Leyi Rong
Sent: Thursday, April 15, 2021 4:58 PM
To: Zhang, Qi Z <[email protected]>; Lu, Wenzhuo <[email protected]>
Cc: [email protected]; Rong, Leyi <[email protected]>
Subject: [dpdk-dev] [PATCH v5 0/2] add alternative AVX512 offload path
Quoted 4 lines
Quoted 2 lines
Add alternative Rx/Tx offload path for AVX512, which can support Rx/Tx offload features, like checksum/vlan/RSS/QinQ offload.
Tested-by Qin Sun <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi