From 5f8c66e26a94f19486d574255e82b99bf8849ea3 Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Mon, 3 Aug 2026 20:04:20 +0800 Subject: [PATCH] tcp: prevent CUBIC ACKs from reducing cwnd Clamp the computed CUBIC window to the current congestion window before processing ACKs. This prevents ACK processing from reducing cwnd when the computed target falls below it, as required by RFC 9438 section 4.2. --- pkg/tcpip/transport/tcp/cubic.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/tcpip/transport/tcp/cubic.go b/pkg/tcpip/transport/tcp/cubic.go index cd2489a4468..a6328bc98a7 100644 --- a/pkg/tcpip/transport/tcp/cubic.go +++ b/pkg/tcpip/transport/tcp/cubic.go @@ -260,6 +260,11 @@ func (c *cubicState) getCwnd(packetsAcked, sndCwnd int, srtt time.Duration) int // As per 4.3 for each received ACK cwnd must be incremented // by (w_cubic(t+RTT) - cwnd/cwnd. cwnd := float64(sndCwnd) + // RFC 9438 section 4.2 bounds the target at cwnd so an ACK does not + // reduce the congestion window. + if wtRtt < cwnd { + wtRtt = cwnd + } for i := 0; i < packetsAcked; i++ { // Concave/Convex regions of cubic have the same formulas. // See: https://tools.ietf.org/html/rfc8312#section-4.3