[NEIGH]: Combine neighbour cleanup and release
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 <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1e6e9342d4
commit
4f494554f9
1 changed files with 13 additions and 14 deletions
|
@ -105,6 +105,14 @@ static int neigh_blackhole(struct sk_buff *skb)
|
||||||
return -ENETDOWN;
|
return -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 is random distribution in the interval (1/2)*base...(3/2)*base.
|
||||||
* It corresponds to default IPv6 settings and is not overridable,
|
* It corresponds to default IPv6 settings and is not overridable,
|
||||||
|
@ -141,9 +149,7 @@ static int neigh_forced_gc(struct neigh_table *tbl)
|
||||||
n->dead = 1;
|
n->dead = 1;
|
||||||
shrunk = 1;
|
shrunk = 1;
|
||||||
write_unlock(&n->lock);
|
write_unlock(&n->lock);
|
||||||
if (n->parms->neigh_cleanup)
|
neigh_cleanup_and_release(n);
|
||||||
n->parms->neigh_cleanup(n);
|
|
||||||
neigh_release(n);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
write_unlock(&n->lock);
|
write_unlock(&n->lock);
|
||||||
|
@ -214,9 +220,7 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev)
|
||||||
NEIGH_PRINTK2("neigh %p is stray.\n", n);
|
NEIGH_PRINTK2("neigh %p is stray.\n", n);
|
||||||
}
|
}
|
||||||
write_unlock(&n->lock);
|
write_unlock(&n->lock);
|
||||||
if (n->parms->neigh_cleanup)
|
neigh_cleanup_and_release(n);
|
||||||
n->parms->neigh_cleanup(n);
|
|
||||||
neigh_release(n);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -677,9 +681,7 @@ static void neigh_periodic_timer(unsigned long arg)
|
||||||
*np = n->next;
|
*np = n->next;
|
||||||
n->dead = 1;
|
n->dead = 1;
|
||||||
write_unlock(&n->lock);
|
write_unlock(&n->lock);
|
||||||
if (n->parms->neigh_cleanup)
|
neigh_cleanup_and_release(n);
|
||||||
n->parms->neigh_cleanup(n);
|
|
||||||
neigh_release(n);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
write_unlock(&n->lock);
|
write_unlock(&n->lock);
|
||||||
|
@ -2095,11 +2097,8 @@ void __neigh_for_each_release(struct neigh_table *tbl,
|
||||||
} else
|
} else
|
||||||
np = &n->next;
|
np = &n->next;
|
||||||
write_unlock(&n->lock);
|
write_unlock(&n->lock);
|
||||||
if (release) {
|
if (release)
|
||||||
if (n->parms->neigh_cleanup)
|
neigh_cleanup_and_release(n);
|
||||||
n->parms->neigh_cleanup(n);
|
|
||||||
neigh_release(n);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue