12 #include <linux/netdevice.h>
13 #include <linux/rtnetlink.h>
18 #include <asm/processor.h>
20 #define DST_GC_MIN (HZ/10)
21 #define DST_GC_INC (HZ/2)
22 #define DST_GC_MAX (120*HZ)
55 #define DST_HOST 0x0001
56 #define DST_NOXFRM 0x0002
57 #define DST_NOPOLICY 0x0004
58 #define DST_NOHASH 0x0008
59 #define DST_NOCACHE 0x0010
60 #define DST_NOCOUNT 0x0020
61 #define DST_NOPEER 0x0040
62 #define DST_FAKE_RTABLE 0x0080
63 #define DST_XFRM_TUNNEL 0x0100
78 #define DST_OBSOLETE_NONE 0
79 #define DST_OBSOLETE_DEAD 2
80 #define DST_OBSOLETE_FORCE_CHK -1
81 #define DST_OBSOLETE_KILL -2
84 #ifdef CONFIG_IP_ROUTE_CLASSID
95 long __pad_to_align_refcnt[2];
115 #define DST_METRICS_READ_ONLY 0x1UL
116 #define __DST_METRICS_PTR(Y) \
117 ((u32 *)((Y) & ~DST_METRICS_READ_ONLY))
118 #define DST_METRICS_PTR(X) __DST_METRICS_PTR((X)->_metrics)
120 static inline bool dst_metrics_read_only(
const struct dst_entry *
dst)
127 static inline void dst_destroy_metrics_generic(
struct dst_entry *
dst)
134 static inline u32 *dst_metrics_write_ptr(
struct dst_entry *dst)
141 return dst->
ops->cow_metrics(dst, p);
148 static inline void dst_init_metrics(
struct dst_entry *dst,
149 const u32 *src_metrics,
153 (read_only ? DST_METRICS_READ_ONLY : 0);
158 u32 *dst_metrics = dst_metrics_write_ptr(dest);
167 static inline u32 *dst_metrics_ptr(
struct dst_entry *dst)
173 dst_metric_raw(
const struct dst_entry *dst,
const int metric)
181 dst_metric(
const struct dst_entry *dst,
const int metric)
186 return dst_metric_raw(dst, metric);
190 dst_metric_advmss(
const struct dst_entry *dst)
195 advmss = dst->
ops->default_advmss(dst);
200 static inline void dst_metric_set(
struct dst_entry *dst,
int metric,
u32 val)
202 u32 *p = dst_metrics_write_ptr(dst);
216 return dst->
ops->mtu(dst);
220 static inline unsigned long dst_metric_rtt(
const struct dst_entry *dst,
int metric)
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)
248 static inline void dst_use(
struct dst_entry *dst,
unsigned long time)
255 static inline void dst_use_noref(
struct dst_entry *dst,
unsigned long time)
270 static inline void refdst_drop(
unsigned long refdst)
272 if (!(refdst & SKB_DST_NOREF))
282 static inline void skb_dst_drop(
struct sk_buff *
skb)
290 static inline void skb_dst_copy(
struct sk_buff *nskb,
const struct sk_buff *oskb)
294 dst_clone(skb_dst(nskb));
303 static inline void skb_dst_force(
struct sk_buff *skb)
305 if (skb_dst_is_noref(skb)) {
306 WARN_ON(!rcu_read_lock_held());
308 dst_clone(skb_dst(skb));
332 skb_set_queue_mapping(skb, 0);
349 dev->
stats.rx_packets++;
351 __skb_tunnel_rx(skb, dev);
368 int initial_ref,
int initial_obsolete,
369 unsigned short flags);
373 static inline void dst_free(
struct dst_entry *dst)
391 static inline void dst_confirm(
struct dst_entry *dst)
412 return neigh_hh_output(hh, skb);
419 return dst->
ops->neigh_lookup(dst,
NULL, daddr);
425 return dst->
ops->neigh_lookup(dst, skb,
NULL);
428 static inline void dst_link_failure(
struct sk_buff *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)
447 static inline int dst_output(
struct sk_buff *skb)
449 return skb_dst(skb)->output(skb);
453 static inline int dst_input(
struct sk_buff *skb)
455 return skb_dst(skb)->input(skb);
461 dst = dst->
ops->check(dst, cookie);