On 9/29/2021 1:13 PM, Leyi Rong wrote:
The common header file for vectorization is included in multiple files,
and so must use macros for the current compilation unit, rather than the
compiler-capability flag set for the whole driver. With the current,
incorrect, macro, the AVX512 or AVX2 flags may be set when compiling up
SSE code, leading to compilation errors. Changing from "CC_AVX*_SUPPORT"
to the compiler-defined "__AVX*__" macros fixes this issue. In addition,
splitting AVX-specific code into the new i40e_rxtx_common_avx.h header
file to avoid such bugs.

Bugzilla ID: 788
Fixes: 0604b1f2208f ("net/i40e: fix crash in AVX512")
Cc: wenzhuo...@intel.com
Cc: sta...@dpdk.org

Signed-off-by: Leyi Rong <leyi.r...@intel.com>
Signed-off-by: Bruce Richardson <bruce.richard...@intel.com>

<...>

diff --git a/drivers/net/i40e/i40e_rxtx_vec_common.h 
b/drivers/net/i40e/i40e_rxtx_vec_common.h
index f52ed98d62..798d6a3e4a 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_common.h
+++ b/drivers/net/i40e/i40e_rxtx_vec_common.h
@@ -15,6 +15,10 @@
  #pragma GCC diagnostic ignored "-Wcast-qual"
  #endif
+#ifdef __AVX2__
+#include "i40e_rxtx_common_avx.h"
+#endif
+

The 'i40e_rxtx_common_avx.h' header is not required by 'i40e_rxtx_vec_common.h',
why not include 'i40e_rxtx_common_avx.h' directly from related .c files:
i40e_rxtx_vec_avx2.c
i40e_rxtx_vec_avx512.c

So "#ifdef __AVX2__" won't be needed. Same for ice.

Reply via email to