Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Jul 2010 14:59:40 GMT
From:      Andre Oppermann <andre@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 180387 for review
Message-ID:  <201007011459.o61Exev6025734@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@180387?ac=10

Change 180387 by andre@andre_t61 on 2010/07/01 14:59:16

	Add tcp_do_recovery() to handle the loss recovery period.

Affected files ...

.. //depot/projects/tcp_new/netinet/tcp_input.c#18 edit

Differences ...

==== //depot/projects/tcp_new/netinet/tcp_input.c#18 (text+ko) ====

@@ -1784,7 +1784,7 @@
 	if (tp->t_phase < TP_LOSSRECOV) {
 		//tcp_cc_ack(tp, th, tiwin, acked, tlen, sacked);
 	} else {
-		tcp_do_lossrecovery(tp);
+		tcp_do_lossrecovery(tp, th, tiwin, acked, tlen, sacked);
 	}
 
 	KASSERT(tp->snd_cwnd > tp->snd_mss,
@@ -3035,9 +3035,51 @@
  * Perform loss recovery.
  */
 void
-tcp_do_lossrecovery(struct tcpcb *tp)
+tcp_do_lossrecovery(struct tcpcb *tp, struct tcphdr *th, tcp_win tiwin,
+    tcp_seq acked, int tlen, int sacked)
 {
-	
+	/*
+	 * NewReno FastRecovery:
+	 *
+	 * 1a) ssthresh = max (FlightSize / 2, 2*SMSS) [input]
+	 *     recover = snd_nxt [input]
+	 *
+	 * 2)  retransmit snd_una+mss [output]
+	 *     cwnd = ssthresh + 3*mss [input]
+	 *
+	 * 3)  on dupack > 3: cwnd =+ mss [input]
+	 *
+	 * 4)  transmit new segment if cwnd allows [output]
+	 *
+	 * 5a) full ack
+	 *     cwnd = min(ssthresh, FlightSize + SMSS) [input]
+	 *     exit fastrecovery and reset dupack [input]
+	 *
+	 * 5b) partial ack
+	 *     deflate/inflate cwnd [input]
+	 *     retransmit new snd_una+mss [output]
+	 *     transmit new segment if cwnd allows [output]
+	 *
+	 * 5c) dupack again
+	 *     transmit new segment if cwnd allows [output]
+	 */
+
+	if (tp->snd_dupack == 3) {
+		tp->snd_recover = tp->snd_nxt;
+		tp->snd_cwnd = tp->snd_ssthresh + 3 * tp->snd_mss;
+		if (tp->t_phase < TP_LOSSRECOV)
+			tp->t_phase = TP_LOSSRECOV;
+	} else if (tp->snd_dupack > 3) {
+		tp->snd_cwnd =+ tp->snd_mss;
+	}
+
+	if (SEQ_GEQ(th->th_ack, tp->snd_recover)) {
+		tp->snd_cwnd = min(tp->snd_ssthresh, SEQ_DELTA(tp->snd_una, tp->snd_nxt) + tp->snd_mss);
+		tp->t_phase = TP_SENDING;
+	} else if (acked > 0) {
+		if (acked <= tp->snd_mss)
+			tp->snd_cwnd =- acked;
+	}
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007011459.o61Exev6025734>