mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Douglas Leith" <doug@eee.strath.ac.uk>
To: <linux-net@vger.kernel.org>
Cc: <davem@redhat.com>, <linux-kernel@vger.kernel.org>,
	<kuznet@ms2.inr.ac.ru>, <jmorris@intercode.com.au>,
	<yoshfuji@linux-ipv6.org>
Subject: patch to implement RFC3517 in linux 2.4.22
Date: Thu, 9 Oct 2003 07:27:15 -0000	[thread overview]
Message-ID: <E1A7VCe-0001lZ-00@hermes.eee.strath.ac.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 4064 bytes --]

Attached is a short patch against version 2.4.22 to implement the recent 
rfc3517 for SACK in TCP (see ftp://ftp.rfc-editor.org/in-notes/rfc3517.txt).  
This modifies how packets which fail to be sacked are marked as lost.  At 
present, any packets falling into sack holes are marked lost after the first 
successful retransmit.  The new code marks packets in sack holes as lost as 
soon as tp->reordering or more packets with higher sequence number are 
sacked.  This is consistent with how reordering is handled elsewhere and 
should lead to faster retransmission and recovery when multiple drops occur.

Comments appreciated.

Regards,

Doug Leith

www.hamilton.ie


diff -u -wbrP --exclude=config.save linux-2.4.22/net/ipv4/tcp_input.c linux-
2.4.22-retrans/net/ipv4/tcp_input.c
--- linux-2.4.22/net/ipv4/tcp_input.c   2003-06-13 15:51:39.000000000 +0100
+++ linux-2.4.22-retrans/net/ipv4/tcp_input.c   2003-10-09 07:59:48.000000000 
+0100
@@ -61,6 +61,7 @@
  *             Panu Kuhlberg:          Experimental audit of TCP (re)
transmission
  *                                     engine. Lots of bugs are found.
  *             Pasi Sarolahti:         F-RTO for dealing with spurious RTOs
+ *             Doug Leith:             Early retransmission of packets 
falling into sack holes.
  */

 #include <linux/config.h>
@@ -757,6 +758,10 @@
  *    for retransmitted and already SACKed segment -> reordering..
  * Both of these heuristics are not used in Loss state, when we cannot
  * account for retransmits accurately.
+ *
+ * Retransmission of packets
+ * -------------------------
+ * Extension of Hoe's retransmit to allow early retransmission of packets 
which fall into sack holes
  */
 static int
 tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 
prior_snd_una)
@@ -770,6 +775,7 @@
        u32 lost_retrans = 0;
        int flag = 0;
        int i;
+        u32 prior_sacked_out=tp->sacked_out;

        if (!tp->sacked_out)
                tp->fackets_out = 0;
@@ -781,6 +787,7 @@
                __u32 end_seq = ntohl(sp->end_seq);
                int fack_count = 0;
                int dup_sack = 0;
+                u32 sack_count=0;

                /* Check for D-SACK. */
                if (i == 0) {
@@ -828,6 +835,8 @@
                                break;

                        fack_count++;
+                       if (sacked&TCPCB_RETRANS)
+                          sack_count++;

                        in_sack = !after(start_seq, TCP_SKB_CB(skb)->seq) &&
                                !before(end_seq, TCP_SKB_CB(skb)->end_seq);
@@ -860,8 +869,14 @@
                            (!lost_retrans || after(end_seq, lost_retrans)))
                                lost_retrans = end_seq;

-                       if (!in_sack)
+                       if (!in_sack) {
+                           /* force early retransmit ? */
+                           if (!(sacked&TCPCB_TAGBITS) && (prior_sacked_out 
> sack_count + tp->reordering)) {
+                               TCP_SKB_CB(skb)->sacked |= TCPCB_LOST;
+                               tp->lost_out++;
+                           }
                                continue;
+                       }

                        if (!(sacked&TCPCB_SACKED_ACKED)) {
                                if (sacked & TCPCB_SACKED_RETRANS) {
@@ -1599,7 +1614,7 @@
        if ((flag&FLAG_DATA_LOST) &&
            before(tp->snd_una, tp->high_seq) &&
            tp->ca_state != TCP_CA_Open &&
-           tp->fackets_out > tp->reordering) {
+           tp->fackets_out > tp->reordering && IsReno(tp) ) {
                tcp_mark_head_lost(sk, tp, tp->fackets_out-tp->reordering, tp-
>high_seq);
                NET_INC_STATS_BH(TCPLoss);
        }
@@ -1714,7 +1729,7 @@
                tp->ca_state = TCP_CA_Recovery;
        }

-       if (is_dupack || tcp_head_timedout(sk, tp))
+       if ( (is_dupack || tcp_head_timedout(sk, tp)) && IsReno(tp) )
                tcp_update_scoreboard(sk, tp);
        tcp_cwnd_down(tp);
        tcp_xmit_retransmit_queue(sk);



[-- Attachment #2: rfc3517.patch --]
[-- Type: text/plain, Size: 2765 bytes --]

diff -u -wbrP --exclude=config.save linux-2.4.22/net/ipv4/tcp_input.c linux-2.4.22-retrans/net/ipv4/tcp_input.c
--- linux-2.4.22/net/ipv4/tcp_input.c	2003-06-13 15:51:39.000000000 +0100
+++ linux-2.4.22-retrans/net/ipv4/tcp_input.c	2003-10-09 07:59:48.000000000 +0100
@@ -61,6 +61,7 @@
  *		Panu Kuhlberg:		Experimental audit of TCP (re)transmission
  *					engine. Lots of bugs are found.
  *		Pasi Sarolahti:		F-RTO for dealing with spurious RTOs
+ *		Doug Leith:		Early retransmission of packets falling into sack holes.
  */
 
 #include <linux/config.h>
@@ -757,6 +758,10 @@
  *    for retransmitted and already SACKed segment -> reordering..
  * Both of these heuristics are not used in Loss state, when we cannot
  * account for retransmits accurately.
+ *
+ * Retransmission of packets
+ * -------------------------
+ * Extension of Hoe's retransmit to allow early retransmission of packets which fall into sack holes
  */
 static int
 tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_una)
@@ -770,6 +775,7 @@
 	u32 lost_retrans = 0;
 	int flag = 0;
 	int i;
+        u32 prior_sacked_out=tp->sacked_out;
 
 	if (!tp->sacked_out)
 		tp->fackets_out = 0;
@@ -781,6 +787,7 @@
 		__u32 end_seq = ntohl(sp->end_seq);
 		int fack_count = 0;
 		int dup_sack = 0;
+                u32 sack_count=0;
 
 		/* Check for D-SACK. */
 		if (i == 0) {
@@ -828,6 +835,8 @@
 				break;
 
 			fack_count++;
+			if (sacked&TCPCB_RETRANS) 
+			   sack_count++;
 
 			in_sack = !after(start_seq, TCP_SKB_CB(skb)->seq) &&
 				!before(end_seq, TCP_SKB_CB(skb)->end_seq);
@@ -860,8 +869,14 @@
 			    (!lost_retrans || after(end_seq, lost_retrans)))
 				lost_retrans = end_seq;
 
-			if (!in_sack)
+			if (!in_sack) {
+                           /* force early retransmit ? */
+                           if (!(sacked&TCPCB_TAGBITS) && (prior_sacked_out > sack_count + tp->reordering)) {
+                               TCP_SKB_CB(skb)->sacked |= TCPCB_LOST; 
+                               tp->lost_out++;
+                           }
 				continue;
+ 			}
 
 			if (!(sacked&TCPCB_SACKED_ACKED)) {
 				if (sacked & TCPCB_SACKED_RETRANS) {
@@ -1599,7 +1614,7 @@
 	if ((flag&FLAG_DATA_LOST) &&
 	    before(tp->snd_una, tp->high_seq) &&
 	    tp->ca_state != TCP_CA_Open &&
-	    tp->fackets_out > tp->reordering) {
+	    tp->fackets_out > tp->reordering && IsReno(tp) ) {
 		tcp_mark_head_lost(sk, tp, tp->fackets_out-tp->reordering, tp->high_seq);
 		NET_INC_STATS_BH(TCPLoss);
 	}
@@ -1714,7 +1729,7 @@
 		tp->ca_state = TCP_CA_Recovery;
 	}
 
-	if (is_dupack || tcp_head_timedout(sk, tp))
+	if ( (is_dupack || tcp_head_timedout(sk, tp)) && IsReno(tp) )
 		tcp_update_scoreboard(sk, tp);
 	tcp_cwnd_down(tp);
 	tcp_xmit_retransmit_queue(sk);

             reply	other threads:[~2003-10-09  7:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-09  7:27 Douglas Leith [this message]
2003-10-10  8:27 ` David S. Miller
2003-10-10 13:29   ` kuznet
     [not found] <006c01c38f50$7bc26940$0603dc0a@hamilton.local>
2003-10-10 17:35 ` kuznet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1A7VCe-0001lZ-00@hermes.eee.strath.ac.uk \
    --to=doug@eee.strath.ac.uk \
    --cc=davem@redhat.com \
    --cc=jmorris@intercode.com.au \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome