31 .AddConstructor<TcpYeah>()
32 .SetGroupName(
"Internet")
33 .AddAttribute(
"Alpha",
34 "Maximum backlog allowed at the bottleneck queue",
38 .AddAttribute(
"Gamma",
39 "Fraction of queue to be removed per RTT",
43 .AddAttribute(
"Delta",
44 "Log minimum fraction of cwnd to be removed on loss",
48 .AddAttribute(
"Epsilon",
49 "Log maximum fraction to be removed on early decongestion",
54 "Maximum delta from base",
59 "Minimum # of consecutive RTT to consider competition on loss",
64 "Minimum # of state switches to reset m_renoCount",
68 .AddAttribute(
"StcpAiFactor",
69 "STCP additive increase factor",
104 m_alpha(sock.m_alpha),
105 m_gamma(sock.m_gamma),
106 m_delta(sock.m_delta),
107 m_epsilon(sock.m_epsilon),
111 m_stcpAiFactor(sock.m_stcpAiFactor),
112 m_baseRtt(sock.m_baseRtt),
113 m_minRtt(sock.m_minRtt),
114 m_cntRtt(sock.m_cntRtt),
115 m_doingYeahNow(sock.m_doingYeahNow),
116 m_begSndNxt(sock.m_begSndNxt),
117 m_lastQ(sock.m_lastQ),
118 m_doingRenoNow(sock.m_doingRenoNow),
119 m_renoCount(sock.m_renoCount),
120 m_fastCount(sock.m_fastCount)
197 if (tcb->m_cWnd < tcb->m_ssThresh)
199 NS_LOG_LOGIC(
"In slow start, invoke NewReno slow start.");
204 NS_LOG_LOGIC(
"In Fast mode, increment cwnd according to STCP rule.");
205 m_stcp->IncreaseWindow(tcb, segmentsAcked);
206 NS_LOG_INFO(
"In Fast mode, updated to cwnd " << tcb->m_cWnd <<
" ssthresh "
217 NS_LOG_LOGIC(
"A YeAH cycle has finished, check if enough RTT samples.");
224 NS_LOG_LOGIC(
"Enough RTT samples to perform YeAH calculations");
231 uint32_t segCwnd = tcb->GetCwndInSegments();
242 NS_LOG_DEBUG(
"Queue backlog = " << queue <<
" given by cwnd = " << segCwnd
254 NS_LOG_LOGIC(
"Execute the precautionary decongestion.");
256 segCwnd -= reduction;
258 tcb->m_cWnd = segCwnd * tcb->m_segmentSize;
259 tcb->m_ssThresh = tcb->m_cWnd;
261 NS_LOG_INFO(
"In Slow mode, after precautionary decongestion, "
263 << tcb->m_cWnd <<
" ssthresh " << tcb->m_ssThresh);
314 uint32_t segBytesInFlight = bytesInFlight / tcb->m_segmentSize;
318 NS_LOG_LOGIC(
"Not competing with Reno flows upon loss");
320 reduction = std::max(reduction, segBytesInFlight >>
m_delta);
321 reduction = std::min(reduction, std::max(segBytesInFlight >> 1, 2U));
326 reduction = std::max(segBytesInFlight >> 1,
static_cast<uint32_t>(2));
329 NS_LOG_INFO(
"Reduction amount upon loss = " << reduction);
336 std::max(bytesInFlight - (reduction * tcb->m_segmentSize), 2U * tcb->m_segmentSize);
friend Ptr< T > CopyObject(Ptr< T > object)
Copy an Object.
Smart pointer class similar to boost::intrusive_ptr.
The NewReno implementation.
virtual uint32_t SlowStart(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Tcp NewReno slow start algorithm.
virtual void CongestionAvoidance(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
NewReno congestion avoidance.
TcpCongState_t
Definition of the Congestion state machine.
@ CA_OPEN
Normal state, no dubious events.
An implementation of TCP YeAH.
Time m_minRtt
Minimum of all RTTs measured within last RTT.
uint32_t m_zeta
Minimum number of state switches to reset m_renoCount.
void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override
Adjust cwnd following YeAH dual-mode algorithm.
void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt) override
Compute RTTs needed to execute YeAH algorithm.
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
uint32_t m_renoCount
Estimated cwnd of competing Reno flow.
bool m_doingYeahNow
If true, do YeAH for this RTT.
void CongestionStateSet(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState) override
Enable/disable YeAH algorithm depending on the congestion state.
static TypeId GetTypeId()
Get the type ID.
uint32_t m_cntRtt
Number of RTT measurements during last RTT.
std::string GetName() const override
Get the name of the congestion control algorithm.
uint32_t m_lastQ
Last number of packets in the bottleneck queue.
uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override
Get slow start threshold upon the receipt of 3 dupACKs.
SequenceNumber32 m_begSndNxt
Right edge during last RTT.
uint32_t m_stcpAiFactor
STCP additive increase parameter.
Ptr< TcpScalable > m_stcp
TcpScalable object.
uint32_t m_alpha
Maximum backlog allowed at the bottleneck queue; Q_max in the paper.
uint32_t m_phy
Maximum delta from base.
uint32_t m_epsilon
Log maximum fraction to be removed on early decongestion.
void EnableYeah(const SequenceNumber32 &nextTxSequence)
Enable YeAH algorithm to start taking YeAH samples.
uint32_t m_doingRenoNow
Number of RTTs in "Slow" mode.
uint32_t m_rho
Minimum number of consecutive RTT to consider competition with Reno flows on loss.
TcpYeah()
Create an unbound tcp socket.
void DisableYeah()
Stop taking YeAH samples.
uint32_t m_fastCount
Number of RTTs in "Fast" mode.
Time m_baseRtt
Minimum of all YeAH RTT measurements seen during connection.
uint32_t m_gamma
Fraction of queue to be removed per RTT when precautionary decongestion executed.
uint32_t m_delta
Log minimum fraction of cwnd to be removed on loss.
Simulation virtual time values and global simulation resolution.
int64_t GetMilliSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
static Time Max()
Maximum representable Time Not to be confused with Max(Time,Time).
bool IsZero() const
Exactly equivalent to t == 0.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
#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.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)