git: f450156bea76 - stable/13 - tcp rack: simplify computation of rsm start and end

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Wed, 01 Feb 2023 23:31:26 UTC
The branch stable/13 has been updated by tuexen:

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

commit f450156bea766c71d5728e907c08f3ef142caf45
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2022-08-02 10:45:56 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2023-02-01 23:30:58 +0000

    tcp rack: simplify computation of rsm start and end
    
    While there, also fix the setting of the SYN related flag.
    
    Reviewed by:            rrs
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D35862
    
    (cherry picked from commit 1abc27dd52e5fd151472439004f20dc798887ae1)
---
 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 e11351e5c515..162b1c928ef7 100644
--- a/sys/netinet/tcp_stacks/rack.c
+++ b/sys/netinet/tcp_stacks/rack.c
@@ -12285,14 +12285,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);