]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/net/neighbour.h
net neigh: RCU conversion of neigh hash table
[net-next-2.6.git] / include / net / neighbour.h
index 242879b6c4df8a4f539c3746dabb26bfe08a9dd8..37845dae6488b6df58e2e200ac0d7a7732098323 100644 (file)
@@ -94,7 +94,7 @@ struct neighbour {
        struct neighbour        *next;
        struct neigh_table      *tbl;
        struct neigh_parms      *parms;
-       struct net_device               *dev;
+       struct net_device       *dev;
        unsigned long           used;
        unsigned long           confirmed;
        unsigned long           updated;
@@ -102,11 +102,11 @@ struct neighbour {
        __u8                    nud_state;
        __u8                    type;
        __u8                    dead;
+       atomic_t                refcnt;
        atomic_t                probes;
        rwlock_t                lock;
        unsigned char           ha[ALIGN(MAX_ADDR_LEN, sizeof(unsigned long))];
        struct hh_cache         *hh;
-       atomic_t                refcnt;
        int                     (*output)(struct sk_buff *skb);
        struct sk_buff_head     arp_queue;
        struct timer_list       timer;
@@ -138,13 +138,22 @@ struct pneigh_entry {
  *     neighbour table manipulation
  */
 
+struct neigh_hash_table {
+       struct neighbour        **hash_buckets;
+       unsigned int            hash_mask;
+       __u32                   hash_rnd;
+       struct rcu_head         rcu;
+};
+
 
 struct neigh_table {
        struct neigh_table      *next;
        int                     family;
        int                     entry_size;
        int                     key_len;
-       __u32                   (*hash)(const void *pkey, const struct net_device *);
+       __u32                   (*hash)(const void *pkey,
+                                       const struct net_device *dev,
+                                       __u32 hash_rnd);
        int                     (*constructor)(struct neighbour *);
        int                     (*pconstructor)(struct pneigh_entry *);
        void                    (*pdestructor)(struct pneigh_entry *);
@@ -163,11 +172,9 @@ struct neigh_table {
        atomic_t                entries;
        rwlock_t                lock;
        unsigned long           last_rand;
-       struct kmem_cache               *kmem_cachep;
+       struct kmem_cache       *kmem_cachep;
        struct neigh_statistics __percpu *stats;
-       struct neighbour        **hash_buckets;
-       unsigned int            hash_mask;
-       __u32                   hash_rnd;
+       struct neigh_hash_table __rcu *nht;
        struct pneigh_entry     **phash_buckets;
 };
 
@@ -237,6 +244,7 @@ extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_en
 struct neigh_seq_state {
        struct seq_net_private p;
        struct neigh_table *tbl;
+       struct neigh_hash_table *nht;
        void *(*neigh_sub_iter)(struct neigh_seq_state *state,
                                struct neighbour *n, loff_t *pos);
        unsigned int bucket;