Merge branch 'bpf-bpftool-improved-prog-load'
Jakub Kicinski says:
====================
This series starts with two minor clean ups to test_offload.py
selftest script.
The next 11 patches extend the abilities of bpftool prog load
beyond the simple cgroup use cases. Three new parameters are
added:
- type - allows specifying program type, independent of how
code sections are named;
- map - allows reusing existing maps, instead of creating a new
map on every program load;
- dev - offload/binding to a device.
A number of changes to libbpf is required to accomplish the task.
The section - program type logic mapping is exposed. We should
probably aim to use the libbpf program section naming everywhere.
For reuse of maps we need to allow users to set FD for bpf map
object in libbpf.
Examples
Load program my_xdp.o and pin it as /sys/fs/bpf/my_xdp, for xdp
program type:
$ bpftool prog load my_xdp.o /sys/fs/bpf/my_xdp \
type xdp
As above but for offload:
$ bpftool prog load my_xdp.o /sys/fs/bpf/my_xdp \
type xdp \
dev netdevsim0
Load program my_maps.o, but for the first map reuse map id 17,
and for the map called "other_map" reuse pinned map /sys/fs/bpf/map0:
$ bpftool prog load my_maps.o /sys/fs/bpf/prog \
map idx 0 id 17 \
map name other_map pinned /sys/fs/bpf/map0
v3:
- fix return codes in patch 5;
- rename libbpf_prog_type_by_string() -> libbpf_prog_type_by_name();
- fold file path into xattr in patch 8;
- add patch 10;
- use dup3() in patch 12;
- depend on fd value in patch 12;
- close old fd in patch 12.
v2:
- add compat for reallocarray().
====================
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Showing
tools/lib/bpf/libbpf_errno.c
0 → 100644
Please register or sign in to comment