Skip to content

Commit 968a9c5

Browse files
committed
libxdp: Add selftest for device binding
Add a selftest program for libxdp device binding, testing the different permutations of loading a program with and without the flag. Signed-off-by: Jalal Mostafa <[email protected]>
1 parent 6311f51 commit 968a9c5

File tree

5 files changed

+420
-2
lines changed

5 files changed

+420
-2
lines changed

lib/libxdp/tests/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ test_dispatcher_versions
55
test_xsk_non_privileged
66
test_link_detach
77
test_xsk_umem_flags
8+
test_xdp_devbound

lib/libxdp/tests/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
22

3-
USER_TARGETS := test_xsk_refcnt check_kern_compat test_xdp_frags test_dispatcher_versions test_link_detach test_xsk_umem_flags
3+
USER_TARGETS := test_xsk_refcnt check_kern_compat test_xdp_devbound test_xdp_frags test_dispatcher_versions test_link_detach test_xsk_umem_flags
44
BPF_TARGETS := xdp_dispatcher_v1 xdp_pass
55
USER_LIBS := -lpthread
66

lib/libxdp/tests/test-libxdp.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
22

3-
ALL_TESTS="test_link_so test_link_a test_old_dispatcher test_xdp_frags test_xsk_prog_refcnt_bpffs test_xsk_prog_refcnt_legacy test_xsk_non_privileged test_link_detach test_xsk_umem_flags"
3+
ALL_TESTS="test_link_so test_link_a test_old_dispatcher test_xdp_devbound test_xdp_frags test_xsk_prog_refcnt_bpffs test_xsk_prog_refcnt_legacy test_xsk_non_privileged test_link_detach test_xsk_umem_flags"
44

55
TESTS_DIR=$(dirname "${BASH_SOURCE[0]}")
66

@@ -81,6 +81,18 @@ test_xdp_frags()
8181
ip link delete xdp_veth_small0
8282
}
8383

84+
test_xdp_devbound()
85+
{
86+
check_mount_bpffs || return 1
87+
skip_if_missing_libxdp_compat
88+
89+
ip link add xdp_veth0 type veth peer name xdp_veth1
90+
ip link add xdp_veth2 type veth peer name xdp_veth3
91+
check_run $TESTS_DIR/test_xdp_devbound xdp_veth1 xdp_veth3 2>&1
92+
ip link delete xdp_veth0
93+
ip link delete xdp_veth2
94+
}
95+
8496
test_old_dispatcher()
8597
{
8698
check_mount_bpffs || return 1

lib/libxdp/tests/test_xdp_devbound

-1.55 MB
Binary file not shown.

0 commit comments

Comments
 (0)