提交 7b522ba2 编写于 作者: P Petr Machata 提交者: 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: NPetr Machata <petrm@mellanox.com>
Reviewed-by: NAmit Cohen <amitc@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 47b0e096
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册