tcp.h (ee3e542fec6e69bc9fb668698889a37d93950ddf) tcp.h (0198230b7705eb2386e53778d944e307eef0cc71)
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the TCP module.
7 *
8 * Version: @(#)tcp.h 1.0.5 05/23/93

--- 178 unchanged lines hidden (view full) ---

187 */
188
189#define TCPOLEN_MSS 4
190#define TCPOLEN_WINDOW 3
191#define TCPOLEN_SACK_PERM 2
192#define TCPOLEN_TIMESTAMP 10
193#define TCPOLEN_MD5SIG 18
194#define TCPOLEN_EXP_FASTOPEN_BASE 4
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the TCP module.
7 *
8 * Version: @(#)tcp.h 1.0.5 05/23/93

--- 178 unchanged lines hidden (view full) ---

187 */
188
189#define TCPOLEN_MSS 4
190#define TCPOLEN_WINDOW 3
191#define TCPOLEN_SACK_PERM 2
192#define TCPOLEN_TIMESTAMP 10
193#define TCPOLEN_MD5SIG 18
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
200/* But this is what stacks really send out. */
201#define TCPOLEN_TSTAMP_ALIGNED 12
202#define TCPOLEN_WSCALE_ALIGNED 4
203#define TCPOLEN_SACKPERM_ALIGNED 4
204#define TCPOLEN_SACK_BASE 2
205#define TCPOLEN_SACK_BASE_ALIGNED 4
206#define TCPOLEN_SACK_PERBLOCK 8

--- 72 unchanged lines hidden (view full) ---

279extern int sysctl_tcp_workaround_signed_windows;
280extern int sysctl_tcp_slow_start_after_idle;
281extern int sysctl_tcp_max_ssthresh;
282extern int sysctl_tcp_thin_linear_timeouts;
283extern int sysctl_tcp_thin_dupack;
284extern int sysctl_tcp_early_retrans;
285extern int sysctl_tcp_limit_output_bytes;
286extern int sysctl_tcp_challenge_ack_limit;
195
196/* But this is what stacks really send out. */
197#define TCPOLEN_TSTAMP_ALIGNED 12
198#define TCPOLEN_WSCALE_ALIGNED 4
199#define TCPOLEN_SACKPERM_ALIGNED 4
200#define TCPOLEN_SACK_BASE 2
201#define TCPOLEN_SACK_BASE_ALIGNED 4
202#define TCPOLEN_SACK_PERBLOCK 8

--- 72 unchanged lines hidden (view full) ---

275extern int sysctl_tcp_workaround_signed_windows;
276extern int sysctl_tcp_slow_start_after_idle;
277extern int sysctl_tcp_max_ssthresh;
278extern int sysctl_tcp_thin_linear_timeouts;
279extern int sysctl_tcp_thin_dupack;
280extern int sysctl_tcp_early_retrans;
281extern int sysctl_tcp_limit_output_bytes;
282extern int sysctl_tcp_challenge_ack_limit;
283extern unsigned int sysctl_tcp_notsent_lowat;
287
288extern atomic_long_t tcp_memory_allocated;
289extern struct percpu_counter tcp_sockets_allocated;
290extern int tcp_memory_pressure;
291
292/*
293 * The next routines deal with comparing 32 bit unsigned ints
294 * and worry about wraparound (automatic with unsigned arithmetic).

--- 179 unchanged lines hidden (view full) ---

474
475void tcp_connect_init(struct sock *sk);
476void tcp_finish_connect(struct sock *sk, struct sk_buff *skb);
477int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size);
478void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb);
479
480/* From syncookies.c */
481extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS];
284
285extern atomic_long_t tcp_memory_allocated;
286extern struct percpu_counter tcp_sockets_allocated;
287extern int tcp_memory_pressure;
288
289/*
290 * The next routines deal with comparing 32 bit unsigned ints
291 * and worry about wraparound (automatic with unsigned arithmetic).

--- 179 unchanged lines hidden (view full) ---

471
472void tcp_connect_init(struct sock *sk);
473void tcp_finish_connect(struct sock *sk, struct sk_buff *skb);
474int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size);
475void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb);
476
477/* From syncookies.c */
478extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS];
479extern int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th,
480 u32 cookie);
482extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
483 struct ip_options *opt);
484#ifdef CONFIG_SYN_COOKIES
481extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
482 struct ip_options *opt);
483#ifdef CONFIG_SYN_COOKIES
484extern u32 __cookie_v4_init_sequence(const struct iphdr *iph,
485 const struct tcphdr *th, u16 *mssp);
485extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
486 __u16 *mss);
487#else
488static inline __u32 cookie_v4_init_sequence(struct sock *sk,
489 struct sk_buff *skb,
490 __u16 *mss)
491{
492 return 0;

--- 93 unchanged lines hidden (view full) ---

586extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
587 sk_read_actor_t recv_actor);
588
589extern void tcp_initialize_rcv_mss(struct sock *sk);
590
591extern int tcp_mtu_to_mss(struct sock *sk, int pmtu);
592extern int tcp_mss_to_mtu(struct sock *sk, int mss);
593extern void tcp_mtup_init(struct sock *sk);
486extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
487 __u16 *mss);
488#else
489static inline __u32 cookie_v4_init_sequence(struct sock *sk,
490 struct sk_buff *skb,
491 __u16 *mss)
492{
493 return 0;

--- 93 unchanged lines hidden (view full) ---

587extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
588 sk_read_actor_t recv_actor);
589
590extern void tcp_initialize_rcv_mss(struct sock *sk);
591
592extern int tcp_mtu_to_mss(struct sock *sk, int pmtu);
593extern int tcp_mss_to_mtu(struct sock *sk, int mss);
594extern 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);
596
597static inline void tcp_bound_rto(const struct sock *sk)
598{
599 if (inet_csk(sk)->icsk_rto > TCP_RTO_MAX)
600 inet_csk(sk)->icsk_rto = TCP_RTO_MAX;
601}
602

--- 486 unchanged lines hidden (view full) ---

1089 ireq->snd_wscale = rx_opt->snd_wscale;
1090 ireq->wscale_ok = rx_opt->wscale_ok;
1091 ireq->acked = 0;
1092 ireq->ecn_ok = 0;
1093 ireq->rmt_port = tcp_hdr(skb)->source;
1094 ireq->loc_port = tcp_hdr(skb)->dest;
1095}
1096
595extern void tcp_init_buffer_space(struct sock *sk);
596
597static inline void tcp_bound_rto(const struct sock *sk)
598{
599 if (inet_csk(sk)->icsk_rto > TCP_RTO_MAX)
600 inet_csk(sk)->icsk_rto = TCP_RTO_MAX;
601}
602

--- 486 unchanged lines hidden (view full) ---

1089 ireq->snd_wscale = rx_opt->snd_wscale;
1090 ireq->wscale_ok = rx_opt->wscale_ok;
1091 ireq->acked = 0;
1092 ireq->ecn_ok = 0;
1093 ireq->rmt_port = tcp_hdr(skb)->source;
1094 ireq->loc_port = tcp_hdr(skb)->dest;
1095}
1096
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);
1107
1108static inline int keepalive_intvl_when(const struct tcp_sock *tp)
1109{
1110 return tp->keepalive_intvl ? : sysctl_tcp_keepalive_intvl;
1111}
1112
1113static inline int keepalive_time_when(const struct tcp_sock *tp)

--- 194 unchanged lines hidden (view full) ---

1308 struct tcp_fastopen_cookie cookie;
1309 struct msghdr *data; /* data in MSG_FASTOPEN */
1310 u16 copied; /* queued in tcp_connect() */
1311};
1312void tcp_free_fastopen_req(struct tcp_sock *tp);
1313
1314extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
1315int tcp_fastopen_reset_cipher(void *key, unsigned int len);
1097extern void tcp_enter_memory_pressure(struct sock *sk);
1098
1099static inline int keepalive_intvl_when(const struct tcp_sock *tp)
1100{
1101 return tp->keepalive_intvl ? : sysctl_tcp_keepalive_intvl;
1102}
1103
1104static inline int keepalive_time_when(const struct tcp_sock *tp)

--- 194 unchanged lines hidden (view full) ---

1299 struct tcp_fastopen_cookie cookie;
1300 struct msghdr *data; /* data in MSG_FASTOPEN */
1301 u16 copied; /* queued in tcp_connect() */
1302};
1303void tcp_free_fastopen_req(struct tcp_sock *tp);
1304
1305extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
1306int tcp_fastopen_reset_cipher(void *key, unsigned int len);
1316void tcp_fastopen_cookie_gen(__be32 addr, struct tcp_fastopen_cookie *foc);
1307extern void tcp_fastopen_cookie_gen(__be32 src, __be32 dst,
1308 struct tcp_fastopen_cookie *foc);
1317
1318#define TCP_FASTOPEN_KEY_LENGTH 16
1319
1320/* Fastopen key context */
1321struct tcp_fastopen_context {
1322 struct crypto_cipher *tfm;
1323 __u8 key[TCP_FASTOPEN_KEY_LENGTH];
1324 struct rcu_head rcu;

--- 219 unchanged lines hidden (view full) ---

1544 netdev_features_t features);
1545extern struct sk_buff **tcp_gro_receive(struct sk_buff **head,
1546 struct sk_buff *skb);
1547extern int tcp_gro_complete(struct sk_buff *skb);
1548
1549extern void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr,
1550 __be32 daddr);
1551
1309
1310#define TCP_FASTOPEN_KEY_LENGTH 16
1311
1312/* Fastopen key context */
1313struct tcp_fastopen_context {
1314 struct crypto_cipher *tfm;
1315 __u8 key[TCP_FASTOPEN_KEY_LENGTH];
1316 struct rcu_head rcu;

--- 219 unchanged lines hidden (view full) ---

1536 netdev_features_t features);
1537extern struct sk_buff **tcp_gro_receive(struct sk_buff **head,
1538 struct sk_buff *skb);
1539extern int tcp_gro_complete(struct sk_buff *skb);
1540
1541extern void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr,
1542 __be32 daddr);
1543
1544static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp)
1545{
1546 return tp->notsent_lowat ?: sysctl_tcp_notsent_lowat;
1547}
1548
1549static inline bool tcp_stream_memory_free(const struct sock *sk)
1550{
1551 const struct tcp_sock *tp = tcp_sk(sk);
1552 u32 notsent_bytes = tp->write_seq - tp->snd_nxt;
1553
1554 return notsent_bytes < tcp_notsent_lowat(tp);
1555}
1556
1552#ifdef CONFIG_PROC_FS
1553extern int tcp4_proc_init(void);
1554extern void tcp4_proc_exit(void);
1555#endif
1556
1557/* TCP af-specific functions */
1558struct tcp_sock_af_ops {
1559#ifdef CONFIG_TCP_MD5SIG

--- 31 unchanged lines hidden ---
1557#ifdef CONFIG_PROC_FS
1558extern int tcp4_proc_init(void);
1559extern void tcp4_proc_exit(void);
1560#endif
1561
1562/* TCP af-specific functions */
1563struct tcp_sock_af_ops {
1564#ifdef CONFIG_TCP_MD5SIG

--- 31 unchanged lines hidden ---