|
1 | 1 | XDP_LOADER=${XDP_LOADER:-./xdp-loader} |
2 | 2 | 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" |
4 | 4 |
|
5 | 5 | PIDS="" |
6 | 6 |
|
@@ -28,6 +28,61 @@ test_udp() |
28 | 28 | check_run $XDP_TRAFFICGEN udp $NS -n 1 |
29 | 29 | } |
30 | 30 |
|
| 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 | + |
31 | 86 | test_tcp() |
32 | 87 | { |
33 | 88 | skip_if_missing_kernel_support |
|
0 commit comments