Lines Matching refs:dst

63 void dst_init(struct dst_entry *dst, struct dst_ops *ops,  in dst_init()  argument
67 dst->dev = dev; in dst_init()
70 dst->ops = ops; in dst_init()
71 dst_init_metrics(dst, dst_default_metrics.metrics, true); in dst_init()
72 dst->expires = 0UL; in dst_init()
74 dst->xfrm = NULL; in dst_init()
76 dst->input = dst_discard; in dst_init()
77 dst->output = dst_discard_out; in dst_init()
78 dst->error = 0; in dst_init()
79 dst->obsolete = initial_obsolete; in dst_init()
80 dst->header_len = 0; in dst_init()
81 dst->trailer_len = 0; in dst_init()
83 dst->tclassid = 0; in dst_init()
85 dst->lwtstate = NULL; in dst_init()
86 atomic_set(&dst->__refcnt, initial_ref); in dst_init()
87 dst->__use = 0; in dst_init()
88 dst->lastuse = jiffies; in dst_init()
89 dst->flags = flags; in dst_init()
98 struct dst_entry *dst; in dst_alloc() local
105 dst = kmem_cache_alloc(ops->kmem_cachep, GFP_ATOMIC); in dst_alloc()
106 if (!dst) in dst_alloc()
109 dst_init(dst, ops, dev, initial_ref, initial_obsolete, flags); in dst_alloc()
111 return dst; in dst_alloc()
115 struct dst_entry *dst_destroy(struct dst_entry * dst) in dst_destroy() argument
122 if (dst->xfrm) { in dst_destroy()
123 struct xfrm_dst *xdst = (struct xfrm_dst *) dst; in dst_destroy()
128 if (!(dst->flags & DST_NOCOUNT)) in dst_destroy()
129 dst_entries_add(dst->ops, -1); in dst_destroy()
131 if (dst->ops->destroy) in dst_destroy()
132 dst->ops->destroy(dst); in dst_destroy()
133 if (dst->dev) in dst_destroy()
134 dev_put(dst->dev); in dst_destroy()
136 lwtstate_put(dst->lwtstate); in dst_destroy()
138 if (dst->flags & DST_METADATA) in dst_destroy()
139 metadata_dst_free((struct metadata_dst *)dst); in dst_destroy()
141 kmem_cache_free(dst->ops->kmem_cachep, dst); in dst_destroy()
143 dst = child; in dst_destroy()
144 if (dst) in dst_destroy()
145 dst_release_immediate(dst); in dst_destroy()
152 struct dst_entry *dst = container_of(head, struct dst_entry, rcu_head); in dst_destroy_rcu() local
154 dst = dst_destroy(dst); in dst_destroy_rcu()
166 void dst_dev_put(struct dst_entry *dst) in dst_dev_put() argument
168 struct net_device *dev = dst->dev; in dst_dev_put()
170 dst->obsolete = DST_OBSOLETE_DEAD; in dst_dev_put()
171 if (dst->ops->ifdown) in dst_dev_put()
172 dst->ops->ifdown(dst, dev, true); in dst_dev_put()
173 dst->input = dst_discard; in dst_dev_put()
174 dst->output = dst_discard_out; in dst_dev_put()
175 dst->dev = dev_net(dst->dev)->loopback_dev; in dst_dev_put()
176 dev_hold(dst->dev); in dst_dev_put()
181 void dst_release(struct dst_entry *dst) in dst_release() argument
183 if (dst) { in dst_release()
186 newrefcnt = atomic_dec_return(&dst->__refcnt); in dst_release()
189 __func__, dst, newrefcnt); in dst_release()
191 call_rcu(&dst->rcu_head, dst_destroy_rcu); in dst_release()
196 void dst_release_immediate(struct dst_entry *dst) in dst_release_immediate() argument
198 if (dst) { in dst_release_immediate()
201 newrefcnt = atomic_dec_return(&dst->__refcnt); in dst_release_immediate()
204 __func__, dst, newrefcnt); in dst_release_immediate()
206 dst_destroy(dst); in dst_release_immediate()
211 u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old) in dst_cow_metrics_generic() argument
223 prev = cmpxchg(&dst->_metrics, old, new); in dst_cow_metrics_generic()
241 void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old) in __dst_destroy_metrics_generic() argument
246 prev = cmpxchg(&dst->_metrics, old, new); in __dst_destroy_metrics_generic()
274 struct dst_entry *dst; in __metadata_dst_init() local
276 dst = &md_dst->dst; in __metadata_dst_init()
277 dst_init(dst, &md_dst_ops, NULL, 1, DST_OBSOLETE_NONE, in __metadata_dst_init()
280 dst->input = dst_md_discard; in __metadata_dst_init()
281 dst->output = dst_md_discard_out; in __metadata_dst_init()
283 memset(dst + 1, 0, sizeof(*md_dst) + optslen - sizeof(*dst)); in __metadata_dst_init()