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/zcrx: move zcrx uapi into separate header

Split out zcrx uapi into a separate file. It'll be easier to manage it
this way, and that reduces the size of a not so small io_uring.h. Since
there are users that expect that zcrx definitions come with io_uring.h,
it includes the new file.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Pavel Begunkov and committed by
Jens Axboe
d9d2455e dc156e0f

+110 -94
+2 -94
include/uapi/linux/io_uring.h
··· 10 10 11 11 #include <linux/fs.h> 12 12 #include <linux/types.h> 13 + #include <linux/io_uring/zcrx.h> 14 + 13 15 /* 14 16 * this file is shared with liburing and that has to autodetect 15 17 * if linux/time_types.h is available or not, it can ··· 1050 1048 struct io_timespec { 1051 1049 __u64 tv_sec; 1052 1050 __u64 tv_nsec; 1053 - }; 1054 - 1055 - /* Zero copy receive refill queue entry */ 1056 - struct io_uring_zcrx_rqe { 1057 - __u64 off; 1058 - __u32 len; 1059 - __u32 __pad; 1060 - }; 1061 - 1062 - struct io_uring_zcrx_cqe { 1063 - __u64 off; 1064 - __u64 __pad; 1065 - }; 1066 - 1067 - /* The bit from which area id is encoded into offsets */ 1068 - #define IORING_ZCRX_AREA_SHIFT 48 1069 - #define IORING_ZCRX_AREA_MASK (~(((__u64)1 << IORING_ZCRX_AREA_SHIFT) - 1)) 1070 - 1071 - struct io_uring_zcrx_offsets { 1072 - __u32 head; 1073 - __u32 tail; 1074 - __u32 rqes; 1075 - __u32 __resv2; 1076 - __u64 __resv[2]; 1077 - }; 1078 - 1079 - enum io_uring_zcrx_area_flags { 1080 - IORING_ZCRX_AREA_DMABUF = 1, 1081 - }; 1082 - 1083 - struct io_uring_zcrx_area_reg { 1084 - __u64 addr; 1085 - __u64 len; 1086 - __u64 rq_area_token; 1087 - __u32 flags; 1088 - __u32 dmabuf_fd; 1089 - __u64 __resv2[2]; 1090 - }; 1091 - 1092 - enum zcrx_reg_flags { 1093 - ZCRX_REG_IMPORT = 1, 1094 - }; 1095 - 1096 - enum zcrx_features { 1097 - /* 1098 - * The user can ask for the desired rx page size by passing the 1099 - * value in struct io_uring_zcrx_ifq_reg::rx_buf_len. 1100 - */ 1101 - ZCRX_FEATURE_RX_PAGE_SIZE = 1 << 0, 1102 - }; 1103 - 1104 - /* 1105 - * Argument for IORING_REGISTER_ZCRX_IFQ 1106 - */ 1107 - struct io_uring_zcrx_ifq_reg { 1108 - __u32 if_idx; 1109 - __u32 if_rxq; 1110 - __u32 rq_entries; 1111 - __u32 flags; 1112 - 1113 - __u64 area_ptr; /* pointer to struct io_uring_zcrx_area_reg */ 1114 - __u64 region_ptr; /* struct io_uring_region_desc * */ 1115 - 1116 - struct io_uring_zcrx_offsets offsets; 1117 - __u32 zcrx_id; 1118 - __u32 rx_buf_len; 1119 - __u64 __resv[3]; 1120 - }; 1121 - 1122 - enum zcrx_ctrl_op { 1123 - ZCRX_CTRL_FLUSH_RQ, 1124 - ZCRX_CTRL_EXPORT, 1125 - 1126 - __ZCRX_CTRL_LAST, 1127 - }; 1128 - 1129 - struct zcrx_ctrl_flush_rq { 1130 - __u64 __resv[6]; 1131 - }; 1132 - 1133 - struct zcrx_ctrl_export { 1134 - __u32 zcrx_fd; 1135 - __u32 __resv1[11]; 1136 - }; 1137 - 1138 - struct zcrx_ctrl { 1139 - __u32 zcrx_id; 1140 - __u32 op; /* see enum zcrx_ctrl_op */ 1141 - __u64 __resv[2]; 1142 - 1143 - union { 1144 - struct zcrx_ctrl_export zc_export; 1145 - struct zcrx_ctrl_flush_rq zc_flush; 1146 - }; 1147 1051 }; 1148 1052 1149 1053 #ifdef __cplusplus
+108
include/uapi/linux/io_uring/zcrx.h
··· 1 + /* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT */ 2 + /* 3 + * Header file for the io_uring zerocopy receive (zcrx) interface. 4 + * 5 + * Copyright (C) 2026 Pavel Begunkov 6 + * Copyright (C) 2026 David Wei 7 + * Copyright (C) Meta Platforms, Inc. 8 + */ 9 + #ifndef LINUX_IO_ZCRX_H 10 + #define LINUX_IO_ZCRX_H 11 + 12 + #include <linux/types.h> 13 + 14 + /* Zero copy receive refill queue entry */ 15 + struct io_uring_zcrx_rqe { 16 + __u64 off; 17 + __u32 len; 18 + __u32 __pad; 19 + }; 20 + 21 + struct io_uring_zcrx_cqe { 22 + __u64 off; 23 + __u64 __pad; 24 + }; 25 + 26 + /* The bit from which area id is encoded into offsets */ 27 + #define IORING_ZCRX_AREA_SHIFT 48 28 + #define IORING_ZCRX_AREA_MASK (~(((__u64)1 << IORING_ZCRX_AREA_SHIFT) - 1)) 29 + 30 + struct io_uring_zcrx_offsets { 31 + __u32 head; 32 + __u32 tail; 33 + __u32 rqes; 34 + __u32 __resv2; 35 + __u64 __resv[2]; 36 + }; 37 + 38 + enum io_uring_zcrx_area_flags { 39 + IORING_ZCRX_AREA_DMABUF = 1, 40 + }; 41 + 42 + struct io_uring_zcrx_area_reg { 43 + __u64 addr; 44 + __u64 len; 45 + __u64 rq_area_token; 46 + __u32 flags; 47 + __u32 dmabuf_fd; 48 + __u64 __resv2[2]; 49 + }; 50 + 51 + enum zcrx_reg_flags { 52 + ZCRX_REG_IMPORT = 1, 53 + }; 54 + 55 + enum zcrx_features { 56 + /* 57 + * The user can ask for the desired rx page size by passing the 58 + * value in struct io_uring_zcrx_ifq_reg::rx_buf_len. 59 + */ 60 + ZCRX_FEATURE_RX_PAGE_SIZE = 1 << 0, 61 + }; 62 + 63 + /* 64 + * Argument for IORING_REGISTER_ZCRX_IFQ 65 + */ 66 + struct io_uring_zcrx_ifq_reg { 67 + __u32 if_idx; 68 + __u32 if_rxq; 69 + __u32 rq_entries; 70 + __u32 flags; 71 + 72 + __u64 area_ptr; /* pointer to struct io_uring_zcrx_area_reg */ 73 + __u64 region_ptr; /* struct io_uring_region_desc * */ 74 + 75 + struct io_uring_zcrx_offsets offsets; 76 + __u32 zcrx_id; 77 + __u32 rx_buf_len; 78 + __u64 __resv[3]; 79 + }; 80 + 81 + enum zcrx_ctrl_op { 82 + ZCRX_CTRL_FLUSH_RQ, 83 + ZCRX_CTRL_EXPORT, 84 + 85 + __ZCRX_CTRL_LAST, 86 + }; 87 + 88 + struct zcrx_ctrl_flush_rq { 89 + __u64 __resv[6]; 90 + }; 91 + 92 + struct zcrx_ctrl_export { 93 + __u32 zcrx_fd; 94 + __u32 __resv1[11]; 95 + }; 96 + 97 + struct zcrx_ctrl { 98 + __u32 zcrx_id; 99 + __u32 op; /* see enum zcrx_ctrl_op */ 100 + __u64 __resv[2]; 101 + 102 + union { 103 + struct zcrx_ctrl_export zc_export; 104 + struct zcrx_ctrl_flush_rq zc_flush; 105 + }; 106 + }; 107 + 108 + #endif /* LINUX_IO_ZCRX_H */