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 56eb83d1a3bdd5fd76bf7c65b40c8f370d77bab4..1783c10215e5ce3e9912404bc31e9e959627d767 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 4a546509de9089cf93d0057438caebc477ee43ac..1fc4f0242fc53b18dd3cf624d6218c40953336e2 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 0446db9c6f7488ec1e14a5b1a0e16fa9ec3684ec..9788bd0f6e8b37d70d12d3447461d756b76b227b 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 e4009f65800317ba7ebb40427f4b1d13b7c8ce38..efca6114a3ce5a55da76b901ad0fa51e1692c081 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 e449475c4d3e98c979ecc5b5762a0709e151c92c..e5e911ce1562faf165a77479c2a310a28009ccf0 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 a8d8e8b3dc819f3abc90060eaa0d312632c2145f..57531c1d884d9d72f97ec2dac8f8a54bd0facc72 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 62281898e7a49a9cbe6bf5965aba499aeeed36bd..7d5b2b9cc1335933690e14ce3043a420461ced52 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 2085111bcd673fc6e2d988adb3cdf347375fbe1c..370f9925302dd8449d48591d288cb911d816f38a 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 d40183b4eccc8e7f2c837155df8c0431672df654..2ab9eaaa5532ae1aeb4284ba541b7b2ed6c2495f 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 a257979d3fc5b052e0d0f14858f2732712648023..32d1461f37b783ba042774ad300ce31470b9272e 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 d208f5243adea226fa79603e423d96aace59da02..eb4e50df53371ff8ad33120072c6fdf7135bec38 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 58a3597037b134e7410bf721ccb80ccb43e1bd24..24f4ab328bd2de7267eca7c66e25f86324e612c4 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 db3688f52888f32b05b1b3d04dab2f48d06e7e80..d1bf39eaf2b361bbe9904ab2ad3afa814ceea855 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 2ef469ff3bc4b3c16a70c0350d6fc7b800bcf4d9..982e0d098ea9a3aa44517875e95830f6f22e741c 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 cb08ffe2356a3f0cf70f85424d5f7449ee55ffe8..a60ff54723b7c508b59c14505fe7898c67d4c7b4 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 a4eceeb5c06ea7b8cf0d0ccbfc8297ad2c576298..e2be354167a1cbb0f4fec50a8ee321adcfe757f6 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)