Petr Machata says: ==================== mlxsw: Test coverage for DSCP leftover fix This patch set fixes some global scope pollution issues in the DSCP tests (in patch #1), and then proceeds (in patch #2) to add a new test for checking whether, after DSCP prioritization rules are removed from a port, DSCP rewrites consistently to zero, instead of the last removed rule still staying in effect. ====================
Unified · Split
| @@ -36,8 +36,6 @@ source $lib_dir/lib.sh · 35 unmodified lines | ||
| 36 | 36 | |
| 37 | 37 | h1_create() |
| 38 | 38 | { |
| 39 | − local dscp; | |
| 40 | − | |
| 41 | 39 | simple_if_init $h1 192.0.2.1/28 |
| 42 | 40 | tc qdisc add dev $h1 clsact |
| 43 | 41 | dscp_capture_install $h1 10 |
| @@ -67,6 +65,7 @@ h2_destroy() · 23 unmodified lines | ||
| 67 | 65 | dscp_map() |
| 68 | 66 | { |
| 69 | 67 | local base=$1; shift |
| 68 | + local prio | |
| 70 | 69 | |
| 71 | 70 | for prio in {0..7}; do |
| 72 | 71 | echo app=$prio,5,$((base + prio)) |
| @@ -138,6 +137,7 @@ dscp_ping_test() · 65 unmodified lines | ||
| 138 | 137 | local prio=$1; shift |
| 139 | 138 | local dev_10=$1; shift |
| 140 | 139 | local dev_20=$1; shift |
| 140 | + local key | |
| 141 | 141 | |
| 142 | 142 | local dscp_10=$(((prio + 10) << 2)) |
| 143 | 143 | local dscp_20=$(((prio + 20) << 2)) |
| @@ -175,6 +175,8 @@ dscp_ping_test() · 31 unmodified lines | ||
| 175 | 175 | |
| 176 | 176 | test_dscp() |
| 177 | 177 | { |
| 178 | + local prio | |
| 179 | + | |
| 178 | 180 | for prio in {0..7}; do |
| 179 | 181 | dscp_ping_test v$h1 192.0.2.1 192.0.2.2 $prio $h1 $h2 |
| 180 | 182 | done |
| @@ -31,6 +31,7 @@ ALL_TESTS=" · 30 unmodified lines | ||
| 31 | 31 | ping_ipv4 |
| 32 | 32 | test_update |
| 33 | 33 | test_no_update |
| 34 | + test_dscp_leftover | |
| 34 | 35 | " |
| 35 | 36 | |
| 36 | 37 | lib_dir=$(dirname $0)/../../../net/forwarding |
| @@ -50,10 +51,13 @@ reprioritize() · 13 unmodified lines | ||
| 50 | 51 | echo ${reprio[$in]} |
| 51 | 52 | } |
| 52 | 53 | |
| 53 | −h1_create() | |
| 54 | +zero() | |
| 54 | 55 | { |
| 55 | − local dscp; | |
| 56 | + echo 0 | |
| 57 | +} | |
| 56 | 58 | |
| 59 | +h1_create() | |
| 60 | +{ | |
| 57 | 61 | simple_if_init $h1 192.0.2.1/28 |
| 58 | 62 | tc qdisc add dev $h1 clsact |
| 59 | 63 | dscp_capture_install $h1 0 |
| @@ -87,6 +91,7 @@ h2_destroy() · 27 unmodified lines | ||
| 87 | 91 | dscp_map() |
| 88 | 92 | { |
| 89 | 93 | local base=$1; shift |
| 94 | + local prio | |
| 90 | 95 | |
| 91 | 96 | for prio in {0..7}; do |
| 92 | 97 | echo app=$prio,5,$((base + prio)) |
| @@ -156,6 +161,7 @@ dscp_ping_test() · 63 unmodified lines | ||
| 156 | 161 | local reprio=$1; shift |
| 157 | 162 | local dev1=$1; shift |
| 158 | 163 | local dev2=$1; shift |
| 164 | + local i | |
| 159 | 165 | |
| 160 | 166 | local prio2=$($reprio $prio) # ICMP Request egress prio |
| 161 | 167 | local prio3=$($reprio $prio2) # ICMP Response egress prio |
| @@ -205,6 +211,7 @@ __test_update() · 43 unmodified lines | ||
| 205 | 211 | { |
| 206 | 212 | local update=$1; shift |
| 207 | 213 | local reprio=$1; shift |
| 214 | + local prio | |
| 208 | 215 | |
| 209 | 216 | sysctl_restore net.ipv4.ip_forward_update_priority |
| 210 | 217 | sysctl_set net.ipv4.ip_forward_update_priority $update |
| @@ -224,6 +231,19 @@ test_no_update() · 13 unmodified lines | ||
| 224 | 231 | __test_update 0 echo |
| 225 | 232 | } |
| 226 | 233 | |
| 234 | +# Test that when the last APP rule is removed, the prio->DSCP map is properly | |
| 235 | +# set to zeroes, and that the last APP rule does not stay active in the ASIC. | |
| 236 | +test_dscp_leftover() | |
| 237 | +{ | |
| 238 | + lldptool -T -i $swp2 -V APP -d $(dscp_map 0) >/dev/null | |
| 239 | + lldpad_app_wait_del | |
| 240 | + | |
| 241 | + __test_update 0 zero | |
| 242 | + | |
| 243 | + lldptool -T -i $swp2 -V APP $(dscp_map 0) >/dev/null | |
| 244 | + lldpad_app_wait_set $swp2 | |
| 245 | +} | |
| 246 | + | |
| 227 | 247 | trap cleanup EXIT |
| 228 | 248 | |
| 229 | 249 | setup_prepare |