mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-13 14:22:13 -04:00
The sockets used by udpgso_bench_tx aren't always ready when udpgso_bench_tx transmits packets. This issue is more prevalent in -rt kernels, but can occur in both. Replace the hacky sleep calls with a function that checks whether the ports in the namespace are ready for use. Suggested-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Lucas Karpinski <lkarpins@redhat.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
23 lines
389 B
Bash
Executable File
23 lines
389 B
Bash
Executable File
#!/bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
#
|
|
# Helper functions
|
|
|
|
wait_local_port_listen()
|
|
{
|
|
local listener_ns="${1}"
|
|
local port="${2}"
|
|
local protocol="${3}"
|
|
local port_hex
|
|
local i
|
|
|
|
port_hex="$(printf "%04X" "${port}")"
|
|
for i in $(seq 10); do
|
|
if ip netns exec "${listener_ns}" cat /proc/net/"${protocol}"* | \
|
|
grep -q "${port_hex}"; then
|
|
break
|
|
fi
|
|
sleep 0.1
|
|
done
|
|
}
|