libbpf: add unified bpf_prog_load() low-level API
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest12 patches 13 repliesIn review
- v114 patches 10 repliesSuperseded
Changes in v2 from the cover letter
- dropped exposing sys_bpf() into public API (Alexei, Daniel);
- also dropped bpftool/cgroup.c fix for unistd.h include because it's not necessary due to sys_bpf() staying as is.
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/12 | libbpf: rename DECLARE_LIBBPF_OPTS into LIBBPF_OPTStools/ tools/ tools/ | +3 | 1 reply | |
| 2/12 | libbpf: pass number of prog load attempts explicitlytools/ | +8 | 2 replies | |
| 3/12 | libbpf: unify low-level BPF_PROG_LOAD APIs into bpf_prog_load()tools/ tools/ tools/ +7 more | +223 | 0 replies | |
| 4/12 | libbpf: remove internal use of deprecated bpf_prog_load() variantstools/ tools/ tools/ +1 more | +64 | 0 replies | |
| 5/12 | libbpf: stop using to-be-deprecated APIstools/ | +9 | 0 replies | |
| 6/12 | bpftool: stop using deprecated bpf_load_program()tools/ | +1 | 0 replies | |
| 7/12 | libbpf: remove deprecation attribute from struct bpf_prog_prep_resulttools/ | +0 | 1 reply | |
| 8/12 | selftests/bpf: fix non-strict SEC() program sectionstools/ tools/ tools/ +4 more | +7 | 1 reply | |
| 9/12 | selftests/bpf: convert legacy prog load APIs to bpf_prog_load()tools/ tools/ tools/ +7 more | +99 | 0 replies | |
| 10/12 | selftests/bpf: merge test_stub.c into testing_helpers.ctools/ tools/ tools/ +1 more | +78 | 4 replies | |
| 11/12 | selftests/bpf: use explicit bpf_prog_test_load() calls everywheretools/ tools/ tools/ +34 more | +68 | 3 replies | |
| 12/12 | selftests/bpf: use explicit bpf_test_load_program() helper callstools/ tools/ tools/ +6 more | +12 | 1 reply |
Reviews trailers per patch
7 of 12 patches have a Reviewed-by or Acked-by.
| Patch | Dave Marchevsky |
|---|---|
| 1/12 | A-b |
| 2/12 | A-b |
| 3/12 | |
| 4/12 | |
| 5/12 | |
| 6/12 | |
| 7/12 | A-b |
| 8/12 | A-b |
| 9/12 | |
| 10/12 | A-b |
| 11/12 | A-b |
| 12/12 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 bpf-next 00/12] libbpf: add unified bpf_prog_load() low-level API
This patch set adds unified OPTS-based low-level bpf_prog_load() API for loading BPF programs directly into kernel without utilizing libbpf's bpf_object abstractions. This OPTS-based interface allows for future extensions without breaking backwards or forward API and ABI compatibility. Similar approach will be used for other low-level APIs that require extensive sets of parameters, like BPF_MAP_CREATE command.
First half of the patch set adds libbpf API, cleans up internal usage of to-be-deprecated APIs, etc. Second half cleans up and converts selftests away from using deprecated APIs. See individual patches for more details.
v1->v2:
- dropped exposing sys_bpf() into public API (Alexei, Daniel);
- also dropped bpftool/cgroup.c fix for unistd.h include because it's not necessary due to sys_bpf() staying as is.
Andrii Nakryiko (12):
libbpf: rename DECLARE_LIBBPF_OPTS into LIBBPF_OPTS
libbpf: pass number of prog load attempts explicitly
libbpf: unify low-level BPF_PROG_LOAD APIs into bpf_prog_load()
libbpf: remove internal use of deprecated bpf_prog_load() variants
libbpf: stop using to-be-deprecated APIs
bpftool: stop using deprecated bpf_load_program()
libbpf: remove deprecation attribute from struct bpf_prog_prep_result selftests/bpf: fix non-strict SEC() program sections selftests/bpf: convert legacy prog load APIs to bpf_prog_load() selftests/bpf: merge test_stub.c into testing_helpers.c selftests/bpf: use explicit bpf_prog_test_load() calls everywhere selftests/bpf: use explicit bpf_test_load_program() helper calls
tools/bpf/bpftool/feature.c | 2 +- tools/lib/bpf/bpf.c | 166 +++++++++------- tools/lib/bpf/bpf.h | 74 +++++++- tools/lib/bpf/bpf_gen_internal.h | 8 +- tools/lib/bpf/gen_loader.c | 30 +-- tools/lib/bpf/libbpf.c | 177 +++++++----------- tools/lib/bpf/libbpf.h | 6 +- tools/lib/bpf/libbpf.map | 2 + tools/lib/bpf/libbpf_common.h | 14 +- tools/lib/bpf/libbpf_internal.h | 31 --- tools/lib/bpf/libbpf_legacy.h | 1 + tools/lib/bpf/libbpf_probes.c | 20 +- tools/lib/bpf/xsk.c | 34 ++-- tools/testing/selftests/bpf/Makefile | 38 ++-- .../selftests/bpf/flow_dissector_load.h | 3 +- .../selftests/bpf/get_cgroup_id_user.c | 5 +- .../testing/selftests/bpf/prog_tests/align.c | 11 +- .../selftests/bpf/prog_tests/bpf_obj_id.c | 2 +- .../bpf/prog_tests/cgroup_attach_autodetach.c | 2 +- .../bpf/prog_tests/cgroup_attach_multi.c | 2 +- .../bpf/prog_tests/cgroup_attach_override.c | 2 +- .../selftests/bpf/prog_tests/fexit_bpf2bpf.c | 8 +- .../selftests/bpf/prog_tests/fexit_stress.c | 33 ++-- .../prog_tests/flow_dissector_load_bytes.c | 2 +- .../bpf/prog_tests/flow_dissector_reattach.c | 4 +- .../bpf/prog_tests/get_stack_raw_tp.c | 4 +- .../selftests/bpf/prog_tests/global_data.c | 2 +- .../bpf/prog_tests/global_func_args.c | 2 +- .../selftests/bpf/prog_tests/kfree_skb.c | 2 +- .../selftests/bpf/prog_tests/l4lb_all.c | 2 +- .../bpf/prog_tests/load_bytes_relative.c | 2 +- .../selftests/bpf/prog_tests/map_lock.c | 4 +- .../selftests/bpf/prog_tests/pkt_access.c | 2 +- .../selftests/bpf/prog_tests/pkt_md_access.c | 2 +- .../bpf/prog_tests/queue_stack_map.c | 2 +- .../raw_tp_writable_reject_nbd_invalid.c | 14 +- .../bpf/prog_tests/raw_tp_writable_test_run.c | 29 ++- .../selftests/bpf/prog_tests/signal_pending.c | 2 +- .../selftests/bpf/prog_tests/skb_ctx.c | 2 +- .../selftests/bpf/prog_tests/skb_helpers.c | 2 +- .../selftests/bpf/prog_tests/sockopt.c | 19 +- .../selftests/bpf/prog_tests/spinlock.c | 4 +- .../selftests/bpf/prog_tests/stacktrace_map.c | 2 +- .../bpf/prog_tests/stacktrace_map_raw_tp.c | 2 +- .../selftests/bpf/prog_tests/tailcalls.c | 18 +- .../bpf/prog_tests/task_fd_query_rawtp.c | 2 +- .../bpf/prog_tests/task_fd_query_tp.c | 4 +- .../selftests/bpf/prog_tests/tcp_estats.c | 2 +- .../bpf/prog_tests/tp_attach_query.c | 2 +- tools/testing/selftests/bpf/prog_tests/xdp.c | 2 +- .../bpf/prog_tests/xdp_adjust_tail.c | 6 +- .../selftests/bpf/prog_tests/xdp_attach.c | 6 +- .../selftests/bpf/prog_tests/xdp_info.c | 2 +- .../selftests/bpf/prog_tests/xdp_perf.c | 2 +- .../selftests/bpf/progs/fexit_bpf2bpf.c | 2 +- tools/testing/selftests/bpf/progs/test_l4lb.c | 2 +- .../selftests/bpf/progs/test_l4lb_noinline.c | 2 +- .../selftests/bpf/progs/test_map_lock.c | 2 +- .../bpf/progs/test_queue_stack_map.h | 2 +- .../selftests/bpf/progs/test_skb_ctx.c | 2 +- .../selftests/bpf/progs/test_spin_lock.c | 2 +- .../selftests/bpf/progs/test_tcp_estats.c | 2 +- .../selftests/bpf/test_cgroup_storage.c | 3 +- tools/testing/selftests/bpf/test_dev_cgroup.c | 3 +- .../selftests/bpf/test_lirc_mode2_user.c | 6 +- tools/testing/selftests/bpf/test_lru_map.c | 9 +- tools/testing/selftests/bpf/test_maps.c | 7 +- tools/testing/selftests/bpf/test_sock.c | 23 ++- tools/testing/selftests/bpf/test_sock_addr.c | 13 +- tools/testing/selftests/bpf/test_stub.c | 44 ----- tools/testing/selftests/bpf/test_sysctl.c | 23 +-- tools/testing/selftests/bpf/test_tag.c | 3 +- .../selftests/bpf/test_tcpnotify_user.c | 3 +- tools/testing/selftests/bpf/test_verifier.c | 38 ++-- tools/testing/selftests/bpf/testing_helpers.c | 55 ++++++ tools/testing/selftests/bpf/testing_helpers.h | 6 + tools/testing/selftests/bpf/xdping.c | 3 +- 77 files changed, 565 insertions(+), 513 deletions(-) delete mode 100644 tools/testing/selftests/bpf/test_stub.c
Signature · 1 line
2.30.2