]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests: mirror_gre_lag_lacp: Check counters at tunnel
authorPetr Machata <petrm@nvidia.com>
Thu, 27 Jun 2024 14:48:41 +0000 (16:48 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 28 Jun 2024 09:55:36 +0000 (10:55 +0100)
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: Petr Machata <petrm@nvidia.com>
Reviewed-by: Danielle Ratson <danieller@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/forwarding/mirror_gre_lag_lacp.sh

index 9edf4cb104a8794a06ff2f1bbd723bba750efc18..f521648682bf2f1860dcc0b9e52aab9ecdd75217 100755 (executable)
 # |    \                                              /                       |
 # |     \____________________________________________/                        |
 # |                           |                                               |
-# |                           + 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