diff options
| author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-10-06 20:49:21 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2010-10-06 21:01:33 -0400 |
| commit | 767e97e1e0db0d0f3152cd2f3bd3403596aedbad (patch) | |
| tree | cda6089e75f98fc3c9812993cf790fccac98b67a /include | |
| parent | 546add79468183f266c75c632c96e4b0029e0d96 (diff) | |
neigh: RCU conversion of struct neighbour
This is the second step for neighbour RCU conversion.
(first was commit d6bf7817 : RCU conversion of neigh hash table)
neigh_lookup() becomes lockless, but still take a reference on found
neighbour. (no more read_lock()/read_unlock() on tbl->lock)
struct neighbour gets an additional rcu_head field and is freed after an
RCU grace period.
Future work would need to eventually not take a reference on neighbour
for temporary dst (DST_NOCACHE), but this would need dst->_neighbour to
use a noref bit like we did for skb->_dst.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/neighbour.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 37845dae6488..a4538d553704 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
| @@ -91,7 +91,7 @@ struct neigh_statistics { | |||
| 91 | #define NEIGH_CACHE_STAT_INC(tbl, field) this_cpu_inc((tbl)->stats->field) | 91 | #define NEIGH_CACHE_STAT_INC(tbl, field) this_cpu_inc((tbl)->stats->field) |
| 92 | 92 | ||
| 93 | struct neighbour { | 93 | struct neighbour { |
| 94 | struct neighbour *next; | 94 | struct neighbour __rcu *next; |
| 95 | struct neigh_table *tbl; | 95 | struct neigh_table *tbl; |
| 96 | struct neigh_parms *parms; | 96 | struct neigh_parms *parms; |
| 97 | struct net_device *dev; | 97 | struct net_device *dev; |
| @@ -111,6 +111,7 @@ struct neighbour { | |||
| 111 | struct sk_buff_head arp_queue; | 111 | struct sk_buff_head arp_queue; |
| 112 | struct timer_list timer; | 112 | struct timer_list timer; |
| 113 | const struct neigh_ops *ops; | 113 | const struct neigh_ops *ops; |
| 114 | struct rcu_head rcu; | ||
| 114 | u8 primary_key[0]; | 115 | u8 primary_key[0]; |
| 115 | }; | 116 | }; |
| 116 | 117 | ||
| @@ -139,7 +140,7 @@ struct pneigh_entry { | |||
| 139 | */ | 140 | */ |
| 140 | 141 | ||
| 141 | struct neigh_hash_table { | 142 | struct neigh_hash_table { |
| 142 | struct neighbour **hash_buckets; | 143 | struct neighbour __rcu **hash_buckets; |
| 143 | unsigned int hash_mask; | 144 | unsigned int hash_mask; |
| 144 | __u32 hash_rnd; | 145 | __u32 hash_rnd; |
| 145 | struct rcu_head rcu; | 146 | struct rcu_head rcu; |
