diff options
author | Jens Axboe <axboe@kernel.dk> | 2024-02-25 22:52:39 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-04-22 20:25:49 +0300 |
commit | 3e747dedd47b6250390abfc08dc0aa4817d3c052 (patch) | |
tree | 6e75be54222e8eefbb22869e29608bc7d741a5e1 | |
parent | df604d2ad480fcf7b39767280c9093e13b1de952 (diff) | |
download | linux-3e747dedd47b6250390abfc08dc0aa4817d3c052.tar.xz |
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 <axboe@kernel.dk>
-rw-r--r-- | io_uring/net.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/io_uring/net.c b/io_uring/net.c index a1da8a2ebf15..dc310f0bfe4c 100644 --- a/io_uring/net.c +++ b/io_uring/net.c @@ -185,6 +185,17 @@ static int io_net_vec_assign(struct io_kiocb *req, struct io_async_msghdr *kmsg, return 0; } +static inline void io_mshot_prep_retry(struct io_kiocb *req, + struct io_async_msghdr *kmsg) +{ + struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); + + req->flags &= ~REQ_F_BL_EMPTY; + sr->done_io = 0; + sr->len = 0; /* get from the provided buffer */ + req->buf_index = sr->buf_group; +} + #ifdef CONFIG_COMPAT static int io_compat_msg_copy_hdr(struct io_kiocb *req, struct io_async_msghdr *iomsg, @@ -658,17 +669,6 @@ int io_recvmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) return io_recvmsg_prep_setup(req); } -static inline void io_recv_prep_retry(struct io_kiocb *req, - struct io_async_msghdr *kmsg) -{ - struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); - - req->flags &= ~REQ_F_BL_EMPTY; - sr->done_io = 0; - sr->len = 0; /* get from the provided buffer */ - req->buf_index = sr->buf_group; -} - /* * Finishes io_recv and io_recvmsg. * @@ -694,7 +694,7 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret, struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); int mshot_retry_ret = IOU_ISSUE_SKIP_COMPLETE; - io_recv_prep_retry(req, kmsg); + io_mshot_prep_retry(req, kmsg); /* Known not-empty or unknown state, retry */ if (cflags & IORING_CQE_F_SOCK_NONEMPTY || kmsg->msg.msg_inq < 0) { if (sr->nr_multishot_loops++ < MULTISHOT_MAX_RETRY) |