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

selftests: RED: Use defer for test cleanup

Instead of having a suite of dedicated cleanup functions, use the defer
framework to schedule cleanups right as their setup functions are run.

The sleep after stop_traffic() in mlxsw selftests is necessary, but
scheduling it as "defer sleep; defer stop_traffic" is silly. Instead, add a
local helper to stop traffic and sleep afterwards.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Petr Machata and committed by
Paolo Abeni
7f46615d 0e07d5db

+152 -184
+95 -96
tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh
··· 75 75 source $lib_dir/devlink_lib.sh 76 76 source mlxsw_lib.sh 77 77 78 + stop_traffic_sleep() 79 + { 80 + local pid=$1; shift 81 + 82 + # Issuing a kill still leaves a bunch of packets lingering in the 83 + # buffers. This traffic then arrives at the point where a follow-up test 84 + # is already running, and can confuse the test. Therefore sleep after 85 + # stopping traffic to flush any leftover packets. 86 + stop_traffic "$pid" 87 + sleep 1 88 + } 89 + 78 90 ipaddr() 79 91 { 80 92 local host=$1; shift ··· 101 89 local host=$1; shift 102 90 103 91 simple_if_init $dev 92 + defer simple_if_fini $dev 93 + 104 94 mtu_set $dev 10000 95 + defer mtu_restore $dev 105 96 106 97 vlan_create $dev 10 v$dev $(ipaddr $host 10)/28 98 + defer vlan_destroy $dev 10 107 99 ip link set dev $dev.10 type vlan egress 0:0 108 100 109 101 vlan_create $dev 11 v$dev $(ipaddr $host 11)/28 102 + defer vlan_destroy $dev 11 110 103 ip link set dev $dev.11 type vlan egress 0:1 111 - } 112 - 113 - host_destroy() 114 - { 115 - local dev=$1; shift 116 - 117 - vlan_destroy $dev 11 118 - vlan_destroy $dev 10 119 - mtu_restore $dev 120 - simple_if_fini $dev 121 104 } 122 105 123 106 h1_create() ··· 120 113 host_create $h1 1 121 114 } 122 115 123 - h1_destroy() 124 - { 125 - host_destroy $h1 126 - } 127 - 128 116 h2_create() 129 117 { 130 118 host_create $h2 2 119 + 131 120 tc qdisc add dev $h2 clsact 121 + defer tc qdisc del dev $h2 clsact 132 122 133 123 # Some of the tests in this suite use multicast traffic. As this traffic 134 124 # enters BR2_10 resp. BR2_11, it is flooded to all other ports. Thus ··· 143 139 144 140 tc qdisc replace dev $h2 root handle 10: tbf rate 200mbit \ 145 141 burst 128K limit 1G 146 - } 147 - 148 - h2_destroy() 149 - { 150 - tc qdisc del dev $h2 root handle 10: 151 - tc qdisc del dev $h2 clsact 152 - host_destroy $h2 142 + defer tc qdisc del dev $h2 root handle 10: 153 143 } 154 144 155 145 h3_create() 156 146 { 157 147 host_create $h3 3 158 - } 159 - 160 - h3_destroy() 161 - { 162 - host_destroy $h3 163 148 } 164 149 165 150 switch_create() ··· 157 164 local vlan 158 165 159 166 ip link add dev br1_10 type bridge 167 + defer ip link del dev br1_10 168 + 160 169 ip link add dev br1_11 type bridge 170 + defer ip link del dev br1_11 161 171 162 172 ip link add dev br2_10 type bridge 173 + defer ip link del dev br2_10 174 + 163 175 ip link add dev br2_11 type bridge 176 + defer ip link del dev br2_11 164 177 165 178 for intf in $swp1 $swp2 $swp3 $swp4 $swp5; do 166 179 ip link set dev $intf up 180 + defer ip link set dev $intf down 181 + 167 182 mtu_set $intf 10000 183 + defer mtu_restore $intf 168 184 done 169 185 170 186 for intf in $swp1 $swp4; do 171 187 for vlan in 10 11; do 172 188 vlan_create $intf $vlan 189 + defer vlan_destroy $intf $vlan 190 + 173 191 ip link set dev $intf.$vlan master br1_$vlan 192 + defer ip link set dev $intf.$vlan nomaster 193 + 174 194 ip link set dev $intf.$vlan up 195 + defer ip link set dev $intf.$vlan up 175 196 done 176 197 done 177 198 178 199 for intf in $swp2 $swp3 $swp5; do 179 200 for vlan in 10 11; do 180 201 vlan_create $intf $vlan 202 + defer vlan_destroy $intf $vlan 203 + 181 204 ip link set dev $intf.$vlan master br2_$vlan 205 + defer ip link set dev $intf.$vlan nomaster 206 + 182 207 ip link set dev $intf.$vlan up 208 + defer ip link set dev $intf.$vlan up 183 209 done 184 210 done 185 211 ··· 213 201 for intf in $swp3 $swp4; do 214 202 tc qdisc replace dev $intf root handle 1: tbf rate 200mbit \ 215 203 burst 128K limit 1G 204 + defer tc qdisc del dev $intf root handle 1: 216 205 done 217 206 218 207 ip link set dev br1_10 up 208 + defer ip link set dev br1_10 down 209 + 219 210 ip link set dev br1_11 up 211 + defer ip link set dev br1_11 down 212 + 220 213 ip link set dev br2_10 up 214 + defer ip link set dev br2_10 down 215 + 221 216 ip link set dev br2_11 up 217 + defer ip link set dev br2_11 down 222 218 223 219 local size=$(devlink_pool_size_thtype 0 | cut -d' ' -f 1) 224 220 devlink_port_pool_th_save $swp3 8 225 221 devlink_port_pool_th_set $swp3 8 $size 226 - } 227 - 228 - switch_destroy() 229 - { 230 - local intf 231 - local vlan 232 - 233 - devlink_port_pool_th_restore $swp3 8 234 - 235 - ip link set dev br2_11 down 236 - ip link set dev br2_10 down 237 - ip link set dev br1_11 down 238 - ip link set dev br1_10 down 239 - 240 - for intf in $swp4 $swp3; do 241 - tc qdisc del dev $intf root handle 1: 242 - done 243 - 244 - for intf in $swp5 $swp3 $swp2 $swp4 $swp1; do 245 - for vlan in 11 10; do 246 - ip link set dev $intf.$vlan down 247 - ip link set dev $intf.$vlan nomaster 248 - vlan_destroy $intf $vlan 249 - done 250 - 251 - mtu_restore $intf 252 - ip link set dev $intf down 253 - done 254 - 255 - ip link del dev br2_11 256 - ip link del dev br2_10 257 - ip link del dev br1_11 258 - ip link del dev br1_10 222 + defer devlink_port_pool_th_restore $swp3 8 259 223 } 260 224 261 225 setup_prepare() ··· 251 263 h3_mac=$(mac_get $h3) 252 264 253 265 vrf_prepare 266 + defer vrf_cleanup 254 267 255 268 h1_create 256 269 h2_create 257 270 h3_create 258 271 switch_create 259 - } 260 - 261 - cleanup() 262 - { 263 - pre_cleanup 264 - 265 - switch_destroy 266 - h3_destroy 267 - h2_destroy 268 - h1_destroy 269 - 270 - vrf_cleanup 271 272 } 272 273 273 274 ping_ipv4() ··· 427 450 428 451 start_tcp_traffic $h1.$vlan $(ipaddr 1 $vlan) $(ipaddr 3 $vlan) \ 429 452 $h3_mac tos=0x01 453 + defer stop_traffic_sleep $! 430 454 sleep 1 431 455 432 456 ecn_test_common "$name" "$get_nmarked" $vlan $limit ··· 439 461 build_backlog $vlan $((2 * limit)) udp >/dev/null 440 462 check_fail $? "UDP traffic went into backlog instead of being early-dropped" 441 463 log_test "TC $((vlan - 10)): $name backlog > limit: UDP early-dropped" 442 - 443 - stop_traffic 444 - sleep 1 445 464 } 446 465 447 466 do_ecn_test() ··· 446 471 local vlan=$1; shift 447 472 local limit=$1; shift 448 473 449 - __do_ecn_test get_nmarked "$vlan" "$limit" 474 + in_defer_scope \ 475 + __do_ecn_test get_nmarked "$vlan" "$limit" 450 476 } 451 477 452 478 do_ecn_test_perband() ··· 456 480 local limit=$1; shift 457 481 458 482 mlxsw_only_on_spectrum 3+ || return 459 - __do_ecn_test get_qdisc_nmarked "$vlan" "$limit" "per-band ECN" 483 + in_defer_scope \ 484 + __do_ecn_test get_qdisc_nmarked "$vlan" "$limit" "per-band ECN" 460 485 } 461 486 462 - do_ecn_nodrop_test() 487 + __do_ecn_nodrop_test() 463 488 { 464 489 local vlan=$1; shift 465 490 local limit=$1; shift ··· 468 491 469 492 start_tcp_traffic $h1.$vlan $(ipaddr 1 $vlan) $(ipaddr 3 $vlan) \ 470 493 $h3_mac tos=0x01 494 + defer stop_traffic_sleep $! 471 495 sleep 1 472 496 473 497 ecn_test_common "$name" get_nmarked $vlan $limit ··· 480 502 build_backlog $vlan $((2 * limit)) udp >/dev/null 481 503 check_err $? "UDP traffic was early-dropped instead of getting into backlog" 482 504 log_test "TC $((vlan - 10)): $name backlog > limit: UDP not dropped" 483 - 484 - stop_traffic 485 - sleep 1 486 505 } 487 506 488 - do_red_test() 507 + do_ecn_nodrop_test() 508 + { 509 + in_defer_scope \ 510 + __do_ecn_nodrop_test "$@" 511 + } 512 + 513 + __do_red_test() 489 514 { 490 515 local vlan=$1; shift 491 516 local limit=$1; shift ··· 499 518 # is above limit. 500 519 start_tcp_traffic $h1.$vlan $(ipaddr 1 $vlan) $(ipaddr 3 $vlan) \ 501 520 $h3_mac tos=0x01 521 + defer stop_traffic_sleep $! 502 522 503 523 # Pushing below the queue limit should work. 504 524 RET=0 ··· 521 539 ((-15 <= pct && pct <= 15)) 522 540 check_err $? "backlog $backlog / $limit expected <= 15% distance" 523 541 log_test "TC $((vlan - 10)): RED backlog > limit" 524 - 525 - stop_traffic 526 - sleep 1 527 542 } 528 543 529 - do_mc_backlog_test() 544 + do_red_test() 545 + { 546 + in_defer_scope \ 547 + __do_red_test "$@" 548 + } 549 + 550 + __do_mc_backlog_test() 530 551 { 531 552 local vlan=$1; shift 532 553 local limit=$1; shift ··· 539 554 RET=0 540 555 541 556 start_tcp_traffic $h1.$vlan $(ipaddr 1 $vlan) $(ipaddr 3 $vlan) bc 557 + defer stop_traffic_sleep $! 558 + 542 559 start_tcp_traffic $h2.$vlan $(ipaddr 2 $vlan) $(ipaddr 3 $vlan) bc 560 + defer stop_traffic_sleep $! 543 561 544 562 qbl=$(busywait 5000 until_counter_is ">= 500000" \ 545 563 get_qdisc_backlog $vlan) ··· 555 567 get_mc_transmit_queue $vlan) 556 568 check_err $? "MC backlog reported by qdisc not visible in ethtool" 557 569 558 - stop_traffic 559 - stop_traffic 560 - 561 570 log_test "TC $((vlan - 10)): Qdisc reports MC backlog" 562 571 } 563 572 564 - do_mark_test() 573 + do_mc_backlog_test() 574 + { 575 + in_defer_scope \ 576 + __do_mc_backlog_test "$@" 577 + } 578 + 579 + __do_mark_test() 565 580 { 566 581 local vlan=$1; shift 567 582 local limit=$1; shift ··· 579 588 580 589 start_tcp_traffic $h1.$vlan $(ipaddr 1 $vlan) $(ipaddr 3 $vlan) \ 581 590 $h3_mac tos=0x01 591 + defer stop_traffic_sleep $! 582 592 583 593 # Create a bit of a backlog and observe no mirroring due to marks. 584 594 qevent_rule_install_$subtest ··· 609 617 else 610 618 log_test "TC $((vlan - 10)): marked packets $subtest'd" 611 619 fi 612 - 613 - stop_traffic 614 - sleep 1 615 620 } 616 621 617 - do_drop_test() 622 + do_mark_test() 623 + { 624 + in_defer_scope \ 625 + __do_mark_test "$@" 626 + } 627 + 628 + __do_drop_test() 618 629 { 619 630 local vlan=$1; shift 620 631 local limit=$1; shift ··· 632 637 RET=0 633 638 634 639 start_traffic $h1.$vlan $(ipaddr 1 $vlan) $(ipaddr 3 $vlan) $h3_mac 640 + defer stop_traffic_sleep $! 635 641 636 642 # Create a bit of a backlog and observe no mirroring due to drops. 637 643 qevent_rule_install_$subtest ··· 667 671 check_fail $? "$((now - base)) spurious packets observed after uninstall" 668 672 669 673 log_test "TC $((vlan - 10)): ${trigger}ped packets $subtest'd" 674 + } 670 675 671 - stop_traffic 672 - sleep 1 676 + do_drop_test() 677 + { 678 + in_defer_scope \ 679 + __do_drop_test "$@" 673 680 } 674 681 675 682 qevent_rule_install_mirror()
+8 -16
tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh
··· 80 80 ecn_test() 81 81 { 82 82 install_qdisc ecn 83 + defer uninstall_qdisc 83 84 84 85 do_ecn_test 10 $BACKLOG1 85 86 do_ecn_test 11 $BACKLOG2 86 - 87 - uninstall_qdisc 88 87 } 89 88 90 89 ecn_test_perband() 91 90 { 92 91 install_qdisc ecn 92 + defer uninstall_qdisc 93 93 94 94 do_ecn_test_perband 10 $BACKLOG1 95 95 do_ecn_test_perband 11 $BACKLOG2 96 - 97 - uninstall_qdisc 98 96 } 99 97 100 98 ecn_nodrop_test() 101 99 { 102 100 install_qdisc ecn nodrop 101 + defer uninstall_qdisc 103 102 104 103 do_ecn_nodrop_test 10 $BACKLOG1 105 104 do_ecn_nodrop_test 11 $BACKLOG2 106 - 107 - uninstall_qdisc 108 105 } 109 106 110 107 red_test() 111 108 { 112 109 install_qdisc 110 + defer uninstall_qdisc 113 111 114 112 # Make sure that we get the non-zero value if there is any. 115 113 local cur=$(busywait 1100 until_counter_is "> 0" \ ··· 118 120 119 121 do_red_test 10 $BACKLOG1 120 122 do_red_test 11 $BACKLOG2 121 - 122 - uninstall_qdisc 123 123 } 124 124 125 125 mc_backlog_test() 126 126 { 127 127 install_qdisc 128 + defer uninstall_qdisc 128 129 129 130 # Note that the backlog numbers here do not correspond to RED 130 131 # configuration, but are arbitrary. 131 132 do_mc_backlog_test 10 $BACKLOG1 132 133 do_mc_backlog_test 11 $BACKLOG2 133 - 134 - uninstall_qdisc 135 134 } 136 135 137 136 red_mirror_test() 138 137 { 139 138 install_qdisc qevent early_drop block 10 139 + defer uninstall_qdisc 140 140 141 141 do_drop_mirror_test 10 $BACKLOG1 early_drop 142 142 do_drop_mirror_test 11 $BACKLOG2 early_drop 143 - 144 - uninstall_qdisc 145 143 } 146 144 147 145 red_trap_test() 148 146 { 149 147 install_qdisc qevent early_drop block 10 148 + defer uninstall_qdisc 150 149 151 150 do_drop_trap_test 10 $BACKLOG1 early_drop 152 151 do_drop_trap_test 11 $BACKLOG2 early_drop 153 - 154 - uninstall_qdisc 155 152 } 156 153 157 154 ecn_mirror_test() 158 155 { 159 156 install_qdisc ecn qevent mark block 10 157 + defer uninstall_qdisc 160 158 161 159 do_mark_mirror_test 10 $BACKLOG1 162 160 do_mark_mirror_test 11 $BACKLOG2 163 - 164 - uninstall_qdisc 165 161 } 166 162 167 163 bail_on_lldpad "configure DCB" "configure Qdiscs"
+12 -6
tools/testing/selftests/drivers/net/mlxsw/sch_red_root.sh
··· 32 32 ecn_test() 33 33 { 34 34 install_qdisc ecn 35 + defer uninstall_qdisc 36 + 35 37 do_ecn_test 10 $BACKLOG 36 - uninstall_qdisc 37 38 } 38 39 39 40 ecn_test_perband() 40 41 { 41 42 install_qdisc ecn 43 + defer uninstall_qdisc 44 + 42 45 do_ecn_test_perband 10 $BACKLOG 43 - uninstall_qdisc 44 46 } 45 47 46 48 ecn_nodrop_test() 47 49 { 48 50 install_qdisc ecn nodrop 51 + defer uninstall_qdisc 52 + 49 53 do_ecn_nodrop_test 10 $BACKLOG 50 - uninstall_qdisc 51 54 } 52 55 53 56 red_test() 54 57 { 55 58 install_qdisc 59 + defer uninstall_qdisc 60 + 56 61 do_red_test 10 $BACKLOG 57 - uninstall_qdisc 58 62 } 59 63 60 64 mc_backlog_test() 61 65 { 62 66 install_qdisc 67 + defer uninstall_qdisc 68 + 63 69 # Note that the backlog value here does not correspond to RED 64 70 # configuration, but is arbitrary. 65 71 do_mc_backlog_test 10 $BACKLOG 66 - uninstall_qdisc 67 72 } 68 73 69 74 red_mirror_test() 70 75 { 71 76 install_qdisc qevent early_drop block 10 77 + defer uninstall_qdisc 78 + 72 79 do_drop_mirror_test 10 $BACKLOG 73 - uninstall_qdisc 74 80 } 75 81 76 82 bail_on_lldpad "configure DCB" "configure Qdiscs"
+37 -66
tools/testing/selftests/net/forwarding/sch_red.sh
··· 53 53 h1_create() 54 54 { 55 55 simple_if_init $h1 192.0.2.1/28 56 + defer simple_if_fini $h1 192.0.2.1/28 57 + 56 58 mtu_set $h1 10000 59 + defer mtu_restore $h1 60 + 57 61 tc qdisc replace dev $h1 root handle 1: tbf \ 58 62 rate 10Mbit burst 10K limit 1M 59 - } 60 - 61 - h1_destroy() 62 - { 63 - tc qdisc del dev $h1 root 64 - mtu_restore $h1 65 - simple_if_fini $h1 192.0.2.1/28 63 + defer tc qdisc del dev $h1 root 66 64 } 67 65 68 66 h2_create() 69 67 { 70 68 simple_if_init $h2 192.0.2.2/28 71 - mtu_set $h2 10000 72 - } 69 + defer simple_if_fini $h2 192.0.2.2/28 73 70 74 - h2_destroy() 75 - { 76 - mtu_restore $h2 77 - simple_if_fini $h2 192.0.2.2/28 71 + mtu_set $h2 10000 72 + defer mtu_restore $h2 78 73 } 79 74 80 75 h3_create() 81 76 { 82 77 simple_if_init $h3 192.0.2.3/28 83 - mtu_set $h3 10000 84 - } 78 + defer simple_if_fini $h3 192.0.2.3/28 85 79 86 - h3_destroy() 87 - { 88 - mtu_restore $h3 89 - simple_if_fini $h3 192.0.2.3/28 80 + mtu_set $h3 10000 81 + defer mtu_restore $h3 90 82 } 91 83 92 84 switch_create() 93 85 { 94 86 ip link add dev br up type bridge 87 + defer ip link del dev br 88 + 95 89 ip link set dev $swp1 up master br 90 + defer ip link set dev $swp1 down nomaster 91 + 96 92 ip link set dev $swp2 up master br 93 + defer ip link set dev $swp2 down nomaster 94 + 97 95 ip link set dev $swp3 up master br 96 + defer ip link set dev $swp3 down nomaster 98 97 99 98 mtu_set $swp1 10000 99 + defer mtu_restore $h1 100 + 100 101 mtu_set $swp2 10000 102 + defer mtu_restore $h2 103 + 101 104 mtu_set $swp3 10000 105 + defer mtu_restore $h3 102 106 103 107 tc qdisc replace dev $swp3 root handle 1: tbf \ 104 108 rate 10Mbit burst 10K limit 1M 109 + defer tc qdisc del dev $swp3 root 110 + 105 111 ip link add name _drop_test up type dummy 106 - } 107 - 108 - switch_destroy() 109 - { 110 - ip link del dev _drop_test 111 - tc qdisc del dev $swp3 root 112 - 113 - mtu_restore $h3 114 - mtu_restore $h2 115 - mtu_restore $h1 116 - 117 - ip link set dev $swp3 down nomaster 118 - ip link set dev $swp2 down nomaster 119 - ip link set dev $swp1 down nomaster 120 - ip link del dev br 112 + defer ip link del dev _drop_test 121 113 } 122 114 123 115 setup_prepare() ··· 126 134 h3_mac=$(mac_get $h3) 127 135 128 136 vrf_prepare 137 + defer vrf_cleanup 129 138 130 139 h1_create 131 140 h2_create 132 141 h3_create 133 142 switch_create 134 - } 135 - 136 - cleanup() 137 - { 138 - pre_cleanup 139 - 140 - switch_destroy 141 - h3_destroy 142 - h2_destroy 143 - h1_destroy 144 - 145 - vrf_cleanup 146 143 } 147 144 148 145 ping_ipv4() ··· 268 287 269 288 $MZ $h1 -p $PKTSZ -A 192.0.2.1 -B 192.0.2.3 -c 0 \ 270 289 -a own -b $h3_mac -t tcp -q tos=0x01 & 290 + defer stop_traffic $! 271 291 sleep 1 272 292 273 293 ecn_test_common "$name" $limit ··· 280 298 build_backlog $((2 * limit)) udp >/dev/null 281 299 check_fail $? "UDP traffic went into backlog instead of being early-dropped" 282 300 log_test "$name backlog > limit: UDP early-dropped" 283 - 284 - stop_traffic 285 - sleep 1 286 301 } 287 302 288 303 do_ecn_nodrop_test() ··· 289 310 290 311 $MZ $h1 -p $PKTSZ -A 192.0.2.1 -B 192.0.2.3 -c 0 \ 291 312 -a own -b $h3_mac -t tcp -q tos=0x01 & 313 + defer stop_traffic $! 292 314 sleep 1 293 315 294 316 ecn_test_common "$name" $limit ··· 301 321 build_backlog $((2 * limit)) udp >/dev/null 302 322 check_err $? "UDP traffic was early-dropped instead of getting into backlog" 303 323 log_test "$name backlog > limit: UDP not dropped" 304 - 305 - stop_traffic 306 - sleep 1 307 324 } 308 325 309 326 do_red_test() ··· 313 336 # is above limit. 314 337 $MZ $h1 -p $PKTSZ -A 192.0.2.1 -B 192.0.2.3 -c 0 \ 315 338 -a own -b $h3_mac -t tcp -q tos=0x01 & 339 + defer stop_traffic $! 316 340 317 341 # Pushing below the queue limit should work. 318 342 RET=0 ··· 330 352 pct=$(check_marking "== 0") 331 353 check_err $? "backlog $backlog / $limit Got $pct% marked packets, expected == 0." 332 354 log_test "RED backlog > limit" 333 - 334 - stop_traffic 335 - sleep 1 336 355 } 337 356 338 357 do_red_qevent_test() ··· 344 369 345 370 $MZ $h1 -p $PKTSZ -A 192.0.2.1 -B 192.0.2.3 -c 0 \ 346 371 -a own -b $h3_mac -t udp -q & 372 + defer stop_traffic $! 347 373 sleep 1 348 374 349 375 tc filter add block 10 pref 1234 handle 102 matchall skip_hw \ ··· 372 396 check_err $? "Dropped packets still observed: 0 expected, $((now - base)) seen" 373 397 374 398 log_test "RED early_dropped packets mirrored" 375 - 376 - stop_traffic 377 - sleep 1 378 399 } 379 400 380 401 do_ecn_qevent_test() ··· 383 410 384 411 $MZ $h1 -p $PKTSZ -A 192.0.2.1 -B 192.0.2.3 -c 0 \ 385 412 -a own -b $h3_mac -t tcp -q tos=0x01 & 413 + defer stop_traffic $! 386 414 sleep 1 387 415 388 416 tc filter add block 10 pref 1234 handle 102 matchall skip_hw \ ··· 402 428 tc filter del block 10 pref 1234 handle 102 matchall 403 429 404 430 log_test "ECN marked packets mirrored" 405 - 406 - stop_traffic 407 - sleep 1 408 431 } 409 432 410 433 install_qdisc() ··· 422 451 ecn_test() 423 452 { 424 453 install_qdisc ecn 454 + defer uninstall_qdisc 425 455 xfail_on_slow do_ecn_test $BACKLOG 426 - uninstall_qdisc 427 456 } 428 457 429 458 ecn_nodrop_test() 430 459 { 431 460 install_qdisc ecn nodrop 461 + defer uninstall_qdisc 432 462 xfail_on_slow do_ecn_nodrop_test $BACKLOG 433 - uninstall_qdisc 434 463 } 435 464 436 465 red_test() 437 466 { 438 467 install_qdisc 468 + defer uninstall_qdisc 439 469 xfail_on_slow do_red_test $BACKLOG 440 - uninstall_qdisc 441 470 } 442 471 443 472 red_qevent_test() 444 473 { 445 474 install_qdisc qevent early_drop block 10 475 + defer uninstall_qdisc 446 476 xfail_on_slow do_red_qevent_test $BACKLOG 447 - uninstall_qdisc 448 477 } 449 478 450 479 ecn_qevent_test() 451 480 { 452 481 install_qdisc ecn qevent mark block 10 482 + defer uninstall_qdisc 453 483 xfail_on_slow do_ecn_qevent_test $BACKLOG 454 - uninstall_qdisc 455 484 } 456 485 457 486 trap cleanup EXIT