diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2025-03-28 23:10:58 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2025-03-28 17:11:20 -0600 |
commit | 49dbce5602dc50343c9794d0ddf05d1f6c9cb592 (patch) | |
tree | c6ef025ccc639ae7904cee9b0dde8a2202d4cf27 /io_uring | |
parent | 63b16e4f0b90abad500ecb7bc7a625278febdc2c (diff) |
io_uring/net: clusterise send vs msghdr branches
We have multiple branches at prep for send vs sendmsg handling, put them
together so that the variant handling is more localised.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/33abf666d9ded74cba4da2f0d9fe58e88520dffe.1743202294.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r-- | io_uring/net.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/io_uring/net.c b/io_uring/net.c index 6d02c8822cc9..9acd8d9f80b2 100644 --- a/io_uring/net.c +++ b/io_uring/net.c @@ -395,12 +395,6 @@ int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) sr->done_io = 0; sr->retry = false; - - if (req->opcode != IORING_OP_SEND) { - if (sqe->addr2 || sqe->file_index) - return -EINVAL; - } - sr->len = READ_ONCE(sqe->len); sr->flags = READ_ONCE(sqe->ioprio); if (sr->flags & ~SENDMSG_FLAGS) @@ -426,6 +420,8 @@ int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) return -ENOMEM; if (req->opcode != IORING_OP_SENDMSG) return io_send_setup(req, sqe); + if (unlikely(sqe->addr2 || sqe->file_index)) + return -EINVAL; return io_sendmsg_setup(req, sqe); } @@ -1303,11 +1299,6 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) } } - if (req->opcode != IORING_OP_SEND_ZC) { - if (unlikely(sqe->addr2 || sqe->file_index)) - return -EINVAL; - } - zc->len = READ_ONCE(sqe->len); zc->msg_flags = READ_ONCE(sqe->msg_flags) | MSG_NOSIGNAL | MSG_ZEROCOPY; req->buf_index = READ_ONCE(sqe->buf_index); @@ -1323,6 +1314,8 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) req->flags |= REQ_F_IMPORT_BUFFER; return io_send_setup(req, sqe); } + if (unlikely(sqe->addr2 || sqe->file_index)) + return -EINVAL; ret = io_sendmsg_setup(req, sqe); if (unlikely(ret)) return ret; |