selftests: mlxsw: sch_red_ets: Test proper counter cleaning in ETS
authorPetr Machata <petrm@nvidia.com>
Tue, 20 Apr 2021 14:53:48 +0000 (16:53 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Apr 2021 23:43:13 +0000 (16:43 -0700)
There was a bug introduced during the rework which cause non-zero backlog
being stuck at ETS. Introduce a selftest that would have caught the issue
earlier.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh

index 3f007c5f8361cea814b88b79094316d16bf70e2b..f3ef3274f9b3de316afe09ba742d8ff70fd1f146 100755 (executable)
@@ -67,6 +67,13 @@ red_test()
 {
        install_qdisc
 
+       # Make sure that we get the non-zero value if there is any.
+       local cur=$(busywait 1100 until_counter_is "> 0" \
+                           qdisc_stats_get $swp3 10: .backlog)
+       (( cur == 0 ))
+       check_err $? "backlog of $cur observed on non-busy qdisc"
+       log_test "$QDISC backlog properly cleaned"
+
        do_red_test 10 $BACKLOG1
        do_red_test 11 $BACKLOG2