diff --git a/src/internet/model/tcp-dctcp.cc b/src/internet/model/tcp-dctcp.cc index 7ba1f5a1d..7c450785a 100644 --- a/src/internet/model/tcp-dctcp.cc +++ b/src/internet/model/tcp-dctcp.cc @@ -112,12 +112,19 @@ TcpDctcp::Init (Ptr tcb) tcb->m_ectCodePoint = m_useEct0 ? TcpSocketState::Ect0 : TcpSocketState::Ect1; } +// Step 9, Section 3.3 of RFC 8257. GetSsThresh() is called upon +// entering the CWR state, and then later, when CWR is exited, +// cwnd is set to ssthresh (this value). bytesInFlight is ignored. +uint32_t +TcpDctcp::GetSsThresh (Ptr tcb, uint32_t bytesInFlight) +{ + NS_LOG_FUNCTION (this << tcb << bytesInFlight); + return static_cast ((1 - m_alpha / 2.0) * tcb->m_cWnd); +} + void TcpDctcp::ReduceCwnd (Ptr tcb) { - NS_LOG_FUNCTION (this << tcb); - uint32_t val = static_cast ((1 - m_alpha / 2.0) * tcb->m_cWnd); - tcb->m_cWnd = std::max (val, 2 * tcb->m_segmentSize); } void diff --git a/src/internet/model/tcp-dctcp.h b/src/internet/model/tcp-dctcp.h index e06d21bb2..2fcb04ad3 100644 --- a/src/internet/model/tcp-dctcp.h +++ b/src/internet/model/tcp-dctcp.h @@ -72,6 +72,8 @@ public: virtual void Init (Ptr tcb); // Documented in base class + virtual uint32_t GetSsThresh (Ptr tcb, + uint32_t bytesInFlight); virtual Ptr Fork (); virtual void ReduceCwnd (Ptr tcb); virtual void PktsAcked (Ptr tcb, uint32_t segmentsAcked,