Skip to content

Commit

Permalink
net/iavf: enable AVX512 for legacy Rx
Browse files Browse the repository at this point in the history
To enhance the per-core performance, this patch adds some AVX512
instructions to the data path to handle the legacy Rx descriptors.

Signed-off-by: Wenzhuo Lu <[email protected]>
Signed-off-by: Bruce Richardson <[email protected]>
Signed-off-by: Leyi Rong <[email protected]>
Acked-by: Qi Zhang <[email protected]>
  • Loading branch information
wenzhuol authored and Ferruh Yigit committed Nov 3, 2020
1 parent 98a181e commit 31737f2
Show file tree
Hide file tree
Showing 5 changed files with 749 additions and 4 deletions.
4 changes: 4 additions & 0 deletions doc/guides/rel_notes/release_20_11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ New Features
Added the FEC PMD which provides functions for query FEC capabilities and
current FEC mode from device. Also, PMD for configuring FEC mode is also provided.

* **Updated Intel iavf driver.**

* Added support of AVX512 instructions in Rx path.

* **Updated Intel ice driver.**

* Used write combining stores.
Expand Down
29 changes: 25 additions & 4 deletions drivers/net/iavf/iavf_rxtx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2123,6 +2123,9 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
struct iavf_rx_queue *rxq;
int i;
bool use_avx2 = false;
#ifdef CC_AVX512_SUPPORT
bool use_avx512 = false;
#endif

if (!iavf_rx_vec_dev_check(dev) &&
rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
Expand All @@ -2135,34 +2138,52 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) &&
rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_256)
use_avx2 = true;
#ifdef CC_AVX512_SUPPORT
if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) == 1 &&
rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_512)
use_avx512 = true;
#endif

if (dev->data->scattered_rx) {
PMD_DRV_LOG(DEBUG,
"Using %sVector Scattered Rx (port %d).",
use_avx2 ? "avx2 " : "",
dev->data->port_id);
if (vf->vf_res->vf_cap_flags &
VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC) {
dev->rx_pkt_burst = use_avx2 ?
iavf_recv_scattered_pkts_vec_avx2_flex_rxd :
iavf_recv_scattered_pkts_vec_flex_rxd;
else
} else {
dev->rx_pkt_burst = use_avx2 ?
iavf_recv_scattered_pkts_vec_avx2 :
iavf_recv_scattered_pkts_vec;
#ifdef CC_AVX512_SUPPORT
if (use_avx512)
dev->rx_pkt_burst =
iavf_recv_scattered_pkts_vec_avx512;
#endif
}
} else {
PMD_DRV_LOG(DEBUG, "Using %sVector Rx (port %d).",
use_avx2 ? "avx2 " : "",
dev->data->port_id);
if (vf->vf_res->vf_cap_flags &
VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC) {
dev->rx_pkt_burst = use_avx2 ?
iavf_recv_pkts_vec_avx2_flex_rxd :
iavf_recv_pkts_vec_flex_rxd;
else
} else {
dev->rx_pkt_burst = use_avx2 ?
iavf_recv_pkts_vec_avx2 :
iavf_recv_pkts_vec;
#ifdef CC_AVX512_SUPPORT
if (use_avx512)
dev->rx_pkt_burst =
iavf_recv_pkts_vec_avx512;
#endif
}
}

return;
Expand Down
5 changes: 5 additions & 0 deletions drivers/net/iavf/iavf_rxtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,11 @@ int iavf_rx_vec_dev_check(struct rte_eth_dev *dev);
int iavf_tx_vec_dev_check(struct rte_eth_dev *dev);
int iavf_rxq_vec_setup(struct iavf_rx_queue *rxq);
int iavf_txq_vec_setup(struct iavf_tx_queue *txq);
uint16_t iavf_recv_pkts_vec_avx512(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t nb_pkts);
uint16_t iavf_recv_scattered_pkts_vec_avx512(void *rx_queue,
struct rte_mbuf **rx_pkts,
uint16_t nb_pkts);

const uint32_t *iavf_get_default_ptype_table(void);

Expand Down
Loading

0 comments on commit 31737f2

Please sign in to comment.