From: Jens Axboe <axboe@kernel.dk>
To: io-uring@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 09/12] io_uring/net: use struct io_br_sel->val as the send finish value
Date: Wed, 20 Aug 2025 20:03:38 -0600 [thread overview]
Message-ID: <20250821020750.598432-11-axboe@kernel.dk> (raw)
In-Reply-To: <20250821020750.598432-2-axboe@kernel.dk>
Currently a pointer is passed in to the 'ret' in the send mshot handler,
but since we already have a value field in io_br_sel, just use that.
This is also in preparation for needing to pass in struct io_br_sel
to io_send_finish() anyway.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
io_uring/net.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/io_uring/net.c b/io_uring/net.c
index a7a4443e3ee7..4eb208d24169 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -503,19 +503,20 @@ static int io_net_kbuf_recyle(struct io_kiocb *req, struct io_buffer_list *bl,
return IOU_RETRY;
}
-static inline bool io_send_finish(struct io_kiocb *req, int *ret,
- struct io_async_msghdr *kmsg)
+static inline bool io_send_finish(struct io_kiocb *req,
+ struct io_async_msghdr *kmsg,
+ struct io_br_sel *sel)
{
struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg);
- bool bundle_finished = *ret <= 0;
+ bool bundle_finished = sel->val <= 0;
unsigned int cflags;
if (!(sr->flags & IORING_RECVSEND_BUNDLE)) {
- cflags = io_put_kbuf(req, *ret, req->buf_list);
+ cflags = io_put_kbuf(req, sel->val, req->buf_list);
goto finish;
}
- cflags = io_put_kbufs(req, *ret, req->buf_list, io_bundle_nbufs(kmsg, *ret));
+ cflags = io_put_kbufs(req, sel->val, req->buf_list, io_bundle_nbufs(kmsg, sel->val));
if (bundle_finished || req->flags & REQ_F_BL_EMPTY)
goto finish;
@@ -524,15 +525,15 @@ static inline bool io_send_finish(struct io_kiocb *req, int *ret,
* Fill CQE for this receive and see if we should keep trying to
* receive from this socket.
*/
- if (io_req_post_cqe(req, *ret, cflags | IORING_CQE_F_MORE)) {
+ if (io_req_post_cqe(req, sel->val, cflags | IORING_CQE_F_MORE)) {
io_mshot_prep_retry(req, kmsg);
return false;
}
/* Otherwise stop bundle and use the current result. */
finish:
- io_req_set_res(req, *ret, cflags);
- *ret = IOU_COMPLETE;
+ io_req_set_res(req, sel->val, cflags);
+ sel->val = IOU_COMPLETE;
return true;
}
@@ -692,11 +693,12 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags)
else if (sr->done_io)
ret = sr->done_io;
- if (!io_send_finish(req, &ret, kmsg))
+ sel.val = ret;
+ if (!io_send_finish(req, kmsg, &sel))
goto retry_bundle;
io_req_msg_cleanup(req, issue_flags);
- return ret;
+ return sel.val;
}
static int io_recvmsg_mshot_prep(struct io_kiocb *req,
--
2.50.1
next prev parent reply other threads:[~2025-08-21 2:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-21 2:03 [PATCHSET v2 0/12] Move io_buffer_list out of struct io_kiocb Jens Axboe
2025-08-21 2:03 ` [PATCH 01/12] io_uring/kbuf: drop 'issue_flags' from io_put_kbuf(s)() arguments Jens Axboe
2025-08-21 2:03 ` [PATCH 02/12] io_uring/net: don't use io_net_kbuf_recyle() for non-provided cases Jens Axboe
2025-08-21 2:03 ` [PATCH 03/12] io_uring/net: clarify io_recv_buf_select() return value Jens Axboe
2025-08-21 2:03 ` [PATCH 04/12] io_uring/kbuf: pass in struct io_buffer_list to commit/recycle helpers Jens Axboe
2025-08-21 2:03 ` [PATCH 05/12] io_uring/kbuf: introduce struct io_br_sel Jens Axboe
2025-08-21 2:03 ` [PATCH 06/12] io_uring/rw: recycle buffers manually for non-mshot reads Jens Axboe
2025-08-21 2:03 ` [PATCH 07/12] io_uring/kbuf: use struct io_br_sel for multiple buffers picking Jens Axboe
2025-08-21 2:03 ` [PATCH 08/12] io_uring/net: use struct io_br_sel->val as the recv finish value Jens Axboe
2025-08-21 2:03 ` Jens Axboe [this message]
2025-08-21 2:03 ` [PATCH 10/12] io_uring/kbuf: switch to storing struct io_buffer_list locally Jens Axboe
2025-08-21 2:03 ` [PATCH 11/12] io_uring: remove async/poll related provided buffer recycles Jens Axboe
2025-08-21 2:03 ` [PATCH 12/12] io_uring/kbuf: check for ring provided buffers first in recycling 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 \
--in-reply-to=20250821020750.598432-11-axboe@kernel.dk \
--to=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
/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