Skip to content

RFC Revamp bpf_attr and make it easier to evolve

Andrii Nakryiko bpf 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3bpf: revamp bpf_attr and name each command's field and substructinclude/uapi/linux/bpf.h kernel/bpf/syscall.c tools/include/uapi/linux/bpf.h+405 -1056 replies
2/3bpf: use new named bpf_attr substructs for few commandskernel/bpf/syscall.c+17 -200 replies
3/3libbpf: use new bpf_xxx_attr structs for bpf() commandstools/lib/bpf/bpf.c tools/lib/bpf/gen_loader.c tools/lib/bpf/libbpf.c +1 more+219 -2200 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH RFC bpf-next 0/3] Revamp bpf_attr and make it easier to evolve

RFC patch set revamping anonymous substructs of union bpf_attr, which would allow nicer and more coherent evolution of bpf() syscall arguments, especially for commands like BPF_MAP_CREATE and BPF_PROG_LOAD. See patch #1 for justification and more details. Patch #2 demonstrates how straightforward it is to switch to new-style substricts in kernel code (and keep in mind that this is optional until we need some new field for a given command, so we can do it completely asynchronously from landing bpf_attr changes themselves). Patch #3 shows also similar libbpf changes, except for libbpf single patches switches over entire libbpf code base to new-style substructs (except skel_internal.h, due to concerns that users might be reliant on outdated system-wide linux/bpf.h UAPI header).

Andrii Nakryiko (3):
bpf: revamp bpf_attr and name each command's field and substruct
bpf: use new named bpf_attr substructs for few commands
libbpf: use new bpf_xxx_attr structs for bpf() commands

 include/uapi/linux/bpf.h        | 235 +++++++++++++++++----
 kernel/bpf/syscall.c            |  77 ++++---
 tools/include/uapi/linux/bpf.h  | 235 +++++++++++++++++----
 tools/lib/bpf/bpf.c             | 355 ++++++++++++++++----------------
 tools/lib/bpf/gen_loader.c      |  78 +++----
 tools/lib/bpf/libbpf.c          |   4 +-
 tools/lib/bpf/libbpf_internal.h |   2 +-
 7 files changed, 641 insertions(+), 345 deletions(-)
Signature · 1 line
2.34.1