Skip to content

Commit

Permalink
selftests: mlxsw: tc_restrictions: add test to check sample action re…
Browse files Browse the repository at this point in the history
…strictions

Check that matchall rules with sample actions are not possible to be
inserted to egress.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
jpirko authored and kuba-moo committed May 9, 2020
1 parent b886dea commit 240fe73
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tools/testing/selftests/drivers/net/mlxsw/tc_restrictions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ALL_TESTS="
shared_block_drop_test
egress_redirect_test
multi_mirror_test
matchall_sample_egress_test
"
NUM_NETIFS=2

Expand Down Expand Up @@ -155,6 +156,30 @@ multi_mirror_test()
log_test "multi mirror"
}

matchall_sample_egress_test()
{
RET=0

# It is forbidden in mlxsw driver to have matchall with sample action
# bound on egress

tc qdisc add dev $swp1 clsact

tc filter add dev $swp1 ingress protocol all pref 1 handle 101 \
matchall skip_sw action sample rate 100 group 1
check_err $? "Failed to add rule with sample action on ingress"

tc filter del dev $swp1 ingress protocol all pref 1 handle 101 matchall

tc filter add dev $swp1 egress protocol all pref 1 handle 101 \
matchall skip_sw action sample rate 100 group 1
check_fail $? "Incorrect success to add rule with sample action on egress"

tc qdisc del dev $swp1 clsact

log_test "matchall sample egress"
}

setup_prepare()
{
swp1=${NETIFS[p1]}
Expand Down

0 comments on commit 240fe73

Please sign in to comment.