git: 1abc27dd52e5 - main - tcp rack: simplify computation of rsm start and end

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Tue, 02 Aug 2022 10:49:24 UTC
The branch main has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=1abc27dd52e5fd151472439004f20dc798887ae1

commit 1abc27dd52e5fd151472439004f20dc798887ae1
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2022-08-02 10:45:56 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2022-08-02 10:45:56 +0000

    tcp rack: simplify computation of rsm start and end
    
    While there, also fix the setting of the SYN related flag.
    
    Reviewed by:            rrs
    MFC after:              1 week
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D35862
---
 sys/netinet/tcp_stacks/rack.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c
index ce33f507bc1c..c3008b38dd4f 100644
--- a/sys/netinet/tcp_stacks/rack.c
+++ b/sys/netinet/tcp_stacks/rack.c
@@ -12610,14 +12610,11 @@ rack_init(struct tcpcb *tp)
 		rsm->r_rtr_bytes = 0;
 		if (tp->t_flags & TF_SENTFIN)
 			rsm->r_flags |= RACK_HAS_FIN;
-		rsm->r_end = tp->snd_max;
-		if (tp->snd_una == tp->iss) {
-			/* The data space is one beyond snd_una */
+		if ((tp->snd_una == tp->iss) &&
+		    !TCPS_HAVEESTABLISHED(tp->t_state))
 			rsm->r_flags |= RACK_HAS_SYN;
-			rsm->r_start = tp->iss;
-			rsm->r_end = rsm->r_start + (tp->snd_max - tp->snd_una);
-		} else
-			rsm->r_start = tp->snd_una;
+		rsm->r_start = tp->snd_una;
+		rsm->r_end = tp->snd_max;
 		rsm->r_dupack = 0;
 		if (rack->rc_inp->inp_socket->so_snd.sb_mb != NULL) {
 			rsm->m = sbsndmbuf(&rack->rc_inp->inp_socket->so_snd, 0, &rsm->soff);