aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/tcp.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-07-21 09:06:09 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-21 09:06:09 -0400
commite66d90fb4abd0a27ee96f57a32fb561221c4d6ae (patch)
tree3337cba94c7444b06fdb0e8b487287d07b71f4a0 /include/net/tcp.h
parent55ca089e2579de90f048aca2a3030b8b2f864813 (diff)
parent14b395e35d1afdd8019d11b92e28041fad591b71 (diff)
Merge branch 'linus' into xen-64bit
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r--include/net/tcp.h65
1 files changed, 38 insertions, 27 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index cf54034019d9..8983386356a5 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -50,6 +50,7 @@ extern atomic_t tcp_orphan_count;
50extern void tcp_time_wait(struct sock *sk, int state, int timeo); 50extern void tcp_time_wait(struct sock *sk, int state, int timeo);
51 51
52#define MAX_TCP_HEADER (128 + MAX_HEADER) 52#define MAX_TCP_HEADER (128 + MAX_HEADER)
53#define MAX_TCP_OPTION_SPACE 40
53 54
54/* 55/*
55 * Never offer a window over 32767 without using window scaling. Some 56 * Never offer a window over 32767 without using window scaling. Some
@@ -184,6 +185,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
184#define TCPOLEN_SACK_BASE_ALIGNED 4 185#define TCPOLEN_SACK_BASE_ALIGNED 4
185#define TCPOLEN_SACK_PERBLOCK 8 186#define TCPOLEN_SACK_PERBLOCK 8
186#define TCPOLEN_MD5SIG_ALIGNED 20 187#define TCPOLEN_MD5SIG_ALIGNED 20
188#define TCPOLEN_MSS_ALIGNED 4
187 189
188/* Flags in tp->nonagle */ 190/* Flags in tp->nonagle */
189#define TCP_NAGLE_OFF 1 /* Nagle's algo is disabled */ 191#define TCP_NAGLE_OFF 1 /* Nagle's algo is disabled */
@@ -265,13 +267,10 @@ static inline int tcp_too_many_orphans(struct sock *sk, int num)
265 267
266extern struct proto tcp_prot; 268extern struct proto tcp_prot;
267 269
268DECLARE_SNMP_STAT(struct tcp_mib, tcp_statistics); 270#define TCP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.tcp_statistics, field)
269#define TCP_INC_STATS(field) SNMP_INC_STATS(tcp_statistics, field) 271#define TCP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.tcp_statistics, field)
270#define TCP_INC_STATS_BH(field) SNMP_INC_STATS_BH(tcp_statistics, field) 272#define TCP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->mib.tcp_statistics, field)
271#define TCP_INC_STATS_USER(field) SNMP_INC_STATS_USER(tcp_statistics, field) 273#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val)
272#define TCP_DEC_STATS(field) SNMP_DEC_STATS(tcp_statistics, field)
273#define TCP_ADD_STATS_BH(field, val) SNMP_ADD_STATS_BH(tcp_statistics, field, val)
274#define TCP_ADD_STATS_USER(field, val) SNMP_ADD_STATS_USER(tcp_statistics, field, val)
275 274
276extern void tcp_v4_err(struct sk_buff *skb, u32); 275extern void tcp_v4_err(struct sk_buff *skb, u32);
277 276
@@ -398,6 +397,8 @@ extern void tcp_parse_options(struct sk_buff *skb,
398 struct tcp_options_received *opt_rx, 397 struct tcp_options_received *opt_rx,
399 int estab); 398 int estab);
400 399
400extern u8 *tcp_parse_md5sig_option(struct tcphdr *th);
401
401/* 402/*
402 * TCP v4 functions exported for the inet6 API 403 * TCP v4 functions exported for the inet6 API
403 */ 404 */
@@ -894,7 +895,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
894 895
895 while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) { 896 while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) {
896 sk->sk_backlog_rcv(sk, skb1); 897 sk->sk_backlog_rcv(sk, skb1);
897 NET_INC_STATS_BH(LINUX_MIB_TCPPREQUEUEDROPPED); 898 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPPREQUEUEDROPPED);
898 } 899 }
899 900
900 tp->ucopy.memory = 0; 901 tp->ucopy.memory = 0;
@@ -975,7 +976,7 @@ static inline void tcp_openreq_init(struct request_sock *req,
975 ireq->rmt_port = tcp_hdr(skb)->source; 976 ireq->rmt_port = tcp_hdr(skb)->source;
976} 977}
977 978
978extern void tcp_enter_memory_pressure(void); 979extern void tcp_enter_memory_pressure(struct sock *sk);
979 980
980static inline int keepalive_intvl_when(const struct tcp_sock *tp) 981static inline int keepalive_intvl_when(const struct tcp_sock *tp)
981{ 982{
@@ -1024,13 +1025,13 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int
1024 1025
1025#define TCP_CHECK_TIMER(sk) do { } while (0) 1026#define TCP_CHECK_TIMER(sk) do { } while (0)
1026 1027
1027static inline void tcp_mib_init(void) 1028static inline void tcp_mib_init(struct net *net)
1028{ 1029{
1029 /* See RFC 2012 */ 1030 /* See RFC 2012 */
1030 TCP_ADD_STATS_USER(TCP_MIB_RTOALGORITHM, 1); 1031 TCP_ADD_STATS_USER(net, TCP_MIB_RTOALGORITHM, 1);
1031 TCP_ADD_STATS_USER(TCP_MIB_RTOMIN, TCP_RTO_MIN*1000/HZ); 1032 TCP_ADD_STATS_USER(net, TCP_MIB_RTOMIN, TCP_RTO_MIN*1000/HZ);
1032 TCP_ADD_STATS_USER(TCP_MIB_RTOMAX, TCP_RTO_MAX*1000/HZ); 1033 TCP_ADD_STATS_USER(net, TCP_MIB_RTOMAX, TCP_RTO_MAX*1000/HZ);
1033 TCP_ADD_STATS_USER(TCP_MIB_MAXCONN, -1); 1034 TCP_ADD_STATS_USER(net, TCP_MIB_MAXCONN, -1);
1034} 1035}
1035 1036
1036/* from STCP */ 1037/* from STCP */
@@ -1113,14 +1114,12 @@ struct tcp_md5sig_pool {
1113#define TCP_MD5SIG_MAXKEYS (~(u32)0) /* really?! */ 1114#define TCP_MD5SIG_MAXKEYS (~(u32)0) /* really?! */
1114 1115
1115/* - functions */ 1116/* - functions */
1116extern int tcp_v4_calc_md5_hash(char *md5_hash, 1117extern int tcp_v4_md5_hash_skb(char *md5_hash,
1117 struct tcp_md5sig_key *key, 1118 struct tcp_md5sig_key *key,
1118 struct sock *sk, 1119 struct sock *sk,
1119 struct dst_entry *dst, 1120 struct request_sock *req,
1120 struct request_sock *req, 1121 struct sk_buff *skb);
1121 struct tcphdr *th, 1122
1122 int protocol,
1123 unsigned int tcplen);
1124extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, 1123extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
1125 struct sock *addr_sk); 1124 struct sock *addr_sk);
1126 1125
@@ -1132,11 +1131,26 @@ extern int tcp_v4_md5_do_add(struct sock *sk,
1132extern int tcp_v4_md5_do_del(struct sock *sk, 1131extern int tcp_v4_md5_do_del(struct sock *sk,
1133 __be32 addr); 1132 __be32 addr);
1134 1133
1134#ifdef CONFIG_TCP_MD5SIG
1135#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \
1136 &(struct tcp_md5sig_key) { \
1137 .key = (twsk)->tw_md5_key, \
1138 .keylen = (twsk)->tw_md5_keylen, \
1139 } : NULL)
1140#else
1141#define tcp_twsk_md5_key(twsk) NULL
1142#endif
1143
1135extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(void); 1144extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(void);
1136extern void tcp_free_md5sig_pool(void); 1145extern void tcp_free_md5sig_pool(void);
1137 1146
1138extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu); 1147extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu);
1139extern void __tcp_put_md5sig_pool(void); 1148extern void __tcp_put_md5sig_pool(void);
1149extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *);
1150extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *,
1151 unsigned header_len);
1152extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp,
1153 struct tcp_md5sig_key *key);
1140 1154
1141static inline 1155static inline
1142struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) 1156struct tcp_md5sig_pool *tcp_get_md5sig_pool(void)
@@ -1348,7 +1362,7 @@ extern void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo);
1348extern struct request_sock_ops tcp_request_sock_ops; 1362extern struct request_sock_ops tcp_request_sock_ops;
1349extern struct request_sock_ops tcp6_request_sock_ops; 1363extern struct request_sock_ops tcp6_request_sock_ops;
1350 1364
1351extern int tcp_v4_destroy_sock(struct sock *sk); 1365extern void tcp_v4_destroy_sock(struct sock *sk);
1352 1366
1353extern int tcp_v4_gso_send_check(struct sk_buff *skb); 1367extern int tcp_v4_gso_send_check(struct sk_buff *skb);
1354extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features); 1368extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features);
@@ -1366,11 +1380,8 @@ struct tcp_sock_af_ops {
1366 int (*calc_md5_hash) (char *location, 1380 int (*calc_md5_hash) (char *location,
1367 struct tcp_md5sig_key *md5, 1381 struct tcp_md5sig_key *md5,
1368 struct sock *sk, 1382 struct sock *sk,
1369 struct dst_entry *dst,
1370 struct request_sock *req, 1383 struct request_sock *req,
1371 struct tcphdr *th, 1384 struct sk_buff *skb);
1372 int protocol,
1373 unsigned int len);
1374 int (*md5_add) (struct sock *sk, 1385 int (*md5_add) (struct sock *sk,
1375 struct sock *addr_sk, 1386 struct sock *addr_sk,
1376 u8 *newkey, 1387 u8 *newkey,