: Add nodev neigh lookup for decnet
Subsystems (2)
David S. Miller
maintainerPATCH 4/6 : Add nodev neigh lookup for decnet
It was the one and only tbl->hash() call site outside of net/core/neighbour.c
# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/09/23 16:52:29-07:00 [email protected]
# [NET]: Create neigh_lookup_nodev for decnet.
#
# Signed-off-by: David S. Miller <[email protected]>
#
# net/decnet/dn_route.c # 2004/09/23 16:51:55-07:00 [email protected] +1 -1 # [NET]: Create neigh_lookup_nodev for decnet. # # net/decnet/dn_neigh.c # 2004/09/23 16:51:55-07:00 [email protected] +0 -21 # [NET]: Create neigh_lookup_nodev for decnet. # # net/core/neighbour.c # 2004/09/23 16:51:55-07:00 [email protected] +18 -0 # [NET]: Create neigh_lookup_nodev for decnet. # # include/net/neighbour.h # 2004/09/23 16:51:55-07:00 [email protected] +2 -0 # [NET]: Create neigh_lookup_nodev for decnet. # # include/net/dn_neigh.h # 2004/09/23 16:51:55-07:00 [email protected] +0 -1 # [NET]: Create neigh_lookup_nodev for decnet. # diff -Nru a/include/net/dn_neigh.h b/include/net/dn_neigh.h --- a/include/net/dn_neigh.h 2004-09-23 22:26:40 -07:00 +++ b/include/net/dn_neigh.h 2004-09-23 22:26:40 -07:00 @@ -18,7 +18,6 @@
extern void dn_neigh_init(void);
extern void dn_neigh_cleanup(void);
-extern struct neighbour *dn_neigh_lookup(struct neigh_table *tbl, const void *ptr);
extern int dn_neigh_router_hello(struct sk_buff *skb);
extern int dn_neigh_endnode_hello(struct sk_buff *skb);
extern void dn_neigh_pointopoint_hello(struct sk_buff *skb);
include/net/neighbour.h +2 -0
@@ -189,6 +189,8 @@extern struct neighbour *neigh_lookup (struct neigh_table *tbl,const void *pkey,struct net_device *dev); +extern struct neighbour *neigh_lookup_nodev (struct neigh_table *tbl, +const void *pkey);extern struct neighbour *neigh_create (struct neigh_table *tbl,const void *pkey,struct net_device *dev);
net/core/neighbour.c +18 -0
@@ -307,6 +307,23 @@return n; } +struct neighbour *neigh_lookup_nodev (struct neigh_table *tbl,const void *pkey) +{ +struct neighbour *n; +int key_len = tbl->key_len; +u32 hash_val = tbl->hash (pkey,NULL ) &NEIGH_HASHMASK ; + +read_lock_bh (&tbl->lock); +for (n = tbl->hash_buckets[hash_val]; n; n = n->next) { +if (!memcmp (n->primary_key, pkey, key_len)) { +neigh_hold (n); +break ; + } + } +read_unlock_bh (&tbl->lock); +return n; +} +struct neighbour *neigh_create (struct neigh_table *tbl,const void *pkey,struct net_device *dev) {
@@ -2068,6 +2085,7 @@EXPORT_SYMBOL (neigh_event_ns);EXPORT_SYMBOL (neigh_ifdown);EXPORT_SYMBOL (neigh_lookup); +EXPORT_SYMBOL (neigh_lookup_nodev);EXPORT_SYMBOL (neigh_parms_alloc);EXPORT_SYMBOL (neigh_parms_release);EXPORT_SYMBOL (neigh_rand_reach_time);
net/decnet/dn_neigh.c +0 -21
@@ -359,27 +359,6 @@* basically does a neigh_lookup(), but without comparing the device * field. This is required for the On-Ethernet cache */ -struct neighbour *dn_neigh_lookup (struct neigh_table *tbl,const void *ptr) -{ -struct neighbour *neigh; -u32 hash_val; - - hash_val = tbl->hash (ptr,NULL ); - -read_lock_bh (&tbl->lock); -for (neigh = tbl->hash_buckets[hash_val]; neigh !=NULL ; neigh = neigh->next) { -if (memcmp (neigh->primary_key, ptr, tbl->key_len) ==0 ) { -atomic_inc (&neigh->refcnt); -read_unlock_bh (&tbl->lock); -return neigh; - } - } -read_unlock_bh (&tbl->lock); - -return NULL ; -} - -/* * Any traffic on a pointopoint link causes the timer to be reset * for the entry in the neighbour table.
net/decnet/dn_route.c +1 -1
@@ -996,7 +996,7 @@* here */ if (!try_hard) { - neigh =dn_neigh_lookup (&dn_neigh_table, &fl.fld_dst); + neigh =neigh_lookup_nodev (&dn_neigh_table, &fl.fld_dst);if (neigh) { if ((oldflp->oif && (neigh->dev->ifindex != oldflp->oif)) ||