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

selftests: mlxsw: qos_mc_aware: Add a test for UC awareness

In a previous patch, mlxsw was updated to configure a minimum bandwidth
allowance on MC TCs. Test that this indeed fixes the problem of UC
traffic overload pushing out all MC traffic.

Fixes: b5638d46c90a ("selftests: mlxsw: Add a test for UC behavior under MC flood")
Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Petr Machata and committed by
David S. Miller
a5ee171d 8f3f0935

+70 -23
+70 -23
tools/testing/selftests/drivers/net/mlxsw/qos_mc_aware.sh
··· 25 25 # Thus we set MTU to 10K on all involved interfaces. Then both unicast and 26 26 # multicast traffic uses 8K frames. 27 27 # 28 - # +-----------------------+ +----------------------------------+ 29 - # | H1 | | H2 | 30 - # | | | unicast --> + $h2.111 | 31 - # | | | traffic | 192.0.2.129/28 | 32 - # | multicast | | | e-qos-map 0:1 | 33 - # | traffic | | | | 34 - # | $h1 + <----- | | + $h2 | 35 - # +-----|-----------------+ +--------------|-------------------+ 36 - # | | 37 - # +-----|-------------------------------------------------|-------------------+ 38 - # | + $swp1 + $swp2 | 39 - # | | >1Gbps | >1Gbps | 40 - # | +---|----------------+ +----------|----------------+ | 41 - # | | + $swp1.1 | | + $swp2.111 | | 28 + # +---------------------------+ +----------------------------------+ 29 + # | H1 | | H2 | 30 + # | | | unicast --> + $h2.111 | 31 + # | multicast | | traffic | 192.0.2.129/28 | 32 + # | traffic | | | e-qos-map 0:1 | 33 + # | $h1 + <----- | | | | 34 + # | 192.0.2.65/28 | | | + $h2 | 35 + # +---------------|-----------+ +--------------|-------------------+ 36 + # | | 37 + # +---------------|---------------------------------------|-------------------+ 38 + # | $swp1 + + $swp2 | 39 + # | >1Gbps | | >1Gbps | 40 + # | +-------------|------+ +----------|----------------+ | 41 + # | | $swp1.1 + | | + $swp2.111 | | 42 42 # | | BR1 | SW | BR111 | | 43 - # | | + $swp3.1 | | + $swp3.111 | | 44 - # | +---|----------------+ +----------|----------------+ | 45 - # | \_________________________________________________/ | 43 + # | | $swp3.1 + | | + $swp3.111 | | 44 + # | +-------------|------+ +----------|----------------+ | 45 + # | \_______________________________________/ | 46 46 # | | | 47 47 # | + $swp3 | 48 48 # | | 1Gbps bottleneck | ··· 51 51 # | 52 52 # +--|-----------------+ 53 53 # | + $h3 H3 | 54 + # | | 192.0.2.66/28 | 54 55 # | | | 55 56 # | + $h3.111 | 56 57 # | 192.0.2.130/28 | ··· 60 59 ALL_TESTS=" 61 60 ping_ipv4 62 61 test_mc_aware 62 + test_uc_aware 63 63 " 64 64 65 65 lib_dir=$(dirname $0)/../../../net/forwarding ··· 70 68 71 69 h1_create() 72 70 { 73 - simple_if_init $h1 71 + simple_if_init $h1 192.0.2.65/28 74 72 mtu_set $h1 10000 75 73 } 76 74 77 75 h1_destroy() 78 76 { 79 77 mtu_restore $h1 80 - simple_if_fini $h1 78 + simple_if_fini $h1 192.0.2.65/28 81 79 } 82 80 83 81 h2_create() ··· 99 97 100 98 h3_create() 101 99 { 102 - simple_if_init $h3 100 + simple_if_init $h3 192.0.2.66/28 103 101 mtu_set $h3 10000 104 102 105 103 vlan_create $h3 111 v$h3 192.0.2.130/28 ··· 110 108 vlan_destroy $h3 111 111 109 112 110 mtu_restore $h3 113 - simple_if_fini $h3 111 + simple_if_fini $h3 192.0.2.66/28 114 112 } 115 113 116 114 switch_create() ··· 253 251 # average ingress rate to somewhat mitigate this. 254 252 local min_ingress=2147483648 255 253 256 - mausezahn $h2.111 -p 8000 -A 192.0.2.129 -B 192.0.2.130 -c 0 \ 254 + $MZ $h2.111 -p 8000 -A 192.0.2.129 -B 192.0.2.130 -c 0 \ 257 255 -a own -b $h3mac -t udp -q & 258 256 sleep 1 259 257 ··· 293 291 check_err $? "Could not get high enough UC-only ingress rate" 294 292 local ucth1=${uc_rate[1]} 295 293 296 - mausezahn $h1 -p 8000 -c 0 -a own -b bc -t udp -q & 294 + $MZ $h1 -p 8000 -c 0 -a own -b bc -t udp -q & 297 295 298 296 local d0=$(date +%s) 299 297 local t0=$(ethtool_stats_get $h3 rx_octets_prio_0) ··· 337 335 echo " egress UC throughput $(humanize ${uc_rate_2[1]})" 338 336 echo " ingress MC throughput $(humanize $mc_ir)" 339 337 echo " egress MC throughput $(humanize $mc_er)" 338 + echo 339 + } 340 + 341 + test_uc_aware() 342 + { 343 + RET=0 344 + 345 + $MZ $h2.111 -p 8000 -A 192.0.2.129 -B 192.0.2.130 -c 0 \ 346 + -a own -b $h3mac -t udp -q & 347 + 348 + local d0=$(date +%s) 349 + local t0=$(ethtool_stats_get $h3 rx_octets_prio_1) 350 + local u0=$(ethtool_stats_get $swp2 rx_octets_prio_1) 351 + sleep 1 352 + 353 + local attempts=50 354 + local passes=0 355 + local i 356 + 357 + for ((i = 0; i < attempts; ++i)); do 358 + if $ARPING -c 1 -I $h1 -b 192.0.2.66 -q -w 0.1; then 359 + ((passes++)) 360 + fi 361 + 362 + sleep 0.1 363 + done 364 + 365 + local d1=$(date +%s) 366 + local t1=$(ethtool_stats_get $h3 rx_octets_prio_1) 367 + local u1=$(ethtool_stats_get $swp2 rx_octets_prio_1) 368 + 369 + local interval=$((d1 - d0)) 370 + local uc_ir=$(rate $u0 $u1 $interval) 371 + local uc_er=$(rate $t0 $t1 $interval) 372 + 373 + ((attempts == passes)) 374 + check_err $? 375 + 376 + # Suppress noise from killing mausezahn. 377 + { kill %% && wait; } 2>/dev/null 378 + 379 + log_test "MC performace under UC overload" 380 + echo " ingress UC throughput $(humanize ${uc_ir})" 381 + echo " egress UC throughput $(humanize ${uc_er})" 382 + echo " sent $attempts BC ARPs, got $passes responses" 340 383 } 341 384 342 385 trap cleanup EXIT