Skip to contentSkip to conversation

Few small libbpf and selftests/bpf fixes

PATCH Applied Andrii Nakryiko 2 participants 6 messages Jun 3, 2021

Subsystems (6)
lore
Share & tools
lore

Andrii Nakryiko

author maintainer
#0 lore raw

cover Few small libbpf and selftests/bpf fixes

Fix few small issues in libbpf and selftests/bpf:
- fix up libbpf.map and move few APIs that didn't make it into final 0.4

    release;

- install skel_internal.h which is used by light skeleton;
- fix .gitignore for xdp_redirect_multi.

Andrii Nakryiko (4):
libbpf: move few APIs from 0.4 to 0.5 version
libbpf: refactor header installation portions of Makefile
libbpf: install skel_internal.h header used from light skeletons selftests/bpf: add xdp_redirect_multi into .gitignore

 tools/lib/bpf/Makefile                 | 19 +++++++------------
 tools/lib/bpf/libbpf.map               |  6 +++---
 tools/testing/selftests/bpf/.gitignore |  1 +
 3 files changed, 11 insertions(+), 15 deletions(-)
Signature · 1 line
2.30.2
author maintainer
#2 lore raw

PATCH 2/4 libbpf: refactor header installation portions of Makefile

As we gradually get more headers that have to be installed, it's quite annoying to copy/paste long $(call) commands. So extract that logic and do a simple $(foreach) over the list of headers.

---
 tools/lib/bpf/Makefile | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
tools/lib/bpf/Makefile +7 -12
index 15420303cf06..d1b909e005dc 100644
@@ -223,19 +223,14 @@ install_lib: all_cmd
 		$(call do_install_mkdir,$(libdir_SQ)); \
 		cp -fpR $(LIB_FILE) $(DESTDIR)$(libdir_SQ)
 
+INSTALL_HEADERS = bpf.h libbpf.h btf.h libbpf_common.h libbpf_legacy.h xsk.h \
+		  bpf_helpers.h $(BPF_HELPER_DEFS) bpf_tracing.h	     \
+		  bpf_endian.h bpf_core_read.h
+
 install_headers: $(BPF_HELPER_DEFS)
-	$(call QUIET_INSTALL, headers) \
-		$(call do_install,bpf.h,$(prefix)/include/bpf,644); \
-		$(call do_install,libbpf.h,$(prefix)/include/bpf,644); \
-		$(call do_install,btf.h,$(prefix)/include/bpf,644); \
-		$(call do_install,libbpf_common.h,$(prefix)/include/bpf,644); \
-		$(call do_install,libbpf_legacy.h,$(prefix)/include/bpf,644); \
-		$(call do_install,xsk.h,$(prefix)/include/bpf,644); \
-		$(call do_install,bpf_helpers.h,$(prefix)/include/bpf,644); \
-		$(call do_install,$(BPF_HELPER_DEFS),$(prefix)/include/bpf,644); \
-		$(call do_install,bpf_tracing.h,$(prefix)/include/bpf,644); \
-		$(call do_install,bpf_endian.h,$(prefix)/include/bpf,644); \
-		$(call do_install,bpf_core_read.h,$(prefix)/include/bpf,644);
+	$(call QUIET_INSTALL, headers)					     \
+		$(foreach hdr,$(INSTALL_HEADERS),			     \
+			$(call do_install,$(hdr),$(prefix)/include/bpf,644);)
 
 install_pkgconfig: $(PC_FILE)
 	$(call QUIET_INSTALL, $(PC_FILE)) \
Signature · 1 line
2.30.2
author maintainer
#3 lore raw

PATCH 3/4 libbpf: install skel_internal.h header used from light skeletons

In reply to Andrii Nakryiko

Light skeleton code assumes skel_internal.h header to be installed system-wide by libbpf package. Make sure it is actually installed.

Fixes 67234743736a ("libbpf: Generate loader program out of BPF ELF file.")
---
 tools/lib/bpf/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/Makefile +1 -1
index d1b909e005dc..ec14aa725bb0 100644
@@ -225,7 +225,7 @@ install_lib: all_cmd
 
 INSTALL_HEADERS = bpf.h libbpf.h btf.h libbpf_common.h libbpf_legacy.h xsk.h \
 		  bpf_helpers.h $(BPF_HELPER_DEFS) bpf_tracing.h	     \
-		  bpf_endian.h bpf_core_read.h
+		  bpf_endian.h bpf_core_read.h skel_internal.h
 
 install_headers: $(BPF_HELPER_DEFS)
 	$(call QUIET_INSTALL, headers)					     \
Signature · 1 line
2.30.2
author maintainer
#1 lore raw

PATCH 1/4 libbpf: move few APIs from 0.4 to 0.5 version

In reply to Andrii Nakryiko

Official libbpf 0.4 release doesn't include three APIs that were tentatively put into 0.4 section. Fix libbpf.map and move these three APIs:
- bpf_map__initial_value;
- bpf_map_lookup_and_delete_elem_flags;
- bpf_object__gen_loader.

---
 tools/lib/bpf/libbpf.map | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/lib/bpf/libbpf.map +3 -3
index bbe99b1db1a9..944c99d1ded3 100644
@@ -359,10 +359,7 @@ LIBBPF_0.4.0 {
 		bpf_linker__finalize;
 		bpf_linker__free;
 		bpf_linker__new;
-		bpf_map__initial_value;
 		bpf_map__inner_map;
-		bpf_map_lookup_and_delete_elem_flags;
-		bpf_object__gen_loader;
 		bpf_object__set_kversion;
 		bpf_tc_attach;
 		bpf_tc_detach;
@@ -373,5 +370,8 @@ LIBBPF_0.4.0 {
 
 LIBBPF_0.5.0 {
 	global:
+		bpf_map__initial_value;
+		bpf_map_lookup_and_delete_elem_flags;
+		bpf_object__gen_loader;
 		libbpf_set_strict_mode;
 } LIBBPF_0.4.0;
Signature · 1 line
2.30.2
author maintainer
#4 lore raw

PATCH 4/4 selftests/bpf: add xdp_redirect_multi into .gitignore

In reply to Andrii Nakryiko

When xdp_redirect_multi test binary was added recently, it wasn't added to .gitignore. Fix that.

Fixes d23292476297 ("selftests/bpf: Add xdp_redirect_multi test")
---
 tools/testing/selftests/bpf/.gitignore | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/.gitignore +1 -0
index a030aa4a8a9e..a18f57044014 100644
@@ -38,3 +38,4 @@ test_cpp
 /bench
 *.ko
 xdpxceiver
+xdp_redirect_multi
Signature · 1 line
2.30.2
#5 lore raw
In reply to Andrii Nakryiko
This series was applied to bpf/bpf-next.git (refs/heads/master):

Hello:

This series was applied to bpf/bpf-next.git (refs/heads/master):

Quoted 6 lines · On Wed, 2 Jun 2021 17:40:22 -0700 you wrote:

Fix few small issues in libbpf and selftests/bpf:
- fix up libbpf.map and move few APIs that didn't make it into final 0.4

    release;

- install skel_internal.h which is used by light skeleton;
- fix .gitignore for xdp_redirect_multi.

Quoted 7 lines

Andrii Nakryiko (4):
libbpf: move few APIs from 0.4 to 0.5 version
libbpf: refactor header installation portions of Makefile
libbpf: install skel_internal.h header used from light skeletons selftests/bpf: add xdp_redirect_multi into .gitignore

[...]

Here is the summary with links:
- [bpf-next,1/4] libbpf: move few APIs from 0.4 to 0.5 version

    https://git.kernel.org/bpf/bpf-next/c/16cac0060680
  - [bpf-next,2/4] libbpf: refactor header installation portions of Makefile
    https://git.kernel.org/bpf/bpf-next/c/232c9e8bd5eb
  - [bpf-next,3/4] libbpf: install skel_internal.h header used from light skeletons
    https://git.kernel.org/bpf/bpf-next/c/7d8a819dd316
  - [bpf-next,4/4] selftests/bpf: add xdp_redirect_multi into .gitignore
    https://git.kernel.org/bpf/bpf-next/c/56b8b7f9533b

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html