]> git.baikalelectronics.ru Git - kernel.git/commit
samples: bpf: Replace attach_tracepoint() to attach() in xdp_redirect_cpu
authorDaniel T. Lee <danieltimlee@gmail.com>
Sat, 10 Oct 2020 18:17:33 +0000 (03:17 +0900)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 11 Oct 2020 19:14:36 +0000 (12:14 -0700)
commit379cb52e2b998d4e482876378e0dd083b988b967
tree18efa2d681bf805b1a564eda4be8bc070fad4321
parent1a7b8d7670fa9ea2e373b630b9b2cca996330c57
samples: bpf: Replace attach_tracepoint() to attach() in xdp_redirect_cpu

>From commit 5d760c4189fe ("libbpf: Add generic bpf_program__attach()"),
for some BPF programs, it is now possible to attach BPF programs
with __attach() instead of explicitly calling __attach_<type>().

This commit refactors the __attach_tracepoint() with libbpf's generic
__attach() method. In addition, this refactors the logic of setting
the map FD to simplify the code. Also, the missing removal of
bpf_load.o in Makefile has been fixed.

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20201010181734.1109-3-danieltimlee@gmail.com
samples/bpf/Makefile
samples/bpf/xdp_redirect_cpu_user.c