diff options
Diffstat (limited to 'include/linux/tcp.h')
-rw-r--r-- | include/linux/tcp.h | 82 |
1 files changed, 19 insertions, 63 deletions
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index e4fd82e42104..ac4ca44c75ca 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -55,24 +55,6 @@ struct tcphdr { | |||
55 | __u16 urg_ptr; | 55 | __u16 urg_ptr; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | |||
59 | enum { | ||
60 | TCP_ESTABLISHED = 1, | ||
61 | TCP_SYN_SENT, | ||
62 | TCP_SYN_RECV, | ||
63 | TCP_FIN_WAIT1, | ||
64 | TCP_FIN_WAIT2, | ||
65 | TCP_TIME_WAIT, | ||
66 | TCP_CLOSE, | ||
67 | TCP_CLOSE_WAIT, | ||
68 | TCP_LAST_ACK, | ||
69 | TCP_LISTEN, | ||
70 | TCP_CLOSING, /* now a valid state */ | ||
71 | |||
72 | TCP_MAX_STATES /* Leave at the end! */ | ||
73 | }; | ||
74 | |||
75 | #define TCP_STATE_MASK 0xF | ||
76 | #define TCP_ACTION_FIN (1 << 7) | 58 | #define TCP_ACTION_FIN (1 << 7) |
77 | 59 | ||
78 | enum { | 60 | enum { |
@@ -195,8 +177,9 @@ struct tcp_info | |||
195 | 177 | ||
196 | #include <linux/config.h> | 178 | #include <linux/config.h> |
197 | #include <linux/skbuff.h> | 179 | #include <linux/skbuff.h> |
198 | #include <linux/ip.h> | ||
199 | #include <net/sock.h> | 180 | #include <net/sock.h> |
181 | #include <net/inet_connection_sock.h> | ||
182 | #include <net/inet_timewait_sock.h> | ||
200 | 183 | ||
201 | /* This defines a selective acknowledgement block. */ | 184 | /* This defines a selective acknowledgement block. */ |
202 | struct tcp_sack_block { | 185 | struct tcp_sack_block { |
@@ -236,8 +219,8 @@ static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) | |||
236 | } | 219 | } |
237 | 220 | ||
238 | struct tcp_sock { | 221 | struct tcp_sock { |
239 | /* inet_sock has to be the first member of tcp_sock */ | 222 | /* inet_connection_sock has to be the first member of tcp_sock */ |
240 | struct inet_sock inet; | 223 | struct inet_connection_sock inet_conn; |
241 | int tcp_header_len; /* Bytes of tcp header to send */ | 224 | int tcp_header_len; /* Bytes of tcp header to send */ |
242 | 225 | ||
243 | /* | 226 | /* |
@@ -258,19 +241,6 @@ struct tcp_sock { | |||
258 | __u32 snd_sml; /* Last byte of the most recently transmitted small packet */ | 241 | __u32 snd_sml; /* Last byte of the most recently transmitted small packet */ |
259 | __u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ | 242 | __u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ |
260 | __u32 lsndtime; /* timestamp of last sent data packet (for restart window) */ | 243 | __u32 lsndtime; /* timestamp of last sent data packet (for restart window) */ |
261 | struct tcp_bind_bucket *bind_hash; | ||
262 | /* Delayed ACK control data */ | ||
263 | struct { | ||
264 | __u8 pending; /* ACK is pending */ | ||
265 | __u8 quick; /* Scheduled number of quick acks */ | ||
266 | __u8 pingpong; /* The session is interactive */ | ||
267 | __u8 blocked; /* Delayed ACK was blocked by socket lock*/ | ||
268 | __u32 ato; /* Predicted tick of soft clock */ | ||
269 | unsigned long timeout; /* Currently scheduled timeout */ | ||
270 | __u32 lrcvtime; /* timestamp of last received data packet*/ | ||
271 | __u16 last_seg_size; /* Size of last incoming segment */ | ||
272 | __u16 rcv_mss; /* MSS used for delayed ACK decisions */ | ||
273 | } ack; | ||
274 | 244 | ||
275 | /* Data for direct copy to user */ | 245 | /* Data for direct copy to user */ |
276 | struct { | 246 | struct { |
@@ -288,19 +258,15 @@ struct tcp_sock { | |||
288 | __u32 mss_cache; /* Cached effective mss, not including SACKS */ | 258 | __u32 mss_cache; /* Cached effective mss, not including SACKS */ |
289 | __u16 xmit_size_goal; /* Goal for segmenting output packets */ | 259 | __u16 xmit_size_goal; /* Goal for segmenting output packets */ |
290 | __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ | 260 | __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ |
291 | __u8 ca_state; /* State of fast-retransmit machine */ | ||
292 | __u8 retransmits; /* Number of unrecovered RTO timeouts. */ | ||
293 | 261 | ||
294 | __u16 advmss; /* Advertised MSS */ | ||
295 | __u32 window_clamp; /* Maximal window to advertise */ | 262 | __u32 window_clamp; /* Maximal window to advertise */ |
296 | __u32 rcv_ssthresh; /* Current window clamp */ | 263 | __u32 rcv_ssthresh; /* Current window clamp */ |
297 | 264 | ||
298 | __u32 frto_highmark; /* snd_nxt when RTO occurred */ | 265 | __u32 frto_highmark; /* snd_nxt when RTO occurred */ |
299 | __u8 reordering; /* Packet reordering metric. */ | 266 | __u8 reordering; /* Packet reordering metric. */ |
300 | __u8 frto_counter; /* Number of new acks after RTO */ | 267 | __u8 frto_counter; /* Number of new acks after RTO */ |
301 | 268 | __u8 nonagle; /* Disable Nagle algorithm? */ | |
302 | __u8 unused; | 269 | __u8 keepalive_probes; /* num of allowed keep alive probes */ |
303 | __u8 defer_accept; /* User waits for some data after accept() */ | ||
304 | 270 | ||
305 | /* RTT measurement */ | 271 | /* RTT measurement */ |
306 | __u32 srtt; /* smoothed round trip time << 3 */ | 272 | __u32 srtt; /* smoothed round trip time << 3 */ |
@@ -308,19 +274,13 @@ struct tcp_sock { | |||
308 | __u32 mdev_max; /* maximal mdev for the last rtt period */ | 274 | __u32 mdev_max; /* maximal mdev for the last rtt period */ |
309 | __u32 rttvar; /* smoothed mdev_max */ | 275 | __u32 rttvar; /* smoothed mdev_max */ |
310 | __u32 rtt_seq; /* sequence number to update rttvar */ | 276 | __u32 rtt_seq; /* sequence number to update rttvar */ |
311 | __u32 rto; /* retransmit timeout */ | ||
312 | 277 | ||
313 | __u32 packets_out; /* Packets which are "in flight" */ | 278 | __u32 packets_out; /* Packets which are "in flight" */ |
314 | __u32 left_out; /* Packets which leaved network */ | 279 | __u32 left_out; /* Packets which leaved network */ |
315 | __u32 retrans_out; /* Retransmitted packets out */ | 280 | __u32 retrans_out; /* Retransmitted packets out */ |
316 | __u8 backoff; /* backoff */ | ||
317 | /* | 281 | /* |
318 | * Options received (usually on last packet, some only on SYN packets). | 282 | * Options received (usually on last packet, some only on SYN packets). |
319 | */ | 283 | */ |
320 | __u8 nonagle; /* Disable Nagle algorithm? */ | ||
321 | __u8 keepalive_probes; /* num of allowed keep alive probes */ | ||
322 | |||
323 | __u8 probes_out; /* unanswered 0 window probes */ | ||
324 | struct tcp_options_received rx_opt; | 284 | struct tcp_options_received rx_opt; |
325 | 285 | ||
326 | /* | 286 | /* |
@@ -333,11 +293,6 @@ struct tcp_sock { | |||
333 | __u32 snd_cwnd_used; | 293 | __u32 snd_cwnd_used; |
334 | __u32 snd_cwnd_stamp; | 294 | __u32 snd_cwnd_stamp; |
335 | 295 | ||
336 | /* Two commonly used timers in both sender and receiver paths. */ | ||
337 | unsigned long timeout; | ||
338 | struct timer_list retransmit_timer; /* Resend (no ack) */ | ||
339 | struct timer_list delack_timer; /* Ack delay */ | ||
340 | |||
341 | struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ | 296 | struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ |
342 | 297 | ||
343 | struct tcp_func *af_specific; /* Operations which are AF_INET{4,6} specific */ | 298 | struct tcp_func *af_specific; /* Operations which are AF_INET{4,6} specific */ |
@@ -352,8 +307,7 @@ struct tcp_sock { | |||
352 | struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ | 307 | struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ |
353 | struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ | 308 | struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ |
354 | 309 | ||
355 | __u8 syn_retries; /* num of allowed syn retries */ | 310 | __u16 advmss; /* Advertised MSS */ |
356 | __u8 ecn_flags; /* ECN status bits. */ | ||
357 | __u16 prior_ssthresh; /* ssthresh saved at recovery start */ | 311 | __u16 prior_ssthresh; /* ssthresh saved at recovery start */ |
358 | __u32 lost_out; /* Lost packets */ | 312 | __u32 lost_out; /* Lost packets */ |
359 | __u32 sacked_out; /* SACK'd packets */ | 313 | __u32 sacked_out; /* SACK'd packets */ |
@@ -367,14 +321,12 @@ struct tcp_sock { | |||
367 | int undo_retrans; /* number of undoable retransmissions. */ | 321 | int undo_retrans; /* number of undoable retransmissions. */ |
368 | __u32 urg_seq; /* Seq of received urgent pointer */ | 322 | __u32 urg_seq; /* Seq of received urgent pointer */ |
369 | __u16 urg_data; /* Saved octet of OOB data and control flags */ | 323 | __u16 urg_data; /* Saved octet of OOB data and control flags */ |
370 | __u8 pending; /* Scheduled timer event */ | ||
371 | __u8 urg_mode; /* In urgent mode */ | 324 | __u8 urg_mode; /* In urgent mode */ |
325 | __u8 ecn_flags; /* ECN status bits. */ | ||
372 | __u32 snd_up; /* Urgent pointer */ | 326 | __u32 snd_up; /* Urgent pointer */ |
373 | 327 | ||
374 | __u32 total_retrans; /* Total retransmits for entire connection */ | 328 | __u32 total_retrans; /* Total retransmits for entire connection */ |
375 | 329 | ||
376 | struct request_sock_queue accept_queue; /* FIFO of established children */ | ||
377 | |||
378 | unsigned int keepalive_time; /* time before keep alive takes place */ | 330 | unsigned int keepalive_time; /* time before keep alive takes place */ |
379 | unsigned int keepalive_intvl; /* time interval between keep alive probes */ | 331 | unsigned int keepalive_intvl; /* time interval between keep alive probes */ |
380 | int linger2; | 332 | int linger2; |
@@ -394,11 +346,6 @@ struct tcp_sock { | |||
394 | __u32 seq; | 346 | __u32 seq; |
395 | __u32 time; | 347 | __u32 time; |
396 | } rcvq_space; | 348 | } rcvq_space; |
397 | |||
398 | /* Pluggable TCP congestion control hook */ | ||
399 | struct tcp_congestion_ops *ca_ops; | ||
400 | u32 ca_priv[16]; | ||
401 | #define TCP_CA_PRIV_SIZE (16*sizeof(u32)) | ||
402 | }; | 349 | }; |
403 | 350 | ||
404 | static inline struct tcp_sock *tcp_sk(const struct sock *sk) | 351 | static inline struct tcp_sock *tcp_sk(const struct sock *sk) |
@@ -406,9 +353,18 @@ static inline struct tcp_sock *tcp_sk(const struct sock *sk) | |||
406 | return (struct tcp_sock *)sk; | 353 | return (struct tcp_sock *)sk; |
407 | } | 354 | } |
408 | 355 | ||
409 | static inline void *tcp_ca(const struct tcp_sock *tp) | 356 | struct tcp_timewait_sock { |
357 | struct inet_timewait_sock tw_sk; | ||
358 | __u32 tw_rcv_nxt; | ||
359 | __u32 tw_snd_nxt; | ||
360 | __u32 tw_rcv_wnd; | ||
361 | __u32 tw_ts_recent; | ||
362 | long tw_ts_recent_stamp; | ||
363 | }; | ||
364 | |||
365 | static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) | ||
410 | { | 366 | { |
411 | return (void *) tp->ca_priv; | 367 | return (struct tcp_timewait_sock *)sk; |
412 | } | 368 | } |
413 | 369 | ||
414 | #endif | 370 | #endif |