Skip to content

Commit f8f115b

Browse files
committed
Merge branch 'zcrx-updates-6.19' into for-6.19/io_uring
Merge zcrx updates from Pavel: "Zcrx updates for 6.19. It includes a bunch of small patches, IORING_REGISTER_ZCRX_CTRL and RQ flushing (Patches 4-5) and David's work on sharing zcrx b/w multiple io_uring instances." Link: https://lore.kernel.org/io-uring/cover.1763029704.git.asml.silence@gmail.com/ Signed-off-by: Jens Axboe <axboe@kernel.dk> * zcrx-updates-6.19: io_uring/zcrx: share an ifq between rings io_uring/zcrx: add io_fill_zcrx_offsets() io_uring/zcrx: export zcrx via a file io_uring/zcrx: move io_zcrx_scrub() and dependencies up io_uring/zcrx: count zcrx users io_uring/zcrx: add sync refill queue flushing io_uring/zcrx: introduce IORING_REGISTER_ZCRX_CTRL io_uring/zcrx: elide passing msg flags io_uring/zcrx: use folio_nr_pages() instead of shift operation io_uring/zcrx: convert to use netmem_desc
2 parents 5bd38e1 + 00d9148 commit f8f115b

5 files changed

Lines changed: 317 additions & 61 deletions

File tree

include/uapi/linux/io_uring.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,9 @@ enum io_uring_register_op {
697697
/* query various aspects of io_uring, see linux/io_uring/query.h */
698698
IORING_REGISTER_QUERY = 35,
699699

700+
/* auxiliary zcrx configuration, see enum zcrx_ctrl_op */
701+
IORING_REGISTER_ZCRX_CTRL = 36,
702+
700703
/* this goes last */
701704
IORING_REGISTER_LAST,
702705

@@ -1060,6 +1063,10 @@ struct io_uring_zcrx_area_reg {
10601063
__u64 __resv2[2];
10611064
};
10621065

1066+
enum zcrx_reg_flags {
1067+
ZCRX_REG_IMPORT = 1,
1068+
};
1069+
10631070
/*
10641071
* Argument for IORING_REGISTER_ZCRX_IFQ
10651072
*/
@@ -1078,6 +1085,33 @@ struct io_uring_zcrx_ifq_reg {
10781085
__u64 __resv[3];
10791086
};
10801087

1088+
enum zcrx_ctrl_op {
1089+
ZCRX_CTRL_FLUSH_RQ,
1090+
ZCRX_CTRL_EXPORT,
1091+
1092+
__ZCRX_CTRL_LAST,
1093+
};
1094+
1095+
struct zcrx_ctrl_flush_rq {
1096+
__u64 __resv[6];
1097+
};
1098+
1099+
struct zcrx_ctrl_export {
1100+
__u32 zcrx_fd;
1101+
__u32 __resv1[11];
1102+
};
1103+
1104+
struct zcrx_ctrl {
1105+
__u32 zcrx_id;
1106+
__u32 op; /* see enum zcrx_ctrl_op */
1107+
__u64 __resv[2];
1108+
1109+
union {
1110+
struct zcrx_ctrl_export zc_export;
1111+
struct zcrx_ctrl_flush_rq zc_flush;
1112+
};
1113+
};
1114+
10811115
#ifdef __cplusplus
10821116
}
10831117
#endif

io_uring/net.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ enum sr_retry_flags {
110110

111111
struct io_recvzc {
112112
struct file *file;
113-
unsigned msg_flags;
114113
u16 flags;
115114
u32 len;
116115
struct io_zcrx_ifq *ifq;
@@ -1253,8 +1252,7 @@ int io_recvzc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
12531252

12541253
zc->len = READ_ONCE(sqe->len);
12551254
zc->flags = READ_ONCE(sqe->ioprio);
1256-
zc->msg_flags = READ_ONCE(sqe->msg_flags);
1257-
if (zc->msg_flags)
1255+
if (READ_ONCE(sqe->msg_flags))
12581256
return -EINVAL;
12591257
if (zc->flags & ~(IORING_RECVSEND_POLL_FIRST | IORING_RECV_MULTISHOT))
12601258
return -EINVAL;
@@ -1283,8 +1281,7 @@ int io_recvzc(struct io_kiocb *req, unsigned int issue_flags)
12831281
return -ENOTSOCK;
12841282

12851283
len = zc->len;
1286-
ret = io_zcrx_recv(req, zc->ifq, sock, zc->msg_flags | MSG_DONTWAIT,
1287-
issue_flags, &zc->len);
1284+
ret = io_zcrx_recv(req, zc->ifq, sock, 0, issue_flags, &zc->len);
12881285
if (len && zc->len == 0) {
12891286
io_req_set_res(req, 0, 0);
12901287

io_uring/register.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,9 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode,
815815
case IORING_REGISTER_QUERY:
816816
ret = io_query(ctx, arg, nr_args);
817817
break;
818+
case IORING_REGISTER_ZCRX_CTRL:
819+
ret = io_zcrx_ctrl(ctx, arg, nr_args);
820+
break;
818821
default:
819822
ret = -EINVAL;
820823
break;

0 commit comments

Comments
 (0)