diff mbox series

[v3,3/6] net/af_xdp: avoid version-based check for shared UMEM

Message ID 20221005095037.997006-5-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
Check for xsk_socket__create_shared() function instead.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 drivers/net/af_xdp/meson.build | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/af_xdp/meson.build b/drivers/net/af_xdp/meson.build
index fa011c357d..a01a67c7e7 100644
--- a/drivers/net/af_xdp/meson.build
+++ b/drivers/net/af_xdp/meson.build
@@ -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