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.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/net/core/dst.c b/net/core/dst.c
index 91104d35de7d..9505778ec800 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -166,7 +166,8 @@ EXPORT_SYMBOL(dst_discard);
166 166
167const u32 dst_default_metrics[RTAX_MAX]; 167const u32 dst_default_metrics[RTAX_MAX];
168 168
169void *dst_alloc(struct dst_ops *ops, int initial_ref) 169void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
170 int initial_ref, int initial_obsolete, int flags)
170{ 171{
171 struct dst_entry *dst; 172 struct dst_entry *dst;
172 173
@@ -177,12 +178,19 @@ void *dst_alloc(struct dst_ops *ops, int initial_ref)
177 dst = kmem_cache_zalloc(ops->kmem_cachep, GFP_ATOMIC); 178 dst = kmem_cache_zalloc(ops->kmem_cachep, GFP_ATOMIC);
178 if (!dst) 179 if (!dst)
179 return NULL; 180 return NULL;
180 atomic_set(&dst->__refcnt, initial_ref);
181 dst->ops = ops; 181 dst->ops = ops;
182 dst->lastuse = jiffies; 182 dst->dev = dev;
183 dst->path = dst; 183 if (dev)
184 dst->input = dst->output = dst_discard; 184 dev_hold(dev);
185 dst_init_metrics(dst, dst_default_metrics, true); 185 dst_init_metrics(dst, dst_default_metrics, true);
186 dst->path = dst;
187 dst->input = dst_discard;
188 dst->output = dst_discard;
189
190 dst->obsolete = initial_obsolete;
191 atomic_set(&dst->__refcnt, initial_ref);
192 dst->lastuse = jiffies;
193 dst->flags = flags;
186#if RT_CACHE_DEBUG >= 2 194#if RT_CACHE_DEBUG >= 2
187 atomic_inc(&dst_total); 195 atomic_inc(&dst_total);
188#endif 196#endif