Commit 1e557246 authored by David S. Miller's avatar David S. Miller
Browse files

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 d7db7775 ("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: default avatarDavid S. Miller <davem@davemloft.net>
parents 2d742304 d7818402
Loading
Loading
Loading
Loading
+28 −25
Original line number Diff line number Diff line
@@ -7,8 +7,6 @@ source net_helper.sh

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

BPF_FILE="xdp_dummy.bpf.o"

# set global exit status, but never reset nonzero one.
check_err()
{
@@ -38,7 +36,7 @@ cfg_veth() {
	ip -netns "${PEER_NS}" addr add dev veth1 192.168.1.1/24
	ip -netns "${PEER_NS}" addr add dev veth1 2001:db8::1/64 nodad
	ip -netns "${PEER_NS}" link set dev veth1 up
	ip -n "${PEER_NS}" link set veth1 xdp object ${BPF_FILE} section xdp
	ip netns exec "${PEER_NS}" ethtool -K veth1 gro on
}

run_one() {
@@ -46,17 +44,19 @@ run_one() {
	local -r all="$@"
	local -r tx_args=${all%rx*}
	local -r rx_args=${all#*rx}
	local ret=0

	cfg_veth

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

	wait_local_port_listen ${PEER_NS} 8000 udp
	./udpgso_bench_tx ${tx_args}
	ret=$?
	wait $(jobs -p)
	check_err $?
	wait ${PID1}
	check_err $?
	[ "$ret" -eq 0 ] && echo "ok" || echo "failed"
	return $ret
}

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

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

	wait_local_port_listen "${PEER_NS}" 8000 udp
	./udpgso_bench_tx ${tx_args}
	ret=$?
	kill -INT $pid
	wait $(jobs -p)
	check_err $?
	kill -INT ${PID1}
	wait ${PID2}
	check_err $?
	[ "$ret" -eq 0 ] && echo "ok" || echo "failed"
	return $ret
}

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

	cfg_veth

	ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} -p 12345 &
	ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 2000 -R 10 ${rx_args} && \
		echo "ok" || \
		echo "failed" &
	local PID1=$!
	ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 2000 -R 10 ${rx_args} &
	local PID2=$!

	wait_local_port_listen "${PEER_NS}" 12345 udp
	./udpgso_bench_tx ${tx_args} -p 12345
	check_err $?
	wait_local_port_listen "${PEER_NS}" 8000 udp
	./udpgso_bench_tx ${tx_args}
	ret=$?
	wait $(jobs -p)
	check_err $?
	wait ${PID1}
	check_err $?
	wait ${PID2}
	check_err $?
	[ "$ret" -eq 0 ] && echo "ok" || echo "failed"
	return $ret
}

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

if [ ! -f ${BPF_FILE} ]; then
	echo "Missing ${BPF_FILE}. Run 'make' first"
	exit -1
fi

if [[ $# -eq 0 ]]; then
	run_all
elif [[ $1 == "__subprocess" ]]; then