net/iavf: enable AVX2 for iavf
Subsystems (2)
PATCH 1/1 net/iavf: enable AVX2 for iavf
This patch enables AVX data path for iavf PMD.
Signed-off-by Leyi Rong <[email protected]>
--- drivers/net/iavf/Makefile | 21 + drivers/net/iavf/iavf_rxtx.c | 62 +- drivers/net/iavf/iavf_rxtx.h | 10 + drivers/net/iavf/iavf_rxtx_vec_avx2.c | 867 ++++++++++++++++++++++++ drivers/net/iavf/iavf_rxtx_vec_common.h | 72 ++ drivers/net/iavf/iavf_rxtx_vec_sse.c | 12 + drivers/net/iavf/meson.build | 17 + 7 files changed, 1041 insertions(+), 20 deletions(-) create mode 100644 drivers/net/iavf/iavf_rxtx_vec_avx2.c
drivers/net/iavf/Makefile +21 -0
@@ -48,4 +48,25 @@ ifeq ($(CONFIG_RTE_ARCH_X86), y) SRCS-$(CONFIG_RTE_LIBRTE_IAVF_INC_VECTOR) += iavf_rxtx_vec_sse.c endif +ifeq ($(CONFIG_RTE_LIBRTE_IAVF_INC_VECTOR), y) + ifeq ($(findstring RTE_MACHINE_CPUFLAG_AVX2,$(CFLAGS)),RTE_MACHINE_CPUFLAG_AVX2) + CC_AVX2_SUPPORT=1 + else + CC_AVX2_SUPPORT=\ + $(shell $(CC) -march=core-avx2 -dM -E - </dev/null 2>&1 | \ + grep -q AVX2 && echo 1) + ifeq ($(CC_AVX2_SUPPORT), 1) + ifeq ($(CONFIG_RTE_TOOLCHAIN_ICC),y) + CFLAGS_iavf_rxtx_vec_avx2.o += -march=core-avx2 + else + CFLAGS_iavf_rxtx_vec_avx2.o += -mavx2 + endif + endif + endif +endif + +ifeq ($(CC_AVX2_SUPPORT), 1) + SRCS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) += iavf_rxtx_vec_avx2.c +endif + include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/iavf/iavf_rxtx.c +42 -20
87 lines not on this page · raw message
drivers/net/iavf/iavf_rxtx.h +10 -0
@@ -19,6 +19,7 @@/* used for Vector PMD */ #define IAVF_VPMD_RX_MAX_BURST 32#define IAVF_VPMD_TX_MAX_BURST 32 +#define IAVF_RXQ_REARM_THRESH 32#define IAVF_VPMD_DESCS_PER_LOOP 4#define IAVF_VPMD_TX_MAX_FREE_BUF 64
@@ -200,6 +201,15 @@ uint16_t iavf_recv_scattered_pkts_vec(void *rx_queue, uint16_t nb_pkts);uint16_t iavf_xmit_fixed_burst_vec (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t iavf_recv_pkts_vec_avx2 (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +uint16_t iavf_recv_scattered_pkts_vec_avx2 (void *rx_queue, +struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); +uint16_t iavf_xmit_pkts_vec_avx2 (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts); +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);
drivers/net/iavf/iavf_rxtx_vec_avx2.c new file +867 -0
867 lines not on this page · raw message
drivers/net/iavf/iavf_rxtx_vec_common.h +72 -0
76 lines not on this page · raw message
drivers/net/iavf/iavf_rxtx_vec_sse.c +12 -0
@@ -655,3 +655,15 @@ iavf_rxq_vec_setup(struct iavf_rx_queue *rxq) rxq->ops = &sse_vec_rxq_ops;return iavf_rxq_vec_setup_default (rxq); } + +int __attribute__((cold)) +iavf_rx_vec_dev_check (struct rte_eth_dev *dev) +{ +return iavf_rx_vec_dev_check_default (dev); +} + +int __attribute__((cold)) +iavf_tx_vec_dev_check (struct rte_eth_dev *dev) +{ +return iavf_tx_vec_dev_check_default (dev); +}
drivers/net/iavf/meson.build +17 -0
@@ -17,4 +17,21 @@ sources = files( if arch_subdir == 'x86' dpdk_conf.set('RTE_LIBRTE_IAVF_INC_VECTOR', 1) sources += files('iavf_rxtx_vec_sse.c') + + # compile AVX2 version if either: + # a. we have AVX supported in minimum instruction set baseline + # b. it's not minimum instruction set, but supported by compiler + if dpdk_conf.has('RTE_MACHINE_CPUFLAG_AVX2') + cflags += ['-DCC_AVX2_SUPPORT'] + sources += files('iavf_rxtx_vec_avx2.c') + elif cc.has_argument('-mavx2') + cflags += ['-DCC_AVX2_SUPPORT'] + i40e_avx2_lib = static_library('iavf_avx2_lib', + 'iavf_rxtx_vec_avx2.c', + dependencies: [static_rte_ethdev, + static_rte_kvargs, static_rte_hash], + include_directories: includes, + c_args: [cflags, '-mavx2']) + objs += iavf_avx2_lib.extract_objects('iavf_rxtx_vec_avx2.c') + endif endif
Signature · 1 line
2.17.1