diff options
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r-- | include/net/tcp.h | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index d1980054ec75..b1aa324c5e65 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -192,10 +192,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo); | |||
192 | #define TCPOLEN_TIMESTAMP 10 | 192 | #define TCPOLEN_TIMESTAMP 10 |
193 | #define TCPOLEN_MD5SIG 18 | 193 | #define TCPOLEN_MD5SIG 18 |
194 | #define TCPOLEN_EXP_FASTOPEN_BASE 4 | 194 | #define TCPOLEN_EXP_FASTOPEN_BASE 4 |
195 | #define TCPOLEN_COOKIE_BASE 2 /* Cookie-less header extension */ | ||
196 | #define TCPOLEN_COOKIE_PAIR 3 /* Cookie pair header extension */ | ||
197 | #define TCPOLEN_COOKIE_MIN (TCPOLEN_COOKIE_BASE+TCP_COOKIE_MIN) | ||
198 | #define TCPOLEN_COOKIE_MAX (TCPOLEN_COOKIE_BASE+TCP_COOKIE_MAX) | ||
199 | 195 | ||
200 | /* But this is what stacks really send out. */ | 196 | /* But this is what stacks really send out. */ |
201 | #define TCPOLEN_TSTAMP_ALIGNED 12 | 197 | #define TCPOLEN_TSTAMP_ALIGNED 12 |
@@ -284,6 +280,8 @@ extern int sysctl_tcp_thin_dupack; | |||
284 | extern int sysctl_tcp_early_retrans; | 280 | extern int sysctl_tcp_early_retrans; |
285 | extern int sysctl_tcp_limit_output_bytes; | 281 | extern int sysctl_tcp_limit_output_bytes; |
286 | extern int sysctl_tcp_challenge_ack_limit; | 282 | extern int sysctl_tcp_challenge_ack_limit; |
283 | extern unsigned int sysctl_tcp_notsent_lowat; | ||
284 | extern int sysctl_tcp_min_tso_segs; | ||
287 | 285 | ||
288 | extern atomic_long_t tcp_memory_allocated; | 286 | extern atomic_long_t tcp_memory_allocated; |
289 | extern struct percpu_counter tcp_sockets_allocated; | 287 | extern struct percpu_counter tcp_sockets_allocated; |
@@ -373,8 +371,8 @@ extern void tcp_delack_timer_handler(struct sock *sk); | |||
373 | extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); | 371 | extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); |
374 | extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | 372 | extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, |
375 | const struct tcphdr *th, unsigned int len); | 373 | const struct tcphdr *th, unsigned int len); |
376 | extern int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, | 374 | extern void tcp_rcv_established(struct sock *sk, struct sk_buff *skb, |
377 | const struct tcphdr *th, unsigned int len); | 375 | const struct tcphdr *th, unsigned int len); |
378 | extern void tcp_rcv_space_adjust(struct sock *sk); | 376 | extern void tcp_rcv_space_adjust(struct sock *sk); |
379 | extern void tcp_cleanup_rbuf(struct sock *sk, int copied); | 377 | extern void tcp_cleanup_rbuf(struct sock *sk, int copied); |
380 | extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); | 378 | extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); |
@@ -479,9 +477,13 @@ void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb); | |||
479 | 477 | ||
480 | /* From syncookies.c */ | 478 | /* From syncookies.c */ |
481 | extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; | 479 | extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; |
480 | extern int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th, | ||
481 | u32 cookie); | ||
482 | extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, | 482 | extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, |
483 | struct ip_options *opt); | 483 | struct ip_options *opt); |
484 | #ifdef CONFIG_SYN_COOKIES | 484 | #ifdef CONFIG_SYN_COOKIES |
485 | extern u32 __cookie_v4_init_sequence(const struct iphdr *iph, | ||
486 | const struct tcphdr *th, u16 *mssp); | ||
485 | extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, | 487 | extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, |
486 | __u16 *mss); | 488 | __u16 *mss); |
487 | #else | 489 | #else |
@@ -498,8 +500,12 @@ extern bool cookie_check_timestamp(struct tcp_options_received *opt, | |||
498 | struct net *net, bool *ecn_ok); | 500 | struct net *net, bool *ecn_ok); |
499 | 501 | ||
500 | /* From net/ipv6/syncookies.c */ | 502 | /* From net/ipv6/syncookies.c */ |
503 | extern int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th, | ||
504 | u32 cookie); | ||
501 | extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); | 505 | extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); |
502 | #ifdef CONFIG_SYN_COOKIES | 506 | #ifdef CONFIG_SYN_COOKIES |
507 | extern u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph, | ||
508 | const struct tcphdr *th, u16 *mssp); | ||
503 | extern __u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb, | 509 | extern __u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb, |
504 | __u16 *mss); | 510 | __u16 *mss); |
505 | #else | 511 | #else |
@@ -591,7 +597,6 @@ extern void tcp_initialize_rcv_mss(struct sock *sk); | |||
591 | extern int tcp_mtu_to_mss(struct sock *sk, int pmtu); | 597 | extern int tcp_mtu_to_mss(struct sock *sk, int pmtu); |
592 | extern int tcp_mss_to_mtu(struct sock *sk, int mss); | 598 | extern int tcp_mss_to_mtu(struct sock *sk, int mss); |
593 | extern void tcp_mtup_init(struct sock *sk); | 599 | extern void tcp_mtup_init(struct sock *sk); |
594 | extern void tcp_valid_rtt_meas(struct sock *sk, u32 seq_rtt); | ||
595 | extern void tcp_init_buffer_space(struct sock *sk); | 600 | extern void tcp_init_buffer_space(struct sock *sk); |
596 | 601 | ||
597 | static inline void tcp_bound_rto(const struct sock *sk) | 602 | static inline void tcp_bound_rto(const struct sock *sk) |
@@ -1094,15 +1099,6 @@ static inline void tcp_openreq_init(struct request_sock *req, | |||
1094 | ireq->loc_port = tcp_hdr(skb)->dest; | 1099 | ireq->loc_port = tcp_hdr(skb)->dest; |
1095 | } | 1100 | } |
1096 | 1101 | ||
1097 | /* Compute time elapsed between SYNACK and the ACK completing 3WHS */ | ||
1098 | static inline void tcp_synack_rtt_meas(struct sock *sk, | ||
1099 | struct request_sock *req) | ||
1100 | { | ||
1101 | if (tcp_rsk(req)->snt_synack) | ||
1102 | tcp_valid_rtt_meas(sk, | ||
1103 | tcp_time_stamp - tcp_rsk(req)->snt_synack); | ||
1104 | } | ||
1105 | |||
1106 | extern void tcp_enter_memory_pressure(struct sock *sk); | 1102 | extern void tcp_enter_memory_pressure(struct sock *sk); |
1107 | 1103 | ||
1108 | static inline int keepalive_intvl_when(const struct tcp_sock *tp) | 1104 | static inline int keepalive_intvl_when(const struct tcp_sock *tp) |
@@ -1313,7 +1309,8 @@ void tcp_free_fastopen_req(struct tcp_sock *tp); | |||
1313 | 1309 | ||
1314 | extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; | 1310 | extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; |
1315 | int tcp_fastopen_reset_cipher(void *key, unsigned int len); | 1311 | int tcp_fastopen_reset_cipher(void *key, unsigned int len); |
1316 | void tcp_fastopen_cookie_gen(__be32 addr, struct tcp_fastopen_cookie *foc); | 1312 | extern void tcp_fastopen_cookie_gen(__be32 src, __be32 dst, |
1313 | struct tcp_fastopen_cookie *foc); | ||
1317 | 1314 | ||
1318 | #define TCP_FASTOPEN_KEY_LENGTH 16 | 1315 | #define TCP_FASTOPEN_KEY_LENGTH 16 |
1319 | 1316 | ||
@@ -1549,6 +1546,19 @@ extern int tcp_gro_complete(struct sk_buff *skb); | |||
1549 | extern void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, | 1546 | extern void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, |
1550 | __be32 daddr); | 1547 | __be32 daddr); |
1551 | 1548 | ||
1549 | static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp) | ||
1550 | { | ||
1551 | return tp->notsent_lowat ?: sysctl_tcp_notsent_lowat; | ||
1552 | } | ||
1553 | |||
1554 | static inline bool tcp_stream_memory_free(const struct sock *sk) | ||
1555 | { | ||
1556 | const struct tcp_sock *tp = tcp_sk(sk); | ||
1557 | u32 notsent_bytes = tp->write_seq - tp->snd_nxt; | ||
1558 | |||
1559 | return notsent_bytes < tcp_notsent_lowat(tp); | ||
1560 | } | ||
1561 | |||
1552 | #ifdef CONFIG_PROC_FS | 1562 | #ifdef CONFIG_PROC_FS |
1553 | extern int tcp4_proc_init(void); | 1563 | extern int tcp4_proc_init(void); |
1554 | extern void tcp4_proc_exit(void); | 1564 | extern void tcp4_proc_exit(void); |