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()
52 netdev_hold(dev, &dst->dev_tracker, GFP_ATOMIC); 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 rcuref_init(&dst->__rcuref, 1); in dst_init()
70 INIT_LIST_HEAD(&dst->rt_uncached); 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
89 dst = kmem_cache_alloc(ops->kmem_cachep, GFP_ATOMIC); in dst_alloc()
90 if (!dst) in dst_alloc()
93 dst_init(dst, ops, dev, initial_obsolete, flags); in dst_alloc()
95 return dst; in dst_alloc()
99 static void dst_destroy(struct dst_entry *dst) in dst_destroy() argument
106 if (dst->xfrm) { in dst_destroy()
107 struct xfrm_dst *xdst = (struct xfrm_dst *) dst; in dst_destroy()
112 if (dst->ops->destroy) in dst_destroy()
113 dst->ops->destroy(dst); in dst_destroy()
114 netdev_put(dst->dev, &dst->dev_tracker); in dst_destroy()
116 lwtstate_put(dst->lwtstate); in dst_destroy()
118 if (dst->flags & DST_METADATA) in dst_destroy()
119 metadata_dst_free((struct metadata_dst *)dst); in dst_destroy()
121 kmem_cache_free(dst->ops->kmem_cachep, dst); in dst_destroy()
123 dst = child; in dst_destroy()
124 if (dst) in dst_destroy()
125 dst_release_immediate(dst); in dst_destroy()
130 struct dst_entry *dst = container_of(head, struct dst_entry, rcu_head); in dst_destroy_rcu() local
132 dst_destroy(dst); in dst_destroy_rcu()
144 void dst_dev_put(struct dst_entry *dst) in dst_dev_put() argument
146 struct net_device *dev = dst->dev; in dst_dev_put()
148 dst->obsolete = DST_OBSOLETE_DEAD; in dst_dev_put()
149 if (dst->ops->ifdown) in dst_dev_put()
150 dst->ops->ifdown(dst, dev); in dst_dev_put()
151 dst->input = dst_discard; in dst_dev_put()
152 dst->output = dst_discard_out; in dst_dev_put()
153 dst->dev = blackhole_netdev; in dst_dev_put()
154 netdev_ref_replace(dev, blackhole_netdev, &dst->dev_tracker, in dst_dev_put()
159 static void dst_count_dec(struct dst_entry *dst) in dst_count_dec() argument
161 if (!(dst->flags & DST_NOCOUNT)) in dst_count_dec()
162 dst_entries_add(dst->ops, -1); in dst_count_dec()
165 void dst_release(struct dst_entry *dst) in dst_release() argument
167 if (dst && rcuref_put(&dst->__rcuref)) { in dst_release()
168 dst_count_dec(dst); in dst_release()
169 call_rcu_hurry(&dst->rcu_head, dst_destroy_rcu); in dst_release()
174 void dst_release_immediate(struct dst_entry *dst) in dst_release_immediate() argument
176 if (dst && rcuref_put(&dst->__rcuref)) { in dst_release_immediate()
177 dst_count_dec(dst); in dst_release_immediate()
178 dst_destroy(dst); in dst_release_immediate()
183 u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old) in dst_cow_metrics_generic() argument
195 prev = cmpxchg(&dst->_metrics, old, new); in dst_cow_metrics_generic()
213 void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old) in __dst_destroy_metrics_generic() argument
218 prev = cmpxchg(&dst->_metrics, old, new); in __dst_destroy_metrics_generic()
224 struct dst_entry *dst_blackhole_check(struct dst_entry *dst, u32 cookie) in dst_blackhole_check() argument
229 u32 *dst_blackhole_cow_metrics(struct dst_entry *dst, unsigned long old) in dst_blackhole_cow_metrics() argument
234 struct neighbour *dst_blackhole_neigh_lookup(const struct dst_entry *dst, in dst_blackhole_neigh_lookup() argument
241 void dst_blackhole_update_pmtu(struct dst_entry *dst, struct sock *sk, in dst_blackhole_update_pmtu() argument
248 void dst_blackhole_redirect(struct dst_entry *dst, struct sock *sk, in dst_blackhole_redirect() argument
254 unsigned int dst_blackhole_mtu(const struct dst_entry *dst) in dst_blackhole_mtu() argument
256 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); in dst_blackhole_mtu()
258 return mtu ? : dst->dev->mtu; in dst_blackhole_mtu()
275 struct dst_entry *dst; in __metadata_dst_init() local
277 dst = &md_dst->dst; in __metadata_dst_init()
278 dst_init(dst, &dst_blackhole_ops, NULL, DST_OBSOLETE_NONE, in __metadata_dst_init()
280 memset(dst + 1, 0, sizeof(*md_dst) + optslen - sizeof(*dst)); in __metadata_dst_init()