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_metric_locked(const struct dst_entry *dst, int metric)
228 return dst_metric(dst, RTAX_LOCK) & (1 << metric);
231 static inline void dst_hold(struct dst_entry *dst)
238 WARN_ON(!rcuref_get(&dst->__rcuref));
241 static inline void dst_use_noref(struct dst_entry *dst, unsigned long time)
243 if (unlikely(time != dst->lastuse)) {
244 dst->__use++;
245 dst->lastuse = time;
249 static inline struct dst_entry *dst_clone(struct dst_entry *dst)
251 if (dst)
252 dst_hold(dst);
253 return dst;
256 void dst_release(struct dst_entry *dst);
258 void dst_release_immediate(struct dst_entry *dst);
267 * skb_dst_drop - drops skb dst
270 * Drops dst reference count if a reference was taken.
294 * dst_hold_safe - Take a reference on a dst if possible
295 * @dst: pointer to dst entry
298 * take a reference on a dst.
300 static inline bool dst_hold_safe(struct dst_entry *dst)
302 return rcuref_get(&dst->__rcuref);
306 * skb_dst_force - makes sure skb dst is refcounted
309 * If dst is not yet refcounted and not destroyed, grab a ref on it.
310 * Returns true if dst is refcounted.
315 struct dst_entry *dst = skb_dst(skb);
318 if (!dst_hold_safe(dst))
319 dst = NULL;
321 skb->_skb_refdst = (unsigned long)dst;
322 skb->slow_gro |= !!dst;
374 const struct dst_entry *dst;
376 dst = skb_dst(skb);
377 if (dst)
378 return dst->tclassid;
390 void dst_init(struct dst_entry *dst, struct dst_ops *ops,
393 void dst_dev_put(struct dst_entry *dst);
395 static inline void dst_confirm(struct dst_entry *dst)
399 static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, const void *daddr)
401 struct neighbour *n = dst->ops->neigh_lookup(dst, NULL, daddr);
405 static inline struct neighbour *dst_neigh_lookup_skb(const struct dst_entry *dst,
410 if (WARN_ON_ONCE(!dst->ops->neigh_lookup))
413 n = dst->ops->neigh_lookup(dst, skb, NULL);
418 static inline void dst_confirm_neigh(const struct dst_entry *dst,
421 if (dst->ops->confirm_neigh)
422 dst->ops->confirm_neigh(dst, daddr);
427 struct dst_entry *dst = skb_dst(skb);
428 if (dst && dst->ops && dst->ops->link_failure)
429 dst->ops->link_failure(skb);
432 static inline void dst_set_expires(struct dst_entry *dst, int timeout)
439 if (dst->expires == 0 || time_before(expires, dst->expires))
440 dst->expires = expires;
468 static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
470 if (dst->obsolete)
471 dst = INDIRECT_CALL_INET(dst->ops->check, ip6_dst_check,
472 ipv4_dst_check, dst, cookie);
473 return dst;
511 static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
531 /* skb attached with this dst needs transformation if dst->xfrm is valid */
532 static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
534 return dst->xfrm;
540 struct dst_entry *dst = skb_dst(skb);
542 if (dst && dst->ops->update_pmtu)
543 dst->ops->update_pmtu(dst, NULL, skb, mtu, true);
546 /* update dst pmtu but not do neighbor confirm */
549 struct dst_entry *dst = skb_dst(skb);
551 if (dst && dst->ops->update_pmtu)
552 dst->ops->update_pmtu(dst, NULL, skb, mtu, false);
555 struct dst_entry *dst_blackhole_check(struct dst_entry *dst, u32 cookie);
556 void dst_blackhole_update_pmtu(struct dst_entry *dst, struct sock *sk,
558 void dst_blackhole_redirect(struct dst_entry *dst, struct sock *sk,
560 u32 *dst_blackhole_cow_metrics(struct dst_entry *dst, unsigned long old);
561 struct neighbour *dst_blackhole_neigh_lookup(const struct dst_entry *dst,
564 unsigned int dst_blackhole_mtu(const struct dst_entry *dst);