Commit d361d78f authored by Petr Machata's avatar Petr Machata Committed by David S. Miller
Browse files

selftests: mirror: Drop dual SW/HW testing



The mirroring tests are currently run in a skip_hw and optionally a skip_sw
mode. The former tests the SW datapath, the latter the HW datapath, if
available. In order to be able to test SW datapath on HW loopbacks, traps
are installed on ingress to get traffic from the HW datapath to the SW one.
This adds an unnecessary complexity when it would be much simpler to just
use a veth-based topology to test the SW datapath. Thus drop all the code
that supports this dual testing.

Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
Reviewed-by: default avatarDanielle Ratson <danieller@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a86e0df9
Loading
Loading
Loading
Loading
+6 −27
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ test_span_gre_ttl_inherit()
	RET=0

	ip link set dev $tundev type $type ttl inherit
	mirror_install $swp1 ingress $tundev "matchall $tcflags"
	mirror_install $swp1 ingress $tundev "matchall"
	fail_test_span_gre_dir $tundev

	ip link set dev $tundev type $type ttl 100
@@ -126,7 +126,7 @@ test_span_gre_ttl_inherit()
	quick_test_span_gre_dir $tundev
	mirror_uninstall $swp1 ingress

	log_test "$what: no offload on TTL of inherit ($tcflags)"
	log_test "$what: no offload on TTL of inherit"
}

test_span_gre_tos_fixed()
@@ -138,14 +138,14 @@ test_span_gre_tos_fixed()
	RET=0

	ip link set dev $tundev type $type tos 0x10
	mirror_install $swp1 ingress $tundev "matchall $tcflags"
	mirror_install $swp1 ingress $tundev "matchall"
	fail_test_span_gre_dir $tundev

	ip link set dev $tundev type $type tos inherit
	quick_test_span_gre_dir $tundev
	mirror_uninstall $swp1 ingress

	log_test "$what: no offload on a fixed TOS ($tcflags)"
	log_test "$what: no offload on a fixed TOS"
}

test_span_failable()
@@ -156,7 +156,7 @@ test_span_failable()

	RET=0

	mirror_install $swp1 ingress $tundev "matchall $tcflags"
	mirror_install $swp1 ingress $tundev "matchall"
	if ((should_fail)); then
	    fail_test_span_gre_dir  $tundev
	else
@@ -164,7 +164,7 @@ test_span_failable()
	fi
	mirror_uninstall $swp1 ingress

	log_test "$what: should_fail=$should_fail ($tcflags)"
	log_test "$what: should_fail=$should_fail"
}

test_failable()
@@ -175,17 +175,6 @@ test_failable()
	test_span_failable $should_fail gt6-soft "mirror to gretap w/ soft underlay"
}

test_sw()
{
	slow_path_trap_install $swp1 ingress
	slow_path_trap_install $swp1 egress

	test_failable 0

	slow_path_trap_uninstall $swp1 egress
	slow_path_trap_uninstall $swp1 ingress
}

test_hw()
{
	test_failable 1
@@ -202,16 +191,6 @@ trap cleanup EXIT
setup_prepare
setup_wait

if ! tc_offload_check; then
    check_err 1 "Could not test offloaded functionality"
    log_test "mlxsw-specific tests for mirror to gretap"
    exit
fi

tcflags="skip_hw"
test_sw

tcflags="skip_sw"
test_hw

exit $EXIT_STATUS
+2 −16
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ mirror_gre_tunnels_create()
		cat >> $MIRROR_GRE_BATCH_FILE <<-EOF
			filter add dev $swp1 ingress pref 1000 \
				protocol ipv6 \
				flower $tcflags dst_ip $match_dip \
				flower skip_sw dst_ip $match_dip \
				action mirred egress mirror dev $tun
		EOF
	done
@@ -107,7 +107,7 @@ mirror_gre_tunnels_destroy()
	done
}

__mirror_gre_test()
mirror_gre_test()
{
	local count=$1; shift
	local should_fail=$1; shift
@@ -131,20 +131,6 @@ __mirror_gre_test()
	done
}

mirror_gre_test()
{
	local count=$1; shift
	local should_fail=$1; shift

	if ! tc_offload_check $TC_FLOWER_NUM_NETIFS; then
		check_err 1 "Could not test offloaded functionality"
		return
	fi

	tcflags="skip_sw"
	__mirror_gre_test $count $should_fail
}

mirror_gre_setup_prepare()
{
	h1=${NETIFS[p1]}
+7 −26
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ test_span_gre_mac()

	RET=0

	mirror_install $swp1 $direction $tundev "matchall $tcflags"
	mirror_install $swp1 $direction $tundev "matchall"
	icmp_capture_install h3-${tundev} "src_mac $src_mac dst_mac $dst_mac"

	mirror_test v$h1 192.0.2.1 192.0.2.2 h3-${tundev} 100 10
@@ -82,15 +82,15 @@ test_span_gre_mac()
	icmp_capture_uninstall h3-${tundev}
	mirror_uninstall $swp1 $direction

	log_test "$direction $what: envelope MAC ($tcflags)"
	log_test "$direction $what: envelope MAC"
}

test_two_spans()
{
	RET=0

	mirror_install $swp1 ingress gt4 "matchall $tcflags"
	mirror_install $swp1 egress gt6 "matchall $tcflags"
	mirror_install $swp1 ingress gt4 "matchall"
	mirror_install $swp1 egress gt6 "matchall"
	quick_test_span_gre_dir gt4 8 0
	quick_test_span_gre_dir gt6 0 8

@@ -98,13 +98,13 @@ test_two_spans()
	fail_test_span_gre_dir gt4 8 0
	quick_test_span_gre_dir gt6 0 8

	mirror_install $swp1 ingress gt4 "matchall $tcflags"
	mirror_install $swp1 ingress gt4 "matchall"
	mirror_uninstall $swp1 egress
	quick_test_span_gre_dir gt4 8 0
	fail_test_span_gre_dir gt6 0 8

	mirror_uninstall $swp1 ingress
	log_test "two simultaneously configured mirrors ($tcflags)"
	log_test "two simultaneously configured mirrors"
}

test_gretap()
@@ -131,30 +131,11 @@ test_ip6gretap_mac()
	test_span_gre_mac gt6 egress "mirror to ip6gretap"
}

test_all()
{
	slow_path_trap_install $swp1 ingress
	slow_path_trap_install $swp1 egress

	tests_run

	slow_path_trap_uninstall $swp1 egress
	slow_path_trap_uninstall $swp1 ingress
}

trap cleanup EXIT

setup_prepare
setup_wait

tcflags="skip_hw"
test_all

if ! tc_offload_check; then
	echo "WARN: Could not test offloaded functionality"
else
	tcflags="skip_sw"
	test_all
fi
tests_run

exit $EXIT_STATUS
+1 −22
Original line number Diff line number Diff line
@@ -196,32 +196,11 @@ test_ip6gretap()
	full_test_span_gre_dir gt6 egress  0 8 "mirror to ip6gretap w/ UL"
}

test_all()
{
	RET=0

	slow_path_trap_install $swp1 ingress
	slow_path_trap_install $swp1 egress

	tests_run

	slow_path_trap_uninstall $swp1 egress
	slow_path_trap_uninstall $swp1 ingress
}

trap cleanup EXIT

setup_prepare
setup_wait

tcflags="skip_hw"
test_all

if ! tc_offload_check; then
	echo "WARN: Could not test offloaded functionality"
else
	tcflags="skip_sw"
	test_all
fi
tests_run

exit $EXIT_STATUS
+1 −20
Original line number Diff line number Diff line
@@ -108,30 +108,11 @@ test_ip6gretap()
	full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap"
}

test_all()
{
	slow_path_trap_install $swp1 ingress
	slow_path_trap_install $swp1 egress

	tests_run

	slow_path_trap_uninstall $swp1 egress
	slow_path_trap_uninstall $swp1 ingress
}

trap cleanup EXIT

setup_prepare
setup_wait

tcflags="skip_hw"
test_all

if ! tc_offload_check; then
	echo "WARN: Could not test offloaded functionality"
else
	tcflags="skip_sw"
	test_all
fi
tests_run

exit $EXIT_STATUS
Loading