diff options
Diffstat (limited to 'include/net/tcp.h')
| -rw-r--r-- | include/net/tcp.h | 31 | 
1 files changed, 24 insertions, 7 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 226bce6d1e8c..0ca972ebd3dd 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1509,25 +1509,38 @@ void tcp_leave_memory_pressure(struct sock *sk);  static inline int keepalive_intvl_when(const struct tcp_sock *tp)  {  	struct net *net = sock_net((struct sock *)tp); +	int val; -	return tp->keepalive_intvl ? : -		READ_ONCE(net->ipv4.sysctl_tcp_keepalive_intvl); +	/* Paired with WRITE_ONCE() in tcp_sock_set_keepintvl() +	 * and do_tcp_setsockopt(). +	 */ +	val = READ_ONCE(tp->keepalive_intvl); + +	return val ? : READ_ONCE(net->ipv4.sysctl_tcp_keepalive_intvl);  }  static inline int keepalive_time_when(const struct tcp_sock *tp)  {  	struct net *net = sock_net((struct sock *)tp); +	int val; -	return tp->keepalive_time ? : -		READ_ONCE(net->ipv4.sysctl_tcp_keepalive_time); +	/* Paired with WRITE_ONCE() in tcp_sock_set_keepidle_locked() */ +	val = READ_ONCE(tp->keepalive_time); + +	return val ? : READ_ONCE(net->ipv4.sysctl_tcp_keepalive_time);  }  static inline int keepalive_probes(const struct tcp_sock *tp)  {  	struct net *net = sock_net((struct sock *)tp); +	int val; -	return tp->keepalive_probes ? : -		READ_ONCE(net->ipv4.sysctl_tcp_keepalive_probes); +	/* Paired with WRITE_ONCE() in tcp_sock_set_keepcnt() +	 * and do_tcp_setsockopt(). +	 */ +	val = READ_ONCE(tp->keepalive_probes); + +	return val ? : READ_ONCE(net->ipv4.sysctl_tcp_keepalive_probes);  }  static inline u32 keepalive_time_elapsed(const struct tcp_sock *tp) @@ -2048,7 +2061,11 @@ void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, __be32 daddr);  static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp)  {  	struct net *net = sock_net((struct sock *)tp); -	return tp->notsent_lowat ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat); +	u32 val; + +	val = READ_ONCE(tp->notsent_lowat); + +	return val ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat);  }  bool tcp_stream_memory_free(const struct sock *sk, int wake);  |