Skip to content

Commit

Permalink
Merge branch 'selftests-net-deflake-gro-tests-and-fix-return-value-an…
Browse files Browse the repository at this point in the history
…d-output'

Kevin Krakauer says:

====================
selftests/net: deflake GRO tests and fix return value and output

The GRO selftests can flake and have some confusing behavior. These
changes make the output and return value of GRO behave as expected, then
deflake the tests.

v1: https://lore.kernel.org/20250218164555.1955400-1-krakauer@google.com
====================

Link: https://patch.msgid.link/20250226192725.621969-1-krakauer@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Feb 28, 2025
2 parents 52478f6 + 51bef03 commit 544a882
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 5 additions & 3 deletions tools/testing/selftests/net/gro.c
Original file line number Diff line number Diff line change
Expand Up @@ -1318,11 +1318,13 @@ int main(int argc, char **argv)
read_MAC(src_mac, smac);
read_MAC(dst_mac, dmac);

if (tx_socket)
if (tx_socket) {
gro_sender();
else
} else {
/* Only the receiver exit status determines test success. */
gro_receiver();
fprintf(stderr, "Gro::%s test passed.\n", testname);
}

fprintf(stderr, "Gro::%s test passed.\n", testname);
return 0;
}
7 changes: 4 additions & 3 deletions tools/testing/selftests/net/gro.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ run_test() {
"--smac" "${CLIENT_MAC}" "--test" "${test}" "--verbose" )

setup_ns
# Each test is run 3 times to deflake, because given the receive timing,
# Each test is run 6 times to deflake, because given the receive timing,
# not all packets that should coalesce will be considered in the same flow
# on every try.
for tries in {1..3}; do
for tries in {1..6}; do
# Actual test starts here
ip netns exec $server_ns ./gro "${ARGS[@]}" "--rx" "--iface" "server" \
1>>log.txt &
Expand Down Expand Up @@ -100,5 +100,6 @@ trap cleanup EXIT
if [[ "${test}" == "all" ]]; then
run_all_tests
else
run_test "${proto}" "${test}"
exit_code=$(run_test "${proto}" "${test}")
exit $exit_code
fi;
3 changes: 2 additions & 1 deletion tools/testing/selftests/net/setup_veth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ setup_veth_ns() {
local -r ns_mac="$4"

[[ -e /var/run/netns/"${ns_name}" ]] || ip netns add "${ns_name}"
echo 1000000 > "/sys/class/net/${ns_dev}/gro_flush_timeout"
echo 100000 > "/sys/class/net/${ns_dev}/gro_flush_timeout"
echo 1 > "/sys/class/net/${ns_dev}/napi_defer_hard_irqs"
ip link set dev "${ns_dev}" netns "${ns_name}" mtu 65535
ip -netns "${ns_name}" link set dev "${ns_dev}" up

Expand Down

0 comments on commit 544a882

Please sign in to comment.