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.h44
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;
284extern int sysctl_tcp_early_retrans; 280extern int sysctl_tcp_early_retrans;
285extern int sysctl_tcp_limit_output_bytes; 281extern int sysctl_tcp_limit_output_bytes;
286extern int sysctl_tcp_challenge_ack_limit; 282extern int sysctl_tcp_challenge_ack_limit;
283extern unsigned int sysctl_tcp_notsent_lowat;
284extern int sysctl_tcp_min_tso_segs;
287 285
288extern atomic_long_t tcp_memory_allocated; 286extern atomic_long_t tcp_memory_allocated;
289extern struct percpu_counter tcp_sockets_allocated; 287extern struct percpu_counter tcp_sockets_allocated;
@@ -373,8 +371,8 @@ extern void tcp_delack_timer_handler(struct sock *sk);
373extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); 371extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg);
374extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, 372extern 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);
376extern int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, 374extern 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);
378extern void tcp_rcv_space_adjust(struct sock *sk); 376extern void tcp_rcv_space_adjust(struct sock *sk);
379extern void tcp_cleanup_rbuf(struct sock *sk, int copied); 377extern void tcp_cleanup_rbuf(struct sock *sk, int copied);
380extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); 378extern 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 */
481extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; 479extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS];
480extern int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th,
481 u32 cookie);
482extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, 482extern 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
485extern u32 __cookie_v4_init_sequence(const struct iphdr *iph,
486 const struct tcphdr *th, u16 *mssp);
485extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, 487extern __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 */
503extern int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th,
504 u32 cookie);
501extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); 505extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb);
502#ifdef CONFIG_SYN_COOKIES 506#ifdef CONFIG_SYN_COOKIES
507extern u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph,
508 const struct tcphdr *th, u16 *mssp);
503extern __u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb, 509extern __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);
591extern int tcp_mtu_to_mss(struct sock *sk, int pmtu); 597extern int tcp_mtu_to_mss(struct sock *sk, int pmtu);
592extern int tcp_mss_to_mtu(struct sock *sk, int mss); 598extern int tcp_mss_to_mtu(struct sock *sk, int mss);
593extern void tcp_mtup_init(struct sock *sk); 599extern void tcp_mtup_init(struct sock *sk);
594extern void tcp_valid_rtt_meas(struct sock *sk, u32 seq_rtt);
595extern void tcp_init_buffer_space(struct sock *sk); 600extern void tcp_init_buffer_space(struct sock *sk);
596 601
597static inline void tcp_bound_rto(const struct sock *sk) 602static 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 */
1098static 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
1106extern void tcp_enter_memory_pressure(struct sock *sk); 1102extern void tcp_enter_memory_pressure(struct sock *sk);
1107 1103
1108static inline int keepalive_intvl_when(const struct tcp_sock *tp) 1104static 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
1314extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; 1310extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
1315int tcp_fastopen_reset_cipher(void *key, unsigned int len); 1311int tcp_fastopen_reset_cipher(void *key, unsigned int len);
1316void tcp_fastopen_cookie_gen(__be32 addr, struct tcp_fastopen_cookie *foc); 1312extern 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);
1549extern void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, 1546extern void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr,
1550 __be32 daddr); 1547 __be32 daddr);
1551 1548
1549static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp)
1550{
1551 return tp->notsent_lowat ?: sysctl_tcp_notsent_lowat;
1552}
1553
1554static 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
1553extern int tcp4_proc_init(void); 1563extern int tcp4_proc_init(void);
1554extern void tcp4_proc_exit(void); 1564extern void tcp4_proc_exit(void);