blob: 5ffa11bf5d2e71ee9b3e185e3b95d9698394f6c5 [file] [log] [blame]
Jens Axboef9ead182022-05-25 06:25:13 -06001// SPDX-License-Identifier: GPL-2.0
2
3#include <linux/net.h>
4#include <linux/uio.h>
5
Jens Axboe43e0bbb2022-07-07 14:30:09 -06006#include "alloc_cache.h"
7
Jens Axboef9ead182022-05-25 06:25:13 -06008#if defined(CONFIG_NET)
9struct io_async_msghdr {
Jens Axboe43e0bbb2022-07-07 14:30:09 -060010 union {
11 struct iovec fast_iov[UIO_FASTIOV];
Dylan Yudaken9bb66902022-07-14 04:02:58 -070012 struct {
13 struct iovec fast_iov_one;
14 __kernel_size_t controllen;
15 int namelen;
16 __kernel_size_t payloadlen;
17 };
Jens Axboe43e0bbb2022-07-07 14:30:09 -060018 struct io_cache_entry cache;
19 };
Jens Axboef9ead182022-05-25 06:25:13 -060020 /* points to an allocated iov, if NULL we use fast_iov instead */
21 struct iovec *free_iov;
22 struct sockaddr __user *uaddr;
23 struct msghdr msg;
24 struct sockaddr_storage addr;
25};
26
27struct io_async_connect {
28 struct sockaddr_storage address;
29};
30
31int io_shutdown_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
32int io_shutdown(struct io_kiocb *req, unsigned int issue_flags);
33
34int io_sendmsg_prep_async(struct io_kiocb *req);
35void io_sendmsg_recvmsg_cleanup(struct io_kiocb *req);
36int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
37int io_sendmsg(struct io_kiocb *req, unsigned int issue_flags);
Pavel Begunkov516e82f2022-09-21 12:17:51 +010038
Jens Axboef9ead182022-05-25 06:25:13 -060039int io_send(struct io_kiocb *req, unsigned int issue_flags);
Pavel Begunkov516e82f2022-09-21 12:17:51 +010040int io_send_prep_async(struct io_kiocb *req);
Jens Axboef9ead182022-05-25 06:25:13 -060041
42int io_recvmsg_prep_async(struct io_kiocb *req);
43int io_recvmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
44int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags);
45int io_recv(struct io_kiocb *req, unsigned int issue_flags);
46
Pavel Begunkov7e6b6382022-09-21 12:17:48 +010047void io_sendrecv_fail(struct io_kiocb *req);
48
Jens Axboef9ead182022-05-25 06:25:13 -060049int io_accept_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
50int io_accept(struct io_kiocb *req, unsigned int issue_flags);
51
52int io_socket_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
53int io_socket(struct io_kiocb *req, unsigned int issue_flags);
54
55int io_connect_prep_async(struct io_kiocb *req);
56int io_connect_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
57int io_connect(struct io_kiocb *req, unsigned int issue_flags);
Jens Axboe43e0bbb2022-07-07 14:30:09 -060058
Pavel Begunkovb0e9b552022-09-21 12:17:52 +010059int io_send_zc(struct io_kiocb *req, unsigned int issue_flags);
Pavel Begunkov493108d2022-09-21 12:17:54 +010060int io_sendmsg_zc(struct io_kiocb *req, unsigned int issue_flags);
Pavel Begunkovb0e9b552022-09-21 12:17:52 +010061int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
62void io_send_zc_cleanup(struct io_kiocb *req);
Pavel Begunkov06a54642022-07-12 21:52:43 +010063
Jens Axboe43e0bbb2022-07-07 14:30:09 -060064void io_netmsg_cache_free(struct io_cache_entry *entry);
65#else
66static inline void io_netmsg_cache_free(struct io_cache_entry *entry)
67{
68}
Jens Axboef9ead182022-05-25 06:25:13 -060069#endif