[PATCH 3/3] io_uring/net: add IORING_SEND_IGNORE_INLINE support to zerocopy send

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If IORING_SEND_IGNORE_INLINE is set for a send zerocopy request, then a
successful inline completion of such a request will be ignored for a
submit_and_wait() type of submissions. In other words, if an application
submits a send for socketA with a recv for socketB, it can now do:

io_uring_submit_and_wait(ring, 1);

and have the inline send completion be ignored from the number of items
to wait for. Note that this only applies to the direct zerocopy send
completion, it does not include the notification when it's safe to reuse
the buffer. Those happen out-of-line anyway.

Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
---
 io_uring/net.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/io_uring/net.c b/io_uring/net.c
index 11ff58a5c145..79f980182a10 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -1223,7 +1223,8 @@ void io_send_zc_cleanup(struct io_kiocb *req)
 }
 
 #define IO_ZC_FLAGS_COMMON (IORING_RECVSEND_POLL_FIRST | IORING_RECVSEND_FIXED_BUF)
-#define IO_ZC_FLAGS_VALID  (IO_ZC_FLAGS_COMMON | IORING_SEND_ZC_REPORT_USAGE)
+#define IO_ZC_FLAGS_VALID  (IO_ZC_FLAGS_COMMON | IORING_SEND_ZC_REPORT_USAGE | \
+				IORING_SEND_IGNORE_INLINE)
 
 int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 {
@@ -1259,6 +1260,8 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 			nd->zc_used = false;
 			nd->zc_copied = false;
 		}
+		if (zc->flags & IORING_SEND_IGNORE_INLINE)
+			req->flags |= REQ_F_IGNORE_INLINE;
 	}
 
 	if (zc->flags & IORING_RECVSEND_FIXED_BUF) {
@@ -1406,6 +1409,8 @@ int io_send_zc(struct io_kiocb *req, unsigned int issue_flags)
 	ret = sock_sendmsg(sock, &kmsg->msg);
 
 	if (unlikely(ret < min_ret)) {
+		req->flags &= ~REQ_F_IGNORE_INLINE;
+
 		if (ret == -EAGAIN && (issue_flags & IO_URING_F_NONBLOCK))
 			return -EAGAIN;
 
-- 
2.45.2





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux