aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bpf/bpftool/prog.c
diff options
context:
space:
mode:
authorQuentin Monnet <quentin.monnet@netronome.com>2018-11-30 11:25:48 -0500
committerAlexei Starovoitov <ast@kernel.org>2018-11-30 17:06:07 -0500
commit99a44bef587082fbbaddf6aaa1e823ebbb629339 (patch)
treed56f6028a98107f060a2116e9c9e586534323a2e /tools/bpf/bpftool/prog.c
parent73f0b9db53836a68c40691fad1467ed44a3123e8 (diff)
tools: bpftool: add owner_prog_type and owner_jited to bpftool output
For prog array maps, the type of the owner program, and the JIT-ed state of that program, are available from the file descriptor information under /proc. Add them to "bpftool map show" output. Example output: # bpftool map show 158225: prog_array name jmp_table flags 0x0 key 4B value 4B max_entries 8 memlock 4096B owner_prog_type flow_dissector owner jited # bpftool --json --pretty map show [{ "id": 1337, "type": "prog_array", "name": "jmp_table", "flags": 0, "bytes_key": 4, "bytes_value": 4, "max_entries": 8, "bytes_memlock": 4096, "owner_prog_type": "flow_dissector", "owner_jited": true } ] As we move the table used for associating names to program types, complete it with the missing types (lwt_seg6local and sk_reuseport). Also add missing types to the help message for "bpftool prog" (sk_reuseport and flow_dissector). Suggested-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/bpf/bpftool/prog.c')
-rw-r--r--tools/bpf/bpftool/prog.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index 4e04699a2350..56db61c5a91f 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -54,30 +54,6 @@
54#include "main.h" 54#include "main.h"
55#include "xlated_dumper.h" 55#include "xlated_dumper.h"
56 56
57static const char * const prog_type_name[] = {
58 [BPF_PROG_TYPE_UNSPEC] = "unspec",
59 [BPF_PROG_TYPE_SOCKET_FILTER] = "socket_filter",
60 [BPF_PROG_TYPE_KPROBE] = "kprobe",
61 [BPF_PROG_TYPE_SCHED_CLS] = "sched_cls",
62 [BPF_PROG_TYPE_SCHED_ACT] = "sched_act",
63 [BPF_PROG_TYPE_TRACEPOINT] = "tracepoint",
64 [BPF_PROG_TYPE_XDP] = "xdp",
65 [BPF_PROG_TYPE_PERF_EVENT] = "perf_event",
66 [BPF_PROG_TYPE_CGROUP_SKB] = "cgroup_skb",
67 [BPF_PROG_TYPE_CGROUP_SOCK] = "cgroup_sock",
68 [BPF_PROG_TYPE_LWT_IN] = "lwt_in",
69 [BPF_PROG_TYPE_LWT_OUT] = "lwt_out",
70 [BPF_PROG_TYPE_LWT_XMIT] = "lwt_xmit",
71 [BPF_PROG_TYPE_SOCK_OPS] = "sock_ops",
72 [BPF_PROG_TYPE_SK_SKB] = "sk_skb",
73 [BPF_PROG_TYPE_CGROUP_DEVICE] = "cgroup_device",
74 [BPF_PROG_TYPE_SK_MSG] = "sk_msg",
75 [BPF_PROG_TYPE_RAW_TRACEPOINT] = "raw_tracepoint",
76 [BPF_PROG_TYPE_CGROUP_SOCK_ADDR] = "cgroup_sock_addr",
77 [BPF_PROG_TYPE_LIRC_MODE2] = "lirc_mode2",
78 [BPF_PROG_TYPE_FLOW_DISSECTOR] = "flow_dissector",
79};
80
81static const char * const attach_type_strings[] = { 57static const char * const attach_type_strings[] = {
82 [BPF_SK_SKB_STREAM_PARSER] = "stream_parser", 58 [BPF_SK_SKB_STREAM_PARSER] = "stream_parser",
83 [BPF_SK_SKB_STREAM_VERDICT] = "stream_verdict", 59 [BPF_SK_SKB_STREAM_VERDICT] = "stream_verdict",
@@ -1172,6 +1148,7 @@ static int do_help(int argc, char **argv)
1172 " tracepoint | raw_tracepoint | xdp | perf_event | cgroup/skb |\n" 1148 " tracepoint | raw_tracepoint | xdp | perf_event | cgroup/skb |\n"
1173 " cgroup/sock | cgroup/dev | lwt_in | lwt_out | lwt_xmit |\n" 1149 " cgroup/sock | cgroup/dev | lwt_in | lwt_out | lwt_xmit |\n"
1174 " lwt_seg6local | sockops | sk_skb | sk_msg | lirc_mode2 |\n" 1150 " lwt_seg6local | sockops | sk_skb | sk_msg | lirc_mode2 |\n"
1151 " sk_reuseport | flow_dissector |\n"
1175 " cgroup/bind4 | cgroup/bind6 | cgroup/post_bind4 |\n" 1152 " cgroup/bind4 | cgroup/bind6 | cgroup/post_bind4 |\n"
1176 " cgroup/post_bind6 | cgroup/connect4 | cgroup/connect6 |\n" 1153 " cgroup/post_bind6 | cgroup/connect4 | cgroup/connect6 |\n"
1177 " cgroup/sendmsg4 | cgroup/sendmsg6 }\n" 1154 " cgroup/sendmsg4 | cgroup/sendmsg6 }\n"