Commit 7b522ba2 authored by Petr Machata's avatar Petr Machata Committed by David S. Miller

selftests: mlxsw: qos_defprio: Use until_counter_is

Instead of hand-coding the busywait() predicate, use the until_counter_is()
introduced recently.
Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
Reviewed-by: default avatarAmit Cohen <amitc@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 47b0e096
...@@ -114,23 +114,12 @@ ping_ipv4() ...@@ -114,23 +114,12 @@ ping_ipv4()
ping_test $h1 192.0.2.2 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() __test_defprio()
{ {
local prio_install=$1; shift local prio_install=$1; shift
local prio_observe=$1; shift local prio_observe=$1; shift
local delta
local key local key
local t1
local i local i
RET=0 RET=0
...@@ -139,9 +128,10 @@ __test_defprio() ...@@ -139,9 +128,10 @@ __test_defprio()
local t0=$(ethtool_stats_get $swp1 rx_frames_prio_$prio_observe) local t0=$(ethtool_stats_get $swp1 rx_frames_prio_$prio_observe)
mausezahn -q $h1 -d 100m -c 10 -t arp reply 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" log_test "Default priority $prio_install/$prio_observe"
defprio_uninstall $swp1 $prio_install defprio_uninstall $swp1 $prio_install
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment