Lines Matching refs:dst

3  * net/dst.h	Protocol independent destination cache definitions.
48 /* A non-zero value of dst->obsolete forces by-hand validation
50 * dst layer to indicate that the entry has been forcefully
103 u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
112 static inline bool dst_metrics_read_only(const struct dst_entry *dst)
114 return dst->_metrics & DST_METRICS_READ_ONLY;
117 void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old);
119 static inline void dst_destroy_metrics_generic(struct dst_entry *dst)
121 unsigned long val = dst->_metrics;
123 __dst_destroy_metrics_generic(dst, val);
126 static inline u32 *dst_metrics_write_ptr(struct dst_entry *dst)
128 unsigned long p = dst->_metrics;
133 return dst->ops->cow_metrics(dst, p);
140 static inline void dst_init_metrics(struct dst_entry *dst,
144 dst->_metrics = ((unsigned long) src_metrics) |
159 static inline u32 *dst_metrics_ptr(struct dst_entry *dst)
161 return DST_METRICS_PTR(dst);
165 dst_metric_raw(const struct dst_entry *dst, const int metric)
167 u32 *p = DST_METRICS_PTR(dst);
173 dst_metric(const struct dst_entry *dst, const int metric)
178 return dst_metric_raw(dst, metric);
182 dst_metric_advmss(const struct dst_entry *dst)
184 u32 advmss = dst_metric_raw(dst, RTAX_ADVMSS);
187 advmss = dst->ops->default_advmss(dst);
192 static inline void dst_metric_set(struct dst_entry *dst, int metric, u32 val)
194 u32 *p = dst_metrics_write_ptr(dst);
207 dst_feature(const struct dst_entry *dst, u32 feature)
209 return dst_metric(dst, RTAX_FEATURES) & feature;
214 static inline u32 dst_mtu(const struct dst_entry *dst)
216 return INDIRECT_CALL_INET(dst->ops->mtu, ip6_mtu, ipv4_mtu, dst);
220 static inline unsigned long dst_metric_rtt(const struct dst_entry *dst, int metric)
222 return msecs_to_jiffies(dst_metric(dst, metric));
226 dst_allfrag(const struct dst_entry *dst)
228 int ret = dst_feature(dst, RTAX_FEATURE_ALLFRAG);
233 dst_metric_locked(const struct dst_entry *dst, int metric)
235 return dst_metric(dst, RTAX_LOCK) & (1 << metric);
238 static inline void dst_hold(struct dst_entry *dst)
245 WARN_ON(!rcuref_get(&dst->__rcuref));
248 static inline void dst_use_noref(struct dst_entry *dst, unsigned long time)
250 if (unlikely(time != dst->lastuse)) {
251 dst->__use++;
252 dst->lastuse = time;
256 static inline struct dst_entry *dst_clone(struct dst_entry *dst)
258 if (dst)
259 dst_hold(dst);
260 return dst;
263 void dst_release(struct dst_entry *dst);
265 void dst_release_immediate(struct dst_entry *dst);
274 * skb_dst_drop - drops skb dst
277 * Drops dst reference count if a reference was taken.
301 * dst_hold_safe - Take a reference on a dst if possible
302 * @dst: pointer to dst entry
305 * take a reference on a dst.
307 static inline bool dst_hold_safe(struct dst_entry *dst)
309 return rcuref_get(&dst->__rcuref);
313 * skb_dst_force - makes sure skb dst is refcounted
316 * If dst is not yet refcounted and not destroyed, grab a ref on it.
317 * Returns true if dst is refcounted.
322 struct dst_entry *dst = skb_dst(skb);
325 if (!dst_hold_safe(dst))
326 dst = NULL;
328 skb->_skb_refdst = (unsigned long)dst;
329 skb->slow_gro |= !!dst;
381 const struct dst_entry *dst;
383 dst = skb_dst(skb);
384 if (dst)
385 return dst->tclassid;
397 void dst_init(struct dst_entry *dst, struct dst_ops *ops,
400 struct dst_entry *dst_destroy(struct dst_entry *dst);
401 void dst_dev_put(struct dst_entry *dst);
403 static inline void dst_confirm(struct dst_entry *dst)
407 static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, const void *daddr)
409 struct neighbour *n = dst->ops->neigh_lookup(dst, NULL, daddr);
413 static inline struct neighbour *dst_neigh_lookup_skb(const struct dst_entry *dst,
418 if (WARN_ON_ONCE(!dst->ops->neigh_lookup))
421 n = dst->ops->neigh_lookup(dst, skb, NULL);
426 static inline void dst_confirm_neigh(const struct dst_entry *dst,
429 if (dst->ops->confirm_neigh)
430 dst->ops->confirm_neigh(dst, daddr);
435 struct dst_entry *dst = skb_dst(skb);
436 if (dst && dst->ops && dst->ops->link_failure)
437 dst->ops->link_failure(skb);
440 static inline void dst_set_expires(struct dst_entry *dst, int timeout)
447 if (dst->expires == 0 || time_before(expires, dst->expires))
448 dst->expires = expires;
476 static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
478 if (dst->obsolete)
479 dst = INDIRECT_CALL_INET(dst->ops->check, ip6_dst_check,
480 ipv4_dst_check, dst, cookie);
481 return dst;
519 static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
539 /* skb attached with this dst needs transformation if dst->xfrm is valid */
540 static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
542 return dst->xfrm;
548 struct dst_entry *dst = skb_dst(skb);
550 if (dst && dst->ops->update_pmtu)
551 dst->ops->update_pmtu(dst, NULL, skb, mtu, true);
554 /* update dst pmtu but not do neighbor confirm */
557 struct dst_entry *dst = skb_dst(skb);
559 if (dst && dst->ops->update_pmtu)
560 dst->ops->update_pmtu(dst, NULL, skb, mtu, false);
563 struct dst_entry *dst_blackhole_check(struct dst_entry *dst, u32 cookie);
564 void dst_blackhole_update_pmtu(struct dst_entry *dst, struct sock *sk,
566 void dst_blackhole_redirect(struct dst_entry *dst, struct sock *sk,
568 u32 *dst_blackhole_cow_metrics(struct dst_entry *dst, unsigned long old);
569 struct neighbour *dst_blackhole_neigh_lookup(const struct dst_entry *dst,
572 unsigned int dst_blackhole_mtu(const struct dst_entry *dst);