Commit ab2b8ab2 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller
Browse files

selftests: add a mirror test to mlxsw tc flower restrictions



Include test of forbidding to have multiple mirror actions.

Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c84e903f
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ lib_dir=$(dirname $0)/../../../net/forwarding
ALL_TESTS="
	shared_block_drop_test
	egress_redirect_test
	multi_mirror_test
"
NUM_NETIFS=2

@@ -127,6 +128,33 @@ egress_redirect_test()
	log_test "shared block drop"
}

multi_mirror_test()
{
	RET=0

	# It is forbidden in mlxsw driver to have multiple mirror
	# actions in a single rule.

	tc qdisc add dev $swp1 clsact

	tc filter add dev $swp1 ingress protocol ip pref 1 handle 101 flower \
		skip_sw dst_ip 192.0.2.2 \
		action mirred egress mirror dev $swp2
	check_err $? "Failed to add rule with single mirror action"

	tc filter del dev $swp1 ingress protocol ip pref 1 handle 101 flower

	tc filter add dev $swp1 ingress protocol ip pref 1 handle 101 flower \
		skip_sw dst_ip 192.0.2.2 \
		action mirred egress mirror dev $swp2 \
		action mirred egress mirror dev $swp1
	check_fail $? "Incorrect success to add rule with two mirror actions"

	tc qdisc del dev $swp1 clsact

	log_test "multi mirror"
}

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