hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/include/linux/tcp.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * INET An implementation of the TCP/IP protocol suite for the LINUX
34 * operating system. INET is implemented using the BSD Socket
....@@ -8,11 +9,6 @@
89 * Version: @(#)tcp.h 1.0.2 04/28/93
910 *
1011 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11
- *
12
- * This program is free software; you can redistribute it and/or
13
- * modify it under the terms of the GNU General Public License
14
- * as published by the Free Software Foundation; either version
15
- * 2 of the License, or (at your option) any later version.
1612 */
1713 #ifndef _LINUX_TCP_H
1814 #define _LINUX_TCP_H
....@@ -20,6 +16,7 @@
2016
2117 #include <linux/skbuff.h>
2218 #include <linux/win_minmax.h>
19
+#include <linux/android_kabi.h>
2320 #include <net/sock.h>
2421 #include <net/inet_connection_sock.h>
2522 #include <net/inet_timewait_sock.h>
....@@ -62,12 +59,7 @@
6259
6360 /* TCP Fast Open Cookie as stored in memory */
6461 struct tcp_fastopen_cookie {
65
- union {
66
- u8 val[TCP_FASTOPEN_COOKIE_MAX];
67
-#if IS_ENABLED(CONFIG_IPV6)
68
- struct in6_addr addr;
69
-#endif
70
- };
62
+ __le64 val[DIV_ROUND_UP(TCP_FASTOPEN_COOKIE_MAX, sizeof(u64))];
7163 s8 len;
7264 bool exp; /* In RFC6994 experimental option format */
7365 };
....@@ -101,6 +93,8 @@
10193 smc_ok : 1, /* SMC seen on SYN packet */
10294 snd_wscale : 4, /* Window scaling received from sender */
10395 rcv_wscale : 4; /* Window scaling to send to receiver */
96
+ u8 saw_unknown:1, /* Received unknown option */
97
+ unused:7;
10498 u8 num_sacks; /* Number of SACK blocks */
10599 u16 user_mss; /* mss requested by user in ioctl */
106100 u16 mss_clamp; /* Maximal mss, negotiated at connection setup */
....@@ -128,6 +122,10 @@
128122 const struct tcp_request_sock_ops *af_specific;
129123 u64 snt_synack; /* first SYNACK sent time */
130124 bool tfo_listener;
125
+ bool is_mptcp;
126
+#if IS_ENABLED(CONFIG_MPTCP)
127
+ bool drop_req;
128
+#endif
131129 u32 txhash;
132130 u32 rcv_isn;
133131 u32 snt_isn;
....@@ -137,6 +135,7 @@
137135 * FastOpen it's the seq#
138136 * after data-in-SYN.
139137 */
138
+ u8 syn_tos;
140139 };
141140
142141 static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
....@@ -225,8 +224,9 @@
225224 } rack;
226225 u16 advmss; /* Advertised MSS */
227226 u8 compressed_ack;
228
- u8 tlp_retrans:1, /* TLP is a retransmission */
229
- unused_1:7;
227
+ u8 dup_ack_counter:2,
228
+ tlp_retrans:1, /* TLP is a retransmission */
229
+ unused:5;
230230 u32 chrono_start; /* Start time in jiffies of a TCP chrono */
231231 u32 chrono_stat[3]; /* Time in jiffies for chrono_stat stats */
232232 u8 chrono_type:2, /* current chronograph type */
....@@ -234,22 +234,25 @@
234234 fastopen_connect:1, /* FASTOPEN_CONNECT sockopt */
235235 fastopen_no_cookie:1, /* Allow send/recv SYN+data without a cookie */
236236 is_sack_reneg:1, /* in recovery from loss with SACK reneg? */
237
- unused:2;
237
+ fastopen_client_fail:2; /* reason why fastopen failed */
238238 u8 nonagle : 4,/* Disable Nagle algorithm? */
239239 thin_lto : 1,/* Use linear timeouts for thin streams */
240240 recvmsg_inq : 1,/* Indicate # of bytes in queue upon recvmsg */
241241 repair : 1,
242242 frto : 1;/* F-RTO (RFC5682) activated in CA_Loss */
243243 u8 repair_queue;
244
- u8 syn_data:1, /* SYN includes data */
244
+ u8 save_syn:2, /* Save headers of SYN packet */
245
+ syn_data:1, /* SYN includes data */
245246 syn_fastopen:1, /* SYN includes Fast Open option */
246247 syn_fastopen_exp:1,/* SYN includes Fast Open exp. option */
247248 syn_fastopen_ch:1, /* Active TFO re-enabling probe */
248249 syn_data_acked:1,/* data in SYN is acked by SYN-ACK */
249
- save_syn:1, /* Save headers of SYN packet */
250
- is_cwnd_limited:1,/* forward progress limited by snd_cwnd? */
251
- syn_smc:1; /* SYN includes SMC */
250
+ is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */
252251 u32 tlp_high_seq; /* snd_nxt at the time of TLP */
252
+
253
+ u32 tcp_tx_delay; /* delay (in usec) added to TX packets */
254
+ u64 tcp_wstamp_ns; /* departure time for next sent data packet */
255
+ u64 tcp_clock_cache; /* cache last tcp_clock_ns() (see tcp_mstamp_refresh()) */
253256
254257 /* RTT measurement */
255258 u64 tcp_mstamp; /* most recent packet received/sent */
....@@ -263,7 +266,14 @@
263266 u32 packets_out; /* Packets which are "in flight" */
264267 u32 retrans_out; /* Retransmitted packets out */
265268 u32 max_packets_out; /* max packets_out in last window */
269
+/* GENKSYMS hack to preserve the ABI because of f4ce91ce12a7 ("tcp: fix
270
+ * tcp_cwnd_validate() to not forget is_cwnd_limited")
271
+ */
272
+#ifndef __GENKSYMS__
273
+ u32 cwnd_usage_seq; /* right edge of cwnd usage tracking flight */
274
+#else
266275 u32 max_packets_seq; /* right edge of max_packets_out flight */
276
+#endif
267277
268278 u16 urg_data; /* Saved octet of OOB data and control flags */
269279 u8 ecn_flags; /* ECN status bits. */
....@@ -361,6 +371,10 @@
361371 #define BPF_SOCK_OPS_TEST_FLAG(TP, ARG) 0
362372 #endif
363373
374
+ u16 timeout_rehash; /* Timeout-triggered rehash attempts */
375
+
376
+ u32 rcv_ooopack; /* Received out-of-order packets, for tcpinfo */
377
+
364378 /* Receiver side RTT estimation */
365379 u32 rcv_rtt_last_tsecr;
366380 struct {
....@@ -384,6 +398,12 @@
384398 u32 mtu_info; /* We received an ICMP_FRAG_NEEDED / ICMPV6_PKT_TOOBIG
385399 * while socket was owned by user.
386400 */
401
+#if IS_ENABLED(CONFIG_MPTCP)
402
+ bool is_mptcp;
403
+#endif
404
+#if IS_ENABLED(CONFIG_SMC)
405
+ bool syn_smc; /* SYN includes SMC */
406
+#endif
387407
388408 #ifdef CONFIG_TCP_MD5SIG
389409 /* TCP AF-Specific parts; only used by MD5 Signature support so far */
....@@ -398,8 +418,10 @@
398418 /* fastopen_rsk points to request_sock that resulted in this big
399419 * socket. Used to retransmit SYNACKs etc.
400420 */
401
- struct request_sock *fastopen_rsk;
402
- u32 *saved_syn;
421
+ struct request_sock __rcu *fastopen_rsk;
422
+ struct saved_syn *saved_syn;
423
+
424
+ ANDROID_KABI_RESERVE(1);
403425 };
404426
405427 enum tsq_enum {
....@@ -439,6 +461,7 @@
439461 u32 tw_last_oow_ack_time;
440462
441463 int tw_ts_recent_stamp;
464
+ u32 tw_tx_delay;
442465 #ifdef CONFIG_TCP_MD5SIG
443466 struct tcp_md5sig_key *tw_md5_key;
444467 #endif
....@@ -451,8 +474,8 @@
451474
452475 static inline bool tcp_passive_fastopen(const struct sock *sk)
453476 {
454
- return (sk->sk_state == TCP_SYN_RECV &&
455
- tcp_sk(sk)->fastopen_rsk != NULL);
477
+ return sk->sk_state == TCP_SYN_RECV &&
478
+ rcu_access_pointer(tcp_sk(sk)->fastopen_rsk) != NULL;
456479 }
457480
458481 static inline void fastopen_queue_tune(struct sock *sk, int backlog)
....@@ -476,7 +499,14 @@
476499 tp->saved_syn = NULL;
477500 }
478501
479
-struct sk_buff *tcp_get_timestamping_opt_stats(const struct sock *sk);
502
+static inline u32 tcp_saved_syn_len(const struct saved_syn *saved_syn)
503
+{
504
+ return saved_syn->mac_hdrlen + saved_syn->network_hdrlen +
505
+ saved_syn->tcp_hdrlen;
506
+}
507
+
508
+struct sk_buff *tcp_get_timestamping_opt_stats(const struct sock *sk,
509
+ const struct sk_buff *orig_skb);
480510
481511 static inline u16 tcp_mss_clamp(const struct tcp_sock *tp, u16 mss)
482512 {
....@@ -491,4 +521,14 @@
491521 int tcp_skb_shift(struct sk_buff *to, struct sk_buff *from, int pcount,
492522 int shiftlen);
493523
524
+void tcp_sock_set_cork(struct sock *sk, bool on);
525
+int tcp_sock_set_keepcnt(struct sock *sk, int val);
526
+int tcp_sock_set_keepidle_locked(struct sock *sk, int val);
527
+int tcp_sock_set_keepidle(struct sock *sk, int val);
528
+int tcp_sock_set_keepintvl(struct sock *sk, int val);
529
+void tcp_sock_set_nodelay(struct sock *sk);
530
+void tcp_sock_set_quickack(struct sock *sk, int val);
531
+int tcp_sock_set_syncnt(struct sock *sk, int val);
532
+void tcp_sock_set_user_timeout(struct sock *sk, u32 val);
533
+
494534 #endif /* _LINUX_TCP_H */