Skip to content

Commit 25744f8

Browse files
isilenceaxboe
authored andcommitted
io_uring/zcrx: return ifq id to the user
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> Link: https://lore.kernel.org/r/8714667d370651962f7d1a169032e5f02682a73e.1744722517.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent cf96072 commit 25744f8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

include/uapi/linux/io_uring.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,9 @@ struct io_uring_zcrx_ifq_reg {
10101010
__u64 region_ptr; /* struct io_uring_region_desc * */
10111011

10121012
struct io_uring_zcrx_offsets offsets;
1013-
__u64 __resv[4];
1013+
__u32 zcrx_id;
1014+
__u32 __resv2;
1015+
__u64 __resv[3];
10141016
};
10151017

10161018
#ifdef __cplusplus

io_uring/zcrx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,8 @@ int io_register_zcrx_ifq(struct io_ring_ctx *ctx,
354354
return -EFAULT;
355355
if (copy_from_user(&rd, u64_to_user_ptr(reg.region_ptr), sizeof(rd)))
356356
return -EFAULT;
357-
if (memchr_inv(&reg.__resv, 0, sizeof(reg.__resv)))
357+
if (memchr_inv(&reg.__resv, 0, sizeof(reg.__resv)) ||
358+
reg.__resv2 || reg.zcrx_id)
358359
return -EINVAL;
359360
if (reg.if_rxq == -1 || !reg.rq_entries || reg.flags)
360361
return -EINVAL;

0 commit comments

Comments
 (0)