8 #include <linux/bitops.h>
9 #include <linux/errno.h>
11 #include <linux/kernel.h>
14 #include <linux/module.h>
15 #include <linux/slab.h>
16 #include <linux/netdevice.h>
18 #include <linux/string.h>
19 #include <linux/types.h>
21 #include <linux/sched.h>
22 #include <linux/prefetch.h>
66 int work_performed = 0;
75 while ((dst = next) !=
NULL) {
106 spin_lock_bh(&dst_garbage.lock);
107 next = dst_garbage.list;
109 dst_garbage.list =
NULL;
110 spin_unlock_bh(&dst_garbage.lock);
114 dst_busy_list = head.
next;
122 if (work_performed <= delayed/10) {
123 dst_garbage.timer_expires += dst_garbage.timer_inc;
131 expires = dst_garbage.timer_expires;
141 spin_unlock_bh(&dst_garbage.lock);
163 int initial_ref,
int initial_obsolete,
unsigned short flags)
167 if (ops->
gc && dst_entries_get_fast(ops) > ops->
gc_thresh) {
179 dst_init_metrics(dst, dst_default_metrics,
true);
191 #ifdef CONFIG_IP_ROUTE_CLASSID
201 dst_entries_add(ops, 1);
206 static void ___dst_free(
struct dst_entry *dst)
218 spin_lock_bh(&dst_garbage.lock);
220 dst->
next = dst_garbage.list;
221 dst_garbage.list =
dst;
226 dst_garbage.timer_expires);
228 spin_unlock_bh(&dst_garbage.lock);
242 dst_entries_add(dst->
ops, -1);
244 if (dst->
ops->destroy)
245 dst->
ops->destroy(dst);
291 unsigned long prev,
new;
293 memcpy(p, old_p,
sizeof(
u32) * RTAX_MAX);
295 new = (
unsigned long) p;
312 unsigned long prev,
new;
331 WARN_ON(!rcu_read_lock_held() && !rcu_read_lock_bh_held());
337 skb_dst_set(skb, dst);
355 if (dst->
ops->ifdown)
356 dst->
ops->ifdown(dst, dev, unregister);
364 dst->
dev = dev_net(dst->
dev)->loopback_dev;
380 for (dst = dst_busy_list;
dst; dst = dst->
next) {
385 spin_lock_bh(&dst_garbage.lock);
386 dst = dst_garbage.list;
387 dst_garbage.list =
NULL;
388 spin_unlock_bh(&dst_garbage.lock);
403 .notifier_call = dst_dev_event,