From a37e7fb06e61a3dd260fb32126d66e34029f5194 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Wed, 25 Nov 2020 14:20:21 -0800 Subject: [PATCH] tcp: Update DCTCP to avoid use of ReduceCwnd --- src/internet/model/tcp-dctcp.cc | 13 ++++++++++--- src/internet/model/tcp-dctcp.h | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) 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,