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

selftests: forwarding: Remove IPv6 L3 multipath hash tests

The multipath tests currently test both the L3 and L4 multipath hash
policies for IPv6, but only the L4 policy for IPv4. The reason is mostly
historic: When the initial multipath test was added
(router_multipath.sh) the IPv6 L4 policy did not exist and was later
added to the test. The other multipath tests copied this pattern
although there is little value in testing both policies.

Align the IPv4 and IPv6 tests and only test the L4 policy. On my system,
this reduces the run time of router_multipath.sh by 89% because of the
repeated ping6 invocations to randomize the flow label.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/r/20240304095612.462900-2-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Ido Schimmel and committed by
Jakub Kicinski
7b2d64f9 00af2aa9

+2 -147
-37
tools/testing/selftests/net/forwarding/gre_multipath_nh.sh
··· 64 64 ping_ipv6 65 65 multipath_ipv4 66 66 multipath_ipv6 67 - multipath_ipv6_l4 68 67 " 69 68 70 69 NUM_NETIFS=6 ··· 263 264 local weight1=$1; shift 264 265 local weight2=$1; shift 265 266 266 - sysctl_set net.ipv6.fib_multipath_hash_policy 0 267 - ip nexthop replace id 103 group 101,$weight1/102,$weight2 268 - 269 - local t0_111=$(tc_rule_stats_get $ul2 111 ingress) 270 - local t0_222=$(tc_rule_stats_get $ul2 222 ingress) 271 - 272 - # Generate 16384 echo requests, each with a random flow label. 273 - for ((i=0; i < 16384; ++i)); do 274 - ip vrf exec v$h1 $PING6 2001:db8:2::2 -F 0 -c 1 -q &> /dev/null 275 - done 276 - 277 - local t1_111=$(tc_rule_stats_get $ul2 111 ingress) 278 - local t1_222=$(tc_rule_stats_get $ul2 222 ingress) 279 - 280 - local d111=$((t1_111 - t0_111)) 281 - local d222=$((t1_222 - t0_222)) 282 - multipath_eval "$what" $weight1 $weight2 $d111 $d222 283 - 284 - ip nexthop replace id 103 group 101/102 285 - sysctl_restore net.ipv6.fib_multipath_hash_policy 286 - } 287 - 288 - multipath6_l4_test() 289 - { 290 - local what=$1; shift 291 - local weight1=$1; shift 292 - local weight2=$1; shift 293 - 294 267 sysctl_set net.ipv6.fib_multipath_hash_policy 1 295 268 ip nexthop replace id 103 group 101,$weight1/102,$weight2 296 269 ··· 308 337 multipath6_test "ECMP" 1 1 309 338 multipath6_test "Weighted MP 2:1" 2 1 310 339 multipath6_test "Weighted MP 11:45" 11 45 311 - } 312 - 313 - multipath_ipv6_l4() 314 - { 315 - log_info "Running IPv6 L4 hash multipath tests" 316 - multipath6_l4_test "ECMP" 1 1 317 - multipath6_l4_test "Weighted MP 2:1" 2 1 318 - multipath6_l4_test "Weighted MP 11:45" 11 45 319 340 } 320 341 321 342 trap cleanup EXIT
-38
tools/testing/selftests/net/forwarding/gre_multipath_nh_res.sh
··· 64 64 ping_ipv6 65 65 multipath_ipv4 66 66 multipath_ipv6 67 - multipath_ipv6_l4 68 67 " 69 68 70 69 NUM_NETIFS=6 ··· 266 267 local weight1=$1; shift 267 268 local weight2=$1; shift 268 269 269 - sysctl_set net.ipv6.fib_multipath_hash_policy 0 270 - ip nexthop replace id 103 group 101,$weight1/102,$weight2 \ 271 - type resilient 272 - 273 - local t0_111=$(tc_rule_stats_get $ul2 111 ingress) 274 - local t0_222=$(tc_rule_stats_get $ul2 222 ingress) 275 - 276 - # Generate 16384 echo requests, each with a random flow label. 277 - for ((i=0; i < 16384; ++i)); do 278 - ip vrf exec v$h1 $PING6 2001:db8:2::2 -F 0 -c 1 -q &> /dev/null 279 - done 280 - 281 - local t1_111=$(tc_rule_stats_get $ul2 111 ingress) 282 - local t1_222=$(tc_rule_stats_get $ul2 222 ingress) 283 - 284 - local d111=$((t1_111 - t0_111)) 285 - local d222=$((t1_222 - t0_222)) 286 - multipath_eval "$what" $weight1 $weight2 $d111 $d222 287 - 288 - ip nexthop replace id 103 group 101/102 type resilient 289 - sysctl_restore net.ipv6.fib_multipath_hash_policy 290 - } 291 - 292 - multipath6_l4_test() 293 - { 294 - local what=$1; shift 295 - local weight1=$1; shift 296 - local weight2=$1; shift 297 - 298 270 sysctl_set net.ipv6.fib_multipath_hash_policy 1 299 271 ip nexthop replace id 103 group 101,$weight1/102,$weight2 \ 300 272 type resilient ··· 312 342 multipath6_test "ECMP" 1 1 313 343 multipath6_test "Weighted MP 2:1" 2 1 314 344 multipath6_test "Weighted MP 11:45" 11 45 315 - } 316 - 317 - multipath_ipv6_l4() 318 - { 319 - log_info "Running IPv6 L4 hash multipath tests" 320 - multipath6_l4_test "ECMP" 1 1 321 - multipath6_l4_test "Weighted MP 2:1" 2 1 322 - multipath6_l4_test "Weighted MP 11:45" 11 45 323 345 } 324 346 325 347 trap cleanup EXIT
+1 -34
tools/testing/selftests/net/forwarding/router_mpath_nh.sh
··· 218 218 sysctl_restore net.ipv4.fib_multipath_hash_policy 219 219 } 220 220 221 - multipath6_l4_test() 221 + multipath6_test() 222 222 { 223 223 local desc="$1" 224 224 local weight_rp12=$2 ··· 251 251 sysctl_restore net.ipv6.fib_multipath_hash_policy 252 252 } 253 253 254 - multipath6_test() 255 - { 256 - local desc="$1" 257 - local weight_rp12=$2 258 - local weight_rp13=$3 259 - local t0_rp12 t0_rp13 t1_rp12 t1_rp13 260 - local packets_rp12 packets_rp13 261 - 262 - ip nexthop replace id 106 group 104,$weight_rp12/105,$weight_rp13 263 - 264 - t0_rp12=$(link_stats_tx_packets_get $rp12) 265 - t0_rp13=$(link_stats_tx_packets_get $rp13) 266 - 267 - # Generate 16384 echo requests, each with a random flow label. 268 - for _ in $(seq 1 16384); do 269 - ip vrf exec vrf-h1 $PING6 2001:db8:2::2 -F 0 -c 1 -q >/dev/null 2>&1 270 - done 271 - 272 - t1_rp12=$(link_stats_tx_packets_get $rp12) 273 - t1_rp13=$(link_stats_tx_packets_get $rp13) 274 - 275 - let "packets_rp12 = $t1_rp12 - $t0_rp12" 276 - let "packets_rp13 = $t1_rp13 - $t0_rp13" 277 - multipath_eval "$desc" $weight_rp12 $weight_rp13 $packets_rp12 $packets_rp13 278 - 279 - ip nexthop replace id 106 group 104/105 280 - } 281 - 282 254 multipath_test() 283 255 { 284 256 log_info "Running IPv4 multipath tests" ··· 273 301 multipath6_test "ECMP" 1 1 274 302 multipath6_test "Weighted MP 2:1" 2 1 275 303 multipath6_test "Weighted MP 11:45" 11 45 276 - 277 - log_info "Running IPv6 L4 hash multipath tests" 278 - multipath6_l4_test "ECMP" 1 1 279 - multipath6_l4_test "Weighted MP 2:1" 2 1 280 - multipath6_l4_test "Weighted MP 11:45" 11 45 281 304 } 282 305 283 306 ping_ipv4_blackhole()
+1 -38
tools/testing/selftests/net/forwarding/router_multipath.sh
··· 195 195 sysctl_restore net.ipv4.fib_multipath_hash_policy 196 196 } 197 197 198 - multipath6_l4_test() 198 + multipath6_test() 199 199 { 200 200 local desc="$1" 201 201 local weight_rp12=$2 ··· 232 232 sysctl_restore net.ipv6.fib_multipath_hash_policy 233 233 } 234 234 235 - multipath6_test() 236 - { 237 - local desc="$1" 238 - local weight_rp12=$2 239 - local weight_rp13=$3 240 - local t0_rp12 t0_rp13 t1_rp12 t1_rp13 241 - local packets_rp12 packets_rp13 242 - 243 - ip route replace 2001:db8:2::/64 vrf vrf-r1 \ 244 - nexthop via fe80:2::22 dev $rp12 weight $weight_rp12 \ 245 - nexthop via fe80:3::23 dev $rp13 weight $weight_rp13 246 - 247 - t0_rp12=$(link_stats_tx_packets_get $rp12) 248 - t0_rp13=$(link_stats_tx_packets_get $rp13) 249 - 250 - # Generate 16384 echo requests, each with a random flow label. 251 - for _ in $(seq 1 16384); do 252 - ip vrf exec vrf-h1 $PING6 2001:db8:2::2 -F 0 -c 1 -q &> /dev/null 253 - done 254 - 255 - t1_rp12=$(link_stats_tx_packets_get $rp12) 256 - t1_rp13=$(link_stats_tx_packets_get $rp13) 257 - 258 - let "packets_rp12 = $t1_rp12 - $t0_rp12" 259 - let "packets_rp13 = $t1_rp13 - $t0_rp13" 260 - multipath_eval "$desc" $weight_rp12 $weight_rp13 $packets_rp12 $packets_rp13 261 - 262 - ip route replace 2001:db8:2::/64 vrf vrf-r1 \ 263 - nexthop via fe80:2::22 dev $rp12 \ 264 - nexthop via fe80:3::23 dev $rp13 265 - } 266 - 267 235 multipath_test() 268 236 { 269 237 log_info "Running IPv4 multipath tests" ··· 243 275 multipath6_test "ECMP" 1 1 244 276 multipath6_test "Weighted MP 2:1" 2 1 245 277 multipath6_test "Weighted MP 11:45" 11 45 246 - 247 - log_info "Running IPv6 L4 hash multipath tests" 248 - multipath6_l4_test "ECMP" 1 1 249 - multipath6_l4_test "Weighted MP 2:1" 2 1 250 - multipath6_l4_test "Weighted MP 11:45" 11 45 251 278 } 252 279 253 280 setup_prepare()