]> www.infradead.org Git - users/hch/misc.git/commitdiff
io_uring/zcrx: return ifq id to the user
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 15 Apr 2025 13:09:45 +0000 (14:09 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 15 Apr 2025 13:37:49 +0000 (07:37 -0600)
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>
include/uapi/linux/io_uring.h
io_uring/zcrx.c

index ed2beb4def3f6ac899922920bc311a20d2605af4..8f1fc12bac4620b9b40728cdd9baa2243e3cafd7 100644 (file)
@@ -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
index 0f46e0404c0454177a92e5313a8ed19a227d5d67..d0eccf277a20bb2d57a619346414db5dd090a769 100644 (file)
@@ -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;