xref: /linux/include/uapi/linux/io_uring/query.h (revision fab183d632628381b466a41479489541ac0e29a0)
1 /* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT */
2 /*
3  * Header file for the io_uring query interface.
4  *
5  * Copyright (C) 2026 Pavel Begunkov <asml.silence@gmail.com>
6  * Copyright (C) Meta Platforms, Inc.
7  */
8 #ifndef LINUX_IO_URING_QUERY_H
9 #define LINUX_IO_URING_QUERY_H
10 
11 #include <linux/types.h>
12 
13 struct io_uring_query_hdr {
14 	__u64 next_entry;
15 	__u64 query_data;
16 	__u32 query_op;
17 	__u32 size;
18 	__s32 result;
19 	__u32 __resv[3];
20 };
21 
22 enum {
23 	IO_URING_QUERY_OPCODES			= 0,
24 	IO_URING_QUERY_ZCRX			= 1,
25 	IO_URING_QUERY_SCQ			= 2,
26 	IO_URING_QUERY_ZCRX_EVENT		= 3,
27 
28 	__IO_URING_QUERY_MAX,
29 };
30 
31 /* Doesn't require a ring */
32 struct io_uring_query_opcode {
33 	/* The number of supported IORING_OP_* opcodes */
34 	__u32	nr_request_opcodes;
35 	/* The number of supported IORING_[UN]REGISTER_* opcodes */
36 	__u32	nr_register_opcodes;
37 	/* Bitmask of all supported IORING_FEAT_* flags */
38 	__u64	feature_flags;
39 	/* Bitmask of all supported IORING_SETUP_* flags */
40 	__u64	ring_setup_flags;
41 	/* Bitmask of all supported IORING_ENTER_** flags */
42 	__u64	enter_flags;
43 	/* Bitmask of all supported IOSQE_* flags */
44 	__u64	sqe_flags;
45 	/* The number of available query opcodes */
46 	__u32	nr_query_opcodes;
47 	__u32	__pad;
48 };
49 
50 struct io_uring_query_zcrx {
51 	/* Bitmask of supported ZCRX_REG_* flags, */
52 	__u64 register_flags;
53 	/* Bitmask of all supported IORING_ZCRX_AREA_* flags */
54 	__u64 area_flags;
55 	/* The number of supported ZCRX_CTRL_* opcodes */
56 	__u32 nr_ctrl_opcodes;
57 	/* Bitmask of ZCRX_FEATURE_* indicating which features are available */
58 	__u32 features;
59 	/* The refill ring header size */
60 	__u32 rq_hdr_size;
61 	/* The alignment for the header */
62 	__u32 rq_hdr_alignment;
63 	__u64 __resv2;
64 };
65 
66 struct io_uring_query_zcrx_event {
67 	/* Bitmask of supported ZCRX_EVENT_* flags */
68 	__u32 event_flags;
69 	/* Size of zcrx_stats */
70 	__u32 stats_size;
71 	/* Required alignment for the stats struct within the region (ie stats_offset) */
72 	__u32 stats_off_alignment;
73 	__u32 __resv1;
74 	__u64 __resv2[4];
75 };
76 
77 struct io_uring_query_scq {
78 	/* The SQ/CQ rings header size */
79 	__u64 hdr_size;
80 	/* The alignment for the header */
81 	__u64 hdr_alignment;
82 };
83 
84 #endif
85