dpdk/0453-net-af_xdp-avoid-version-based-check-for-program-loa.patch

49 lines
1.8 KiB
Diff
Raw Permalink Normal View History

From 0ed0bc383428042c45d7d77f689bcd87b3700d5b Mon Sep 17 00:00:00 2001
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Date: Thu, 6 Oct 2022 09:26:52 +0300
Subject: [PATCH] net/af_xdp: avoid version-based check for program load
[ upstream commit 0ed0bc383428042c45d7d77f689bcd87b3700d5b ]
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>
---
drivers/net/af_xdp/meson.build | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/af_xdp/meson.build b/drivers/net/af_xdp/meson.build
index a01a67c7e7..9d5ffab96b 100644
--- a/drivers/net/af_xdp/meson.build
+++ b/drivers/net/af_xdp/meson.build
@@ -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
--
2.33.0