Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 351438
b: refs/heads/master
c: ac3175f
h: refs/heads/master
v: v3
  • Loading branch information
YOSHIFUJI Hideaki / 吉藤英明 authored and David S. Miller committed Jan 17, 2013
1 parent b9b0d3a commit 81ceb65
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dd0cbf29b12bf876abf2880bcc0db8983537b87a
refs/heads/master: ac3175fe7a5788d40b067b76c27f2943cd0be2d7
22 changes: 15 additions & 7 deletions trunk/include/net/ndisc.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,13 @@ static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, _
(p32[3] * hash_rnd[3]));
}

static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, const void *pkey)
static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey)
{
struct neigh_hash_table *nht;
const u32 *p32 = pkey;
struct neighbour *n;
u32 hash_val;

rcu_read_lock_bh();
nht = rcu_dereference_bh(nd_tbl.nht);
hash_val = ndisc_hashfn(pkey, dev, nht->hash_rnd) >> (32 - nht->hash_shift);
for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]);
Expand All @@ -164,12 +163,21 @@ static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, cons
u32 *n32 = (u32 *) n->primary_key;
if (n->dev == dev &&
((n32[0] ^ p32[0]) | (n32[1] ^ p32[1]) |
(n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0) {
if (!atomic_inc_not_zero(&n->refcnt))
n = NULL;
break;
}
(n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0)
return n;
}

return NULL;
}

static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, const void *pkey)
{
struct neighbour *n;

rcu_read_lock_bh();
n = __ipv6_neigh_lookup_noref(dev, pkey);
if (n && !atomic_inc_not_zero(&n->refcnt))
n = NULL;
rcu_read_unlock_bh();

return n;
Expand Down

0 comments on commit 81ceb65

Please sign in to comment.