lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191002233655.24323-46-mathew.j.martineau@linux.intel.com>
Date:   Wed,  2 Oct 2019 16:36:55 -0700
From:   Mat Martineau <mathew.j.martineau@...ux.intel.com>
To:     netdev@...r.kernel.org, edumazet@...gle.com
Cc:     Florian Westphal <fw@...len.de>, cpaasch@...le.com,
        pabeni@...hat.com, peter.krystad@...ux.intel.com,
        dcaratti@...hat.com, matthieu.baerts@...sares.net
Subject: [RFC PATCH v2 45/45] selftests: mptcp: random ethtool tweaking

From: Florian Westphal <fw@...len.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 <fw@...len.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ