Prior to this change, it was possible the scalar path would be selected
even if the avx-512 path was available. This was due to the ordering of
the logic in the iavf_set_tx_function function. Support for all three
vector paths (sse, avx2 and avx-512) was first established and then in
that order, the tx_burst_type was set to the appropriate type. If all
three paths were supported, then the burst type would be first set to
sse, then avx2 then avx-512. However, in the avx2 logic, if an error
was encountered then the burst type was set to a fallback option of the
scalar path. This is not desired behaviour because the avx-512 path
should be selected over the scalar path when it is available.

This commit fixes this issue by only checking for avx2 support after
deeming that avx512 is not supported.

Fixes: 77b19d1d4b2e ("net/iavf: fix mbuf release path selection")

Signed-off-by: Ciara Loftus <ciara.lof...@intel.com>
---
 drivers/net/intel/iavf/iavf_rxtx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/intel/iavf/iavf_rxtx.c 
b/drivers/net/intel/iavf/iavf_rxtx.c
index 1ce9de0699..a7922ee44d 100644
--- a/drivers/net/intel/iavf/iavf_rxtx.c
+++ b/drivers/net/intel/iavf/iavf_rxtx.c
@@ -4230,16 +4230,16 @@ iavf_set_tx_function(struct rte_eth_dev *dev)
                if (check_ret == IAVF_VECTOR_PATH) {
                        use_sse = true;
                }
-               if ((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;
 #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 (!use_avx512 && (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_sse && !use_avx2 && !use_avx512)
                        goto normal;
-- 
2.34.1

Reply via email to