Depending on the underlying architecture and CPU flags available, a
different set of Tx paths are defined. The Tx path selection function
iterates sequentially from zero to num_paths where num_paths is the size
of the array as determined by the RTE_DIM macro. However, depending on
the platform, some of these entries may be empty, and valid entries at
the end of the array may never be considered in the selection function.
Fix this by editing the i40e_tx_func_type enum and only defining a value
for the Tx path if it is implemented in the i40e_tx_path_infos array.
Fixes: dc9c426f991f ("net/i40e: use common Tx path selection infrastructure")
Signed-off-by: Ciara Loftus <[email protected]>
---
drivers/net/intel/i40e/i40e_ethdev.h | 6 ++++++
drivers/net/intel/i40e/i40e_rxtx.c | 8 ++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/net/intel/i40e/i40e_ethdev.h
b/drivers/net/intel/i40e/i40e_ethdev.h
index 1fe504d0cd..c3240be960 100644
--- a/drivers/net/intel/i40e/i40e_ethdev.h
+++ b/drivers/net/intel/i40e/i40e_ethdev.h
@@ -1246,11 +1246,17 @@ enum i40e_rx_func_type {
enum i40e_tx_func_type {
I40E_TX_DEFAULT,
I40E_TX_SCALAR_SIMPLE,
+#ifdef RTE_ARCH_X86
I40E_TX_SSE,
I40E_TX_AVX2,
+#ifdef CC_AVX512_SUPPORT
I40E_TX_AVX512,
+#endif
+#elif defined(RTE_ARCH_ARM64)
I40E_TX_NEON,
+#elif defined(RTE_ARCH_PPC_64)
I40E_TX_ALTIVEC,
+#endif
};
/*
diff --git a/drivers/net/intel/i40e/i40e_rxtx.c
b/drivers/net/intel/i40e/i40e_rxtx.c
index a7d80e2bc0..f3c9d41686 100644
--- a/drivers/net/intel/i40e/i40e_rxtx.c
+++ b/drivers/net/intel/i40e/i40e_rxtx.c
@@ -3626,10 +3626,14 @@ i40e_set_tx_function(struct rte_eth_dev *dev)
i40e_tx_path_infos[ad->tx_func_type].info, dev->data->port_id);
if (ad->tx_func_type == I40E_TX_SCALAR_SIMPLE ||
+#ifdef RTE_ARCH_X86
ad->tx_func_type == I40E_TX_SSE ||
- ad->tx_func_type == I40E_TX_NEON ||
- ad->tx_func_type == I40E_TX_ALTIVEC ||
ad->tx_func_type == I40E_TX_AVX2)
+#elif defined(RTE_ARCH_ARM64)
+ ad->tx_func_type == I40E_TX_NEON)
+#elif defined(RTE_ARCH_PPC_64)
+ ad->tx_func_type == I40E_TX_ALTIVEC)
+#endif
dev->recycle_tx_mbufs_reuse = i40e_recycle_tx_mbufs_reuse_vec;
}
--
2.43.0