linux/tools/bpf/bpftool
Quentin Monnet e3b9626f09 tools: bpftool: Add "inner_map" to "bpftool map create" outer maps
There is no support for creating maps of types array-of-map or
hash-of-map in bpftool. This is because the kernel needs an inner_map_fd
to collect metadata on the inner maps to be supported by the new map,
but bpftool does not provide a way to pass this file descriptor.

Add a new optional "inner_map" keyword that can be used to pass a
reference to a map, retrieve a fd to that map, and pass it as the
inner_map_fd.

Add related documentation and bash completion. Note that we can
reference the inner map by its name, meaning we can have several times
the keyword "name" with different meanings (mandatory outer map name,
and possibly a name to use to find the inner_map_fd). The bash
completion will offer it just once, and will not suggest "name" on the
following command:

    # bpftool map create /sys/fs/bpf/my_outer_map type hash_of_maps \
        inner_map name my_inner_map [TAB]

Fixing that specific case seems too convoluted. Completion will work as
expected, however, if the outer map name comes first and the "inner_map
name ..." is passed second.

Signed-off-by: Quentin Monnet <quentin@isovalent.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200910102652.10509-4-quentin@isovalent.com
2020-09-10 17:29:21 -07:00
..
bash-completion tools: bpftool: Add "inner_map" to "bpftool map create" outer maps 2020-09-10 17:29:21 -07:00
Documentation tools: bpftool: Add "inner_map" to "bpftool map create" outer maps 2020-09-10 17:29:21 -07:00
skeleton samples/bpf, selftests/bpf: Use bpf_probe_read_kernel 2020-07-21 13:26:26 -07:00
.gitignore tools/bpftool: Generalize BPF skeleton support and generate vmlinux.h 2020-06-22 17:01:48 -07:00
btf_dumper.c tools/bpftool: Fix compilation warnings in 32-bit mode 2020-08-13 16:45:41 -07:00
btf.c tools/bpftool: Use libbpf's btf__parse() API for parsing BTF from file 2020-08-03 16:39:48 +02:00
cfg.c tools, bpftool: Poison and replace kernel integer typedefs 2020-05-11 21:20:46 +02:00
cfg.h tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00
cgroup.c tools, bpftool: Clean subcommand help messages 2020-06-01 14:38:18 -07:00
common.c bpftool: Use only nftw for file tree parsing 2020-07-21 23:42:56 +02:00
feature.c tools, bpftool: Skip type probe if name is not found 2020-07-27 22:40:25 +02:00
gen.c tools/bpftool: Remove libbpf_internal.h usage in bpftool 2020-08-18 18:38:25 -07:00
iter.c tools/bpf: Support new uapi for map element bpf iterator 2020-08-06 16:39:14 -07:00
jit_disasm.c tools/bpf/bpftool: Remove duplicate headers 2020-04-26 08:40:01 -07:00
json_writer.c tools: bpftool: move "__printf()" attributes to header file 2019-08-15 22:06:46 -07:00
json_writer.h tools: bpftool: move "__printf()" attributes to header file 2019-08-15 22:06:46 -07:00
link.c bpftool: Implement link_query for bpf iterators 2020-08-21 14:01:39 -07:00
main.c tools: bpftool: Print optional built-in features along with version 2020-09-10 11:16:46 -07:00
main.h tools/bpftool: Fix compilation warnings in 32-bit mode 2020-08-13 16:45:41 -07:00
Makefile tools, bpf/build: Cleanup feature files on make clean 2020-08-28 14:04:27 +02:00
map_perf_ring.c tools, bpftool: Poison and replace kernel integer typedefs 2020-05-11 21:20:46 +02:00
map.c tools: bpftool: Add "inner_map" to "bpftool map create" outer maps 2020-09-10 17:29:21 -07:00
net.c tools/bpftool: Remove libbpf_internal.h usage in bpftool 2020-08-18 18:38:25 -07:00
netlink_dumper.c bpftool: Use consistent include paths for libbpf 2020-01-20 16:37:45 -08:00
netlink_dumper.h tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
perf.c tools, bpftool: Clean subcommand help messages 2020-06-01 14:38:18 -07:00
pids.c bpftool: Handle EAGAIN error code properly in pids collection 2020-08-18 17:36:23 -07:00
prog.c tools/bpftool: Replace bpf_program__title() with bpf_program__section_name() 2020-09-03 17:14:40 -07:00
struct_ops.c tools, bpftool: Clean subcommand help messages 2020-06-01 14:38:18 -07:00
tracelog.c tools: bpftool: add an option to prevent auto-mount of bpffs, tracefs 2018-12-18 14:47:17 +01:00
xlated_dumper.c bpftool: Use consistent include paths for libbpf 2020-01-20 16:37:45 -08:00
xlated_dumper.h tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00