mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-24 10:57:03 +07:00
selftests: forwarding: lib: Split out setup_wait_dev()
Split out of setup_wait() a function setup_wait_dev() that waits for a single device. This gives tests the opportunity to wait for a selected device after they tinkered with its upness. Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b330219cb2
commit
010079bac0
@ -185,18 +185,25 @@ log_info()
|
|||||||
echo "INFO: $msg"
|
echo "INFO: $msg"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setup_wait_dev()
|
||||||
|
{
|
||||||
|
local dev=$1; shift
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
ip link show dev $dev up \
|
||||||
|
| grep 'state UP' &> /dev/null
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
sleep 1
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
setup_wait()
|
setup_wait()
|
||||||
{
|
{
|
||||||
for i in $(eval echo {1..$NUM_NETIFS}); do
|
for i in $(eval echo {1..$NUM_NETIFS}); do
|
||||||
while true; do
|
setup_wait_dev ${NETIFS[p$i]}
|
||||||
ip link show dev ${NETIFS[p$i]} up \
|
|
||||||
| grep 'state UP' &> /dev/null
|
|
||||||
if [[ $? -ne 0 ]]; then
|
|
||||||
sleep 1
|
|
||||||
else
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Make sure links are ready.
|
# Make sure links are ready.
|
||||||
|
Loading…
Reference in New Issue
Block a user