Skip to content

Commit 67a0bb1

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 0f9e76d commit 67a0bb1

File tree

5 files changed

+430
-2
lines changed

5 files changed

+430
-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: 11 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,16 @@ test_xdp_frags()
8181
ip link delete xdp_veth_small0
8282
}
8383

84+
test_xdp_devbound()
85+
{
86+
skip_if_missing_libxdp_compat
87+
88+
check_mount_bpffs || return 1
89+
ip link add xdp_veth0 type veth peer name xdp_veth1
90+
check_run $TESTS_DIR/test_xdp_devbound xdp_veth1 2>&1
91+
ip link delete xdp_veth0
92+
}
93+
8494
test_old_dispatcher()
8595
{
8696
skip_if_missing_libxdp_compat

lib/libxdp/tests/test_xdp_devbound

-1.55 MB
Binary file not shown.

0 commit comments

Comments
 (0)