Thread (4 messages) flat view 4 messages, 4 authors, 10d ago
COOLING10d

[PATCH net-next] selftests: drv-net: devmem: set reuseaddr on the sender's source port

From: Jakub Kicinski <kuba@kernel.org>
Date: 2026-09-08 18:34:28
Also in: linux-kselftest
Subsystem: kernel selftest framework, networking drivers, the rest · Maintainers: Shuah Khan, Shuah Khan, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

devmem.py fails on the HW runners with:

  CMD[remote]: dd if=/dev/zero bs=512 count=1 2>/dev/null | socat -b 512 \
    -u - TCP6:[fd00:2::1]:50051,bind=[fd00:2::2]:50051,nodelay
    STDERR: socat[41018] W bind(5, {AF=10 [fd00:2::2]:50051}, 28): \
            Address already in use

ncdevmem installs a 5-tuple flow rule which matches the source port, so
socat has to bind it explicitly. The port comes from rand_port(), which
checks availability on the DUT - but we bind on the remote...
That said the failure rate seems to high to be random collisions
(~2% per sub-test). It's probably TIME_WAIT sockets on the remote,
run_rx_hds() alone creates 12 of them.

Set reuseaddr so a TIME_WAIT socket does not fail the bind. Collisions
with a live socket are still possible, we'll see if they are frequent
enough to care.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: shuah@kernel.org
CC: bobbyeshleman@meta.com
CC: sdf@fomichev.me
CC: leitao@debian.org
CC: razor@blackwall.org
CC: linux-kselftest@vger.kernel.org
---
 tools/testing/selftests/drivers/net/hw/devmem_lib.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/drivers/net/hw/devmem_lib.py b/tools/testing/selftests/drivers/net/hw/devmem_lib.py
index 3554954a6691..b6e52fa9dda5 100644
--- a/tools/testing/selftests/drivers/net/hw/devmem_lib.py
+++ b/tools/testing/selftests/drivers/net/hw/devmem_lib.py
@@ -201,7 +201,7 @@ def ncdevmem_rx(cfg, port, verify=True, fail_on_linear=False, flow_steer=False,
     else:
         addr = cfg.baddr
 
-    suffix = f",bind={cfg.remote_baddr}:{port}"
+    suffix = f",bind={cfg.remote_baddr}:{port},reuseaddr"
 
     buf = ""
     if buf_size:
-- 
2.55.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help