net/af_xdp: avoid version-based check for program load

Version-based checks are bad. It is better to check for required
functions. Check for bpf_object__next_program() in this case since
it appears last in libbpf among functions used to load program
without bpf_prog_load() which is deprecated in libbpf v0.7.0.

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:52 +03:00 committed by Ferruh Yigit
parent e024c7e838
commit 0ed0bc3834

View File

@ -22,11 +22,6 @@ if cc.has_header('linux/if_xdp.h')
ext_deps += xdp_dep
if bpf_dep.found() and cc.has_header('bpf/bpf.h')
ext_deps += bpf_dep
bpf_ver_dep = dependency('libbpf', version : '>=0.7.0',
required: false, method: 'pkg-config')
if bpf_ver_dep.found()
cflags += ['-DRTE_NET_AF_XDP_LIBBPF_OBJ_OPEN']
endif
else
build = false
reason = 'missing dependency, libbpf'
@ -64,4 +59,9 @@ if build
dependencies : ext_deps)
cflags += ['-DRTE_NET_AF_XDP_SHARED_UMEM']
endif
if cc.has_function('bpf_object__next_program',
prefix : '#include <bpf/libbpf.h>',
dependencies : bpf_dep)
cflags += ['-DRTE_NET_AF_XDP_LIBBPF_OBJ_OPEN']
endif
endif