summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs
diff options
context:
space:
mode:
authorEelco Chaudron <echaudro@redhat.com>2020-02-20 13:26:35 +0000
committerAlexei Starovoitov <ast@kernel.org>2020-02-20 17:48:40 -0800
commitff26ce5cd7680ebc9c5446cda013e2087decc60f (patch)
tree13503f7c233736c8f10bd27795597cb48012dd71 /tools/testing/selftests/bpf/progs
parentdd88aed92d017bed2a2c0023f22f0eef7cd29702 (diff)
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) Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andriin@fb.com> Acked-by: Toke Høiland-Jørgensen <toke@redhat.com> Link: https://lore.kernel.org/bpf/158220519486.127661.7964708960649051384.stgit@xdp-tutorial
Diffstat (limited to 'tools/testing/selftests/bpf/progs')
0 files changed, 0 insertions, 0 deletions