42 .AddConstructor<TcpYeah>()
43 .SetGroupName(
"Internet")
44 .AddAttribute(
"Alpha",
45 "Maximum backlog allowed at the bottleneck queue",
48 MakeUintegerChecker<uint32_t>())
49 .AddAttribute(
"Gamma",
50 "Fraction of queue to be removed per RTT",
53 MakeUintegerChecker<uint32_t>())
54 .AddAttribute(
"Delta",
55 "Log minimum fraction of cwnd to be removed on loss",
58 MakeUintegerChecker<uint32_t>())
59 .AddAttribute(
"Epsilon",
60 "Log maximum fraction to be removed on early decongestion",
63 MakeUintegerChecker<uint32_t>())
65 "Maximum delta from base",
68 MakeUintegerChecker<uint32_t>())
70 "Minimum # of consecutive RTT to consider competition on loss",
73 MakeUintegerChecker<uint32_t>())
75 "Minimum # of state switches to reset m_renoCount",
78 MakeUintegerChecker<uint32_t>())
79 .AddAttribute(
"StcpAiFactor",
80 "STCP additive increase factor",
83 MakeUintegerChecker<uint32_t>());
101 m_doingYeahNow(true),
109 m_stcp = CreateObject<TcpScalable>();
115 m_alpha(sock.m_alpha),
116 m_gamma(sock.m_gamma),
117 m_delta(sock.m_delta),
118 m_epsilon(sock.m_epsilon),
122 m_stcpAiFactor(sock.m_stcpAiFactor),
123 m_baseRtt(sock.m_baseRtt),
124 m_minRtt(sock.m_minRtt),
125 m_cntRtt(sock.m_cntRtt),
126 m_doingYeahNow(sock.m_doingYeahNow),
127 m_begSndNxt(sock.m_begSndNxt),
128 m_lastQ(sock.m_lastQ),
129 m_doingRenoNow(sock.m_doingRenoNow),
130 m_renoCount(sock.m_renoCount),
131 m_fastCount(sock.m_fastCount)
145 return CopyObject<TcpYeah>(
this);
210 NS_LOG_LOGIC(
"In slow start, invoke NewReno slow start.");
215 NS_LOG_LOGIC(
"In Fast mode, increment cwnd according to STCP rule.");
216 m_stcp->IncreaseWindow(tcb, segmentsAcked);
228 NS_LOG_LOGIC(
"A YeAH cycle has finished, check if enough RTT samples.");
235 NS_LOG_LOGIC(
"Enough RTT samples to perform YeAH calculations");
252 auto queue =
static_cast<uint32_t
>(bw * rttQueue.
GetSeconds());
253 NS_LOG_DEBUG(
"Queue backlog = " << queue <<
" given by cwnd = " << segCwnd
265 NS_LOG_LOGIC(
"Execute the precautionary decongestion.");
267 segCwnd -= reduction;
272 NS_LOG_INFO(
"In Slow mode, after precautionary decongestion, "
325 uint32_t segBytesInFlight = bytesInFlight / tcb->m_segmentSize;
329 NS_LOG_LOGIC(
"Not competing with Reno flows upon loss");
337 reduction =
std::max(segBytesInFlight >> 1,
static_cast<uint32_t
>(2));
340 NS_LOG_INFO(
"Reduction amount upon loss = " << reduction);
347 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.
uint32_t m_segmentSize
Segment size.
uint32_t GetCwndInSegments() const
Get cwnd in segments rather than bytes.
TcpCongState_t
Definition of the Congestion state machine.
@ CA_OPEN
Normal state, no dubious events.
SequenceNumber32 m_lastAckedSeq
Last sequence ACKed.
TracedValue< uint32_t > m_cWnd
Congestion window.
TracedValue< SequenceNumber32 > m_nextTxSequence
Next seqnum to be sent (SND.NXT), ReTx pushes it back.
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
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,...
int64x64_t Max(const int64x64_t &a, const int64x64_t &b)
Maximum.
#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.
#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 AttributeAccessor > MakeUintegerAccessor(T1 a1)