Skip to content

Commit 1e55724

Browse files
committed
Merge branch 'selftests-udpgro-fixes'
Hangbin Liu says: ==================== selftests: Fix udpgro failures There are 2 issues for the current udpgro test. The first one is the testing doesn't record all the failures, which may report pass but the test actually failed. e.g. https://netdev-3.bots.linux.dev/vmksft-net/results/725661/45-udpgro-sh/stdout The other one is after commit d7db777 ("net: veth: do not manipulate GRO when using XDP"), there is no need to load xdp program to enable GRO on veth device. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 2d74230 + d781840 commit 1e55724

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

tools/testing/selftests/net/udpgro.sh

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ source net_helper.sh
77

88
readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
99

10-
BPF_FILE="xdp_dummy.bpf.o"
11-
1210
# set global exit status, but never reset nonzero one.
1311
check_err()
1412
{
@@ -38,25 +36,27 @@ cfg_veth() {
3836
ip -netns "${PEER_NS}" addr add dev veth1 192.168.1.1/24
3937
ip -netns "${PEER_NS}" addr add dev veth1 2001:db8::1/64 nodad
4038
ip -netns "${PEER_NS}" link set dev veth1 up
41-
ip -n "${PEER_NS}" link set veth1 xdp object ${BPF_FILE} section xdp
39+
ip netns exec "${PEER_NS}" ethtool -K veth1 gro on
4240
}
4341

4442
run_one() {
4543
# use 'rx' as separator between sender args and receiver args
4644
local -r all="$@"
4745
local -r tx_args=${all%rx*}
4846
local -r rx_args=${all#*rx}
47+
local ret=0
4948

5049
cfg_veth
5150

52-
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} && \
53-
echo "ok" || \
54-
echo "failed" &
51+
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} &
52+
local PID1=$!
5553

5654
wait_local_port_listen ${PEER_NS} 8000 udp
5755
./udpgso_bench_tx ${tx_args}
58-
ret=$?
59-
wait $(jobs -p)
56+
check_err $?
57+
wait ${PID1}
58+
check_err $?
59+
[ "$ret" -eq 0 ] && echo "ok" || echo "failed"
6060
return $ret
6161
}
6262

@@ -73,6 +73,7 @@ run_one_nat() {
7373
local -r all="$@"
7474
local -r tx_args=${all%rx*}
7575
local -r rx_args=${all#*rx}
76+
local ret=0
7677

7778
if [[ ${tx_args} = *-4* ]]; then
7879
ipt_cmd=iptables
@@ -93,16 +94,17 @@ run_one_nat() {
9394
# ... so that GRO will match the UDP_GRO enabled socket, but packets
9495
# will land on the 'plain' one
9596
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -G ${family} -b ${addr1} -n 0 &
96-
pid=$!
97-
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${family} -b ${addr2%/*} ${rx_args} && \
98-
echo "ok" || \
99-
echo "failed"&
97+
local PID1=$!
98+
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${family} -b ${addr2%/*} ${rx_args} &
99+
local PID2=$!
100100

101101
wait_local_port_listen "${PEER_NS}" 8000 udp
102102
./udpgso_bench_tx ${tx_args}
103-
ret=$?
104-
kill -INT $pid
105-
wait $(jobs -p)
103+
check_err $?
104+
kill -INT ${PID1}
105+
wait ${PID2}
106+
check_err $?
107+
[ "$ret" -eq 0 ] && echo "ok" || echo "failed"
106108
return $ret
107109
}
108110

@@ -111,20 +113,26 @@ run_one_2sock() {
111113
local -r all="$@"
112114
local -r tx_args=${all%rx*}
113115
local -r rx_args=${all#*rx}
116+
local ret=0
114117

115118
cfg_veth
116119

117120
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} -p 12345 &
118-
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 2000 -R 10 ${rx_args} && \
119-
echo "ok" || \
120-
echo "failed" &
121+
local PID1=$!
122+
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 2000 -R 10 ${rx_args} &
123+
local PID2=$!
121124

122125
wait_local_port_listen "${PEER_NS}" 12345 udp
123126
./udpgso_bench_tx ${tx_args} -p 12345
127+
check_err $?
124128
wait_local_port_listen "${PEER_NS}" 8000 udp
125129
./udpgso_bench_tx ${tx_args}
126-
ret=$?
127-
wait $(jobs -p)
130+
check_err $?
131+
wait ${PID1}
132+
check_err $?
133+
wait ${PID2}
134+
check_err $?
135+
[ "$ret" -eq 0 ] && echo "ok" || echo "failed"
128136
return $ret
129137
}
130138

@@ -196,11 +204,6 @@ run_all() {
196204
return $ret
197205
}
198206

199-
if [ ! -f ${BPF_FILE} ]; then
200-
echo "Missing ${BPF_FILE}. Run 'make' first"
201-
exit -1
202-
fi
203-
204207
if [[ $# -eq 0 ]]; then
205208
run_all
206209
elif [[ $1 == "__subprocess" ]]; then

0 commit comments

Comments
 (0)