xref: /openbmc/linux/include/net/dst.h (revision 5170ae824ddf1988a63fb12cbedcff817634c444)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * net/dst.h	Protocol independent destination cache definitions.
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  * Authors:	Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
51da177e4SLinus Torvalds  *
61da177e4SLinus Torvalds  */
71da177e4SLinus Torvalds 
81da177e4SLinus Torvalds #ifndef _NET_DST_H
91da177e4SLinus Torvalds #define _NET_DST_H
101da177e4SLinus Torvalds 
1186393e52SAlexey Dobriyan #include <net/dst_ops.h>
1214c85021SArnaldo Carvalho de Melo #include <linux/netdevice.h>
131da177e4SLinus Torvalds #include <linux/rtnetlink.h>
141da177e4SLinus Torvalds #include <linux/rcupdate.h>
151da177e4SLinus Torvalds #include <linux/jiffies.h>
161da177e4SLinus Torvalds #include <net/neighbour.h>
171da177e4SLinus Torvalds #include <asm/processor.h>
181da177e4SLinus Torvalds 
191da177e4SLinus Torvalds /*
201da177e4SLinus Torvalds  * 0 - no debugging messages
211da177e4SLinus Torvalds  * 1 - rare events and bugs (default)
221da177e4SLinus Torvalds  * 2 - trace mode.
231da177e4SLinus Torvalds  */
241da177e4SLinus Torvalds #define RT_CACHE_DEBUG		0
251da177e4SLinus Torvalds 
261da177e4SLinus Torvalds #define DST_GC_MIN	(HZ/10)
271da177e4SLinus Torvalds #define DST_GC_INC	(HZ/2)
281da177e4SLinus Torvalds #define DST_GC_MAX	(120*HZ)
291da177e4SLinus Torvalds 
301da177e4SLinus Torvalds /* Each dst_entry has reference count and sits in some parent list(s).
311da177e4SLinus Torvalds  * When it is removed from parent list, it is "freed" (dst_free).
321da177e4SLinus Torvalds  * After this it enters dead state (dst->obsolete > 0) and if its refcnt
331da177e4SLinus Torvalds  * is zero, it can be destroyed immediately, otherwise it is added
341da177e4SLinus Torvalds  * to gc list and garbage collector periodically checks the refcnt.
351da177e4SLinus Torvalds  */
361da177e4SLinus Torvalds 
371da177e4SLinus Torvalds struct sk_buff;
381da177e4SLinus Torvalds 
39fd2c3ef7SEric Dumazet struct dst_entry {
401e19e02cSEric Dumazet 	struct rcu_head		rcu_head;
411da177e4SLinus Torvalds 	struct dst_entry	*child;
421da177e4SLinus Torvalds 	struct net_device       *dev;
43c4d54110SHerbert Xu 	short			error;
44c4d54110SHerbert Xu 	short			obsolete;
451da177e4SLinus Torvalds 	int			flags;
46c7d4426aSEric Dumazet #define DST_HOST		0x0001
47c7d4426aSEric Dumazet #define DST_NOXFRM		0x0002
48c7d4426aSEric Dumazet #define DST_NOPOLICY		0x0004
49c7d4426aSEric Dumazet #define DST_NOHASH		0x0008
50c7d4426aSEric Dumazet #define DST_NOCACHE		0x0010
511da177e4SLinus Torvalds 	unsigned long		expires;
521da177e4SLinus Torvalds 
531da177e4SLinus Torvalds 	unsigned short		header_len;	/* more space at head required */
541da177e4SLinus Torvalds 	unsigned short		trailer_len;	/* space to reserve at tail */
551da177e4SLinus Torvalds 
5669a73829SEric Dumazet 	unsigned int		rate_tokens;
57f1dd9c37SZhang Yanmin 	unsigned long		rate_last;	/* rate limiting for ICMP */
5869a73829SEric Dumazet 
59f1dd9c37SZhang Yanmin 	struct dst_entry	*path;
601da177e4SLinus Torvalds 
611da177e4SLinus Torvalds 	struct neighbour	*neighbour;
621da177e4SLinus Torvalds 	struct hh_cache		*hh;
63def8b4faSAlexey Dobriyan #ifdef CONFIG_XFRM
641da177e4SLinus Torvalds 	struct xfrm_state	*xfrm;
655635c10dSEric Dumazet #else
665635c10dSEric Dumazet 	void			*__pad1;
67def8b4faSAlexey Dobriyan #endif
681da177e4SLinus Torvalds 	int			(*input)(struct sk_buff*);
691da177e4SLinus Torvalds 	int			(*output)(struct sk_buff*);
701da177e4SLinus Torvalds 
711da177e4SLinus Torvalds 	struct  dst_ops	        *ops;
721da177e4SLinus Torvalds 
73defb3519SDavid S. Miller 	u32			_metrics[RTAX_MAX];
74f1dd9c37SZhang Yanmin 
75f1dd9c37SZhang Yanmin #ifdef CONFIG_NET_CLS_ROUTE
76f1dd9c37SZhang Yanmin 	__u32			tclassid;
775635c10dSEric Dumazet #else
785635c10dSEric Dumazet 	__u32			__pad2;
79f1dd9c37SZhang Yanmin #endif
80f1dd9c37SZhang Yanmin 
815635c10dSEric Dumazet 
825635c10dSEric Dumazet 	/*
835635c10dSEric Dumazet 	 * Align __refcnt to a 64 bytes alignment
845635c10dSEric Dumazet 	 * (L1_CACHE_SIZE would be too much)
855635c10dSEric Dumazet 	 */
865635c10dSEric Dumazet #ifdef CONFIG_64BIT
875635c10dSEric Dumazet 	long			__pad_to_align_refcnt[1];
885635c10dSEric Dumazet #endif
89f1dd9c37SZhang Yanmin 	/*
90f1dd9c37SZhang Yanmin 	 * __refcnt wants to be on a different cache line from
91f1dd9c37SZhang Yanmin 	 * input/output/ops or performance tanks badly
92f1dd9c37SZhang Yanmin 	 */
931e19e02cSEric Dumazet 	atomic_t		__refcnt;	/* client references	*/
941e19e02cSEric Dumazet 	int			__use;
95f1dd9c37SZhang Yanmin 	unsigned long		lastuse;
961e19e02cSEric Dumazet 	union {
971e19e02cSEric Dumazet 		struct dst_entry	*next;
981c31720aSEric Dumazet 		struct rtable __rcu	*rt_next;
991e19e02cSEric Dumazet 		struct rt6_info		*rt6_next;
100fc766e4cSEric Dumazet 		struct dn_route __rcu	*dn_next;
1011e19e02cSEric Dumazet 	};
1021da177e4SLinus Torvalds };
1031da177e4SLinus Torvalds 
1041da177e4SLinus Torvalds #ifdef __KERNEL__
1051da177e4SLinus Torvalds 
1061da177e4SLinus Torvalds static inline u32
107*5170ae82SDavid S. Miller dst_metric_raw(const struct dst_entry *dst, const int metric)
1081da177e4SLinus Torvalds {
109defb3519SDavid S. Miller 	return dst->_metrics[metric-1];
110defb3519SDavid S. Miller }
111defb3519SDavid S. Miller 
112*5170ae82SDavid S. Miller static inline u32
113*5170ae82SDavid S. Miller dst_metric(const struct dst_entry *dst, const int metric)
114*5170ae82SDavid S. Miller {
115*5170ae82SDavid S. Miller 	WARN_ON_ONCE(metric == RTAX_HOPLIMIT);
116*5170ae82SDavid S. Miller 	return dst_metric_raw(dst, metric);
117*5170ae82SDavid S. Miller }
118*5170ae82SDavid S. Miller 
119*5170ae82SDavid S. Miller static inline u32
120*5170ae82SDavid S. Miller dst_metric_hoplimit(const struct dst_entry *dst)
121*5170ae82SDavid S. Miller {
122*5170ae82SDavid S. Miller 	return dst_metric_raw(dst, RTAX_HOPLIMIT);
123*5170ae82SDavid S. Miller }
124*5170ae82SDavid S. Miller 
125defb3519SDavid S. Miller static inline void dst_metric_set(struct dst_entry *dst, int metric, u32 val)
126defb3519SDavid S. Miller {
127defb3519SDavid S. Miller 	dst->_metrics[metric-1] = val;
128defb3519SDavid S. Miller }
129defb3519SDavid S. Miller 
130defb3519SDavid S. Miller static inline void dst_import_metrics(struct dst_entry *dst, const u32 *src_metrics)
131defb3519SDavid S. Miller {
132defb3519SDavid S. Miller 	memcpy(dst->_metrics, src_metrics, RTAX_MAX * sizeof(u32));
133defb3519SDavid S. Miller }
134defb3519SDavid S. Miller 
135defb3519SDavid S. Miller static inline void dst_copy_metrics(struct dst_entry *dest, const struct dst_entry *src)
136defb3519SDavid S. Miller {
137defb3519SDavid S. Miller 	dst_import_metrics(dest, src->_metrics);
138defb3519SDavid S. Miller }
139defb3519SDavid S. Miller 
140defb3519SDavid S. Miller static inline u32 *dst_metrics_ptr(struct dst_entry *dst)
141defb3519SDavid S. Miller {
142defb3519SDavid S. Miller 	return dst->_metrics;
1431da177e4SLinus Torvalds }
1441da177e4SLinus Torvalds 
1450c3adfb8SGilad Ben-Yossef static inline u32
1460c3adfb8SGilad Ben-Yossef dst_feature(const struct dst_entry *dst, u32 feature)
1470c3adfb8SGilad Ben-Yossef {
148bb5b7c11SDavid S. Miller 	return dst_metric(dst, RTAX_FEATURES) & feature;
1490c3adfb8SGilad Ben-Yossef }
1500c3adfb8SGilad Ben-Yossef 
1511da177e4SLinus Torvalds static inline u32 dst_mtu(const struct dst_entry *dst)
1521da177e4SLinus Torvalds {
1531da177e4SLinus Torvalds 	u32 mtu = dst_metric(dst, RTAX_MTU);
1541da177e4SLinus Torvalds 	/*
1551da177e4SLinus Torvalds 	 * Alexey put it here, so ask him about it :)
1561da177e4SLinus Torvalds 	 */
1571da177e4SLinus Torvalds 	barrier();
1581da177e4SLinus Torvalds 	return mtu;
1591da177e4SLinus Torvalds }
1601da177e4SLinus Torvalds 
161c1e20f7cSStephen Hemminger /* RTT metrics are stored in milliseconds for user ABI, but used as jiffies */
162c1e20f7cSStephen Hemminger static inline unsigned long dst_metric_rtt(const struct dst_entry *dst, int metric)
163c1e20f7cSStephen Hemminger {
164c1e20f7cSStephen Hemminger 	return msecs_to_jiffies(dst_metric(dst, metric));
165c1e20f7cSStephen Hemminger }
166c1e20f7cSStephen Hemminger 
167c1e20f7cSStephen Hemminger static inline void set_dst_metric_rtt(struct dst_entry *dst, int metric,
168c1e20f7cSStephen Hemminger 				      unsigned long rtt)
169c1e20f7cSStephen Hemminger {
170defb3519SDavid S. Miller 	dst_metric_set(dst, metric, jiffies_to_msecs(rtt));
171c1e20f7cSStephen Hemminger }
172c1e20f7cSStephen Hemminger 
1731da177e4SLinus Torvalds static inline u32
1741da177e4SLinus Torvalds dst_allfrag(const struct dst_entry *dst)
1751da177e4SLinus Torvalds {
1760c3adfb8SGilad Ben-Yossef 	int ret = dst_feature(dst,  RTAX_FEATURE_ALLFRAG);
1771da177e4SLinus Torvalds 	/* Yes, _exactly_. This is paranoia. */
1781da177e4SLinus Torvalds 	barrier();
1791da177e4SLinus Torvalds 	return ret;
1801da177e4SLinus Torvalds }
1811da177e4SLinus Torvalds 
1821da177e4SLinus Torvalds static inline int
1831da177e4SLinus Torvalds dst_metric_locked(struct dst_entry *dst, int metric)
1841da177e4SLinus Torvalds {
1851da177e4SLinus Torvalds 	return dst_metric(dst, RTAX_LOCK) & (1<<metric);
1861da177e4SLinus Torvalds }
1871da177e4SLinus Torvalds 
1881da177e4SLinus Torvalds static inline void dst_hold(struct dst_entry * dst)
1891da177e4SLinus Torvalds {
1905635c10dSEric Dumazet 	/*
1915635c10dSEric Dumazet 	 * If your kernel compilation stops here, please check
1925635c10dSEric Dumazet 	 * __pad_to_align_refcnt declaration in struct dst_entry
1935635c10dSEric Dumazet 	 */
1945635c10dSEric Dumazet 	BUILD_BUG_ON(offsetof(struct dst_entry, __refcnt) & 63);
1951da177e4SLinus Torvalds 	atomic_inc(&dst->__refcnt);
1961da177e4SLinus Torvalds }
1971da177e4SLinus Torvalds 
19803f49f34SPavel Emelyanov static inline void dst_use(struct dst_entry *dst, unsigned long time)
19903f49f34SPavel Emelyanov {
20003f49f34SPavel Emelyanov 	dst_hold(dst);
20103f49f34SPavel Emelyanov 	dst->__use++;
20203f49f34SPavel Emelyanov 	dst->lastuse = time;
20303f49f34SPavel Emelyanov }
20403f49f34SPavel Emelyanov 
2057fee226aSEric Dumazet static inline void dst_use_noref(struct dst_entry *dst, unsigned long time)
2067fee226aSEric Dumazet {
2077fee226aSEric Dumazet 	dst->__use++;
2087fee226aSEric Dumazet 	dst->lastuse = time;
2097fee226aSEric Dumazet }
2107fee226aSEric Dumazet 
2111da177e4SLinus Torvalds static inline
2121da177e4SLinus Torvalds struct dst_entry * dst_clone(struct dst_entry * dst)
2131da177e4SLinus Torvalds {
2141da177e4SLinus Torvalds 	if (dst)
2151da177e4SLinus Torvalds 		atomic_inc(&dst->__refcnt);
2161da177e4SLinus Torvalds 	return dst;
2171da177e4SLinus Torvalds }
2181da177e4SLinus Torvalds 
2198d330868SIlpo Järvinen extern void dst_release(struct dst_entry *dst);
2207fee226aSEric Dumazet 
2217fee226aSEric Dumazet static inline void refdst_drop(unsigned long refdst)
2227fee226aSEric Dumazet {
2237fee226aSEric Dumazet 	if (!(refdst & SKB_DST_NOREF))
2247fee226aSEric Dumazet 		dst_release((struct dst_entry *)(refdst & SKB_DST_PTRMASK));
2257fee226aSEric Dumazet }
2267fee226aSEric Dumazet 
2277fee226aSEric Dumazet /**
2287fee226aSEric Dumazet  * skb_dst_drop - drops skb dst
2297fee226aSEric Dumazet  * @skb: buffer
2307fee226aSEric Dumazet  *
2317fee226aSEric Dumazet  * Drops dst reference count if a reference was taken.
2327fee226aSEric Dumazet  */
233adf30907SEric Dumazet static inline void skb_dst_drop(struct sk_buff *skb)
234adf30907SEric Dumazet {
2357fee226aSEric Dumazet 	if (skb->_skb_refdst) {
2367fee226aSEric Dumazet 		refdst_drop(skb->_skb_refdst);
2377fee226aSEric Dumazet 		skb->_skb_refdst = 0UL;
2387fee226aSEric Dumazet 	}
2397fee226aSEric Dumazet }
2407fee226aSEric Dumazet 
2417fee226aSEric Dumazet static inline void skb_dst_copy(struct sk_buff *nskb, const struct sk_buff *oskb)
2427fee226aSEric Dumazet {
2437fee226aSEric Dumazet 	nskb->_skb_refdst = oskb->_skb_refdst;
2447fee226aSEric Dumazet 	if (!(nskb->_skb_refdst & SKB_DST_NOREF))
2457fee226aSEric Dumazet 		dst_clone(skb_dst(nskb));
2467fee226aSEric Dumazet }
2477fee226aSEric Dumazet 
2487fee226aSEric Dumazet /**
2497fee226aSEric Dumazet  * skb_dst_force - makes sure skb dst is refcounted
2507fee226aSEric Dumazet  * @skb: buffer
2517fee226aSEric Dumazet  *
2527fee226aSEric Dumazet  * If dst is not yet refcounted, let's do it
2537fee226aSEric Dumazet  */
2547fee226aSEric Dumazet static inline void skb_dst_force(struct sk_buff *skb)
2557fee226aSEric Dumazet {
2567fee226aSEric Dumazet 	if (skb_dst_is_noref(skb)) {
2577fee226aSEric Dumazet 		WARN_ON(!rcu_read_lock_held());
2587fee226aSEric Dumazet 		skb->_skb_refdst &= ~SKB_DST_NOREF;
2597fee226aSEric Dumazet 		dst_clone(skb_dst(skb));
2607fee226aSEric Dumazet 	}
261adf30907SEric Dumazet }
2621da177e4SLinus Torvalds 
263d19d56ddSEric Dumazet 
264d19d56ddSEric Dumazet /**
265290b895eSEric Dumazet  *	__skb_tunnel_rx - prepare skb for rx reinsert
266290b895eSEric Dumazet  *	@skb: buffer
267290b895eSEric Dumazet  *	@dev: tunnel device
268290b895eSEric Dumazet  *
269290b895eSEric Dumazet  *	After decapsulation, packet is going to re-enter (netif_rx()) our stack,
270290b895eSEric Dumazet  *	so make some cleanups. (no accounting done)
271290b895eSEric Dumazet  */
272290b895eSEric Dumazet static inline void __skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev)
273290b895eSEric Dumazet {
274290b895eSEric Dumazet 	skb->dev = dev;
275290b895eSEric Dumazet 	skb->rxhash = 0;
276290b895eSEric Dumazet 	skb_set_queue_mapping(skb, 0);
277290b895eSEric Dumazet 	skb_dst_drop(skb);
278290b895eSEric Dumazet 	nf_reset(skb);
279290b895eSEric Dumazet }
280290b895eSEric Dumazet 
281290b895eSEric Dumazet /**
282d19d56ddSEric Dumazet  *	skb_tunnel_rx - prepare skb for rx reinsert
283d19d56ddSEric Dumazet  *	@skb: buffer
284d19d56ddSEric Dumazet  *	@dev: tunnel device
285d19d56ddSEric Dumazet  *
286d19d56ddSEric Dumazet  *	After decapsulation, packet is going to re-enter (netif_rx()) our stack,
287d19d56ddSEric Dumazet  *	so make some cleanups, and perform accounting.
288290b895eSEric Dumazet  *	Note: this accounting is not SMP safe.
289d19d56ddSEric Dumazet  */
290d19d56ddSEric Dumazet static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev)
291d19d56ddSEric Dumazet {
292d19d56ddSEric Dumazet 	/* TODO : stats should be SMP safe */
293d19d56ddSEric Dumazet 	dev->stats.rx_packets++;
294d19d56ddSEric Dumazet 	dev->stats.rx_bytes += skb->len;
295290b895eSEric Dumazet 	__skb_tunnel_rx(skb, dev);
296d19d56ddSEric Dumazet }
297d19d56ddSEric Dumazet 
2981da177e4SLinus Torvalds /* Children define the path of the packet through the
2991da177e4SLinus Torvalds  * Linux networking.  Thus, destinations are stackable.
3001da177e4SLinus Torvalds  */
3011da177e4SLinus Torvalds 
3028764ab2cSSteffen Klassert static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb)
3031da177e4SLinus Torvalds {
3048764ab2cSSteffen Klassert 	struct dst_entry *child = skb_dst(skb)->child;
3051da177e4SLinus Torvalds 
3068764ab2cSSteffen Klassert 	skb_dst_drop(skb);
3071da177e4SLinus Torvalds 	return child;
3081da177e4SLinus Torvalds }
3091da177e4SLinus Torvalds 
310352e512cSHerbert Xu extern int dst_discard(struct sk_buff *skb);
3111da177e4SLinus Torvalds extern void * dst_alloc(struct dst_ops * ops);
3121da177e4SLinus Torvalds extern void __dst_free(struct dst_entry * dst);
3131da177e4SLinus Torvalds extern struct dst_entry *dst_destroy(struct dst_entry * dst);
3141da177e4SLinus Torvalds 
3151da177e4SLinus Torvalds static inline void dst_free(struct dst_entry * dst)
3161da177e4SLinus Torvalds {
3171da177e4SLinus Torvalds 	if (dst->obsolete > 1)
3181da177e4SLinus Torvalds 		return;
3191da177e4SLinus Torvalds 	if (!atomic_read(&dst->__refcnt)) {
3201da177e4SLinus Torvalds 		dst = dst_destroy(dst);
3211da177e4SLinus Torvalds 		if (!dst)
3221da177e4SLinus Torvalds 			return;
3231da177e4SLinus Torvalds 	}
3241da177e4SLinus Torvalds 	__dst_free(dst);
3251da177e4SLinus Torvalds }
3261da177e4SLinus Torvalds 
3271da177e4SLinus Torvalds static inline void dst_rcu_free(struct rcu_head *head)
3281da177e4SLinus Torvalds {
3291da177e4SLinus Torvalds 	struct dst_entry *dst = container_of(head, struct dst_entry, rcu_head);
3301da177e4SLinus Torvalds 	dst_free(dst);
3311da177e4SLinus Torvalds }
3321da177e4SLinus Torvalds 
3331da177e4SLinus Torvalds static inline void dst_confirm(struct dst_entry *dst)
3341da177e4SLinus Torvalds {
3351da177e4SLinus Torvalds 	if (dst)
3361da177e4SLinus Torvalds 		neigh_confirm(dst->neighbour);
3371da177e4SLinus Torvalds }
3381da177e4SLinus Torvalds 
3391da177e4SLinus Torvalds static inline void dst_link_failure(struct sk_buff *skb)
3401da177e4SLinus Torvalds {
341adf30907SEric Dumazet 	struct dst_entry *dst = skb_dst(skb);
3421da177e4SLinus Torvalds 	if (dst && dst->ops && dst->ops->link_failure)
3431da177e4SLinus Torvalds 		dst->ops->link_failure(skb);
3441da177e4SLinus Torvalds }
3451da177e4SLinus Torvalds 
3461da177e4SLinus Torvalds static inline void dst_set_expires(struct dst_entry *dst, int timeout)
3471da177e4SLinus Torvalds {
3481da177e4SLinus Torvalds 	unsigned long expires = jiffies + timeout;
3491da177e4SLinus Torvalds 
3501da177e4SLinus Torvalds 	if (expires == 0)
3511da177e4SLinus Torvalds 		expires = 1;
3521da177e4SLinus Torvalds 
3531da177e4SLinus Torvalds 	if (dst->expires == 0 || time_before(expires, dst->expires))
3541da177e4SLinus Torvalds 		dst->expires = expires;
3551da177e4SLinus Torvalds }
3561da177e4SLinus Torvalds 
3571da177e4SLinus Torvalds /* Output packet to network from transport.  */
3581da177e4SLinus Torvalds static inline int dst_output(struct sk_buff *skb)
3591da177e4SLinus Torvalds {
360adf30907SEric Dumazet 	return skb_dst(skb)->output(skb);
3611da177e4SLinus Torvalds }
3621da177e4SLinus Torvalds 
3631da177e4SLinus Torvalds /* Input packet from network to transport.  */
3641da177e4SLinus Torvalds static inline int dst_input(struct sk_buff *skb)
3651da177e4SLinus Torvalds {
366adf30907SEric Dumazet 	return skb_dst(skb)->input(skb);
3671da177e4SLinus Torvalds }
3681da177e4SLinus Torvalds 
3691da177e4SLinus Torvalds static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
3701da177e4SLinus Torvalds {
3711da177e4SLinus Torvalds 	if (dst->obsolete)
3721da177e4SLinus Torvalds 		dst = dst->ops->check(dst, cookie);
3731da177e4SLinus Torvalds 	return dst;
3741da177e4SLinus Torvalds }
3751da177e4SLinus Torvalds 
3761da177e4SLinus Torvalds extern void		dst_init(void);
3771da177e4SLinus Torvalds 
378815f4e57SHerbert Xu /* Flags for xfrm_lookup flags argument. */
379815f4e57SHerbert Xu enum {
380815f4e57SHerbert Xu 	XFRM_LOOKUP_WAIT = 1 << 0,
3818b7817f3SHerbert Xu 	XFRM_LOOKUP_ICMP = 1 << 1,
382815f4e57SHerbert Xu };
383815f4e57SHerbert Xu 
3841da177e4SLinus Torvalds struct flowi;
3851da177e4SLinus Torvalds #ifndef CONFIG_XFRM
38652479b62SAlexey Dobriyan static inline int xfrm_lookup(struct net *net, struct dst_entry **dst_p,
38752479b62SAlexey Dobriyan 			      struct flowi *fl, struct sock *sk, int flags)
3881da177e4SLinus Torvalds {
3891da177e4SLinus Torvalds 	return 0;
3901da177e4SLinus Torvalds }
39152479b62SAlexey Dobriyan static inline int __xfrm_lookup(struct net *net, struct dst_entry **dst_p,
39252479b62SAlexey Dobriyan 				struct flowi *fl, struct sock *sk, int flags)
39314e50e57SDavid S. Miller {
39414e50e57SDavid S. Miller 	return 0;
39514e50e57SDavid S. Miller }
3961da177e4SLinus Torvalds #else
39752479b62SAlexey Dobriyan extern int xfrm_lookup(struct net *net, struct dst_entry **dst_p,
39852479b62SAlexey Dobriyan 		       struct flowi *fl, struct sock *sk, int flags);
39952479b62SAlexey Dobriyan extern int __xfrm_lookup(struct net *net, struct dst_entry **dst_p,
40052479b62SAlexey Dobriyan 			 struct flowi *fl, struct sock *sk, int flags);
4011da177e4SLinus Torvalds #endif
4021da177e4SLinus Torvalds #endif
4031da177e4SLinus Torvalds 
4041da177e4SLinus Torvalds #endif /* _NET_DST_H */
405