From 5b3df2fa8e1a553a6b3ddd851aff7f3bd328c519 Mon Sep 17 00:00:00 2001 From: Shefali Gupta Date: Mon, 4 Jun 2018 21:07:42 +0200 Subject: [PATCH] tcp: (fixes #2921) Add min_cwnd variable --- RELEASE_NOTES | 1 + src/internet/model/tcp-ledbat.cc | 11 +++++++++-- src/internet/model/tcp-ledbat.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 916dbc1fb..8dbf124d2 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -32,6 +32,7 @@ New user-visible features Bugs fixed ---------- +- Bug 2921 - tcp: Add min_cwnd variable to LEDBAT - Bug 2911 - aodv: Binary exponential backoff can become unlimited - Bug 2901 - Add CommandLine::Parse (const std::vector> args) - Bug 2891 - netanim: dumbbell-animation breaks when RightCount > LeftCount diff --git a/src/internet/model/tcp-ledbat.cc b/src/internet/model/tcp-ledbat.cc index 5c4d7439b..1c9377121 100644 --- a/src/internet/model/tcp-ledbat.cc +++ b/src/internet/model/tcp-ledbat.cc @@ -61,6 +61,11 @@ TcpLedbat::GetTypeId (void) MakeEnumAccessor (&TcpLedbat::SetDoSs), MakeEnumChecker (DO_SLOWSTART, "yes", DO_NOT_SLOWSTART, "no")) + .AddAttribute ("MIN_CWND", + "Minimum cWnd for Ledbat", + UintegerValue (2), + MakeUintegerAccessor (&TcpLedbat::m_minCwnd), + MakeUintegerChecker ()) ; return tid; } @@ -93,7 +98,8 @@ TcpLedbat::TcpLedbat (void) m_lastRollover = 0; m_sndCwndCnt = 0; m_flag = LEDBAT_CAN_SS; -} + m_minCwnd = 2; +}; void TcpLedbat::InitCircBuf (struct OwdCircBuf &buffer) { @@ -116,6 +122,7 @@ TcpLedbat::TcpLedbat (const TcpLedbat& sock) m_lastRollover = sock.m_lastRollover; m_sndCwndCnt = sock.m_sndCwndCnt; m_flag = sock.m_flag; + m_minCwnd = sock.m_minCwnd; } TcpLedbat::~TcpLedbat (void) @@ -210,7 +217,7 @@ void TcpLedbat::CongestionAvoidance (Ptr tcb, uint32_t segmentsA max_cwnd = static_cast(tcb->m_highTxMark.Get () - tcb->m_lastAckedSeq) + segmentsAcked * tcb->m_segmentSize; cwnd = std::min (cwnd, max_cwnd); - cwnd = std::max (cwnd, tcb->m_segmentSize); + cwnd = std::max (cwnd, m_minCwnd * tcb->m_segmentSize); tcb->m_cWnd = cwnd; if (tcb->m_cWnd <= tcb->m_ssThresh) diff --git a/src/internet/model/tcp-ledbat.h b/src/internet/model/tcp-ledbat.h index a5458b7e1..5e06298ef 100644 --- a/src/internet/model/tcp-ledbat.h +++ b/src/internet/model/tcp-ledbat.h @@ -192,6 +192,7 @@ private: OwdCircBuf m_baseHistory; //!< Buffer to store the base delay OwdCircBuf m_noiseFilter; //!< Buffer to store the current delay uint32_t m_flag; //!< LEDBAT Flag + uint32_t m_minCwnd; //!< Minimum cWnd value mentioned in RFC 6817 }; } // namespace ns3