Lines Matching refs:dst

47 void dst_init(struct dst_entry *dst, struct dst_ops *ops,  in dst_init()  argument
51 dst->dev = dev; in dst_init()
54 dst->ops = ops; in dst_init()
55 dst_init_metrics(dst, dst_default_metrics.metrics, true); in dst_init()
56 dst->expires = 0UL; in dst_init()
58 dst->xfrm = NULL; in dst_init()
60 dst->input = dst_discard; in dst_init()
61 dst->output = dst_discard_out; in dst_init()
62 dst->error = 0; in dst_init()
63 dst->obsolete = initial_obsolete; in dst_init()
64 dst->header_len = 0; in dst_init()
65 dst->trailer_len = 0; in dst_init()
67 dst->tclassid = 0; in dst_init()
69 dst->lwtstate = NULL; in dst_init()
70 atomic_set(&dst->__refcnt, initial_ref); in dst_init()
71 dst->__use = 0; in dst_init()
72 dst->lastuse = jiffies; in dst_init()
73 dst->flags = flags; in dst_init()
82 struct dst_entry *dst; in dst_alloc() local
93 dst = kmem_cache_alloc(ops->kmem_cachep, GFP_ATOMIC); in dst_alloc()
94 if (!dst) in dst_alloc()
97 dst_init(dst, ops, dev, initial_ref, initial_obsolete, flags); in dst_alloc()
99 return dst; in dst_alloc()
103 struct dst_entry *dst_destroy(struct dst_entry * dst) in dst_destroy() argument
110 if (dst->xfrm) { in dst_destroy()
111 struct xfrm_dst *xdst = (struct xfrm_dst *) dst; in dst_destroy()
116 if (!(dst->flags & DST_NOCOUNT)) in dst_destroy()
117 dst_entries_add(dst->ops, -1); in dst_destroy()
119 if (dst->ops->destroy) in dst_destroy()
120 dst->ops->destroy(dst); in dst_destroy()
121 if (dst->dev) in dst_destroy()
122 dev_put(dst->dev); in dst_destroy()
124 lwtstate_put(dst->lwtstate); in dst_destroy()
126 if (dst->flags & DST_METADATA) in dst_destroy()
127 metadata_dst_free((struct metadata_dst *)dst); in dst_destroy()
129 kmem_cache_free(dst->ops->kmem_cachep, dst); in dst_destroy()
131 dst = child; in dst_destroy()
132 if (dst) in dst_destroy()
133 dst_release_immediate(dst); in dst_destroy()
140 struct dst_entry *dst = container_of(head, struct dst_entry, rcu_head); in dst_destroy_rcu() local
142 dst = dst_destroy(dst); in dst_destroy_rcu()
154 void dst_dev_put(struct dst_entry *dst) in dst_dev_put() argument
156 struct net_device *dev = dst->dev; in dst_dev_put()
158 dst->obsolete = DST_OBSOLETE_DEAD; in dst_dev_put()
159 if (dst->ops->ifdown) in dst_dev_put()
160 dst->ops->ifdown(dst, dev, true); in dst_dev_put()
161 dst->input = dst_discard; in dst_dev_put()
162 dst->output = dst_discard_out; in dst_dev_put()
163 dst->dev = blackhole_netdev; in dst_dev_put()
164 dev_hold(dst->dev); in dst_dev_put()
169 void dst_release(struct dst_entry *dst) in dst_release() argument
171 if (dst) { in dst_release()
174 newrefcnt = atomic_dec_return(&dst->__refcnt); in dst_release()
177 __func__, dst, newrefcnt); in dst_release()
179 call_rcu(&dst->rcu_head, dst_destroy_rcu); in dst_release()
184 void dst_release_immediate(struct dst_entry *dst) in dst_release_immediate() argument
186 if (dst) { in dst_release_immediate()
189 newrefcnt = atomic_dec_return(&dst->__refcnt); in dst_release_immediate()
192 __func__, dst, newrefcnt); in dst_release_immediate()
194 dst_destroy(dst); in dst_release_immediate()
199 u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old) in dst_cow_metrics_generic() argument
211 prev = cmpxchg(&dst->_metrics, old, new); in dst_cow_metrics_generic()
229 void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old) in __dst_destroy_metrics_generic() argument
234 prev = cmpxchg(&dst->_metrics, old, new); in __dst_destroy_metrics_generic()
262 struct dst_entry *dst; in __metadata_dst_init() local
264 dst = &md_dst->dst; in __metadata_dst_init()
265 dst_init(dst, &md_dst_ops, NULL, 1, DST_OBSOLETE_NONE, in __metadata_dst_init()
268 dst->input = dst_md_discard; in __metadata_dst_init()
269 dst->output = dst_md_discard_out; in __metadata_dst_init()
271 memset(dst + 1, 0, sizeof(*md_dst) + optslen - sizeof(*dst)); in __metadata_dst_init()