Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Sep 2020 13:27:53 +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-12@freebsd.org
Subject:   svn commit: r365572 - in stable/12/sys/netinet: . cc
Message-ID:  <202009101327.08ADRr88075318@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Thu Sep 10 13:27:53 2020
New Revision: 365572
URL: https://svnweb.freebsd.org/changeset/base/365572

Log:
  MFC r356235:
  Fix delayed ACK generation for DCTCP.
  Manually changed to use TF_ECN_SND_ECE.

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

Modified: stable/12/sys/netinet/cc/cc_dctcp.c
==============================================================================
--- stable/12/sys/netinet/cc/cc_dctcp.c	Thu Sep 10 13:17:23 2020	(r365571)
+++ stable/12/sys/netinet/cc/cc_dctcp.c	Thu Sep 10 13:27:53 2020	(r365572)
@@ -272,9 +272,9 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type)
 					dctcp_data->bytes_total = 0;
 					dctcp_data->save_sndnxt = CCV(ccv, snd_nxt);
 				} else
-					CCV(ccv, snd_ssthresh) = 
+					CCV(ccv, snd_ssthresh) =
 					    max((cwin - (((uint64_t)cwin *
-					    dctcp_data->alpha) >> (DCTCP_SHIFT+1))), 
+					    dctcp_data->alpha) >> (DCTCP_SHIFT+1))),
 					    2 * mss);
 				CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
 				ENTER_CONGRECOVERY(CCV(ccv, t_flags));
@@ -316,46 +316,43 @@ dctcp_post_recovery(struct cc_var *ccv)
 }
 
 /*
- * Execute an additional ECN processing using ECN field in IP header and the CWR
- * bit in TCP header.
- *
- * delay_ack == 0 - Delayed ACK disabled
- * delay_ack == 1 - Delayed ACK enabled
+ * Execute an additional ECN processing using ECN field in IP header
+ * and the CWR bit in TCP header.
  */
-
 static void
 dctcp_ecnpkt_handler(struct cc_var *ccv)
 {
 	struct dctcp *dctcp_data;
 	uint32_t ccflag;
-	int delay_ack;
+	int acknow;
 
 	dctcp_data = ccv->cc_data;
 	ccflag = ccv->flags;
-	delay_ack = 1;
+	acknow = 0;
 
 	/*
 	 * DCTCP responds with an ACK immediately when the CE state
 	 * in between this segment and the last segment has changed.
 	 */
 	if (ccflag & CCF_IPHDR_CE) {
-		if (!dctcp_data->ce_prev && (ccflag & CCF_DELACK))
-			delay_ack = 0;
-		dctcp_data->ce_prev = 1;
-		CCV(ccv, t_flags) |= TF_ECN_SND_ECE;
+		if (!dctcp_data->ce_prev) {
+			acknow = 1;
+			dctcp_data->ce_prev = 1;
+			CCV(ccv, t_flags2) |= TF_ECN_SND_ECE;
+		}
 	} else {
-		if (dctcp_data->ce_prev && (ccflag & CCF_DELACK))
-			delay_ack = 0;
-		dctcp_data->ce_prev = 0;
-		CCV(ccv, t_flags) &= ~TF_ECN_SND_ECE;
+		if (dctcp_data->ce_prev) {
+			acknow = 1;
+			dctcp_data->ce_prev = 0;
+			CCV(ccv, t_flags2) &= ~TF_ECN_SND_ECE;
+		}
 	}
 
-	/* DCTCP sets delayed ack when this segment sets the CWR flag. */
-	if ((ccflag & CCF_DELACK) && (ccflag & CCF_TCPHDR_CWR))
-		delay_ack = 1;
-
-	if (delay_ack == 0)
+	if ((acknow) || (ccflag & CCF_TCPHDR_CWR)) {
 		ccv->flags |= CCF_ACKNOW;
+	} else {
+		ccv->flags &= ~CCF_ACKNOW;
+	}
 }
 
 /*

Modified: stable/12/sys/netinet/tcp_input.c
==============================================================================
--- stable/12/sys/netinet/tcp_input.c	Thu Sep 10 13:17:23 2020	(r365571)
+++ stable/12/sys/netinet/tcp_input.c	Thu Sep 10 13:27:53 2020	(r365572)
@@ -516,15 +516,12 @@ cc_ecnpkt_handler(struct tcpcb *tp, struct tcphdr *th,
 		else
 			tp->ccv->flags &= ~CCF_TCPHDR_CWR;
 
-		if (tp->t_flags & TF_DELACK)
-			tp->ccv->flags |= CCF_DELACK;
-		else
-			tp->ccv->flags &= ~CCF_DELACK;
-
 		CC_ALGO(tp)->ecnpkt_handler(tp->ccv);
 
-		if (tp->ccv->flags & CCF_ACKNOW)
+		if (tp->ccv->flags & CCF_ACKNOW) {
 			tcp_timer_activate(tp, TT_DELACK, tcp_delacktime);
+			tp->t_flags |= TF_ACKNOW;
+		}
 	}
 }
 



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