: Combine neighbour cleanup and release
Subsystems (2)
Introduces neigh_cleanup_and_release() to be used after a neighbour has been removed from its neighbour table. Serves as preparation to add event notifications.
Signed-off-by Thomas Graf <[email protected]>
net/core/neighbour.c +13 -14
@@ -104,6 +104,14 @@ static int neigh_blackhole(struct sk_bufreturn -ENETDOWN ; } +static void neigh_cleanup_and_release (struct neighbour *neigh) +{ +if (neigh->parms->neigh_cleanup) + neigh->parms->neigh_cleanup (neigh); + +neigh_release (neigh); +} +/* * It is random distribution in the interval (1/2)*base...(3/2)*base. * It corresponds to default IPv6 settings and is not overridable,
@@ -140,9 +148,7 @@ static int neigh_forced_gc(struct neigh_ n->dead =1 ; shrunk =1 ;write_unlock (&n->lock); -if (n->parms->neigh_cleanup) - n->parms->neigh_cleanup (n); -neigh_release (n); +neigh_cleanup_and_release (n);continue ; }write_unlock (&n->lock);
@@ -213,9 +219,7 @@ static void neigh_flush_dev(struct neighNEIGH_PRINTK2 ("neigh %p is stray.\n" , n); }write_unlock (&n->lock); -if (n->parms->neigh_cleanup) - n->parms->neigh_cleanup (n); -neigh_release (n); +neigh_cleanup_and_release (n); } } }
@@ -676,9 +680,7 @@ static void neigh_periodic_timer(unsigne *np = n->next; n->dead =1 ;write_unlock (&n->lock); -if (n->parms->neigh_cleanup) - n->parms->neigh_cleanup (n); -neigh_release (n); +neigh_cleanup_and_release (n);continue ; }write_unlock (&n->lock);
@@ -2094,11 +2096,8 @@ void __neigh_for_each_release(struct nei }else np = &n->next;write_unlock (&n->lock); -if (release) { -if (n->parms->neigh_cleanup) - n->parms->neigh_cleanup (n); -neigh_release (n); - } +if (release) +neigh_cleanup_and_release (n); } } }
From: Thomas Graf <[email protected]>
Date: Tue, 31 Jul 2007 23:12:06 +0200
Quoted 5 lines
Introduces
neigh_cleanup_and_release()to be used after a neighbour has been removed from its neighbour table. Serves as preparation to add event notifications.Signed-off-by Thomas Graf <[email protected]>
Applied to net-2.6.24, thanks Thomas.