Commit 0c22f993 authored by Danielle Ratson's avatar Danielle Ratson Committed by David S. Miller

selftests: mlxsw: Use busywait helper in blackhole routes test

Blackhole routes test uses offload indication checks.

Use busywait helper and wait until the routes offload indication is set or
fail if it reaches timeout.
Signed-off-by: default avatarDanielle Ratson <danieller@mellanox.com>
Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5d66773f
...@@ -45,6 +45,7 @@ ALL_TESTS=" ...@@ -45,6 +45,7 @@ ALL_TESTS="
blackhole_ipv6 blackhole_ipv6
" "
NUM_NETIFS=4 NUM_NETIFS=4
: ${TIMEOUT:=20000} # ms
source $lib_dir/tc_common.sh source $lib_dir/tc_common.sh
source $lib_dir/lib.sh source $lib_dir/lib.sh
...@@ -123,7 +124,7 @@ blackhole_ipv4() ...@@ -123,7 +124,7 @@ blackhole_ipv4()
skip_hw dst_ip 198.51.100.1 src_ip 192.0.2.1 ip_proto icmp \ skip_hw dst_ip 198.51.100.1 src_ip 192.0.2.1 ip_proto icmp \
action pass action pass
ip -4 route show 198.51.100.0/30 | grep -q offload busywait "$TIMEOUT" wait_for_offload ip -4 route show 198.51.100.0/30
check_err $? "route not marked as offloaded when should" check_err $? "route not marked as offloaded when should"
ping_do $h1 198.51.100.1 ping_do $h1 198.51.100.1
...@@ -147,7 +148,7 @@ blackhole_ipv6() ...@@ -147,7 +148,7 @@ blackhole_ipv6()
skip_hw dst_ip 2001:db8:2::1 src_ip 2001:db8:1::1 \ skip_hw dst_ip 2001:db8:2::1 src_ip 2001:db8:1::1 \
ip_proto icmpv6 action pass ip_proto icmpv6 action pass
ip -6 route show 2001:db8:2::/120 | grep -q offload busywait "$TIMEOUT" wait_for_offload ip -6 route show 2001:db8:2::/120
check_err $? "route not marked as offloaded when should" check_err $? "route not marked as offloaded when should"
ping6_do $h1 2001:db8:2::1 ping6_do $h1 2001:db8:2::1
......
...@@ -248,6 +248,11 @@ busywait() ...@@ -248,6 +248,11 @@ busywait()
done done
} }
wait_for_offload()
{
"$@" | grep -q offload
}
until_counter_is() until_counter_is()
{ {
local value=$1; shift local value=$1; shift
......
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