[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <b090beef61645cda58889a32ea9c1d0be60beb63.1583170249.git.petrm@mellanox.com>
Date: Mon, 2 Mar 2020 19:56:05 +0200
From: Petr Machata <me@...chata.org>
To: netdev@...r.kernel.org
Cc: Ido Schimmel <idosch@...lanox.com>,
Petr Machata <petrm@...lanox.com>,
David Miller <davem@...emloft.net>,
Amit Cohen <amitc@...lanox.com>
Subject: [PATCH net-next 4/4] selftests: mlxsw: qos_defprio: Use until_counter_is
From: Petr Machata <petrm@...lanox.com>
Instead of hand-coding the busywait() predicate, use the until_counter_is()
introduced recently.
Signed-off-by: Petr Machata <petrm@...lanox.com>
Reviewed-by: Amit Cohen <amitc@...lanox.com>
---
.../selftests/drivers/net/mlxsw/qos_defprio.sh | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/mlxsw/qos_defprio.sh b/tools/testing/selftests/drivers/net/mlxsw/qos_defprio.sh
index eff6393ce974..71066bc4b886 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/qos_defprio.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/qos_defprio.sh
@@ -114,23 +114,12 @@ ping_ipv4()
ping_test $h1 192.0.2.2
}
-wait_for_packets()
-{
- local t0=$1; shift
- local prio_observe=$1; shift
-
- local t1=$(ethtool_stats_get $swp1 rx_frames_prio_$prio_observe)
- local delta=$((t1 - t0))
- echo $delta
- ((delta >= 10))
-}
-
__test_defprio()
{
local prio_install=$1; shift
local prio_observe=$1; shift
- local delta
local key
+ local t1
local i
RET=0
@@ -139,9 +128,10 @@ __test_defprio()
local t0=$(ethtool_stats_get $swp1 rx_frames_prio_$prio_observe)
mausezahn -q $h1 -d 100m -c 10 -t arp reply
- delta=$(busywait "$HIT_TIMEOUT" wait_for_packets $t0 $prio_observe)
+ t1=$(busywait "$HIT_TIMEOUT" until_counter_is ">= $((t0 + 10))" \
+ ethtool_stats_get $swp1 rx_frames_prio_$prio_observe)
- check_err $? "Default priority $prio_install/$prio_observe: Expected to capture 10 packets, got $delta."
+ check_err $? "Default priority $prio_install/$prio_observe: Expected to capture 10 packets, got $((t1 - t0))."
log_test "Default priority $prio_install/$prio_observe"
defprio_uninstall $swp1 $prio_install
--
2.20.1
Powered by blists - more mailing lists