net/af_xdp: avoid version-based check for shared UMEM

Check for xsk_socket__create_shared() function instead.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
This commit is contained in:
Andrew Rybchenko 2022-10-06 09:26:51 +03:00 committed by Ferruh Yigit
parent f76dc44ded
commit e024c7e838

View File

@ -19,7 +19,6 @@ endif
if cc.has_header('linux/if_xdp.h')
if xdp_dep.found() and cc.has_header('xdp/xsk.h')
cflags += ['-DRTE_NET_AF_XDP_LIBXDP']
cflags += ['-DRTE_NET_AF_XDP_SHARED_UMEM']
ext_deps += xdp_dep
if bpf_dep.found() and cc.has_header('bpf/bpf.h')
ext_deps += bpf_dep
@ -39,11 +38,6 @@ if cc.has_header('linux/if_xdp.h')
required: false, method: 'pkg-config')
if bpf_ver_dep.found()
ext_deps += bpf_dep
bpf_shumem_ver_dep = dependency('libbpf', version : '>=0.2.0',
required: false, method: 'pkg-config')
if bpf_shumem_ver_dep.found()
cflags += ['-DRTE_NET_AF_XDP_SHARED_UMEM']
endif
else
build = false
reason = 'missing dependency, "libxdp ' + libxdp_ver + '" or "libbpf <= v0.6.0"'
@ -56,3 +50,18 @@ else
build = false
reason = 'missing header, "linux/if_xdp.h"'
endif
if build
xsk_check_prefix = '''
#ifdef RTE_NET_AF_XDP_LIBXDP
#include <xdp/xsk.h>
#else
#include <bpf/xsk.h>
#endif
'''
if cc.has_function('xsk_socket__create_shared', prefix : xsk_check_prefix,
dependencies : ext_deps)
cflags += ['-DRTE_NET_AF_XDP_SHARED_UMEM']
endif
endif