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

selftests: forwarding: Parametrize mausezahn delay

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>

authored by

Ido Schimmel and committed by
Jakub Kicinski
748d2744 7b2d64f9

+44 -41
+8 -8
tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
··· 183 183 { 184 184 ip vrf exec v$h1 $MZ $h1 -q -p 64 \ 185 185 -A "198.51.100.2-198.51.100.253" -B 203.0.113.2 \ 186 - -d 1msec -c 50 -t udp "sp=20000,dp=30000" 186 + -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000" 187 187 } 188 188 189 189 send_dst_ipv4() 190 190 { 191 191 ip vrf exec v$h1 $MZ $h1 -q -p 64 \ 192 192 -A 198.51.100.2 -B "203.0.113.2-203.0.113.253" \ 193 - -d 1msec -c 50 -t udp "sp=20000,dp=30000" 193 + -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000" 194 194 } 195 195 196 196 send_src_udp4() 197 197 { 198 198 ip vrf exec v$h1 $MZ $h1 -q -p 64 \ 199 199 -A 198.51.100.2 -B 203.0.113.2 \ 200 - -d 1msec -t udp "sp=0-32768,dp=30000" 200 + -d $MZ_DELAY -t udp "sp=0-32768,dp=30000" 201 201 } 202 202 203 203 send_dst_udp4() 204 204 { 205 205 ip vrf exec v$h1 $MZ $h1 -q -p 64 \ 206 206 -A 198.51.100.2 -B 203.0.113.2 \ 207 - -d 1msec -t udp "sp=20000,dp=0-32768" 207 + -d $MZ_DELAY -t udp "sp=20000,dp=0-32768" 208 208 } 209 209 210 210 send_src_ipv6() 211 211 { 212 212 ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ 213 213 -A "2001:db8:1::2-2001:db8:1::fd" -B 2001:db8:4::2 \ 214 - -d 1msec -c 50 -t udp "sp=20000,dp=30000" 214 + -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000" 215 215 } 216 216 217 217 send_dst_ipv6() 218 218 { 219 219 ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ 220 220 -A 2001:db8:1::2 -B "2001:db8:4::2-2001:db8:4::fd" \ 221 - -d 1msec -c 50 -t udp "sp=20000,dp=30000" 221 + -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000" 222 222 } 223 223 224 224 send_flowlabel() ··· 234 234 { 235 235 ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ 236 236 -A 2001:db8:1::2 -B 2001:db8:4::2 \ 237 - -d 1msec -t udp "sp=0-32768,dp=30000" 237 + -d $MZ_DELAY -t udp "sp=0-32768,dp=30000" 238 238 } 239 239 240 240 send_dst_udp6() 241 241 { 242 242 ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ 243 243 -A 2001:db8:1::2 -B 2001:db8:4::2 \ 244 - -d 1msec -t udp "sp=20000,dp=0-32768" 244 + -d $MZ_DELAY -t udp "sp=20000,dp=0-32768" 245 245 } 246 246 247 247 custom_hash_test()
+2
tools/testing/selftests/net/forwarding/forwarding.config.sample
··· 28 28 PING6=ping6 29 29 # Packet generator. Some distributions use 'mz'. 30 30 MZ=mausezahn 31 + # mausezahn delay between transmissions in microseconds. 32 + MZ_DELAY=0 31 33 # Time to wait after interfaces participating in the test are all UP 32 34 WAIT_TIME=5 33 35 # Whether to pause on failure or not.
+8 -8
tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh
··· 278 278 { 279 279 ip vrf exec v$h1 $MZ $h1 -q -p 64 \ 280 280 -A "198.51.100.2-198.51.100.253" -B 203.0.113.2 \ 281 - -d 1msec -c 50 -t udp "sp=20000,dp=30000" 281 + -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000" 282 282 } 283 283 284 284 send_dst_ipv4() 285 285 { 286 286 ip vrf exec v$h1 $MZ $h1 -q -p 64 \ 287 287 -A 198.51.100.2 -B "203.0.113.2-203.0.113.253" \ 288 - -d 1msec -c 50 -t udp "sp=20000,dp=30000" 288 + -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000" 289 289 } 290 290 291 291 send_src_udp4() 292 292 { 293 293 ip vrf exec v$h1 $MZ $h1 -q -p 64 \ 294 294 -A 198.51.100.2 -B 203.0.113.2 \ 295 - -d 1msec -t udp "sp=0-32768,dp=30000" 295 + -d $MZ_DELAY -t udp "sp=0-32768,dp=30000" 296 296 } 297 297 298 298 send_dst_udp4() 299 299 { 300 300 ip vrf exec v$h1 $MZ $h1 -q -p 64 \ 301 301 -A 198.51.100.2 -B 203.0.113.2 \ 302 - -d 1msec -t udp "sp=20000,dp=0-32768" 302 + -d $MZ_DELAY -t udp "sp=20000,dp=0-32768" 303 303 } 304 304 305 305 send_src_ipv6() 306 306 { 307 307 ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ 308 308 -A "2001:db8:1::2-2001:db8:1::fd" -B 2001:db8:2::2 \ 309 - -d 1msec -c 50 -t udp "sp=20000,dp=30000" 309 + -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000" 310 310 } 311 311 312 312 send_dst_ipv6() 313 313 { 314 314 ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ 315 315 -A 2001:db8:1::2 -B "2001:db8:2::2-2001:db8:2::fd" \ 316 - -d 1msec -c 50 -t udp "sp=20000,dp=30000" 316 + -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000" 317 317 } 318 318 319 319 send_flowlabel() ··· 329 329 { 330 330 ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ 331 331 -A 2001:db8:1::2 -B 2001:db8:2::2 \ 332 - -d 1msec -t udp "sp=0-32768,dp=30000" 332 + -d $MZ_DELAY -t udp "sp=0-32768,dp=30000" 333 333 } 334 334 335 335 send_dst_udp6() 336 336 { 337 337 ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ 338 338 -A 2001:db8:1::2 -B 2001:db8:2::2 \ 339 - -d 1msec -t udp "sp=20000,dp=0-32768" 339 + -d $MZ_DELAY -t udp "sp=20000,dp=0-32768" 340 340 } 341 341 342 342 custom_hash_test()
+1 -1
tools/testing/selftests/net/forwarding/gre_inner_v4_multipath.sh
··· 267 267 268 268 ip vrf exec v$h1 \ 269 269 $MZ $h1 -q -p 64 -A "192.0.3.2-192.0.3.62" -B "192.0.4.2-192.0.4.62" \ 270 - -d 1msec -c 50 -t udp "sp=1024,dp=1024" 270 + -d $MZ_DELAY -c 50 -t udp "sp=1024,dp=1024" 271 271 sleep 1 272 272 273 273 local t1_111=$(tc_rule_stats_get $ul32 111 ingress)
+1 -1
tools/testing/selftests/net/forwarding/gre_inner_v6_multipath.sh
··· 268 268 ip vrf exec v$h1 \ 269 269 $MZ $h1 -6 -q -p 64 -A "2001:db8:1::2-2001:db8:1::1e" \ 270 270 -B "2001:db8:2::2-2001:db8:2::1e" \ 271 - -d 1msec -c 50 -t udp "sp=1024,dp=1024" 271 + -d $MZ_DELAY -c 50 -t udp "sp=1024,dp=1024" 272 272 sleep 1 273 273 274 274 local t1_111=$(tc_rule_stats_get $ul32 111 ingress)
+1 -1
tools/testing/selftests/net/forwarding/gre_multipath.sh
··· 220 220 221 221 ip vrf exec v$h1 \ 222 222 $MZ $h1 -q -p 64 -A 192.0.2.1 -B 192.0.2.18 \ 223 - -d 1msec -t udp "sp=1024,dp=0-32768" 223 + -d $MZ_DELAY -t udp "sp=1024,dp=0-32768" 224 224 225 225 local t1_111=$(tc_rule_stats_get $ul2 111 ingress) 226 226 local t1_222=$(tc_rule_stats_get $ul2 222 ingress)
+2 -2
tools/testing/selftests/net/forwarding/gre_multipath_nh.sh
··· 244 244 245 245 ip vrf exec v$h1 \ 246 246 $MZ $h1 -q -p 64 -A 192.0.2.1 -B 192.0.2.18 \ 247 - -d 1msec -t udp "sp=1024,dp=0-32768" 247 + -d $MZ_DELAY -t udp "sp=1024,dp=0-32768" 248 248 249 249 local t1_111=$(tc_rule_stats_get $ul2 111 ingress) 250 250 local t1_222=$(tc_rule_stats_get $ul2 222 ingress) ··· 271 271 272 272 ip vrf exec v$h1 \ 273 273 $MZ $h1 -6 -q -p 64 -A 2001:db8:1::1 -B 2001:db8:2::2 \ 274 - -d 1msec -t udp "sp=1024,dp=0-32768" 274 + -d $MZ_DELAY -t udp "sp=1024,dp=0-32768" 275 275 276 276 local t1_111=$(tc_rule_stats_get $ul2 111 ingress) 277 277 local t1_222=$(tc_rule_stats_get $ul2 222 ingress)
+2 -2
tools/testing/selftests/net/forwarding/gre_multipath_nh_res.sh
··· 247 247 248 248 ip vrf exec v$h1 \ 249 249 $MZ $h1 -q -p 64 -A 192.0.2.1 -B 192.0.2.18 \ 250 - -d 1msec -t udp "sp=1024,dp=0-32768" 250 + -d $MZ_DELAY -t udp "sp=1024,dp=0-32768" 251 251 252 252 local t1_111=$(tc_rule_stats_get $ul2 111 ingress) 253 253 local t1_222=$(tc_rule_stats_get $ul2 222 ingress) ··· 275 275 276 276 ip vrf exec v$h1 \ 277 277 $MZ $h1 -6 -q -p 64 -A 2001:db8:1::1 -B 2001:db8:2::2 \ 278 - -d 1msec -t udp "sp=1024,dp=0-32768" 278 + -d $MZ_DELAY -t udp "sp=1024,dp=0-32768" 279 279 280 280 local t1_111=$(tc_rule_stats_get $ul2 111 ingress) 281 281 local t1_222=$(tc_rule_stats_get $ul2 222 ingress)
+8 -8
tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh
··· 280 280 { 281 281 ip vrf exec v$h1 $MZ $h1 -q -p 64 \ 282 282 -A "198.51.100.2-198.51.100.253" -B 203.0.113.2 \ 283 - -d 1msec -c 50 -t udp "sp=20000,dp=30000" 283 + -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000" 284 284 } 285 285 286 286 send_dst_ipv4() 287 287 { 288 288 ip vrf exec v$h1 $MZ $h1 -q -p 64 \ 289 289 -A 198.51.100.2 -B "203.0.113.2-203.0.113.253" \ 290 - -d 1msec -c 50 -t udp "sp=20000,dp=30000" 290 + -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000" 291 291 } 292 292 293 293 send_src_udp4() 294 294 { 295 295 ip vrf exec v$h1 $MZ $h1 -q -p 64 \ 296 296 -A 198.51.100.2 -B 203.0.113.2 \ 297 - -d 1msec -t udp "sp=0-32768,dp=30000" 297 + -d $MZ_DELAY -t udp "sp=0-32768,dp=30000" 298 298 } 299 299 300 300 send_dst_udp4() 301 301 { 302 302 ip vrf exec v$h1 $MZ $h1 -q -p 64 \ 303 303 -A 198.51.100.2 -B 203.0.113.2 \ 304 - -d 1msec -t udp "sp=20000,dp=0-32768" 304 + -d $MZ_DELAY -t udp "sp=20000,dp=0-32768" 305 305 } 306 306 307 307 send_src_ipv6() 308 308 { 309 309 ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ 310 310 -A "2001:db8:1::2-2001:db8:1::fd" -B 2001:db8:2::2 \ 311 - -d 1msec -c 50 -t udp "sp=20000,dp=30000" 311 + -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000" 312 312 } 313 313 314 314 send_dst_ipv6() 315 315 { 316 316 ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ 317 317 -A 2001:db8:1::2 -B "2001:db8:2::2-2001:db8:2::fd" \ 318 - -d 1msec -c 50 -t udp "sp=20000,dp=30000" 318 + -d $MZ_DELAY -c 50 -t udp "sp=20000,dp=30000" 319 319 } 320 320 321 321 send_flowlabel() ··· 331 331 { 332 332 ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ 333 333 -A 2001:db8:1::2 -B 2001:db8:2::2 \ 334 - -d 1msec -t udp "sp=0-32768,dp=30000" 334 + -d $MZ_DELAY -t udp "sp=0-32768,dp=30000" 335 335 } 336 336 337 337 send_dst_udp6() 338 338 { 339 339 ip vrf exec v$h1 $MZ -6 $h1 -q -p 64 \ 340 340 -A 2001:db8:1::2 -B 2001:db8:2::2 \ 341 - -d 1msec -t udp "sp=20000,dp=0-32768" 341 + -d $MZ_DELAY -t udp "sp=20000,dp=0-32768" 342 342 } 343 343 344 344 custom_hash_test()
+1 -1
tools/testing/selftests/net/forwarding/ip6gre_inner_v4_multipath.sh
··· 266 266 267 267 ip vrf exec v$h1 \ 268 268 $MZ $h1 -q -p 64 -A "192.0.3.2-192.0.3.62" -B "192.0.4.2-192.0.4.62" \ 269 - -d 1msec -c 50 -t udp "sp=1024,dp=1024" 269 + -d $MZ_DELAY -c 50 -t udp "sp=1024,dp=1024" 270 270 sleep 1 271 271 272 272 local t1_111=$(tc_rule_stats_get $ul32 111 ingress)
+1 -1
tools/testing/selftests/net/forwarding/ip6gre_inner_v6_multipath.sh
··· 267 267 ip vrf exec v$h1 \ 268 268 $MZ $h1 -6 -q -p 64 -A "2001:db8:1::2-2001:db8:1::1e" \ 269 269 -B "2001:db8:2::2-2001:db8:2::1e" \ 270 - -d 1msec -c 50 -t udp "sp=1024,dp=1024" 270 + -d $MZ_DELAY -c 50 -t udp "sp=1024,dp=1024" 271 271 sleep 1 272 272 273 273 local t1_111=$(tc_rule_stats_get $ul32 111 ingress)
+2 -2
tools/testing/selftests/net/forwarding/ip6gre_lib.sh
··· 356 356 flower $TC_FLAG dst_ip 203.0.113.1 action pass 357 357 358 358 $MZ $h1 -c 1000 -p 64 -a $h1mac -b $ol1mac -A 198.51.100.1 \ 359 - -B 203.0.113.1 -t ip -q -d 1msec 359 + -B 203.0.113.1 -t ip -q -d $MZ_DELAY 360 360 361 361 # Check ports after encap and after decap. 362 362 tc_check_at_least_x_packets "dev $ul1 egress" 101 1000 ··· 389 389 flower $TC_FLAG dst_ip 2001:db8:2::1 action pass 390 390 391 391 $MZ -6 $h1 -c 1000 -p 64 -a $h1mac -b $ol1mac -A 2001:db8:1::1 \ 392 - -B 2001:db8:2::1 -t ip -q -d 1msec 392 + -B 2001:db8:2::1 -t ip -q -d $MZ_DELAY 393 393 394 394 # Check ports after encap and after decap. 395 395 tc_check_at_least_x_packets "dev $ul1 egress" 101 1000
+1
tools/testing/selftests/net/forwarding/lib.sh
··· 8 8 PING=${PING:=ping} 9 9 PING6=${PING6:=ping6} 10 10 MZ=${MZ:=mausezahn} 11 + MZ_DELAY=${MZ_DELAY:=0} 11 12 ARPING=${ARPING:=arping} 12 13 TEAMD=${TEAMD:=teamd} 13 14 WAIT_TIME=${WAIT_TIME:=5}
+2 -2
tools/testing/selftests/net/forwarding/router_mpath_nh.sh
··· 204 204 t0_rp13=$(link_stats_tx_packets_get $rp13) 205 205 206 206 ip vrf exec vrf-h1 $MZ $h1 -q -p 64 -A 192.0.2.2 -B 198.51.100.2 \ 207 - -d 1msec -t udp "sp=1024,dp=0-32768" 207 + -d $MZ_DELAY -t udp "sp=1024,dp=0-32768" 208 208 209 209 t1_rp12=$(link_stats_tx_packets_get $rp12) 210 210 t1_rp13=$(link_stats_tx_packets_get $rp13) ··· 237 237 t0_rp13=$(link_stats_tx_packets_get $rp13) 238 238 239 239 $MZ $h1 -6 -q -p 64 -A 2001:db8:1::2 -B 2001:db8:2::2 \ 240 - -d 1msec -t udp "sp=1024,dp=0-32768" 240 + -d $MZ_DELAY -t udp "sp=1024,dp=0-32768" 241 241 242 242 t1_rp12=$(link_stats_tx_packets_get $rp12) 243 243 t1_rp13=$(link_stats_tx_packets_get $rp13)
+2 -2
tools/testing/selftests/net/forwarding/router_mpath_nh_res.sh
··· 205 205 t0_rp13=$(link_stats_tx_packets_get $rp13) 206 206 207 207 ip vrf exec vrf-h1 $MZ $h1 -q -p 64 -A 192.0.2.2 -B 198.51.100.2 \ 208 - -d 1msec -t udp "sp=1024,dp=0-32768" 208 + -d $MZ_DELAY -t udp "sp=1024,dp=0-32768" 209 209 210 210 t1_rp12=$(link_stats_tx_packets_get $rp12) 211 211 t1_rp13=$(link_stats_tx_packets_get $rp13) ··· 235 235 t0_rp13=$(link_stats_tx_packets_get $rp13) 236 236 237 237 $MZ $h1 -6 -q -p 64 -A 2001:db8:1::2 -B 2001:db8:2::2 \ 238 - -d 1msec -t udp "sp=1024,dp=0-32768" 238 + -d $MZ_DELAY -t udp "sp=1024,dp=0-32768" 239 239 240 240 t1_rp12=$(link_stats_tx_packets_get $rp12) 241 241 t1_rp13=$(link_stats_tx_packets_get $rp13)
+2 -2
tools/testing/selftests/net/forwarding/router_multipath.sh
··· 179 179 t0_rp13=$(link_stats_tx_packets_get $rp13) 180 180 181 181 ip vrf exec vrf-h1 $MZ $h1 -q -p 64 -A 192.0.2.2 -B 198.51.100.2 \ 182 - -d 1msec -t udp "sp=1024,dp=0-32768" 182 + -d $MZ_DELAY -t udp "sp=1024,dp=0-32768" 183 183 184 184 t1_rp12=$(link_stats_tx_packets_get $rp12) 185 185 t1_rp13=$(link_stats_tx_packets_get $rp13) ··· 216 216 t0_rp13=$(link_stats_tx_packets_get $rp13) 217 217 218 218 $MZ $h1 -6 -q -p 64 -A 2001:db8:1::2 -B 2001:db8:2::2 \ 219 - -d 1msec -t udp "sp=1024,dp=0-32768" 219 + -d $MZ_DELAY -t udp "sp=1024,dp=0-32768" 220 220 221 221 t1_rp12=$(link_stats_tx_packets_get $rp12) 222 222 t1_rp13=$(link_stats_tx_packets_get $rp13)