Skip to content

Commit 03e452f

Browse files
committed
Merge branch 'io_uring-6.17' into for-next
* io_uring-6.17: io_uring/net: Allow to do vectorized send
2 parents 4f92d05 + 1b67df3 commit 03e452f

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

include/uapi/linux/io_uring.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,12 +392,16 @@ enum io_uring_op {
392392
* the starting buffer ID in cqe->flags as per
393393
* usual for provided buffer usage. The buffers
394394
* will be contiguous from the starting buffer ID.
395+
*
396+
* IORING_SEND_VECTORIZED If set, SEND[_ZC] will take a pointer to a io_vec
397+
* to allow vectorized send operations.
395398
*/
396399
#define IORING_RECVSEND_POLL_FIRST (1U << 0)
397400
#define IORING_RECV_MULTISHOT (1U << 1)
398401
#define IORING_RECVSEND_FIXED_BUF (1U << 2)
399402
#define IORING_SEND_ZC_REPORT_USAGE (1U << 3)
400403
#define IORING_RECVSEND_BUNDLE (1U << 4)
404+
#define IORING_SEND_VECTORIZED (1U << 5)
401405

402406
/*
403407
* cqe.res for IORING_CQE_F_NOTIF if

io_uring/net.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,10 @@ static int io_send_setup(struct io_kiocb *req, const struct io_uring_sqe *sqe)
382382
}
383383
if (req->flags & REQ_F_BUFFER_SELECT)
384384
return 0;
385+
386+
if (sr->flags & IORING_SEND_VECTORIZED)
387+
return io_net_import_vec(req, kmsg, sr->buf, sr->len, ITER_SOURCE);
388+
385389
return import_ubuf(ITER_SOURCE, sr->buf, sr->len, &kmsg->msg.msg_iter);
386390
}
387391

@@ -409,7 +413,7 @@ static int io_sendmsg_setup(struct io_kiocb *req, const struct io_uring_sqe *sqe
409413
return io_net_import_vec(req, kmsg, msg.msg_iov, msg.msg_iovlen, ITER_SOURCE);
410414
}
411415

412-
#define SENDMSG_FLAGS (IORING_RECVSEND_POLL_FIRST | IORING_RECVSEND_BUNDLE)
416+
#define SENDMSG_FLAGS (IORING_RECVSEND_POLL_FIRST | IORING_RECVSEND_BUNDLE | IORING_SEND_VECTORIZED)
413417

414418
int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
415419
{
@@ -420,6 +424,7 @@ int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
420424
sr->flags = READ_ONCE(sqe->ioprio);
421425
if (sr->flags & ~SENDMSG_FLAGS)
422426
return -EINVAL;
427+
423428
sr->msg_flags = READ_ONCE(sqe->msg_flags) | MSG_NOSIGNAL;
424429
if (sr->msg_flags & MSG_DONTWAIT)
425430
req->flags |= REQ_F_NOWAIT;

0 commit comments

Comments
 (0)