selftests: forwarding: Add tc offload check helper
authorJiri Pirko <jiri@mellanox.com>
Wed, 28 Feb 2018 10:25:13 +0000 (12:25 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Feb 2018 17:25:48 +0000 (12:25 -0500)
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>
tools/testing/selftests/net/forwarding/lib.sh

index 6866f4a..92e4642 100644 (file)
@@ -296,6 +296,19 @@ forwarding_restore()
        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