Lines Matching refs:dst
3 * net/dst.h Protocol independent destination cache definitions.
46 /* A non-zero value of dst->obsolete forces by-hand validation
48 * dst layer to indicate that the entry has been forcefully
87 u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
96 static inline bool dst_metrics_read_only(const struct dst_entry *dst)
98 return dst->_metrics & DST_METRICS_READ_ONLY;
101 void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old);
103 static inline void dst_destroy_metrics_generic(struct dst_entry *dst)
105 unsigned long val = dst->_metrics;
107 __dst_destroy_metrics_generic(dst, val);
110 static inline u32 *dst_metrics_write_ptr(struct dst_entry *dst)
112 unsigned long p = dst->_metrics;
117 return dst->ops->cow_metrics(dst, p);
124 static inline void dst_init_metrics(struct dst_entry *dst,
128 dst->_metrics = ((unsigned long) src_metrics) |
143 static inline u32 *dst_metrics_ptr(struct dst_entry *dst)
145 return DST_METRICS_PTR(dst);
149 dst_metric_raw(const struct dst_entry *dst, const int metric)
151 u32 *p = DST_METRICS_PTR(dst);
157 dst_metric(const struct dst_entry *dst, const int metric)
162 return dst_metric_raw(dst, metric);
166 dst_metric_advmss(const struct dst_entry *dst)
168 u32 advmss = dst_metric_raw(dst, RTAX_ADVMSS);
171 advmss = dst->ops->default_advmss(dst);
176 static inline void dst_metric_set(struct dst_entry *dst, int metric, u32 val)
178 u32 *p = dst_metrics_write_ptr(dst);
191 dst_feature(const struct dst_entry *dst, u32 feature)
193 return dst_metric(dst, RTAX_FEATURES) & feature;
196 static inline u32 dst_mtu(const struct dst_entry *dst)
198 return dst->ops->mtu(dst);
202 static inline unsigned long dst_metric_rtt(const struct dst_entry *dst, int metric)
204 return msecs_to_jiffies(dst_metric(dst, metric));
208 dst_allfrag(const struct dst_entry *dst)
210 int ret = dst_feature(dst, RTAX_FEATURE_ALLFRAG);
215 dst_metric_locked(const struct dst_entry *dst, int metric)
217 return dst_metric(dst, RTAX_LOCK) & (1 << metric);
220 static inline void dst_hold(struct dst_entry *dst)
227 WARN_ON(atomic_inc_not_zero(&dst->__refcnt) == 0);
230 static inline void dst_use_noref(struct dst_entry *dst, unsigned long time)
232 if (unlikely(time != dst->lastuse)) {
233 dst->__use++;
234 dst->lastuse = time;
238 static inline struct dst_entry *dst_clone(struct dst_entry *dst)
240 if (dst)
241 dst_hold(dst);
242 return dst;
245 void dst_release(struct dst_entry *dst);
247 void dst_release_immediate(struct dst_entry *dst);
256 * skb_dst_drop - drops skb dst
259 * Drops dst reference count if a reference was taken.
282 * dst_hold_safe - Take a reference on a dst if possible
283 * @dst: pointer to dst entry
286 * take a reference on a dst.
288 static inline bool dst_hold_safe(struct dst_entry *dst)
290 return atomic_inc_not_zero(&dst->__refcnt);
294 * skb_dst_force - makes sure skb dst is refcounted
297 * If dst is not yet refcounted and not destroyed, grab a ref on it.
298 * Returns true if dst is refcounted.
303 struct dst_entry *dst = skb_dst(skb);
306 if (!dst_hold_safe(dst))
307 dst = NULL;
309 skb->_skb_refdst = (unsigned long)dst;
361 const struct dst_entry *dst;
363 dst = skb_dst(skb);
364 if (dst)
365 return dst->tclassid;
377 void dst_init(struct dst_entry *dst, struct dst_ops *ops,
380 struct dst_entry *dst_destroy(struct dst_entry *dst);
381 void dst_dev_put(struct dst_entry *dst);
383 static inline void dst_confirm(struct dst_entry *dst)
387 static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, const void *daddr)
389 struct neighbour *n = dst->ops->neigh_lookup(dst, NULL, daddr);
393 static inline struct neighbour *dst_neigh_lookup_skb(const struct dst_entry *dst,
399 * metadata in the dst pointer of skb. Hence a pointer check of
402 if (dst->ops->neigh_lookup)
403 n = dst->ops->neigh_lookup(dst, skb, NULL);
408 static inline void dst_confirm_neigh(const struct dst_entry *dst,
411 if (dst->ops->confirm_neigh)
412 dst->ops->confirm_neigh(dst, daddr);
417 struct dst_entry *dst = skb_dst(skb);
418 if (dst && dst->ops && dst->ops->link_failure)
419 dst->ops->link_failure(skb);
422 static inline void dst_set_expires(struct dst_entry *dst, int timeout)
429 if (dst->expires == 0 || time_before(expires, dst->expires))
430 dst->expires = expires;
445 static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
447 if (dst->obsolete)
448 dst = dst->ops->check(dst, cookie);
449 return dst;
487 static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
507 /* skb attached with this dst needs transformation if dst->xfrm is valid */
508 static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
510 return dst->xfrm;
516 struct dst_entry *dst = skb_dst(skb);
518 if (dst && dst->ops->update_pmtu)
519 dst->ops->update_pmtu(dst, NULL, skb, mtu, true);
522 /* update dst pmtu but not do neighbor confirm */
525 struct dst_entry *dst = skb_dst(skb);
527 if (dst && dst->ops->update_pmtu)
528 dst->ops->update_pmtu(dst, NULL, skb, mtu, false);
531 struct dst_entry *dst_blackhole_check(struct dst_entry *dst, u32 cookie);
532 void dst_blackhole_update_pmtu(struct dst_entry *dst, struct sock *sk,
534 void dst_blackhole_redirect(struct dst_entry *dst, struct sock *sk,
536 u32 *dst_blackhole_cow_metrics(struct dst_entry *dst, unsigned long old);
537 struct neighbour *dst_blackhole_neigh_lookup(const struct dst_entry *dst,
540 unsigned int dst_blackhole_mtu(const struct dst_entry *dst);