From: Florian Westphal <f...@strlen.de>

Instead of unconditionally disabling TSO in ns3, turn off any of
gso/tso/gro in ns3 and/or ns4.

This gets us various combinations of GRO/GSO/TSO without a large
impact on test time.

Signed-off-by: Florian Westphal <f...@strlen.de>
---
 .../selftests/net/mptcp/mptcp_connect.sh      | 29 ++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh 
b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
index 615691434a34..40cce8d1772e 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
@@ -92,7 +92,6 @@ $ipv6 && ip -net ns3 addr add dead:beef:3::2/64 dev ns3eth4
 ip -net ns3 link set ns3eth4 up
 ip -net ns3 route add default via 10.0.2.1
 $ipv6 && ip -net ns3 route add default via dead:beef:2::1
-ip netns exec ns3 ethtool -K ns3eth2 tso off 2>/dev/null
 ip netns exec ns3 sysctl -q net.ipv4.ip_forward=1
 $ipv6 && ip netns exec ns3 sysctl -q net.ipv6.conf.all.forwarding=1
 
@@ -102,6 +101,34 @@ ip -net ns4 link set ns4eth3 up
 ip -net ns4 route add default via 10.0.3.2
 $ipv6 && ip -net ns4 route add default via dead:beef:3::2
 
+set_ethtool_flags() {
+       ns=$1
+       dev=$2
+
+       r=$RANDOM
+
+       pick1=$((r & 1))
+       r=$((r>>1))
+       pick2=$((r & 1))
+       r=$((r>>1))
+       pick3=$((r & 1))
+
+       comma=""
+       flags=""
+       [ $pick1 -ne 0 ] && flags="tso"
+       [ $pick1 -ne 0 ] && comma=","
+       [ $pick2 -ne 0 ] && flags=${flags}${comma}"gso"
+       [ $pick3 -ne 0 ] && flags=${flags}${comma}"gro"
+
+       [ -z $flags ] && return
+
+       ip netns exec $ns ethtool -K $dev $flags off 2>/dev/null
+       [ $? -eq 0 ] && echo "INFO: set $ns dev $dev: ethtool -K $flags off"
+}
+
+set_ethtool_flags ns3 ns3eth2
+set_ethtool_flags ns4 ns4eth3
+
 print_file_err()
 {
        ls -l "$1" 1>&2
-- 
2.23.0

Reply via email to