diff options
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index c04f9e18ea22..941ad7c830a3 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -229,7 +229,9 @@ struct sock { | |||
229 | } sk_backlog; | 229 | } sk_backlog; |
230 | wait_queue_head_t *sk_sleep; | 230 | wait_queue_head_t *sk_sleep; |
231 | struct dst_entry *sk_dst_cache; | 231 | struct dst_entry *sk_dst_cache; |
232 | #ifdef CONFIG_XFRM | ||
232 | struct xfrm_policy *sk_policy[2]; | 233 | struct xfrm_policy *sk_policy[2]; |
234 | #endif | ||
233 | rwlock_t sk_dst_lock; | 235 | rwlock_t sk_dst_lock; |
234 | atomic_t sk_rmem_alloc; | 236 | atomic_t sk_rmem_alloc; |
235 | atomic_t sk_wmem_alloc; | 237 | atomic_t sk_wmem_alloc; |
@@ -361,6 +363,27 @@ static __inline__ int sk_del_node_init(struct sock *sk) | |||
361 | return rc; | 363 | return rc; |
362 | } | 364 | } |
363 | 365 | ||
366 | static __inline__ int __sk_del_node_init_rcu(struct sock *sk) | ||
367 | { | ||
368 | if (sk_hashed(sk)) { | ||
369 | hlist_del_init_rcu(&sk->sk_node); | ||
370 | return 1; | ||
371 | } | ||
372 | return 0; | ||
373 | } | ||
374 | |||
375 | static __inline__ int sk_del_node_init_rcu(struct sock *sk) | ||
376 | { | ||
377 | int rc = __sk_del_node_init_rcu(sk); | ||
378 | |||
379 | if (rc) { | ||
380 | /* paranoid for a while -acme */ | ||
381 | WARN_ON(atomic_read(&sk->sk_refcnt) == 1); | ||
382 | __sock_put(sk); | ||
383 | } | ||
384 | return rc; | ||
385 | } | ||
386 | |||
364 | static __inline__ void __sk_add_node(struct sock *sk, struct hlist_head *list) | 387 | static __inline__ void __sk_add_node(struct sock *sk, struct hlist_head *list) |
365 | { | 388 | { |
366 | hlist_add_head(&sk->sk_node, list); | 389 | hlist_add_head(&sk->sk_node, list); |
@@ -372,6 +395,17 @@ static __inline__ void sk_add_node(struct sock *sk, struct hlist_head *list) | |||
372 | __sk_add_node(sk, list); | 395 | __sk_add_node(sk, list); |
373 | } | 396 | } |
374 | 397 | ||
398 | static __inline__ void __sk_add_node_rcu(struct sock *sk, struct hlist_head *list) | ||
399 | { | ||
400 | hlist_add_head_rcu(&sk->sk_node, list); | ||
401 | } | ||
402 | |||
403 | static __inline__ void sk_add_node_rcu(struct sock *sk, struct hlist_head *list) | ||
404 | { | ||
405 | sock_hold(sk); | ||
406 | __sk_add_node_rcu(sk, list); | ||
407 | } | ||
408 | |||
375 | static __inline__ void __sk_del_bind_node(struct sock *sk) | 409 | static __inline__ void __sk_del_bind_node(struct sock *sk) |
376 | { | 410 | { |
377 | __hlist_del(&sk->sk_bind_node); | 411 | __hlist_del(&sk->sk_bind_node); |
@@ -385,6 +419,8 @@ static __inline__ void sk_add_bind_node(struct sock *sk, | |||
385 | 419 | ||
386 | #define sk_for_each(__sk, node, list) \ | 420 | #define sk_for_each(__sk, node, list) \ |
387 | hlist_for_each_entry(__sk, node, list, sk_node) | 421 | hlist_for_each_entry(__sk, node, list, sk_node) |
422 | #define sk_for_each_rcu_safenext(__sk, node, list, next) \ | ||
423 | hlist_for_each_entry_rcu_safenext(__sk, node, list, sk_node, next) | ||
388 | #define sk_for_each_from(__sk, node) \ | 424 | #define sk_for_each_from(__sk, node) \ |
389 | if (__sk && ({ node = &(__sk)->sk_node; 1; })) \ | 425 | if (__sk && ({ node = &(__sk)->sk_node; 1; })) \ |
390 | hlist_for_each_entry_from(__sk, node, sk_node) | 426 | hlist_for_each_entry_from(__sk, node, sk_node) |
@@ -587,8 +623,9 @@ struct proto { | |||
587 | int *sysctl_rmem; | 623 | int *sysctl_rmem; |
588 | int max_header; | 624 | int max_header; |
589 | 625 | ||
590 | struct kmem_cache *slab; | 626 | struct kmem_cache *slab; |
591 | unsigned int obj_size; | 627 | unsigned int obj_size; |
628 | int slab_flags; | ||
592 | 629 | ||
593 | atomic_t *orphan_count; | 630 | atomic_t *orphan_count; |
594 | 631 | ||
@@ -597,7 +634,7 @@ struct proto { | |||
597 | 634 | ||
598 | union { | 635 | union { |
599 | struct inet_hashinfo *hashinfo; | 636 | struct inet_hashinfo *hashinfo; |
600 | struct hlist_head *udp_hash; | 637 | struct udp_table *udp_table; |
601 | struct raw_hashinfo *raw_hash; | 638 | struct raw_hashinfo *raw_hash; |
602 | } h; | 639 | } h; |
603 | 640 | ||