diff options
author | Niklas Söderlund <niklas.soderlund@corigine.com> | 2021-08-06 14:28:54 +0200 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2021-08-06 16:53:27 -0700 |
commit | 29f24c43cbe09b83162776a370848d5a782dc3b7 (patch) | |
tree | ef9000e8598e56428ed9bb2aff253b13a37fa4a2 /samples/bpf/xdp_redirect_map_multi_user.c | |
parent | 579345e7f2190c1ee97f44154526dcd458ea790d (diff) |
samples/bpf: xdpsock: Make the sample more useful outside the tree
The xdpsock sample application is a useful base for experiment's around
AF_XDP sockets. Compiling the sample outside of the kernel tree is made
harder then it has to be as the sample includes two headers and that are
not installed by 'make install_header' nor are usually part of
distributions kernel headers.
The first header asm/barrier.h is not used and can just be dropped.
The second linux/compiler.h are only needed for the decorator __force
and are only used in ip_fast_csum(), csum_fold() and
csum_tcpudp_nofold(). These functions are copied verbatim from
include/asm-generic/checksum.h and lib/checksum.c. While it's fine to
copy and use these functions in the sample application the decorator
brings no value and can be dropped together with the include.
With this change it's trivial to compile the xdpsock sample outside the
kernel tree from xdpsock_user.c and xdpsock.h.
$ gcc -o xdpsock xdpsock_user.c -lbpf -lpthread
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Louis Peens <louis.peens@corigine.com>
Link: https://lore.kernel.org/bpf/20210806122855.26115-2-simon.horman@corigine.com
Diffstat (limited to 'samples/bpf/xdp_redirect_map_multi_user.c')
0 files changed, 0 insertions, 0 deletions