7 #ifndef _NET_INETPEER_H
8 #define _NET_INETPEER_H
10 #include <linux/types.h>
14 #include <linux/rtnetlink.h>
69 #define INETPEER_BASE_BIT 0x1UL
71 static inline struct inet_peer *inetpeer_ptr(
unsigned long val)
81 val &= ~INETPEER_BASE_BIT;
85 static inline bool inetpeer_ptr_is_peer(
unsigned long val)
90 static inline void __inetpeer_ptr_set_peer(
unsigned long *val,
struct inet_peer *peer)
93 *val = (
unsigned long) peer;
96 static inline bool inetpeer_ptr_set_peer(
unsigned long *
ptr,
struct inet_peer *peer)
98 unsigned long val = (
unsigned long) peer;
99 unsigned long orig = *
ptr;
101 if (!(orig & INETPEER_BASE_BIT) ||
102 cmpxchg(ptr, orig, val) != orig)
107 static inline void inetpeer_init_ptr(
unsigned long *ptr,
struct inet_peer_base *base)
109 *ptr = (
unsigned long) base | INETPEER_BASE_BIT;
112 static inline void inetpeer_transfer_peer(
unsigned long *to,
unsigned long *
from)
114 unsigned long val = *
from;
117 if (inetpeer_ptr_is_peer(val)) {
118 struct inet_peer *peer = inetpeer_ptr(val);
127 #define INETPEER_METRICS_NEW (~(u32) 0)
129 static inline bool inet_metrics_new(
const struct inet_peer *
p)
145 daddr.addr.a4 = v4daddr;
172 static inline void inet_peer_refcheck(
const struct inet_peer *
p)
179 static inline int inet_getid(
struct inet_peer *p,
int more)
183 inet_peer_refcheck(p);