Skip to content

Commit c292146

Browse files
isilenceaxboe
authored andcommitted
io_uring/query: return support for custom rx page size
Add an ability to query if the zcrx rx page size setting is available. Note, even when the API is supported by io_uring, the registration can still get rejected for various reasons, e.g. when the NIC or the driver doesn't support it, when the particular specified size is unsupported, when the memory area doesn't satisfy all requirements, etc. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 7496e65 commit c292146

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

include/uapi/linux/io_uring.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,14 @@ enum zcrx_reg_flags {
10901090
ZCRX_REG_IMPORT = 1,
10911091
};
10921092

1093+
enum zcrx_features {
1094+
/*
1095+
* The user can ask for the desired rx page size by passing the
1096+
* value in struct io_uring_zcrx_ifq_reg::rx_buf_len.
1097+
*/
1098+
ZCRX_FEATURE_RX_PAGE_SIZE = 1 << 0,
1099+
};
1100+
10931101
/*
10941102
* Argument for IORING_REGISTER_ZCRX_IFQ
10951103
*/

include/uapi/linux/io_uring/query.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ struct io_uring_query_zcrx {
5050
__u64 area_flags;
5151
/* The number of supported ZCRX_CTRL_* opcodes */
5252
__u32 nr_ctrl_opcodes;
53-
__u32 __resv1;
53+
/* Bitmask of ZCRX_FEATURE_* indicating which features are available */
54+
__u32 features;
5455
/* The refill ring header size */
5556
__u32 rq_hdr_size;
5657
/* The alignment for the header */

io_uring/query.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static ssize_t io_query_zcrx(union io_query_data *data)
3939
e->nr_ctrl_opcodes = __ZCRX_CTRL_LAST;
4040
e->rq_hdr_size = sizeof(struct io_uring);
4141
e->rq_hdr_alignment = L1_CACHE_BYTES;
42-
e->__resv1 = 0;
42+
e->features = ZCRX_FEATURE_RX_PAGE_SIZE;
4343
e->__resv2 = 0;
4444
return sizeof(*e);
4545
}

0 commit comments

Comments
 (0)