selftest: Clean-up and stabilize mirroring tests
Subsystems (5)
Petr Machata
maintainercover selftest: Clean-up and stabilize mirroring tests
The mirroring selftests work by sending ICMP traffic between two hosts. Along the way, this traffic is mirrored to a gretap netdevice, and counter taps are then installed strategically along the path of the mirrored traffic to verify the mirroring took place.
The problem with this is that besides mirroring the primary traffic, any other service traffic is mirrored as well. At the same time, because the tests need to work in HW-offloaded scenarios, the ability of the device to do arbitrary packet inspection should not be taken for granted. Most tests therefore simply use matchall, one uses flower to match on IP address. As a result, the selftests are noisy.
mirror_test() accommodated this noisiness by giving the counters an allowance of several packets. But that only works up to a point, and on busy systems won't be always enough.
In this patch set, clean up and stabilize the mirroring selftests. The original intention was to port the tests over to UDP, but the logic of ICMP ends up being so entangled in the mirroring selftests that the changes feel overly invasive. Instead, ICMP is kept, but where possible, we match on ICMP message type, thus filtering out hits by other ICMP messages.
Where this is not practical (where the counter tap is put on a device that carries encapsulated packets), switch the counter condition to _at least_ X observed packets. This is less robust, but barely so -- probably the only scenario that this would not catch is something like erroneous packet duplication, which would hopefully get caught by the numerous other tests in this extensive suite.
- Patches #1 to #3 clean up parameters at various helpers.
- Patches #4 to #6 stabilize the mirroring selftests as described above.
- Mirroring tests currently allow testing SW datapath even on HW netdevices by trapping traffic to the SW datapath. This complicates the tests a bit without a good reason: to test SW datapath, just run the selftests on the veth topology. Thus in patch #7, drop support for this dual SW/HW testing.
- At this point, some cleanups were either made possible by the previous patches, or were always possible. In patches #8 to #11, realize these cleanups.
- In patch #12, fix mlxsw mirror_gre selftest to respect setting TESTS.
Petr Machata (12):
selftests: libs: Expand "$@" where possible
selftests: mirror: Drop direction argument from several functions
selftests: lib: tc_rule_stats_get(): Move default to argument
definition
selftests: mirror_gre_lag_lacp: Check counters at tunnel
selftests: mirror: do_test_span_dir_ips(): Install accurate taps
selftests: mirror: mirror_test(): Allow exact count of packets
selftests: mirror: Drop dual SW/HW testing
selftests: mlxsw: mirror_gre: Simplify
selftests: mirror_gre_lag_lacp: Drop unnecessary code
selftests: libs: Drop slow_path_trap_install()/_uninstall()
selftests: libs: Drop unused functions
selftests: mlxsw: mirror_gre: Obey TESTS
.../selftests/drivers/net/mlxsw/mirror_gre.sh | 71 ++++++--------- .../drivers/net/mlxsw/mirror_gre_scale.sh | 18 +--- tools/testing/selftests/net/forwarding/lib.sh | 83 +++++++++++------ .../selftests/net/forwarding/mirror_gre.sh | 45 +++------- .../net/forwarding/mirror_gre_bound.sh | 23 +---- .../net/forwarding/mirror_gre_bridge_1d.sh | 21 +---- .../forwarding/mirror_gre_bridge_1d_vlan.sh | 21 +---- .../net/forwarding/mirror_gre_bridge_1q.sh | 21 +---- .../forwarding/mirror_gre_bridge_1q_lag.sh | 29 ++---- .../net/forwarding/mirror_gre_changes.sh | 73 ++++++--------- .../net/forwarding/mirror_gre_flower.sh | 43 ++++----- .../net/forwarding/mirror_gre_lag_lacp.sh | 65 ++++++-------- .../net/forwarding/mirror_gre_lib.sh | 90 ++++++++++++++----- .../net/forwarding/mirror_gre_neigh.sh | 39 +++----- .../selftests/net/forwarding/mirror_gre_nh.sh | 35 ++------ .../net/forwarding/mirror_gre_vlan.sh | 21 +---- .../forwarding/mirror_gre_vlan_bridge_1q.sh | 69 ++++++-------- .../selftests/net/forwarding/mirror_lib.sh | 79 +++++++++++----- .../selftests/net/forwarding/mirror_vlan.sh | 43 +++------ tools/testing/selftests/net/lib.sh | 4 +- 20 files changed, 355 insertions(+), 538 deletions(-)
Signature · 1 line
2.45.0
Petr Machata
maintainerPATCH 1/12 selftests: libs: Expand "$@" where possible
In some functions, argument-forwarding through "$@" without listing the individual arguments explicitly is fundamental to the operation of a function. E.g. xfail_on_veth() should be able to run various tests in the fail-to-xfail regime, and usage of "$@" is appropriate as an abstraction mechanism. For functions such as simple_if_init(), $@ is a handy way to pass an array.
In other functions, it's merely a mechanism to save some typing, which however ends up obscuring the real arguments and makes life hard for those that end up reading the code.
This patch adds some of the implicit function arguments and correspondingly expands $@'s. In several cases this will come in handy as following patches adjust the parameter lists.
--- tools/testing/selftests/net/forwarding/lib.sh | 67 ++++++++++++++++--- .../net/forwarding/mirror_gre_flower.sh | 13 +++- .../net/forwarding/mirror_gre_lib.sh | 63 ++++++++++++++--- .../selftests/net/forwarding/mirror_lib.sh | 63 ++++++++++++++--- 4 files changed, 176 insertions(+), 30 deletions(-)
tools/testing/selftests/net/forwarding/lib.sh +56 -11
@@ -1257,22 +1257,34 @@ __icmp_capture_add_del() icmp_capture_install() { - __icmp_capture_add_del add 100 "" "$@" + local tundev=$1; shift + local filter=$1; shift + + __icmp_capture_add_del add 100 "" "$tundev" "$filter" } icmp_capture_uninstall() { - __icmp_capture_add_del del 100 "" "$@" + local tundev=$1; shift + local filter=$1; shift + + __icmp_capture_add_del del 100 "" "$tundev" "$filter" } icmp6_capture_install() { - __icmp_capture_add_del add 100 v6 "$@" + local tundev=$1; shift + local filter=$1; shift + + __icmp_capture_add_del add 100 v6 "$tundev" "$filter" } icmp6_capture_uninstall() { - __icmp_capture_add_del del 100 v6 "$@" + local tundev=$1; shift + local filter=$1; shift + + __icmp_capture_add_del del 100 v6 "$tundev" "$filter" } __vlan_capture_add_del()
@@ -1290,12 +1302,18 @@ __vlan_capture_add_del() vlan_capture_install() { - __vlan_capture_add_del add 100 "$@" + local dev=$1; shift + local filter=$1; shift + + __vlan_capture_add_del add 100 "$dev" "$filter" } vlan_capture_uninstall() { - __vlan_capture_add_del del 100 "$@" + local dev=$1; shift + local filter=$1; shift + + __vlan_capture_add_del del 100 "$dev" "$filter" } __dscp_capture_add_del()
@@ -1655,34 +1673,61 @@ __start_traffic() local sip=$1; shift local dip=$1; shift local dmac=$1; shift + local -a mz_args=("$@") $MZ $h_in -p $pktsize -A $sip -B $dip -c 0 \ - -a own -b $dmac -t "$proto" -q "$@" & + -a own -b $dmac -t "$proto" -q "${mz_args[@]}" & sleep 1 } start_traffic_pktsize() { local pktsize=$1; shift + local h_in=$1; shift + local sip=$1; shift + local dip=$1; shift + local dmac=$1; shift + local -a mz_args=("$@") - __start_traffic $pktsize udp "$@" + __start_traffic $pktsize udp "$h_in" "$sip" "$dip" "$dmac" \ + "${mz_args[@]}" } start_tcp_traffic_pktsize() { local pktsize=$1; shift + local h_in=$1; shift + local sip=$1; shift + local dip=$1; shift + local dmac=$1; shift + local -a mz_args=("$@") - __start_traffic $pktsize tcp "$@" + __start_traffic $pktsize tcp "$h_in" "$sip" "$dip" "$dmac" \ + "${mz_args[@]}" } start_traffic() { - start_traffic_pktsize 8000 "$@" + local h_in=$1; shift + local sip=$1; shift + local dip=$1; shift + local dmac=$1; shift + local -a mz_args=("$@") + + start_traffic_pktsize 8000 "$h_in" "$sip" "$dip" "$dmac" \ + "${mz_args[@]}" } start_tcp_traffic() { - start_tcp_traffic_pktsize 8000 "$@" + local h_in=$1; shift + local sip=$1; shift + local dip=$1; shift + local dmac=$1; shift + local -a mz_args=("$@") + + start_tcp_traffic_pktsize 8000 "$h_in" "$sip" "$dip" "$dmac" \ + "${mz_args[@]}" } stop_traffic()
tools/testing/selftests/net/forwarding/mirror_gre_flower.sh +11 -2
@@ -64,12 +64,21 @@ cleanup() test_span_gre_dir_acl() { - test_span_gre_dir_ips "$@" 192.0.2.3 192.0.2.4 + local tundev=$1; shift + local direction=$1; shift + local forward_type=$1; shift + local backward_type=$1; shift + + test_span_gre_dir_ips "$tundev" "$direction" "$forward_type" \ + "$backward_type" 192.0.2.3 192.0.2.4 } fail_test_span_gre_dir_acl() { - fail_test_span_gre_dir_ips "$@" 192.0.2.3 192.0.2.4 + local tundev=$1; shift + local direction=$1; shift + + fail_test_span_gre_dir_ips "$tundev" "$direction" 192.0.2.3 192.0.2.4 } full_test_span_gre_dir_acl()
tools/testing/selftests/net/forwarding/mirror_gre_lib.sh +54 -9
108 lines not on this page · raw message
tools/testing/selftests/net/forwarding/mirror_lib.sh +55 -8
99 lines not on this page · raw message
Signature · 1 line
2.45.0
Petr Machata
maintainerPATCH 2/12 selftests: mirror: Drop direction argument from several functions
In reply to Petr MachataThe argument is not used by these functions except to propagate it for ultimately no purpose.
--- .../selftests/drivers/net/mlxsw/mirror_gre.sh | 12 ++++---- .../selftests/net/forwarding/mirror_gre.sh | 12 ++++---- .../net/forwarding/mirror_gre_changes.sh | 24 +++++++-------- .../net/forwarding/mirror_gre_flower.sh | 13 ++++---- .../net/forwarding/mirror_gre_lib.sh | 25 +++++++--------- .../net/forwarding/mirror_gre_neigh.sh | 4 +-- .../selftests/net/forwarding/mirror_gre_nh.sh | 6 ++-- .../forwarding/mirror_gre_vlan_bridge_1q.sh | 30 +++++++++---------- .../selftests/net/forwarding/mirror_lib.sh | 25 +++++----------- .../selftests/net/forwarding/mirror_vlan.sh | 8 ++--- 10 files changed, 69 insertions(+), 90 deletions(-)
tools/testing/selftests/drivers/net/mlxsw/mirror_gre.sh +6 -6
@@ -119,11 +119,11 @@ test_span_gre_ttl_inherit() ip link set dev $tundev type $type ttl inherit mirror_install $swp1 ingress $tundev "matchall $tcflags" - fail_test_span_gre_dir $tundev ingress + fail_test_span_gre_dir $tundev ip link set dev $tundev type $type ttl 100 - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev mirror_uninstall $swp1 ingress log_test "$what: no offload on TTL of inherit ($tcflags)"
@@ -139,10 +139,10 @@ test_span_gre_tos_fixed() ip link set dev $tundev type $type tos 0x10 mirror_install $swp1 ingress $tundev "matchall $tcflags" - fail_test_span_gre_dir $tundev ingress + fail_test_span_gre_dir $tundev ip link set dev $tundev type $type tos inherit - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev mirror_uninstall $swp1 ingress log_test "$what: no offload on a fixed TOS ($tcflags)"
@@ -158,9 +158,9 @@ test_span_failable() mirror_install $swp1 ingress $tundev "matchall $tcflags" if ((should_fail)); then - fail_test_span_gre_dir $tundev ingress + fail_test_span_gre_dir $tundev else - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev fi mirror_uninstall $swp1 ingress
tools/testing/selftests/net/forwarding/mirror_gre.sh +6 -6
@@ -91,17 +91,17 @@ test_two_spans() mirror_install $swp1 ingress gt4 "matchall $tcflags" mirror_install $swp1 egress gt6 "matchall $tcflags" - quick_test_span_gre_dir gt4 ingress - quick_test_span_gre_dir gt6 egress + quick_test_span_gre_dir gt4 + quick_test_span_gre_dir gt6 mirror_uninstall $swp1 ingress - fail_test_span_gre_dir gt4 ingress - quick_test_span_gre_dir gt6 egress + fail_test_span_gre_dir gt4 + quick_test_span_gre_dir gt6 mirror_install $swp1 ingress gt4 "matchall $tcflags" mirror_uninstall $swp1 egress - quick_test_span_gre_dir gt4 ingress - fail_test_span_gre_dir gt6 egress + quick_test_span_gre_dir gt4 + fail_test_span_gre_dir gt6 mirror_uninstall $swp1 ingress log_test "two simultaneously configured mirrors ($tcflags)"
tools/testing/selftests/net/forwarding/mirror_gre_changes.sh +12 -12
@@ -99,11 +99,11 @@ test_span_gre_tun_up() ip link set dev $tundev down mirror_install $swp1 ingress $tundev "matchall $tcflags" - fail_test_span_gre_dir $tundev ingress + fail_test_span_gre_dir $tundev ip link set dev $tundev up - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev mirror_uninstall $swp1 ingress log_test "$what: tunnel down/up ($tcflags)"
@@ -119,7 +119,7 @@ test_span_gre_egress_up() ip link set dev $swp3 down mirror_install $swp1 ingress $tundev "matchall $tcflags" - fail_test_span_gre_dir $tundev ingress + fail_test_span_gre_dir $tundev # After setting the device up, wait for neighbor to get resolved so that # we can expect mirroring to work.
@@ -127,7 +127,7 @@ test_span_gre_egress_up() setup_wait_dev $swp3 ping -c 1 -I $swp3 $remote_ip &>/dev/null - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev mirror_uninstall $swp1 ingress log_test "$what: egress down/up ($tcflags)"
@@ -145,10 +145,10 @@ test_span_gre_remote_ip() ip link set dev $tundev type $type remote $wrong_ip mirror_install $swp1 ingress $tundev "matchall $tcflags" - fail_test_span_gre_dir $tundev ingress + fail_test_span_gre_dir $tundev ip link set dev $tundev type $type remote $correct_ip - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev mirror_uninstall $swp1 ingress log_test "$what: remote address change ($tcflags)"
@@ -166,9 +166,9 @@ test_span_gre_tun_del() RET=0 mirror_install $swp1 ingress $tundev "matchall $tcflags" - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev ip link del dev $tundev - fail_test_span_gre_dir $tundev ingress + fail_test_span_gre_dir $tundev tunnel_create $tundev $type $local_ip $remote_ip \ ttl 100 tos inherit $flags
@@ -177,7 +177,7 @@ test_span_gre_tun_del() # and verify it works for the follow-up tests. mirror_uninstall $swp1 ingress mirror_install $swp1 ingress $tundev "matchall $tcflags" - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev mirror_uninstall $swp1 ingress log_test "$what: tunnel deleted ($tcflags)"
@@ -193,13 +193,13 @@ test_span_gre_route_del() RET=0 mirror_install $swp1 ingress $tundev "matchall $tcflags" - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev ip route del $route dev $edev - fail_test_span_gre_dir $tundev ingress + fail_test_span_gre_dir $tundev ip route add $route dev $edev - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev mirror_uninstall $swp1 ingress
tools/testing/selftests/net/forwarding/mirror_gre_flower.sh +5 -8
@@ -65,20 +65,18 @@ cleanup() test_span_gre_dir_acl() { local tundev=$1; shift - local direction=$1; shift local forward_type=$1; shift local backward_type=$1; shift - test_span_gre_dir_ips "$tundev" "$direction" "$forward_type" \ + test_span_gre_dir_ips "$tundev" "$forward_type" \ "$backward_type" 192.0.2.3 192.0.2.4 } fail_test_span_gre_dir_acl() { local tundev=$1; shift - local direction=$1; shift - fail_test_span_gre_dir_ips "$tundev" "$direction" 192.0.2.3 192.0.2.4 + fail_test_span_gre_dir_ips "$tundev" 192.0.2.3 192.0.2.4 } full_test_span_gre_dir_acl()
@@ -94,13 +92,12 @@ full_test_span_gre_dir_acl() mirror_install $swp1 $direction $tundev \ "protocol ip flower $tcflags dst_ip $match_dip" - fail_test_span_gre_dir $tundev $direction - test_span_gre_dir_acl "$tundev" "$direction" \ - "$forward_type" "$backward_type" + fail_test_span_gre_dir $tundev + test_span_gre_dir_acl "$tundev" "$forward_type" "$backward_type" mirror_uninstall $swp1 $direction # Test lack of mirroring after ACL mirror is uninstalled. - fail_test_span_gre_dir_acl "$tundev" "$direction" + fail_test_span_gre_dir_acl "$tundev" log_test "$direction $what ($tcflags)" }
tools/testing/selftests/net/forwarding/mirror_gre_lib.sh +10 -15
@@ -5,33 +5,30 @@ source "$net_forwarding_dir/mirror_lib.sh" quick_test_span_gre_dir_ips() { local tundev=$1; shift - local direction=$1; shift local ip1=$1; shift local ip2=$1; shift - do_test_span_dir_ips 10 h3-$tundev "$direction" "$ip1" "$ip2" + do_test_span_dir_ips 10 h3-$tundev "$ip1" "$ip2" } fail_test_span_gre_dir_ips() { local tundev=$1; shift - local direction=$1; shift local ip1=$1; shift local ip2=$1; shift - do_test_span_dir_ips 0 h3-$tundev "$direction" "$ip1" "$ip2" + do_test_span_dir_ips 0 h3-$tundev "$ip1" "$ip2" } test_span_gre_dir_ips() { local tundev=$1; shift - local direction=$1; shift local forward_type=$1; shift local backward_type=$1; shift local ip1=$1; shift local ip2=$1; shift - test_span_dir_ips h3-$tundev "$direction" "$forward_type" \ + test_span_dir_ips h3-$tundev "$forward_type" \ "$backward_type" "$ip1" "$ip2" }
@@ -48,7 +45,7 @@ full_test_span_gre_dir_ips() RET=0 mirror_install $swp1 $direction $tundev "matchall $tcflags" - test_span_dir_ips "h3-$tundev" "$direction" "$forward_type" \ + test_span_dir_ips "h3-$tundev" "$forward_type" \ "$backward_type" "$ip1" "$ip2" mirror_uninstall $swp1 $direction
@@ -70,7 +67,7 @@ full_test_span_gre_dir_vlan_ips() mirror_install $swp1 $direction $tundev "matchall $tcflags" - test_span_dir_ips "h3-$tundev" "$direction" "$forward_type" \ + test_span_dir_ips "h3-$tundev" "$forward_type" \ "$backward_type" "$ip1" "$ip2" tc filter add dev $h3 ingress pref 77 prot 802.1q \
@@ -87,17 +84,15 @@ full_test_span_gre_dir_vlan_ips() quick_test_span_gre_dir() { local tundev=$1; shift - local direction=$1; shift - quick_test_span_gre_dir_ips "$tundev" "$direction" 192.0.2.1 192.0.2.2 + quick_test_span_gre_dir_ips "$tundev" 192.0.2.1 192.0.2.2 } fail_test_span_gre_dir() { local tundev=$1; shift - local direction=$1; shift - fail_test_span_gre_dir_ips "$tundev" "$direction" 192.0.2.1 192.0.2.2 + fail_test_span_gre_dir_ips "$tundev" 192.0.2.1 192.0.2.2 } test_span_gre_dir()
@@ -149,15 +144,15 @@ full_test_span_gre_stp_ips() RET=0 mirror_install $swp1 ingress $tundev "matchall $tcflags" - quick_test_span_gre_dir_ips $tundev ingress $ip1 $ip2 + quick_test_span_gre_dir_ips $tundev $ip1 $ip2 bridge link set dev $nbpdev state disabled sleep 1 - fail_test_span_gre_dir_ips $tundev ingress $ip1 $ip2 + fail_test_span_gre_dir_ips $tundev $ip1 $ip2 bridge link set dev $nbpdev state forwarding sleep 1 - quick_test_span_gre_dir_ips $tundev ingress $ip1 $ip2 + quick_test_span_gre_dir_ips $tundev $ip1 $ip2 mirror_uninstall $swp1 ingress
tools/testing/selftests/net/forwarding/mirror_gre_neigh.sh +2 -2
@@ -66,9 +66,9 @@ test_span_gre_neigh() ip neigh replace dev $swp3 $addr lladdr 00:11:22:33:44:55 mirror_install $swp1 $direction $tundev "matchall $tcflags" - fail_test_span_gre_dir $tundev ingress + fail_test_span_gre_dir $tundev ip neigh del dev $swp3 $addr - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev mirror_uninstall $swp1 $direction log_test "$direction $what: neighbor change ($tcflags)"
tools/testing/selftests/net/forwarding/mirror_gre_nh.sh +3 -3
@@ -81,10 +81,10 @@ test_gretap() # the traffic to tunnel remote address. Then add it and test that # mirroring starts. For IPv6 we can't test this due to the limitation # that routes for locally-specified IPv6 addresses can't be added. - fail_test_span_gre_dir gt4 ingress + fail_test_span_gre_dir gt4 ip route add 192.0.2.130/32 via 192.0.2.162 - quick_test_span_gre_dir gt4 ingress + quick_test_span_gre_dir gt4 ip route del 192.0.2.130/32 via 192.0.2.162 mirror_uninstall $swp1 ingress
@@ -96,7 +96,7 @@ test_ip6gretap() RET=0 mirror_install $swp1 ingress gt6 "matchall $tcflags" - quick_test_span_gre_dir gt6 ingress + quick_test_span_gre_dir gt6 mirror_uninstall $swp1 ingress log_test "mirror to ip6gre with next-hop remote ($tcflags)"
tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh +15 -15
@@ -154,16 +154,16 @@ test_span_gre_forbidden_cpu() # Run the pass-test first, to prime neighbor table. mirror_install $swp1 ingress $tundev "matchall $tcflags" - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev # Now forbid the VLAN at the bridge and see it fail. bridge vlan del dev br1 vid 555 self sleep 1 - fail_test_span_gre_dir $tundev ingress + fail_test_span_gre_dir $tundev bridge vlan add dev br1 vid 555 self sleep 1 - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev mirror_uninstall $swp1 ingress
@@ -188,17 +188,17 @@ test_span_gre_forbidden_egress() RET=0 mirror_install $swp1 ingress $tundev "matchall $tcflags" - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev bridge vlan del dev $swp3 vid 555 sleep 1 - fail_test_span_gre_dir $tundev ingress + fail_test_span_gre_dir $tundev bridge vlan add dev $swp3 vid 555 # Re-prime FDB $ARPING -I br1.555 192.0.2.130 -fqc 1 sleep 1 - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev mirror_uninstall $swp1 ingress
@@ -225,24 +225,24 @@ test_span_gre_untagged_egress() mirror_install $swp1 ingress $tundev "matchall $tcflags" - quick_test_span_gre_dir $tundev ingress - quick_test_span_vlan_dir $h3 555 ingress "$ul_proto" + quick_test_span_gre_dir $tundev + quick_test_span_vlan_dir $h3 555 "$ul_proto" h3_addr_add_del del $h3.555 bridge vlan add dev $swp3 vid 555 pvid untagged h3_addr_add_del add $h3 sleep 5 - quick_test_span_gre_dir $tundev ingress - fail_test_span_vlan_dir $h3 555 ingress "$ul_proto" + quick_test_span_gre_dir $tundev + fail_test_span_vlan_dir $h3 555 "$ul_proto" h3_addr_add_del del $h3 bridge vlan add dev $swp3 vid 555 h3_addr_add_del add $h3.555 sleep 5 - quick_test_span_gre_dir $tundev ingress - quick_test_span_vlan_dir $h3 555 ingress "$ul_proto" + quick_test_span_gre_dir $tundev + quick_test_span_vlan_dir $h3 555 "$ul_proto" mirror_uninstall $swp1 ingress
@@ -268,13 +268,13 @@ test_span_gre_fdb_roaming() RET=0 mirror_install $swp1 ingress $tundev "matchall $tcflags" - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev while ((RET == 0)); do bridge fdb del dev $swp3 $h3mac vlan 555 master 2>/dev/null bridge fdb add dev $swp2 $h3mac vlan 555 master static sleep 1 - fail_test_span_gre_dir $tundev ingress + fail_test_span_gre_dir $tundev if ! bridge fdb sh dev $swp2 vlan 555 master \ | grep -q $h3mac; then
@@ -292,7 +292,7 @@ test_span_gre_fdb_roaming() # Re-prime FDB $ARPING -I br1.555 192.0.2.130 -fqc 1 sleep 1 - quick_test_span_gre_dir $tundev ingress + quick_test_span_gre_dir $tundev mirror_uninstall $swp1 ingress
tools/testing/selftests/net/forwarding/mirror_lib.sh +7 -18
@@ -59,7 +59,6 @@ do_test_span_dir_ips() { local expect=$1; shift local dev=$1; shift - local direction=$1; shift local ip1=$1; shift local ip2=$1; shift
@@ -72,11 +71,10 @@ do_test_span_dir_ips() quick_test_span_dir_ips() { local dev=$1; shift - local direction=$1; shift local ip1=$1; shift local ip2=$1; shift - do_test_span_dir_ips 10 "$dev" "$direction" "$ip1" "$ip2" + do_test_span_dir_ips 10 "$dev" "$ip1" "$ip2" } fail_test_span_dir_ips()
@@ -92,13 +90,12 @@ fail_test_span_dir_ips() test_span_dir_ips() { local dev=$1; shift - local direction=$1; shift local forward_type=$1; shift local backward_type=$1; shift local ip1=$1; shift local ip2=$1; shift - quick_test_span_dir_ips "$dev" "$direction" "$ip1" "$ip2" + quick_test_span_dir_ips "$dev" "$ip1" "$ip2" icmp_capture_install $dev "type $forward_type" mirror_test v$h1 $ip1 $ip2 $dev 100 10
@@ -120,11 +117,10 @@ fail_test_span_dir() test_span_dir() { local dev=$1; shift - local direction=$1; shift local forward_type=$1; shift local backward_type=$1; shift - test_span_dir_ips "$dev" "$direction" "$forward_type" "$backward_type" \ + test_span_dir_ips "$dev" "$forward_type" "$backward_type" \ 192.0.2.1 192.0.2.2 }
@@ -133,7 +129,6 @@ do_test_span_vlan_dir_ips() local expect=$1; shift local dev=$1; shift local vid=$1; shift - local direction=$1; shift local ul_proto=$1; shift local ip1=$1; shift local ip2=$1; shift
@@ -151,36 +146,31 @@ quick_test_span_vlan_dir_ips() { local dev=$1; shift local vid=$1; shift - local direction=$1; shift local ul_proto=$1; shift local ip1=$1; shift local ip2=$1; shift - do_test_span_vlan_dir_ips 10 "$dev" "$vid" "$direction" "$ul_proto" \ - "$ip1" "$ip2" + do_test_span_vlan_dir_ips 10 "$dev" "$vid" "$ul_proto" "$ip1" "$ip2" } fail_test_span_vlan_dir_ips() { local dev=$1; shift local vid=$1; shift - local direction=$1; shift local ul_proto=$1; shift local ip1=$1; shift local ip2=$1; shift - do_test_span_vlan_dir_ips 0 "$dev" "$vid" "$direction" "$ul_proto" \ - "$ip1" "$ip2" + do_test_span_vlan_dir_ips 0 "$dev" "$vid" "$ul_proto" "$ip1" "$ip2" } quick_test_span_vlan_dir() { local dev=$1; shift local vid=$1; shift - local direction=$1; shift local ul_proto=$1; shift - quick_test_span_vlan_dir_ips "$dev" "$vid" "$direction" "$ul_proto" \ + quick_test_span_vlan_dir_ips "$dev" "$vid" "$ul_proto" \ 192.0.2.1 192.0.2.2 }
@@ -188,9 +178,8 @@ fail_test_span_vlan_dir() { local dev=$1; shift local vid=$1; shift - local direction=$1; shift local ul_proto=$1; shift - fail_test_span_vlan_dir_ips "$dev" "$vid" "$direction" "$ul_proto" \ + fail_test_span_vlan_dir_ips "$dev" "$vid" "$ul_proto" \ 192.0.2.1 192.0.2.2 }
tools/testing/selftests/net/forwarding/mirror_vlan.sh +3 -5
@@ -64,7 +64,7 @@ test_vlan_dir() RET=0 mirror_install $swp1 $direction $swp3.555 "matchall $tcflags" - test_span_dir "$h3.555" "$direction" "$forward_type" "$backward_type" + test_span_dir "$h3.555" "$forward_type" "$backward_type" mirror_uninstall $swp1 $direction log_test "$direction mirror to vlan ($tcflags)"
@@ -85,10 +85,8 @@ test_tagged_vlan_dir() RET=0 mirror_install $swp1 $direction $swp3.555 "matchall $tcflags" - do_test_span_vlan_dir_ips 10 "$h3.555" 111 "$direction" ip \ - 192.0.2.17 192.0.2.18 - do_test_span_vlan_dir_ips 0 "$h3.555" 555 "$direction" ip \ - 192.0.2.17 192.0.2.18 + do_test_span_vlan_dir_ips 10 "$h3.555" 111 ip 192.0.2.17 192.0.2.18 + do_test_span_vlan_dir_ips 0 "$h3.555" 555 ip 192.0.2.17 192.0.2.18 mirror_uninstall $swp1 $direction log_test "$direction mirror tagged to vlan ($tcflags)"
Signature · 1 line
2.45.0
Petr Machata
maintainerPATCH 3/12 selftests: lib: tc_rule_stats_get(): Move default to argument definition
In reply to Petr MachataThe argument $dir has a fallback value of "ingress". Move the fallback from the usage site to the argument definition block to make the fact clearer.
--- tools/testing/selftests/net/lib.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/net/lib.sh +2 -2
@@ -199,10 +199,10 @@ tc_rule_stats_get() { local dev=$1; shift local pref=$1; shift - local dir=$1; shift + local dir=${1:-ingress}; shift local selector=${1:-.packets}; shift - tc -j -s filter show dev $dev ${dir:-ingress} pref $pref \ + tc -j -s filter show dev $dev $dir pref $pref \ | jq ".[1].options.actions[].stats$selector" }
Signature · 1 line
2.45.0
Petr Machata
maintainerPATCH 4/12 selftests: mirror_gre_lag_lacp: Check counters at tunnel
In reply to Petr MachataThe 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.
--- .../net/forwarding/mirror_gre_lag_lacp.sh | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-)
tools/testing/selftests/net/forwarding/mirror_gre_lag_lacp.sh +22 -15
@@ -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
Signature · 1 line
2.45.0
Petr Machata
maintainerPATCH 5/12 selftests: mirror: do_test_span_dir_ips(): Install accurate taps
In reply to Petr MachataThe mirroring selftests work by sending ICMP traffic between two hosts. Along the way, this traffic is mirrored to a gretap netdevice, and counter taps are then installed strategically along the path of the mirrored traffic to verify the mirroring took place.
The problem with this is that besides mirroring the primary traffic, any other service traffic is mirrored as well. At the same time, because the tests need to work in HW-offloaded scenarios, the ability of the device to do arbitrary packet inspection should not be taken for granted. Most tests therefore simply use matchall, one uses flower to match on IP address.
As a result, the selftests are noisy, because besides the primary ICMP traffic, any amount of other service traffic is mirrored as well.
However, often the counter tap is installed at the remote end of the gretap tunnel. Since this is a SW-datapath scenario anyway, we can make the filter arbitrarily accurate.
Thus in this patch, add parameters forward_type and backward_type to several mirroring test helpers, as some other helpers already have. Then change do_test_span_dir_ips() to instead of installing one generic tap and using it for test in both directions, install the tap for each direction separately, matching on the ICMP type given by these parameters.
--- .../selftests/net/forwarding/mirror_gre.sh | 12 +++++----- .../net/forwarding/mirror_gre_lib.sh | 23 +++++++++++++++---- .../net/forwarding/mirror_gre_neigh.sh | 14 ++++++----- .../selftests/net/forwarding/mirror_lib.sh | 15 +++++++++--- 4 files changed, 44 insertions(+), 20 deletions(-)
tools/testing/selftests/net/forwarding/mirror_gre.sh +6 -6
@@ -91,17 +91,17 @@ test_two_spans() mirror_install $swp1 ingress gt4 "matchall $tcflags" mirror_install $swp1 egress gt6 "matchall $tcflags" - quick_test_span_gre_dir gt4 - quick_test_span_gre_dir gt6 + quick_test_span_gre_dir gt4 8 0 + quick_test_span_gre_dir gt6 0 8 mirror_uninstall $swp1 ingress - fail_test_span_gre_dir gt4 - quick_test_span_gre_dir gt6 + fail_test_span_gre_dir gt4 8 0 + quick_test_span_gre_dir gt6 0 8 mirror_install $swp1 ingress gt4 "matchall $tcflags" mirror_uninstall $swp1 egress - quick_test_span_gre_dir gt4 - fail_test_span_gre_dir gt6 + 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)"
tools/testing/selftests/net/forwarding/mirror_gre_lib.sh +18 -5
@@ -7,8 +7,11 @@ quick_test_span_gre_dir_ips() local tundev=$1; shift local ip1=$1; shift local ip2=$1; shift + local forward_type=$1; shift + local backward_type=$1; shift - do_test_span_dir_ips 10 h3-$tundev "$ip1" "$ip2" + do_test_span_dir_ips 10 h3-$tundev "$ip1" "$ip2" \ + "$forward_type" "$backward_type" } fail_test_span_gre_dir_ips()
@@ -84,8 +87,11 @@ full_test_span_gre_dir_vlan_ips() quick_test_span_gre_dir() { local tundev=$1; shift + local forward_type=${1-8}; shift + local backward_type=${1-0}; shift - quick_test_span_gre_dir_ips "$tundev" 192.0.2.1 192.0.2.2 + quick_test_span_gre_dir_ips "$tundev" 192.0.2.1 192.0.2.2 \ + "$forward_type" "$backward_type" } fail_test_span_gre_dir()
@@ -139,12 +145,15 @@ full_test_span_gre_stp_ips() local what=$1; shift local ip1=$1; shift local ip2=$1; shift + local forward_type=$1; shift + local backward_type=$1; shift local h3mac=$(mac_get $h3) RET=0 mirror_install $swp1 ingress $tundev "matchall $tcflags" - quick_test_span_gre_dir_ips $tundev $ip1 $ip2 + quick_test_span_gre_dir_ips $tundev $ip1 $ip2 \ + "$forward_type" "$backward_type" bridge link set dev $nbpdev state disabled sleep 1
@@ -152,7 +161,8 @@ full_test_span_gre_stp_ips() bridge link set dev $nbpdev state forwarding sleep 1 - quick_test_span_gre_dir_ips $tundev $ip1 $ip2 + quick_test_span_gre_dir_ips $tundev $ip1 $ip2 \ + "$forward_type" "$backward_type" mirror_uninstall $swp1 ingress
@@ -164,7 +174,10 @@ full_test_span_gre_stp() local tundev=$1; shift local nbpdev=$1; shift local what=$1; shift + local forward_type=${1-8}; shift + local backward_type=${1-0}; shift full_test_span_gre_stp_ips "$tundev" "$nbpdev" "$what" \ - 192.0.2.1 192.0.2.2 + 192.0.2.1 192.0.2.2 \ + "$forward_type" "$backward_type" }
tools/testing/selftests/net/forwarding/mirror_gre_neigh.sh +8 -6
@@ -60,15 +60,17 @@ test_span_gre_neigh() local addr=$1; shift local tundev=$1; shift local direction=$1; shift + local forward_type=$1; shift + local backward_type=$1; shift local what=$1; shift RET=0 ip neigh replace dev $swp3 $addr lladdr 00:11:22:33:44:55 mirror_install $swp1 $direction $tundev "matchall $tcflags" - fail_test_span_gre_dir $tundev + fail_test_span_gre_dir $tundev "$forward_type" "$backward_type" ip neigh del dev $swp3 $addr - quick_test_span_gre_dir $tundev + quick_test_span_gre_dir $tundev "$forward_type" "$backward_type" mirror_uninstall $swp1 $direction log_test "$direction $what: neighbor change ($tcflags)"
@@ -76,14 +78,14 @@ test_span_gre_neigh() test_gretap() { - test_span_gre_neigh 192.0.2.130 gt4 ingress "mirror to gretap" - test_span_gre_neigh 192.0.2.130 gt4 egress "mirror to gretap" + test_span_gre_neigh 192.0.2.130 gt4 ingress 8 0 "mirror to gretap" + test_span_gre_neigh 192.0.2.130 gt4 egress 0 8 "mirror to gretap" } test_ip6gretap() { - test_span_gre_neigh 2001:db8:2::2 gt6 ingress "mirror to ip6gretap" - test_span_gre_neigh 2001:db8:2::2 gt6 egress "mirror to ip6gretap" + test_span_gre_neigh 2001:db8:2::2 gt6 ingress 8 0 "mirror to ip6gretap" + test_span_gre_neigh 2001:db8:2::2 gt6 egress 0 8 "mirror to ip6gretap" } test_all()
tools/testing/selftests/net/forwarding/mirror_lib.sh +12 -3
@@ -61,9 +61,14 @@ do_test_span_dir_ips() local dev=$1; shift local ip1=$1; shift local ip2=$1; shift + local forward_type=${1-8}; shift + local backward_type=${1-0}; shift - icmp_capture_install $dev + icmp_capture_install $dev "type $forward_type" mirror_test v$h1 $ip1 $ip2 $dev 100 $expect + icmp_capture_uninstall $dev + + icmp_capture_install $dev "type $backward_type" mirror_test v$h2 $ip2 $ip1 $dev 100 $expect icmp_capture_uninstall $dev }
@@ -73,8 +78,11 @@ quick_test_span_dir_ips() local dev=$1; shift local ip1=$1; shift local ip2=$1; shift + local forward_type=${1-8}; shift + local backward_type=${1-0}; shift - do_test_span_dir_ips 10 "$dev" "$ip1" "$ip2" + do_test_span_dir_ips 10 "$dev" "$ip1" "$ip2" \ + "$forward_type" "$backward_type" } fail_test_span_dir_ips()
@@ -95,7 +103,8 @@ test_span_dir_ips() local ip1=$1; shift local ip2=$1; shift - quick_test_span_dir_ips "$dev" "$ip1" "$ip2" + quick_test_span_dir_ips "$dev" "$ip1" "$ip2" \ + "$forward_type" "$backward_type" icmp_capture_install $dev "type $forward_type" mirror_test v$h1 $ip1 $ip2 $dev 100 10
Signature · 1 line
2.45.0
Petr Machata
maintainerPATCH 6/12 selftests: mirror: mirror_test(): Allow exact count of packets
In reply to Petr MachataThe mirroring selftests work by sending ICMP traffic between two hosts. Along the way, this traffic is mirrored to a gretap netdevice, and counter taps are then installed strategically along the path of the mirrored traffic to verify the mirroring took place.
The problem with this is that besides mirroring the primary traffic, any other service traffic is mirrored as well. At the same time, because the tests need to work in HW-offloaded scenarios, the ability of the device to do arbitrary packet inspection should not be taken for granted. Most tests therefore simply use matchall, one uses flower to match on IP address.
As a result, the selftests are noisy, because besides the primary ICMP traffic, any amount of other service traffic is mirrored as well.
mirror_test() accommodated this noisiness by giving the counters an allowance of several packets. But in the previous patch, where possible, counter taps were changed to match only on an exact ICMP message. At least in those cases, we can demand an exact number of packets to match.
Where the tap is installed on a connective netdevice, the exact matching is not practical (though with u32, anything is possible). In those places, there should still be some leeway -- and probably bigger than before, because experience shows that these tests are very noisy.
To that end, change mirror_test() so that it can be either called with an exact number to expect, or with an expression. Where leeway is needed, adjust callers to pass a ">= 10" instead of mere 10.
--- .../net/forwarding/mirror_gre_bridge_1q_lag.sh | 2 +- .../selftests/net/forwarding/mirror_gre_changes.sh | 2 +- .../selftests/net/forwarding/mirror_gre_lib.sh | 2 +- .../testing/selftests/net/forwarding/mirror_lib.sh | 14 +++++++++----- .../selftests/net/forwarding/mirror_vlan.sh | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-)
tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q_lag.sh +1 -1
@@ -239,7 +239,7 @@ test_lag_slave() setup_wait_dev $host_dev $ARPING -I br1 192.0.2.130 -qfc 1 sleep 2 - mirror_test vrf-h1 192.0.2.1 192.0.2.18 $host_dev 1 10 + mirror_test vrf-h1 192.0.2.1 192.0.2.18 $host_dev 1 ">= 10" # Test lack of connectivity when both slaves are down. ip link set dev $up_dev down
tools/testing/selftests/net/forwarding/mirror_gre_changes.sh +1 -1
@@ -81,7 +81,7 @@ test_span_gre_ttl() ip link set dev $tundev type $type ttl 50 sleep 2 - mirror_test v$h1 192.0.2.1 192.0.2.2 $h3 77 10 + mirror_test v$h1 192.0.2.1 192.0.2.2 $h3 77 ">= 10" ip link set dev $tundev type $type ttl 100 tc filter del dev $h3 ingress pref 77
tools/testing/selftests/net/forwarding/mirror_gre_lib.sh +1 -1
@@ -76,7 +76,7 @@ full_test_span_gre_dir_vlan_ips() tc filter add dev $h3 ingress pref 77 prot 802.1q \ flower $vlan_match \ action pass - mirror_test v$h1 $ip1 $ip2 $h3 77 10 + mirror_test v$h1 $ip1 $ip2 $h3 77 '>= 10' tc filter del dev $h3 ingress pref 77 mirror_uninstall $swp1 $direction
tools/testing/selftests/net/forwarding/mirror_lib.sh +9 -5
@@ -44,14 +44,17 @@ mirror_test() local type="icmp echoreq" fi + if [[ -z ${expect//[[:digit:]]/} ]]; then + expect="== $expect" + fi + local t0=$(tc_rule_stats_get $dev $pref) $MZ $proto $vrf_name ${sip:+-A $sip} -B $dip -a own -b bc -q \ -c 10 -d 100msec -t $type sleep 0.5 local t1=$(tc_rule_stats_get $dev $pref) local delta=$((t1 - t0)) - # Tolerate a couple stray extra packets. - ((expect <= delta && delta <= expect + 2)) + ((delta $expect)) check_err $? "Expected to capture $expect packets, got $delta." }
@@ -146,8 +149,8 @@ do_test_span_vlan_dir_ips() # The traffic is meant for local box anyway, so will be trapped to # kernel. vlan_capture_install $dev "skip_hw vlan_id $vid vlan_ethtype $ul_proto" - mirror_test v$h1 $ip1 $ip2 $dev 100 $expect - mirror_test v$h2 $ip2 $ip1 $dev 100 $expect + mirror_test v$h1 $ip1 $ip2 $dev 100 "$expect" + mirror_test v$h2 $ip2 $ip1 $dev 100 "$expect" vlan_capture_uninstall $dev }
@@ -159,7 +162,8 @@ quick_test_span_vlan_dir_ips() local ip1=$1; shift local ip2=$1; shift - do_test_span_vlan_dir_ips 10 "$dev" "$vid" "$ul_proto" "$ip1" "$ip2" + do_test_span_vlan_dir_ips '>= 10' "$dev" "$vid" "$ul_proto" \ + "$ip1" "$ip2" } fail_test_span_vlan_dir_ips()
tools/testing/selftests/net/forwarding/mirror_vlan.sh +1 -1
@@ -85,7 +85,7 @@ test_tagged_vlan_dir() RET=0 mirror_install $swp1 $direction $swp3.555 "matchall $tcflags" - do_test_span_vlan_dir_ips 10 "$h3.555" 111 ip 192.0.2.17 192.0.2.18 + do_test_span_vlan_dir_ips '>= 10' "$h3.555" 111 ip 192.0.2.17 192.0.2.18 do_test_span_vlan_dir_ips 0 "$h3.555" 555 ip 192.0.2.17 192.0.2.18 mirror_uninstall $swp1 $direction
Signature · 1 line
2.45.0
Petr Machata
maintainerPATCH 7/12 selftests: mirror: Drop dual SW/HW testing
In reply to Petr MachataThe 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.
--- .../selftests/drivers/net/mlxsw/mirror_gre.sh | 33 +++---------- .../drivers/net/mlxsw/mirror_gre_scale.sh | 18 +------ .../selftests/net/forwarding/mirror_gre.sh | 33 +++---------- .../net/forwarding/mirror_gre_bound.sh | 23 +-------- .../net/forwarding/mirror_gre_bridge_1d.sh | 21 +-------- .../forwarding/mirror_gre_bridge_1d_vlan.sh | 21 +-------- .../net/forwarding/mirror_gre_bridge_1q.sh | 21 +-------- .../forwarding/mirror_gre_bridge_1q_lag.sh | 27 ++--------- .../net/forwarding/mirror_gre_changes.sh | 47 ++++++------------- .../net/forwarding/mirror_gre_flower.sh | 25 ++-------- .../net/forwarding/mirror_gre_lag_lacp.sh | 25 ++-------- .../net/forwarding/mirror_gre_lib.sh | 12 ++--- .../net/forwarding/mirror_gre_neigh.sh | 25 ++-------- .../selftests/net/forwarding/mirror_gre_nh.sh | 29 ++---------- .../net/forwarding/mirror_gre_vlan.sh | 21 +-------- .../forwarding/mirror_gre_vlan_bridge_1q.sh | 39 ++++----------- .../selftests/net/forwarding/mirror_vlan.sh | 35 ++++---------- 17 files changed, 77 insertions(+), 378 deletions(-)
tools/testing/selftests/drivers/net/mlxsw/mirror_gre.sh +6 -27
@@ -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
tools/testing/selftests/drivers/net/mlxsw/mirror_gre_scale.sh +2 -16
@@ -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]}
tools/testing/selftests/net/forwarding/mirror_gre.sh +7 -26
@@ -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
tools/testing/selftests/net/forwarding/mirror_gre_bound.sh +1 -22
@@ -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
tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d.sh +1 -20
@@ -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
tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh +1 -20
@@ -104,30 +104,11 @@ test_ip6gretap_stp() full_test_span_gre_stp gt6 $swp3.555 "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
tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh +1 -20
@@ -104,30 +104,11 @@ test_ip6gretap() full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap" } -tests() -{ - 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" -tests - -if ! tc_offload_check; then - echo "WARN: Could not test offloaded functionality" -else - tcflags="skip_sw" - tests -fi +tests_run exit $EXIT_STATUS
tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q_lag.sh +4 -23
@@ -227,10 +227,10 @@ test_lag_slave() RET=0 tc filter add dev $swp1 ingress pref 999 \ - proto 802.1q flower vlan_ethtype arp $tcflags \ + proto 802.1q flower vlan_ethtype arp \ action pass mirror_install $swp1 ingress gt4 \ - "proto 802.1q flower vlan_id 333 $tcflags" + "proto 802.1q flower vlan_id 333" # Test connectivity through $up_dev when $down_dev is set down. ip link set dev $down_dev down
@@ -252,7 +252,7 @@ test_lag_slave() mirror_uninstall $swp1 ingress tc filter del dev $swp1 ingress pref 999 - log_test "$what ($tcflags)" + log_test "$what" } test_mirror_gretap_first()
@@ -265,30 +265,11 @@ test_mirror_gretap_second() test_lag_slave $h4 $swp4 $swp3 "mirror to gretap: LAG second slave" } -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
tools/testing/selftests/net/forwarding/mirror_gre_changes.sh +14 -33
132 lines not on this page · raw message
tools/testing/selftests/net/forwarding/mirror_gre_flower.sh +3 -22
@@ -91,7 +91,7 @@ full_test_span_gre_dir_acl() RET=0 mirror_install $swp1 $direction $tundev \ - "protocol ip flower $tcflags dst_ip $match_dip" + "protocol ip flower dst_ip $match_dip" fail_test_span_gre_dir $tundev test_span_gre_dir_acl "$tundev" "$forward_type" "$backward_type" mirror_uninstall $swp1 $direction
@@ -99,7 +99,7 @@ full_test_span_gre_dir_acl() # Test lack of mirroring after ACL mirror is uninstalled. fail_test_span_gre_dir_acl "$tundev" - log_test "$direction $what ($tcflags)" + log_test "$direction $what" } test_gretap()
@@ -114,30 +114,11 @@ test_ip6gretap() full_test_span_gre_dir_acl gt6 egress 0 8 192.0.2.3 "ACL 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
tools/testing/selftests/net/forwarding/mirror_gre_lag_lacp.sh +3 -22
@@ -223,7 +223,7 @@ test_lag_slave() RET=0 mirror_install $swp1 ingress gt4 \ - "proto 802.1q flower vlan_id 333 $tcflags" + "proto 802.1q flower vlan_id 333" 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
@@ -250,7 +250,7 @@ test_lag_slave() # Wait for ${h,swp}{3,4}. setup_wait - log_test "$what ($tcflags)" + log_test "$what" } test_mirror_gretap_first()
@@ -263,30 +263,11 @@ test_mirror_gretap_second() test_lag_slave $h4 $h3 "mirror to gretap: LAG second slave" } -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
tools/testing/selftests/net/forwarding/mirror_gre_lib.sh +6 -6
@@ -47,12 +47,12 @@ full_test_span_gre_dir_ips() RET=0 - mirror_install $swp1 $direction $tundev "matchall $tcflags" + mirror_install $swp1 $direction $tundev "matchall" test_span_dir_ips "h3-$tundev" "$forward_type" \ "$backward_type" "$ip1" "$ip2" mirror_uninstall $swp1 $direction - log_test "$direction $what ($tcflags)" + log_test "$direction $what" } full_test_span_gre_dir_vlan_ips()
@@ -68,7 +68,7 @@ full_test_span_gre_dir_vlan_ips() RET=0 - mirror_install $swp1 $direction $tundev "matchall $tcflags" + mirror_install $swp1 $direction $tundev "matchall" test_span_dir_ips "h3-$tundev" "$forward_type" \ "$backward_type" "$ip1" "$ip2"
@@ -81,7 +81,7 @@ full_test_span_gre_dir_vlan_ips() mirror_uninstall $swp1 $direction - log_test "$direction $what ($tcflags)" + log_test "$direction $what" } quick_test_span_gre_dir()
@@ -151,7 +151,7 @@ full_test_span_gre_stp_ips() RET=0 - mirror_install $swp1 ingress $tundev "matchall $tcflags" + mirror_install $swp1 ingress $tundev "matchall" quick_test_span_gre_dir_ips $tundev $ip1 $ip2 \ "$forward_type" "$backward_type"
@@ -166,7 +166,7 @@ full_test_span_gre_stp_ips() mirror_uninstall $swp1 ingress - log_test "$what: STP state ($tcflags)" + log_test "$what: STP state" } full_test_span_gre_stp()
tools/testing/selftests/net/forwarding/mirror_gre_neigh.sh +3 -22
@@ -67,13 +67,13 @@ test_span_gre_neigh() RET=0 ip neigh replace dev $swp3 $addr lladdr 00:11:22:33:44:55 - mirror_install $swp1 $direction $tundev "matchall $tcflags" + mirror_install $swp1 $direction $tundev "matchall" fail_test_span_gre_dir $tundev "$forward_type" "$backward_type" ip neigh del dev $swp3 $addr quick_test_span_gre_dir $tundev "$forward_type" "$backward_type" mirror_uninstall $swp1 $direction - log_test "$direction $what: neighbor change ($tcflags)" + log_test "$direction $what: neighbor change" } test_gretap()
@@ -88,30 +88,11 @@ test_ip6gretap() test_span_gre_neigh 2001:db8:2::2 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
tools/testing/selftests/net/forwarding/mirror_gre_nh.sh +5 -24
@@ -75,7 +75,7 @@ cleanup() test_gretap() { RET=0 - mirror_install $swp1 ingress gt4 "matchall $tcflags" + mirror_install $swp1 ingress gt4 "matchall" # For IPv4, test that there's no mirroring without the route directing # the traffic to tunnel remote address. Then add it and test that
@@ -88,29 +88,18 @@ test_gretap() ip route del 192.0.2.130/32 via 192.0.2.162 mirror_uninstall $swp1 ingress - log_test "mirror to gre with next-hop remote ($tcflags)" + log_test "mirror to gre with next-hop remote" } test_ip6gretap() { RET=0 - mirror_install $swp1 ingress gt6 "matchall $tcflags" + mirror_install $swp1 ingress gt6 "matchall" quick_test_span_gre_dir gt6 mirror_uninstall $swp1 ingress - log_test "mirror to ip6gre with next-hop remote ($tcflags)" -} - -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 + log_test "mirror to ip6gre with next-hop remote" } trap cleanup EXIT
@@ -118,14 +107,6 @@ 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
tools/testing/selftests/net/forwarding/mirror_gre_vlan.sh +1 -20
@@ -63,30 +63,11 @@ test_gretap() full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap" } -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
tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh +10 -29
@@ -153,7 +153,7 @@ test_span_gre_forbidden_cpu() RET=0 # Run the pass-test first, to prime neighbor table. - mirror_install $swp1 ingress $tundev "matchall $tcflags" + mirror_install $swp1 ingress $tundev "matchall" quick_test_span_gre_dir $tundev # Now forbid the VLAN at the bridge and see it fail.
@@ -167,7 +167,7 @@ test_span_gre_forbidden_cpu() mirror_uninstall $swp1 ingress - log_test "$what: vlan forbidden at a bridge ($tcflags)" + log_test "$what: vlan forbidden at a bridge" } test_gretap_forbidden_cpu()
@@ -187,7 +187,7 @@ test_span_gre_forbidden_egress() RET=0 - mirror_install $swp1 ingress $tundev "matchall $tcflags" + mirror_install $swp1 ingress $tundev "matchall" quick_test_span_gre_dir $tundev bridge vlan del dev $swp3 vid 555
@@ -202,7 +202,7 @@ test_span_gre_forbidden_egress() mirror_uninstall $swp1 ingress - log_test "$what: vlan forbidden at a bridge egress ($tcflags)" + log_test "$what: vlan forbidden at a bridge egress" } test_gretap_forbidden_egress()
@@ -223,7 +223,7 @@ test_span_gre_untagged_egress() RET=0 - mirror_install $swp1 ingress $tundev "matchall $tcflags" + mirror_install $swp1 ingress $tundev "matchall" quick_test_span_gre_dir $tundev quick_test_span_vlan_dir $h3 555 "$ul_proto"
@@ -246,7 +246,7 @@ test_span_gre_untagged_egress() mirror_uninstall $swp1 ingress - log_test "$what: vlan untagged at a bridge egress ($tcflags)" + log_test "$what: vlan untagged at a bridge egress" } test_gretap_untagged_egress()
@@ -267,7 +267,7 @@ test_span_gre_fdb_roaming() RET=0 - mirror_install $swp1 ingress $tundev "matchall $tcflags" + mirror_install $swp1 ingress $tundev "matchall" quick_test_span_gre_dir $tundev while ((RET == 0)); do
@@ -279,7 +279,7 @@ test_span_gre_fdb_roaming() if ! bridge fdb sh dev $swp2 vlan 555 master \ | grep -q $h3mac; then printf "TEST: %-60s [RETRY]\n" \ - "$what: MAC roaming ($tcflags)" + "$what: MAC roaming" # ARP or ND probably reprimed the FDB while the test # was running. We would get a spurious failure. RET=0
@@ -296,7 +296,7 @@ test_span_gre_fdb_roaming() mirror_uninstall $swp1 ingress - log_test "$what: MAC roaming ($tcflags)" + log_test "$what: MAC roaming" } test_gretap_fdb_roaming()
@@ -319,30 +319,11 @@ test_ip6gretap_stp() full_test_span_gre_stp gt6 $swp3 "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
tools/testing/selftests/net/forwarding/mirror_vlan.sh +9 -26
@@ -40,12 +40,16 @@ setup_prepare() vlan_create $h2 111 v$h2 192.0.2.18/28 bridge vlan add dev $swp2 vid 111 + + trap_install $h3 ingress } cleanup() { pre_cleanup + trap_uninstall $h3 ingress + vlan_destroy $h2 111 vlan_destroy $h1 111 vlan_destroy $h3 555
@@ -63,11 +67,11 @@ test_vlan_dir() RET=0 - mirror_install $swp1 $direction $swp3.555 "matchall $tcflags" + mirror_install $swp1 $direction $swp3.555 "matchall" test_span_dir "$h3.555" "$forward_type" "$backward_type" mirror_uninstall $swp1 $direction - log_test "$direction mirror to vlan ($tcflags)" + log_test "$direction mirror to vlan" } test_vlan()
@@ -84,12 +88,12 @@ test_tagged_vlan_dir() RET=0 - mirror_install $swp1 $direction $swp3.555 "matchall $tcflags" + mirror_install $swp1 $direction $swp3.555 "matchall" do_test_span_vlan_dir_ips '>= 10' "$h3.555" 111 ip 192.0.2.17 192.0.2.18 do_test_span_vlan_dir_ips 0 "$h3.555" 555 ip 192.0.2.17 192.0.2.18 mirror_uninstall $swp1 $direction - log_test "$direction mirror tagged to vlan ($tcflags)" + log_test "$direction mirror tagged to vlan" } test_tagged_vlan()
@@ -98,32 +102,11 @@ test_tagged_vlan() test_tagged_vlan_dir egress 0 8 } -test_all() -{ - slow_path_trap_install $swp1 ingress - slow_path_trap_install $swp1 egress - trap_install $h3 ingress - - tests_run - - trap_uninstall $h3 ingress - 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
Signature · 1 line
2.45.0
Petr Machata
maintainerPATCH 8/12 selftests: mlxsw: mirror_gre: Simplify
In reply to Petr MachataAfter the previous patch, the function test_span_failable() is always called with should_fail=1. Drop the argument and streamline the code.
--- .../selftests/drivers/net/mlxsw/mirror_gre.sh | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
tools/testing/selftests/drivers/net/mlxsw/mirror_gre.sh +5 -12
@@ -150,34 +150,27 @@ test_span_gre_tos_fixed() test_span_failable() { - local should_fail=$1; shift local tundev=$1; shift local what=$1; shift RET=0 mirror_install $swp1 ingress $tundev "matchall" - if ((should_fail)); then - fail_test_span_gre_dir $tundev - else - quick_test_span_gre_dir $tundev - fi + fail_test_span_gre_dir $tundev mirror_uninstall $swp1 ingress - log_test "$what: should_fail=$should_fail" + log_test "fail $what" } test_failable() { - local should_fail=$1; shift - - test_span_failable $should_fail gt6-key "mirror to keyful gretap" - test_span_failable $should_fail gt6-soft "mirror to gretap w/ soft underlay" + test_span_failable gt6-key "mirror to keyful gretap" + test_span_failable gt6-soft "mirror to gretap w/ soft underlay" } test_hw() { - test_failable 1 + test_failable test_span_gre_tos_fixed gt4 gretap "mirror to gretap" test_span_gre_tos_fixed gt6 ip6gretap "mirror to ip6gretap"
Signature · 1 line
2.45.0
Petr Machata
maintainerPATCH 10/12 selftests: libs: Drop slow_path_trap_install()/_uninstall()
In reply to Petr MachataThese functions are not used anymore.
--- tools/testing/selftests/net/forwarding/lib.sh | 16 ---------------- 1 file changed, 16 deletions(-)
tools/testing/selftests/net/forwarding/lib.sh +0 -16
@@ -1225,22 +1225,6 @@ trap_uninstall() tc filter del dev $dev $direction pref 1 flower } -slow_path_trap_install() -{ - # For slow-path testing, we need to install a trap to get to - # slow path the packets that would otherwise be switched in HW. - if [ "${tcflags/skip_hw}" != "$tcflags" ]; then - trap_install "$@" - fi -} - -slow_path_trap_uninstall() -{ - if [ "${tcflags/skip_hw}" != "$tcflags" ]; then - trap_uninstall "$@" - fi -} - __icmp_capture_add_del() { local add_del=$1; shift
Signature · 1 line
2.45.0
Petr Machata
maintainerPATCH 9/12 selftests: mirror_gre_lag_lacp: Drop unnecessary code
In reply to Petr MachataThe selftest does not use functions from mirror_gre_lib, ditch the import.
It does not use arping either, so drop the require_command as well.
--- tools/testing/selftests/net/forwarding/mirror_gre_lag_lacp.sh | 3 --- 1 file changed, 3 deletions(-)
tools/testing/selftests/net/forwarding/mirror_gre_lag_lacp.sh +0 -3
@@ -56,9 +56,6 @@ ALL_TESTS=" NUM_NETIFS=6 source lib.sh source mirror_lib.sh -source mirror_gre_lib.sh - -require_command $ARPING vlan_host_create() {
Signature · 1 line
2.45.0
Petr Machata
maintainerPATCH 11/12 selftests: libs: Drop unused functions
In reply to Petr MachataNothing calls these.
--- .../selftests/net/forwarding/mirror_gre_lib.sh | 11 ----------- .../selftests/net/forwarding/mirror_lib.sh | 18 ------------------ 2 files changed, 29 deletions(-)
tools/testing/selftests/net/forwarding/mirror_gre_lib.sh +0 -11
@@ -101,17 +101,6 @@ fail_test_span_gre_dir() fail_test_span_gre_dir_ips "$tundev" 192.0.2.1 192.0.2.2 } -test_span_gre_dir() -{ - local tundev=$1; shift - local direction=$1; shift - local forward_type=$1; shift - local backward_type=$1; shift - - test_span_gre_dir_ips "$tundev" "$direction" "$forward_type" \ - "$backward_type" 192.0.2.1 192.0.2.2 -} - full_test_span_gre_dir() { local tundev=$1; shift
tools/testing/selftests/net/forwarding/mirror_lib.sh +0 -18
@@ -88,16 +88,6 @@ quick_test_span_dir_ips() "$forward_type" "$backward_type" } -fail_test_span_dir_ips() -{ - local dev=$1; shift - local direction=$1; shift - local ip1=$1; shift - local ip2=$1; shift - - do_test_span_dir_ips 0 "$dev" "$direction" "$ip1" "$ip2" -} - test_span_dir_ips() { local dev=$1; shift
@@ -118,14 +108,6 @@ test_span_dir_ips() icmp_capture_uninstall $dev } -fail_test_span_dir() -{ - local dev=$1; shift - local direction=$1; shift - - fail_test_span_dir_ips "$dev" "$direction" 192.0.2.1 192.0.2.2 -} - test_span_dir() { local dev=$1; shift
Signature · 1 line
2.45.0
Petr Machata
maintainerPATCH 12/12 selftests: mlxsw: mirror_gre: Obey TESTS
In reply to Petr MachataThis test is unusual in that overriding TESTS does not change the tests to be run. Split the individual tests into several functions and invoke them through tests_run() as appropriate.
--- .../selftests/drivers/net/mlxsw/mirror_gre.sh | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-)
tools/testing/selftests/drivers/net/mlxsw/mirror_gre.sh +18 -5
@@ -15,6 +15,13 @@ source $lib_dir/mirror_lib.sh source $lib_dir/mirror_gre_lib.sh source $lib_dir/mirror_gre_topo_lib.sh +ALL_TESTS=" + test_keyful + test_soft + test_tos_fixed + test_ttl_inherit +" + setup_keyful() { tunnel_create gt6-key ip6gretap 2001:db8:3::1 2001:db8:3::2 \
@@ -162,19 +169,25 @@ test_span_failable() log_test "fail $what" } -test_failable() +test_keyful() { test_span_failable gt6-key "mirror to keyful gretap" +} + +test_soft() +{ test_span_failable gt6-soft "mirror to gretap w/ soft underlay" } -test_hw() +test_tos_fixed() { - test_failable - test_span_gre_tos_fixed gt4 gretap "mirror to gretap" test_span_gre_tos_fixed gt6 ip6gretap "mirror to ip6gretap" +} + +test_ttl_inherit() +{ test_span_gre_ttl_inherit gt4 gretap "mirror to gretap" test_span_gre_ttl_inherit gt6 ip6gretap "mirror to ip6gretap" }
@@ -184,6 +197,6 @@ trap cleanup EXIT setup_prepare setup_wait -test_hw +tests_run exit $EXIT_STATUS
Signature · 1 line
2.45.0
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Quoted 5 lines · On Thu, 27 Jun 2024 16:48:37 +0200 you wrote:
The mirroring selftests work by sending ICMP traffic between two hosts. Along the way, this traffic is mirrored to a gretap netdevice, and counter taps are then installed strategically along the path of the mirrored traffic to verify the mirroring took place.
Quoted 8 lines
The problem with this is that besides mirroring the primary traffic, any other service traffic is mirrored as well. At the same time, because the tests need to work in HW-offloaded scenarios, the ability of the device to do arbitrary packet inspection should not be taken for granted. Most tests therefore simply use matchall, one uses flower to match on IP address. As a result, the selftests are noisy.
[...]
Here is the summary with links:
- [net-next,01/12] selftests: libs: Expand "$@" where possible
https://git.kernel.org/netdev/net-next/c/d5fbb2eb33c2 - [net-next,02/12] selftests: mirror: Drop direction argument from several functions https://git.kernel.org/netdev/net-next/c/28e67746b73d - [net-next,03/12] selftests: lib: tc_rule_stats_get(): Move default to argument definition https://git.kernel.org/netdev/net-next/c/9b5d5f272654 - [net-next,04/12] selftests: mirror_gre_lag_lacp: Check counters at tunnel https://git.kernel.org/netdev/net-next/c/95e7b860e16d - [net-next,05/12] selftests: mirror: do_test_span_dir_ips(): Install accurate taps https://git.kernel.org/netdev/net-next/c/833415358f34 - [net-next,06/12] selftests: mirror: mirror_test(): Allow exact count of packets https://git.kernel.org/netdev/net-next/c/a86e0df9ce25 - [net-next,07/12] selftests: mirror: Drop dual SW/HW testing https://git.kernel.org/netdev/net-next/c/d361d78fe2cc - [net-next,08/12] selftests: mlxsw: mirror_gre: Simplify https://git.kernel.org/netdev/net-next/c/388b2d985a13 - [net-next,09/12] selftests: mirror_gre_lag_lacp: Drop unnecessary code https://git.kernel.org/netdev/net-next/c/95d33989cee5 - [net-next,10/12] selftests: libs: Drop slow_path_trap_install()/_uninstall() https://git.kernel.org/netdev/net-next/c/4e9cd3d03af2 - [net-next,11/12] selftests: libs: Drop unused functions https://git.kernel.org/netdev/net-next/c/06704a0d5e67 - [net-next,12/12] selftests: mlxsw: mirror_gre: Obey TESTS https://git.kernel.org/netdev/net-next/c/098ba97d0e89
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html