Lines Matching defs:dst
3 * net/dst.h Protocol independent destination cache definitions.
51 /* A non-zero value of dst->obsolete forces by-hand validation
53 * dst layer to indicate that the entry has been forcefully
106 u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
115 static inline bool dst_metrics_read_only(const struct dst_entry *dst)
117 return dst->_metrics & DST_METRICS_READ_ONLY;
120 void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old);
122 static inline void dst_destroy_metrics_generic(struct dst_entry *dst)
124 unsigned long val = dst->_metrics;
126 __dst_destroy_metrics_generic(dst, val);
129 static inline u32 *dst_metrics_write_ptr(struct dst_entry *dst)
131 unsigned long p = dst->_metrics;
136 return dst->ops->cow_metrics(dst, p);
143 static inline void dst_init_metrics(struct dst_entry *dst,
147 dst->_metrics = ((unsigned long) src_metrics) |
162 static inline u32 *dst_metrics_ptr(struct dst_entry *dst)
164 return DST_METRICS_PTR(dst);
168 dst_metric_raw(const struct dst_entry *dst, const int metric)
170 u32 *p = DST_METRICS_PTR(dst);
176 dst_metric(const struct dst_entry *dst, const int metric)
181 return dst_metric_raw(dst, metric);
185 dst_metric_advmss(const struct dst_entry *dst)
187 u32 advmss = dst_metric_raw(dst, RTAX_ADVMSS);
190 advmss = dst->ops->default_advmss(dst);
195 static inline void dst_metric_set(struct dst_entry *dst, int metric, u32 val)
197 u32 *p = dst_metrics_write_ptr(dst);
210 dst_feature(const struct dst_entry *dst, u32 feature)
212 return dst_metric(dst, RTAX_FEATURES) & feature;
217 static inline u32 dst_mtu(const struct dst_entry *dst)
219 return INDIRECT_CALL_INET(dst->ops->mtu, ip6_mtu, ipv4_mtu, dst);
223 static inline unsigned long dst_metric_rtt(const struct dst_entry *dst, int metric)
225 return msecs_to_jiffies(dst_metric(dst, metric));
229 dst_metric_locked(const struct dst_entry *dst, int metric)
231 return dst_metric(dst, RTAX_LOCK) & (1 << metric);
234 static inline void dst_hold(struct dst_entry *dst)
241 WARN_ON(!rcuref_get(&dst->__rcuref));
244 static inline void dst_use_noref(struct dst_entry *dst, unsigned long time)
246 if (unlikely(time != READ_ONCE(dst->lastuse))) {
247 dst->__use++;
248 WRITE_ONCE(dst->lastuse, time);
252 static inline struct dst_entry *dst_clone(struct dst_entry *dst)
254 if (dst)
255 dst_hold(dst);
256 return dst;
259 void dst_release(struct dst_entry *dst);
261 void dst_release_immediate(struct dst_entry *dst);
270 * skb_dst_drop - drops skb dst
273 * Drops dst reference count if a reference was taken.
297 * dst_hold_safe - Take a reference on a dst if possible
298 * @dst: pointer to dst entry
301 * take a reference on a dst.
303 static inline bool dst_hold_safe(struct dst_entry *dst)
305 return rcuref_get(&dst->__rcuref);
309 * skb_dst_force - makes sure skb dst is refcounted
312 * If dst is not yet refcounted and not destroyed, grab a ref on it.
313 * Returns: true if dst is refcounted.
318 struct dst_entry *dst = skb_dst(skb);
321 if (!dst_hold_safe(dst))
322 dst = NULL;
324 skb->_skb_refdst = (unsigned long)dst;
325 skb->slow_gro |= !!dst;
377 const struct dst_entry *dst;
379 dst = skb_dst(skb);
380 if (dst)
381 return dst->tclassid;
393 void dst_init(struct dst_entry *dst, struct dst_ops *ops,
396 void dst_dev_put(struct dst_entry *dst);
398 static inline void dst_confirm(struct dst_entry *dst)
402 static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, const void *daddr)
404 struct neighbour *n = dst->ops->neigh_lookup(dst, NULL, daddr);
408 static inline struct neighbour *dst_neigh_lookup_skb(const struct dst_entry *dst,
413 if (WARN_ON_ONCE(!dst->ops->neigh_lookup))
416 n = dst->ops->neigh_lookup(dst, skb, NULL);
421 static inline void dst_confirm_neigh(const struct dst_entry *dst,
424 if (dst->ops->confirm_neigh)
425 dst->ops->confirm_neigh(dst, daddr);
430 struct dst_entry *dst = skb_dst(skb);
431 if (dst && dst->ops && dst->ops->link_failure)
432 dst->ops->link_failure(skb);
435 static inline void dst_set_expires(struct dst_entry *dst, int timeout)
442 old = READ_ONCE(dst->expires);
445 WRITE_ONCE(dst->expires, expires);
448 static inline unsigned int dst_dev_overhead(struct dst_entry *dst,
451 if (likely(dst))
452 return LL_RESERVED_SPACE(dst->dev);
482 static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
484 if (READ_ONCE(dst->obsolete))
485 dst = INDIRECT_CALL_INET(dst->ops->check, ip6_dst_check,
486 ipv4_dst_check, dst, cookie);
487 return dst;
525 static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
545 /* skb attached with this dst needs transformation if dst->xfrm is valid */
546 static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
548 return dst->xfrm;
554 struct dst_entry *dst = skb_dst(skb);
556 if (dst && dst->ops->update_pmtu)
557 dst->ops->update_pmtu(dst, NULL, skb, mtu, true);
560 /* update dst pmtu but not do neighbor confirm */
563 struct dst_entry *dst = skb_dst(skb);
565 if (dst && dst->ops->update_pmtu)
566 dst->ops->update_pmtu(dst, NULL, skb, mtu, false);
569 static inline struct net_device *dst_dev(const struct dst_entry *dst)
571 return READ_ONCE(dst->dev);
574 static inline struct net_device *dst_dev_rcu(const struct dst_entry *dst)
576 return rcu_dereference(dst->dev_rcu);
579 static inline struct net *dst_dev_net_rcu(const struct dst_entry *dst)
581 return dev_net_rcu(dst_dev_rcu(dst));
604 struct dst_entry *dst_blackhole_check(struct dst_entry *dst, u32 cookie);
605 void dst_blackhole_update_pmtu(struct dst_entry *dst, struct sock *sk,
607 void dst_blackhole_redirect(struct dst_entry *dst, struct sock *sk,
609 u32 *dst_blackhole_cow_metrics(struct dst_entry *dst, unsigned long old);
610 struct neighbour *dst_blackhole_neigh_lookup(const struct dst_entry *dst,
613 unsigned int dst_blackhole_mtu(const struct dst_entry *dst);