Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Jul 2011 19:27:05 GMT
From:      Catalin Nicutar <cnicutar@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 195682 for review
Message-ID:  <201107031927.p63JR5XI091167@skunkworks.freebsd.org>

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

Change 195682 by cnicutar@cnicutar_cronos on 2011/07/03 19:26:51

	Keep retransmitting after TCP_MAXRXTSHIFT retransmits at a fixed
	rate (TCPTV_REXMTMAX). In the future all retransmits could possibly
	be stretched over the entire UTO period.

Affected files ...

.. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_timer.c#4 edit

Differences ...

==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_timer.c#4 (text+ko) ====

@@ -490,21 +490,24 @@
 	tcp_free_sackholes(tp);
 
 	if (tp->t_rxtshift == 0)
-		tp->t_suto = 0;
+		/* UTO starting again since it's the first retransmit. */
+		tp->t_suto = 0;	
 
 	if ((tp->t_flags & TF_SND_UTO) || ((tp->t_flags & TF_RCV_UTO) &&
 	    tp->rcv_uto)) {
-		/* Using UTO for this connection. */
+		/*
+		 * Since we're using UTO for this connection we need to
+		 * compute how much time we've got left.
+		 */
 		uto_left = max(tp->snd_uto, tp->rcv_uto);
-		if (tp->t_suto) {
+		if (tp->t_suto)
 			uto_left -= ticks_to_secs(ticks - tp->t_suto);
-		}
 
 		/*
 		 * The user may choose a value that's less than TCP_MAXRXTSHIFT
 		 * retransmits.
 		 */
-		if (tp->t_rxtshift > TCP_MAXRXTSHIFT || uto_left <= 0) {
+		if (uto_left <= 0) {
 			/* Before or after the retransmits, UTO was exceeded. */
 			TCPSTAT_INC(tcps_timeoutdrop);
 			tp = tcp_drop(tp, ETIMEDOUT);
@@ -516,21 +519,14 @@
 	 * Retransmission timer went off.  Message has not
 	 * been acked within retransmit interval.  Back off
 	 * to a longer retransmit interval and retransmit one segment.
+	 * If using UTO, don't drop. t_rxtshift will hint it's not a
+	 * normal retransmit.
 	 */
-	if (++tp->t_rxtshift > TCP_MAXRXTSHIFT) {
-		if (uto_left > 0) {
-			/*
-			 * Reset the timer for UTO; t_rxtshift will hint
-			 * that it's not a normal retransmit.
-			 */
-			callout_reset(&tp->t_timers->tt_rexmt, hz * uto_left,
-			    tcp_timer_rexmt, tp);
-		} else {
-			tp->t_rxtshift = TCP_MAXRXTSHIFT;
-			TCPSTAT_INC(tcps_timeoutdrop);
-			tp = tcp_drop(tp, tp->t_softerror ?
-				      tp->t_softerror : ETIMEDOUT);
-		}
+	if (++tp->t_rxtshift > TCP_MAXRXTSHIFT && uto_left <= 0) {
+		tp->t_rxtshift = TCP_MAXRXTSHIFT;
+		TCPSTAT_INC(tcps_timeoutdrop);
+		tp = tcp_drop(tp, tp->t_softerror ?
+			      tp->t_softerror : ETIMEDOUT);
 		goto out;
 	}
 	INP_INFO_WUNLOCK(&V_tcbinfo);
@@ -558,13 +554,15 @@
 	TCPSTAT_INC(tcps_rexmttimeo);
 	if (tp->t_state == TCPS_SYN_SENT)
 		rexmt = TCP_REXMTVAL(tp) * tcp_syn_backoff[tp->t_rxtshift];
-	else
-		rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift];
+	else {
+		if (tp->t_rxtshift <= TCP_MAXRXTSHIFT)
+			rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift];
+		else
+			/* We're in UTO, back off as much as we can. */
+			rexmt = min(TCPTV_REXMTMAX, uto_left * hz);
+	}
 	TCPT_RANGESET(tp->t_rxtcur, rexmt,
 		      tp->t_rttmin, TCPTV_REXMTMAX);
-	if (uto_left) {
-		tp->t_rxtcur = min(tp->t_rxtcur, hz * uto_left);
-	}
 	/*
 	 * Disable rfc1323 if we haven't got any response to
 	 * our third SYN to work-around some broken terminal servers



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