Use the new function for determining the maximum simd bitwidth in
the iavf driver.

Signed-off-by: Ciara Loftus <ciara.lof...@intel.com>
---
 drivers/net/intel/iavf/iavf_rxtx.c         | 27 +++++-----------------
 drivers/net/intel/iavf/iavf_rxtx.h         |  1 +
 drivers/net/intel/iavf/iavf_rxtx_vec_sse.c |  6 +++++
 3 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/drivers/net/intel/iavf/iavf_rxtx.c 
b/drivers/net/intel/iavf/iavf_rxtx.c
index 3329499e59..e36a07d5ac 100644
--- a/drivers/net/intel/iavf/iavf_rxtx.c
+++ b/drivers/net/intel/iavf/iavf_rxtx.c
@@ -3970,21 +3970,13 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
        int check_ret;
        bool use_avx2 = false;
        bool use_avx512 = false;
+       enum rte_vect_max_simd rx_simd_path = iavf_get_max_simd_bitwidth();
 
        check_ret = iavf_rx_vec_dev_check(dev);
        if (check_ret >= 0 &&
            rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
-               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
+               use_avx2 = rx_simd_path == RTE_VECT_SIMD_256;
+               use_avx512 = rx_simd_path == RTE_VECT_SIMD_512;
 
                for (i = 0; i < dev->data->nb_rx_queues; i++) {
                        rxq = dev->data->rx_queues[i];
@@ -4129,6 +4121,7 @@ iavf_set_tx_function(struct rte_eth_dev *dev)
        bool use_sse = false;
        bool use_avx2 = false;
        bool use_avx512 = false;
+       enum rte_vect_max_simd tx_simd_path = iavf_get_max_simd_bitwidth();
 
        check_ret = iavf_tx_vec_dev_check(dev);
 
@@ -4138,16 +4131,8 @@ 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
+               use_avx2 = tx_simd_path == RTE_VECT_SIMD_256;
+               use_avx512 = tx_simd_path == RTE_VECT_SIMD_512;
 
                if (!use_sse && !use_avx2 && !use_avx512)
                        goto normal;
diff --git a/drivers/net/intel/iavf/iavf_rxtx.h 
b/drivers/net/intel/iavf/iavf_rxtx.h
index 1641bfe59a..36157003e3 100644
--- a/drivers/net/intel/iavf/iavf_rxtx.h
+++ b/drivers/net/intel/iavf/iavf_rxtx.h
@@ -606,6 +606,7 @@ void iavf_tx_queue_release_mbufs_avx512(struct ci_tx_queue 
*txq);
 void iavf_rx_queue_release_mbufs_sse(struct ci_rx_queue *rxq);
 void iavf_tx_queue_release_mbufs_sse(struct ci_tx_queue *txq);
 void iavf_rx_queue_release_mbufs_neon(struct ci_rx_queue *rxq);
+enum rte_vect_max_simd iavf_get_max_simd_bitwidth(void);
 
 static inline
 void iavf_dump_rx_descriptor(struct ci_rx_queue *rxq,
diff --git a/drivers/net/intel/iavf/iavf_rxtx_vec_sse.c 
b/drivers/net/intel/iavf/iavf_rxtx_vec_sse.c
index e4c1f9fc7b..9dae0a79bf 100644
--- a/drivers/net/intel/iavf/iavf_rxtx_vec_sse.c
+++ b/drivers/net/intel/iavf/iavf_rxtx_vec_sse.c
@@ -1387,3 +1387,9 @@ iavf_tx_vec_dev_check(struct rte_eth_dev *dev)
 {
        return iavf_tx_vec_dev_check_default(dev);
 }
+
+enum rte_vect_max_simd
+iavf_get_max_simd_bitwidth(void)
+{
+       return ci_get_x86_max_simd_bitwidth();
+}
-- 
2.34.1

Reply via email to