diff options
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index bbf7c2cf15b4..7f89e4ba18d1 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -2226,6 +2226,31 @@ static inline bool sk_listener(const struct sock *sk) | |||
2226 | return (1 << sk->sk_state) & (TCPF_LISTEN | TCPF_NEW_SYN_RECV); | 2226 | return (1 << sk->sk_state) & (TCPF_LISTEN | TCPF_NEW_SYN_RECV); |
2227 | } | 2227 | } |
2228 | 2228 | ||
2229 | /** | ||
2230 | * sk_state_load - read sk->sk_state for lockless contexts | ||
2231 | * @sk: socket pointer | ||
2232 | * | ||
2233 | * Paired with sk_state_store(). Used in places we do not hold socket lock : | ||
2234 | * tcp_diag_get_info(), tcp_get_info(), tcp_poll(), get_tcp4_sock() ... | ||
2235 | */ | ||
2236 | static inline int sk_state_load(const struct sock *sk) | ||
2237 | { | ||
2238 | return smp_load_acquire(&sk->sk_state); | ||
2239 | } | ||
2240 | |||
2241 | /** | ||
2242 | * sk_state_store - update sk->sk_state | ||
2243 | * @sk: socket pointer | ||
2244 | * @newstate: new state | ||
2245 | * | ||
2246 | * Paired with sk_state_load(). Should be used in contexts where | ||
2247 | * state change might impact lockless readers. | ||
2248 | */ | ||
2249 | static inline void sk_state_store(struct sock *sk, int newstate) | ||
2250 | { | ||
2251 | smp_store_release(&sk->sk_state, newstate); | ||
2252 | } | ||
2253 | |||
2229 | void sock_enable_timestamp(struct sock *sk, int flag); | 2254 | void sock_enable_timestamp(struct sock *sk, int flag); |
2230 | int sock_get_timestamp(struct sock *, struct timeval __user *); | 2255 | int sock_get_timestamp(struct sock *, struct timeval __user *); |
2231 | int sock_get_timestampns(struct sock *, struct timespec __user *); | 2256 | int sock_get_timestampns(struct sock *, struct timespec __user *); |