Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring/nop: add support for IORING_SETUP_CQE_MIXED

This adds support for setting IORING_NOP_CQE32 as a flag for a NOP
command, in which case a 32b CQE will be posted rather than a regular
one. This is the default if the ring has been setup with
IORING_SETUP_CQE32. If the ring has been setup with
IORING_SETUP_CQE_MIXED, then 16b CQEs will be posted without this flag
set, and 32b CQEs if this flag is set. For the latter case, sqe->off is
what will be posted as cqe->big_cqe[0] and sqe->addr is what will be
posted as cqe->big_cqe[1].

Signed-off-by: Jens Axboe <axboe@kernel.dk>

+16 -2
+1
include/uapi/linux/io_uring.h
··· 464 464 #define IORING_NOP_FIXED_FILE (1U << 2) 465 465 #define IORING_NOP_FIXED_BUFFER (1U << 3) 466 466 #define IORING_NOP_TW (1U << 4) 467 + #define IORING_NOP_CQE32 (1U << 5) 467 468 468 469 /* 469 470 * IO completion data structure (Completion Queue Entry)
+15 -2
io_uring/nop.c
··· 17 17 int result; 18 18 int fd; 19 19 unsigned int flags; 20 + __u64 extra1; 21 + __u64 extra2; 20 22 }; 21 23 22 24 #define NOP_FLAGS (IORING_NOP_INJECT_RESULT | IORING_NOP_FIXED_FILE | \ 23 25 IORING_NOP_FIXED_BUFFER | IORING_NOP_FILE | \ 24 - IORING_NOP_TW) 26 + IORING_NOP_TW | IORING_NOP_CQE32) 25 27 26 28 int io_nop_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) 27 29 { ··· 43 41 nop->fd = -1; 44 42 if (nop->flags & IORING_NOP_FIXED_BUFFER) 45 43 req->buf_index = READ_ONCE(sqe->buf_index); 44 + if (nop->flags & IORING_NOP_CQE32) { 45 + struct io_ring_ctx *ctx = req->ctx; 46 + 47 + if (!(ctx->flags & (IORING_SETUP_CQE32|IORING_SETUP_CQE_MIXED))) 48 + return -EINVAL; 49 + nop->extra1 = READ_ONCE(sqe->off); 50 + nop->extra2 = READ_ONCE(sqe->addr); 51 + } 46 52 return 0; 47 53 } 48 54 ··· 78 68 done: 79 69 if (ret < 0) 80 70 req_set_fail(req); 81 - io_req_set_res(req, nop->result, 0); 71 + if (nop->flags & IORING_NOP_CQE32) 72 + io_req_set_res32(req, nop->result, 0, nop->extra1, nop->extra2); 73 + else 74 + io_req_set_res(req, nop->result, 0); 82 75 if (nop->flags & IORING_NOP_TW) { 83 76 req->io_task_work.func = io_req_task_complete; 84 77 io_req_task_work_add(req);