[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201009160353.1529-1-danieltimlee@gmail.com>
Date: Sat, 10 Oct 2020 01:03:50 +0900
From: "Daniel T. Lee" <danieltimlee@...il.com>
To: Daniel Borkmann <daniel@...earbox.net>,
Alexei Starovoitov <ast@...nel.org>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Andrii Nakryiko <andrii.nakryiko@...il.com>,
Lorenzo Bianconi <lorenzo@...nel.org>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org,
Xdp <xdp-newbies@...r.kernel.org>
Subject: [PATCH bpf-next 0/3] samples: bpf: Refactor XDP programs with libbpf
To avoid confusion caused by the increasing fragmentation of the BPF
Loader program, this commit would like to convert the previous bpf_load
loader with the libbpf loader.
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.
And due to addition of generic bpf_program__attach() to libbpf, it is
now possible to attach BPF programs with __attach() instead of
explicitly calling __attach_<type>().
This patchset refactors xdp_monitor with using this libbpf API, and the
bpf_load is removed and migrated to libbpf. Also, attach_tracepoint()
is replaced with the generic __attach() method in xdp_redirect_cpu.
Moreover, maps in kern program have been converted to BTF-defined map.
Daniel T. Lee (3):
samples: bpf: Refactor xdp_monitor with libbpf
samples: bpf: Replace attach_tracepoint() to attach() in
xdp_redirect_cpu
samples: bpf: refactor XDP kern program maps with BTF-defined map
samples/bpf/Makefile | 4 +-
samples/bpf/xdp_monitor_kern.c | 60 ++++++------
samples/bpf/xdp_monitor_user.c | 144 +++++++++++++++++++++-------
samples/bpf/xdp_redirect_cpu_user.c | 138 +++++++++++++-------------
samples/bpf/xdp_sample_pkts_kern.c | 14 ++-
samples/bpf/xdp_sample_pkts_user.c | 1 -
6 files changed, 211 insertions(+), 150 deletions(-)
--
2.25.1
Powered by blists - more mailing lists