]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
io_uring/net: use io_sr_msg for sendzc
authorPavel Begunkov <asml.silence@gmail.com>
Sun, 16 Oct 2022 20:33:26 +0000 (21:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Oct 2022 10:39:27 +0000 (12:39 +0200)
[ upstream commit ac9e5784bbe72f4f603d1af84760ec09bc0b5ccd ]

Reuse struct io_sr_msg for zerocopy sends, which is handy. There is
only one zerocopy specific field, namely .notif, and we have enough
space for it.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/408c5b1b2d8869e1a12da5f5a78ed72cac112149.1662639236.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
io_uring/net.c

index 62682f0f57f10e2779877300d688f2770116e3ed..ea19eddfe1782aaee297b850d11bcc472c373ea1 100644 (file)
@@ -60,15 +60,7 @@ struct io_sr_msg {
        unsigned                        done_io;
        unsigned                        msg_flags;
        u16                             flags;
-};
-
-struct io_sendzc {
-       struct file                     *file;
-       void __user                     *buf;
-       unsigned                        len;
-       unsigned                        done_io;
-       unsigned                        msg_flags;
-       u16                             flags;
+       /* used only for sendzc */
        u16                             addr_len;
        void __user                     *addr;
        struct io_kiocb                 *notif;
@@ -188,7 +180,7 @@ static int io_sendmsg_copy_hdr(struct io_kiocb *req,
 
 int io_sendzc_prep_async(struct io_kiocb *req)
 {
-       struct io_sendzc *zc = io_kiocb_to_cmd(req, struct io_sendzc);
+       struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg);
        struct io_async_msghdr *io;
        int ret;
 
@@ -885,7 +877,7 @@ out_free:
 
 void io_sendzc_cleanup(struct io_kiocb *req)
 {
-       struct io_sendzc *zc = io_kiocb_to_cmd(req, struct io_sendzc);
+       struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg);
 
        zc->notif->flags |= REQ_F_CQE_SKIP;
        io_notif_flush(zc->notif);
@@ -894,7 +886,7 @@ void io_sendzc_cleanup(struct io_kiocb *req)
 
 int io_sendzc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 {
-       struct io_sendzc *zc = io_kiocb_to_cmd(req, struct io_sendzc);
+       struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg);
        struct io_ring_ctx *ctx = req->ctx;
        struct io_kiocb *notif;
 
@@ -1000,7 +992,7 @@ static int io_sg_from_iter(struct sock *sk, struct sk_buff *skb,
 int io_sendzc(struct io_kiocb *req, unsigned int issue_flags)
 {
        struct sockaddr_storage __address, *addr = NULL;
-       struct io_sendzc *zc = io_kiocb_to_cmd(req, struct io_sendzc);
+       struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg);
        struct msghdr msg;
        struct iovec iov;
        struct socket *sock;