public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] io_uring/zcrx: return ifq id to the user
@ 2025-04-15 13:09 Pavel Begunkov
  2025-04-15 13:38 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2025-04-15 13:09 UTC (permalink / raw)
  To: io-uring; +Cc: asml.silence, David Wei

IORING_OP_RECV_ZC requests take a zcrx object id via sqe::zcrx_ifq_idx,
which binds it to the corresponding if / queue. However, we don't return
that id back to the user. It's fine as currently there can be only one
zcrx and the user assumes that its id should be 0, but as we'll need
multiple zcrx objects in the future let's explicitly pass it back on
registration.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 include/uapi/linux/io_uring.h | 4 +++-
 io_uring/zcrx.c               | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
index ed2beb4def3f..8f1fc12bac46 100644
--- a/include/uapi/linux/io_uring.h
+++ b/include/uapi/linux/io_uring.h
@@ -1010,7 +1010,9 @@ struct io_uring_zcrx_ifq_reg {
 	__u64	region_ptr; /* struct io_uring_region_desc * */
 
 	struct io_uring_zcrx_offsets offsets;
-	__u64	__resv[4];
+	__u32	zcrx_id;
+	__u32	__resv2;
+	__u64	__resv[3];
 };
 
 #ifdef __cplusplus
diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index 0f46e0404c04..d0eccf277a20 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -354,7 +354,8 @@ int io_register_zcrx_ifq(struct io_ring_ctx *ctx,
 		return -EFAULT;
 	if (copy_from_user(&rd, u64_to_user_ptr(reg.region_ptr), sizeof(rd)))
 		return -EFAULT;
-	if (memchr_inv(&reg.__resv, 0, sizeof(reg.__resv)))
+	if (memchr_inv(&reg.__resv, 0, sizeof(reg.__resv)) ||
+	    reg.__resv2 || reg.zcrx_id)
 		return -EINVAL;
 	if (reg.if_rxq == -1 || !reg.rq_entries || reg.flags)
 		return -EINVAL;
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] io_uring/zcrx: return ifq id to the user
  2025-04-15 13:09 [PATCH 1/1] io_uring/zcrx: return ifq id to the user Pavel Begunkov
@ 2025-04-15 13:38 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2025-04-15 13:38 UTC (permalink / raw)
  To: io-uring, Pavel Begunkov; +Cc: David Wei


On Tue, 15 Apr 2025 14:09:45 +0100, Pavel Begunkov wrote:
> IORING_OP_RECV_ZC requests take a zcrx object id via sqe::zcrx_ifq_idx,
> which binds it to the corresponding if / queue. However, we don't return
> that id back to the user. It's fine as currently there can be only one
> zcrx and the user assumes that its id should be 0, but as we'll need
> multiple zcrx objects in the future let's explicitly pass it back on
> registration.
> 
> [...]

Applied, thanks!

[1/1] io_uring/zcrx: return ifq id to the user
      commit: 25744f849524e806a13ade17c4fb83f6888fe954

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-15 13:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-15 13:09 [PATCH 1/1] io_uring/zcrx: return ifq id to the user Pavel Begunkov
2025-04-15 13:38 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox