git: 8c4970ff4947 - releng/15.2 - tcp bbr: improve invalidating rtt

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Fri, 27 Nov 2026 00:00:21 UTC
The branch releng/15.2 has been updated by cperciva:

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

commit 8c4970ff4947d596f2f5f4b0fc2e95869a7af4d7
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2026-11-15 18:56:25 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-11-26 23:59:40 +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.
    
    Approved by:    re (cperciva)
    Reviewed by:            Peter Lei
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D61585
    
    (cherry picked from commit 8018d75601dfe804a8d70f4f08bdb0e4e3a8c5c9)
    (cherry picked from commit 158dcb8e415d84caf6ebc30841ed4bfc3148bc32)
---
 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