diff options
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r-- | include/net/tcp.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 1421b02a790..a8cb00c0c6d 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -913,15 +913,21 @@ static inline bool tcp_in_initial_slowstart(const struct tcp_sock *tp) | |||
913 | return tp->snd_ssthresh >= TCP_INFINITE_SSTHRESH; | 913 | return tp->snd_ssthresh >= TCP_INFINITE_SSTHRESH; |
914 | } | 914 | } |
915 | 915 | ||
916 | static inline bool tcp_in_cwnd_reduction(const struct sock *sk) | ||
917 | { | ||
918 | return (TCPF_CA_CWR | TCPF_CA_Recovery) & | ||
919 | (1 << inet_csk(sk)->icsk_ca_state); | ||
920 | } | ||
921 | |||
916 | /* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. | 922 | /* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. |
917 | * The exception is rate halving phase, when cwnd is decreasing towards | 923 | * The exception is cwnd reduction phase, when cwnd is decreasing towards |
918 | * ssthresh. | 924 | * ssthresh. |
919 | */ | 925 | */ |
920 | static inline __u32 tcp_current_ssthresh(const struct sock *sk) | 926 | static inline __u32 tcp_current_ssthresh(const struct sock *sk) |
921 | { | 927 | { |
922 | const struct tcp_sock *tp = tcp_sk(sk); | 928 | const struct tcp_sock *tp = tcp_sk(sk); |
923 | 929 | ||
924 | if ((1 << inet_csk(sk)->icsk_ca_state) & (TCPF_CA_CWR | TCPF_CA_Recovery)) | 930 | if (tcp_in_cwnd_reduction(sk)) |
925 | return tp->snd_ssthresh; | 931 | return tp->snd_ssthresh; |
926 | else | 932 | else |
927 | return max(tp->snd_ssthresh, | 933 | return max(tp->snd_ssthresh, |