summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2025-02-25 00:31:08 +0300
committerJens Axboe <axboe@kernel.dk>2025-02-27 17:17:39 +0300
commit81cc96fcb3dcfb3d85df4e0eec56149b5b53c016 (patch)
tree9a3e742992008c2a4f528daac2ef2168543f2d3a
parenta14ca7a413ec8a9f9184c543691f890a011ed98a (diff)
downloadlinux-81cc96fcb3dcfb3d85df4e0eec56149b5b53c016.tar.xz
io_uring/net: reuse req->buf_index for sendzc
There is already a field in io_kiocb that can store a registered buffer index, use that instead of stashing the value into struct io_sr_msg. Reviewed-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Reviewed-by: Pavel Begunkov <asml.silence@gmail.com> Reviewed-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20250224213116.3509093-4-kbusch@meta.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--io_uring/net.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/io_uring/net.c b/io_uring/net.c
index 8283a1f55192..22fa1664a6b1 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -75,7 +75,6 @@ struct io_sr_msg {
u16 flags;
/* initialised and used only by !msg send variants */
u16 buf_group;
- u16 buf_index;
bool retry;
void __user *msg_control;
/* used only for send zerocopy */
@@ -1287,7 +1286,7 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
zc->len = READ_ONCE(sqe->len);
zc->msg_flags = READ_ONCE(sqe->msg_flags) | MSG_NOSIGNAL | MSG_ZEROCOPY;
- zc->buf_index = READ_ONCE(sqe->buf_index);
+ req->buf_index = READ_ONCE(sqe->buf_index);
if (zc->msg_flags & MSG_DONTWAIT)
req->flags |= REQ_F_NOWAIT;
@@ -1363,7 +1362,7 @@ static int io_send_zc_import(struct io_kiocb *req, unsigned int issue_flags)
ret = -EFAULT;
io_ring_submit_lock(ctx, issue_flags);
- node = io_rsrc_node_lookup(&ctx->buf_table, sr->buf_index);
+ node = io_rsrc_node_lookup(&ctx->buf_table, req->buf_index);
if (node) {
io_req_assign_buf_node(sr->notif, node);
ret = 0;