Skip to content

Commit d285da7

Browse files
isilenceaxboe
authored andcommitted
io_uring/net: set MSG_ZEROCOPY for sendzc in advance
We can set MSG_ZEROCOPY at the preparation step, do it so we don't have to care about it later in the issue callback. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/c2c22aaa577624977f045979a6db2b9fb2e5648c.1712534031.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 6b7f864 commit d285da7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

io_uring/net.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
10501050

10511051
zc->buf = u64_to_user_ptr(READ_ONCE(sqe->addr));
10521052
zc->len = READ_ONCE(sqe->len);
1053-
zc->msg_flags = READ_ONCE(sqe->msg_flags) | MSG_NOSIGNAL;
1053+
zc->msg_flags = READ_ONCE(sqe->msg_flags) | MSG_NOSIGNAL | MSG_ZEROCOPY;
10541054
if (zc->msg_flags & MSG_DONTWAIT)
10551055
req->flags |= REQ_F_NOWAIT;
10561056

@@ -1167,7 +1167,7 @@ int io_send_zc(struct io_kiocb *req, unsigned int issue_flags)
11671167
return ret;
11681168
}
11691169

1170-
msg_flags = zc->msg_flags | MSG_ZEROCOPY;
1170+
msg_flags = zc->msg_flags;
11711171
if (issue_flags & IO_URING_F_NONBLOCK)
11721172
msg_flags |= MSG_DONTWAIT;
11731173
if (msg_flags & MSG_WAITALL)
@@ -1229,7 +1229,7 @@ int io_sendmsg_zc(struct io_kiocb *req, unsigned int issue_flags)
12291229
(sr->flags & IORING_RECVSEND_POLL_FIRST))
12301230
return -EAGAIN;
12311231

1232-
flags = sr->msg_flags | MSG_ZEROCOPY;
1232+
flags = sr->msg_flags;
12331233
if (issue_flags & IO_URING_F_NONBLOCK)
12341234
flags |= MSG_DONTWAIT;
12351235
if (flags & MSG_WAITALL)

0 commit comments

Comments
 (0)