add alternative AVX512 offload path
v2 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.
---
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 | 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 | 403 +++++++++++++++++--------- drivers/net/ice/ice_rxtx_vec_common.h | 129 +++++++-- drivers/net/ice/ice_rxtx_vec_sse.c | 2 +- 6 files changed, 443 insertions(+), 176 deletions(-)
Signature · 1 line
2.17.1
PATCH v2 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 | 58 +++++++++++--- drivers/net/ice/ice_rxtx_vec_common.h | 105 ++++++++++++++++++++++---- drivers/net/ice/ice_rxtx_vec_sse.c | 2 +- 6 files changed, 162 insertions(+), 35 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 +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 v2 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 | 345 +++++++++++++++++--------- drivers/net/ice/ice_rxtx_vec_common.h | 50 ++-- 4 files changed, 294 insertions(+), 154 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 +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