28 #include "ns3/tcp-socket-base.h"
42 .AddConstructor<TcpYeah> ()
43 .SetGroupName (
"Internet")
44 .AddAttribute (
"Alpha",
"Maximum backlog allowed at the bottleneck queue",
47 MakeUintegerChecker<uint32_t> ())
48 .AddAttribute (
"Gamma",
"Fraction of queue to be removed per RTT",
51 MakeUintegerChecker<uint32_t> ())
52 .AddAttribute (
"Delta",
"Log minimum fraction of cwnd to be removed on loss",
55 MakeUintegerChecker<uint32_t> ())
56 .AddAttribute (
"Epsilon",
"Log maximum fraction to be removed on early decongestion",
59 MakeUintegerChecker<uint32_t> ())
60 .AddAttribute (
"Phy",
"Maximum delta from base",
63 MakeUintegerChecker<uint32_t> ())
64 .AddAttribute (
"Rho",
"Minimum # of consecutive RTT to consider competition on loss",
67 MakeUintegerChecker<uint32_t> ())
68 .AddAttribute (
"Zeta",
"Minimum # of state switches to reset m_renoCount",
71 MakeUintegerChecker<uint32_t> ())
72 .AddAttribute (
"StcpAiFactor",
"STCP additive increase factor",
75 MakeUintegerChecker<uint32_t> ())
94 m_doingYeahNow (true),
102 m_stcp = CreateObject <TcpScalable> ();
108 m_alpha (sock.m_alpha),
109 m_gamma (sock.m_gamma),
110 m_delta (sock.m_delta),
111 m_epsilon (sock.m_epsilon),
114 m_zeta (sock.m_zeta),
115 m_stcpAiFactor (sock.m_stcpAiFactor),
116 m_baseRtt (sock.m_baseRtt),
117 m_minRtt (sock.m_minRtt),
118 m_cntRtt (sock.m_cntRtt),
119 m_doingYeahNow (sock.m_doingYeahNow),
120 m_begSndNxt (sock.m_begSndNxt),
121 m_lastQ (sock.m_lastQ),
122 m_doingRenoNow (sock.m_doingRenoNow),
123 m_renoCount (sock.m_renoCount),
124 m_fastCount (sock.m_fastCount)
138 return CopyObject<TcpYeah> (
this);
156 NS_LOG_DEBUG (
"Updated m_baseRtt = " << m_baseRtt.GetMilliSeconds () <<
" ms");
203 if (tcb->m_cWnd < tcb->m_ssThresh)
205 NS_LOG_LOGIC (
"In slow start, invoke NewReno slow start.");
210 NS_LOG_LOGIC (
"In Fast mode, increment cwnd according to STCP rule.");
211 m_stcp->IncreaseWindow (tcb, segmentsAcked);
212 NS_LOG_INFO (
"In Fast mode, updated to cwnd " << tcb->m_cWnd <<
213 " ssthresh " << tcb->m_ssThresh);
223 NS_LOG_LOGIC (
"A YeAH cycle has finished, check if enough RTT samples.");
230 NS_LOG_LOGIC (
"Enough RTT samples to perform YeAH calculations");
237 uint32_t segCwnd = tcb->GetCwndInSegments ();
249 " given by cwnd = " << segCwnd <<
251 " ms, baseRtt = " << m_baseRtt.GetMilliSeconds () <<
254 double L = rttQueue.
GetSeconds () / m_baseRtt.GetSeconds ();
261 NS_LOG_LOGIC (
"Execute the precautionary decongestion.");
263 segCwnd -= reduction;
265 tcb->m_cWnd = segCwnd * tcb->m_segmentSize;
266 tcb->m_ssThresh = tcb->m_cWnd;
268 NS_LOG_INFO (
"In Slow mode, after precautionary decongestion, "
269 "updated to cwnd " << tcb->m_cWnd <<
270 " ssthresh " << tcb->m_ssThresh);
283 NS_LOG_DEBUG (
"In Slow mode, updated to m_renoCount = " <<
295 NS_LOG_DEBUG (
"In Fast mode, updated to m_renoCount = " <<
318 uint32_t bytesInFlight)
322 uint32_t segBytesInFlight = bytesInFlight / tcb->m_segmentSize;
326 NS_LOG_LOGIC (
"Not competing with Reno flows upon loss");
329 reduction =
std::min (reduction,
std::max (segBytesInFlight >> 1, (uint32_t) 2));
334 reduction =
std::max (segBytesInFlight >> 1, (uint32_t) 2);
337 NS_LOG_INFO (
"Reduction amount upon loss = " << reduction);
342 return (bytesInFlight - (reduction * tcb->m_segmentSize));
Simulation virtual time values and global simulation resolution.
uint32_t m_stcpAiFactor
STCP additive increase parameter.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Normal state, no dubious events.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
TcpYeah(void)
Create an unbound tcp socket.
uint32_t m_fastCount
Number of RTTs in "Fast" mode.
virtual void CongestionStateSet(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState)
Enable/disable YeAH algorithm depending on the congestion state.
uint32_t m_epsilon
Log maximum fraction to be removed on early decongestion.
virtual uint32_t SlowStart(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Tcp NewReno slow start algorithm.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void DisableYeah()
Stop taking YeAH samples.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
uint32_t m_delta
Log minimum fraction of cwnd to be removed on loss.
The NewReno implementation.
uint32_t m_gamma
Fraction of queue to be removed per RTT when precautionary decongestion executed. ...
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Compute RTTs needed to execute YeAH algorithm.
static Time Max()
Maximum representable Time.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Time m_minRtt
Minimum of all RTTs measured within last RTT.
An implementation of TCP YeAH.
Hold an unsigned integer type.
int64x64_t Max(const int64x64_t &a, const int64x64_t &b)
Maximum.
uint32_t m_cntRtt
Number of RTT measurements during last RTT.
uint32_t m_phy
Maximum delta from base.
virtual std::string GetName() const
Get the name of the congestion control algorithm.
friend Ptr< T > CopyObject(Ptr< T > object)
Copy an Object.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
uint32_t m_renoCount
Estimated cwnd of competing Reno flow.
TcpCongState_t
Definition of the Congestion state machine.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void EnableYeah(const SequenceNumber32 &nextTxSequence)
Enable YeAH algorithm to start taking YeAH samples.
uint32_t m_lastQ
Last number of packets in the bottleneck queue.
Time m_baseRtt
Minimum of all YeAH RTT measurements seen during connection.
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across socket.
uint32_t m_rho
Minimum number of consecutive RTT to consider competition with Reno flows on loss.
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Adjust cwnd following YeAH dual-mode algorithm.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
bool m_doingYeahNow
If true, do YeAH for this RTT.
uint32_t m_zeta
Minimum number of state switches to reset m_renoCount.
Ptr< TcpScalable > m_stcp
TcpScalable object.
virtual void CongestionAvoidance(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
NewReno congestion avoidance.
static TypeId GetTypeId(void)
Get the type ID.
SequenceNumber32 m_begSndNxt
Right edge during last RTT.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
int64_t GetMilliSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
uint32_t m_alpha
Maximum backlog allowed at the bottleneck queue; Q_max in the paper.
uint32_t m_doingRenoNow
Number of RTTs in "Slow" mode.
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)
Get slow start threshold upon the receipt of 3 dupACKs.