Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Jun 2019 07:50:39 +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: r349226 - stable/12/sys/netinet/tcp_stacks
Message-ID:  <201906200750.x5K7odkA006667@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Thu Jun 20 07:50:38 2019
New Revision: 349226
URL: https://svnweb.freebsd.org/changeset/base/349226

Log:
  MFC r348728:
  
  r347382 added receiver side DSACK support for the TCP base stack.
  The corresponding changes for the RACK stack where missed and are added
  by this commit.

Modified:
  stable/12/sys/netinet/tcp_stacks/rack.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/tcp_stacks/rack.c
==============================================================================
--- stable/12/sys/netinet/tcp_stacks/rack.c	Thu Jun 20 07:17:16 2019	(r349225)
+++ stable/12/sys/netinet/tcp_stacks/rack.c	Thu Jun 20 07:50:38 2019	(r349226)
@@ -1790,6 +1790,17 @@ rack_drop_checks(struct tcpopt *to, struct mbuf *m, st
 			TCPSTAT_INC(tcps_rcvpartduppack);
 			TCPSTAT_ADD(tcps_rcvpartdupbyte, todrop);
 		}
+		/*
+		 * DSACK - add SACK block for dropped range
+		 */
+		if (tp->t_flags & TF_SACK_PERMIT) {
+			tcp_update_sack_list(tp, th->th_seq, th->th_seq + tlen);
+			/*
+			 * ACK now, as the next in-sequence segment
+			 * will clear the DSACK block again
+			 */
+			tp->t_flags |= TF_ACKNOW;
+		}
 		*drop_hdrlen += todrop;	/* drop from the top afterwards */
 		th->th_seq += todrop;
 		tlen -= todrop;
@@ -4822,6 +4833,8 @@ dodata:				/* XXX */
 	if ((tlen || (thflags & TH_FIN) || tfo_syn) &&
 	    TCPS_HAVERCVDFIN(tp->t_state) == 0) {
 		tcp_seq save_start = th->th_seq;
+		tcp_seq save_rnxt  = tp->rcv_nxt;
+		int     save_tlen  = tlen;
 
 		m_adj(m, drop_hdrlen);	/* delayed header drop */
 		/*
@@ -4864,11 +4877,29 @@ dodata:				/* XXX */
 			 * m_adj() doesn't actually frees any mbufs when
 			 * trimming from the head.
 			 */
-			thflags = tcp_reass(tp, th, &save_start, &tlen, m);
+			tcp_seq temp = save_start;
+			thflags = tcp_reass(tp, th, &temp, &tlen, m);
 			tp->t_flags |= TF_ACKNOW;
 		}
-		if (tlen > 0)
-			tcp_update_sack_list(tp, save_start, save_start + tlen);
+		if (((tlen == 0) && (save_tlen > 0) &&
+		    (SEQ_LT(save_start, save_rnxt)))) {
+			/*
+			 * DSACK actually handled in the fastpath
+			 * above.
+			 */
+			tcp_update_sack_list(tp, save_start, save_start + save_tlen);
+		} else if ((tlen > 0) && SEQ_GT(tp->rcv_nxt, save_rnxt)) {
+			/*
+			 * Cleaning sackblks by using zero length
+			 * update.
+			 */
+			tcp_update_sack_list(tp, save_start, save_start);
+		} else if ((tlen > 0) && (tlen >= save_tlen)) {
+			/* Update of sackblks. */
+			tcp_update_sack_list(tp, save_start, save_start + save_tlen);
+		} else if (tlen > 0) {
+			tcp_update_sack_list(tp, save_start, save_start+tlen);
+		}
 	} else {
 		m_freem(m);
 		thflags &= ~TH_FIN;



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