Re: [PATCH bpf-next v2 1/3] samples: bpf: Refactor xdp_monitor with libbpf
Andrii Nakryiko <[email protected]>
| Newsgroups | org.kernel.vger.xdp-newbies,org.kernel.vger.bpf,org.kernel.vger.netdev |
|---|---|
| Message-ID | <CAEf4BzZw3Se=qa=hjrtLtL4AEq7UQcmS-ZdKqo=qAHO1Kn=SGA@mail.gmail.com> |
On Sat, Oct 10, 2020 at 11:17 AM Daniel T. Lee <[email protected]> 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 <[email protected]> > > --- Acked-by: Andrii Nakryiko <[email protected]> > 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(-) > [...]