git: 158dcb8e415d - stable/15 - tcp bbr: improve invalidating rtt

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Tue, 24 Nov 2026 10:43:01 UTC
The branch stable/15 has been updated by tuexen:

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

commit 158dcb8e415d84caf6ebc30841ed4bfc3148bc32
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2026-11-15 18:56:25 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2026-11-24 09:54:18 +0000

    tcp bbr: improve invalidating rtt
    
    Invalidate the rtt based on t_rxtshift instead of resetting t_srtt to 0,
    because using the latter also affects the retransmission timeout.
    
    Reviewed by:            Peter Lei
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D61585
    
    (cherry picked from commit 8018d75601dfe804a8d70f4f08bdb0e4e3a8c5c9)
---
 sys/netinet/tcp_stacks/bbr.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c
index dd17cefe1449..f2ab0a291c5e 100644
--- a/sys/netinet/tcp_stacks/bbr.c
+++ b/sys/netinet/tcp_stacks/bbr.c
@@ -5151,15 +5151,13 @@ bbr_timeout_rxt(struct tcpcb *tp, struct tcp_bbr *bbr, uint32_t cts)
 	 * move the current srtt into rttvar to keep the current retransmit
 	 * times until then.
 	 */
-	if (tp->t_rxtshift > TCP_MAXRXTSHIFT / 4) {
+	if (tp->t_rxtshift > TCP_RTT_INVALIDATE) {
 #ifdef INET6
 		if (bbr->r_is_v6)
 			in6_losing(inp);
 		else
 #endif
 			in_losing(inp);
-		tp->t_rttvar += (tp->t_srtt >> TCP_RTT_SHIFT);
-		tp->t_srtt = 0;
 	}
 	sack_filter_clear(&bbr->r_ctl.bbr_sf, tp->snd_una);
 	tp->snd_recover = tp->snd_max;
@@ -6315,7 +6313,7 @@ tcp_bbr_xmit_timer_commit(struct tcp_bbr *bbr, struct tcpcb *tp, uint32_t cts)
 	}
 	/* Round it up */
 	rtt_ticks = USEC_2_TICKS((rtt + (USECS_IN_MSEC - 1)));
-	if (tp->t_srtt != 0) {
+	if (tp->t_srtt != 0 && tp->t_rxtshift <= TCP_RTT_INVALIDATE) {
 		/*
 		 * srtt is stored as fixed point with 5 bits after the
 		 * binary point (i.e., scaled by 8).  The following magic is