libbpf: Add support for dynamic program attach target
Status from this message: Applied, Thanks
Get series with b4
b4 am 158220517358.127661.1514720920408191215.stgit@xdp-tutorialVersions newest first · linked by author and title
- v5 Latest3 patches 2 repliesApplied
- v43 patches 7 repliesSuperseded
- v31 patch 2 repliesSuperseded
Earlier versions · 2
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v2 | 1 patch | 7 replies | Superseded | |
| v1 | 1 patch | 10 replies | Superseded |
Patches in v5 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | libbpf: Bump libpf current version to v0.0.8tools/ | +3 | 0 replies | |
| 2/3 | libbpf: Add support for dynamic program attach targettools/ tools/ tools/ | +36 | 0 replies | |
| 3/3 | selftests/bpf: update xdp_bpf2bpf test to use new set_attach_target APItools/ tools/ | +15 | 1 reply |
Reviews trailers per patch
All 3 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Toke Høiland-Jørgensen | Andrii Nakryiko |
|---|---|---|
| Series | A-b | |
| 1/3 | A-b | |
| 2/3 | A-b | A-b |
| 3/3 | A-b | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH bpf-next v5 0/3] libbpf: Add support for dynamic program attach target
Currently when you want to attach a trace program to a bpf program the section name needs to match the tracepoint/function semantics.
However the addition of the bpf_program__set_attach_target() API allows you to specify the tracepoint/function dynamically.
The call flow would look something like this:
xdp_fd = bpf_prog_get_fd_by_id(id);
trace_obj = bpf_object__open_file("func.o", NULL);
prog = bpf_object__find_program_by_title(trace_obj,
"fentry/myfunc");
bpf_program__set_expected_attach_type(prog, BPF_TRACE_FENTRY);
bpf_program__set_attach_target(prog, xdp_fd,
"xdpfilt_blk_all");
bpf_object__load(trace_obj)v1 -> v2: Remove requirement for attach type hint in API
v2 -> v3: Moved common warning to __find_vmlinux_btf_id, requested by Andrii
Updated the xdp_bpf2bpf test to use this new API
v3 -> v4: Split up patch, update libbpf.map version
v4 -> v5: Fix return code, and prog assignment in test case