Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Sep 2020 08:45:22 +0000 (UTC)
From:      Richard Scheffenegger <rscheff@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r365294 - stable/12/sys/netinet/cc
Message-ID:  <202009030845.0838jMmU043916@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rscheff
Date: Thu Sep  3 08:45:21 2020
New Revision: 365294
URL: https://svnweb.freebsd.org/changeset/base/365294

Log:
  MFC r364197: TCP Cubic: Have Fast Convergence Heuristic work for ECN, and align concave region
  
  The Cubic concave region was not aligned nicely for the very first exit from
  slow start, where a 50% cwnd reduction is done instead of the normal 30%.
  
  This addresses an issue, where a short line-rate burst could result from that
  sudden jump of cwnd.
  
  In addition, the Fast Convergence Heuristic has been expanded to work also
  with ECN induced congestion response.
  
  Submitted by:	chengc_netapp.com
  Reported by:	chengc_netapp.com
  Reviewed by:	tuexen (mentor), rgrimes (mentor)
  Approved by:	tuexen (mentor), rgrimes (mentor)
  MFC after:	3 weeks
  Sponsored by:	NetApp, Inc.
  Differential Revision:	https://reviews.freebsd.org/D25976

Modified:
  stable/12/sys/netinet/cc/cc_cubic.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/cc/cc_cubic.c
==============================================================================
--- stable/12/sys/netinet/cc/cc_cubic.c	Thu Sep  3 08:41:38 2020	(r365293)
+++ stable/12/sys/netinet/cc/cc_cubic.c	Thu Sep  3 08:45:21 2020	(r365294)
@@ -286,8 +286,7 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type)
 			if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
 				cubic_ssthresh_update(ccv);
 				cubic_data->flags |= CUBICFLAG_CONG_EVENT;
-				cubic_data->prev_max_cwnd = cubic_data->max_cwnd;
-				cubic_data->max_cwnd = CCV(ccv, snd_cwnd);
+				cubic_data->t_last_cong = ticks;
 				cubic_data->K = cubic_k(cubic_data->max_cwnd / CCV(ccv, t_maxseg));
 			}
 			ENTER_RECOVERY(CCV(ccv, t_flags));
@@ -298,8 +297,6 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type)
 		if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
 			cubic_ssthresh_update(ccv);
 			cubic_data->flags |= CUBICFLAG_CONG_EVENT;
-			cubic_data->prev_max_cwnd = cubic_data->max_cwnd;
-			cubic_data->max_cwnd = CCV(ccv, snd_cwnd);
 			cubic_data->t_last_cong = ticks;
 			cubic_data->K = cubic_k(cubic_data->max_cwnd / CCV(ccv, t_maxseg));
 			CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
@@ -361,11 +358,6 @@ cubic_post_recovery(struct cc_var *ccv)
 	cubic_data = ccv->cc_data;
 	pipe = 0;
 
-	/* Fast convergence heuristic. */
-	if (cubic_data->max_cwnd < cubic_data->prev_max_cwnd)
-		cubic_data->max_cwnd = (cubic_data->max_cwnd * CUBIC_FC_FACTOR)
-		    >> CUBIC_SHIFT;
-
 	if (IN_FASTRECOVERY(CCV(ccv, t_flags))) {
 		/*
 		 * If inflight data is less than ssthresh, set cwnd
@@ -392,7 +384,6 @@ cubic_post_recovery(struct cc_var *ccv)
 			    CUBIC_BETA) >> CUBIC_SHIFT,
 			    2 * CCV(ccv, t_maxseg));
 	}
-	cubic_data->t_last_cong = ticks;
 
 	/* Calculate the average RTT between congestion epochs. */
 	if (cubic_data->epoch_ack_count > 0 &&
@@ -403,7 +394,6 @@ cubic_post_recovery(struct cc_var *ccv)
 
 	cubic_data->epoch_ack_count = 0;
 	cubic_data->sum_rtt_ticks = 0;
-	cubic_data->K = cubic_k(cubic_data->max_cwnd / CCV(ccv, t_maxseg));
 }
 
 /*
@@ -457,18 +447,32 @@ cubic_ssthresh_update(struct cc_var *ccv)
 {
 	struct cubic *cubic_data;
 	uint32_t ssthresh;
+	uint32_t cwnd;
 
 	cubic_data = ccv->cc_data;
+	cwnd = CCV(ccv, snd_cwnd);
 
+	/* Fast convergence heuristic. */
+	if (cwnd < cubic_data->max_cwnd) {
+		cwnd = ((uint64_t)cwnd * CUBIC_FC_FACTOR) >> CUBIC_SHIFT;
+	}
+	cubic_data->prev_max_cwnd = cubic_data->max_cwnd;
+	cubic_data->max_cwnd = cwnd;
+
 	/*
-	 * On the first congestion event, set ssthresh to cwnd * 0.5, on
-	 * subsequent congestion events, set it to cwnd * beta.
+	 * On the first congestion event, set ssthresh to cwnd * 0.5
+	 * and reduce max_cwnd to cwnd * beta. This aligns the cubic concave
+	 * region appropriately. On subsequent congestion events, set
+	 * ssthresh to cwnd * beta.
 	 */
-	if ((cubic_data->flags & CUBICFLAG_CONG_EVENT) == 0)
-		ssthresh = CCV(ccv, snd_cwnd) >> 1;
-	else
-		ssthresh = ((uint64_t)CCV(ccv, snd_cwnd) *
+	if ((cubic_data->flags & CUBICFLAG_CONG_EVENT) == 0) {
+		ssthresh = cwnd >> 1;
+		cubic_data->max_cwnd = ((uint64_t)cwnd *
 		    CUBIC_BETA) >> CUBIC_SHIFT;
+	} else {
+		ssthresh = ((uint64_t)cwnd *
+		    CUBIC_BETA) >> CUBIC_SHIFT;
+	}
 	CCV(ccv, snd_ssthresh) = max(ssthresh, 2 * CCV(ccv, t_maxseg));
 }
 



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