Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Feb 2012 20:09:23 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r231422 - stable/8/sys/netinet
Message-ID:  <201202102009.q1AK9NxY091924@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Fri Feb 10 20:09:23 2012
New Revision: 231422
URL: http://svn.freebsd.org/changeset/base/231422

Log:
  MFC r219014:
  * Fix several bugs where the scaled versions of srtt and rttvar
    where used incorrectly.
  * Use appropriate variable names for RTO instead of RTT.

Modified:
  stable/8/sys/netinet/sctp_cc_functions.c
  stable/8/sys/netinet/sctp_timer.c
  stable/8/sys/netinet/sctp_usrreq.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/netinet/sctp_cc_functions.c
==============================================================================
--- stable/8/sys/netinet/sctp_cc_functions.c	Fri Feb 10 20:07:01 2012	(r231421)
+++ stable/8/sys/netinet/sctp_cc_functions.c	Fri Feb 10 20:09:23 2012	(r231422)
@@ -428,7 +428,7 @@ skip_cwnd_update:
 		 */
 		if (net->net_ack2) {
 			/* restore any doubled timers */
-			net->RTO = ((net->lastsa >> 2) + net->lastsv) >> 1;
+			net->RTO = (net->lastsa >> SCTP_RTT_SHIFT) + net->lastsv;
 			if (net->RTO < stcb->asoc.minrto) {
 				net->RTO = stcb->asoc.minrto;
 			}
@@ -518,8 +518,8 @@ sctp_cwnd_update_after_packet_dropped(st
 	unsigned int incr;
 	int old_cwnd = net->cwnd;
 
-	/* need real RTT for this calc */
-	rtt = ((net->lastsa >> 2) + net->lastsv) >> 1;
+	/* need real RTT in msd for this calc */
+	rtt = net->rtt / 1000;
 	/* get bottle neck bw */
 	*bottle_bw = ntohl(cp->bottle_bw);
 	/* and whats on queue */
@@ -1079,7 +1079,7 @@ skip_cwnd_update:
 		 */
 		if (net->net_ack2) {
 			/* restore any doubled timers */
-			net->RTO = ((net->lastsa >> 2) + net->lastsv) >> 1;
+			net->RTO = (net->lastsa >> SCTP_RTT_SHIFT) + net->lastsv;
 			if (net->RTO < stcb->asoc.minrto) {
 				net->RTO = stcb->asoc.minrto;
 			}
@@ -1146,7 +1146,7 @@ htcp_cwnd_undo(struct sctp_tcb *stcb, st
 static inline void
 measure_rtt(struct sctp_tcb *stcb, struct sctp_nets *net)
 {
-	uint32_t srtt = net->lastsa >> 3;
+	uint32_t srtt = net->lastsa >> SCTP_RTT_SHIFT;
 
 	/* keep track of minimum RTT seen so far, minRTT is zero at first */
 	if (net->htcp_ca.minRTT > srtt || !net->htcp_ca.minRTT)
@@ -1532,7 +1532,7 @@ skip_cwnd_update:
 		 */
 		if (net->net_ack2) {
 			/* restore any doubled timers */
-			net->RTO = ((net->lastsa >> 2) + net->lastsv) >> 1;
+			net->RTO = (net->lastsa >> SCTP_RTT_SHIFT) + net->lastsv;
 			if (net->RTO < stcb->asoc.minrto) {
 				net->RTO = stcb->asoc.minrto;
 			}

Modified: stable/8/sys/netinet/sctp_timer.c
==============================================================================
--- stable/8/sys/netinet/sctp_timer.c	Fri Feb 10 20:07:01 2012	(r231421)
+++ stable/8/sys/netinet/sctp_timer.c	Fri Feb 10 20:09:23 2012	(r231422)
@@ -61,24 +61,24 @@ sctp_early_fr_timer(struct sctp_inpcb *i
 {
 	struct sctp_tmit_chunk *chk, *pchk;
 	struct timeval now, min_wait, tv;
-	unsigned int cur_rtt, cnt = 0, cnt_resend = 0;
+	unsigned int cur_rto, cnt = 0, cnt_resend = 0;
 
 	/* an early FR is occuring. */
 	(void)SCTP_GETTIME_TIMEVAL(&now);
 	/* get cur rto in micro-seconds */
 	if (net->lastsa == 0) {
 		/* Hmm no rtt estimate yet? */
-		cur_rtt = stcb->asoc.initial_rto >> 2;
+		cur_rto = stcb->asoc.initial_rto >> 2;
 	} else {
 
-		cur_rtt = ((net->lastsa >> 2) + net->lastsv) >> 1;
+		cur_rto = (net->lastsa >> SCTP_RTT_SHIFT) + net->lastsv;
 	}
-	if (cur_rtt < SCTP_BASE_SYSCTL(sctp_early_fr_msec)) {
-		cur_rtt = SCTP_BASE_SYSCTL(sctp_early_fr_msec);
+	if (cur_rto < SCTP_BASE_SYSCTL(sctp_early_fr_msec)) {
+		cur_rto = SCTP_BASE_SYSCTL(sctp_early_fr_msec);
 	}
-	cur_rtt *= 1000;
-	tv.tv_sec = cur_rtt / 1000000;
-	tv.tv_usec = cur_rtt % 1000000;
+	cur_rto *= 1000;
+	tv.tv_sec = cur_rto / 1000000;
+	tv.tv_usec = cur_rto % 1000000;
 	min_wait = now;
 	timevalsub(&min_wait, &tv);
 	if (min_wait.tv_sec < 0 || min_wait.tv_usec < 0) {
@@ -626,7 +626,7 @@ sctp_mark_all_for_resend(struct sctp_tcb
 	struct sctp_tmit_chunk *chk, *nchk;
 	struct sctp_nets *lnets;
 	struct timeval now, min_wait, tv;
-	int cur_rtt;
+	int cur_rto;
 	int cnt_abandoned;
 	int audit_tf, num_mk, fir;
 	unsigned int cnt_mk;
@@ -644,10 +644,10 @@ sctp_mark_all_for_resend(struct sctp_tcb
 	 */
 	(void)SCTP_GETTIME_TIMEVAL(&now);
 	/* get cur rto in micro-seconds */
-	cur_rtt = (((net->lastsa >> 2) + net->lastsv) >> 1);
-	cur_rtt *= 1000;
+	cur_rto = (net->lastsa >> SCTP_RTT_SHIFT) + net->lastsv;
+	cur_rto *= 1000;
 	if (SCTP_BASE_SYSCTL(sctp_logging_level) & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
-		sctp_log_fr(cur_rtt,
+		sctp_log_fr(cur_rto,
 		    stcb->asoc.peers_rwnd,
 		    window_probe,
 		    SCTP_FR_T3_MARK_TIME);
@@ -657,8 +657,8 @@ sctp_mark_all_for_resend(struct sctp_tcb
 		    SCTP_FR_CWND_REPORT);
 		sctp_log_fr(net->flight_size, net->cwnd, stcb->asoc.total_flight, SCTP_FR_CWND_REPORT);
 	}
-	tv.tv_sec = cur_rtt / 1000000;
-	tv.tv_usec = cur_rtt % 1000000;
+	tv.tv_sec = cur_rto / 1000000;
+	tv.tv_usec = cur_rto % 1000000;
 	min_wait = now;
 	timevalsub(&min_wait, &tv);
 	if (min_wait.tv_sec < 0 || min_wait.tv_usec < 0) {
@@ -671,7 +671,7 @@ sctp_mark_all_for_resend(struct sctp_tcb
 		min_wait.tv_sec = min_wait.tv_usec = 0;
 	}
 	if (SCTP_BASE_SYSCTL(sctp_logging_level) & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
-		sctp_log_fr(cur_rtt, now.tv_sec, now.tv_usec, SCTP_FR_T3_MARK_TIME);
+		sctp_log_fr(cur_rto, now.tv_sec, now.tv_usec, SCTP_FR_T3_MARK_TIME);
 		sctp_log_fr(0, min_wait.tv_sec, min_wait.tv_usec, SCTP_FR_T3_MARK_TIME);
 	}
 	/*

Modified: stable/8/sys/netinet/sctp_usrreq.c
==============================================================================
--- stable/8/sys/netinet/sctp_usrreq.c	Fri Feb 10 20:07:01 2012	(r231421)
+++ stable/8/sys/netinet/sctp_usrreq.c	Fri Feb 10 20:09:23 2012	(r231422)
@@ -2398,7 +2398,7 @@ flags_out:
 					paddri->spinfo_state = SCTP_INACTIVE;
 				}
 				paddri->spinfo_cwnd = net->cwnd;
-				paddri->spinfo_srtt = ((net->lastsa >> 2) + net->lastsv) >> 1;
+				paddri->spinfo_srtt = net->lastsa >> SCTP_RTT_SHIFT;
 				paddri->spinfo_rto = net->RTO;
 				paddri->spinfo_assoc_id = sctp_get_associd(stcb);
 				SCTP_TCB_UNLOCK(stcb);
@@ -2475,7 +2475,7 @@ flags_out:
 				sstat->sstat_primary.spinfo_state = SCTP_INACTIVE;
 			}
 			sstat->sstat_primary.spinfo_cwnd = net->cwnd;
-			sstat->sstat_primary.spinfo_srtt = net->lastsa;
+			sstat->sstat_primary.spinfo_srtt = net->lastsa >> SCTP_RTT_SHIFT;
 			sstat->sstat_primary.spinfo_rto = net->RTO;
 			sstat->sstat_primary.spinfo_mtu = net->mtu;
 			sstat->sstat_primary.spinfo_assoc_id = sctp_get_associd(stcb);



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