git: 71cc98ba7352 - stable/13 - tcp: Add prr_out in preparation for PRR/nonSACK and LRD

Richard Scheffenegger rscheff at FreeBSD.org
Mon Mar 8 11:26:41 UTC 2021


The branch stable/13 has been updated by rscheff:

URL: https://cgit.FreeBSD.org/src/commit/?id=71cc98ba735283b8720c9031eb87810f3d3d96a0

commit 71cc98ba735283b8720c9031eb87810f3d3d96a0
Author:     Richard Scheffenegger <rscheff at FreeBSD.org>
AuthorDate: 2021-03-05 23:36:48 +0000
Commit:     Richard Scheffenegger <rscheff at FreeBSD.org>
CommitDate: 2021-03-08 11:23:58 +0000

    tcp: Add prr_out in preparation for PRR/nonSACK and LRD
    
    Reviewed By:           #transport, kbowling
    MFC after:             3 days
    Sponsored By:          Netapp, Inc.
    Differential Revision: https://reviews.freebsd.org/D29058
    
    (cherry picked from commit e53138694aa41c24c17847afe959225ce0eeff91)
---
 sys/netinet/tcp_input.c  | 21 ++++++++-------------
 sys/netinet/tcp_output.c |  8 ++++++++
 sys/netinet/tcp_var.h    |  2 +-
 3 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 4773c8fb3dac..e000c589c78e 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -510,6 +510,7 @@ cc_post_recovery(struct tcpcb *tp, struct tcphdr *th)
 	}
 	/* XXXLAS: EXIT_RECOVERY ? */
 	tp->t_bytes_acked = 0;
+	tp->sackhint.prr_out = 0;
 }
 
 /*
@@ -2601,17 +2602,14 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
 								    imax(1, tp->snd_nxt - tp->snd_una);
 							snd_cnt = howmany((long)tp->sackhint.prr_delivered *
 							    tp->snd_ssthresh, tp->sackhint.recover_fs) -
-							    (tp->sackhint.sack_bytes_rexmit +
-							    (tp->snd_nxt - tp->snd_recover));
+							    tp->sackhint.prr_out;
 						} else {
 							if (V_tcp_do_prr_conservative)
 								limit = tp->sackhint.prr_delivered -
-									(tp->sackhint.sack_bytes_rexmit +
-									(tp->snd_nxt - tp->snd_recover));
+									tp->sackhint.prr_out;
 							else
 								limit = imax(tp->sackhint.prr_delivered -
-									    (tp->sackhint.sack_bytes_rexmit +
-									    (tp->snd_nxt - tp->snd_recover)),
+									    tp->sackhint.prr_out,
 									    del_data) + maxseg;
 							snd_cnt = imin(tp->snd_ssthresh - pipe, limit);
 						}
@@ -3978,18 +3976,15 @@ tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th)
 			    imax(1, tp->snd_nxt - tp->snd_una);
 		snd_cnt = howmany((long)tp->sackhint.prr_delivered *
 			    tp->snd_ssthresh, tp->sackhint.recover_fs) -
-			    (tp->sackhint.sack_bytes_rexmit +
-			    (tp->snd_nxt - tp->snd_recover));
+			    tp->sackhint.prr_out;
 	} else {
 		if (V_tcp_do_prr_conservative)
 			limit = tp->sackhint.prr_delivered -
-			    (tp->sackhint.sack_bytes_rexmit +
-			    (tp->snd_nxt - tp->snd_recover));
+			    tp->sackhint.prr_out;
 		else
 			limit = imax(tp->sackhint.prr_delivered -
-				    (tp->sackhint.sack_bytes_rexmit +
-				    (tp->snd_nxt - tp->snd_recover)),
-				    del_data) + maxseg;
+				    tp->sackhint.prr_out, del_data) +
+				    maxseg;
 		snd_cnt = imin((tp->snd_ssthresh - pipe), limit);
 	}
 	snd_cnt = imax(snd_cnt, 0) / maxseg;
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index b4c7ab0a1ab7..d4b5a328e2a6 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -1236,6 +1236,14 @@ send:
 		p->rxmit += len;
 		tp->sackhint.sack_bytes_rexmit += len;
 	}
+	if (IN_RECOVERY(tp->t_flags)) {
+		/*
+		 * Account all bytes transmitted while
+		 * IN_RECOVERY, simplifying PRR and
+		 * Lost Retransmit Detection
+		 */
+		tp->sackhint.prr_out += len;
+	}
 	th->th_ack = htonl(tp->rcv_nxt);
 	if (optlen) {
 		bcopy(opt, th + 1, optlen);
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 6e22d75ac441..3b007fcfcc93 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -115,7 +115,7 @@ struct sackhint {
 					 */
 	uint32_t	recover_fs;	/* Flight Size at the start of Loss recovery */
 	uint32_t	prr_delivered;	/* Total bytes delivered using PRR */
-	uint32_t	_pad[1];	/* TBD */
+	uint32_t	prr_out;	/* Bytes sent during IN_RECOVERY */
 };
 
 #define SEGQ_EMPTY(tp) TAILQ_EMPTY(&(tp)->t_segq)


More information about the dev-commits-src-all mailing list