dst.h (40a0c68ca9b49fb3e7292c1bae035ba5bcb27903) dst.h (a4023dd01a37f3a648ea028269f946cb55896337)
1/*
2 * net/dst.h Protocol independent destination cache definitions.
3 *
4 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
5 *
6 */
7
8#ifndef _NET_DST_H

--- 92 unchanged lines hidden (view full) ---

101 union {
102 struct dst_entry *next;
103 struct rtable __rcu *rt_next;
104 struct rt6_info *rt6_next;
105 struct dn_route __rcu *dn_next;
106 };
107};
108
1/*
2 * net/dst.h Protocol independent destination cache definitions.
3 *
4 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
5 *
6 */
7
8#ifndef _NET_DST_H

--- 92 unchanged lines hidden (view full) ---

101 union {
102 struct dst_entry *next;
103 struct rtable __rcu *rt_next;
104 struct rt6_info *rt6_next;
105 struct dn_route __rcu *dn_next;
106 };
107};
108
109extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
109u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
110extern const u32 dst_default_metrics[];
111
112#define DST_METRICS_READ_ONLY 0x1UL
113#define __DST_METRICS_PTR(Y) \
114 ((u32 *)((Y) & ~DST_METRICS_READ_ONLY))
115#define DST_METRICS_PTR(X) __DST_METRICS_PTR((X)->_metrics)
116
117static inline bool dst_metrics_read_only(const struct dst_entry *dst)
118{
119 return dst->_metrics & DST_METRICS_READ_ONLY;
120}
121
110extern const u32 dst_default_metrics[];
111
112#define DST_METRICS_READ_ONLY 0x1UL
113#define __DST_METRICS_PTR(Y) \
114 ((u32 *)((Y) & ~DST_METRICS_READ_ONLY))
115#define DST_METRICS_PTR(X) __DST_METRICS_PTR((X)->_metrics)
116
117static inline bool dst_metrics_read_only(const struct dst_entry *dst)
118{
119 return dst->_metrics & DST_METRICS_READ_ONLY;
120}
121
122extern void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old);
122void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old);
123
124static inline void dst_destroy_metrics_generic(struct dst_entry *dst)
125{
126 unsigned long val = dst->_metrics;
127 if (!(val & DST_METRICS_READ_ONLY))
128 __dst_destroy_metrics_generic(dst, val);
129}
130

--- 126 unchanged lines hidden (view full) ---

257
258static inline struct dst_entry *dst_clone(struct dst_entry *dst)
259{
260 if (dst)
261 atomic_inc(&dst->__refcnt);
262 return dst;
263}
264
123
124static inline void dst_destroy_metrics_generic(struct dst_entry *dst)
125{
126 unsigned long val = dst->_metrics;
127 if (!(val & DST_METRICS_READ_ONLY))
128 __dst_destroy_metrics_generic(dst, val);
129}
130

--- 126 unchanged lines hidden (view full) ---

257
258static inline struct dst_entry *dst_clone(struct dst_entry *dst)
259{
260 if (dst)
261 atomic_inc(&dst->__refcnt);
262 return dst;
263}
264
265extern void dst_release(struct dst_entry *dst);
265void dst_release(struct dst_entry *dst);
266
267static inline void refdst_drop(unsigned long refdst)
268{
269 if (!(refdst & SKB_DST_NOREF))
270 dst_release((struct dst_entry *)(refdst & SKB_DST_PTRMASK));
271}
272
273/**

--- 83 unchanged lines hidden (view full) ---

357static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb)
358{
359 struct dst_entry *child = dst_clone(skb_dst(skb)->child);
360
361 skb_dst_drop(skb);
362 return child;
363}
364
266
267static inline void refdst_drop(unsigned long refdst)
268{
269 if (!(refdst & SKB_DST_NOREF))
270 dst_release((struct dst_entry *)(refdst & SKB_DST_PTRMASK));
271}
272
273/**

--- 83 unchanged lines hidden (view full) ---

357static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb)
358{
359 struct dst_entry *child = dst_clone(skb_dst(skb)->child);
360
361 skb_dst_drop(skb);
362 return child;
363}
364
365extern int dst_discard(struct sk_buff *skb);
366extern void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
367 int initial_ref, int initial_obsolete,
368 unsigned short flags);
369extern void __dst_free(struct dst_entry *dst);
370extern struct dst_entry *dst_destroy(struct dst_entry *dst);
365int dst_discard(struct sk_buff *skb);
366void *dst_alloc(struct dst_ops *ops, struct net_device *dev, int initial_ref,
367 int initial_obsolete, unsigned short flags);
368void __dst_free(struct dst_entry *dst);
369struct dst_entry *dst_destroy(struct dst_entry *dst);
371
372static inline void dst_free(struct dst_entry *dst)
373{
374 if (dst->obsolete > 0)
375 return;
376 if (!atomic_read(&dst->__refcnt)) {
377 dst = dst_destroy(dst);
378 if (!dst)

--- 79 unchanged lines hidden (view full) ---

458
459static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
460{
461 if (dst->obsolete)
462 dst = dst->ops->check(dst, cookie);
463 return dst;
464}
465
370
371static inline void dst_free(struct dst_entry *dst)
372{
373 if (dst->obsolete > 0)
374 return;
375 if (!atomic_read(&dst->__refcnt)) {
376 dst = dst_destroy(dst);
377 if (!dst)

--- 79 unchanged lines hidden (view full) ---

457
458static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
459{
460 if (dst->obsolete)
461 dst = dst->ops->check(dst, cookie);
462 return dst;
463}
464
466extern void dst_init(void);
465void dst_init(void);
467
468/* Flags for xfrm_lookup flags argument. */
469enum {
470 XFRM_LOOKUP_ICMP = 1 << 0,
471};
472
473struct flowi;
474#ifndef CONFIG_XFRM
475static inline struct dst_entry *xfrm_lookup(struct net *net,
476 struct dst_entry *dst_orig,
477 const struct flowi *fl, struct sock *sk,
478 int flags)
479{
480 return dst_orig;
481}
482#else
466
467/* Flags for xfrm_lookup flags argument. */
468enum {
469 XFRM_LOOKUP_ICMP = 1 << 0,
470};
471
472struct flowi;
473#ifndef CONFIG_XFRM
474static inline struct dst_entry *xfrm_lookup(struct net *net,
475 struct dst_entry *dst_orig,
476 const struct flowi *fl, struct sock *sk,
477 int flags)
478{
479 return dst_orig;
480}
481#else
483extern struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
484 const struct flowi *fl, struct sock *sk,
485 int flags);
482struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
483 const struct flowi *fl, struct sock *sk,
484 int flags);
486#endif
487
488#endif /* _NET_DST_H */
485#endif
486
487#endif /* _NET_DST_H */