]> git.baikalelectronics.ru Git - kernel.git/commit
samples: bpf: Refactor xdp_monitor with libbpf
authorDaniel T. Lee <danieltimlee@gmail.com>
Sat, 10 Oct 2020 18:17:32 +0000 (03:17 +0900)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 11 Oct 2020 19:14:36 +0000 (12:14 -0700)
commit1a7b8d7670fa9ea2e373b630b9b2cca996330c57
tree6676ff15f8f28c6da1fb2ee1c13b6e3c891addd6
parent44c4a1f166f7222ffb7f5adec93a9d3f1e81d0b7
samples: bpf: Refactor xdp_monitor with libbpf

To avoid confusion caused by the increasing fragmentation of the BPF
Loader program, this commit would like to change to the libbpf loader
instead of using the bpf_load.

Thanks to libbpf's bpf_link interface, managing the tracepoint BPF
program is much easier. bpf_program__attach_tracepoint manages the
enable of tracepoint event and attach of BPF programs to it with a
single interface bpf_link, so there is no need to manage event_fd and
prog_fd separately.

This commit refactors xdp_monitor with using this libbpf API, and the
bpf_load is removed and migrated to libbpf.

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-2-danieltimlee@gmail.com
samples/bpf/Makefile
samples/bpf/xdp_monitor_user.c