bpf: decouple btf from seq bpf fs dump and enable more maps
Commit a26ca7c9 ("bpf: btf: Add pretty print support to the basic arraymap") and 699c86d6 ("bpf: btf: add pretty print for hash/lru_hash maps") enabled support for BTF and dumping via BPF fs for array and hash/lru map. However, both can be decoupled from each other such that regular BPF maps can be supported for attaching BTF key/value information, while not all maps necessarily need to dump via map_seq_show_elem() callback. The basic sanity check which is a prerequisite for all maps is that key/value size has to match in any case, and some maps can have extra checks via map_check_btf() callback, e.g. probing certain types or indicating no support in general. With that we can also enable retrieving BTF info for per-cpu map types and lpm. Signed-off-by:Daniel Borkmann <daniel@iogearbox.net> Acked-by:
Alexei Starovoitov <ast@kernel.org> Acked-by:
Yonghong Song <yhs@fb.com>
Showing
- include/linux/bpf.h 9 additions, 4 deletionsinclude/linux/bpf.h
- kernel/bpf/arraymap.c 12 additions, 14 deletionskernel/bpf/arraymap.c
- kernel/bpf/cpumap.c 1 addition, 0 deletionskernel/bpf/cpumap.c
- kernel/bpf/devmap.c 1 addition, 0 deletionskernel/bpf/devmap.c
- kernel/bpf/hashtab.c 1 addition, 19 deletionskernel/bpf/hashtab.c
- kernel/bpf/inode.c 2 additions, 1 deletionkernel/bpf/inode.c
- kernel/bpf/local_storage.c 1 addition, 0 deletionskernel/bpf/local_storage.c
- kernel/bpf/lpm_trie.c 12 additions, 0 deletionskernel/bpf/lpm_trie.c
- kernel/bpf/sockmap.c 2 additions, 0 deletionskernel/bpf/sockmap.c
- kernel/bpf/stackmap.c 1 addition, 0 deletionskernel/bpf/stackmap.c
- kernel/bpf/syscall.c 32 additions, 4 deletionskernel/bpf/syscall.c
- kernel/bpf/xskmap.c 1 addition, 2 deletionskernel/bpf/xskmap.c
Loading
Please register or sign in to comment