1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | #ifndef _INET_COMMON_H |
3 | #define _INET_COMMON_H |
4 | |
5 | #include <linux/indirect_call_wrapper.h> |
6 | |
7 | extern const struct proto_ops inet_stream_ops; |
8 | extern const struct proto_ops inet_dgram_ops; |
9 | |
10 | /* |
11 | * INET4 prototypes used by INET6 |
12 | */ |
13 | |
14 | struct msghdr; |
15 | struct sock; |
16 | struct sockaddr; |
17 | struct socket; |
18 | |
19 | int inet_release(struct socket *sock); |
20 | int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, |
21 | int addr_len, int flags); |
22 | int __inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, |
23 | int addr_len, int flags, int is_sendmsg); |
24 | int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr, |
25 | int addr_len, int flags); |
26 | int inet_accept(struct socket *sock, struct socket *newsock, int flags, |
27 | bool kern); |
28 | int inet_sendmsg(struct socket *sock, struct msghdr *msg, size_t size); |
29 | ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset, |
30 | size_t size, int flags); |
31 | int inet_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, |
32 | int flags); |
33 | int inet_shutdown(struct socket *sock, int how); |
34 | int inet_listen(struct socket *sock, int backlog); |
35 | void inet_sock_destruct(struct sock *sk); |
36 | int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len); |
37 | int __inet_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len, |
38 | bool force_bind_address_no_port, bool with_lock); |
39 | int inet_getname(struct socket *sock, struct sockaddr *uaddr, |
40 | int peer); |
41 | int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); |
42 | int inet_ctl_sock_create(struct sock **sk, unsigned short family, |
43 | unsigned short type, unsigned char protocol, |
44 | struct net *net); |
45 | int inet_recv_error(struct sock *sk, struct msghdr *msg, int len, |
46 | int *addr_len); |
47 | |
48 | struct sk_buff *inet_gro_receive(struct list_head *head, struct sk_buff *skb); |
49 | int inet_gro_complete(struct sk_buff *skb, int nhoff); |
50 | struct sk_buff *inet_gso_segment(struct sk_buff *skb, |
51 | netdev_features_t features); |
52 | |
53 | static inline void inet_ctl_sock_destroy(struct sock *sk) |
54 | { |
55 | if (sk) |
56 | sock_release(sk->sk_socket); |
57 | } |
58 | |
59 | #define indirect_call_gro_receive(f2, f1, cb, head, skb) \ |
60 | ({ \ |
61 | unlikely(gro_recursion_inc_test(skb)) ? \ |
62 | NAPI_GRO_CB(skb)->flush |= 1, NULL : \ |
63 | INDIRECT_CALL_2(cb, f2, f1, head, skb); \ |
64 | }) |
65 | |
66 | #endif |
67 | |