linux/tools/bpf/bpftool/Documentation
Yonghong Song 9406b485de tools/bpftool: Add bpf_iter support for bptool
Currently, only one command is supported
  bpftool iter pin <bpf_prog.o> <path>

It will pin the trace/iter bpf program in
the object file <bpf_prog.o> to the <path>
where <path> should be on a bpffs mount.

For example,
  $ bpftool iter pin ./bpf_iter_ipv6_route.o \
    /sys/fs/bpf/my_route
User can then do a `cat` to print out the results:
  $ cat /sys/fs/bpf/my_route
    fe800000000000000000000000000000 40 00000000000000000000000000000000 ...
    00000000000000000000000000000000 00 00000000000000000000000000000000 ...
    00000000000000000000000000000001 80 00000000000000000000000000000000 ...
    fe800000000000008c0162fffebdfd57 80 00000000000000000000000000000000 ...
    ff000000000000000000000000000000 08 00000000000000000000000000000000 ...
    00000000000000000000000000000000 00 00000000000000000000000000000000 ...

The implementation for ipv6_route iterator is in one of subsequent
patches.

This patch also added BPF_LINK_TYPE_ITER to link query.

In the future, we may add additional parameters to pin command
by parameterizing the bpf iterator. For example, a map_id or pid
may be added to let bpf program only traverses a single map or task,
similar to kernel seq_file single_open().

We may also add introspection command for targets/iterators by
leveraging the bpf_iter itself.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200509175920.2477247-1-yhs@fb.com
2020-05-09 17:05:27 -07:00
..
bpftool-btf.rst tools: bpftool: implement "bpftool btf show|list" 2019-08-20 09:51:06 -07:00
bpftool-cgroup.rst tools: bpftool: add support for reporting the effective cgroup progs 2019-07-30 21:15:02 -07:00
bpftool-feature.rst tools: bpftool: Make libcap dependency optional 2020-04-29 23:25:11 +02:00
bpftool-gen.rst bpftool: Use consistent include paths for libbpf 2020-01-20 16:37:45 -08:00
bpftool-iter.rst tools/bpftool: Add bpf_iter support for bptool 2020-05-09 17:05:27 -07:00
bpftool-link.rst bpftool: Add bpftool-link manpage 2020-04-28 17:27:08 -07:00
bpftool-map.rst bpftool: Match maps by name 2019-12-15 09:03:18 -08:00
bpftool-net.rst tools: bpftool: add documentation for net attach/detach 2019-08-15 17:00:33 -07:00
bpftool-perf.rst tools: bpftool: add -d option to get debug output from libbpf 2019-05-28 11:02:21 +02:00
bpftool-prog.rst bpftool: Documentation for bpftool prog profile 2020-03-10 00:04:07 +01:00
bpftool-struct_ops.rst bpftool: Add struct_ops support 2020-03-20 15:51:35 +01:00
bpftool.rst bpftool: Add gen subcommand manpage 2019-12-17 22:16:36 -08:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00