diff options
author | Quentin Monnet <quentin.monnet@netronome.com> | 2018-11-30 11:25:48 -0500 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2018-11-30 17:06:07 -0500 |
commit | 99a44bef587082fbbaddf6aaa1e823ebbb629339 (patch) | |
tree | d56f6028a98107f060a2116e9c9e586534323a2e /tools/bpf/bpftool/main.h | |
parent | 73f0b9db53836a68c40691fad1467ed44a3123e8 (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/main.h')
-rw-r--r-- | tools/bpf/bpftool/main.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/main.h b/tools/bpf/bpftool/main.h index 7431669fae0a..2761981669c8 100644 --- a/tools/bpf/bpftool/main.h +++ b/tools/bpf/bpftool/main.h | |||
@@ -78,6 +78,32 @@ | |||
78 | #define HELP_SPEC_MAP \ | 78 | #define HELP_SPEC_MAP \ |
79 | "MAP := { id MAP_ID | pinned FILE }" | 79 | "MAP := { id MAP_ID | pinned FILE }" |
80 | 80 | ||
81 | static const char * const prog_type_name[] = { | ||
82 | [BPF_PROG_TYPE_UNSPEC] = "unspec", | ||
83 | [BPF_PROG_TYPE_SOCKET_FILTER] = "socket_filter", | ||
84 | [BPF_PROG_TYPE_KPROBE] = "kprobe", | ||
85 | [BPF_PROG_TYPE_SCHED_CLS] = "sched_cls", | ||
86 | [BPF_PROG_TYPE_SCHED_ACT] = "sched_act", | ||
87 | [BPF_PROG_TYPE_TRACEPOINT] = "tracepoint", | ||
88 | [BPF_PROG_TYPE_XDP] = "xdp", | ||
89 | [BPF_PROG_TYPE_PERF_EVENT] = "perf_event", | ||
90 | [BPF_PROG_TYPE_CGROUP_SKB] = "cgroup_skb", | ||
91 | [BPF_PROG_TYPE_CGROUP_SOCK] = "cgroup_sock", | ||
92 | [BPF_PROG_TYPE_LWT_IN] = "lwt_in", | ||
93 | [BPF_PROG_TYPE_LWT_OUT] = "lwt_out", | ||
94 | [BPF_PROG_TYPE_LWT_XMIT] = "lwt_xmit", | ||
95 | [BPF_PROG_TYPE_SOCK_OPS] = "sock_ops", | ||
96 | [BPF_PROG_TYPE_SK_SKB] = "sk_skb", | ||
97 | [BPF_PROG_TYPE_CGROUP_DEVICE] = "cgroup_device", | ||
98 | [BPF_PROG_TYPE_SK_MSG] = "sk_msg", | ||
99 | [BPF_PROG_TYPE_RAW_TRACEPOINT] = "raw_tracepoint", | ||
100 | [BPF_PROG_TYPE_CGROUP_SOCK_ADDR] = "cgroup_sock_addr", | ||
101 | [BPF_PROG_TYPE_LWT_SEG6LOCAL] = "lwt_seg6local", | ||
102 | [BPF_PROG_TYPE_LIRC_MODE2] = "lirc_mode2", | ||
103 | [BPF_PROG_TYPE_SK_REUSEPORT] = "sk_reuseport", | ||
104 | [BPF_PROG_TYPE_FLOW_DISSECTOR] = "flow_dissector", | ||
105 | }; | ||
106 | |||
81 | enum bpf_obj_type { | 107 | enum bpf_obj_type { |
82 | BPF_OBJ_UNKNOWN, | 108 | BPF_OBJ_UNKNOWN, |
83 | BPF_OBJ_PROG, | 109 | BPF_OBJ_PROG, |