Lines Matching refs:dst
53 static void ___dst_free(struct dst_entry *dst);
68 struct dst_entry *dst, *next, head; in dst_gc_task() local
75 while ((dst = next) != NULL) { in dst_gc_task()
76 next = dst->next; in dst_gc_task()
79 if (likely(atomic_read(&dst->__refcnt))) { in dst_gc_task()
80 last->next = dst; in dst_gc_task()
81 last = dst; in dst_gc_task()
87 dst = dst_destroy(dst); in dst_gc_task()
88 if (dst) { in dst_gc_task()
97 if (dst->obsolete > 0) in dst_gc_task()
100 ___dst_free(dst); in dst_gc_task()
101 dst->next = next; in dst_gc_task()
102 next = dst; in dst_gc_task()
165 struct dst_entry *dst; in dst_alloc() local
171 dst = kmem_cache_alloc(ops->kmem_cachep, GFP_ATOMIC); in dst_alloc()
172 if (!dst) in dst_alloc()
174 dst->child = NULL; in dst_alloc()
175 dst->dev = dev; in dst_alloc()
178 dst->ops = ops; in dst_alloc()
179 dst_init_metrics(dst, dst_default_metrics, true); in dst_alloc()
180 dst->expires = 0UL; in dst_alloc()
181 dst->path = dst; in dst_alloc()
182 dst->from = NULL; in dst_alloc()
184 dst->xfrm = NULL; in dst_alloc()
186 dst->input = dst_discard; in dst_alloc()
187 dst->output = dst_discard_sk; in dst_alloc()
188 dst->error = 0; in dst_alloc()
189 dst->obsolete = initial_obsolete; in dst_alloc()
190 dst->header_len = 0; in dst_alloc()
191 dst->trailer_len = 0; in dst_alloc()
193 dst->tclassid = 0; in dst_alloc()
195 atomic_set(&dst->__refcnt, initial_ref); in dst_alloc()
196 dst->__use = 0; in dst_alloc()
197 dst->lastuse = jiffies; in dst_alloc()
198 dst->flags = flags; in dst_alloc()
199 dst->pending_confirm = 0; in dst_alloc()
200 dst->next = NULL; in dst_alloc()
203 return dst; in dst_alloc()
207 static void ___dst_free(struct dst_entry *dst) in ___dst_free() argument
212 if (dst->dev == NULL || !(dst->dev->flags&IFF_UP)) { in ___dst_free()
213 dst->input = dst_discard; in ___dst_free()
214 dst->output = dst_discard_sk; in ___dst_free()
216 dst->obsolete = DST_OBSOLETE_DEAD; in ___dst_free()
219 void __dst_free(struct dst_entry *dst) in __dst_free() argument
222 ___dst_free(dst); in __dst_free()
223 dst->next = dst_garbage.list; in __dst_free()
224 dst_garbage.list = dst; in __dst_free()
235 struct dst_entry *dst_destroy(struct dst_entry * dst) in dst_destroy() argument
242 child = dst->child; in dst_destroy()
244 if (!(dst->flags & DST_NOCOUNT)) in dst_destroy()
245 dst_entries_add(dst->ops, -1); in dst_destroy()
247 if (dst->ops->destroy) in dst_destroy()
248 dst->ops->destroy(dst); in dst_destroy()
249 if (dst->dev) in dst_destroy()
250 dev_put(dst->dev); in dst_destroy()
251 kmem_cache_free(dst->ops->kmem_cachep, dst); in dst_destroy()
253 dst = child; in dst_destroy()
254 if (dst) { in dst_destroy()
255 int nohash = dst->flags & DST_NOHASH; in dst_destroy()
257 if (atomic_dec_and_test(&dst->__refcnt)) { in dst_destroy()
264 return dst; in dst_destroy()
274 struct dst_entry *dst = container_of(head, struct dst_entry, rcu_head); in dst_destroy_rcu() local
276 dst = dst_destroy(dst); in dst_destroy_rcu()
277 if (dst) in dst_destroy_rcu()
278 __dst_free(dst); in dst_destroy_rcu()
281 void dst_release(struct dst_entry *dst) in dst_release() argument
283 if (dst) { in dst_release()
285 unsigned short nocache = dst->flags & DST_NOCACHE; in dst_release()
287 newrefcnt = atomic_dec_return(&dst->__refcnt); in dst_release()
290 call_rcu(&dst->rcu_head, dst_destroy_rcu); in dst_release()
295 u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old) in dst_cow_metrics_generic() argument
306 prev = cmpxchg(&dst->_metrics, old, new); in dst_cow_metrics_generic()
320 void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old) in __dst_destroy_metrics_generic() argument
325 prev = cmpxchg(&dst->_metrics, old, new); in __dst_destroy_metrics_generic()
339 static void dst_ifdown(struct dst_entry *dst, struct net_device *dev, in dst_ifdown() argument
342 if (dst->ops->ifdown) in dst_ifdown()
343 dst->ops->ifdown(dst, dev, unregister); in dst_ifdown()
345 if (dev != dst->dev) in dst_ifdown()
349 dst->input = dst_discard; in dst_ifdown()
350 dst->output = dst_discard_sk; in dst_ifdown()
352 dst->dev = dev_net(dst->dev)->loopback_dev; in dst_ifdown()
353 dev_hold(dst->dev); in dst_ifdown()
362 struct dst_entry *dst, *last = NULL; in dst_dev_event() local
368 for (dst = dst_busy_list; dst; dst = dst->next) { in dst_dev_event()
369 last = dst; in dst_dev_event()
370 dst_ifdown(dst, dev, event != NETDEV_DOWN); in dst_dev_event()
374 dst = dst_garbage.list; in dst_dev_event()
379 last->next = dst; in dst_dev_event()
381 dst_busy_list = dst; in dst_dev_event()
382 for (; dst; dst = dst->next) in dst_dev_event()
383 dst_ifdown(dst, dev, event != NETDEV_DOWN); in dst_dev_event()