[TCP]: Access to highest_sack obsoletes forward_cnt_hint
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
Sun, 27 May 2007 09:03:20 +0000 (02:03 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:47:53 +0000 (16:47 -0700)
In addition, added a reference about the purpose of the loop.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/tcp.h
net/ipv4/tcp_output.c

index c072f88afb979ef61f107999dde18956e26727d8..d64734389fb62f83e6b05d5a22533e78a0eaa863 100644 (file)
@@ -346,7 +346,6 @@ struct tcp_sock {
        int     fastpath_cnt_hint;
        int     lost_cnt_hint;
        int     retransmit_cnt_hint;
-       int     forward_cnt_hint;
 
        u16     advmss;         /* Advertised MSS                       */
        u16     prior_ssthresh; /* ssthresh saved at recovery start     */
index 666d8a58d14a3d573f11963de87773f25201d573..b11025e8a49e4c783d1b51afa4df9df339974968 100644 (file)
@@ -1945,33 +1945,28 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
         * and retransmission... Both ways have their merits...
         *
         * For now we do not retransmit anything, while we have some new
-        * segments to send.
+        * segments to send. In the other cases, follow rule 3 for
+        * NextSeg() specified in RFC3517.
         */
 
        if (tcp_may_send_now(sk))
                return;
 
-       if (tp->forward_skb_hint) {
+       /* If nothing is SACKed, highest_sack in the loop won't be valid */
+       if (!tp->sacked_out)
+               return;
+
+       if (tp->forward_skb_hint)
                skb = tp->forward_skb_hint;
-               packet_cnt = tp->forward_cnt_hint;
-       } else{
+       else
                skb = tcp_write_queue_head(sk);
-               packet_cnt = 0;
-       }
 
        tcp_for_write_queue_from(skb, sk) {
                if (skb == tcp_send_head(sk))
                        break;
-               tp->forward_cnt_hint = packet_cnt;
                tp->forward_skb_hint = skb;
 
-               /* Similar to the retransmit loop above we
-                * can pretend that the retransmitted SKB
-                * we send out here will be composed of one
-                * real MSS sized packet because tcp_retransmit_skb()
-                * will fragment it if necessary.
-                */
-               if (++packet_cnt > tp->fackets_out)
+               if (after(TCP_SKB_CB(skb)->seq, tp->highest_sack))
                        break;
 
                if (tcp_packets_in_flight(tp) >= tp->snd_cwnd)