selftests: forwarding: Parametrize mausezahn delay
authorIdo Schimmel <idosch@nvidia.com>
Mon, 4 Mar 2024 09:56:08 +0000 (11:56 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 5 Mar 2024 17:18:04 +0000 (09:18 -0800)
The various multipath tests use mausezahn to generate different flows
and check how they are distributed between the available nexthops. The
tool is currently invoked with an hard coded transmission delay of 1 ms.
This is unnecessary when the tests are run with veth pairs and
needlessly prolongs the tests.

Parametrize this delay and default it to 0 us. It can be overridden
using the forwarding.config file. On my system, this reduces the run
time of router_multipath.sh by 93%.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/r/20240304095612.462900-3-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
16 files changed:
tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
tools/testing/selftests/net/forwarding/forwarding.config.sample
tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh
tools/testing/selftests/net/forwarding/gre_inner_v4_multipath.sh
tools/testing/selftests/net/forwarding/gre_inner_v6_multipath.sh
tools/testing/selftests/net/forwarding/gre_multipath.sh
tools/testing/selftests/net/forwarding/gre_multipath_nh.sh
tools/testing/selftests/net/forwarding/gre_multipath_nh_res.sh
tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh
tools/testing/selftests/net/forwarding/ip6gre_inner_v4_multipath.sh
tools/testing/selftests/net/forwarding/ip6gre_inner_v6_multipath.sh
tools/testing/selftests/net/forwarding/ip6gre_lib.sh
tools/testing/selftests/net/forwarding/lib.sh
tools/testing/selftests/net/forwarding/router_mpath_nh.sh
tools/testing/selftests/net/forwarding/router_mpath_nh_res.sh
tools/testing/selftests/net/forwarding/router_multipath.sh

index 56eb83d..1783c10 100755 (executable)
@@ -183,42 +183,42 @@ send_src_ipv4()
 {
        ip vrf exec v$h1 $MZ $h1 -q -p 64 \
                -A "198.51.100.2-198.51.100.253" -B 203.0.113.2 \
-               -d 1msec -c 50 -t udp "sp=20000,dp=30000"
+               -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000"
 }
 
 send_dst_ipv4()
 {
        ip vrf exec v$h1 $MZ $h1 -q -p 64 \
                -A 198.51.100.2 -B "203.0.113.2-203.0.113.253" \
-               -d 1msec -c 50 -t udp "sp=20000,dp=30000"
+               -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000"
 }
 
 send_src_udp4()
 {
        ip vrf exec v$h1 $MZ $h1 -q -p 64 \
                -A 198.51.100.2 -B 203.0.113.2 \
-               -d 1msec -t udp "sp=0-32768,dp=30000"
+               -d $MZ_DELAY -t udp "sp=0-32768,dp=30000"
 }
 
 send_dst_udp4()
 {
        ip vrf exec v$h1 $MZ $h1 -q -p 64 \
                -A 198.51.100.2 -B 203.0.113.2 \
-               -d 1msec -t udp "sp=20000,dp=0-32768"
+               -d $MZ_DELAY -t udp "sp=20000,dp=0-32768"
 }
 
 send_src_ipv6()
 {
        ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \
                -A "2001:db8:1::2-2001:db8:1::fd" -B 2001:db8:4::2 \
-               -d 1msec -c 50 -t udp "sp=20000,dp=30000"
+               -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000"
 }
 
 send_dst_ipv6()
 {
        ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \
                -A 2001:db8:1::2 -B "2001:db8:4::2-2001:db8:4::fd" \
-               -d 1msec -c 50 -t udp "sp=20000,dp=30000"
+               -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000"
 }
 
 send_flowlabel()
@@ -234,14 +234,14 @@ send_src_udp6()
 {
        ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \
                -A 2001:db8:1::2 -B 2001:db8:4::2 \
-               -d 1msec -t udp "sp=0-32768,dp=30000"
+               -d $MZ_DELAY -t udp "sp=0-32768,dp=30000"
 }
 
 send_dst_udp6()
 {
        ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \
                -A 2001:db8:1::2 -B 2001:db8:4::2 \
-               -d 1msec -t udp "sp=20000,dp=0-32768"
+               -d $MZ_DELAY -t udp "sp=20000,dp=0-32768"
 }
 
 custom_hash_test()
index 4a54650..1fc4f02 100644 (file)
@@ -28,6 +28,8 @@ PING=ping
 PING6=ping6
 # Packet generator. Some distributions use 'mz'.
 MZ=mausezahn
+# mausezahn delay between transmissions in microseconds.
+MZ_DELAY=0
 # Time to wait after interfaces participating in the test are all UP
 WAIT_TIME=5
 # Whether to pause on failure or not.
index 0446db9..9788bd0 100755 (executable)
@@ -278,42 +278,42 @@ send_src_ipv4()
 {
        ip vrf exec v$h1 $MZ $h1 -q -p 64 \
                -A "198.51.100.2-198.51.100.253" -B 203.0.113.2 \
-               -d 1msec -c 50 -t udp "sp=20000,dp=30000"
+               -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000"
 }
 
 send_dst_ipv4()
 {
        ip vrf exec v$h1 $MZ $h1 -q -p 64 \
                -A 198.51.100.2 -B "203.0.113.2-203.0.113.253" \
-               -d 1msec -c 50 -t udp "sp=20000,dp=30000"
+               -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000"
 }
 
 send_src_udp4()
 {
        ip vrf exec v$h1 $MZ $h1 -q -p 64 \
                -A 198.51.100.2 -B 203.0.113.2 \
-               -d 1msec -t udp "sp=0-32768,dp=30000"
+               -d $MZ_DELAY -t udp "sp=0-32768,dp=30000"
 }
 
 send_dst_udp4()
 {
        ip vrf exec v$h1 $MZ $h1 -q -p 64 \
                -A 198.51.100.2 -B 203.0.113.2 \
-               -d 1msec -t udp "sp=20000,dp=0-32768"
+               -d $MZ_DELAY -t udp "sp=20000,dp=0-32768"
 }
 
 send_src_ipv6()
 {
        ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \
                -A "2001:db8:1::2-2001:db8:1::fd" -B 2001:db8:2::2 \
-               -d 1msec -c 50 -t udp "sp=20000,dp=30000"
+               -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000"
 }
 
 send_dst_ipv6()
 {
        ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \
                -A 2001:db8:1::2 -B "2001:db8:2::2-2001:db8:2::fd" \
-               -d 1msec -c 50 -t udp "sp=20000,dp=30000"
+               -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000"
 }
 
 send_flowlabel()
@@ -329,14 +329,14 @@ send_src_udp6()
 {
        ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \
                -A 2001:db8:1::2 -B 2001:db8:2::2 \
-               -d 1msec -t udp "sp=0-32768,dp=30000"
+               -d $MZ_DELAY -t udp "sp=0-32768,dp=30000"
 }
 
 send_dst_udp6()
 {
        ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \
                -A 2001:db8:1::2 -B 2001:db8:2::2 \
-               -d 1msec -t udp "sp=20000,dp=0-32768"
+               -d $MZ_DELAY -t udp "sp=20000,dp=0-32768"
 }
 
 custom_hash_test()
index e4009f6..efca611 100755 (executable)
@@ -267,7 +267,7 @@ multipath4_test()
 
        ip vrf exec v$h1 \
           $MZ $h1 -q -p 64 -A "192.0.3.2-192.0.3.62" -B "192.0.4.2-192.0.4.62" \
-              -d 1msec -c 50 -t udp "sp=1024,dp=1024"
+              -d $MZ_DELAY -c 50 -t udp "sp=1024,dp=1024"
        sleep 1
 
        local t1_111=$(tc_rule_stats_get $ul32 111 ingress)
index e449475..e5e911c 100755 (executable)
@@ -268,7 +268,7 @@ multipath6_test()
        ip vrf exec v$h1 \
           $MZ $h1 -6 -q -p 64 -A "2001:db8:1::2-2001:db8:1::1e" \
               -B "2001:db8:2::2-2001:db8:2::1e" \
-              -d 1msec -c 50 -t udp "sp=1024,dp=1024"
+              -d $MZ_DELAY -c 50 -t udp "sp=1024,dp=1024"
        sleep 1
 
        local t1_111=$(tc_rule_stats_get $ul32 111 ingress)
index a8d8e8b..57531c1 100755 (executable)
@@ -220,7 +220,7 @@ multipath4_test()
 
        ip vrf exec v$h1 \
           $MZ $h1 -q -p 64 -A 192.0.2.1 -B 192.0.2.18 \
-              -d 1msec -t udp "sp=1024,dp=0-32768"
+              -d $MZ_DELAY -t udp "sp=1024,dp=0-32768"
 
        local t1_111=$(tc_rule_stats_get $ul2 111 ingress)
        local t1_222=$(tc_rule_stats_get $ul2 222 ingress)
index 6228189..7d5b2b9 100755 (executable)
@@ -244,7 +244,7 @@ multipath4_test()
 
        ip vrf exec v$h1 \
           $MZ $h1 -q -p 64 -A 192.0.2.1 -B 192.0.2.18 \
-              -d 1msec -t udp "sp=1024,dp=0-32768"
+              -d $MZ_DELAY -t udp "sp=1024,dp=0-32768"
 
        local t1_111=$(tc_rule_stats_get $ul2 111 ingress)
        local t1_222=$(tc_rule_stats_get $ul2 222 ingress)
@@ -271,7 +271,7 @@ multipath6_test()
 
        ip vrf exec v$h1 \
                $MZ $h1 -6 -q -p 64 -A 2001:db8:1::1 -B 2001:db8:2::2 \
-               -d 1msec -t udp "sp=1024,dp=0-32768"
+               -d $MZ_DELAY -t udp "sp=1024,dp=0-32768"
 
        local t1_111=$(tc_rule_stats_get $ul2 111 ingress)
        local t1_222=$(tc_rule_stats_get $ul2 222 ingress)
index 2085111..370f992 100755 (executable)
@@ -247,7 +247,7 @@ multipath4_test()
 
        ip vrf exec v$h1 \
           $MZ $h1 -q -p 64 -A 192.0.2.1 -B 192.0.2.18 \
-              -d 1msec -t udp "sp=1024,dp=0-32768"
+              -d $MZ_DELAY -t udp "sp=1024,dp=0-32768"
 
        local t1_111=$(tc_rule_stats_get $ul2 111 ingress)
        local t1_222=$(tc_rule_stats_get $ul2 222 ingress)
@@ -275,7 +275,7 @@ multipath6_test()
 
        ip vrf exec v$h1 \
                $MZ $h1 -6 -q -p 64 -A 2001:db8:1::1 -B 2001:db8:2::2 \
-               -d 1msec -t udp "sp=1024,dp=0-32768"
+               -d $MZ_DELAY -t udp "sp=1024,dp=0-32768"
 
        local t1_111=$(tc_rule_stats_get $ul2 111 ingress)
        local t1_222=$(tc_rule_stats_get $ul2 222 ingress)
index d40183b..2ab9eaa 100755 (executable)
@@ -280,42 +280,42 @@ send_src_ipv4()
 {
        ip vrf exec v$h1 $MZ $h1 -q -p 64 \
                -A "198.51.100.2-198.51.100.253" -B 203.0.113.2 \
-               -d 1msec -c 50 -t udp "sp=20000,dp=30000"
+               -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000"
 }
 
 send_dst_ipv4()
 {
        ip vrf exec v$h1 $MZ $h1 -q -p 64 \
                -A 198.51.100.2 -B "203.0.113.2-203.0.113.253" \
-               -d 1msec -c 50 -t udp "sp=20000,dp=30000"
+               -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000"
 }
 
 send_src_udp4()
 {
        ip vrf exec v$h1 $MZ $h1 -q -p 64 \
                -A 198.51.100.2 -B 203.0.113.2 \
-               -d 1msec -t udp "sp=0-32768,dp=30000"
+               -d $MZ_DELAY -t udp "sp=0-32768,dp=30000"
 }
 
 send_dst_udp4()
 {
        ip vrf exec v$h1 $MZ $h1 -q -p 64 \
                -A 198.51.100.2 -B 203.0.113.2 \
-               -d 1msec -t udp "sp=20000,dp=0-32768"
+               -d $MZ_DELAY -t udp "sp=20000,dp=0-32768"
 }
 
 send_src_ipv6()
 {
        ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \
                -A "2001:db8:1::2-2001:db8:1::fd" -B 2001:db8:2::2 \
-               -d 1msec -c 50 -t udp "sp=20000,dp=30000"
+               -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000"
 }
 
 send_dst_ipv6()
 {
        ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \
                -A 2001:db8:1::2 -B "2001:db8:2::2-2001:db8:2::fd" \
-               -d 1msec -c 50 -t udp "sp=20000,dp=30000"
+               -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000"
 }
 
 send_flowlabel()
@@ -331,14 +331,14 @@ send_src_udp6()
 {
        ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \
                -A 2001:db8:1::2 -B 2001:db8:2::2 \
-               -d 1msec -t udp "sp=0-32768,dp=30000"
+               -d $MZ_DELAY -t udp "sp=0-32768,dp=30000"
 }
 
 send_dst_udp6()
 {
        ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \
                -A 2001:db8:1::2 -B 2001:db8:2::2 \
-               -d 1msec -t udp "sp=20000,dp=0-32768"
+               -d $MZ_DELAY -t udp "sp=20000,dp=0-32768"
 }
 
 custom_hash_test()
index a257979..32d1461 100755 (executable)
@@ -266,7 +266,7 @@ multipath4_test()
 
        ip vrf exec v$h1 \
           $MZ $h1 -q -p 64 -A "192.0.3.2-192.0.3.62" -B "192.0.4.2-192.0.4.62" \
-              -d 1msec -c 50 -t udp "sp=1024,dp=1024"
+              -d $MZ_DELAY -c 50 -t udp "sp=1024,dp=1024"
        sleep 1
 
        local t1_111=$(tc_rule_stats_get $ul32 111 ingress)
index d208f52..eb4e50d 100755 (executable)
@@ -267,7 +267,7 @@ multipath6_test()
        ip vrf exec v$h1 \
           $MZ $h1 -6 -q -p 64 -A "2001:db8:1::2-2001:db8:1::1e" \
               -B "2001:db8:2::2-2001:db8:2::1e" \
-              -d 1msec -c 50 -t udp "sp=1024,dp=1024"
+              -d $MZ_DELAY -c 50 -t udp "sp=1024,dp=1024"
        sleep 1
 
        local t1_111=$(tc_rule_stats_get $ul32 111 ingress)
index 58a3597..24f4ab3 100644 (file)
@@ -356,7 +356,7 @@ test_traffic_ip4ip6()
                flower $TC_FLAG dst_ip 203.0.113.1 action pass
 
        $MZ $h1 -c 1000 -p 64 -a $h1mac -b $ol1mac -A 198.51.100.1 \
-               -B 203.0.113.1 -t ip -q -d 1msec
+               -B 203.0.113.1 -t ip -q -d $MZ_DELAY
 
        # Check ports after encap and after decap.
        tc_check_at_least_x_packets "dev $ul1 egress" 101 1000
@@ -389,7 +389,7 @@ test_traffic_ip6ip6()
                flower $TC_FLAG dst_ip 2001:db8:2::1 action pass
 
        $MZ -6 $h1 -c 1000 -p 64 -a $h1mac -b $ol1mac -A 2001:db8:1::1 \
-               -B 2001:db8:2::1 -t ip -q -d 1msec
+               -B 2001:db8:2::1 -t ip -q -d $MZ_DELAY
 
        # Check ports after encap and after decap.
        tc_check_at_least_x_packets "dev $ul1 egress" 101 1000
index db3688f..d1bf39e 100644 (file)
@@ -8,6 +8,7 @@
 PING=${PING:=ping}
 PING6=${PING6:=ping6}
 MZ=${MZ:=mausezahn}
+MZ_DELAY=${MZ_DELAY:=0}
 ARPING=${ARPING:=arping}
 TEAMD=${TEAMD:=teamd}
 WAIT_TIME=${WAIT_TIME:=5}
index 2ef469f..982e0d0 100755 (executable)
@@ -204,7 +204,7 @@ multipath4_test()
        t0_rp13=$(link_stats_tx_packets_get $rp13)
 
        ip vrf exec vrf-h1 $MZ $h1 -q -p 64 -A 192.0.2.2 -B 198.51.100.2 \
-               -d 1msec -t udp "sp=1024,dp=0-32768"
+               -d $MZ_DELAY -t udp "sp=1024,dp=0-32768"
 
        t1_rp12=$(link_stats_tx_packets_get $rp12)
        t1_rp13=$(link_stats_tx_packets_get $rp13)
@@ -237,7 +237,7 @@ multipath6_test()
        t0_rp13=$(link_stats_tx_packets_get $rp13)
 
        $MZ $h1 -6 -q -p 64 -A 2001:db8:1::2 -B 2001:db8:2::2 \
-               -d 1msec -t udp "sp=1024,dp=0-32768"
+               -d $MZ_DELAY -t udp "sp=1024,dp=0-32768"
 
        t1_rp12=$(link_stats_tx_packets_get $rp12)
        t1_rp13=$(link_stats_tx_packets_get $rp13)
index cb08ffe..a60ff54 100755 (executable)
@@ -205,7 +205,7 @@ multipath4_test()
        t0_rp13=$(link_stats_tx_packets_get $rp13)
 
        ip vrf exec vrf-h1 $MZ $h1 -q -p 64 -A 192.0.2.2 -B 198.51.100.2 \
-               -d 1msec -t udp "sp=1024,dp=0-32768"
+               -d $MZ_DELAY -t udp "sp=1024,dp=0-32768"
 
        t1_rp12=$(link_stats_tx_packets_get $rp12)
        t1_rp13=$(link_stats_tx_packets_get $rp13)
@@ -235,7 +235,7 @@ multipath6_l4_test()
        t0_rp13=$(link_stats_tx_packets_get $rp13)
 
        $MZ $h1 -6 -q -p 64 -A 2001:db8:1::2 -B 2001:db8:2::2 \
-               -d 1msec -t udp "sp=1024,dp=0-32768"
+               -d $MZ_DELAY -t udp "sp=1024,dp=0-32768"
 
        t1_rp12=$(link_stats_tx_packets_get $rp12)
        t1_rp13=$(link_stats_tx_packets_get $rp13)
index a4eceeb..e2be354 100755 (executable)
@@ -179,7 +179,7 @@ multipath4_test()
        t0_rp13=$(link_stats_tx_packets_get $rp13)
 
        ip vrf exec vrf-h1 $MZ $h1 -q -p 64 -A 192.0.2.2 -B 198.51.100.2 \
-              -d 1msec -t udp "sp=1024,dp=0-32768"
+              -d $MZ_DELAY -t udp "sp=1024,dp=0-32768"
 
        t1_rp12=$(link_stats_tx_packets_get $rp12)
        t1_rp13=$(link_stats_tx_packets_get $rp13)
@@ -216,7 +216,7 @@ multipath6_test()
        t0_rp13=$(link_stats_tx_packets_get $rp13)
 
        $MZ $h1 -6 -q -p 64 -A 2001:db8:1::2 -B 2001:db8:2::2 \
-              -d 1msec -t udp "sp=1024,dp=0-32768"
+              -d $MZ_DELAY -t udp "sp=1024,dp=0-32768"
 
        t1_rp12=$(link_stats_tx_packets_get $rp12)
        t1_rp13=$(link_stats_tx_packets_get $rp13)