Commit 7224a073 authored by Andrii Nakryiko's avatar Andrii Nakryiko
Browse files

Merge branch 'bpf/bpftool: add program & link type names'



Milan Landaverde says:

====================

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)
====================

Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
parents 4eeebce6 7b53eaa6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -567,7 +567,7 @@ probe_prog_type(enum bpf_prog_type prog_type, bool *supported_types,

		res = probe_prog_type_ifindex(prog_type, ifindex);
	} else {
		res = libbpf_probe_bpf_prog_type(prog_type, NULL);
		res = libbpf_probe_bpf_prog_type(prog_type, NULL) > 0;
	}

#ifdef USE_LIBCAP
+3 −0
Original line number Diff line number Diff line
@@ -20,6 +20,9 @@ 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",
	[BPF_LINK_TYPE_KPROBE_MULTI]		= "kprobe_multi",
};

static struct hashmap *link_table;
+1 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ const char * const prog_type_name[] = {
	[BPF_PROG_TYPE_EXT]			= "ext",
	[BPF_PROG_TYPE_LSM]			= "lsm",
	[BPF_PROG_TYPE_SK_LOOKUP]		= "sk_lookup",
	[BPF_PROG_TYPE_SYSCALL]			= "syscall",
};

const size_t prog_type_name_size = ARRAY_SIZE(prog_type_name);