From c77d00a7eeb31b7093548cb30d7982191286b191 Mon Sep 17 00:00:00 2001 From: Nayana Bidari Date: Wed, 31 May 2023 19:11:49 -0700 Subject: [PATCH] Set minimum value for RTT in TCP. RTT value should not be zero, set the minimum RTT value to 1ms. This does not happen often and was identified while investigating http://gvisor.dev/issues/6113. Updates #6113 PiperOrigin-RevId: 536885961 --- pkg/tcpip/transport/tcp/snd.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/tcpip/transport/tcp/snd.go b/pkg/tcpip/transport/tcp/snd.go index d762c410e..9c7306911 100644 --- a/pkg/tcpip/transport/tcp/snd.go +++ b/pkg/tcpip/transport/tcp/snd.go @@ -34,6 +34,9 @@ const ( // MaxRTO is the maximum allowed value for the retransmit timeout. MaxRTO = 120 * time.Second + // MinSRTT is the minimum allowed value for smoothed RTT. + MinSRTT = 1 * time.Millisecond + // InitialCwnd is the initial congestion window. InitialCwnd = 10 @@ -384,6 +387,10 @@ func (s *sender) updateRTO(rtt time.Duration) { } } + if s.rtt.TCPRTTState.SRTT < MinSRTT { + s.rtt.TCPRTTState.SRTT = MinSRTT + } + s.RTO = s.rtt.TCPRTTState.SRTT + 4*s.rtt.TCPRTTState.RTTVar s.rtt.Unlock() if s.RTO < s.minRTO {