Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Aug 2009 07:49:20 GMT
From:      Fang Wang <fangwang@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 167352 for review
Message-ID:  <200908150749.n7F7nK6u020019@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=167352

Change 167352 by fangwang@fangwang_utobsd on 2009/08/15 07:48:56

	Fix style.
	Fix bug in decrease timeout value.

Affected files ...

.. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_timer.c#8 edit
.. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_timer.h#7 edit
.. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_var.h#14 edit

Differences ...

==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_timer.c#8 (text+ko) ====

@@ -494,6 +494,7 @@
 	if (tp->t_rxtshift == 0) {
 		TCPT_RESOLVE_UTO(tp);
 		tp->t_uto_left = tp->t_uto_impl / hz;
+		tp->t_uto_left -= tcp_backoff[0];
 	}
 	/*
 	 * Retransmission timer went off.  Message has not
@@ -533,18 +534,26 @@
 	if (tp->t_state == TCPS_SYN_SENT)
 		rexmt = TCP_REXMTVAL(tp) * tcp_syn_backoff[tp->t_rxtshift];
 	else
-		if ((tp->uto_flags & TCPUTO_IMPL) == 0)
+		if ((tp->uto_flags & TCPUTO_IMPL) == 0) {
 			rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift];
-		else {
-			int rxtshift;
+			TCPT_RANGESET(tp->t_rxtcur, rexmt,
+				      tp->t_rttmin, TCPTV_REXMTMAX);
+		} else {
+			int rxtshift, interval;
 			rxtshift = min(TCP_MAXRXTSHIFT, tp->t_rxtshift);
-			tp->t_uto_left -= min(tp->t_uto_left, 
-				min(TCP_REXMTMAX, tcp_backoff[rxtshift]));
+			interval = min(TCP_REXMTMAX, tcp_backoff[rxtshift]);
 			rexmt = TCP_REXMTVAL(tp) * tcp_backoff[rxtshift];
+			TCPT_RANGESET(tp->t_rxtcur, rexmt,
+				      tp->t_rttmin, TCPTV_REXMTMAX);
+			if (tp->t_uto_left < interval) {
+				tp->t_rxtcur = (tp->t_rxtcur * tp->t_uto_left) / interval;
+				/*  Prevent t_rxtcur to be zero */
+				TCPT_RANGESET(tp->t_rxtcur, tp->t_rxtcur,
+					      tp->t_rttmin, TCPTV_REXMTMAX);
+			}
+			tp->t_uto_left -= min(tp->t_uto_left, interval);
 		}
 
-	TCPT_RANGESET(tp->t_rxtcur, rexmt,
-		      tp->t_rttmin, TCPTV_REXMTMAX);
 	/*
 	 * Disable rfc1323 if we havn't got any response to
 	 * our third SYN to work-around some broken terminal servers

==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_timer.h#7 (text+ko) ====

@@ -93,7 +93,7 @@
 
 #define	TCPTV_UTO_MIN		( 120*hz)	/* min user timeout */
 #define	TCPTV_UTO_MAX		(1020*hz)	/* max user timeout */
-#define	TCPTV_UTO_DEFAULT	( 447*hz)	/* default user timeout */
+#define	TCPTV_UTO_DEFAULT	( 511*hz)	/* default user timeout */
 
 /*
  * Minimum retransmit timer is 3 ticks, for algorithmic stability.

==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_var.h#14 (text+ko) ====

@@ -254,19 +254,19 @@
 /*
 * Resolve user timeout value(ticks).
 */
-#define	TCPT_RESOLVE_UTO(tp) do { \
-	if ((tp)->uto_flags & TCPUTO_ENABLE && \
-	    (tp)->uto_flags & TCPUTO_RCVD && \
-	    (tp)->uto_flags & TCPUTO_CHANGEABLE) { \
-		(tp)->t_uto_impl = (tp)->rcv_uto >> 1; \
-		if ((tp)->rcv_uto & 1) \
-			(tp)->t_uto_impl *= 60; \
-		(tp)->t_uto_impl *= hz; \
-		(tp)->t_uto_impl = min(tcp_uto_max, \
-		    max((tp)->t_uto_adv, max((tp)->t_uto_impl, tcp_uto_min))); \
-		(tp)->uto_flags &= ~TCPUTO_RCVD; \
-		(tp)->uto_flags |= TCPUTO_IMPL; \
-	} \
+#define	TCPT_RESOLVE_UTO(tp) do {						\
+	if ((tp)->uto_flags & TCPUTO_ENABLE &&					\
+	    (tp)->uto_flags & TCPUTO_RCVD &&					\
+	    (tp)->uto_flags & TCPUTO_CHANGEABLE) {				\
+		(tp)->t_uto_impl = (tp)->rcv_uto >> 1;				\
+		if ((tp)->rcv_uto & 1)						\
+			(tp)->t_uto_impl *= 60;					\
+		(tp)->t_uto_impl *= hz;						\
+		(tp)->t_uto_impl = min(tcp_uto_max,				\
+		    max((tp)->t_uto_adv, max((tp)->t_uto_impl, tcp_uto_min)));	\
+		(tp)->uto_flags &= ~TCPUTO_RCVD;				\
+		(tp)->uto_flags |= TCPUTO_IMPL;					\
+	}									\
 } while(0)
 
 #ifdef TCP_SIGNATURE



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