libbpf: Add opts-based attach/detach/query API for tcx
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 19 Jul 2023 14:08:53 +0000 (16:08 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 19 Jul 2023 17:07:28 +0000 (10:07 -0700)
commitfe20ce3a512649b7f883e15dfc01eb29bfcf2168
treecd1ae81acdc67408b13c9031c756eaa20be1a748
parente420bed025071a623d2720a92bc2245c84757ecb
libbpf: Add opts-based attach/detach/query API for tcx

Extend libbpf attach opts and add a new detach opts API so this can be used
to add/remove fd-based tcx BPF programs. The old-style bpf_prog_detach() and
bpf_prog_detach2() APIs are refactored to reuse the new bpf_prog_detach_opts()
internally.

The bpf_prog_query_opts() API got extended to be able to handle the new
link_ids, link_attach_flags and revision fields.

For concrete usage examples, see the extensive selftests that have been
developed as part of this series.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20230719140858.13224-4-daniel@iogearbox.net
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/lib/bpf/bpf.c
tools/lib/bpf/bpf.h
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf.map