Skip to content

Commit

Permalink
io_uring/net: move recv/recvmsg flags out of retry loop
Browse files Browse the repository at this point in the history
The flags don't change, just intialize them once rather than every loop
for multishot.

Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
axboe committed Mar 1, 2024
1 parent c3f9109 commit eb18c29
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions io_uring/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,10 @@ int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags)
if (!io_check_multishot(req, issue_flags))
return io_setup_async_msg(req, kmsg, issue_flags);

flags = sr->msg_flags;
if (force_nonblock)
flags |= MSG_DONTWAIT;

retry_multishot:
if (io_do_buffer_select(req)) {
void __user *buf;
Expand All @@ -875,10 +879,6 @@ int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags)
iov_iter_ubuf(&kmsg->msg.msg_iter, ITER_DEST, buf, len);
}

flags = sr->msg_flags;
if (force_nonblock)
flags |= MSG_DONTWAIT;

kmsg->msg.msg_get_inq = 1;
kmsg->msg.msg_inq = -1;
if (req->flags & REQ_F_APOLL_MULTISHOT) {
Expand Down Expand Up @@ -964,6 +964,10 @@ int io_recv(struct io_kiocb *req, unsigned int issue_flags)
msg.msg_iocb = NULL;
msg.msg_ubuf = NULL;

flags = sr->msg_flags;
if (force_nonblock)
flags |= MSG_DONTWAIT;

retry_multishot:
if (io_do_buffer_select(req)) {
void __user *buf;
Expand All @@ -982,9 +986,6 @@ int io_recv(struct io_kiocb *req, unsigned int issue_flags)
msg.msg_inq = -1;
msg.msg_flags = 0;

flags = sr->msg_flags;
if (force_nonblock)
flags |= MSG_DONTWAIT;
if (flags & MSG_WAITALL)
min_ret = iov_iter_count(&msg.msg_iter);

Expand Down

0 comments on commit eb18c29

Please sign in to comment.