diff options
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/af_unix.h | 2 | ||||
-rw-r--r-- | include/net/dst.h | 7 | ||||
-rw-r--r-- | include/net/esp.h | 2 | ||||
-rw-r--r-- | include/net/fib_rules.h | 3 | ||||
-rw-r--r-- | include/net/ieee80211.h | 8 | ||||
-rw-r--r-- | include/net/inet_common.h | 4 | ||||
-rw-r--r-- | include/net/inet_hashtables.h | 71 | ||||
-rw-r--r-- | include/net/inetpeer.h | 2 | ||||
-rw-r--r-- | include/net/ip_fib.h | 15 | ||||
-rw-r--r-- | include/net/ip_vs.h | 42 | ||||
-rw-r--r-- | include/net/mac80211.h | 26 | ||||
-rw-r--r-- | include/net/net_namespace.h | 35 | ||||
-rw-r--r-- | include/net/request_sock.h | 18 | ||||
-rw-r--r-- | include/net/sctp/auth.h | 2 | ||||
-rw-r--r-- | include/net/sctp/command.h | 1 | ||||
-rw-r--r-- | include/net/sctp/constants.h | 3 | ||||
-rw-r--r-- | include/net/sctp/sctp.h | 5 | ||||
-rw-r--r-- | include/net/sctp/structs.h | 22 | ||||
-rw-r--r-- | include/net/sock.h | 92 | ||||
-rw-r--r-- | include/net/tcp.h | 3 |
20 files changed, 222 insertions, 141 deletions
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 0864a775de24..a1c805d7f488 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -12,7 +12,7 @@ extern void unix_gc(void); | |||
12 | 12 | ||
13 | #define UNIX_HASH_SIZE 256 | 13 | #define UNIX_HASH_SIZE 256 |
14 | 14 | ||
15 | extern atomic_t unix_tot_inflight; | 15 | extern unsigned int unix_tot_inflight; |
16 | 16 | ||
17 | struct unix_address { | 17 | struct unix_address { |
18 | atomic_t refcnt; | 18 | atomic_t refcnt; |
diff --git a/include/net/dst.h b/include/net/dst.h index e9ff4a4caef9..2f65e894b829 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -143,6 +143,13 @@ static inline void dst_hold(struct dst_entry * dst) | |||
143 | atomic_inc(&dst->__refcnt); | 143 | atomic_inc(&dst->__refcnt); |
144 | } | 144 | } |
145 | 145 | ||
146 | static inline void dst_use(struct dst_entry *dst, unsigned long time) | ||
147 | { | ||
148 | dst_hold(dst); | ||
149 | dst->__use++; | ||
150 | dst->lastuse = time; | ||
151 | } | ||
152 | |||
146 | static inline | 153 | static inline |
147 | struct dst_entry * dst_clone(struct dst_entry * dst) | 154 | struct dst_entry * dst_clone(struct dst_entry * dst) |
148 | { | 155 | { |
diff --git a/include/net/esp.h b/include/net/esp.h index c1bc529809da..c05f529bff28 100644 --- a/include/net/esp.h +++ b/include/net/esp.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/crypto.h> | 4 | #include <linux/crypto.h> |
5 | #include <net/xfrm.h> | 5 | #include <net/xfrm.h> |
6 | #include <asm/scatterlist.h> | 6 | #include <linux/scatterlist.h> |
7 | 7 | ||
8 | #define ESP_NUM_FAST_SG 4 | 8 | #define ESP_NUM_FAST_SG 4 |
9 | 9 | ||
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index 017aebd90683..41a301e38643 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h | |||
@@ -107,4 +107,7 @@ extern int fib_rules_unregister(struct fib_rules_ops *); | |||
107 | extern int fib_rules_lookup(struct fib_rules_ops *, | 107 | extern int fib_rules_lookup(struct fib_rules_ops *, |
108 | struct flowi *, int flags, | 108 | struct flowi *, int flags, |
109 | struct fib_lookup_arg *); | 109 | struct fib_lookup_arg *); |
110 | extern int fib_default_rule_add(struct fib_rules_ops *, | ||
111 | u32 pref, u32 table, | ||
112 | u32 flags); | ||
110 | #endif | 113 | #endif |
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index 164d13211165..d8ae48439f12 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -115,8 +115,16 @@ extern u32 ieee80211_debug_level; | |||
115 | do { if (ieee80211_debug_level & (level)) \ | 115 | do { if (ieee80211_debug_level & (level)) \ |
116 | printk(KERN_DEBUG "ieee80211: %c %s " fmt, \ | 116 | printk(KERN_DEBUG "ieee80211: %c %s " fmt, \ |
117 | in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) | 117 | in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) |
118 | static inline bool ieee80211_ratelimit_debug(u32 level) | ||
119 | { | ||
120 | return (ieee80211_debug_level & level) && net_ratelimit(); | ||
121 | } | ||
118 | #else | 122 | #else |
119 | #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) | 123 | #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) |
124 | static inline bool ieee80211_ratelimit_debug(u32 level) | ||
125 | { | ||
126 | return false; | ||
127 | } | ||
120 | #endif /* CONFIG_IEEE80211_DEBUG */ | 128 | #endif /* CONFIG_IEEE80211_DEBUG */ |
121 | 129 | ||
122 | /* escape_essid() is intended to be used in debug (and possibly error) | 130 | /* escape_essid() is intended to be used in debug (and possibly error) |
diff --git a/include/net/inet_common.h b/include/net/inet_common.h index 227adcbdfec8..38d5a1e9980d 100644 --- a/include/net/inet_common.h +++ b/include/net/inet_common.h | |||
@@ -13,9 +13,6 @@ struct sock; | |||
13 | struct sockaddr; | 13 | struct sockaddr; |
14 | struct socket; | 14 | struct socket; |
15 | 15 | ||
16 | extern void inet_remove_sock(struct sock *sk1); | ||
17 | extern void inet_put_sock(unsigned short num, | ||
18 | struct sock *sk); | ||
19 | extern int inet_release(struct socket *sock); | 16 | extern int inet_release(struct socket *sock); |
20 | extern int inet_stream_connect(struct socket *sock, | 17 | extern int inet_stream_connect(struct socket *sock, |
21 | struct sockaddr * uaddr, | 18 | struct sockaddr * uaddr, |
@@ -30,7 +27,6 @@ extern int inet_sendmsg(struct kiocb *iocb, | |||
30 | struct msghdr *msg, | 27 | struct msghdr *msg, |
31 | size_t size); | 28 | size_t size); |
32 | extern int inet_shutdown(struct socket *sock, int how); | 29 | extern int inet_shutdown(struct socket *sock, int how); |
33 | extern unsigned int inet_poll(struct file * file, struct socket *sock, struct poll_table_struct *wait); | ||
34 | extern int inet_listen(struct socket *sock, int backlog); | 30 | extern int inet_listen(struct socket *sock, int backlog); |
35 | 31 | ||
36 | extern void inet_sock_destruct(struct sock *sk); | 32 | extern void inet_sock_destruct(struct sock *sk); |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 4427dcd1e53a..37f6cb112127 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
25 | #include <linux/wait.h> | 25 | #include <linux/wait.h> |
26 | #include <linux/vmalloc.h> | ||
26 | 27 | ||
27 | #include <net/inet_connection_sock.h> | 28 | #include <net/inet_connection_sock.h> |
28 | #include <net/inet_sock.h> | 29 | #include <net/inet_sock.h> |
@@ -37,7 +38,6 @@ | |||
37 | * I'll experiment with dynamic table growth later. | 38 | * I'll experiment with dynamic table growth later. |
38 | */ | 39 | */ |
39 | struct inet_ehash_bucket { | 40 | struct inet_ehash_bucket { |
40 | rwlock_t lock; | ||
41 | struct hlist_head chain; | 41 | struct hlist_head chain; |
42 | struct hlist_head twchain; | 42 | struct hlist_head twchain; |
43 | }; | 43 | }; |
@@ -100,6 +100,9 @@ struct inet_hashinfo { | |||
100 | * TIME_WAIT sockets use a separate chain (twchain). | 100 | * TIME_WAIT sockets use a separate chain (twchain). |
101 | */ | 101 | */ |
102 | struct inet_ehash_bucket *ehash; | 102 | struct inet_ehash_bucket *ehash; |
103 | rwlock_t *ehash_locks; | ||
104 | unsigned int ehash_size; | ||
105 | unsigned int ehash_locks_mask; | ||
103 | 106 | ||
104 | /* Ok, let's try this, I give up, we do need a local binding | 107 | /* Ok, let's try this, I give up, we do need a local binding |
105 | * TCP hash as well as the others for fast bind/connect. | 108 | * TCP hash as well as the others for fast bind/connect. |
@@ -107,7 +110,7 @@ struct inet_hashinfo { | |||
107 | struct inet_bind_hashbucket *bhash; | 110 | struct inet_bind_hashbucket *bhash; |
108 | 111 | ||
109 | unsigned int bhash_size; | 112 | unsigned int bhash_size; |
110 | unsigned int ehash_size; | 113 | /* Note : 4 bytes padding on 64 bit arches */ |
111 | 114 | ||
112 | /* All sockets in TCP_LISTEN state will be in here. This is the only | 115 | /* All sockets in TCP_LISTEN state will be in here. This is the only |
113 | * table where wildcard'd TCP sockets can exist. Hash function here | 116 | * table where wildcard'd TCP sockets can exist. Hash function here |
@@ -134,6 +137,61 @@ static inline struct inet_ehash_bucket *inet_ehash_bucket( | |||
134 | return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)]; | 137 | return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)]; |
135 | } | 138 | } |
136 | 139 | ||
140 | static inline rwlock_t *inet_ehash_lockp( | ||
141 | struct inet_hashinfo *hashinfo, | ||
142 | unsigned int hash) | ||
143 | { | ||
144 | return &hashinfo->ehash_locks[hash & hashinfo->ehash_locks_mask]; | ||
145 | } | ||
146 | |||
147 | static inline int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo) | ||
148 | { | ||
149 | unsigned int i, size = 256; | ||
150 | #if defined(CONFIG_PROVE_LOCKING) | ||
151 | unsigned int nr_pcpus = 2; | ||
152 | #else | ||
153 | unsigned int nr_pcpus = num_possible_cpus(); | ||
154 | #endif | ||
155 | if (nr_pcpus >= 4) | ||
156 | size = 512; | ||
157 | if (nr_pcpus >= 8) | ||
158 | size = 1024; | ||
159 | if (nr_pcpus >= 16) | ||
160 | size = 2048; | ||
161 | if (nr_pcpus >= 32) | ||
162 | size = 4096; | ||
163 | if (sizeof(rwlock_t) != 0) { | ||
164 | #ifdef CONFIG_NUMA | ||
165 | if (size * sizeof(rwlock_t) > PAGE_SIZE) | ||
166 | hashinfo->ehash_locks = vmalloc(size * sizeof(rwlock_t)); | ||
167 | else | ||
168 | #endif | ||
169 | hashinfo->ehash_locks = kmalloc(size * sizeof(rwlock_t), | ||
170 | GFP_KERNEL); | ||
171 | if (!hashinfo->ehash_locks) | ||
172 | return ENOMEM; | ||
173 | for (i = 0; i < size; i++) | ||
174 | rwlock_init(&hashinfo->ehash_locks[i]); | ||
175 | } | ||
176 | hashinfo->ehash_locks_mask = size - 1; | ||
177 | return 0; | ||
178 | } | ||
179 | |||
180 | static inline void inet_ehash_locks_free(struct inet_hashinfo *hashinfo) | ||
181 | { | ||
182 | if (hashinfo->ehash_locks) { | ||
183 | #ifdef CONFIG_NUMA | ||
184 | unsigned int size = (hashinfo->ehash_locks_mask + 1) * | ||
185 | sizeof(rwlock_t); | ||
186 | if (size > PAGE_SIZE) | ||
187 | vfree(hashinfo->ehash_locks); | ||
188 | else | ||
189 | #endif | ||
190 | kfree(hashinfo->ehash_locks); | ||
191 | hashinfo->ehash_locks = NULL; | ||
192 | } | ||
193 | } | ||
194 | |||
137 | extern struct inet_bind_bucket * | 195 | extern struct inet_bind_bucket * |
138 | inet_bind_bucket_create(struct kmem_cache *cachep, | 196 | inet_bind_bucket_create(struct kmem_cache *cachep, |
139 | struct inet_bind_hashbucket *head, | 197 | struct inet_bind_hashbucket *head, |
@@ -222,7 +280,7 @@ static inline void __inet_hash(struct inet_hashinfo *hashinfo, | |||
222 | sk->sk_hash = inet_sk_ehashfn(sk); | 280 | sk->sk_hash = inet_sk_ehashfn(sk); |
223 | head = inet_ehash_bucket(hashinfo, sk->sk_hash); | 281 | head = inet_ehash_bucket(hashinfo, sk->sk_hash); |
224 | list = &head->chain; | 282 | list = &head->chain; |
225 | lock = &head->lock; | 283 | lock = inet_ehash_lockp(hashinfo, sk->sk_hash); |
226 | write_lock(lock); | 284 | write_lock(lock); |
227 | } | 285 | } |
228 | __sk_add_node(sk, list); | 286 | __sk_add_node(sk, list); |
@@ -253,7 +311,7 @@ static inline void inet_unhash(struct inet_hashinfo *hashinfo, struct sock *sk) | |||
253 | inet_listen_wlock(hashinfo); | 311 | inet_listen_wlock(hashinfo); |
254 | lock = &hashinfo->lhash_lock; | 312 | lock = &hashinfo->lhash_lock; |
255 | } else { | 313 | } else { |
256 | lock = &inet_ehash_bucket(hashinfo, sk->sk_hash)->lock; | 314 | lock = inet_ehash_lockp(hashinfo, sk->sk_hash); |
257 | write_lock_bh(lock); | 315 | write_lock_bh(lock); |
258 | } | 316 | } |
259 | 317 | ||
@@ -354,9 +412,10 @@ static inline struct sock * | |||
354 | */ | 412 | */ |
355 | unsigned int hash = inet_ehashfn(daddr, hnum, saddr, sport); | 413 | unsigned int hash = inet_ehashfn(daddr, hnum, saddr, sport); |
356 | struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); | 414 | struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); |
415 | rwlock_t *lock = inet_ehash_lockp(hashinfo, hash); | ||
357 | 416 | ||
358 | prefetch(head->chain.first); | 417 | prefetch(head->chain.first); |
359 | read_lock(&head->lock); | 418 | read_lock(lock); |
360 | sk_for_each(sk, node, &head->chain) { | 419 | sk_for_each(sk, node, &head->chain) { |
361 | if (INET_MATCH(sk, hash, acookie, saddr, daddr, ports, dif)) | 420 | if (INET_MATCH(sk, hash, acookie, saddr, daddr, ports, dif)) |
362 | goto hit; /* You sunk my battleship! */ | 421 | goto hit; /* You sunk my battleship! */ |
@@ -369,7 +428,7 @@ static inline struct sock * | |||
369 | } | 428 | } |
370 | sk = NULL; | 429 | sk = NULL; |
371 | out: | 430 | out: |
372 | read_unlock(&head->lock); | 431 | read_unlock(lock); |
373 | return sk; | 432 | return sk; |
374 | hit: | 433 | hit: |
375 | sock_hold(sk); | 434 | sock_hold(sk); |
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index aa10a8178e70..ad8404b56113 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
@@ -22,7 +22,7 @@ struct inet_peer | |||
22 | __be32 v4daddr; /* peer's address */ | 22 | __be32 v4daddr; /* peer's address */ |
23 | __u16 avl_height; | 23 | __u16 avl_height; |
24 | __u16 ip_id_count; /* IP ID for the next packet */ | 24 | __u16 ip_id_count; /* IP ID for the next packet */ |
25 | struct inet_peer *unused_next, **unused_prevp; | 25 | struct list_head unused; |
26 | __u32 dtime; /* the time of last use of not | 26 | __u32 dtime; /* the time of last use of not |
27 | * referenced entries */ | 27 | * referenced entries */ |
28 | atomic_t refcnt; | 28 | atomic_t refcnt; |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 8cadc77c7df4..ed514bfb61ba 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -185,6 +185,12 @@ static inline void fib_select_default(const struct flowi *flp, struct fib_result | |||
185 | } | 185 | } |
186 | 186 | ||
187 | #else /* CONFIG_IP_MULTIPLE_TABLES */ | 187 | #else /* CONFIG_IP_MULTIPLE_TABLES */ |
188 | extern void __init fib4_rules_init(void); | ||
189 | |||
190 | #ifdef CONFIG_NET_CLS_ROUTE | ||
191 | extern u32 fib_rules_tclass(struct fib_result *res); | ||
192 | #endif | ||
193 | |||
188 | #define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL) | 194 | #define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL) |
189 | #define ip_fib_main_table fib_get_table(RT_TABLE_MAIN) | 195 | #define ip_fib_main_table fib_get_table(RT_TABLE_MAIN) |
190 | 196 | ||
@@ -214,15 +220,6 @@ extern __be32 __fib_res_prefsrc(struct fib_result *res); | |||
214 | /* Exported by fib_hash.c */ | 220 | /* Exported by fib_hash.c */ |
215 | extern struct fib_table *fib_hash_init(u32 id); | 221 | extern struct fib_table *fib_hash_init(u32 id); |
216 | 222 | ||
217 | #ifdef CONFIG_IP_MULTIPLE_TABLES | ||
218 | extern void __init fib4_rules_init(void); | ||
219 | |||
220 | #ifdef CONFIG_NET_CLS_ROUTE | ||
221 | extern u32 fib_rules_tclass(struct fib_result *res); | ||
222 | #endif | ||
223 | |||
224 | #endif | ||
225 | |||
226 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) | 223 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) |
227 | { | 224 | { |
228 | #ifdef CONFIG_NET_CLS_ROUTE | 225 | #ifdef CONFIG_NET_CLS_ROUTE |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 41870564df8e..8a7d59be8a0d 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -328,40 +328,6 @@ extern int ip_vs_get_debug_level(void); | |||
328 | #define FTPDATA __constant_htons(20) | 328 | #define FTPDATA __constant_htons(20) |
329 | 329 | ||
330 | /* | 330 | /* |
331 | * IPVS sysctl variables under the /proc/sys/net/ipv4/vs/ | ||
332 | */ | ||
333 | #define NET_IPV4_VS 21 | ||
334 | |||
335 | enum { | ||
336 | NET_IPV4_VS_DEBUG_LEVEL=1, | ||
337 | NET_IPV4_VS_AMEMTHRESH=2, | ||
338 | NET_IPV4_VS_AMDROPRATE=3, | ||
339 | NET_IPV4_VS_DROP_ENTRY=4, | ||
340 | NET_IPV4_VS_DROP_PACKET=5, | ||
341 | NET_IPV4_VS_SECURE_TCP=6, | ||
342 | NET_IPV4_VS_TO_ES=7, | ||
343 | NET_IPV4_VS_TO_SS=8, | ||
344 | NET_IPV4_VS_TO_SR=9, | ||
345 | NET_IPV4_VS_TO_FW=10, | ||
346 | NET_IPV4_VS_TO_TW=11, | ||
347 | NET_IPV4_VS_TO_CL=12, | ||
348 | NET_IPV4_VS_TO_CW=13, | ||
349 | NET_IPV4_VS_TO_LA=14, | ||
350 | NET_IPV4_VS_TO_LI=15, | ||
351 | NET_IPV4_VS_TO_SA=16, | ||
352 | NET_IPV4_VS_TO_UDP=17, | ||
353 | NET_IPV4_VS_TO_ICMP=18, | ||
354 | NET_IPV4_VS_LBLC_EXPIRE=19, | ||
355 | NET_IPV4_VS_LBLCR_EXPIRE=20, | ||
356 | NET_IPV4_VS_CACHE_BYPASS=22, | ||
357 | NET_IPV4_VS_EXPIRE_NODEST_CONN=23, | ||
358 | NET_IPV4_VS_SYNC_THRESHOLD=24, | ||
359 | NET_IPV4_VS_NAT_ICMP_SEND=25, | ||
360 | NET_IPV4_VS_EXPIRE_QUIESCENT_TEMPLATE=26, | ||
361 | NET_IPV4_VS_LAST | ||
362 | }; | ||
363 | |||
364 | /* | ||
365 | * TCP State Values | 331 | * TCP State Values |
366 | */ | 332 | */ |
367 | enum { | 333 | enum { |
@@ -520,6 +486,10 @@ struct ip_vs_conn { | |||
520 | spinlock_t lock; /* lock for state transition */ | 486 | spinlock_t lock; /* lock for state transition */ |
521 | volatile __u16 flags; /* status flags */ | 487 | volatile __u16 flags; /* status flags */ |
522 | volatile __u16 state; /* state info */ | 488 | volatile __u16 state; /* state info */ |
489 | volatile __u16 old_state; /* old state, to be used for | ||
490 | * state transition triggerd | ||
491 | * synchronization | ||
492 | */ | ||
523 | 493 | ||
524 | /* Control members */ | 494 | /* Control members */ |
525 | struct ip_vs_conn *control; /* Master control connection */ | 495 | struct ip_vs_conn *control; /* Master control connection */ |
@@ -901,6 +871,10 @@ extern int ip_vs_use_count_inc(void); | |||
901 | extern void ip_vs_use_count_dec(void); | 871 | extern void ip_vs_use_count_dec(void); |
902 | extern int ip_vs_control_init(void); | 872 | extern int ip_vs_control_init(void); |
903 | extern void ip_vs_control_cleanup(void); | 873 | extern void ip_vs_control_cleanup(void); |
874 | extern struct ip_vs_dest * | ||
875 | ip_vs_find_dest(__be32 daddr, __be16 dport, | ||
876 | __be32 vaddr, __be16 vport, __u16 protocol); | ||
877 | extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); | ||
904 | 878 | ||
905 | 879 | ||
906 | /* | 880 | /* |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 5fcc4c104340..17b60391fcd6 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -706,11 +706,16 @@ enum ieee80211_hw_flags { | |||
706 | * | 706 | * |
707 | * @queues: number of available hardware transmit queues for | 707 | * @queues: number of available hardware transmit queues for |
708 | * data packets. WMM/QoS requires at least four. | 708 | * data packets. WMM/QoS requires at least four. |
709 | * | ||
710 | * @rate_control_algorithm: rate control algorithm for this hardware. | ||
711 | * If unset (NULL), the default algorithm will be used. Must be | ||
712 | * set before calling ieee80211_register_hw(). | ||
709 | */ | 713 | */ |
710 | struct ieee80211_hw { | 714 | struct ieee80211_hw { |
711 | struct ieee80211_conf conf; | 715 | struct ieee80211_conf conf; |
712 | struct wiphy *wiphy; | 716 | struct wiphy *wiphy; |
713 | struct workqueue_struct *workqueue; | 717 | struct workqueue_struct *workqueue; |
718 | const char *rate_control_algorithm; | ||
714 | void *priv; | 719 | void *priv; |
715 | u32 flags; | 720 | u32 flags; |
716 | unsigned int extra_tx_headroom; | 721 | unsigned int extra_tx_headroom; |
@@ -936,27 +941,11 @@ enum ieee80211_erp_change_flags { | |||
936 | * and remove_interface calls, i.e. while the interface with the | 941 | * and remove_interface calls, i.e. while the interface with the |
937 | * given local_address is enabled. | 942 | * given local_address is enabled. |
938 | * | 943 | * |
939 | * @set_ieee8021x: Enable/disable IEEE 802.1X. This item requests wlan card | ||
940 | * to pass unencrypted EAPOL-Key frames even when encryption is | ||
941 | * configured. If the wlan card does not require such a configuration, | ||
942 | * this function pointer can be set to NULL. | ||
943 | * | ||
944 | * @set_port_auth: Set port authorization state (IEEE 802.1X PAE) to be | ||
945 | * authorized (@authorized=1) or unauthorized (=0). This function can be | ||
946 | * used if the wlan hardware or low-level driver implements PAE. | ||
947 | * mac80211 will filter frames based on authorization state in any case, | ||
948 | * so this function pointer can be NULL if low-level driver does not | ||
949 | * require event notification about port state changes. | ||
950 | * | ||
951 | * @hw_scan: Ask the hardware to service the scan request, no need to start | 944 | * @hw_scan: Ask the hardware to service the scan request, no need to start |
952 | * the scan state machine in stack. | 945 | * the scan state machine in stack. |
953 | * | 946 | * |
954 | * @get_stats: return low-level statistics | 947 | * @get_stats: return low-level statistics |
955 | * | 948 | * |
956 | * @set_privacy_invoked: For devices that generate their own beacons and probe | ||
957 | * response or association responses this updates the state of privacy_invoked | ||
958 | * returns 0 for success or an error number. | ||
959 | * | ||
960 | * @get_sequence_counter: For devices that have internal sequence counters this | 949 | * @get_sequence_counter: For devices that have internal sequence counters this |
961 | * callback allows mac80211 to access the current value of a counter. | 950 | * callback allows mac80211 to access the current value of a counter. |
962 | * This callback seems not well-defined, tell us if you need it. | 951 | * This callback seems not well-defined, tell us if you need it. |
@@ -1029,14 +1018,9 @@ struct ieee80211_ops { | |||
1029 | int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, | 1018 | int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
1030 | const u8 *local_address, const u8 *address, | 1019 | const u8 *local_address, const u8 *address, |
1031 | struct ieee80211_key_conf *key); | 1020 | struct ieee80211_key_conf *key); |
1032 | int (*set_ieee8021x)(struct ieee80211_hw *hw, int use_ieee8021x); | ||
1033 | int (*set_port_auth)(struct ieee80211_hw *hw, u8 *addr, | ||
1034 | int authorized); | ||
1035 | int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); | 1021 | int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); |
1036 | int (*get_stats)(struct ieee80211_hw *hw, | 1022 | int (*get_stats)(struct ieee80211_hw *hw, |
1037 | struct ieee80211_low_level_stats *stats); | 1023 | struct ieee80211_low_level_stats *stats); |
1038 | int (*set_privacy_invoked)(struct ieee80211_hw *hw, | ||
1039 | int privacy_invoked); | ||
1040 | int (*get_sequence_counter)(struct ieee80211_hw *hw, | 1024 | int (*get_sequence_counter)(struct ieee80211_hw *hw, |
1041 | u8* addr, u8 keyidx, u8 txrx, | 1025 | u8* addr, u8 keyidx, u8 txrx, |
1042 | u32* iv32, u16* iv16); | 1026 | u32* iv32, u16* iv16); |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 5279466606d2..5dd6d90b37eb 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -51,13 +51,12 @@ static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns) | |||
51 | } | 51 | } |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | #ifdef CONFIG_NET_NS | ||
54 | extern void __put_net(struct net *net); | 55 | extern void __put_net(struct net *net); |
55 | 56 | ||
56 | static inline struct net *get_net(struct net *net) | 57 | static inline struct net *get_net(struct net *net) |
57 | { | 58 | { |
58 | #ifdef CONFIG_NET | ||
59 | atomic_inc(&net->count); | 59 | atomic_inc(&net->count); |
60 | #endif | ||
61 | return net; | 60 | return net; |
62 | } | 61 | } |
63 | 62 | ||
@@ -75,26 +74,44 @@ static inline struct net *maybe_get_net(struct net *net) | |||
75 | 74 | ||
76 | static inline void put_net(struct net *net) | 75 | static inline void put_net(struct net *net) |
77 | { | 76 | { |
78 | #ifdef CONFIG_NET | ||
79 | if (atomic_dec_and_test(&net->count)) | 77 | if (atomic_dec_and_test(&net->count)) |
80 | __put_net(net); | 78 | __put_net(net); |
81 | #endif | ||
82 | } | 79 | } |
83 | 80 | ||
84 | static inline struct net *hold_net(struct net *net) | 81 | static inline struct net *hold_net(struct net *net) |
85 | { | 82 | { |
86 | #ifdef CONFIG_NET | ||
87 | atomic_inc(&net->use_count); | 83 | atomic_inc(&net->use_count); |
88 | #endif | ||
89 | return net; | 84 | return net; |
90 | } | 85 | } |
91 | 86 | ||
92 | static inline void release_net(struct net *net) | 87 | static inline void release_net(struct net *net) |
93 | { | 88 | { |
94 | #ifdef CONFIG_NET | ||
95 | atomic_dec(&net->use_count); | 89 | atomic_dec(&net->use_count); |
96 | #endif | ||
97 | } | 90 | } |
91 | #else | ||
92 | static inline struct net *get_net(struct net *net) | ||
93 | { | ||
94 | return net; | ||
95 | } | ||
96 | |||
97 | static inline void put_net(struct net *net) | ||
98 | { | ||
99 | } | ||
100 | |||
101 | static inline struct net *hold_net(struct net *net) | ||
102 | { | ||
103 | return net; | ||
104 | } | ||
105 | |||
106 | static inline void release_net(struct net *net) | ||
107 | { | ||
108 | } | ||
109 | |||
110 | static inline struct net *maybe_get_net(struct net *net) | ||
111 | { | ||
112 | return net; | ||
113 | } | ||
114 | #endif | ||
98 | 115 | ||
99 | #define for_each_net(VAR) \ | 116 | #define for_each_net(VAR) \ |
100 | list_for_each_entry(VAR, &net_namespace_list, list) | 117 | list_for_each_entry(VAR, &net_namespace_list, list) |
@@ -102,9 +119,11 @@ static inline void release_net(struct net *net) | |||
102 | #ifdef CONFIG_NET_NS | 119 | #ifdef CONFIG_NET_NS |
103 | #define __net_init | 120 | #define __net_init |
104 | #define __net_exit | 121 | #define __net_exit |
122 | #define __net_initdata | ||
105 | #else | 123 | #else |
106 | #define __net_init __init | 124 | #define __net_init __init |
107 | #define __net_exit __exit_refok | 125 | #define __net_exit __exit_refok |
126 | #define __net_initdata __initdata | ||
108 | #endif | 127 | #endif |
109 | 128 | ||
110 | struct pernet_operations { | 129 | struct pernet_operations { |
diff --git a/include/net/request_sock.h b/include/net/request_sock.h index 7aed02ce2b65..cff4608179c1 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h | |||
@@ -124,23 +124,7 @@ struct request_sock_queue { | |||
124 | extern int reqsk_queue_alloc(struct request_sock_queue *queue, | 124 | extern int reqsk_queue_alloc(struct request_sock_queue *queue, |
125 | unsigned int nr_table_entries); | 125 | unsigned int nr_table_entries); |
126 | 126 | ||
127 | static inline struct listen_sock *reqsk_queue_yank_listen_sk(struct request_sock_queue *queue) | 127 | extern void __reqsk_queue_destroy(struct request_sock_queue *queue); |
128 | { | ||
129 | struct listen_sock *lopt; | ||
130 | |||
131 | write_lock_bh(&queue->syn_wait_lock); | ||
132 | lopt = queue->listen_opt; | ||
133 | queue->listen_opt = NULL; | ||
134 | write_unlock_bh(&queue->syn_wait_lock); | ||
135 | |||
136 | return lopt; | ||
137 | } | ||
138 | |||
139 | static inline void __reqsk_queue_destroy(struct request_sock_queue *queue) | ||
140 | { | ||
141 | kfree(reqsk_queue_yank_listen_sk(queue)); | ||
142 | } | ||
143 | |||
144 | extern void reqsk_queue_destroy(struct request_sock_queue *queue); | 128 | extern void reqsk_queue_destroy(struct request_sock_queue *queue); |
145 | 129 | ||
146 | static inline struct request_sock * | 130 | static inline struct request_sock * |
diff --git a/include/net/sctp/auth.h b/include/net/sctp/auth.h index 9e8f13b7da5a..5db261a1e85e 100644 --- a/include/net/sctp/auth.h +++ b/include/net/sctp/auth.h | |||
@@ -103,7 +103,7 @@ struct sctp_hmac *sctp_auth_asoc_get_hmac(const struct sctp_association *asoc); | |||
103 | void sctp_auth_asoc_set_default_hmac(struct sctp_association *asoc, | 103 | void sctp_auth_asoc_set_default_hmac(struct sctp_association *asoc, |
104 | struct sctp_hmac_algo_param *hmacs); | 104 | struct sctp_hmac_algo_param *hmacs); |
105 | int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc, | 105 | int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc, |
106 | __u16 hmac_id); | 106 | __be16 hmac_id); |
107 | int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc); | 107 | int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc); |
108 | int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc); | 108 | int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc); |
109 | void sctp_auth_calculate_hmac(const struct sctp_association *asoc, | 109 | void sctp_auth_calculate_hmac(const struct sctp_association *asoc, |
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h index b8733364557f..c1f797673571 100644 --- a/include/net/sctp/command.h +++ b/include/net/sctp/command.h | |||
@@ -103,6 +103,7 @@ typedef enum { | |||
103 | SCTP_CMD_ASSOC_CHANGE, /* generate and send assoc_change event */ | 103 | SCTP_CMD_ASSOC_CHANGE, /* generate and send assoc_change event */ |
104 | SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */ | 104 | SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */ |
105 | SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */ | 105 | SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */ |
106 | SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */ | ||
106 | SCTP_CMD_LAST | 107 | SCTP_CMD_LAST |
107 | } sctp_verb_t; | 108 | } sctp_verb_t; |
108 | 109 | ||
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index da8354e8e33c..f30b537d6952 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h | |||
@@ -186,6 +186,8 @@ typedef enum { | |||
186 | SCTP_IERROR_AUTH_BAD_HMAC, | 186 | SCTP_IERROR_AUTH_BAD_HMAC, |
187 | SCTP_IERROR_AUTH_BAD_KEYID, | 187 | SCTP_IERROR_AUTH_BAD_KEYID, |
188 | SCTP_IERROR_PROTO_VIOLATION, | 188 | SCTP_IERROR_PROTO_VIOLATION, |
189 | SCTP_IERROR_ERROR, | ||
190 | SCTP_IERROR_ABORT, | ||
189 | } sctp_ierror_t; | 191 | } sctp_ierror_t; |
190 | 192 | ||
191 | 193 | ||
@@ -407,6 +409,7 @@ typedef enum { | |||
407 | SCTP_RTXR_T3_RTX, | 409 | SCTP_RTXR_T3_RTX, |
408 | SCTP_RTXR_FAST_RTX, | 410 | SCTP_RTXR_FAST_RTX, |
409 | SCTP_RTXR_PMTUD, | 411 | SCTP_RTXR_PMTUD, |
412 | SCTP_RTXR_T1_RTX, | ||
410 | } sctp_retransmit_reason_t; | 413 | } sctp_retransmit_reason_t; |
411 | 414 | ||
412 | /* Reasons to lower cwnd. */ | 415 | /* Reasons to lower cwnd. */ |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 93eb708609e7..34318a33a94c 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -65,7 +65,6 @@ | |||
65 | 65 | ||
66 | 66 | ||
67 | #ifdef TEST_FRAME | 67 | #ifdef TEST_FRAME |
68 | #undef CONFIG_PROC_FS | ||
69 | #undef CONFIG_SCTP_DBG_OBJCNT | 68 | #undef CONFIG_SCTP_DBG_OBJCNT |
70 | #undef CONFIG_SYSCTL | 69 | #undef CONFIG_SYSCTL |
71 | #endif /* TEST_FRAME */ | 70 | #endif /* TEST_FRAME */ |
@@ -267,6 +266,7 @@ enum | |||
267 | SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS, | 266 | SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS, |
268 | SCTP_MIB_DELAY_SACK_EXPIREDS, | 267 | SCTP_MIB_DELAY_SACK_EXPIREDS, |
269 | SCTP_MIB_AUTOCLOSE_EXPIREDS, | 268 | SCTP_MIB_AUTOCLOSE_EXPIREDS, |
269 | SCTP_MIB_T1_RETRANSMITS, | ||
270 | SCTP_MIB_T3_RETRANSMITS, | 270 | SCTP_MIB_T3_RETRANSMITS, |
271 | SCTP_MIB_PMTUD_RETRANSMITS, | 271 | SCTP_MIB_PMTUD_RETRANSMITS, |
272 | SCTP_MIB_FAST_RETRANSMITS, | 272 | SCTP_MIB_FAST_RETRANSMITS, |
@@ -664,6 +664,9 @@ static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag) | |||
664 | return (h & (sctp_assoc_hashsize-1)); | 664 | return (h & (sctp_assoc_hashsize-1)); |
665 | } | 665 | } |
666 | 666 | ||
667 | #define sctp_for_each_hentry(epb, node, head) \ | ||
668 | hlist_for_each_entry(epb, node, head, node) | ||
669 | |||
667 | /* Is a socket of this style? */ | 670 | /* Is a socket of this style? */ |
668 | #define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style)) | 671 | #define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style)) |
669 | static inline int __sctp_style(const struct sock *sk, sctp_socket_type_t style) | 672 | static inline int __sctp_style(const struct sock *sk, sctp_socket_type_t style) |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index ef892e00c833..eb3113c38a94 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -100,20 +100,19 @@ struct crypto_hash; | |||
100 | struct sctp_bind_bucket { | 100 | struct sctp_bind_bucket { |
101 | unsigned short port; | 101 | unsigned short port; |
102 | unsigned short fastreuse; | 102 | unsigned short fastreuse; |
103 | struct sctp_bind_bucket *next; | 103 | struct hlist_node node; |
104 | struct sctp_bind_bucket **pprev; | ||
105 | struct hlist_head owner; | 104 | struct hlist_head owner; |
106 | }; | 105 | }; |
107 | 106 | ||
108 | struct sctp_bind_hashbucket { | 107 | struct sctp_bind_hashbucket { |
109 | spinlock_t lock; | 108 | spinlock_t lock; |
110 | struct sctp_bind_bucket *chain; | 109 | struct hlist_head chain; |
111 | }; | 110 | }; |
112 | 111 | ||
113 | /* Used for hashing all associations. */ | 112 | /* Used for hashing all associations. */ |
114 | struct sctp_hashbucket { | 113 | struct sctp_hashbucket { |
115 | rwlock_t lock; | 114 | rwlock_t lock; |
116 | struct sctp_ep_common *chain; | 115 | struct hlist_head chain; |
117 | } __attribute__((__aligned__(8))); | 116 | } __attribute__((__aligned__(8))); |
118 | 117 | ||
119 | 118 | ||
@@ -212,6 +211,7 @@ extern struct sctp_globals { | |||
212 | 211 | ||
213 | /* Flag to indicate if addip is enabled. */ | 212 | /* Flag to indicate if addip is enabled. */ |
214 | int addip_enable; | 213 | int addip_enable; |
214 | int addip_noauth_enable; | ||
215 | 215 | ||
216 | /* Flag to indicate if PR-SCTP is enabled. */ | 216 | /* Flag to indicate if PR-SCTP is enabled. */ |
217 | int prsctp_enable; | 217 | int prsctp_enable; |
@@ -249,6 +249,7 @@ extern struct sctp_globals { | |||
249 | #define sctp_local_addr_list (sctp_globals.local_addr_list) | 249 | #define sctp_local_addr_list (sctp_globals.local_addr_list) |
250 | #define sctp_local_addr_lock (sctp_globals.addr_list_lock) | 250 | #define sctp_local_addr_lock (sctp_globals.addr_list_lock) |
251 | #define sctp_addip_enable (sctp_globals.addip_enable) | 251 | #define sctp_addip_enable (sctp_globals.addip_enable) |
252 | #define sctp_addip_noauth (sctp_globals.addip_noauth_enable) | ||
252 | #define sctp_prsctp_enable (sctp_globals.prsctp_enable) | 253 | #define sctp_prsctp_enable (sctp_globals.prsctp_enable) |
253 | #define sctp_auth_enable (sctp_globals.auth_enable) | 254 | #define sctp_auth_enable (sctp_globals.auth_enable) |
254 | 255 | ||
@@ -873,10 +874,11 @@ struct sctp_transport { | |||
873 | * address list derived from the INIT or INIT ACK chunk, a | 874 | * address list derived from the INIT or INIT ACK chunk, a |
874 | * number of data elements needs to be maintained including: | 875 | * number of data elements needs to be maintained including: |
875 | */ | 876 | */ |
876 | __u32 rtt; /* This is the most recent RTT. */ | ||
877 | |||
878 | /* RTO : The current retransmission timeout value. */ | 877 | /* RTO : The current retransmission timeout value. */ |
879 | unsigned long rto; | 878 | unsigned long rto; |
879 | unsigned long last_rto; | ||
880 | |||
881 | __u32 rtt; /* This is the most recent RTT. */ | ||
880 | 882 | ||
881 | /* RTTVAR : The current RTT variation. */ | 883 | /* RTTVAR : The current RTT variation. */ |
882 | __u32 rttvar; | 884 | __u32 rttvar; |
@@ -1184,9 +1186,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest, | |||
1184 | int flags); | 1186 | int flags); |
1185 | int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, | 1187 | int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, |
1186 | __u8 use_as_src, gfp_t gfp); | 1188 | __u8 use_as_src, gfp_t gfp); |
1187 | int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *, | 1189 | int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); |
1188 | void fastcall (*rcu_call)(struct rcu_head *, | ||
1189 | void (*func)(struct rcu_head *))); | ||
1190 | int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, | 1190 | int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, |
1191 | struct sctp_sock *); | 1191 | struct sctp_sock *); |
1192 | union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, | 1192 | union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, |
@@ -1229,8 +1229,7 @@ typedef enum { | |||
1229 | 1229 | ||
1230 | struct sctp_ep_common { | 1230 | struct sctp_ep_common { |
1231 | /* Fields to help us manage our entries in the hash tables. */ | 1231 | /* Fields to help us manage our entries in the hash tables. */ |
1232 | struct sctp_ep_common *next; | 1232 | struct hlist_node node; |
1233 | struct sctp_ep_common **pprev; | ||
1234 | int hashent; | 1233 | int hashent; |
1235 | 1234 | ||
1236 | /* Runtime type information. What kind of endpoint is this? */ | 1235 | /* Runtime type information. What kind of endpoint is this? */ |
@@ -1541,7 +1540,6 @@ struct sctp_association { | |||
1541 | __u8 asconf_capable; /* Does peer support ADDIP? */ | 1540 | __u8 asconf_capable; /* Does peer support ADDIP? */ |
1542 | __u8 prsctp_capable; /* Can peer do PR-SCTP? */ | 1541 | __u8 prsctp_capable; /* Can peer do PR-SCTP? */ |
1543 | __u8 auth_capable; /* Is peer doing SCTP-AUTH? */ | 1542 | __u8 auth_capable; /* Is peer doing SCTP-AUTH? */ |
1544 | __u8 addip_capable; /* Can peer do ADD-IP */ | ||
1545 | 1543 | ||
1546 | __u32 adaptation_ind; /* Adaptation Code point. */ | 1544 | __u32 adaptation_ind; /* Adaptation Code point. */ |
1547 | 1545 | ||
diff --git a/include/net/sock.h b/include/net/sock.h index 43fc3fa50d62..67e35c7e230c 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -560,6 +560,14 @@ struct proto { | |||
560 | void (*unhash)(struct sock *sk); | 560 | void (*unhash)(struct sock *sk); |
561 | int (*get_port)(struct sock *sk, unsigned short snum); | 561 | int (*get_port)(struct sock *sk, unsigned short snum); |
562 | 562 | ||
563 | #ifdef CONFIG_SMP | ||
564 | /* Keeping track of sockets in use */ | ||
565 | void (*inuse_add)(struct proto *prot, int inc); | ||
566 | int (*inuse_getval)(const struct proto *prot); | ||
567 | int *inuse_ptr; | ||
568 | #else | ||
569 | int inuse; | ||
570 | #endif | ||
563 | /* Memory pressure */ | 571 | /* Memory pressure */ |
564 | void (*enter_memory_pressure)(void); | 572 | void (*enter_memory_pressure)(void); |
565 | atomic_t *memory_allocated; /* Current allocated memory. */ | 573 | atomic_t *memory_allocated; /* Current allocated memory. */ |
@@ -592,12 +600,38 @@ struct proto { | |||
592 | #ifdef SOCK_REFCNT_DEBUG | 600 | #ifdef SOCK_REFCNT_DEBUG |
593 | atomic_t socks; | 601 | atomic_t socks; |
594 | #endif | 602 | #endif |
595 | struct { | ||
596 | int inuse; | ||
597 | u8 __pad[SMP_CACHE_BYTES - sizeof(int)]; | ||
598 | } stats[NR_CPUS]; | ||
599 | }; | 603 | }; |
600 | 604 | ||
605 | /* | ||
606 | * Special macros to let protos use a fast version of inuse{get|add} | ||
607 | * using a static percpu variable per proto instead of an allocated one, | ||
608 | * saving one dereference. | ||
609 | * This might be changed if/when dynamic percpu vars become fast. | ||
610 | */ | ||
611 | #ifdef CONFIG_SMP | ||
612 | # define DEFINE_PROTO_INUSE(NAME) \ | ||
613 | static DEFINE_PER_CPU(int, NAME##_inuse); \ | ||
614 | static void NAME##_inuse_add(struct proto *prot, int inc) \ | ||
615 | { \ | ||
616 | __get_cpu_var(NAME##_inuse) += inc; \ | ||
617 | } \ | ||
618 | \ | ||
619 | static int NAME##_inuse_getval(const struct proto *prot)\ | ||
620 | { \ | ||
621 | int res = 0, cpu; \ | ||
622 | \ | ||
623 | for_each_possible_cpu(cpu) \ | ||
624 | res += per_cpu(NAME##_inuse, cpu); \ | ||
625 | return res; \ | ||
626 | } | ||
627 | # define REF_PROTO_INUSE(NAME) \ | ||
628 | .inuse_add = NAME##_inuse_add, \ | ||
629 | .inuse_getval = NAME##_inuse_getval, | ||
630 | #else | ||
631 | # define DEFINE_PROTO_INUSE(NAME) | ||
632 | # define REF_PROTO_INUSE(NAME) | ||
633 | #endif | ||
634 | |||
601 | extern int proto_register(struct proto *prot, int alloc_slab); | 635 | extern int proto_register(struct proto *prot, int alloc_slab); |
602 | extern void proto_unregister(struct proto *prot); | 636 | extern void proto_unregister(struct proto *prot); |
603 | 637 | ||
@@ -629,12 +663,29 @@ static inline void sk_refcnt_debug_release(const struct sock *sk) | |||
629 | /* Called with local bh disabled */ | 663 | /* Called with local bh disabled */ |
630 | static __inline__ void sock_prot_inc_use(struct proto *prot) | 664 | static __inline__ void sock_prot_inc_use(struct proto *prot) |
631 | { | 665 | { |
632 | prot->stats[smp_processor_id()].inuse++; | 666 | #ifdef CONFIG_SMP |
667 | prot->inuse_add(prot, 1); | ||
668 | #else | ||
669 | prot->inuse++; | ||
670 | #endif | ||
633 | } | 671 | } |
634 | 672 | ||
635 | static __inline__ void sock_prot_dec_use(struct proto *prot) | 673 | static __inline__ void sock_prot_dec_use(struct proto *prot) |
636 | { | 674 | { |
637 | prot->stats[smp_processor_id()].inuse--; | 675 | #ifdef CONFIG_SMP |
676 | prot->inuse_add(prot, -1); | ||
677 | #else | ||
678 | prot->inuse--; | ||
679 | #endif | ||
680 | } | ||
681 | |||
682 | static __inline__ int sock_prot_inuse(struct proto *proto) | ||
683 | { | ||
684 | #ifdef CONFIG_SMP | ||
685 | return proto->inuse_getval(proto); | ||
686 | #else | ||
687 | return proto->inuse; | ||
688 | #endif | ||
638 | } | 689 | } |
639 | 690 | ||
640 | /* With per-bucket locks this operation is not-atomic, so that | 691 | /* With per-bucket locks this operation is not-atomic, so that |
@@ -779,7 +830,7 @@ extern void FASTCALL(release_sock(struct sock *sk)); | |||
779 | 830 | ||
780 | extern struct sock *sk_alloc(struct net *net, int family, | 831 | extern struct sock *sk_alloc(struct net *net, int family, |
781 | gfp_t priority, | 832 | gfp_t priority, |
782 | struct proto *prot, int zero_it); | 833 | struct proto *prot); |
783 | extern void sk_free(struct sock *sk); | 834 | extern void sk_free(struct sock *sk); |
784 | extern struct sock *sk_clone(const struct sock *sk, | 835 | extern struct sock *sk_clone(const struct sock *sk, |
785 | const gfp_t priority); | 836 | const gfp_t priority); |
@@ -993,20 +1044,6 @@ static inline void sock_graft(struct sock *sk, struct socket *parent) | |||
993 | write_unlock_bh(&sk->sk_callback_lock); | 1044 | write_unlock_bh(&sk->sk_callback_lock); |
994 | } | 1045 | } |
995 | 1046 | ||
996 | static inline void sock_copy(struct sock *nsk, const struct sock *osk) | ||
997 | { | ||
998 | #ifdef CONFIG_SECURITY_NETWORK | ||
999 | void *sptr = nsk->sk_security; | ||
1000 | #endif | ||
1001 | |||
1002 | memcpy(nsk, osk, osk->sk_prot->obj_size); | ||
1003 | get_net(nsk->sk_net); | ||
1004 | #ifdef CONFIG_SECURITY_NETWORK | ||
1005 | nsk->sk_security = sptr; | ||
1006 | security_sk_clone(osk, nsk); | ||
1007 | #endif | ||
1008 | } | ||
1009 | |||
1010 | extern int sock_i_uid(struct sock *sk); | 1047 | extern int sock_i_uid(struct sock *sk); |
1011 | extern unsigned long sock_i_ino(struct sock *sk); | 1048 | extern unsigned long sock_i_ino(struct sock *sk); |
1012 | 1049 | ||
@@ -1198,14 +1235,19 @@ static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, | |||
1198 | gfp_t gfp) | 1235 | gfp_t gfp) |
1199 | { | 1236 | { |
1200 | struct sk_buff *skb; | 1237 | struct sk_buff *skb; |
1201 | int hdr_len; | ||
1202 | 1238 | ||
1203 | hdr_len = SKB_DATA_ALIGN(sk->sk_prot->max_header); | 1239 | /* The TCP header must be at least 32-bit aligned. */ |
1204 | skb = alloc_skb_fclone(size + hdr_len, gfp); | 1240 | size = ALIGN(size, 4); |
1241 | |||
1242 | skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); | ||
1205 | if (skb) { | 1243 | if (skb) { |
1206 | skb->truesize += mem; | 1244 | skb->truesize += mem; |
1207 | if (sk_stream_wmem_schedule(sk, skb->truesize)) { | 1245 | if (sk_stream_wmem_schedule(sk, skb->truesize)) { |
1208 | skb_reserve(skb, hdr_len); | 1246 | /* |
1247 | * Make sure that we have exactly size bytes | ||
1248 | * available to the caller, no more, no less. | ||
1249 | */ | ||
1250 | skb_reserve(skb, skb_tailroom(skb) - size); | ||
1209 | return skb; | 1251 | return skb; |
1210 | } | 1252 | } |
1211 | __kfree_skb(skb); | 1253 | __kfree_skb(skb); |
diff --git a/include/net/tcp.h b/include/net/tcp.h index d695cea7730d..cb5b033e0e59 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -1288,6 +1288,9 @@ static inline void tcp_insert_write_queue_before(struct sk_buff *new, | |||
1288 | struct sock *sk) | 1288 | struct sock *sk) |
1289 | { | 1289 | { |
1290 | __skb_insert(new, skb->prev, skb, &sk->sk_write_queue); | 1290 | __skb_insert(new, skb->prev, skb, &sk->sk_write_queue); |
1291 | |||
1292 | if (sk->sk_send_head == skb) | ||
1293 | sk->sk_send_head = new; | ||
1291 | } | 1294 | } |
1292 | 1295 | ||
1293 | static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk) | 1296 | static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk) |