public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf v1 0/2] libbpf: Remove extern declaration of bpf_stream_vprintk()
@ 2026-02-18 21:56 Ihor Solodrai
  2026-02-18 21:56 ` [PATCH bpf v1 1/2] selftests/bpf: Use vmlinux.h in test_xdp_meta Ihor Solodrai
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ihor Solodrai @ 2026-02-18 21:56 UTC (permalink / raw)
  To: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
	Eduard Zingerman
  Cc: Jakub Sitnicki, bpf, netdev, linux-kernel, kernel-team

The first patch adjusts a selftest that has been using
bpf_stream_printk() macro. The second patch removes the declaration.

Successful BPF CI run: https://github.com/kernel-patches/bpf/actions/runs/22156645808

Ihor Solodrai (2):
  selftests/bpf: Use vmlinux.h in test_xdp_meta
  libbpf: Remove extern declaration of bpf_stream_vprintk()

 tools/lib/bpf/bpf_helpers.h                       |  3 ---
 tools/testing/selftests/bpf/progs/test_xdp_meta.c | 12 ++++++------
 2 files changed, 6 insertions(+), 9 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH bpf v1 1/2] selftests/bpf: Use vmlinux.h in test_xdp_meta
  2026-02-18 21:56 [PATCH bpf v1 0/2] libbpf: Remove extern declaration of bpf_stream_vprintk() Ihor Solodrai
@ 2026-02-18 21:56 ` Ihor Solodrai
  2026-02-18 21:56 ` [PATCH bpf v1 2/2] libbpf: Remove extern declaration of bpf_stream_vprintk() Ihor Solodrai
  2026-02-18 23:20 ` [PATCH bpf v1 0/2] " patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Ihor Solodrai @ 2026-02-18 21:56 UTC (permalink / raw)
  To: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
	Eduard Zingerman
  Cc: Jakub Sitnicki, bpf, netdev, linux-kernel, kernel-team

- Replace linux/* includes with vmlinux.h
- Include errno.h
- Include bpf_tracing_net.h for TC_ACT_* and ETH_*
- Use BPF_STDERR instead of BPF_STREAM_STDERR

Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
---
 tools/testing/selftests/bpf/progs/test_xdp_meta.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/bpf/progs/test_xdp_meta.c b/tools/testing/selftests/bpf/progs/test_xdp_meta.c
index 0a0f371a2dec..fa73b17cb999 100644
--- a/tools/testing/selftests/bpf/progs/test_xdp_meta.c
+++ b/tools/testing/selftests/bpf/progs/test_xdp_meta.c
@@ -1,12 +1,12 @@
-#include <stdbool.h>
-#include <linux/bpf.h>
-#include <linux/errno.h>
-#include <linux/if_ether.h>
-#include <linux/pkt_cls.h>
+// SPDX-License-Identifier: GPL-2.0
+#include <vmlinux.h>
 
 #include <bpf/bpf_endian.h>
 #include <bpf/bpf_helpers.h>
+#include <errno.h>
+
 #include "bpf_kfuncs.h"
+#include "bpf_tracing_net.h"
 
 #define META_SIZE 32
 
@@ -42,7 +42,7 @@ static bool check_metadata(const char *file, int line, __u8 *meta_have)
 	if (!__builtin_memcmp(meta_have, meta_want, META_SIZE))
 		return true;
 
-	bpf_stream_printk(BPF_STREAM_STDERR,
+	bpf_stream_printk(BPF_STDERR,
 			  "FAIL:%s:%d: metadata mismatch\n"
 			  "  have:\n    %pI6\n    %pI6\n"
 			  "  want:\n    %pI6\n    %pI6\n",
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH bpf v1 2/2] libbpf: Remove extern declaration of bpf_stream_vprintk()
  2026-02-18 21:56 [PATCH bpf v1 0/2] libbpf: Remove extern declaration of bpf_stream_vprintk() Ihor Solodrai
  2026-02-18 21:56 ` [PATCH bpf v1 1/2] selftests/bpf: Use vmlinux.h in test_xdp_meta Ihor Solodrai
@ 2026-02-18 21:56 ` Ihor Solodrai
  2026-02-18 23:20 ` [PATCH bpf v1 0/2] " patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Ihor Solodrai @ 2026-02-18 21:56 UTC (permalink / raw)
  To: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
	Eduard Zingerman
  Cc: Jakub Sitnicki, bpf, netdev, linux-kernel, kernel-team

An issue was reported that building BPF program which includes both
vmlinux.h and bpf_helpers.h from libbpf fails due to conflicting
declarations of bpf_stream_vprintk().

Remove the extern declaration from bpf_helpers.h to address this.

In order to use bpf_stream_printk() macro, BPF programs are expected
to either include vmlinux.h of the kernel they are targeting, or add
their own extern declaration.

Reported-by: Luca Boccassi <luca.boccassi@gmail.com>
Closes: https://github.com/libbpf/libbpf/issues/947
Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
---
 tools/lib/bpf/bpf_helpers.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/lib/bpf/bpf_helpers.h b/tools/lib/bpf/bpf_helpers.h
index c145da05a67c..9d160b5b9c0e 100644
--- a/tools/lib/bpf/bpf_helpers.h
+++ b/tools/lib/bpf/bpf_helpers.h
@@ -315,9 +315,6 @@ enum libbpf_tristate {
 			  ___param, sizeof(___param));		\
 })
 
-extern int bpf_stream_vprintk(int stream_id, const char *fmt__str, const void *args,
-			      __u32 len__sz) __weak __ksym;
-
 #define bpf_stream_printk(stream_id, fmt, args...)					\
 ({											\
 	static const char ___fmt[] = fmt;						\
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf v1 0/2] libbpf: Remove extern declaration of bpf_stream_vprintk()
  2026-02-18 21:56 [PATCH bpf v1 0/2] libbpf: Remove extern declaration of bpf_stream_vprintk() Ihor Solodrai
  2026-02-18 21:56 ` [PATCH bpf v1 1/2] selftests/bpf: Use vmlinux.h in test_xdp_meta Ihor Solodrai
  2026-02-18 21:56 ` [PATCH bpf v1 2/2] libbpf: Remove extern declaration of bpf_stream_vprintk() Ihor Solodrai
@ 2026-02-18 23:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-02-18 23:20 UTC (permalink / raw)
  To: Ihor Solodrai
  Cc: ast, andrii, daniel, eddyz87, jakub, bpf, netdev, linux-kernel,
	kernel-team

Hello:

This series was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Wed, 18 Feb 2026 13:56:49 -0800 you wrote:
> The first patch adjusts a selftest that has been using
> bpf_stream_printk() macro. The second patch removes the declaration.
> 
> Successful BPF CI run: https://github.com/kernel-patches/bpf/actions/runs/22156645808
> 
> Ihor Solodrai (2):
>   selftests/bpf: Use vmlinux.h in test_xdp_meta
>   libbpf: Remove extern declaration of bpf_stream_vprintk()
> 
> [...]

Here is the summary with links:
  - [bpf,v1,1/2] selftests/bpf: Use vmlinux.h in test_xdp_meta
    https://git.kernel.org/bpf/bpf/c/b3dfa128f7da
  - [bpf,v1,2/2] libbpf: Remove extern declaration of bpf_stream_vprintk()
    https://git.kernel.org/bpf/bpf/c/0cecd492f516

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-18 23:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-18 21:56 [PATCH bpf v1 0/2] libbpf: Remove extern declaration of bpf_stream_vprintk() Ihor Solodrai
2026-02-18 21:56 ` [PATCH bpf v1 1/2] selftests/bpf: Use vmlinux.h in test_xdp_meta Ihor Solodrai
2026-02-18 21:56 ` [PATCH bpf v1 2/2] libbpf: Remove extern declaration of bpf_stream_vprintk() Ihor Solodrai
2026-02-18 23:20 ` [PATCH bpf v1 0/2] " patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox