* [PATCH net] neighbour: skip NTF_EXT_LEARNED entries during forced gc
@ 2018-06-13 4:26 Roopa Prabhu
2018-06-15 16:37 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Roopa Prabhu @ 2018-06-13 4:26 UTC (permalink / raw)
To: davem; +Cc: netdev
From: Roopa Prabhu <roopa@cumulusnetworks.com>
Commit 9ce33e46531d ("neighbour: support for NTF_EXT_LEARNED flag")
added support for NTF_EXT_LEARNED for neighbour entries.
NTF_EXT_LEARNED entries are neigh entries managed by control
plane (eg: Ethernet VPN implementation in FRR routing suite).
Periodic gc already excludes these entries. This patch extends
it to forced gc which the earlier patch missed.
Fixes: 9ce33e46531d ("neighbour: support for NTF_EXT_LEARNED flag")
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
net/core/neighbour.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index a7a9c3d..8e3fda9 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -119,13 +119,14 @@ unsigned long neigh_rand_reach_time(unsigned long base)
EXPORT_SYMBOL(neigh_rand_reach_time);
-static bool neigh_del(struct neighbour *n, __u8 state,
+static bool neigh_del(struct neighbour *n, __u8 state, __u8 flags,
struct neighbour __rcu **np, struct neigh_table *tbl)
{
bool retval = false;
write_lock(&n->lock);
- if (refcount_read(&n->refcnt) == 1 && !(n->nud_state & state)) {
+ if (refcount_read(&n->refcnt) == 1 && !(n->nud_state & state) &&
+ !(n->flags & flags)) {
struct neighbour *neigh;
neigh = rcu_dereference_protected(n->next,
@@ -157,7 +158,7 @@ bool neigh_remove_one(struct neighbour *ndel, struct neigh_table *tbl)
while ((n = rcu_dereference_protected(*np,
lockdep_is_held(&tbl->lock)))) {
if (n == ndel)
- return neigh_del(n, 0, np, tbl);
+ return neigh_del(n, 0, 0, np, tbl);
np = &n->next;
}
return false;
@@ -185,7 +186,8 @@ static int neigh_forced_gc(struct neigh_table *tbl)
* - nobody refers to it.
* - it is not permanent
*/
- if (neigh_del(n, NUD_PERMANENT, np, tbl)) {
+ if (neigh_del(n, NUD_PERMANENT, NTF_EXT_LEARNED, np,
+ tbl)) {
shrunk = 1;
continue;
}
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] neighbour: skip NTF_EXT_LEARNED entries during forced gc
2018-06-13 4:26 [PATCH net] neighbour: skip NTF_EXT_LEARNED entries during forced gc Roopa Prabhu
@ 2018-06-15 16:37 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-06-15 16:37 UTC (permalink / raw)
To: roopa; +Cc: netdev
From: Roopa Prabhu <roopa@cumulusnetworks.com>
Date: Tue, 12 Jun 2018 21:26:10 -0700
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> Commit 9ce33e46531d ("neighbour: support for NTF_EXT_LEARNED flag")
> added support for NTF_EXT_LEARNED for neighbour entries.
> NTF_EXT_LEARNED entries are neigh entries managed by control
> plane (eg: Ethernet VPN implementation in FRR routing suite).
> Periodic gc already excludes these entries. This patch extends
> it to forced gc which the earlier patch missed.
>
> Fixes: 9ce33e46531d ("neighbour: support for NTF_EXT_LEARNED flag")
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-15 16:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-13 4:26 [PATCH net] neighbour: skip NTF_EXT_LEARNED entries during forced gc Roopa Prabhu
2018-06-15 16:37 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).