mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Update minimum RTT for RACK.
We are currently tracking the minimum RTT for RACK as smoothed RTT. As per RFC minimum RTT can be a global minimum of all RTTs or filtered value of recent RTT measurements. In this cl minimum RTT is updated to global minimum of all RTTs for the connection. PiperOrigin-RevId: 335061518
This commit is contained in:
committed by
gVisor bot
parent
02cff90ad9
commit
d23f1ec0fa
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user