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.

Merge branch 'zcrx-query-6.19' into for-6.19/io_uring

Merge zcrx SQ/CQ query changes from Pavel:

"Introduce zcrx and SQ/CQ layout queries. The former returns what zcrx
features are available. And both return the ring size information to
help with allocation size calculation for user provided rings like
IORING_SETUP_NO_MMAP and. IORING_MEM_REGION_TYPE_USER"

Link: https://lore.kernel.org/io-uring/cover.1763030298.git.asml.silence@gmail.com/
Signed-off-by: Jens Axboe <axboe@kernel.dk>

* zcrx-query-6.19:
io_uring/query: introduce rings info query
io_uring/query: introduce zcrx query

+56
+24
include/uapi/linux/io_uring/query.h
··· 18 18 19 19 enum { 20 20 IO_URING_QUERY_OPCODES = 0, 21 + IO_URING_QUERY_ZCRX = 1, 22 + IO_URING_QUERY_SCQ = 2, 21 23 22 24 __IO_URING_QUERY_MAX, 23 25 }; ··· 41 39 /* The number of available query opcodes */ 42 40 __u32 nr_query_opcodes; 43 41 __u32 __pad; 42 + }; 43 + 44 + struct io_uring_query_zcrx { 45 + /* Bitmask of supported ZCRX_REG_* flags, */ 46 + __u64 register_flags; 47 + /* Bitmask of all supported IORING_ZCRX_AREA_* flags */ 48 + __u64 area_flags; 49 + /* The number of supported ZCRX_CTRL_* opcodes */ 50 + __u32 nr_ctrl_opcodes; 51 + __u32 __resv1; 52 + /* The refill ring header size */ 53 + __u32 rq_hdr_size; 54 + /* The alignment for the header */ 55 + __u32 rq_hdr_alignment; 56 + __u64 __resv2; 57 + }; 58 + 59 + struct io_uring_query_scq { 60 + /* The SQ/CQ rings header size */ 61 + __u64 hdr_size; 62 + /* The alignment for the header */ 63 + __u64 hdr_alignment; 44 64 }; 45 65 46 66 #endif
+32
io_uring/query.c
··· 4 4 5 5 #include "query.h" 6 6 #include "io_uring.h" 7 + #include "zcrx.h" 7 8 8 9 union io_query_data { 9 10 struct io_uring_query_opcode opcodes; 11 + struct io_uring_query_zcrx zcrx; 12 + struct io_uring_query_scq scq; 10 13 }; 11 14 12 15 #define IO_MAX_QUERY_SIZE sizeof(union io_query_data) ··· 27 24 e->sqe_flags = SQE_VALID_FLAGS; 28 25 e->nr_query_opcodes = __IO_URING_QUERY_MAX; 29 26 e->__pad = 0; 27 + return sizeof(*e); 28 + } 29 + 30 + static ssize_t io_query_zcrx(union io_query_data *data) 31 + { 32 + struct io_uring_query_zcrx *e = &data->zcrx; 33 + 34 + e->register_flags = ZCRX_REG_IMPORT; 35 + e->area_flags = IORING_ZCRX_AREA_DMABUF; 36 + e->nr_ctrl_opcodes = __ZCRX_CTRL_LAST; 37 + e->rq_hdr_size = sizeof(struct io_uring); 38 + e->rq_hdr_alignment = L1_CACHE_BYTES; 39 + e->__resv1 = 0; 40 + e->__resv2 = 0; 41 + return sizeof(*e); 42 + } 43 + 44 + static ssize_t io_query_scq(union io_query_data *data) 45 + { 46 + struct io_uring_query_scq *e = &data->scq; 47 + 48 + e->hdr_size = sizeof(struct io_rings); 49 + e->hdr_alignment = SMP_CACHE_BYTES; 30 50 return sizeof(*e); 31 51 } 32 52 ··· 80 54 switch (hdr.query_op) { 81 55 case IO_URING_QUERY_OPCODES: 82 56 ret = io_query_ops(data); 57 + break; 58 + case IO_URING_QUERY_ZCRX: 59 + ret = io_query_zcrx(data); 60 + break; 61 + case IO_URING_QUERY_SCQ: 62 + ret = io_query_scq(data); 83 63 break; 84 64 } 85 65