Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: router_mpath_nh_res: Test 16-bit next hop weights

Add tests that exercise full 16 bits of NH weight.

Like in the previous patch, omit the 255:65535 test when KSFT_MACHINE_SLOW.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/a91d6ead9d1b1b4b7e276ca58a71ef814f42b7dd.1723036486.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Petr Machata and committed by
Jakub Kicinski
dce0765c bb89fdac

+48 -8
+48 -8
tools/testing/selftests/net/forwarding/router_mpath_nh_res.sh
··· 40 40 ping_ipv4 41 41 ping_ipv6 42 42 multipath_test 43 + multipath16_test 43 44 nh_stats_test_v4 44 45 nh_stats_test_v6 45 46 " ··· 229 228 230 229 multipath4_test() 231 230 { 232 - local desc="$1" 233 - local weight_rp12=$2 234 - local weight_rp13=$3 231 + local desc=$1; shift 232 + local weight_rp12=$1; shift 233 + local weight_rp13=$1; shift 234 + local ports=${1-sp=1024,dp=0-32768}; shift 235 + 235 236 local t0_rp12 t0_rp13 t1_rp12 t1_rp13 236 237 local packets_rp12 packets_rp13 237 238 ··· 246 243 t0_rp13=$(link_stats_tx_packets_get $rp13) 247 244 248 245 ip vrf exec vrf-h1 $MZ $h1 -q -p 64 -A 192.0.2.2 -B 198.51.100.2 \ 249 - -d $MZ_DELAY -t udp "sp=1024,dp=0-32768" 246 + -d $MZ_DELAY -t udp "$ports" 250 247 sleep 1 251 248 252 249 t1_rp12=$(link_stats_tx_packets_get $rp12) ··· 262 259 263 260 multipath6_l4_test() 264 261 { 265 - local desc="$1" 266 - local weight_rp12=$2 267 - local weight_rp13=$3 262 + local desc=$1; shift 263 + local weight_rp12=$1; shift 264 + local weight_rp13=$1; shift 265 + local ports=${1-sp=1024,dp=0-32768}; shift 266 + 268 267 local t0_rp12 t0_rp13 t1_rp12 t1_rp13 269 268 local packets_rp12 packets_rp13 270 269 ··· 279 274 t0_rp13=$(link_stats_tx_packets_get $rp13) 280 275 281 276 $MZ $h1 -6 -q -p 64 -A 2001:db8:1::2 -B 2001:db8:2::2 \ 282 - -d $MZ_DELAY -t udp "sp=1024,dp=0-32768" 277 + -d $MZ_DELAY -t udp "$ports" 283 278 sleep 1 284 279 285 280 t1_rp12=$(link_stats_tx_packets_get $rp12) ··· 374 369 sleep 10 375 370 ip nexthop replace id 106 group 104,11/105,45 type resilient 376 371 multipath6_l4_test "Weighted MP 11:45" 11 45 372 + 373 + ip nexthop replace id 106 group 104,1/105,1 type resilient 374 + } 375 + 376 + multipath16_test() 377 + { 378 + check_nhgw16 104 || return 379 + 380 + log_info "Running 16-bit IPv4 multipath tests" 381 + ip nexthop replace id 103 group 101/102 type resilient idle_timer 0 382 + 383 + ip nexthop replace id 103 group 101,65535/102,65535 type resilient 384 + multipath4_test "65535:65535" 65535 65535 385 + 386 + ip nexthop replace id 103 group 101,128/102,512 type resilient 387 + multipath4_test "128:512" 128 512 388 + 389 + ip nexthop replace id 103 group 101,255/102,65535 type resilient 390 + omit_on_slow \ 391 + multipath4_test "255:65535" 255 65535 sp=1024-1026,dp=0-65535 392 + 393 + ip nexthop replace id 103 group 101,1/102,1 type resilient 394 + 395 + log_info "Running 16-bit IPv6 L4 hash multipath tests" 396 + ip nexthop replace id 106 group 104/105 type resilient idle_timer 0 397 + 398 + ip nexthop replace id 106 group 104,65535/105,65535 type resilient 399 + multipath6_l4_test "65535:65535" 65535 65535 400 + 401 + ip nexthop replace id 106 group 104,128/105,512 type resilient 402 + multipath6_l4_test "128:512" 128 512 403 + 404 + ip nexthop replace id 106 group 104,255/105,65535 type resilient 405 + omit_on_slow \ 406 + multipath6_l4_test "255:65535" 255 65535 sp=1024-1026,dp=0-65535 377 407 378 408 ip nexthop replace id 106 group 104,1/105,1 type resilient 379 409 }