Check for xsk_socket__create_shared() function instead.

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

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
-- 
2.30.2

Reply via email to