Merge tag 'x86_mm_for_v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
[linux-2.6-microblaze.git] / net / ipv4 / tcp_output.c
index bf48cd7..9901176 100644 (file)
@@ -1880,7 +1880,8 @@ static void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited)
         * window, and remember whether we were cwnd-limited then.
         */
        if (!before(tp->snd_una, tp->max_packets_seq) ||
-           tp->packets_out > tp->max_packets_out) {
+           tp->packets_out > tp->max_packets_out ||
+           is_cwnd_limited) {
                tp->max_packets_out = tp->packets_out;
                tp->max_packets_seq = tp->snd_nxt;
                tp->is_cwnd_limited = is_cwnd_limited;
@@ -2702,6 +2703,10 @@ repair:
        else
                tcp_chrono_stop(sk, TCP_CHRONO_RWND_LIMITED);
 
+       is_cwnd_limited |= (tcp_packets_in_flight(tp) >= tp->snd_cwnd);
+       if (likely(sent_pkts || is_cwnd_limited))
+               tcp_cwnd_validate(sk, is_cwnd_limited);
+
        if (likely(sent_pkts)) {
                if (tcp_in_cwnd_reduction(sk))
                        tp->prr_out += sent_pkts;
@@ -2709,8 +2714,6 @@ repair:
                /* Send one loss probe per tail loss episode. */
                if (push_one != 2)
                        tcp_schedule_loss_probe(sk, false);
-               is_cwnd_limited |= (tcp_packets_in_flight(tp) >= tp->snd_cwnd);
-               tcp_cwnd_validate(sk, is_cwnd_limited);
                return false;
        }
        return !tp->packets_out && !tcp_write_queue_empty(sk);