aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2007-08-09 02:12:36 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:47:48 -0400
commit4f494554f9b95d0de57c14c460d525e3715e3f6f (patch)
treee0d9a91efdd9b7809069c4582c0e420acd113558
parent1e6e9342d41ff80ced0ad5dfcf084926700cdfc5 (diff)
[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>
-rw-r--r--net/core/neighbour.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index f7de8f24d8dd..4b815db94b6b 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -105,6 +105,14 @@ static int neigh_blackhole(struct sk_buff *skb)
105 return -ENETDOWN; 105 return -ENETDOWN;
106} 106}
107 107
108static void neigh_cleanup_and_release(struct neighbour *neigh)
109{
110 if (neigh->parms->neigh_cleanup)
111 neigh->parms->neigh_cleanup(neigh);
112
113 neigh_release(neigh);
114}
115
108/* 116/*
109 * It is random distribution in the interval (1/2)*base...(3/2)*base. 117 * It is random distribution in the interval (1/2)*base...(3/2)*base.
110 * It corresponds to default IPv6 settings and is not overridable, 118 * It corresponds to default IPv6 settings and is not overridable,
@@ -141,9 +149,7 @@ static int neigh_forced_gc(struct neigh_table *tbl)
141 n->dead = 1; 149 n->dead = 1;
142 shrunk = 1; 150 shrunk = 1;
143 write_unlock(&n->lock); 151 write_unlock(&n->lock);
144 if (n->parms->neigh_cleanup) 152 neigh_cleanup_and_release(n);
145 n->parms->neigh_cleanup(n);
146 neigh_release(n);
147 continue; 153 continue;
148 } 154 }
149 write_unlock(&n->lock); 155 write_unlock(&n->lock);
@@ -214,9 +220,7 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev)
214 NEIGH_PRINTK2("neigh %p is stray.\n", n); 220 NEIGH_PRINTK2("neigh %p is stray.\n", n);
215 } 221 }
216 write_unlock(&n->lock); 222 write_unlock(&n->lock);
217 if (n->parms->neigh_cleanup) 223 neigh_cleanup_and_release(n);
218 n->parms->neigh_cleanup(n);
219 neigh_release(n);
220 } 224 }
221 } 225 }
222} 226}
@@ -677,9 +681,7 @@ static void neigh_periodic_timer(unsigned long arg)
677 *np = n->next; 681 *np = n->next;
678 n->dead = 1; 682 n->dead = 1;
679 write_unlock(&n->lock); 683 write_unlock(&n->lock);
680 if (n->parms->neigh_cleanup) 684 neigh_cleanup_and_release(n);
681 n->parms->neigh_cleanup(n);
682 neigh_release(n);
683 continue; 685 continue;
684 } 686 }
685 write_unlock(&n->lock); 687 write_unlock(&n->lock);
@@ -2095,11 +2097,8 @@ void __neigh_for_each_release(struct neigh_table *tbl,
2095 } else 2097 } else
2096 np = &n->next; 2098 np = &n->next;
2097 write_unlock(&n->lock); 2099 write_unlock(&n->lock);
2098 if (release) { 2100 if (release)
2099 if (n->parms->neigh_cleanup) 2101 neigh_cleanup_and_release(n);
2100 n->parms->neigh_cleanup(n);
2101 neigh_release(n);
2102 }
2103 } 2102 }
2104 } 2103 }
2105} 2104}