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

selftests: mirror_gre_lag_lacp: Check counters at tunnel



The test works by sending packets through a tunnel, whence they are
forwarded to a LAG. One of the LAG children is removed from the LAG prior
to the exercise, and the test then counts how many packets pass through the
other one. The issue with this is that it counts all packets, not just the
encapsulated ones.

So instead add a second gretap endpoint to receive the sent packets, and
check reception counters there.

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 9b5d5f27
Loading
Loading
Loading
Loading
+22 −15
Original line number Diff line number Diff line
@@ -37,8 +37,14 @@
# |    \                                              /                       |
# |     \____________________________________________/                        |
# |                           |                                               |
# |                           + lag2 (team)                                   |
# |                             192.0.2.130/28                                |
# |                           + lag2 (team)  ------>   + gt4-dst (gretap)     |
# |                             192.0.2.130/28           loc=192.0.2.130      |
# |                                                      rem=192.0.2.129      |
# |                                                      ttl=100              |
# |                                                      tos=inherit          |
# |                                                                           |
# |                                                                           |
# |                                                                           |
# |                                                                           |
# +---------------------------------------------------------------------------+

@@ -122,16 +128,21 @@ h3_create()
{
	vrf_create vrf-h3
	ip link set dev vrf-h3 up
	tc qdisc add dev $h3 clsact
	tc qdisc add dev $h4 clsact
	h3_create_team

	tunnel_create gt4-dst gretap 192.0.2.130 192.0.2.129 \
		      ttl 100 tos inherit
	ip link set dev gt4-dst master vrf-h3
	tc qdisc add dev gt4-dst clsact
}

h3_destroy()
{
	tc qdisc del dev gt4-dst clsact
	ip link set dev gt4-dst nomaster
	tunnel_destroy gt4-dst

	h3_destroy_team
	tc qdisc del dev $h4 clsact
	tc qdisc del dev $h3 clsact
	ip link set dev vrf-h3 down
	vrf_destroy vrf-h3
}
@@ -188,18 +199,12 @@ setup_prepare()
	h2_create
	h3_create
	switch_create

	trap_install $h3 ingress
	trap_install $h4 ingress
}

cleanup()
{
	pre_cleanup

	trap_uninstall $h4 ingress
	trap_uninstall $h3 ingress

	switch_destroy
	h3_destroy
	h2_destroy
@@ -219,6 +224,7 @@ test_lag_slave()

	mirror_install $swp1 ingress gt4 \
		       "proto 802.1q flower vlan_id 333 $tcflags"
	vlan_capture_install gt4-dst "vlan_ethtype ipv4 ip_proto icmp type 8"

	# Move $down_dev away from the team. That will prompt change in
	# txability of the connected device, without changing its upness. The
@@ -226,13 +232,14 @@ test_lag_slave()
	# other slave.
	ip link set dev $down_dev nomaster
	sleep 2
	mirror_test vrf-h1 192.0.2.1 192.0.2.18 $up_dev 1 10
	mirror_test vrf-h1 192.0.2.1 192.0.2.18 gt4-dst 100 10

	# Test lack of connectivity when neither slave is txable.
	ip link set dev $up_dev nomaster
	sleep 2
	mirror_test vrf-h1 192.0.2.1 192.0.2.18 $h3 1 0
	mirror_test vrf-h1 192.0.2.1 192.0.2.18 $h4 1 0
	mirror_test vrf-h1 192.0.2.1 192.0.2.18 gt4-dst 100 0

	vlan_capture_uninstall gt4-dst
	mirror_uninstall $swp1 ingress

	# Recreate H3's team device, because mlxsw, which this test is