Skip to contentSkip to conversation

selftests: iou-zcrx: defer listen() until after zcrx setup

PATCH Applied Dragos Tatulea 2 participants 2 messages Jun 11 – Jun 13

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: iou-zcrx: defer listen() until after zcrx setup

The server binds the queues for zero-copy after listen(). If the client does a connect() during this time it can fail with EHOSTUNREACH on a cold system. This was encountered with the mlx5 driver where binding the .ndo_queue_start() is a slow operation during which no packets can be exchanged.

This change moves listen() after queue binding, when the test server is fully operational.

Fixes 71082faa2c64 ("io_uring/zcrx: add selftest")
---
 tools/testing/selftests/drivers/net/hw/iou-zcrx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/drivers/net/hw/iou-zcrx.c +3 -3
index 240d13dbc54e..f6a8fc5fac24 100644
@@ -351,9 +351,6 @@ static void run_server(void)
 	if (ret < 0)
 		error(1, 0, "bind()");
 
-	if (listen(fd, 1024) < 0)
-		error(1, 0, "listen()");
-
 	flags |= IORING_SETUP_COOP_TASKRUN;
 	flags |= IORING_SETUP_SINGLE_ISSUER;
 	flags |= IORING_SETUP_DEFER_TASKRUN;
@@ -366,6 +363,9 @@ static void run_server(void)
 	if (cfg_dry_run)
 		return;
 
+	if (listen(fd, 1024) < 0)
+		error(1, 0, "listen()");
+
 	add_accept(&ring, fd);
 
 	tstop = gettimeofday_ms() + 5000;
Signature · 1 line
2.54.0
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Thu, 11 Jun 2026 19:03:41 +0300 you wrote:

The server binds the queues for zero-copy after listen(). If the client does a connect() during this time it can fail with EHOSTUNREACH on a cold system. This was encountered with the mlx5 driver where binding the .ndo_queue_start() is a slow operation during which no packets can be exchanged.

This change moves listen() after queue binding, when the test server is fully operational.

[...]

Here is the summary with links:
- [net] selftests: iou-zcrx: defer listen() until after zcrx setup

    https://git.kernel.org/netdev/net-next/c/ec782be97d2d

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html