aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/xdpxceiver.c
diff options
context:
space:
mode:
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>2022-06-29 16:34:56 +0200
committerDaniel Borkmann <daniel@iogearbox.net>2022-06-30 22:49:05 +0200
commit61333008d01e18716a7050fdc9479cc8d6e63883 (patch)
treeac2d11308bd6081b87e9b7032ece2f5341638242 /tools/testing/selftests/bpf/xdpxceiver.c
parentselftests/xsk: Avoid bpf_link probe for existing xsk (diff)
downloadlinux-dev-61333008d01e18716a7050fdc9479cc8d6e63883.tar.xz
linux-dev-61333008d01e18716a7050fdc9479cc8d6e63883.zip
selftests/xsk: Introduce XDP prog load based on existing AF_XDP socket
Currently, xsk_setup_xdp_prog() uses anonymous xsk_socket struct which means that during xsk_create_bpf_link() call, xsk->config.xdp_flags is always 0. This in turn means that from xdpxceiver it is impossible to use xdpgeneric attachment, so since commit 3b22523bca02 ("selftests, xsk: Fix bpf_res cleanup test") we were not testing SKB mode at all. To fix this, introduce a function, called xsk_setup_xdp_prog_xsk(), that will load XDP prog based on the existing xsk_socket, so that xsk context's refcount is correctly bumped and flags from application side are respected. Use this from xdpxceiver side so we get coverage of generic and native XDP program attach points. Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Magnus Karlsson <magnus.karlsson@intel.com> Link: https://lore.kernel.org/bpf/20220629143458.934337-3-maciej.fijalkowski@intel.com
Diffstat (limited to 'tools/testing/selftests/bpf/xdpxceiver.c')
-rw-r--r--tools/testing/selftests/bpf/xdpxceiver.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
index 019c567b6b4e..c024aa91ea02 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.c
+++ b/tools/testing/selftests/bpf/xdpxceiver.c
@@ -1130,7 +1130,7 @@ static void thread_common_ops(struct test_spec *test, struct ifobject *ifobject)
if (!ifindex)
exit_with_error(errno);
- ret = xsk_setup_xdp_prog(ifindex, &ifobject->xsk_map_fd);
+ ret = xsk_setup_xdp_prog_xsk(ifobject->xsk->xsk, &ifobject->xsk_map_fd);
if (ret)
exit_with_error(-ret);