Skip to contentSkip to conversation

net/af_xdp: limit libbpf version to <= v0.7.0

PATCH In review Ciara Loftus 3 participants 6 messages Jun 24, 2022 – Jul 7, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/af_xdp: limit libbpf version to <= v0.7.0

Linking with libbpf v0.8.0 causes deprication warnings. As a temporary measure, prevent linking with libbpf versions v0.8.0 and greater. This limitation should be removed in the future when appropriate compatibility measures are introduced.

---
 doc/guides/nics/af_xdp.rst     | 3 ++-
 drivers/net/af_xdp/meson.build | 7 ++-----
 2 files changed, 4 insertions(+), 6 deletions(-)
doc/guides/nics/af_xdp.rst +2 -1
index 56681c8365..46738e089d 100644
@@ -43,7 +43,8 @@ Prerequisites
 This is a Linux-specific PMD, thus the following prerequisites apply:
 
 *  A Linux Kernel (version > v4.18) with XDP sockets configuration enabled;
-*  Both libxdp >=v1.2.2 and libbpf libraries installed, or, libbpf <=v0.6.0
+*  Both libxdp >=v1.2.2 and libbpf <=v0.7.0 libraries installed, or, libbpf
+   <=v0.6.0.
 *  If using libxdp, it requires an environment variable called
    LIBXDP_OBJECT_PATH to be set to the location of where libxdp placed its bpf
    object files. This is usually in /usr/local/lib/bpf or /usr/local/lib64/bpf.
drivers/net/af_xdp/meson.build +2 -5
index 1e0de23705..52862e90a1 100644
@@ -10,10 +10,7 @@ endif
 sources = files('rte_eth_af_xdp.c')
 
 xdp_dep = dependency('libxdp', version : '>=1.2.2', required: false, method: 'pkg-config')
-bpf_dep = dependency('libbpf', required: false, method: 'pkg-config')
-if not bpf_dep.found()
-    bpf_dep = cc.find_library('bpf', required: false)
-endif
+bpf_dep = dependency('libbpf', version : '<=0.7.0', required: false, method: 'pkg-config')
 
 if cc.has_header('linux/if_xdp.h')
     if xdp_dep.found() and cc.has_header('xdp/xsk.h')
@@ -29,7 +26,7 @@ if cc.has_header('linux/if_xdp.h')
             endif
         else
             build = false
-            reason = 'missing dependency, libbpf'
+            reason = 'missing dependency, libbpf <= v0.7.0'
         endif
     elif bpf_dep.found() and cc.has_header('bpf/xsk.h') and cc.has_header('bpf/bpf.h')
         # libxdp not found. Rely solely on libbpf for xsk functionality
Signature · 1 line
2.25.1
#1 lore raw

24/06/2022 08:06, Ciara Loftus:

drivers/net/af_xdp/meson.build endif · line 13

Quoted 12 lines

Linking with libbpf v0.8.0 causes deprication warnings. As a temporary measure, prevent linking with libbpf versions v0.8.0 and greater. This limitation should be removed in the future when appropriate compatibility measures are introduced.

---

drivers/net/af_xdp/meson.build +1 -4
-bpf_dep = dependency('libbpf', required: false, method: 'pkg-config')
-if not bpf_dep.found()
-    bpf_dep = cc.find_library('bpf', required: false)
-endif
+bpf_dep = dependency('libbpf', version : '<=0.7.0', required: false, method: 'pkg-config')

It is also removing the find_library() method.
Any reason it was there?

#2 lore raw
Quoted 16 lines

24/06/2022 08:06, Ciara Loftus:

drivers/net/af_xdp/meson.build endif

Quoted 12 lines

Linking with libbpf v0.8.0 causes deprication warnings. As a temporary measure, prevent linking with libbpf versions v0.8.0 and greater. This limitation should be removed in the future when appropriate compatibility measures are introduced.

---

drivers/net/af_xdp/meson.build +1 -4
-bpf_dep = dependency('libbpf', required: false, method: 'pkg-config')
-if not bpf_dep.found()
-    bpf_dep = cc.find_library('bpf', required: false)
-endif
+bpf_dep = dependency('libbpf', version : '<=0.7.0', required: false,

method: 'pkg-config')

Quoted 3 lines

It is also removing the find_library() method.
Any reason it was there?

My understanding is that one can't check the library version using that method.
So it was a valid method of picking up the library until now where we always need to check the version before linking.

#3 lore raw

24/06/2022 10:37, Loftus, Ciara:

Quoted 16 lines
Quoted 16 lines

24/06/2022 08:06, Ciara Loftus:

drivers/net/af_xdp/meson.build endif

Quoted 12 lines

Linking with libbpf v0.8.0 causes deprication warnings. As a temporary measure, prevent linking with libbpf versions v0.8.0 and greater. This limitation should be removed in the future when appropriate compatibility measures are introduced.

---

drivers/net/af_xdp/meson.build +1 -4
-bpf_dep = dependency('libbpf', required: false, method: 'pkg-config')
-if not bpf_dep.found()
-    bpf_dep = cc.find_library('bpf', required: false)
-endif
+bpf_dep = dependency('libbpf', version : '<=0.7.0', required: false,

method: 'pkg-config')

Quoted 6 lines
Quoted 3 lines

It is also removing the find_library() method.
Any reason it was there?

My understanding is that one can't check the library version using that method.
So it was a valid method of picking up the library until now where we always need to check the version before linking.

OK I see

#4 lore raw
Quoted 17 lines · Thomas Monjalon

24/06/2022 10:37, Loftus, Ciara:

Quoted 16 lines
Quoted 16 lines

24/06/2022 08:06, Ciara Loftus:

drivers/net/af_xdp/meson.build endif

Quoted 12 lines

Linking with libbpf v0.8.0 causes deprication warnings. As a temporary measure, prevent linking with libbpf versions v0.8.0 and greater. This limitation should be removed in the future when appropriate compatibility measures are introduced.

---

drivers/net/af_xdp/meson.build +1 -4
-bpf_dep = dependency('libbpf', required: false, method: 'pkg-config')
-if not bpf_dep.found()
-    bpf_dep = cc.find_library('bpf', required: false)
-endif
+bpf_dep = dependency('libbpf', version : '<=0.7.0', required: false,

method: 'pkg-config')

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

It is also removing the find_library() method.
Any reason it was there?

My understanding is that one can't check the library version using that method.
So it was a valid method of picking up the library until now where we always need to check the version before linking.

OK I see

IMHO checking library version is a bad approach. We should file the library of whatever version and check for symbols etc in it and provide corresponding HAVE_ defines to handle it in code.

#5 lore raw
Quoted 22 lines · Andrew Rybchenko
Quoted 21 lines · Thomas Monjalon

24/06/2022 10:37, Loftus, Ciara:

Quoted 20 lines
Quoted 19 lines

24/06/2022 08:06, Ciara Loftus:

drivers/net/af_xdp/meson.build endif

Quoted 12 lines

Linking with libbpf v0.8.0 causes deprication warnings. As a temporary measure, prevent linking with libbpf versions v0.8.0 and greater. This limitation should be removed in the future when appropriate compatibility measures are introduced.

---

drivers/net/af_xdp/meson.build +1 -4
-bpf_dep = dependency('libbpf', required: false, method: 'pkg-config')
-if not bpf_dep.found()
-    bpf_dep = cc.find_library('bpf', required: false)
-endif
+bpf_dep = dependency('libbpf', version : '<=0.7.0', required: false,

method: 'pkg-config')

It is also removing the find_library() method.
Any reason it was there?

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

My understanding is that one can't check the library version using that method.
So it was a valid method of picking up the library until now where we always need to check the version before linking.

OK I see

IMHO checking library version is a bad approach. We should file the library of whatever version and check for symbols etc in it and provide corresponding HAVE_ defines to handle it in code.

I'm marking the patch as discarded since it is a step in a wrong direction.