hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/include/net/inet_common.h
....@@ -2,6 +2,8 @@
22 #ifndef _INET_COMMON_H
33 #define _INET_COMMON_H
44
5
+#include <linux/indirect_call_wrapper.h>
6
+
57 extern const struct proto_ops inet_stream_ops;
68 extern const struct proto_ops inet_dgram_ops;
79
....@@ -23,6 +25,7 @@
2325 int addr_len, int flags);
2426 int inet_accept(struct socket *sock, struct socket *newsock, int flags,
2527 bool kern);
28
+int inet_send_prepare(struct sock *sk);
2629 int inet_sendmsg(struct socket *sock, struct msghdr *msg, size_t size);
2730 ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset,
2831 size_t size, int flags);
....@@ -32,8 +35,14 @@
3235 int inet_listen(struct socket *sock, int backlog);
3336 void inet_sock_destruct(struct sock *sk);
3437 int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len);
38
+/* Don't allocate port at this moment, defer to connect. */
39
+#define BIND_FORCE_ADDRESS_NO_PORT (1 << 0)
40
+/* Grab and release socket lock. */
41
+#define BIND_WITH_LOCK (1 << 1)
42
+/* Called from BPF program. */
43
+#define BIND_FROM_BPF (1 << 2)
3544 int __inet_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,
36
- bool force_bind_address_no_port, bool with_lock);
45
+ u32 flags);
3746 int inet_getname(struct socket *sock, struct sockaddr *uaddr,
3847 int peer);
3948 int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
....@@ -54,4 +63,11 @@
5463 sock_release(sk->sk_socket);
5564 }
5665
66
+#define indirect_call_gro_receive(f2, f1, cb, head, skb) \
67
+({ \
68
+ unlikely(gro_recursion_inc_test(skb)) ? \
69
+ NAPI_GRO_CB(skb)->flush |= 1, NULL : \
70
+ INDIRECT_CALL_2(cb, f2, f1, head, skb); \
71
+})
72
+
5773 #endif