Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Sep 2014 13:48:46 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r271672 - head/sys/netinet
Message-ID:  <201409161348.s8GDmkvQ077081@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Tue Sep 16 13:48:46 2014
New Revision: 271672
URL: http://svnweb.freebsd.org/changeset/base/271672

Log:
  Small cleanup which addresses a warning regaring the truncation
  of a 64-bit entity to a 32-bit entity. This issue was reported by
  Peter Kasting from Google.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_cc_functions.c

Modified: head/sys/netinet/sctp_cc_functions.c
==============================================================================
--- head/sys/netinet/sctp_cc_functions.c	Tue Sep 16 11:07:25 2014	(r271671)
+++ head/sys/netinet/sctp_cc_functions.c	Tue Sep 16 13:48:46 2014	(r271672)
@@ -1130,12 +1130,9 @@ sctp_cwnd_update_after_packet_dropped(st
     uint32_t * bottle_bw, uint32_t * on_queue)
 {
 	uint32_t bw_avail;
-	int rtt;
 	unsigned int incr;
 	int old_cwnd = net->cwnd;
 
-	/* 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 */
@@ -1144,10 +1141,11 @@ sctp_cwnd_update_after_packet_dropped(st
 	 * adjust the on-queue if our flight is more it could be that the
 	 * router has not yet gotten data "in-flight" to it
 	 */
-	if (*on_queue < net->flight_size)
+	if (*on_queue < net->flight_size) {
 		*on_queue = net->flight_size;
-	/* calculate the available space */
-	bw_avail = (*bottle_bw * rtt) / 1000;
+	}
+	/* rtt is measured in micro seconds, bottle_bw in bytes per second */
+	bw_avail = (uint32_t) (((uint64_t) (*bottle_bw) * net->rtt) / (uint64_t) 1000000);
 	if (bw_avail > *bottle_bw) {
 		/*
 		 * Cap the growth to no more than the bottle neck. This can
@@ -1167,7 +1165,6 @@ sctp_cwnd_update_after_packet_dropped(st
 		int seg_inflight, seg_onqueue, my_portion;
 
 		net->partial_bytes_acked = 0;
-
 		/* how much are we over queue size? */
 		incr = *on_queue - bw_avail;
 		if (stcb->asoc.seen_a_sack_this_pkt) {



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