aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dst.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/dst.c')
-rw-r--r--net/core/dst.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/net/core/dst.c b/net/core/dst.c
index 9ccca038444..14b33baf073 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -171,8 +171,7 @@ void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
171 dst_init_metrics(dst, dst_default_metrics, true); 171 dst_init_metrics(dst, dst_default_metrics, true);
172 dst->expires = 0UL; 172 dst->expires = 0UL;
173 dst->path = dst; 173 dst->path = dst;
174 dst->neighbour = NULL; 174 dst->_neighbour = NULL;
175 dst->hh = NULL;
176#ifdef CONFIG_XFRM 175#ifdef CONFIG_XFRM
177 dst->xfrm = NULL; 176 dst->xfrm = NULL;
178#endif 177#endif
@@ -190,7 +189,8 @@ void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
190 dst->lastuse = jiffies; 189 dst->lastuse = jiffies;
191 dst->flags = flags; 190 dst->flags = flags;
192 dst->next = NULL; 191 dst->next = NULL;
193 dst_entries_add(ops, 1); 192 if (!(flags & DST_NOCOUNT))
193 dst_entries_add(ops, 1);
194 return dst; 194 return dst;
195} 195}
196EXPORT_SYMBOL(dst_alloc); 196EXPORT_SYMBOL(dst_alloc);
@@ -225,25 +225,20 @@ struct dst_entry *dst_destroy(struct dst_entry * dst)
225{ 225{
226 struct dst_entry *child; 226 struct dst_entry *child;
227 struct neighbour *neigh; 227 struct neighbour *neigh;
228 struct hh_cache *hh;
229 228
230 smp_rmb(); 229 smp_rmb();
231 230
232again: 231again:
233 neigh = dst->neighbour; 232 neigh = dst->_neighbour;
234 hh = dst->hh;
235 child = dst->child; 233 child = dst->child;
236 234
237 dst->hh = NULL;
238 if (hh)
239 hh_cache_put(hh);
240
241 if (neigh) { 235 if (neigh) {
242 dst->neighbour = NULL; 236 dst->_neighbour = NULL;
243 neigh_release(neigh); 237 neigh_release(neigh);
244 } 238 }
245 239
246 dst_entries_add(dst->ops, -1); 240 if (!(dst->flags & DST_NOCOUNT))
241 dst_entries_add(dst->ops, -1);
247 242
248 if (dst->ops->destroy) 243 if (dst->ops->destroy)
249 dst->ops->destroy(dst); 244 dst->ops->destroy(dst);
@@ -368,8 +363,8 @@ static void dst_ifdown(struct dst_entry *dst, struct net_device *dev,
368 dst->dev = dev_net(dst->dev)->loopback_dev; 363 dst->dev = dev_net(dst->dev)->loopback_dev;
369 dev_hold(dst->dev); 364 dev_hold(dst->dev);
370 dev_put(dev); 365 dev_put(dev);
371 if (dst->neighbour && dst->neighbour->dev == dev) { 366 if (dst->_neighbour && dst->_neighbour->dev == dev) {
372 dst->neighbour->dev = dst->dev; 367 dst->_neighbour->dev = dst->dev;
373 dev_hold(dst->dev); 368 dev_hold(dst->dev);
374 dev_put(dev); 369 dev_put(dev);
375 } 370 }