diff options
author | David S. Miller <davem@davemloft.net> | 2011-04-28 17:13:38 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-29 01:25:59 -0400 |
commit | 5c1e6aa300a7a669dc469d2dcb20172c6bd8fed9 (patch) | |
tree | 61796a49f8b9236eee4730ff8142e79bd43f0f51 /net/core/dst.c | |
parent | 778865a550e7958c1211242cc481f48d46de0f04 (diff) |
net: Make dst_alloc() take more explicit initializations.
Now the dst->dev, dev->obsolete, and dst->flags values can
be specified as well.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dst.c')
-rw-r--r-- | net/core/dst.c | 18 |
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 | ||
167 | const u32 dst_default_metrics[RTAX_MAX]; | 167 | const u32 dst_default_metrics[RTAX_MAX]; |
168 | 168 | ||
169 | void *dst_alloc(struct dst_ops *ops, int initial_ref) | 169 | void *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 |