Skip to content

Commit

Permalink
Merge branch 'selftests-forwarding-various-improvements'
Browse files Browse the repository at this point in the history
Ido Schimmel says:

====================
selftests: forwarding: Various improvements

This patchset speeds up the multipath tests (patches #1-#2) and makes
other tests more stable (patches #3-#6) so that they will not randomly
fail in the netdev CI.

On my system, after applying the first two patches, the run time of
gre_multipath_nh_res.sh is reduced by over 90%.
====================

Link: https://lore.kernel.org/r/20240304095612.462900-1-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
kuba-moo committed Mar 5, 2024
2 parents 00af2aa + 35df2ce commit 5ad0512
Show file tree
Hide file tree
Showing 20 changed files with 67 additions and 209 deletions.
16 changes: 8 additions & 8 deletions tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
Expand Up @@ -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()
Expand All @@ -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()
Expand Down
Expand Up @@ -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.
Expand Down
Expand Up @@ -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()
Expand All @@ -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()
Expand Down
Expand Up @@ -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)
Expand Down
Expand Up @@ -266,9 +266,9 @@ multipath6_test()
local t0_222=$(tc_rule_stats_get $ul32 222 ingress)

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"
$MZ $h1 -6 -q -p 64 -A "2001:db8:1::2-2001:db8:1::3e" \
-B "2001:db8:2::2-2001:db8:2::3e" \
-d $MZ_DELAY -c 50 -t udp "sp=1024,dp=1024"
sleep 1

local t1_111=$(tc_rule_stats_get $ul32 111 ingress)
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/net/forwarding/gre_multipath.sh
Expand Up @@ -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)
Expand Down
41 changes: 2 additions & 39 deletions tools/testing/selftests/net/forwarding/gre_multipath_nh.sh
Expand Up @@ -64,7 +64,6 @@ ALL_TESTS="
ping_ipv6
multipath_ipv4
multipath_ipv6
multipath_ipv6_l4
"

NUM_NETIFS=6
Expand Down Expand Up @@ -245,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)
Expand All @@ -264,34 +263,6 @@ multipath6_test()
local weight1=$1; shift
local weight2=$1; shift

sysctl_set net.ipv6.fib_multipath_hash_policy 0
ip nexthop replace id 103 group 101,$weight1/102,$weight2

local t0_111=$(tc_rule_stats_get $ul2 111 ingress)
local t0_222=$(tc_rule_stats_get $ul2 222 ingress)

# Generate 16384 echo requests, each with a random flow label.
for ((i=0; i < 16384; ++i)); do
ip vrf exec v$h1 $PING6 2001:db8:2::2 -F 0 -c 1 -q &> /dev/null
done

local t1_111=$(tc_rule_stats_get $ul2 111 ingress)
local t1_222=$(tc_rule_stats_get $ul2 222 ingress)

local d111=$((t1_111 - t0_111))
local d222=$((t1_222 - t0_222))
multipath_eval "$what" $weight1 $weight2 $d111 $d222

ip nexthop replace id 103 group 101/102
sysctl_restore net.ipv6.fib_multipath_hash_policy
}

multipath6_l4_test()
{
local what=$1; shift
local weight1=$1; shift
local weight2=$1; shift

sysctl_set net.ipv6.fib_multipath_hash_policy 1
ip nexthop replace id 103 group 101,$weight1/102,$weight2

Expand All @@ -300,7 +271,7 @@ multipath6_l4_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)
Expand Down Expand Up @@ -339,14 +310,6 @@ multipath_ipv6()
multipath6_test "Weighted MP 11:45" 11 45
}

multipath_ipv6_l4()
{
log_info "Running IPv6 L4 hash multipath tests"
multipath6_l4_test "ECMP" 1 1
multipath6_l4_test "Weighted MP 2:1" 2 1
multipath6_l4_test "Weighted MP 11:45" 11 45
}

trap cleanup EXIT

setup_prepare
Expand Down
42 changes: 2 additions & 40 deletions tools/testing/selftests/net/forwarding/gre_multipath_nh_res.sh
Expand Up @@ -64,7 +64,6 @@ ALL_TESTS="
ping_ipv6
multipath_ipv4
multipath_ipv6
multipath_ipv6_l4
"

NUM_NETIFS=6
Expand Down Expand Up @@ -248,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)
Expand All @@ -267,35 +266,6 @@ multipath6_test()
local weight1=$1; shift
local weight2=$1; shift

sysctl_set net.ipv6.fib_multipath_hash_policy 0
ip nexthop replace id 103 group 101,$weight1/102,$weight2 \
type resilient

local t0_111=$(tc_rule_stats_get $ul2 111 ingress)
local t0_222=$(tc_rule_stats_get $ul2 222 ingress)

# Generate 16384 echo requests, each with a random flow label.
for ((i=0; i < 16384; ++i)); do
ip vrf exec v$h1 $PING6 2001:db8:2::2 -F 0 -c 1 -q &> /dev/null
done

local t1_111=$(tc_rule_stats_get $ul2 111 ingress)
local t1_222=$(tc_rule_stats_get $ul2 222 ingress)

local d111=$((t1_111 - t0_111))
local d222=$((t1_222 - t0_222))
multipath_eval "$what" $weight1 $weight2 $d111 $d222

ip nexthop replace id 103 group 101/102 type resilient
sysctl_restore net.ipv6.fib_multipath_hash_policy
}

multipath6_l4_test()
{
local what=$1; shift
local weight1=$1; shift
local weight2=$1; shift

sysctl_set net.ipv6.fib_multipath_hash_policy 1
ip nexthop replace id 103 group 101,$weight1/102,$weight2 \
type resilient
Expand All @@ -305,7 +275,7 @@ multipath6_l4_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)
Expand Down Expand Up @@ -344,14 +314,6 @@ multipath_ipv6()
multipath6_test "Weighted MP 11:45" 11 45
}

multipath_ipv6_l4()
{
log_info "Running IPv6 L4 hash multipath tests"
multipath6_l4_test "ECMP" 1 1
multipath6_l4_test "Weighted MP 2:1" 2 1
multipath6_l4_test "Weighted MP 11:45" 11 45
}

trap cleanup EXIT

setup_prepare
Expand Down
Expand Up @@ -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()
Expand All @@ -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()
Expand Down
Expand Up @@ -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)
Expand Down

0 comments on commit 5ad0512

Please sign in to comment.