summaryrefslogtreecommitdiffstats
path: root/net/core/dst.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-04-28 14:13:38 -0700
committerDavid S. Miller <davem@davemloft.net>2011-04-28 22:25:59 -0700
commit5c1e6aa300a7a669dc469d2dcb20172c6bd8fed9 (patch)
tree61796a49f8b9236eee4730ff8142e79bd43f0f51 /net/core/dst.c
parent778865a550e7958c1211242cc481f48d46de0f04 (diff)
downloadop-kernel-dev-5c1e6aa300a7a669dc469d2dcb20172c6bd8fed9.zip
op-kernel-dev-5c1e6aa300a7a669dc469d2dcb20172c6bd8fed9.tar.gz
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.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/net/core/dst.c b/net/core/dst.c
index 91104d3..9505778 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -166,7 +166,8 @@ EXPORT_SYMBOL(dst_discard);
const u32 dst_default_metrics[RTAX_MAX];
-void *dst_alloc(struct dst_ops *ops, int initial_ref)
+void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
+ int initial_ref, int initial_obsolete, int flags)
{
struct dst_entry *dst;
@@ -177,12 +178,19 @@ void *dst_alloc(struct dst_ops *ops, int initial_ref)
dst = kmem_cache_zalloc(ops->kmem_cachep, GFP_ATOMIC);
if (!dst)
return NULL;
- atomic_set(&dst->__refcnt, initial_ref);
dst->ops = ops;
- dst->lastuse = jiffies;
- dst->path = dst;
- dst->input = dst->output = dst_discard;
+ dst->dev = dev;
+ if (dev)
+ dev_hold(dev);
dst_init_metrics(dst, dst_default_metrics, true);
+ dst->path = dst;
+ dst->input = dst_discard;
+ dst->output = dst_discard;
+
+ dst->obsolete = initial_obsolete;
+ atomic_set(&dst->__refcnt, initial_ref);
+ dst->lastuse = jiffies;
+ dst->flags = flags;
#if RT_CACHE_DEBUG >= 2
atomic_inc(&dst_total);
#endif
OpenPOWER on IntegriCloud