2022-04-01 14:27:22

by Milan Landaverde

[permalink] [raw]
Subject: [PATCH bpf-next 0/3] bpf/bpftool: add program & link type names

With the addition of the syscall prog type we should now
be able to see feature probe info for that prog type:

$ bpftool feature probe kernel
...
eBPF program_type syscall is available
...
eBPF helpers supported for program type syscall:
...
- bpf_sys_bpf
- bpf_sys_close

And for the link types, their names should aid in
the output.

Before:
$ bpftool link show
50: type 7 prog 5042
bpf_cookie 0
pids vfsstat(394433)

After:
$ bpftool link show
57: perf_event prog 5058
bpf_cookie 0
pids vfsstat(394725)

Milan Landaverde (3):
bpf/bpftool: add syscall prog type
bpf/bpftool: add missing link types
bpf/bpftool: handle libbpf_probe_prog_type errors

tools/bpf/bpftool/feature.c | 2 +-
tools/bpf/bpftool/link.c | 2 ++
tools/bpf/bpftool/prog.c | 1 +
3 files changed, 4 insertions(+), 1 deletion(-)

--
2.32.0


2022-04-01 14:30:11

by Milan Landaverde

[permalink] [raw]
Subject: [PATCH bpf-next 2/3] bpf/bpftool: add missing link types

Will display the link type names in bpftool link show output

Signed-off-by: Milan Landaverde <[email protected]>
---
tools/bpf/bpftool/link.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/bpf/bpftool/link.c b/tools/bpf/bpftool/link.c
index 97dec81950e5..9392ef390828 100644
--- a/tools/bpf/bpftool/link.c
+++ b/tools/bpf/bpftool/link.c
@@ -20,6 +20,8 @@ static const char * const link_type_name[] = {
[BPF_LINK_TYPE_CGROUP] = "cgroup",
[BPF_LINK_TYPE_ITER] = "iter",
[BPF_LINK_TYPE_NETNS] = "netns",
+ [BPF_LINK_TYPE_XDP] = "xdp",
+ [BPF_LINK_TYPE_PERF_EVENT] = "perf_event",
};

static struct hashmap *link_table;
--
2.32.0

2022-04-02 14:37:46

by Quentin Monnet

[permalink] [raw]
Subject: Re: [PATCH bpf-next 2/3] bpf/bpftool: add missing link types

2022-03-31 11:45 UTC-0400 ~ Milan Landaverde <[email protected]>
> Will display the link type names in bpftool link show output
>
> Signed-off-by: Milan Landaverde <[email protected]>
> ---
> tools/bpf/bpftool/link.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/bpf/bpftool/link.c b/tools/bpf/bpftool/link.c
> index 97dec81950e5..9392ef390828 100644
> --- a/tools/bpf/bpftool/link.c
> +++ b/tools/bpf/bpftool/link.c
> @@ -20,6 +20,8 @@ static const char * const link_type_name[] = {
> [BPF_LINK_TYPE_CGROUP] = "cgroup",
> [BPF_LINK_TYPE_ITER] = "iter",
> [BPF_LINK_TYPE_NETNS] = "netns",
> + [BPF_LINK_TYPE_XDP] = "xdp",
> + [BPF_LINK_TYPE_PERF_EVENT] = "perf_event",

Since this goes into bpf-next, we should add BPF_LINK_TYPE_KPROBE_MULTI
as well.

Quentin

2022-04-05 00:52:54

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH bpf-next 0/3] bpf/bpftool: add program & link type names

Hello:

This series was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <[email protected]>:

On Thu, 31 Mar 2022 11:45:52 -0400 you wrote:
> With the addition of the syscall prog type we should now
> be able to see feature probe info for that prog type:
>
> $ bpftool feature probe kernel
> ...
> eBPF program_type syscall is available
> ...
> eBPF helpers supported for program type syscall:
> ...
> - bpf_sys_bpf
> - bpf_sys_close
>
> [...]

Here is the summary with links:
- [bpf-next,1/3] bpf/bpftool: add syscall prog type
https://git.kernel.org/bpf/bpf-next/c/380341637ebb
- [bpf-next,2/3] bpf/bpftool: add missing link types
https://git.kernel.org/bpf/bpf-next/c/fff3dfab1786
- [bpf-next,3/3] bpf/bpftool: handle libbpf_probe_prog_type errors
https://git.kernel.org/bpf/bpf-next/c/7b53eaa656c3

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


2022-04-05 01:26:59

by Andrii Nakryiko

[permalink] [raw]
Subject: Re: [PATCH bpf-next 2/3] bpf/bpftool: add missing link types

On Fri, Apr 1, 2022 at 9:05 AM Quentin Monnet <[email protected]> wrote:
>
> 2022-03-31 11:45 UTC-0400 ~ Milan Landaverde <[email protected]>
> > Will display the link type names in bpftool link show output
> >
> > Signed-off-by: Milan Landaverde <[email protected]>
> > ---
> > tools/bpf/bpftool/link.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/tools/bpf/bpftool/link.c b/tools/bpf/bpftool/link.c
> > index 97dec81950e5..9392ef390828 100644
> > --- a/tools/bpf/bpftool/link.c
> > +++ b/tools/bpf/bpftool/link.c
> > @@ -20,6 +20,8 @@ static const char * const link_type_name[] = {
> > [BPF_LINK_TYPE_CGROUP] = "cgroup",
> > [BPF_LINK_TYPE_ITER] = "iter",
> > [BPF_LINK_TYPE_NETNS] = "netns",
> > + [BPF_LINK_TYPE_XDP] = "xdp",

fixed indentation here and added KPROBE_MULTI while applying

> > + [BPF_LINK_TYPE_PERF_EVENT] = "perf_event",
>
> Since this goes into bpf-next, we should add BPF_LINK_TYPE_KPROBE_MULTI
> as well.
>
> Quentin