Blame view

include/linux/tcp.h 13 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  /*
   * INET		An implementation of the TCP/IP protocol suite for the LINUX
   *		operating system.  INET is implemented using the  BSD Socket
   *		interface as the means of communication with the user level.
   *
   *		Definitions for the TCP protocol.
   *
   * Version:	@(#)tcp.h	1.0.2	04/28/93
   *
   * Author:	Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
   *
   *		This program is free software; you can redistribute it and/or
   *		modify it under the terms of the GNU General Public License
   *		as published by the Free Software Foundation; either version
   *		2 of the License, or (at your option) any later version.
   */
  #ifndef _LINUX_TCP_H
  #define _LINUX_TCP_H
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
19

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
20
  #include <linux/skbuff.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
21
  #include <net/sock.h>
463c84b97   Arnaldo Carvalho de Melo   [NET]: Introduce ...
22
  #include <net/inet_connection_sock.h>
8feaf0c0a   Arnaldo Carvalho de Melo   [INET]: Generalis...
23
  #include <net/inet_timewait_sock.h>
607ca46e9   David Howells   UAPI: (Scripted) ...
24
  #include <uapi/linux/tcp.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
25

aa8223c7b   Arnaldo Carvalho de Melo   [SK_BUFF]: Introd...
26
27
  static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb)
  {
9c70220b7   Arnaldo Carvalho de Melo   [SK_BUFF]: Introd...
28
  	return (struct tcphdr *)skb_transport_header(skb);
aa8223c7b   Arnaldo Carvalho de Melo   [SK_BUFF]: Introd...
29
  }
ab6a5bb6b   Arnaldo Carvalho de Melo   [TCP]: Introduce ...
30
31
  static inline unsigned int tcp_hdrlen(const struct sk_buff *skb)
  {
aa8223c7b   Arnaldo Carvalho de Melo   [SK_BUFF]: Introd...
32
  	return tcp_hdr(skb)->doff * 4;
ab6a5bb6b   Arnaldo Carvalho de Melo   [TCP]: Introduce ...
33
  }
6a674e9c7   Joseph Gasparakis   net: Add support ...
34
35
36
37
38
39
40
41
42
  static inline struct tcphdr *inner_tcp_hdr(const struct sk_buff *skb)
  {
  	return (struct tcphdr *)skb_inner_transport_header(skb);
  }
  
  static inline unsigned int inner_tcp_hdrlen(const struct sk_buff *skb)
  {
  	return inner_tcp_hdr(skb)->doff * 4;
  }
ab6a5bb6b   Arnaldo Carvalho de Melo   [TCP]: Introduce ...
43
44
  static inline unsigned int tcp_optlen(const struct sk_buff *skb)
  {
aa8223c7b   Arnaldo Carvalho de Melo   [SK_BUFF]: Introd...
45
  	return (tcp_hdr(skb)->doff - 5) * 4;
ab6a5bb6b   Arnaldo Carvalho de Melo   [TCP]: Introduce ...
46
  }
2100c8d2d   Yuchung Cheng   net-tcp: Fast Ope...
47
48
49
  /* TCP Fast Open */
  #define TCP_FASTOPEN_COOKIE_MIN	4	/* Min Fast Open Cookie size in bytes */
  #define TCP_FASTOPEN_COOKIE_MAX	16	/* Max Fast Open Cookie size in bytes */
104671636   Jerry Chu   tcp: TCP Fast Ope...
50
  #define TCP_FASTOPEN_COOKIE_SIZE 8	/* the size employed by this impl. */
2100c8d2d   Yuchung Cheng   net-tcp: Fast Ope...
51
52
53
54
55
  
  /* TCP Fast Open Cookie as stored in memory */
  struct tcp_fastopen_cookie {
  	s8	len;
  	u8	val[TCP_FASTOPEN_COOKIE_MAX];
7f9b838b7   Daniel Lee   tcp: RFC7413 opti...
56
  	bool	exp;	/* In RFC6994 experimental option format */
2100c8d2d   Yuchung Cheng   net-tcp: Fast Ope...
57
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
58
  /* This defines a selective acknowledgement block. */
269bd27e6   Al Viro   [TCP]: struct tcp...
59
60
61
62
  struct tcp_sack_block_wire {
  	__be32	start_seq;
  	__be32	end_seq;
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
63
  struct tcp_sack_block {
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
64
65
  	u32	start_seq;
  	u32	end_seq;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
66
  };
ab56222a3   Vijay Subramanian   tcp: Replace cons...
67
68
69
70
  /*These are used to set the sack_ok field in struct tcp_options_received */
  #define TCP_SACK_SEEN     (1 << 0)   /*1 = peer is SACK capable, */
  #define TCP_FACK_ENABLED  (1 << 1)   /*1 = FACK is enabled locally*/
  #define TCP_DSACK_SEEN    (1 << 2)   /*1 = DSACK was received from peer*/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
71
72
73
  struct tcp_options_received {
  /*	PAWS/RTTM data	*/
  	long	ts_recent_stamp;/* Time we stored ts_recent (for aging) */
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
74
75
76
77
  	u32	ts_recent;	/* Time stamp to echo next		*/
  	u32	rcv_tsval;	/* Time stamp value             	*/
  	u32	rcv_tsecr;	/* Time stamp echo reply        	*/
  	u16 	saw_tstamp : 1,	/* Saw TIMESTAMP on last packet		*/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
78
79
80
81
82
83
  		tstamp_ok : 1,	/* TIMESTAMP seen on SYN packet		*/
  		dsack : 1,	/* D-SACK is scheduled			*/
  		wscale_ok : 1,	/* Wscale seen on SYN packet		*/
  		sack_ok : 4,	/* SACK seen on SYN packet		*/
  		snd_wscale : 4,	/* Window scaling received from sender	*/
  		rcv_wscale : 4;	/* Window scaling to send to receiver	*/
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
84
  	u8	num_sacks;	/* Number of SACK blocks		*/
435cf559f   William Allen Simpson   TCPCT part 1d: de...
85
  	u16	user_mss;	/* mss requested by user in ioctl	*/
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
86
  	u16	mss_clamp;	/* Maximal mss, negotiated at connection setup */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
87
  };
519855c50   William Allen Simpson   TCPCT part 1c: sy...
88
89
  static inline void tcp_clear_options(struct tcp_options_received *rx_opt)
  {
435cf559f   William Allen Simpson   TCPCT part 1d: de...
90
91
  	rx_opt->tstamp_ok = rx_opt->sack_ok = 0;
  	rx_opt->wscale_ok = rx_opt->snd_wscale = 0;
519855c50   William Allen Simpson   TCPCT part 1c: sy...
92
  }
4389dded7   Adam Langley   tcp: Remove redun...
93
  /* This is the max number of SACKS that we'll generate and process. It's safe
435cf559f   William Allen Simpson   TCPCT part 1d: de...
94
   * to increase this, although since:
4389dded7   Adam Langley   tcp: Remove redun...
95
96
97
   *   size = TCPOLEN_SACK_BASE_ALIGNED (4) + n * TCPOLEN_SACK_PERBLOCK (8)
   * only four options will fit in a standard TCP header */
  #define TCP_NUM_SACKS 4
435cf559f   William Allen Simpson   TCPCT part 1d: de...
98
  struct tcp_request_sock_ops;
2e6599cb8   Arnaldo Carvalho de Melo   [NET] Generalise ...
99
  struct tcp_request_sock {
cfb6eeb4c   YOSHIFUJI Hideaki   [TCP]: MD5 Signat...
100
  	struct inet_request_sock 	req;
b2e4b3deb   Stephen Hemminger   tcp: MD5 operatio...
101
  	const struct tcp_request_sock_ops *af_specific;
0f1c28ae7   Yuchung Cheng   tcp: usec resolut...
102
  	struct skb_mstamp		snt_synack; /* first SYNACK sent time */
9439ce00f   Eric Dumazet   tcp: rename struc...
103
  	bool				tfo_listener;
58d607d3e   Eric Dumazet   tcp: provide skb-...
104
  	u32				txhash;
435cf559f   William Allen Simpson   TCPCT part 1d: de...
105
106
  	u32				rcv_isn;
  	u32				snt_isn;
a9b2c06db   Neal Cardwell   tcp: mitigate ACK...
107
  	u32				last_oow_ack_time; /* last SYNACK */
104671636   Jerry Chu   tcp: TCP Fast Ope...
108
109
110
111
  	u32				rcv_nxt; /* the ack # by SYNACK. For
  						  * FastOpen it's the seq#
  						  * after data-in-SYN.
  						  */
2e6599cb8   Arnaldo Carvalho de Melo   [NET] Generalise ...
112
  };
60236fdd0   Arnaldo Carvalho de Melo   [NET] Rename open...
113
  static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
2e6599cb8   Arnaldo Carvalho de Melo   [NET] Generalise ...
114
115
116
  {
  	return (struct tcp_request_sock *)req;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
117
  struct tcp_sock {
463c84b97   Arnaldo Carvalho de Melo   [NET]: Introduce ...
118
119
  	/* inet_connection_sock has to be the first member of tcp_sock */
  	struct inet_connection_sock	inet_conn;
2ff52f282   Arnaldo Carvalho de Melo   [TCP]: Change tcp...
120
  	u16	tcp_header_len;	/* Bytes of tcp header to send		*/
605ad7f18   Eric Dumazet   tcp: refine TSO a...
121
  	u16	gso_segs;	/* Max number of segs per GSO packet	*/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
122
123
124
125
126
  
  /*
   *	Header prediction flags
   *	0x5?10 << 16 + snd_wnd in net byte order
   */
dddc93c05   Al Viro   [TCP]: struct tcp...
127
  	__be32	pred_flags;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
128
129
130
131
132
133
  
  /*
   *	RFC793 variables by their proper names. This means you can
   *	read the code and the spec side by side (and laugh ...)
   *	See RFC793 and RFC1122. The RFC writes these in capitals.
   */
bdd1f9eda   Eric Dumazet   tcp: add tcpi_byt...
134
135
136
137
  	u64	bytes_received;	/* RFC4898 tcpEStatsAppHCThruOctetsReceived
  				 * sum(delta(rcv_nxt)), or how many bytes
  				 * were acked.
  				 */
2efd055c5   Marcelo Ricardo Leitner   tcp: add tcpi_seg...
138
139
140
  	u32	segs_in;	/* RFC4898 tcpEStatsPerfSegsIn
  				 * total number of segments in.
  				 */
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
141
   	u32	rcv_nxt;	/* What we want to receive next 	*/
54287cc17   Eric Dumazet   [TCP]: Keep copie...
142
143
  	u32	copied_seq;	/* Head of yet unread data		*/
  	u32	rcv_wup;	/* rcv_nxt on last window update sent	*/
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
144
   	u32	snd_nxt;	/* Next sequence we send		*/
2efd055c5   Marcelo Ricardo Leitner   tcp: add tcpi_seg...
145
146
147
  	u32	segs_out;	/* RFC4898 tcpEStatsPerfSegsOut
  				 * The total number of segments sent.
  				 */
0df48c26d   Eric Dumazet   tcp: add tcpi_byt...
148
149
150
151
  	u64	bytes_acked;	/* RFC4898 tcpEStatsAppHCThruOctetsAcked
  				 * sum(delta(snd_una)), or how many bytes
  				 * were acked.
  				 */
d654976cb   Eric Dumazet   tcp: fix a potent...
152
  	struct u64_stats_sync syncp; /* protects 64bit vars (cf tcp_get_info()) */
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
153
154
155
156
   	u32	snd_una;	/* First byte we want an ack for	*/
   	u32	snd_sml;	/* Last byte of the most recently transmitted small packet */
  	u32	rcv_tstamp;	/* timestamp of last received ACK (for keepalives) */
  	u32	lsndtime;	/* timestamp of last sent data packet (for restart window) */
f2b2c582e   Neal Cardwell   tcp: mitigate ACK...
157
  	u32	last_oow_ack_time;  /* timestamp of last out-of-window ACK */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
158

ceaa1fef6   Andrey Vagin   tcp: adding a per...
159
  	u32	tsoffset;	/* timestamp offset */
46d3ceabd   Eric Dumazet   tcp: TCP Small Qu...
160
161
  	struct list_head tsq_node; /* anchor in tsq_tasklet.head list */
  	unsigned long	tsq_flags;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
162
163
164
165
  	/* Data for direct copy to user */
  	struct {
  		struct sk_buff_head	prequeue;
  		struct task_struct	*task;
f4362a2c9   Al Viro   switch tcp_sock->...
166
  		struct msghdr		*msg;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
167
168
169
  		int			memory;
  		int			len;
  	} ucopy;
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
170
171
172
173
  	u32	snd_wl1;	/* Sequence for window update		*/
  	u32	snd_wnd;	/* The window we expect to receive	*/
  	u32	max_window;	/* Maximal window ever seen from peer	*/
  	u32	mss_cache;	/* Cached effective mss, not including SACKS */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
174

3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
175
176
  	u32	window_clamp;	/* Maximal window to advertise		*/
  	u32	rcv_ssthresh;	/* Current window clamp			*/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
177

659a8ad56   Yuchung Cheng   tcp: track the pa...
178
179
180
181
182
183
  	/* Information of the most recently (s)acked skb */
  	struct tcp_rack {
  		struct skb_mstamp mstamp; /* (Re)sent time of the skb */
  		u8 advanced; /* mstamp advanced since last lost marking */
  		u8 reord;    /* reordering detected */
  	} rack;
b79eeeb9e   Ilpo Järvinen   tcp: Reorganize t...
184
  	u16	advmss;		/* Advertised MSS			*/
9b44190dc   Yuchung Cheng   tcp: refactor F-RTO
185
  	u8	unused;
36e31b0af   Andreas Petlund   net: TCP thin lin...
186
187
  	u8	nonagle     : 4,/* Disable Nagle algorithm?             */
  		thin_lto    : 1,/* Use linear timeouts for thin streams */
7e3801755   Andreas Petlund   net: TCP thin dupack
188
  		thin_dupack : 1,/* Fast retransmit on first dupack      */
e33099f96   Yuchung Cheng   tcp: implement RF...
189
190
  		repair      : 1,
  		frto        : 1;/* F-RTO (RFC5682) activated in CA_Loss */
ee9952831   Pavel Emelyanov   tcp: Initial repa...
191
  	u8	repair_queue;
750ea2baf   Yuchung Cheng   tcp: early retran...
192
  	u8	do_early_retrans:1,/* Enable RFC5827 early-retransmit  */
67da22d23   Yuchung Cheng   net-tcp: Fast Ope...
193
  		syn_data:1,	/* SYN includes data */
6f73601ef   Yuchung Cheng   tcp: add SYN/data...
194
  		syn_fastopen:1,	/* SYN includes Fast Open option */
2646c831c   Daniel Lee   tcp: RFC7413 opti...
195
  		syn_fastopen_exp:1,/* SYN includes Fast Open exp. option */
ca8a22634   Neal Cardwell   tcp: make cwnd-li...
196
  		syn_data_acked:1,/* data in SYN is acked by SYN-ACK */
cd8ae8529   Eric Dumazet   tcp: provide SYN ...
197
  		save_syn:1,	/* Save headers of SYN packet */
ca8a22634   Neal Cardwell   tcp: make cwnd-li...
198
  		is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */
9b717a8d2   Nandita Dukkipati   tcp: TLP loss det...
199
  	u32	tlp_high_seq;	/* snd_nxt at the time of TLP retransmit. */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
200
201
  
  /* RTT measurement */
740b0f184   Eric Dumazet   tcp: switch rtt e...
202
203
204
205
  	u32	srtt_us;	/* smoothed round trip time << 3 in usecs */
  	u32	mdev_us;	/* medium deviation			*/
  	u32	mdev_max_us;	/* maximal mdev for the last rtt period	*/
  	u32	rttvar_us;	/* smoothed mdev_max			*/
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
206
  	u32	rtt_seq;	/* sequence number to update rttvar	*/
f67225839   Yuchung Cheng   tcp: track min RT...
207
208
209
  	struct rtt_meas {
  		u32 rtt, ts;	/* RTT in usec and sampling time in jiffies. */
  	} rtt_min[3];
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
210
211
  
  	u32	packets_out;	/* Packets which are "in flight"	*/
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
212
  	u32	retrans_out;	/* Retransmitted packets out		*/
ca8a22634   Neal Cardwell   tcp: make cwnd-li...
213
214
  	u32	max_packets_out;  /* max packets_out in last window */
  	u32	max_packets_seq;  /* right edge of max_packets_out flight */
b79eeeb9e   Ilpo Järvinen   tcp: Reorganize t...
215
216
  
  	u16	urg_data;	/* Saved octet of OOB data and control flags */
b79eeeb9e   Ilpo Järvinen   tcp: Reorganize t...
217
  	u8	ecn_flags;	/* ECN status bits.			*/
dca145ffa   Eric Dumazet   tcp: allow for bi...
218
219
  	u8	keepalive_probes; /* num of allowed keep alive probes	*/
  	u32	reordering;	/* Packet reordering metric.		*/
33f5f57ee   Ilpo Järvinen   tcp: kill pointle...
220
  	u32	snd_up;		/* Urgent pointer		*/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
221
222
223
  /*
   *      Options received (usually on last packet, some only on SYN packets).
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
224
225
226
227
228
  	struct tcp_options_received rx_opt;
  
  /*
   *	Slow start and congestion control (see also Nagle, and Karn & Partridge)
   */
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
229
230
   	u32	snd_ssthresh;	/* Slow start size threshold		*/
   	u32	snd_cwnd;	/* Sending congestion window		*/
f78a1b389   Ilpo Järvinen   [TCP]: Make snd_c...
231
  	u32	snd_cwnd_cnt;	/* Linear increase counter		*/
e0ef57cc5   David S. Miller   [TCP]: Make snd_c...
232
  	u32	snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
233
234
  	u32	snd_cwnd_used;
  	u32	snd_cwnd_stamp;
a262f0cdf   Nandita Dukkipati   Proportional Rate...
235
236
237
238
  	u32	prior_cwnd;	/* Congestion window at start of Recovery. */
  	u32	prr_delivered;	/* Number of newly delivered packets to
  				 * receiver in Recovery. */
  	u32	prr_out;	/* Total number of pkts sent during Recovery. */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
239

3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
240
   	u32	rcv_wnd;	/* Current receiver window		*/
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
241
  	u32	write_seq;	/* Tail(+1) of data held in tcp send buffer */
c9bee3b7f   Eric Dumazet   tcp: TCP_NOTSENT_...
242
  	u32	notsent_lowat;	/* TCP_NOTSENT_LOWAT */
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
243
  	u32	pushed_seq;	/* Last pushed seq, required to talk to windows */
b79eeeb9e   Ilpo Järvinen   tcp: Reorganize t...
244
245
246
  	u32	lost_out;	/* Lost packets			*/
  	u32	sacked_out;	/* SACK'd packets			*/
  	u32	fackets_out;	/* FACK'd packets			*/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
247

b79eeeb9e   Ilpo Järvinen   tcp: Reorganize t...
248
249
  	/* from STCP, retrans queue hinting */
  	struct sk_buff* lost_skb_hint;
b79eeeb9e   Ilpo Järvinen   tcp: Reorganize t...
250
  	struct sk_buff *retransmit_skb_hint;
b79eeeb9e   Ilpo Järvinen   tcp: Reorganize t...
251

996b175e3   Eric Dumazet   tcp: out_of_order...
252
253
254
255
  	/* OOO segments go in this list. Note that socket lock must be held,
  	 * as we do not use sk_buff_head lock.
  	 */
  	struct sk_buff_head	out_of_order_queue;
b79eeeb9e   Ilpo Järvinen   tcp: Reorganize t...
256

c0a788c45   Kyle McMartin   net: Fix tcp_buil...
257
  	/* SACKs data, these 2 need to be together (see tcp_options_write) */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
258
259
  	struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
  	struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/
fd6dad616   Ilpo Järvinen   [TCP]: Earlier SA...
260
  	struct tcp_sack_block recv_sack_cache[4];
6a438bbe6   Stephen Hemminger   [TCP]: speed up S...
261

ecb971923   Neal Cardwell   tcp: fix comment ...
262
263
  	struct sk_buff *highest_sack;   /* skb just after the highest
  					 * skb with SACKed bit set
a47e5a988   Ilpo Järvinen   [TCP]: Convert hi...
264
265
266
  					 * (validity guaranteed only if
  					 * sacked_out > 0)
  					 */
d738cd8fc   Ilpo Järvinen   [TCP]: Add highes...
267

6a438bbe6   Stephen Hemminger   [TCP]: speed up S...
268
  	int     lost_cnt_hint;
006f582c7   Ilpo Järvinen   tcp: convert retr...
269
  	u32     retransmit_high;	/* L-bits may be on up to this seqno */
6a438bbe6   Stephen Hemminger   [TCP]: speed up S...
270

4b7494404   Ilpo Järvinen   tcp: Make prior_s...
271
  	u32	prior_ssthresh; /* ssthresh saved at recovery start	*/
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
272
  	u32	high_seq;	/* snd_nxt at onset of congestion	*/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
273

3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
274
  	u32	retrans_stamp;	/* Timestamp of the last retransmit,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
275
276
  				 * also used in SYN-SENT to remember stamp of
  				 * the first SYN. */
989e04c5b   Yuchung Cheng   tcp: improve undo...
277
  	u32	undo_marker;	/* snd_una upon a new recovery episode. */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
278
  	int	undo_retrans;	/* number of undoable retransmissions. */
b79eeeb9e   Ilpo Järvinen   tcp: Reorganize t...
279
  	u32	total_retrans;	/* Total retransmits for entire connection */
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
280
  	u32	urg_seq;	/* Seq of received urgent pointer */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
281
282
  	unsigned int		keepalive_time;	  /* time before keep alive takes place */
  	unsigned int		keepalive_intvl;  /* time interval between keep alive probes */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
283

a0f82f64e   Florian Westphal   syncookies: remov...
284
  	int			linger2;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
285
286
287
  
  /* Receiver side RTT estimation */
  	struct {
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
288
289
290
  		u32	rtt;
  		u32	seq;
  		u32	time;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
291
292
293
294
295
  	} rcv_rtt_est;
  
  /* Receiver queue space */
  	struct {
  		int	space;
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
296
297
  		u32	seq;
  		u32	time;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
298
  	} rcvq_space;
0e7b13685   John Heffner   [TCP] mtu probing...
299
300
301
  
  /* TCP-specific MTU probe information. */
  	struct {
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
302
303
  		u32		  probe_seq_start;
  		u32		  probe_seq_end;
0e7b13685   John Heffner   [TCP] mtu probing...
304
  	} mtu_probe;
563d34d05   Eric Dumazet   tcp: dont drop MT...
305
306
307
  	u32	mtu_info; /* We received an ICMP_FRAG_NEEDED / ICMPV6_PKT_TOOBIG
  			   * while socket was owned by user.
  			   */
cfb6eeb4c   YOSHIFUJI Hideaki   [TCP]: MD5 Signat...
308
309
310
  
  #ifdef CONFIG_TCP_MD5SIG
  /* TCP AF-Specific parts; only used by MD5 Signature support so far */
b2e4b3deb   Stephen Hemminger   tcp: MD5 operatio...
311
  	const struct tcp_sock_af_ops	*af_specific;
cfb6eeb4c   YOSHIFUJI Hideaki   [TCP]: MD5 Signat...
312

b2e4b3deb   Stephen Hemminger   tcp: MD5 operatio...
313
  /* TCP MD5 Signature Option information */
a8afca032   Eric Dumazet   tcp: md5: protect...
314
  	struct tcp_md5sig_info	__rcu *md5sig_info;
cfb6eeb4c   YOSHIFUJI Hideaki   [TCP]: MD5 Signat...
315
  #endif
435cf559f   William Allen Simpson   TCPCT part 1d: de...
316

104671636   Jerry Chu   tcp: TCP Fast Ope...
317
318
319
320
321
322
  /* TCP fastopen related information */
  	struct tcp_fastopen_request *fastopen_req;
  	/* fastopen_rsk points to request_sock that resulted in this big
  	 * socket. Used to retransmit SYNACKs etc.
  	 */
  	struct request_sock *fastopen_rsk;
cd8ae8529   Eric Dumazet   tcp: provide SYN ...
323
  	u32	*saved_syn;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
324
  };
46d3ceabd   Eric Dumazet   tcp: TCP Small Qu...
325
326
327
  enum tsq_flags {
  	TSQ_THROTTLED,
  	TSQ_QUEUED,
6f458dfb4   Eric Dumazet   tcp: improve late...
328
329
330
  	TCP_TSQ_DEFERRED,	   /* tcp_tasklet_func() found socket was owned */
  	TCP_WRITE_TIMER_DEFERRED,  /* tcp_write_timer() found socket was owned */
  	TCP_DELACK_TIMER_DEFERRED, /* tcp_delack_timer() found socket was owned */
563d34d05   Eric Dumazet   tcp: dont drop MT...
331
332
333
  	TCP_MTU_REDUCED_DEFERRED,  /* tcp_v{4|6}_err() could not call
  				    * tcp_v{4|6}_mtu_reduced()
  				    */
46d3ceabd   Eric Dumazet   tcp: TCP Small Qu...
334
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
335
336
337
338
  static inline struct tcp_sock *tcp_sk(const struct sock *sk)
  {
  	return (struct tcp_sock *)sk;
  }
8feaf0c0a   Arnaldo Carvalho de Melo   [INET]: Generalis...
339
340
  struct tcp_timewait_sock {
  	struct inet_timewait_sock tw_sk;
d475f090b   Eric Dumazet   tcp: shrink tcp_t...
341
342
  #define tw_rcv_nxt tw_sk.__tw_common.skc_tw_rcv_nxt
  #define tw_snd_nxt tw_sk.__tw_common.skc_tw_snd_nxt
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
343
  	u32			  tw_rcv_wnd;
ceaa1fef6   Andrey Vagin   tcp: adding a per...
344
  	u32			  tw_ts_offset;
3a137d206   Arnaldo Carvalho de Melo   [TCP]: Renove the...
345
  	u32			  tw_ts_recent;
4fb17a609   Neal Cardwell   tcp: mitigate ACK...
346
347
348
  
  	/* The time we sent the last out-of-window ACK: */
  	u32			  tw_last_oow_ack_time;
8feaf0c0a   Arnaldo Carvalho de Melo   [INET]: Generalis...
349
  	long			  tw_ts_recent_stamp;
cfb6eeb4c   YOSHIFUJI Hideaki   [TCP]: MD5 Signat...
350
  #ifdef CONFIG_TCP_MD5SIG
2397849ba   David S. Miller   [PATCH] tcp: Cach...
351
  	struct tcp_md5sig_key	  *tw_md5_key;
cfb6eeb4c   YOSHIFUJI Hideaki   [TCP]: MD5 Signat...
352
  #endif
8feaf0c0a   Arnaldo Carvalho de Melo   [INET]: Generalis...
353
354
355
356
357
358
  };
  
  static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk)
  {
  	return (struct tcp_timewait_sock *)sk;
  }
104671636   Jerry Chu   tcp: TCP Fast Ope...
359
360
361
362
363
  static inline bool tcp_passive_fastopen(const struct sock *sk)
  {
  	return (sk->sk_state == TCP_SYN_RECV &&
  		tcp_sk(sk)->fastopen_rsk != NULL);
  }
0536fcc03   Eric Dumazet   tcp: prepare fast...
364
  static inline void fastopen_queue_tune(struct sock *sk, int backlog)
104671636   Jerry Chu   tcp: TCP Fast Ope...
365
  {
0536fcc03   Eric Dumazet   tcp: prepare fast...
366
  	struct request_sock_queue *queue = &inet_csk(sk)->icsk_accept_queue;
dbf650b67   Eric Dumazet   tcp: fastopen: li...
367
  	int somaxconn = READ_ONCE(sock_net(sk)->core.sysctl_somaxconn);
0536fcc03   Eric Dumazet   tcp: prepare fast...
368

dbf650b67   Eric Dumazet   tcp: fastopen: li...
369
  	queue->fastopenq.max_qlen = min_t(unsigned int, backlog, somaxconn);
104671636   Jerry Chu   tcp: TCP Fast Ope...
370
  }
805c4bc05   Eric Dumazet   tcp: fix req->sav...
371
372
373
374
375
376
  static inline void tcp_move_syn(struct tcp_sock *tp,
  				struct request_sock *req)
  {
  	tp->saved_syn = req->saved_syn;
  	req->saved_syn = NULL;
  }
cd8ae8529   Eric Dumazet   tcp: provide SYN ...
377
378
379
380
381
  static inline void tcp_saved_syn_free(struct tcp_sock *tp)
  {
  	kfree(tp->saved_syn);
  	tp->saved_syn = NULL;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
382
  #endif	/* _LINUX_TCP_H */