mirror of
https://github.com/torvalds/linux.git
synced 2026-11-29 10:07:52 +00: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 <[email protected]> Signed-off-by: Lucas Karpinski <[email protected]> Reviewed-by: Willem de Bruijn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
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
|
|
}
|