aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/tcp.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r--include/net/tcp.h48
1 files changed, 45 insertions, 3 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index e79aa48d9fc1..e19124b84cd2 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -170,6 +170,11 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
170#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ 170#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */
171#define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */ 171#define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */
172#define TCPOPT_COOKIE 253 /* Cookie extension (experimental) */ 172#define TCPOPT_COOKIE 253 /* Cookie extension (experimental) */
173#define TCPOPT_EXP 254 /* Experimental */
174/* Magic number to be after the option value for sharing TCP
175 * experimental options. See draft-ietf-tcpm-experimental-options-00.txt
176 */
177#define TCPOPT_FASTOPEN_MAGIC 0xF989
173 178
174/* 179/*
175 * TCP option lengths 180 * TCP option lengths
@@ -180,6 +185,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
180#define TCPOLEN_SACK_PERM 2 185#define TCPOLEN_SACK_PERM 2
181#define TCPOLEN_TIMESTAMP 10 186#define TCPOLEN_TIMESTAMP 10
182#define TCPOLEN_MD5SIG 18 187#define TCPOLEN_MD5SIG 18
188#define TCPOLEN_EXP_FASTOPEN_BASE 4
183#define TCPOLEN_COOKIE_BASE 2 /* Cookie-less header extension */ 189#define TCPOLEN_COOKIE_BASE 2 /* Cookie-less header extension */
184#define TCPOLEN_COOKIE_PAIR 3 /* Cookie pair header extension */ 190#define TCPOLEN_COOKIE_PAIR 3 /* Cookie pair header extension */
185#define TCPOLEN_COOKIE_MIN (TCPOLEN_COOKIE_BASE+TCP_COOKIE_MIN) 191#define TCPOLEN_COOKIE_MIN (TCPOLEN_COOKIE_BASE+TCP_COOKIE_MIN)
@@ -206,6 +212,10 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
206/* TCP initial congestion window as per draft-hkchu-tcpm-initcwnd-01 */ 212/* TCP initial congestion window as per draft-hkchu-tcpm-initcwnd-01 */
207#define TCP_INIT_CWND 10 213#define TCP_INIT_CWND 10
208 214
215/* Bit Flags for sysctl_tcp_fastopen */
216#define TFO_CLIENT_ENABLE 1
217#define TFO_CLIENT_NO_COOKIE 4 /* Data in SYN w/o cookie option */
218
209extern struct inet_timewait_death_row tcp_death_row; 219extern struct inet_timewait_death_row tcp_death_row;
210 220
211/* sysctl variables for tcp */ 221/* sysctl variables for tcp */
@@ -222,6 +232,7 @@ extern int sysctl_tcp_retries1;
222extern int sysctl_tcp_retries2; 232extern int sysctl_tcp_retries2;
223extern int sysctl_tcp_orphan_retries; 233extern int sysctl_tcp_orphan_retries;
224extern int sysctl_tcp_syncookies; 234extern int sysctl_tcp_syncookies;
235extern int sysctl_tcp_fastopen;
225extern int sysctl_tcp_retrans_collapse; 236extern int sysctl_tcp_retrans_collapse;
226extern int sysctl_tcp_stdurg; 237extern int sysctl_tcp_stdurg;
227extern int sysctl_tcp_rfc1337; 238extern int sysctl_tcp_rfc1337;
@@ -253,6 +264,8 @@ extern int sysctl_tcp_cookie_size;
253extern int sysctl_tcp_thin_linear_timeouts; 264extern int sysctl_tcp_thin_linear_timeouts;
254extern int sysctl_tcp_thin_dupack; 265extern int sysctl_tcp_thin_dupack;
255extern int sysctl_tcp_early_retrans; 266extern int sysctl_tcp_early_retrans;
267extern int sysctl_tcp_limit_output_bytes;
268extern int sysctl_tcp_challenge_ack_limit;
256 269
257extern atomic_long_t tcp_memory_allocated; 270extern atomic_long_t tcp_memory_allocated;
258extern struct percpu_counter tcp_sockets_allocated; 271extern struct percpu_counter tcp_sockets_allocated;
@@ -321,19 +334,24 @@ extern struct proto tcp_prot;
321 334
322extern void tcp_init_mem(struct net *net); 335extern void tcp_init_mem(struct net *net);
323 336
337extern void tcp_tasklet_init(void);
338
324extern void tcp_v4_err(struct sk_buff *skb, u32); 339extern void tcp_v4_err(struct sk_buff *skb, u32);
325 340
326extern void tcp_shutdown (struct sock *sk, int how); 341extern void tcp_shutdown (struct sock *sk, int how);
327 342
343extern void tcp_v4_early_demux(struct sk_buff *skb);
328extern int tcp_v4_rcv(struct sk_buff *skb); 344extern int tcp_v4_rcv(struct sk_buff *skb);
329 345
330extern struct inet_peer *tcp_v4_get_peer(struct sock *sk, bool *release_it); 346extern struct inet_peer *tcp_v4_get_peer(struct sock *sk);
331extern void *tcp_v4_tw_get_peer(struct sock *sk);
332extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); 347extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
333extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 348extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
334 size_t size); 349 size_t size);
335extern int tcp_sendpage(struct sock *sk, struct page *page, int offset, 350extern int tcp_sendpage(struct sock *sk, struct page *page, int offset,
336 size_t size, int flags); 351 size_t size, int flags);
352extern void tcp_release_cb(struct sock *sk);
353extern void tcp_write_timer_handler(struct sock *sk);
354extern void tcp_delack_timer_handler(struct sock *sk);
337extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); 355extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg);
338extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, 356extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
339 const struct tcphdr *th, unsigned int len); 357 const struct tcphdr *th, unsigned int len);
@@ -388,6 +406,19 @@ extern void tcp_enter_frto(struct sock *sk);
388extern void tcp_enter_loss(struct sock *sk, int how); 406extern void tcp_enter_loss(struct sock *sk, int how);
389extern void tcp_clear_retrans(struct tcp_sock *tp); 407extern void tcp_clear_retrans(struct tcp_sock *tp);
390extern void tcp_update_metrics(struct sock *sk); 408extern void tcp_update_metrics(struct sock *sk);
409extern void tcp_init_metrics(struct sock *sk);
410extern void tcp_metrics_init(void);
411extern bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, bool paws_check);
412extern bool tcp_remember_stamp(struct sock *sk);
413extern bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw);
414extern void tcp_fastopen_cache_get(struct sock *sk, u16 *mss,
415 struct tcp_fastopen_cookie *cookie,
416 int *syn_loss, unsigned long *last_syn_loss);
417extern void tcp_fastopen_cache_set(struct sock *sk, u16 mss,
418 struct tcp_fastopen_cookie *cookie,
419 bool syn_lost);
420extern void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst);
421extern void tcp_disable_fack(struct tcp_sock *tp);
391extern void tcp_close(struct sock *sk, long timeout); 422extern void tcp_close(struct sock *sk, long timeout);
392extern void tcp_init_sock(struct sock *sk); 423extern void tcp_init_sock(struct sock *sk);
393extern unsigned int tcp_poll(struct file * file, struct socket *sock, 424extern unsigned int tcp_poll(struct file * file, struct socket *sock,
@@ -406,7 +437,7 @@ extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
406 size_t len, int nonblock, int flags, int *addr_len); 437 size_t len, int nonblock, int flags, int *addr_len);
407extern void tcp_parse_options(const struct sk_buff *skb, 438extern void tcp_parse_options(const struct sk_buff *skb,
408 struct tcp_options_received *opt_rx, const u8 **hvpp, 439 struct tcp_options_received *opt_rx, const u8 **hvpp,
409 int estab); 440 int estab, struct tcp_fastopen_cookie *foc);
410extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th); 441extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
411 442
412/* 443/*
@@ -556,6 +587,8 @@ static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
556 return (tp->srtt >> 3) + tp->rttvar; 587 return (tp->srtt >> 3) + tp->rttvar;
557} 588}
558 589
590extern void tcp_set_rto(struct sock *sk);
591
559static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) 592static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
560{ 593{
561 tp->pred_flags = htonl((tp->tcp_header_len << 26) | 594 tp->pred_flags = htonl((tp->tcp_header_len << 26) |
@@ -1264,6 +1297,15 @@ extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff
1264extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, 1297extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp,
1265 const struct tcp_md5sig_key *key); 1298 const struct tcp_md5sig_key *key);
1266 1299
1300struct tcp_fastopen_request {
1301 /* Fast Open cookie. Size 0 means a cookie request */
1302 struct tcp_fastopen_cookie cookie;
1303 struct msghdr *data; /* data in MSG_FASTOPEN */
1304 u16 copied; /* queued in tcp_connect() */
1305};
1306
1307void tcp_free_fastopen_req(struct tcp_sock *tp);
1308
1267/* write queue abstraction */ 1309/* write queue abstraction */
1268static inline void tcp_write_queue_purge(struct sock *sk) 1310static inline void tcp_write_queue_purge(struct sock *sk)
1269{ 1311{