diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-10-02 18:13:54 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-10-02 18:13:54 +0000 |
commit | 5310845d4446c30ed12a10c5c3a3466ddd506983 (patch) | |
tree | 88e0c7489eeb606e2e56719a216a58ec4b8d6cc0 /pkg/tcpip/transport/tcp | |
parent | c1507edf55f1fd65816a4555eff4d10390cb1c88 (diff) | |
parent | d23f1ec0fabf9c0f706f5e5b20843a0d176bc60c (diff) |
Merge release-20200921.0-100-gd23f1ec0f (automated)
Diffstat (limited to 'pkg/tcpip/transport/tcp')
-rw-r--r-- | pkg/tcpip/transport/tcp/rack.go | 16 | ||||
-rw-r--r-- | pkg/tcpip/transport/tcp/snd.go | 5 | ||||
-rw-r--r-- | pkg/tcpip/transport/tcp/tcp_state_autogen.go | 7 |
3 files changed, 20 insertions, 8 deletions
diff --git a/pkg/tcpip/transport/tcp/rack.go b/pkg/tcpip/transport/tcp/rack.go index d969ca23a..439932595 100644 --- a/pkg/tcpip/transport/tcp/rack.go +++ b/pkg/tcpip/transport/tcp/rack.go @@ -39,6 +39,9 @@ type rackControl struct { // sequence. fack seqnum.Value + // minRTT is the estimated minimum RTT of the connection. + minRTT time.Duration + // rtt is the RTT of the most recently delivered packet on the // connection (either cumulatively acknowledged or selectively // acknowledged) that was not marked invalid as a possible spurious @@ -48,7 +51,7 @@ type rackControl struct { // Update will update the RACK related fields when an ACK has been received. // See: https://tools.ietf.org/html/draft-ietf-tcpm-rack-08#section-7.2 -func (rc *rackControl) Update(seg *segment, ackSeg *segment, srtt time.Duration, offset uint32) { +func (rc *rackControl) Update(seg *segment, ackSeg *segment, offset uint32) { rtt := time.Now().Sub(seg.xmitTime) // If the ACK is for a retransmitted packet, do not update if it is a @@ -65,12 +68,21 @@ func (rc *rackControl) Update(seg *segment, ackSeg *segment, srtt time.Duration, return } } - if rtt < srtt { + if rtt < rc.minRTT { return } } rc.rtt = rtt + + // The sender can either track a simple global minimum of all RTT + // measurements from the connection, or a windowed min-filtered value + // of recent RTT measurements. This implementation keeps track of the + // simple global minimum of all RTTs for the connection. + if rtt < rc.minRTT || rc.minRTT == 0 { + rc.minRTT = rtt + } + // Update rc.xmitTime and rc.endSequence to the transmit time and // ending sequence number of the packet which has been acknowledged // most recently. diff --git a/pkg/tcpip/transport/tcp/snd.go b/pkg/tcpip/transport/tcp/snd.go index c55589c45..4c9a86cda 100644 --- a/pkg/tcpip/transport/tcp/snd.go +++ b/pkg/tcpip/transport/tcp/snd.go @@ -1365,9 +1365,6 @@ func (s *sender) handleRcvdSegment(rcvdSeg *segment) { ackLeft := acked originalOutstanding := s.outstanding - s.rtt.Lock() - srtt := s.rtt.srtt - s.rtt.Unlock() for ackLeft > 0 { // We use logicalLen here because we can have FIN // segments (which are always at the end of list) that @@ -1389,7 +1386,7 @@ func (s *sender) handleRcvdSegment(rcvdSeg *segment) { // Update the RACK fields if SACK is enabled. if s.ep.sackPermitted { - s.rc.Update(seg, rcvdSeg, srtt, s.ep.tsOffset) + s.rc.Update(seg, rcvdSeg, s.ep.tsOffset) } s.writeList.Remove(seg) diff --git a/pkg/tcpip/transport/tcp/tcp_state_autogen.go b/pkg/tcpip/transport/tcp/tcp_state_autogen.go index 1da199cd6..08f185795 100644 --- a/pkg/tcpip/transport/tcp/tcp_state_autogen.go +++ b/pkg/tcpip/transport/tcp/tcp_state_autogen.go @@ -411,6 +411,7 @@ func (x *rackControl) StateFields() []string { "xmitTime", "endSequence", "fack", + "minRTT", "rtt", } } @@ -423,7 +424,8 @@ func (x *rackControl) StateSave(m state.Sink) { m.SaveValue(0, xmitTime) m.Save(1, &x.endSequence) m.Save(2, &x.fack) - m.Save(3, &x.rtt) + m.Save(3, &x.minRTT) + m.Save(4, &x.rtt) } func (x *rackControl) afterLoad() {} @@ -431,7 +433,8 @@ func (x *rackControl) afterLoad() {} func (x *rackControl) StateLoad(m state.Source) { m.Load(1, &x.endSequence) m.Load(2, &x.fack) - m.Load(3, &x.rtt) + m.Load(3, &x.minRTT) + m.Load(4, &x.rtt) m.LoadValue(0, new(unixTime), func(y interface{}) { x.loadXmitTime(y.(unixTime)) }) } |