public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jens Axboe <[email protected]>
To: [email protected]
Cc: [email protected], [email protected], Jens Axboe <[email protected]>
Subject: [PATCH 5/9] io_uring/net: avoid redundant -ENOBUFS on recv multishot retry
Date: Mon, 26 Feb 2024 12:21:17 -0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Now that we know if the buffer list is empty upfront, there's no point
doing a retry for that case. This can help avoid a redundant -ENOBUFS
which would terminate the multishot receive, requiring the app to
re-arm it.

Signed-off-by: Jens Axboe <[email protected]>
---
 io_uring/net.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/io_uring/net.c b/io_uring/net.c
index 679eefcd11c5..aaab4f121b7f 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -698,6 +698,11 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
 		int mshot_retry_ret = IOU_ISSUE_SKIP_COMPLETE;
 
 		io_recv_prep_retry(req);
+
+		/* buffer list now empty, no point trying again */
+		if (req->flags & REQ_F_BL_EMPTY)
+			goto enobufs;
+
 		/* Known not-empty or unknown state, retry */
 		if (cflags & IORING_CQE_F_SOCK_NONEMPTY || msg->msg_inq == -1) {
 			if (sr->nr_multishot_loops++ < MULTISHOT_MAX_RETRY)
@@ -706,6 +711,7 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
 			sr->nr_multishot_loops = 0;
 			mshot_retry_ret = IOU_REQUEUE;
 		}
+enobufs:
 		if (issue_flags & IO_URING_F_MULTISHOT)
 			*ret = mshot_retry_ret;
 		else
-- 
2.43.0


  parent reply	other threads:[~2024-02-26 19:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-26 19:21 [PATCHSET v4 0/9] Support for provided buffers for send Jens Axboe
2024-02-26 19:21 ` [PATCH 1/9] net: remove {revc,send}msg_copy_msghdr() from exports Jens Axboe
2024-02-26 19:21 ` [PATCH 2/9] io_uring/net: add provided buffer support for IORING_OP_SEND Jens Axboe
2024-02-26 19:21 ` [PATCH 3/9] io_uring/net: add provided buffer support for IORING_OP_SENDMSG Jens Axboe
2024-02-26 19:21 ` [PATCH 4/9] io_uring/kbuf: flag request if buffer pool is empty after buffer pick Jens Axboe
2024-02-26 19:21 ` Jens Axboe [this message]
2024-02-26 19:21 ` [PATCH 6/9] io_uring/net: move recv/recvmsg flags out of retry loop Jens Axboe
2024-02-26 19:21 ` [PATCH 7/9] io_uring/net: add generic multishot retry helper Jens Axboe
2024-02-26 19:21 ` [PATCH 8/9] io_uring/net: support multishot for send Jens Axboe
2024-02-26 19:21 ` [PATCH 9/9] io_uring/net: support multishot for sendmsg Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox