forked from Minki/linux
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: Petr Machata <petrm@mellanox.com> Reviewed-by: Amit Cohen <amitc@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
47b0e096a9
commit
7b522ba276
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user