neigh: Factor out ___neigh_lookup_noref
[deliverable/linux.git] / include / net / arp.h
index 21ee1860abbc7109006ebc5d625ac25d41d3f6bc..5e0f891d476c299d91fde14ce9cdeedc9a7e26c6 100644 (file)
@@ -9,28 +9,17 @@
 
 extern struct neigh_table arp_tbl;
 
-static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd)
+static inline u32 arp_hashfn(const void *pkey, const struct net_device *dev, u32 *hash_rnd)
 {
+       u32 key = *(const u32 *)pkey;
        u32 val = key ^ hash32_ptr(dev);
 
-       return val * hash_rnd;
+       return val * hash_rnd[0];
 }
 
 static inline struct neighbour *__ipv4_neigh_lookup_noref(struct net_device *dev, u32 key)
 {
-       struct neigh_hash_table *nht = rcu_dereference_bh(arp_tbl.nht);
-       struct neighbour *n;
-       u32 hash_val;
-
-       hash_val = arp_hashfn(key, dev, nht->hash_rnd[0]) >> (32 - nht->hash_shift);
-       for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]);
-            n != NULL;
-            n = rcu_dereference_bh(n->next)) {
-               if (n->dev == dev && *(u32 *)n->primary_key == key)
-                       return n;
-       }
-
-       return NULL;
+       return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, arp_hashfn, &key, dev);
 }
 
 static inline struct neighbour *__ipv4_neigh_lookup(struct net_device *dev, u32 key)
This page took 0.026557 seconds and 5 git commands to generate.