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()
53 dst->ops = ops; in dst_init()
54 dst_init_metrics(dst, dst_default_metrics.metrics, true); in dst_init()
55 dst->expires = 0UL; in dst_init()
57 dst->xfrm = NULL; in dst_init()
59 dst->input = dst_discard; in dst_init()
60 dst->output = dst_discard_out; in dst_init()
61 dst->error = 0; in dst_init()
62 dst->obsolete = initial_obsolete; in dst_init()
63 dst->header_len = 0; in dst_init()
64 dst->trailer_len = 0; in dst_init()
66 dst->tclassid = 0; in dst_init()
68 dst->lwtstate = NULL; in dst_init()
69 atomic_set(&dst->__refcnt, initial_ref); in dst_init()
70 dst->__use = 0; in dst_init()
71 dst->lastuse = jiffies; in dst_init()
72 dst->flags = flags; in dst_init()
81 struct dst_entry *dst; in dst_alloc() local
92 dst = kmem_cache_alloc(ops->kmem_cachep, GFP_ATOMIC); in dst_alloc()
93 if (!dst) in dst_alloc()
96 dst_init(dst, ops, dev, initial_ref, initial_obsolete, flags); in dst_alloc()
98 return dst; in dst_alloc()
102 struct dst_entry *dst_destroy(struct dst_entry * dst) in dst_destroy() argument
109 if (dst->xfrm) { in dst_destroy()
110 struct xfrm_dst *xdst = (struct xfrm_dst *) dst; in dst_destroy()
115 if (!(dst->flags & DST_NOCOUNT)) in dst_destroy()
116 dst_entries_add(dst->ops, -1); in dst_destroy()
118 if (dst->ops->destroy) in dst_destroy()
119 dst->ops->destroy(dst); in dst_destroy()
120 dev_put(dst->dev); in dst_destroy()
122 lwtstate_put(dst->lwtstate); in dst_destroy()
124 if (dst->flags & DST_METADATA) in dst_destroy()
125 metadata_dst_free((struct metadata_dst *)dst); in dst_destroy()
127 kmem_cache_free(dst->ops->kmem_cachep, dst); in dst_destroy()
129 dst = child; in dst_destroy()
130 if (dst) in dst_destroy()
131 dst_release_immediate(dst); in dst_destroy()
138 struct dst_entry *dst = container_of(head, struct dst_entry, rcu_head); in dst_destroy_rcu() local
140 dst = dst_destroy(dst); in dst_destroy_rcu()
152 void dst_dev_put(struct dst_entry *dst) in dst_dev_put() argument
154 struct net_device *dev = dst->dev; in dst_dev_put()
156 dst->obsolete = DST_OBSOLETE_DEAD; in dst_dev_put()
157 if (dst->ops->ifdown) in dst_dev_put()
158 dst->ops->ifdown(dst, dev, true); in dst_dev_put()
159 dst->input = dst_discard; in dst_dev_put()
160 dst->output = dst_discard_out; in dst_dev_put()
161 dst->dev = blackhole_netdev; in dst_dev_put()
162 dev_hold(dst->dev); in dst_dev_put()
167 void dst_release(struct dst_entry *dst) in dst_release() argument
169 if (dst) { in dst_release()
172 newrefcnt = atomic_dec_return(&dst->__refcnt); in dst_release()
175 __func__, dst, newrefcnt); in dst_release()
177 call_rcu(&dst->rcu_head, dst_destroy_rcu); in dst_release()
182 void dst_release_immediate(struct dst_entry *dst) in dst_release_immediate() argument
184 if (dst) { in dst_release_immediate()
187 newrefcnt = atomic_dec_return(&dst->__refcnt); in dst_release_immediate()
190 __func__, dst, newrefcnt); in dst_release_immediate()
192 dst_destroy(dst); in dst_release_immediate()
197 u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old) in dst_cow_metrics_generic() argument
209 prev = cmpxchg(&dst->_metrics, old, new); in dst_cow_metrics_generic()
227 void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old) in __dst_destroy_metrics_generic() argument
232 prev = cmpxchg(&dst->_metrics, old, new); in __dst_destroy_metrics_generic()
238 struct dst_entry *dst_blackhole_check(struct dst_entry *dst, u32 cookie) in dst_blackhole_check() argument
243 u32 *dst_blackhole_cow_metrics(struct dst_entry *dst, unsigned long old) in dst_blackhole_cow_metrics() argument
248 struct neighbour *dst_blackhole_neigh_lookup(const struct dst_entry *dst, in dst_blackhole_neigh_lookup() argument
255 void dst_blackhole_update_pmtu(struct dst_entry *dst, struct sock *sk, in dst_blackhole_update_pmtu() argument
262 void dst_blackhole_redirect(struct dst_entry *dst, struct sock *sk, in dst_blackhole_redirect() argument
268 unsigned int dst_blackhole_mtu(const struct dst_entry *dst) in dst_blackhole_mtu() argument
270 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); in dst_blackhole_mtu()
272 return mtu ? : dst->dev->mtu; in dst_blackhole_mtu()
289 struct dst_entry *dst; in __metadata_dst_init() local
291 dst = &md_dst->dst; in __metadata_dst_init()
292 dst_init(dst, &dst_blackhole_ops, NULL, 1, DST_OBSOLETE_NONE, in __metadata_dst_init()
294 memset(dst + 1, 0, sizeof(*md_dst) + optslen - sizeof(*dst)); in __metadata_dst_init()