Re: [PATCH net-next v5 5/6] selftests: net: add multithread server support to iou-zcrx
From: Juanlu Herrero
Date: Mon Aug 17 2026 - 10:24:10 EST
On Fri, Aug 14, 2026 at 08:50:29AM -0600, David Wei wrote:
> On 2026-08-13 18:23, Juanlu Herrero wrote:
> > Run the iou-zcrx server as N worker threads, each owning one receive
> > queue with its own io_uring and zero-copy receive (zcrx) ifq, so the
> > test can exercise multi-queue zero-copy receive.
> >
> > The main thread owns the listening socket, accepts connections, and
> > dispatches each to the worker owning the queue it landed on by matching
> > SO_INCOMING_NAPI_ID against per-queue NAPI IDs.
> >
> > Assisted-by: Claude:claude-opus-4-8
> > Signed-off-by: Juanlu Herrero <juanlu@xxxxxxxxxxxx>
> > ---
> > .../testing/selftests/drivers/net/hw/Makefile | 5 +-
> > .../selftests/drivers/net/hw/iou-zcrx.c | 262 +++++++++++++-----
> > 2 files changed, 195 insertions(+), 72 deletions(-)
> >
> [...]
> > diff --git a/tools/testing/selftests/drivers/net/hw/iou-zcrx.c b/tools/testing/selftests/drivers/net/hw/iou-zcrx.c
> > index f793a6c04e412..008d3f4b76263 100644
> > --- a/tools/testing/selftests/drivers/net/hw/iou-zcrx.c
> > +++ b/tools/testing/selftests/drivers/net/hw/iou-zcrx.c
> [...]
> > @@ -289,12 +279,13 @@ static void process_recvzc(struct thread_ctx *ctx, struct io_uring_cqe *cqe)
> > error(1, 0, "recvzc(): %d", cqe->res);
> > if (cfg_oneshot) {
> > - if (cqe->res == 0 && cqe->flags == 0 && cfg_oneshot_recvs) {
> > - add_recvzc_oneshot(ctx, ctx->connfd, page_size);
> > - cfg_oneshot_recvs--;
> > + if (cqe->res == 0 && cqe->flags == 0 &&
> > + ctx->oneshot_recvs[conn_idx]) {
> > + add_recvzc_oneshot(ctx, conn_idx, page_size);
> > + ctx->oneshot_recvs[conn_idx]--;
>
> This needs an early return. Sorry the bug was pre-existing but I just
> noticed it.
ack, I will fix that in v6.
Best,
Juanlu