Skip to content

Commit 7ae40e5

Browse files
bruce-richardsondavid-marchand
authored andcommitted
net: use common AVX512 build handling
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 <[email protected]> Acked-by: Konstantin Ananyev <[email protected]>
1 parent 98d04bc commit 7ae40e5

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

lib/net/meson.build

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,10 @@ use_function_versioning = true
4444
if dpdk_conf.has('RTE_ARCH_X86_64')
4545
sources += files('net_crc_sse.c')
4646
cflags += ['-mpclmul', '-maes']
47-
if cc.has_argument('-mvpclmulqdq') and cc_has_avx512
48-
cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT']
49-
net_crc_avx512_lib = static_library(
50-
'net_crc_avx512_lib',
51-
'net_crc_avx512.c',
52-
dependencies: static_rte_eal,
53-
c_args: [cflags, cc_avx512_flags, '-mvpclmulqdq'])
54-
objs += net_crc_avx512_lib.extract_objects('net_crc_avx512.c')
47+
# only build AVX-512 support if we also have PCLMULQDQ support
48+
if cc.has_argument('-mvpclmulqdq')
49+
sources_avx512 += files('net_crc_avx512.c')
50+
cflags_avx512 += ['-mvpclmulqdq']
5551
endif
5652

5753
elif (dpdk_conf.has('RTE_ARCH_ARM64') and

lib/net/rte_net_crc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static const rte_net_crc_handler handlers_scalar[] = {
6060
[RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_handler,
6161
[RTE_NET_CRC32_ETH] = rte_crc32_eth_handler,
6262
};
63-
#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT
63+
#ifdef CC_AVX512_SUPPORT
6464
static const rte_net_crc_handler handlers_avx512[] = {
6565
[RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_avx512_handler,
6666
[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)
185185
static const rte_net_crc_handler *
186186
avx512_vpclmulqdq_get_handlers(void)
187187
{
188-
#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT
188+
#ifdef CC_AVX512_SUPPORT
189189
if (AVX512_VPCLMULQDQ_CPU_SUPPORTED &&
190190
max_simd_bitwidth >= RTE_VECT_SIMD_512)
191191
return handlers_avx512;
@@ -197,7 +197,7 @@ avx512_vpclmulqdq_get_handlers(void)
197197
static void
198198
avx512_vpclmulqdq_init(void)
199199
{
200-
#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT
200+
#ifdef CC_AVX512_SUPPORT
201201
if (AVX512_VPCLMULQDQ_CPU_SUPPORTED)
202202
rte_net_crc_avx512_init();
203203
#endif
@@ -305,7 +305,7 @@ handlers_init(enum rte_net_crc_alg alg)
305305

306306
switch (alg) {
307307
case RTE_NET_CRC_AVX512:
308-
#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT
308+
#ifdef CC_AVX512_SUPPORT
309309
if (AVX512_VPCLMULQDQ_CPU_SUPPORTED) {
310310
handlers_dpdk26[alg].f[RTE_NET_CRC16_CCITT] =
311311
rte_crc16_ccitt_avx512_handler;

0 commit comments

Comments
 (0)