[PATCH bpf-next 00/14] libbpf: add unified bpf_prog_load() low-level API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Cc: Hengqi Chen <hengqi.chen@xxxxxxxxx>

Andrii Nakryiko (14):
  bpftool: fix unistd.h include
  libbpf: add bpf() syscall wrapper into public API
  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/cgroup.c                    |   2 +-
 tools/bpf/bpftool/feature.c                   |   2 +-
 tools/lib/bpf/bpf.c                           | 242 +++++++++---------
 tools/lib/bpf/bpf.h                           | 104 +++++++-
 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 +-
 78 files changed, 620 insertions(+), 566 deletions(-)
 delete mode 100644 tools/testing/selftests/bpf/test_stub.c

-- 
2.30.2




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux