svn commit: r356235 - in head/sys/netinet: . cc

Michael Tuexen tuexen at FreeBSD.org
Tue Dec 31 16:15:48 UTC 2019


Author: tuexen
Date: Tue Dec 31 16:15:47 2019
New Revision: 356235
URL: https://svnweb.freebsd.org/changeset/base/356235

Log:
  Fix delayed ACK generation for DCTCP.
  
  Submitted by:		Richard Scheffenegger
  Reviewed by:		chengc at netapp.com, rgrimes@, tuexen@
  Differential Revision:	https://reviews.freebsd.org/D22644

Modified:
  head/sys/netinet/cc/cc_dctcp.c
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/cc/cc_dctcp.c
==============================================================================
--- head/sys/netinet/cc/cc_dctcp.c	Tue Dec 31 16:07:12 2019	(r356234)
+++ head/sys/netinet/cc/cc_dctcp.c	Tue Dec 31 16:15:47 2019	(r356235)
@@ -318,46 +318,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_flags2) |= TF2_ECN_SND_ECE;
+		if (!dctcp_data->ce_prev) {
+			acknow = 1;
+			dctcp_data->ce_prev = 1;
+			CCV(ccv, t_flags2) |= TF2_ECN_SND_ECE;
+		}
 	} else {
-		if (dctcp_data->ce_prev && (ccflag & CCF_DELACK))
-			delay_ack = 0;
-		dctcp_data->ce_prev = 0;
-		CCV(ccv, t_flags2) &= ~TF2_ECN_SND_ECE;
+		if (dctcp_data->ce_prev) {
+			acknow = 1;
+			dctcp_data->ce_prev = 0;
+			CCV(ccv, t_flags2) &= ~TF2_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: head/sys/netinet/tcp_input.c
==============================================================================
--- head/sys/netinet/tcp_input.c	Tue Dec 31 16:07:12 2019	(r356234)
+++ head/sys/netinet/tcp_input.c	Tue Dec 31 16:15:47 2019	(r356235)
@@ -538,15 +538,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;
+		}
 	}
 }
 


More information about the svn-src-all mailing list