summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@nvidia.com>2021-03-29 13:09:48 +0300
committerDavid S. Miller <davem@davemloft.net>2021-03-29 13:37:26 -0700
commit7ede22e6583290c832306e23414cc2c1e336c4b7 (patch)
tree0461107d4a1d322cc3d96f26262e81f1dda8b341 /tools
parent17b96a5cbe3d0c743c49776e90d892844c226a56 (diff)
downloadlinux-stable-7ede22e6583290c832306e23414cc2c1e336c4b7.tar.gz
linux-stable-7ede22e6583290c832306e23414cc2c1e336c4b7.tar.bz2
linux-stable-7ede22e6583290c832306e23414cc2c1e336c4b7.zip
selftests: mlxsw: Test vetoing of double sampling
Test that two sampling rules cannot be configured on the same port with the same trigger. Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/selftests/drivers/net/mlxsw/tc_sample.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/testing/selftests/drivers/net/mlxsw/tc_sample.sh b/tools/testing/selftests/drivers/net/mlxsw/tc_sample.sh
index 57b05f042787..093bed088ad0 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/tc_sample.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/tc_sample.sh
@@ -34,6 +34,7 @@ lib_dir=$(dirname $0)/../../../net/forwarding
ALL_TESTS="
tc_sample_rate_test
tc_sample_max_rate_test
+ tc_sample_conflict_test
tc_sample_group_conflict_test
tc_sample_md_iif_test
tc_sample_md_lag_iif_test
@@ -272,6 +273,35 @@ tc_sample_max_rate_test()
log_test "tc sample maximum rate"
}
+tc_sample_conflict_test()
+{
+ RET=0
+
+ # Test that two sampling rules cannot be configured on the same port,
+ # even when they share the same parameters.
+
+ tc filter add dev $rp1 ingress protocol all pref 1 handle 101 matchall \
+ skip_sw action sample rate 1024 group 1
+ check_err $? "Failed to configure sampling rule"
+
+ tc filter add dev $rp1 ingress protocol all pref 2 handle 102 matchall \
+ skip_sw action sample rate 1024 group 1 &> /dev/null
+ check_fail $? "Managed to configure second sampling rule"
+
+ # Delete the first rule and make sure the second rule can now be
+ # configured.
+
+ tc filter del dev $rp1 ingress protocol all pref 1 handle 101 matchall
+
+ tc filter add dev $rp1 ingress protocol all pref 2 handle 102 matchall \
+ skip_sw action sample rate 1024 group 1
+ check_err $? "Failed to configure sampling rule after deletion"
+
+ log_test "tc sample conflict test"
+
+ tc filter del dev $rp1 ingress protocol all pref 2 handle 102 matchall
+}
+
tc_sample_group_conflict_test()
{
RET=0