Adds support to dump out cubic internal state.

PiperOrigin-RevId: 207754087
Change-Id: I83abce64348ea93f8692da81a881b364dae2158b
This commit is contained in:
Bhasker Hariharan 2018-08-07 11:48:37 -07:00 committed by Shentubot
parent a38f41b464
commit 7d3684aadf
2 changed files with 31 additions and 0 deletions

View File

@ -56,6 +56,20 @@ type transportProtocolState struct {
// passed to stack.AddTCPProbe.
type TCPProbeFunc func(s TCPEndpointState)
// TCPCubicState is used to hold a copy of the internal cubic state when the
// TCPProbeFunc is invoked.
type TCPCubicState struct {
WLastMax float64
WMax float64
T time.Time
TimeSinceLastCongestion time.Duration
C float64
K float64
Beta float64
WC float64
WEst float64
}
// TCPEndpointID is the unique 4 tuple that identifies a given endpoint.
type TCPEndpointID struct {
// LocalPort is the local port associated with the endpoint.
@ -180,6 +194,9 @@ type TCPSenderState struct {
// FastRecovery holds the fast recovery state for the endpoint.
FastRecovery TCPFastRecoveryState
// Cubic holds the state related to CUBIC congestion control.
Cubic TCPCubicState
}
// TCPSACKInfo holds TCP SACK related information for a given TCP endpoint.

View File

@ -1452,5 +1452,19 @@ func (e *endpoint) completeState() stack.TCPEndpointState {
SndWndScale: e.snd.sndWndScale,
MaxSentAck: e.snd.maxSentAck,
}
if cubic, ok := e.snd.cc.(*cubicState); ok {
s.Sender.Cubic = stack.TCPCubicState{
WMax: cubic.wMax,
WLastMax: cubic.wLastMax,
T: cubic.t,
TimeSinceLastCongestion: time.Since(cubic.t),
C: cubic.c,
K: cubic.k,
Beta: cubic.beta,
WC: cubic.wC,
WEst: cubic.wEst,
}
}
return s
}