Browse Source

selftests: forwarding: Add tc offload check helper

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Jiri Pirko 7 years ago
parent
commit
2f19f2125d
1 changed files with 13 additions and 0 deletions
  1. 13 0
      tools/testing/selftests/net/forwarding/lib.sh

+ 13 - 0
tools/testing/selftests/net/forwarding/lib.sh

@@ -296,6 +296,19 @@ forwarding_restore()
        sysctl -q -w net.ipv4.conf.all.forwarding=$ipv4_fwd
        sysctl -q -w net.ipv4.conf.all.forwarding=$ipv4_fwd
 }
 }
 
 
+tc_offload_check()
+{
+	for i in $(eval echo {1..$NUM_NETIFS}); do
+		ethtool -k ${NETIFS[p$i]} \
+			| grep "hw-tc-offload: on" &> /dev/null
+		if [[ $? -ne 0 ]]; then
+			return 1
+		fi
+	done
+
+	return 0
+}
+
 ##############################################################################
 ##############################################################################
 # Tests
 # Tests