From: David Wei <dw@davidwei.uk>
To: io-uring@vger.kernel.org, netdev@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>, Pavel Begunkov <asml.silence@gmail.com>
Subject: [PATCH v2 4/5] io_uring/zcrx: redirect io_recvzc on proxy ifq to src ifq
Date: Sat, 25 Oct 2025 12:15:03 -0700 [thread overview]
Message-ID: <20251025191504.3024224-5-dw@davidwei.uk> (raw)
In-Reply-To: <20251025191504.3024224-1-dw@davidwei.uk>
Technically there is no reason why one ring can't issue io_recvzc on a
socket that is steered into a zero copy HW RX queue bound to an ifq in
another ring. No ifq locks are taken in the happy zero copy path; only
socket locks. If copy fallback is needed the freelist spinlock is taken,
which ensures multiple contexts can synchronise access.
Writing to the tail of the refill ring needs to be synchronised, though
that can be done purely from userspace.
The only thing preventing this today is a check in io_zcrx_recv_frag()
that returns EFAULT if the ifq of the net_iov in an skb doesn't match.
This is the ifq that owns the memory provider bound to a HW RX queue.
The previous patches added a proxy ifq that has a ptr to the src ifq.
Therefore to pass this check, use the src ifq in io_recvzc.
Signed-off-by: David Wei <dw@davidwei.uk>
---
io_uring/net.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/io_uring/net.c b/io_uring/net.c
index a95cc9ca2a4d..8eb6145e0f4d 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -1250,6 +1250,8 @@ int io_recvzc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
zc->ifq = xa_load(&req->ctx->zcrx_ctxs, ifq_idx);
if (!zc->ifq)
return -EINVAL;
+ if (zc->ifq->proxy)
+ zc->ifq = zc->ifq->proxy;
zc->len = READ_ONCE(sqe->len);
zc->flags = READ_ONCE(sqe->ioprio);
--
2.47.3
next prev parent reply other threads:[~2025-10-25 19:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-25 19:14 [PATCH v2 0/5] io_uring zcrx ifq sharing David Wei
2025-10-25 19:15 ` [PATCH v2 1/5] io_uring/rsrc: rename and export io_lock_two_rings() David Wei
2025-10-25 19:15 ` [PATCH v2 2/5] io_uring/zcrx: add refcount to struct io_zcrx_ifq David Wei
2025-10-25 23:37 ` Jens Axboe
2025-10-26 4:10 ` David Wei
2025-10-25 19:15 ` [PATCH v2 3/5] io_uring/zcrx: share an ifq between rings David Wei
2025-10-25 23:41 ` Jens Axboe
2025-10-26 4:12 ` David Wei
2025-10-26 13:16 ` Jens Axboe
2025-10-26 13:43 ` Jens Axboe
2025-10-26 15:06 ` David Wei
2025-10-25 19:15 ` David Wei [this message]
2025-10-25 19:15 ` [PATCH v2 5/5] io_uring/zcrx: free proxy ifqs David Wei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251025191504.3024224-5-dw@davidwei.uk \
--to=dw@davidwei.uk \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).