Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Jul 2017 15:08:52 +0000 (UTC)
From:      Sean Bruno <sbruno@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r321480 - in head/sys/netinet: . cc tcp_stacks
Message-ID:  <201707251508.v6PF8qQ8039338@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sbruno
Date: Tue Jul 25 15:08:52 2017
New Revision: 321480
URL: https://svnweb.freebsd.org/changeset/base/321480

Log:
  Revert r307901 - Inform CC modules about loss events.
  
  This was discussed between various transport@ members and it was
  requested to be reverted and discussed.
  
  Submitted by:	Kevin Bowling <kevin.bowling@kev009.com>
  Reported by:	lawrence
  Reviewed by:	hiren
  Sponsored by:	Limelight Networks

Modified:
  head/sys/netinet/cc/cc_cdg.c
  head/sys/netinet/cc/cc_chd.c
  head/sys/netinet/cc/cc_cubic.c
  head/sys/netinet/cc/cc_dctcp.c
  head/sys/netinet/cc/cc_htcp.c
  head/sys/netinet/cc/cc_newreno.c
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_stacks/fastpath.c

Modified: head/sys/netinet/cc/cc_cdg.c
==============================================================================
--- head/sys/netinet/cc/cc_cdg.c	Tue Jul 25 15:03:05 2017	(r321479)
+++ head/sys/netinet/cc/cc_cdg.c	Tue Jul 25 15:08:52 2017	(r321480)
@@ -431,12 +431,7 @@ static void
 cdg_cong_signal(struct cc_var *ccv, uint32_t signal_type)
 {
 	struct cdg *cdg_data = ccv->cc_data;
-	uint32_t cwin;
-	u_int mss;
 
-	cwin = CCV(ccv, snd_cwnd);
-	mss = CCV(ccv, t_maxseg);
-
 	switch(signal_type) {
 	case CC_CDG_DELAY:
 		CCV(ccv, snd_ssthresh) = cdg_window_decrease(ccv,
@@ -453,7 +448,7 @@ cdg_cong_signal(struct cc_var *ccv, uint32_t signal_ty
 		 */
 		if (IN_CONGRECOVERY(CCV(ccv, t_flags)) ||
 		    cdg_data->queue_state < CDG_Q_FULL) {
-			CCV(ccv, snd_ssthresh) = cwin;
+			CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd);
 			CCV(ccv, snd_recover) = CCV(ccv, snd_max);
 		} else {
 			/*
@@ -466,16 +461,12 @@ cdg_cong_signal(struct cc_var *ccv, uint32_t signal_ty
 				    cdg_data->shadow_w, RENO_BETA);
 
 			CCV(ccv, snd_ssthresh) = max(cdg_data->shadow_w,
-			    cdg_window_decrease(ccv, cwin, V_cdg_beta_loss));
-			CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
+			    cdg_window_decrease(ccv, CCV(ccv, snd_cwnd),
+			    V_cdg_beta_loss));
 
 			cdg_data->window_incr = cdg_data->rtt_count = 0;
 		}
 		ENTER_RECOVERY(CCV(ccv, t_flags));
-		break;
-	case CC_RTO:
-		CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2);
-		CCV(ccv, snd_cwnd) = mss;
 		break;
 	default:
 		newreno_cc_algo.cong_signal(ccv, signal_type);

Modified: head/sys/netinet/cc/cc_chd.c
==============================================================================
--- head/sys/netinet/cc/cc_chd.c	Tue Jul 25 15:03:05 2017	(r321479)
+++ head/sys/netinet/cc/cc_chd.c	Tue Jul 25 15:08:52 2017	(r321480)
@@ -330,14 +330,10 @@ chd_cong_signal(struct cc_var *ccv, uint32_t signal_ty
 	struct ertt *e_t;
 	struct chd *chd_data;
 	int qdly;
-	uint32_t cwin;
-	u_int mss;
 
 	e_t = khelp_get_osd(CCV(ccv, osd), ertt_id);
 	chd_data = ccv->cc_data;
 	qdly = imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt;
-	cwin = CCV(ccv, snd_cwnd);
-	mss = CCV(ccv, t_maxseg);
 
 	switch(signal_type) {
 	case CC_CHD_DELAY:
@@ -376,10 +372,6 @@ chd_cong_signal(struct cc_var *ccv, uint32_t signal_ty
 			    CCV(ccv, t_maxseg) / 2, 2) * CCV(ccv, t_maxseg);
 		}
 		ENTER_FASTRECOVERY(CCV(ccv, t_flags));
-		break;
-	case CC_RTO:
-		CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2);
-		CCV(ccv, snd_cwnd) = mss;
 		break;
 
 	default:

Modified: head/sys/netinet/cc/cc_cubic.c
==============================================================================
--- head/sys/netinet/cc/cc_cubic.c	Tue Jul 25 15:03:05 2017	(r321479)
+++ head/sys/netinet/cc/cc_cubic.c	Tue Jul 25 15:08:52 2017	(r321480)
@@ -225,12 +225,8 @@ static void
 cubic_cong_signal(struct cc_var *ccv, uint32_t type)
 {
 	struct cubic *cubic_data;
-	uint32_t cwin;
-	u_int mss;
 
 	cubic_data = ccv->cc_data;
-	cwin = CCV(ccv, snd_cwnd);
-	mss = CCV(ccv, t_maxseg);
 
 	switch (type) {
 	case CC_NDUPACK:
@@ -239,8 +235,7 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type)
 				cubic_ssthresh_update(ccv);
 				cubic_data->num_cong_events++;
 				cubic_data->prev_max_cwnd = cubic_data->max_cwnd;
-				cubic_data->max_cwnd = cwin;
-				CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
+				cubic_data->max_cwnd = CCV(ccv, snd_cwnd);
 			}
 			ENTER_RECOVERY(CCV(ccv, t_flags));
 		}
@@ -251,7 +246,7 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type)
 			cubic_ssthresh_update(ccv);
 			cubic_data->num_cong_events++;
 			cubic_data->prev_max_cwnd = cubic_data->max_cwnd;
-			cubic_data->max_cwnd = cwin;
+			cubic_data->max_cwnd = CCV(ccv, snd_cwnd);
 			cubic_data->t_last_cong = ticks;
 			CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
 			ENTER_CONGRECOVERY(CCV(ccv, t_flags));
@@ -266,13 +261,9 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type)
 		 * chance the first one is a false alarm and may not indicate
 		 * congestion.
 		 */
-		if (CCV(ccv, t_rxtshift) >= 2) {
+		if (CCV(ccv, t_rxtshift) >= 2)
 			cubic_data->num_cong_events++;
 			cubic_data->t_last_cong = ticks;
-			cubic_ssthresh_update(ccv);
-			cubic_data->max_cwnd = cwin;
-			CCV(ccv, snd_cwnd) = mss;
-		}
 		break;
 	}
 }

Modified: head/sys/netinet/cc/cc_dctcp.c
==============================================================================
--- head/sys/netinet/cc/cc_dctcp.c	Tue Jul 25 15:03:05 2017	(r321479)
+++ head/sys/netinet/cc/cc_dctcp.c	Tue Jul 25 15:08:52 2017	(r321480)
@@ -230,11 +230,10 @@ static void
 dctcp_cong_signal(struct cc_var *ccv, uint32_t type)
 {
 	struct dctcp *dctcp_data;
-	uint32_t cwin;
-	u_int mss;
+	u_int win, mss;
 
 	dctcp_data = ccv->cc_data;
-	cwin = CCV(ccv, snd_cwnd);
+	win = CCV(ccv, snd_cwnd);
 	mss = CCV(ccv, t_maxseg);
 
 	switch (type) {
@@ -242,16 +241,16 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type)
 		if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) {
 			if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
 				CCV(ccv, snd_ssthresh) = mss *
-				    max(cwin / 2 / mss, 2);
+				    max(win / 2 / mss, 2);
 				dctcp_data->num_cong_events++;
 			} else {
 				/* cwnd has already updated as congestion
 				 * recovery. Reverse cwnd value using
 				 * snd_cwnd_prev and recalculate snd_ssthresh
 				 */
-				cwin = CCV(ccv, snd_cwnd_prev);
+				win = CCV(ccv, snd_cwnd_prev);
 				CCV(ccv, snd_ssthresh) =
-				    max(cwin / 2 / mss, 2) * mss;
+				    max(win / 2 / mss, 2) * mss;
 			}
 			ENTER_RECOVERY(CCV(ccv, t_flags));
 		}
@@ -261,18 +260,18 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type)
 		 * Save current snd_cwnd when the host encounters both
 		 * congestion recovery and fast recovery.
 		 */
-		CCV(ccv, snd_cwnd_prev) = cwin;
+		CCV(ccv, snd_cwnd_prev) = win;
 		if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
 			if (V_dctcp_slowstart &&
 			    dctcp_data->num_cong_events++ == 0) {
 				CCV(ccv, snd_ssthresh) =
-				    mss * max(cwin / 2 / mss, 2);
+				    mss * max(win / 2 / mss, 2);
 				dctcp_data->alpha = MAX_ALPHA_VALUE;
 				dctcp_data->bytes_ecn = 0;
 				dctcp_data->bytes_total = 0;
 				dctcp_data->save_sndnxt = CCV(ccv, snd_nxt);
 			} else
-				CCV(ccv, snd_ssthresh) = max((cwin - ((cwin *
+				CCV(ccv, snd_ssthresh) = max((win - ((win *
 				    dctcp_data->alpha) >> 11)) / mss, 2) * mss;
 			CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
 			ENTER_CONGRECOVERY(CCV(ccv, t_flags));
@@ -285,8 +284,6 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type)
 			dctcp_update_alpha(ccv);
 			dctcp_data->save_sndnxt += CCV(ccv, t_maxseg);
 			dctcp_data->num_cong_events++;
-			CCV(ccv, snd_ssthresh) = max(2 * mss, cwin / 2);
-			CCV(ccv, snd_cwnd) = mss;
 		}
 		break;
 	}

Modified: head/sys/netinet/cc/cc_htcp.c
==============================================================================
--- head/sys/netinet/cc/cc_htcp.c	Tue Jul 25 15:03:05 2017	(r321479)
+++ head/sys/netinet/cc/cc_htcp.c	Tue Jul 25 15:08:52 2017	(r321480)
@@ -271,12 +271,8 @@ static void
 htcp_cong_signal(struct cc_var *ccv, uint32_t type)
 {
 	struct htcp *htcp_data;
-	uint32_t cwin;
-	u_int mss;
 
 	htcp_data = ccv->cc_data;
-	cwin = CCV(ccv, snd_cwnd);
-	mss = CCV(ccv, t_maxseg);
 
 	switch (type) {
 	case CC_NDUPACK:
@@ -291,9 +287,8 @@ htcp_cong_signal(struct cc_var *ccv, uint32_t type)
 				    (htcp_data->maxrtt - htcp_data->minrtt) *
 				    95) / 100;
 				htcp_ssthresh_update(ccv);
-				CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
 				htcp_data->t_last_cong = ticks;
-				htcp_data->prev_cwnd = cwin;
+				htcp_data->prev_cwnd = CCV(ccv, snd_cwnd);
 			}
 			ENTER_RECOVERY(CCV(ccv, t_flags));
 		}
@@ -310,7 +305,7 @@ htcp_cong_signal(struct cc_var *ccv, uint32_t type)
 			htcp_ssthresh_update(ccv);
 			CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
 			htcp_data->t_last_cong = ticks;
-			htcp_data->prev_cwnd = cwin;
+			htcp_data->prev_cwnd = CCV(ccv, snd_cwnd);
 			ENTER_CONGRECOVERY(CCV(ccv, t_flags));
 		}
 		break;
@@ -325,8 +320,6 @@ htcp_cong_signal(struct cc_var *ccv, uint32_t type)
 		 */
 		if (CCV(ccv, t_rxtshift) >= 2)
 			htcp_data->t_last_cong = ticks;
-		CCV(ccv, snd_ssthresh) = max(2 * mss, cwin / 2);
-		CCV(ccv, snd_cwnd) = mss;
 		break;
 	}
 }

Modified: head/sys/netinet/cc/cc_newreno.c
==============================================================================
--- head/sys/netinet/cc/cc_newreno.c	Tue Jul 25 15:03:05 2017	(r321479)
+++ head/sys/netinet/cc/cc_newreno.c	Tue Jul 25 15:08:52 2017	(r321480)
@@ -182,38 +182,29 @@ newreno_after_idle(struct cc_var *ccv)
 static void
 newreno_cong_signal(struct cc_var *ccv, uint32_t type)
 {
-	uint32_t cwin;
-	u_int mss;
+	u_int win;
 
-	cwin = CCV(ccv, snd_cwnd);
-	mss = CCV(ccv, t_maxseg);
-
 	/* Catch algos which mistakenly leak private signal types. */
 	KASSERT((type & CC_SIGPRIVMASK) == 0,
 	    ("%s: congestion signal type 0x%08x is private\n", __func__, type));
 
-	cwin = max(2*mss, cwin/2);
+	win = max(CCV(ccv, snd_cwnd) / 2 / CCV(ccv, t_maxseg), 2) *
+	    CCV(ccv, t_maxseg);
 
 	switch (type) {
 	case CC_NDUPACK:
 		if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) {
-			if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
-				CCV(ccv, snd_ssthresh) = cwin;
-				CCV(ccv, snd_cwnd) = cwin;
-			}
+			if (!IN_CONGRECOVERY(CCV(ccv, t_flags)))
+				CCV(ccv, snd_ssthresh) = win;
 			ENTER_RECOVERY(CCV(ccv, t_flags));
 		}
 		break;
 	case CC_ECN:
 		if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
-			CCV(ccv, snd_ssthresh) = cwin;
-			CCV(ccv, snd_cwnd) = cwin;
+			CCV(ccv, snd_ssthresh) = win;
+			CCV(ccv, snd_cwnd) = win;
 			ENTER_CONGRECOVERY(CCV(ccv, t_flags));
 		}
-		break;
-	case CC_RTO:
-		CCV(ccv, snd_ssthresh) = cwin;
-		CCV(ccv, snd_cwnd) = mss;
 		break;
 	}
 }

Modified: head/sys/netinet/tcp_input.c
==============================================================================
--- head/sys/netinet/tcp_input.c	Tue Jul 25 15:03:05 2017	(r321479)
+++ head/sys/netinet/tcp_input.c	Tue Jul 25 15:08:52 2017	(r321480)
@@ -435,15 +435,9 @@ cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, ui
 		tp->t_dupacks = 0;
 		tp->t_bytes_acked = 0;
 		EXIT_RECOVERY(tp->t_flags);
-		if (CC_ALGO(tp)->cong_signal == NULL) {
-			/*
-			 * RFC5681 Section 3.1 
-			 * ssthresh = max (FlightSize / 2, 2*SMSS) eq (4)
-			 */
-			tp->snd_ssthresh =
-			    max((tp->snd_max - tp->snd_una) / 2, 2 * maxseg);
-			tp->snd_cwnd = maxseg;
-		}
+		tp->snd_ssthresh = max(2, min(tp->snd_wnd, tp->snd_cwnd) / 2 /
+		    maxseg) * maxseg;
+		tp->snd_cwnd = maxseg;
 		break;
 	case CC_RTO_ERR:
 		TCPSTAT_INC(tcps_sndrexmitbad);
@@ -2612,15 +2606,6 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru
 
 						if (awnd < tp->snd_ssthresh) {
 							tp->snd_cwnd += maxseg;
-							/*
-							 * RFC5681 Section 3.2 talks about cwnd
-							 * inflation on additional dupacks and
-							 * deflation on recovering from loss.
-							 *
-							 * We keep cwnd into check so that
-							 * we don't have to 'deflate' it when we
-							 * get out of recovery.
-							 */
 							if (tp->snd_cwnd > tp->snd_ssthresh)
 								tp->snd_cwnd = tp->snd_ssthresh;
 						}
@@ -2660,22 +2645,19 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru
 						TCPSTAT_INC(
 						    tcps_sack_recovery_episode);
 						tp->sack_newdata = tp->snd_nxt;
-						if (CC_ALGO(tp)->cong_signal == NULL)
-							tp->snd_cwnd = maxseg;
+						tp->snd_cwnd = maxseg;
 						(void) tp->t_fb->tfb_tcp_output(tp);
 						goto drop;
 					}
 					tp->snd_nxt = th->th_ack;
-					if (CC_ALGO(tp)->cong_signal == NULL)
-						tp->snd_cwnd = maxseg;
+					tp->snd_cwnd = maxseg;
 					(void) tp->t_fb->tfb_tcp_output(tp);
 					KASSERT(tp->snd_limited <= 2,
 					    ("%s: tp->snd_limited too big",
 					    __func__));
-					if (CC_ALGO(tp)->cong_signal == NULL)
-						tp->snd_cwnd = tp->snd_ssthresh +
-						    maxseg *
-						    (tp->t_dupacks - tp->snd_limited);
+					tp->snd_cwnd = tp->snd_ssthresh +
+					     maxseg *
+					     (tp->t_dupacks - tp->snd_limited);
 					if (SEQ_GT(onxt, tp->snd_nxt))
 						tp->snd_nxt = onxt;
 					goto drop;

Modified: head/sys/netinet/tcp_stacks/fastpath.c
==============================================================================
--- head/sys/netinet/tcp_stacks/fastpath.c	Tue Jul 25 15:03:05 2017	(r321479)
+++ head/sys/netinet/tcp_stacks/fastpath.c	Tue Jul 25 15:08:52 2017	(r321480)
@@ -1052,15 +1052,6 @@ tcp_do_slowpath(struct mbuf *m, struct tcphdr *th, str
 
 						if (awnd < tp->snd_ssthresh) {
 							tp->snd_cwnd += tp->t_maxseg;
-							/*
-							 * RFC5681 Section 3.2 talks about cwnd
-							 * inflation on additional dupacks and
-							 * deflation on recovering from loss.
-							 *
-							 * We keep cwnd into check so that
-							 * we don't have to 'deflate' it when we
-							 * get out of recovery.
-							 */
 							if (tp->snd_cwnd > tp->snd_ssthresh)
 								tp->snd_cwnd = tp->snd_ssthresh;
 						}
@@ -1100,22 +1091,19 @@ tcp_do_slowpath(struct mbuf *m, struct tcphdr *th, str
 						TCPSTAT_INC(
 						    tcps_sack_recovery_episode);
 						tp->sack_newdata = tp->snd_nxt;
-						if (CC_ALGO(tp)->cong_signal == NULL)
-							tp->snd_cwnd = tp->t_maxseg;
+						tp->snd_cwnd = tp->t_maxseg;
 						(void) tp->t_fb->tfb_tcp_output(tp);
 						goto drop;
 					}
 					tp->snd_nxt = th->th_ack;
-					if (CC_ALGO(tp)->cong_signal == NULL)
-						tp->snd_cwnd = tp->t_maxseg;
+					tp->snd_cwnd = tp->t_maxseg;
 					(void) tp->t_fb->tfb_tcp_output(tp);
 					KASSERT(tp->snd_limited <= 2,
 					    ("%s: tp->snd_limited too big",
 					    __func__));
-					if (CC_ALGO(tp)->cong_signal == NULL)
-						tp->snd_cwnd = tp->snd_ssthresh +
-						    tp->t_maxseg *
-						    (tp->t_dupacks - tp->snd_limited);
+					tp->snd_cwnd = tp->snd_ssthresh +
+					     tp->t_maxseg *
+					     (tp->t_dupacks - tp->snd_limited);
 					if (SEQ_GT(onxt, tp->snd_nxt))
 						tp->snd_nxt = onxt;
 					goto drop;



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