git: 8018d75601df - main - tcp bbr: improve invalidating rtt

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Sun, 15 Nov 2026 19:00:23 UTC
The branch main has been updated by tuexen:

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

commit 8018d75601dfe804a8d70f4f08bdb0e4e3a8c5c9
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2026-11-15 18:56:25 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2026-11-15 18:56:25 +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
    MFC after:              Netflix, Inc.
    MFC to:                 stable/15
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D61585
---
 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 8b293208c282..49b5902f5ee4 100644
--- a/sys/netinet/tcp_stacks/bbr.c
+++ b/sys/netinet/tcp_stacks/bbr.c
@@ -5145,15 +5145,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;
@@ -6309,7 +6307,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