diff mbox series

[v3,4/6] net/af_xdp: avoid version-based check for program load mech

Message ID 20221005095037.997006-6-andrew.rybchenko@oktetlabs.ru (mailing list archive)
State Superseded, archived
Delegated to: Andrew Rybchenko
Headers show
Series net/af_xdp: make compatible with libbpf v0.8.0 | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andrew Rybchenko Oct. 5, 2022, 9:50 a.m. UTC
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>
---
 drivers/net/af_xdp/meson.build | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

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