diff options
author | David Miller <davem@davemloft.net> | 2011-07-24 20:01:38 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-30 18:48:03 -0500 |
commit | da6a8fa0275e2178c44a875374cae80d057538d1 (patch) | |
tree | 6a9df6b3b9e268ca463fdb47d9041883acc923ea /net/core/neighbour.c | |
parent | 869759b9e4160fb8a8d25bc3b4ce3b658523aebb (diff) |
neigh: Add device constructor/destructor capability.
If the neigh entry has device private state, it will need
constructor/destructor ops.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/neighbour.c')
-rw-r--r-- | net/core/neighbour.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index ef750ff7497e..cdf8dc34f0ba 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -489,6 +489,14 @@ struct neighbour *neigh_create(struct neigh_table *tbl, const void *pkey, | |||
489 | goto out_neigh_release; | 489 | goto out_neigh_release; |
490 | } | 490 | } |
491 | 491 | ||
492 | if (dev->netdev_ops->ndo_neigh_construct) { | ||
493 | error = dev->netdev_ops->ndo_neigh_construct(n); | ||
494 | if (error < 0) { | ||
495 | rc = ERR_PTR(error); | ||
496 | goto out_neigh_release; | ||
497 | } | ||
498 | } | ||
499 | |||
492 | /* Device specific setup. */ | 500 | /* Device specific setup. */ |
493 | if (n->parms->neigh_setup && | 501 | if (n->parms->neigh_setup && |
494 | (error = n->parms->neigh_setup(n)) < 0) { | 502 | (error = n->parms->neigh_setup(n)) < 0) { |
@@ -692,6 +700,8 @@ static inline void neigh_parms_put(struct neigh_parms *parms) | |||
692 | */ | 700 | */ |
693 | void neigh_destroy(struct neighbour *neigh) | 701 | void neigh_destroy(struct neighbour *neigh) |
694 | { | 702 | { |
703 | struct net_device *dev = neigh->dev; | ||
704 | |||
695 | NEIGH_CACHE_STAT_INC(neigh->tbl, destroys); | 705 | NEIGH_CACHE_STAT_INC(neigh->tbl, destroys); |
696 | 706 | ||
697 | if (!neigh->dead) { | 707 | if (!neigh->dead) { |
@@ -707,7 +717,10 @@ void neigh_destroy(struct neighbour *neigh) | |||
707 | skb_queue_purge(&neigh->arp_queue); | 717 | skb_queue_purge(&neigh->arp_queue); |
708 | neigh->arp_queue_len_bytes = 0; | 718 | neigh->arp_queue_len_bytes = 0; |
709 | 719 | ||
710 | dev_put(neigh->dev); | 720 | if (dev->netdev_ops->ndo_neigh_destroy) |
721 | dev->netdev_ops->ndo_neigh_destroy(neigh); | ||
722 | |||
723 | dev_put(dev); | ||
711 | neigh_parms_put(neigh->parms); | 724 | neigh_parms_put(neigh->parms); |
712 | 725 | ||
713 | NEIGH_PRINTK2("neigh %p is destroyed.\n", neigh); | 726 | NEIGH_PRINTK2("neigh %p is destroyed.\n", neigh); |