diff options
Diffstat (limited to 'include/net/inet_sock.h')
-rw-r--r-- | include/net/inet_sock.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index a3431a4ff9cc..0a671c32d6b9 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -290,9 +290,32 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to, | |||
290 | #endif | 290 | #endif |
291 | 291 | ||
292 | int inet_sk_rebuild_header(struct sock *sk); | 292 | int inet_sk_rebuild_header(struct sock *sk); |
293 | void inet_sk_set_state(struct sock *sk, int state); | 293 | |
294 | /** | ||
295 | * inet_sk_state_load - read sk->sk_state for lockless contexts | ||
296 | * @sk: socket pointer | ||
297 | * | ||
298 | * Paired with inet_sk_state_store(). Used in places we don't hold socket lock: | ||
299 | * tcp_diag_get_info(), tcp_get_info(), tcp_poll(), get_tcp4_sock() ... | ||
300 | */ | ||
301 | static inline int inet_sk_state_load(const struct sock *sk) | ||
302 | { | ||
303 | /* state change might impact lockless readers. */ | ||
304 | return smp_load_acquire(&sk->sk_state); | ||
305 | } | ||
306 | |||
307 | /** | ||
308 | * inet_sk_state_store - update sk->sk_state | ||
309 | * @sk: socket pointer | ||
310 | * @newstate: new state | ||
311 | * | ||
312 | * Paired with inet_sk_state_load(). Should be used in contexts where | ||
313 | * state change might impact lockless readers. | ||
314 | */ | ||
294 | void inet_sk_state_store(struct sock *sk, int newstate); | 315 | void inet_sk_state_store(struct sock *sk, int newstate); |
295 | 316 | ||
317 | void inet_sk_set_state(struct sock *sk, int state); | ||
318 | |||
296 | static inline unsigned int __inet_ehashfn(const __be32 laddr, | 319 | static inline unsigned int __inet_ehashfn(const __be32 laddr, |
297 | const __u16 lport, | 320 | const __u16 lport, |
298 | const __be32 faddr, | 321 | const __be32 faddr, |