On Sat, Oct 10, 2020 at 11:17 AM Daniel T. Lee <danieltimlee@xxxxxxxxx> wrote: > > 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@xxxxxxxxx> > > --- Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > Changes in v2: > - added cleanup logic for bpf_link and bpf_object > - split increment into seperate satement > - refactor pointer array initialization > > samples/bpf/Makefile | 2 +- > samples/bpf/xdp_monitor_user.c | 159 +++++++++++++++++++++++++-------- > 2 files changed, 121 insertions(+), 40 deletions(-) > [...]