Skip to content

bpf: Generate helpers for pinning through bpf object skeleton

Yafang Shao bpf netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 15 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4libbpf: Define DEFAULT_BPFFStools/lib/bpf/bpf_helpers.h tools/lib/bpf/libbpf.c tools/lib/bpf/libbpf.h+6 -43 replies
2/4libbpf: Add helpers for pinning bpf prog through bpf object skeletontools/lib/bpf/libbpf.c tools/lib/bpf/libbpf.h tools/lib/bpf/libbpf.map+65 -06 replies
3/4bpftool: Fix incorrect return in generated detach helpertools/bpf/bpftool/gen.c+1 -12 replies
4/4bpftool: Generate helpers for pinning prog through bpf object skeletontools/bpf/bpftool/gen.c+16 -02 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH bpf-next 0/4] bpf: Generate helpers for pinning through bpf object skeleton

Currently there're helpers for allowing to open/load/attach BPF object through BPF object skeleton. Let's also add helpers for pinning through BPF object skeleton. It could simplify BPF userspace code which wants to pin the progs into bpffs.

After this change, with command 'bpftool gen skeleton XXX.bpf.o', the helpers for pinning BPF prog will be generated in BPF object skeleton.

The new helpers are named with __{pin, unpin}_prog, because it only pins bpf progs. If the user also wants to pin bpf maps, he can use LIBBPF_PIN_BY_NAME.

Yafang Shao (4):
libbpf: Define DEFAULT_BPFFS
libbpf: Add helpers for pinning bpf prog through bpf object skeleton
bpftool: Fix incorrect return in generated detach helper
bpftool: Generate helpers for pinning prog through bpf object skeleton

 tools/bpf/bpftool/gen.c     | 18 ++++++++++-
 tools/lib/bpf/bpf_helpers.h |  2 +-
 tools/lib/bpf/libbpf.c      | 61 ++++++++++++++++++++++++++++++++++++-
 tools/lib/bpf/libbpf.h      | 10 ++++--
 tools/lib/bpf/libbpf.map    |  2 ++
 5 files changed, 88 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.1