diff options
author | David S. Miller <davem@davemloft.net> | 2012-07-02 05:02:15 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-05 04:02:12 -0400 |
commit | a263b3093641fb1ec377582c90986a7fd0625184 (patch) | |
tree | 691fdb4703bb88611272bf958d9de1a461f1492a /net/core | |
parent | 11604721a3c4bea60e2ddd9e4e30d741ecdba7b0 (diff) |
ipv4: Make neigh lookups directly in output packet path.
Do not use the dst cached neigh, we'll be getting rid of that.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/neighbour.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index d81d026138f0..a793af9af150 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -474,8 +474,8 @@ struct neighbour *neigh_lookup_nodev(struct neigh_table *tbl, struct net *net, | |||
474 | } | 474 | } |
475 | EXPORT_SYMBOL(neigh_lookup_nodev); | 475 | EXPORT_SYMBOL(neigh_lookup_nodev); |
476 | 476 | ||
477 | struct neighbour *neigh_create(struct neigh_table *tbl, const void *pkey, | 477 | struct neighbour *__neigh_create(struct neigh_table *tbl, const void *pkey, |
478 | struct net_device *dev) | 478 | struct net_device *dev, bool want_ref) |
479 | { | 479 | { |
480 | u32 hash_val; | 480 | u32 hash_val; |
481 | int key_len = tbl->key_len; | 481 | int key_len = tbl->key_len; |
@@ -535,14 +535,16 @@ struct neighbour *neigh_create(struct neigh_table *tbl, const void *pkey, | |||
535 | n1 = rcu_dereference_protected(n1->next, | 535 | n1 = rcu_dereference_protected(n1->next, |
536 | lockdep_is_held(&tbl->lock))) { | 536 | lockdep_is_held(&tbl->lock))) { |
537 | if (dev == n1->dev && !memcmp(n1->primary_key, pkey, key_len)) { | 537 | if (dev == n1->dev && !memcmp(n1->primary_key, pkey, key_len)) { |
538 | neigh_hold(n1); | 538 | if (want_ref) |
539 | neigh_hold(n1); | ||
539 | rc = n1; | 540 | rc = n1; |
540 | goto out_tbl_unlock; | 541 | goto out_tbl_unlock; |
541 | } | 542 | } |
542 | } | 543 | } |
543 | 544 | ||
544 | n->dead = 0; | 545 | n->dead = 0; |
545 | neigh_hold(n); | 546 | if (want_ref) |
547 | neigh_hold(n); | ||
546 | rcu_assign_pointer(n->next, | 548 | rcu_assign_pointer(n->next, |
547 | rcu_dereference_protected(nht->hash_buckets[hash_val], | 549 | rcu_dereference_protected(nht->hash_buckets[hash_val], |
548 | lockdep_is_held(&tbl->lock))); | 550 | lockdep_is_held(&tbl->lock))); |
@@ -558,7 +560,7 @@ out_neigh_release: | |||
558 | neigh_release(n); | 560 | neigh_release(n); |
559 | goto out; | 561 | goto out; |
560 | } | 562 | } |
561 | EXPORT_SYMBOL(neigh_create); | 563 | EXPORT_SYMBOL(__neigh_create); |
562 | 564 | ||
563 | static u32 pneigh_hash(const void *pkey, int key_len) | 565 | static u32 pneigh_hash(const void *pkey, int key_len) |
564 | { | 566 | { |