Skip to content

Commit 3e747de

Browse files
committed
io_uring/net: add generic multishot retry helper
This is just moving io_recv_prep_retry() higher up so it can get used for sends as well, and rename it to be generically useful for both sends and receives. Signed-off-by: Jens Axboe <[email protected]>
1 parent df604d2 commit 3e747de

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

io_uring/net.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,17 @@ static int io_net_vec_assign(struct io_kiocb *req, struct io_async_msghdr *kmsg,
185185
return 0;
186186
}
187187

188+
static inline void io_mshot_prep_retry(struct io_kiocb *req,
189+
struct io_async_msghdr *kmsg)
190+
{
191+
struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg);
192+
193+
req->flags &= ~REQ_F_BL_EMPTY;
194+
sr->done_io = 0;
195+
sr->len = 0; /* get from the provided buffer */
196+
req->buf_index = sr->buf_group;
197+
}
198+
188199
#ifdef CONFIG_COMPAT
189200
static int io_compat_msg_copy_hdr(struct io_kiocb *req,
190201
struct io_async_msghdr *iomsg,
@@ -658,17 +669,6 @@ int io_recvmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
658669
return io_recvmsg_prep_setup(req);
659670
}
660671

661-
static inline void io_recv_prep_retry(struct io_kiocb *req,
662-
struct io_async_msghdr *kmsg)
663-
{
664-
struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg);
665-
666-
req->flags &= ~REQ_F_BL_EMPTY;
667-
sr->done_io = 0;
668-
sr->len = 0; /* get from the provided buffer */
669-
req->buf_index = sr->buf_group;
670-
}
671-
672672
/*
673673
* Finishes io_recv and io_recvmsg.
674674
*
@@ -694,7 +694,7 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
694694
struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg);
695695
int mshot_retry_ret = IOU_ISSUE_SKIP_COMPLETE;
696696

697-
io_recv_prep_retry(req, kmsg);
697+
io_mshot_prep_retry(req, kmsg);
698698
/* Known not-empty or unknown state, retry */
699699
if (cflags & IORING_CQE_F_SOCK_NONEMPTY || kmsg->msg.msg_inq < 0) {
700700
if (sr->nr_multishot_loops++ < MULTISHOT_MAX_RETRY)

0 commit comments

Comments
 (0)