[v4,10/11] net: use common AVX512 build code
Checks
Commit Message
Use the common support for AVX512 code present in lib/meson.build,
rather than hard-coding it. The only complication is an extra check for
the "-mvpclmulqdq" command-line flag before adding the AVX512 sources.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/net/meson.build | 12 ++++--------
lib/net/rte_net_crc.c | 8 ++++----
2 files changed, 8 insertions(+), 12 deletions(-)
@@ -44,14 +44,10 @@ use_function_versioning = true
if dpdk_conf.has('RTE_ARCH_X86_64')
sources += files('net_crc_sse.c')
cflags += ['-mpclmul', '-maes']
- if cc.has_argument('-mvpclmulqdq') and cc_has_avx512
- cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT']
- net_crc_avx512_lib = static_library(
- 'net_crc_avx512_lib',
- 'net_crc_avx512.c',
- dependencies: static_rte_eal,
- c_args: [cflags, cc_avx512_flags, '-mvpclmulqdq'])
- objs += net_crc_avx512_lib.extract_objects('net_crc_avx512.c')
+ # only build AVX-512 support if we also have PCLMULQDQ support
+ if cc.has_argument('-mvpclmulqdq')
+ sources_avx512 += files('net_crc_avx512.c')
+ cflags_avx512 += ['-mvpclmulqdq']
endif
elif (dpdk_conf.has('RTE_ARCH_ARM64') and
@@ -60,7 +60,7 @@ static const rte_net_crc_handler handlers_scalar[] = {
[RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_handler,
[RTE_NET_CRC32_ETH] = rte_crc32_eth_handler,
};
-#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT
+#ifdef CC_AVX512_SUPPORT
static const rte_net_crc_handler handlers_avx512[] = {
[RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_avx512_handler,
[RTE_NET_CRC32_ETH] = rte_crc32_eth_avx512_handler,
@@ -185,7 +185,7 @@ rte_crc32_eth_handler(const uint8_t *data, uint32_t data_len)
static const rte_net_crc_handler *
avx512_vpclmulqdq_get_handlers(void)
{
-#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT
+#ifdef CC_AVX512_SUPPORT
if (AVX512_VPCLMULQDQ_CPU_SUPPORTED &&
max_simd_bitwidth >= RTE_VECT_SIMD_512)
return handlers_avx512;
@@ -197,7 +197,7 @@ avx512_vpclmulqdq_get_handlers(void)
static void
avx512_vpclmulqdq_init(void)
{
-#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT
+#ifdef CC_AVX512_SUPPORT
if (AVX512_VPCLMULQDQ_CPU_SUPPORTED)
rte_net_crc_avx512_init();
#endif
@@ -305,7 +305,7 @@ handlers_init(enum rte_net_crc_alg alg)
switch (alg) {
case RTE_NET_CRC_AVX512:
-#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT
+#ifdef CC_AVX512_SUPPORT
if (AVX512_VPCLMULQDQ_CPU_SUPPORTED) {
handlers_dpdk26[alg].f[RTE_NET_CRC16_CCITT] =
rte_crc16_ccitt_avx512_handler;