]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/tcp_input.c
tcp: Partial hint clearing has again become meaningless
[linux-2.6-omap-h63xx.git] / net / ipv4 / tcp_input.c
index 9da9f19ece8adfc303918709d0da4e59c1b9b910..7306bfb16cdbbc4a6424efe8683f14975342cfa5 100644 (file)
@@ -811,12 +811,25 @@ void tcp_update_metrics(struct sock *sk)
        }
 }
 
+/* Numbers are taken from RFC3390.
+ *
+ * John Heffner states:
+ *
+ *     The RFC specifies a window of no more than 4380 bytes
+ *     unless 2*MSS > 4380.  Reading the pseudocode in the RFC
+ *     is a bit misleading because they use a clamp at 4380 bytes
+ *     rather than use a multiplier in the relevant range.
+ */
 __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst)
 {
        __u32 cwnd = (dst ? dst_metric(dst, RTAX_INITCWND) : 0);
 
-       if (!cwnd)
-               cwnd = rfc3390_bytes_to_packets(tp->mss_cache);
+       if (!cwnd) {
+               if (tp->mss_cache > 1460)
+                       cwnd = 2;
+               else
+                       cwnd = (tp->mss_cache > 1095) ? 3 : 4;
+       }
        return min_t(__u32, cwnd, tp->snd_cwnd_clamp);
 }
 
@@ -1870,7 +1883,7 @@ static void tcp_enter_frto_loss(struct sock *sk, int allowed_segments, int flag)
        tp->high_seq = tp->snd_nxt;
        TCP_ECN_queue_cwr(tp);
 
-       tcp_clear_retrans_hints_partial(tp);
+       tcp_clear_all_retrans_hints(tp);
 }
 
 static void tcp_clear_retrans_partial(struct tcp_sock *tp)
@@ -1921,12 +1934,11 @@ void tcp_enter_loss(struct sock *sk, int how)
                /* Push undo marker, if it was plain RTO and nothing
                 * was retransmitted. */
                tp->undo_marker = tp->snd_una;
-               tcp_clear_retrans_hints_partial(tp);
        } else {
                tp->sacked_out = 0;
                tp->fackets_out = 0;
-               tcp_clear_all_retrans_hints(tp);
        }
+       tcp_clear_all_retrans_hints(tp);
 
        tcp_for_write_queue(skb, sk) {
                if (skb == tcp_send_head(sk))