Skip to content

Commit 48b7ab3

Browse files
committed
xdp-trafficgen: Add XSK tests
Add a test that exercises the different XSK options for xdp-trafficgen. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
1 parent 7e126dd commit 48b7ab3

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed

xdp-trafficgen/tests/test-xdp-trafficgen.sh

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
XDP_LOADER=${XDP_LOADER:-./xdp-loader}
22
XDP_TRAFFICGEN=${XDP_TRAFFICGEN:-./xdp-trafficgen}
3-
ALL_TESTS="test_udp test_tcp test_no_support"
3+
ALL_TESTS="test_udp test_tcp test_no_support test_xsk_udp"
44

55
PIDS=""
66

@@ -28,6 +28,61 @@ test_udp()
2828
check_run $XDP_TRAFFICGEN udp $NS -n 1
2929
}
3030

31+
test_xsk_one()
32+
{
33+
action=$1
34+
shift
35+
36+
export XDP_SAMPLE_IMMEDIATE_EXIT=1
37+
check_run ip link add dev btest0 type veth peer name btest1
38+
check_run $XDP_TRAFFICGEN $action btest0 "$@"
39+
ip link del dev btest0
40+
}
41+
42+
test_xsk_udp()
43+
{
44+
local action
45+
local res
46+
local hugepg
47+
48+
action=xsk-udp
49+
50+
test_xsk_one $action
51+
test_xsk_one $action --no-need-wakeup
52+
test_xsk_one $action --shared-umem
53+
test_xsk_one $action -F
54+
test_xsk_one $action -M aa:bb:cc:dd:ee:ff
55+
test_xsk_one $action -P 0x12345678
56+
test_xsk_one $action -Q
57+
test_xsk_one $action -T 1000
58+
test_xsk_one $action -V
59+
test_xsk_one $action -W SCHED_FIFO -U 50
60+
test_xsk_one $action -b 32
61+
test_xsk_one $action -c 1
62+
test_xsk_one $action -c copy
63+
test_xsk_one $action -d 1
64+
test_xsk_one $action -f 2048
65+
test_xsk_one $action -m aa:bb:cc:dd:ee:ff
66+
test_xsk_one $action -p
67+
test_xsk_one $action -q 0
68+
hugepg=$(cat /proc/sys/vm/nr_hugepages)
69+
if [ "$hugepg" -lt "8" ]; then
70+
echo 8 > /proc/sys/vm/nr_hugepages
71+
res=$?
72+
else
73+
res=0
74+
fi
75+
if [ "$res" = "0" ]; then
76+
test_xsk_one $action -u
77+
echo $hugepg > /proc/sys/vm/nr_hugepages
78+
fi
79+
test_xsk_one $action -w BOOTTIME
80+
test_xsk_one $action -w MONOTONIC
81+
test_xsk_one $action -x -a
82+
test_xsk_one $action -y
83+
}
84+
85+
3186
test_tcp()
3287
{
3388
skip_if_missing_kernel_support

0 commit comments

Comments
 (0)