Skip to content

Commit 6c15859

Browse files
bruce-richardsondavid-marchand
authored andcommitted
fib: use common AVX build handling
Remove custom logic for building AVX2 and AVX-512 files. Within the C code this requires some renaming of build macros to use the standard defines. Signed-off-by: Bruce Richardson <[email protected]> Acked-by: Konstantin Ananyev <[email protected]>
1 parent defa5d5 commit 6c15859

File tree

3 files changed

+7
-23
lines changed

3 files changed

+7
-23
lines changed

lib/fib/dir24_8.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
#include "dir24_8.h"
1717
#include "fib_log.h"
1818

19-
#ifdef CC_DIR24_8_AVX512_SUPPORT
19+
#ifdef CC_AVX512_SUPPORT
2020

2121
#include "dir24_8_avx512.h"
2222

23-
#endif /* CC_DIR24_8_AVX512_SUPPORT */
23+
#endif /* CC_AVX512_SUPPORT */
2424

2525
#define DIR24_8_NAMESIZE 64
2626

@@ -63,7 +63,7 @@ get_scalar_fn_inlined(enum rte_fib_dir24_8_nh_sz nh_sz, bool be_addr)
6363
static inline rte_fib_lookup_fn_t
6464
get_vector_fn(enum rte_fib_dir24_8_nh_sz nh_sz, bool be_addr)
6565
{
66-
#ifdef CC_DIR24_8_AVX512_SUPPORT
66+
#ifdef CC_AVX512_SUPPORT
6767
if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) <= 0 ||
6868
rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512DQ) <= 0 ||
6969
rte_vect_get_max_simd_bitwidth() < RTE_VECT_SIMD_512)

lib/fib/meson.build

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,5 @@ deps += ['rcu']
1515
deps += ['net']
1616

1717
if dpdk_conf.has('RTE_ARCH_X86_64')
18-
if target_has_avx512
19-
cflags += ['-DCC_DIR24_8_AVX512_SUPPORT', '-DCC_TRIE_AVX512_SUPPORT']
20-
sources += files('dir24_8_avx512.c', 'trie_avx512.c')
21-
22-
elif cc_has_avx512
23-
cflags += ['-DCC_DIR24_8_AVX512_SUPPORT', '-DCC_TRIE_AVX512_SUPPORT']
24-
dir24_8_avx512_tmp = static_library('dir24_8_avx512_tmp',
25-
'dir24_8_avx512.c',
26-
dependencies: [static_rte_eal, static_rte_rcu],
27-
c_args: cflags + cc_avx512_flags)
28-
objs += dir24_8_avx512_tmp.extract_objects('dir24_8_avx512.c')
29-
trie_avx512_tmp = static_library('trie_avx512_tmp',
30-
'trie_avx512.c',
31-
dependencies: [static_rte_eal, static_rte_rcu, static_rte_net],
32-
c_args: cflags + cc_avx512_flags)
33-
objs += trie_avx512_tmp.extract_objects('trie_avx512.c')
34-
endif
18+
sources_avx512 += files('dir24_8_avx512.c', 'trie_avx512.c')
3519
endif

lib/fib/trie.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
#include <rte_fib6.h>
1515
#include "trie.h"
1616

17-
#ifdef CC_TRIE_AVX512_SUPPORT
17+
#ifdef CC_AVX512_SUPPORT
1818

1919
#include "trie_avx512.h"
2020

21-
#endif /* CC_TRIE_AVX512_SUPPORT */
21+
#endif /* CC_AVX512_SUPPORT */
2222

2323
#define TRIE_NAMESIZE 64
2424

@@ -45,7 +45,7 @@ get_scalar_fn(enum rte_fib_trie_nh_sz nh_sz)
4545
static inline rte_fib6_lookup_fn_t
4646
get_vector_fn(enum rte_fib_trie_nh_sz nh_sz)
4747
{
48-
#ifdef CC_TRIE_AVX512_SUPPORT
48+
#ifdef CC_AVX512_SUPPORT
4949
if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) <= 0 ||
5050
rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512DQ) <= 0 ||
5151
rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) <= 0 ||

0 commit comments

Comments
 (0)