20 #define NS_LOG_APPEND_CONTEXT \
21 { std::clog << Simulator::Now ().GetSeconds () << " "; }
37 .AddConstructor<TcpCubic> ()
38 .SetGroupName (
"Internet")
39 .AddAttribute (
"FastConvergence",
"Enable (true) or disable (false) fast convergence",
43 .AddAttribute (
"Beta",
"Beta for multiplicative decrease",
46 MakeDoubleChecker <double> (0.0))
47 .AddAttribute (
"HyStart",
"Enable (true) or disable (false) hybrid slow start algorithm",
51 .AddAttribute (
"HyStartLowWindow",
"Lower bound cWnd for hybrid slow start (segments)",
54 MakeUintegerChecker <uint32_t> ())
55 .AddAttribute (
"HyStartDetect",
"Hybrid Slow Start detection mechanisms:" \
56 "1: packet train, 2: delay, 3: both",
59 MakeIntegerChecker <int> (1,3))
60 .AddAttribute (
"HyStartMinSamples",
"Number of delay samples for detecting the increase of delay",
63 MakeUintegerChecker <uint8_t> ())
64 .AddAttribute (
"HyStartAckDelta",
"Spacing between ack's indicating train",
68 .AddAttribute (
"HyStartDelayMin",
"Minimum time for hystart algorithm",
72 .AddAttribute (
"HyStartDelayMax",
"Maximum time for hystart algorithm",
76 .AddAttribute (
"CubicDelta",
"Delta Time to wait after fast recovery before adjusting param",
80 .AddAttribute (
"CntClamp",
"Counter value when no losses are detected (counter is used" \
81 " when incrementing cWnd in congestion avoidance, to avoid" \
82 " floating point arithmetic). It is the modulo of the (avoided)" \
86 MakeUintegerChecker <uint8_t> ())
87 .AddAttribute (
"C",
"Cubic Scaling factor",
90 MakeDoubleChecker <double> (0.0))
116 m_fastConvergence (sock.m_fastConvergence),
117 m_beta (sock.m_beta),
118 m_hystart (sock.m_hystart),
119 m_hystartDetect (sock.m_hystartDetect),
120 m_hystartLowWindow (sock.m_hystartLowWindow),
121 m_hystartAckDelta (sock.m_hystartAckDelta),
122 m_hystartDelayMin (sock.m_hystartDelayMin),
123 m_hystartDelayMax (sock.m_hystartDelayMax),
124 m_hystartMinSamples (sock.m_hystartMinSamples),
125 m_initialCwnd (sock.m_initialCwnd),
126 m_cntClamp (sock.m_cntClamp),
128 m_cWndCnt (sock.m_cWndCnt),
129 m_lastMaxCwnd (sock.m_lastMaxCwnd),
130 m_bicOriginPoint (sock.m_bicOriginPoint),
131 m_bicK (sock.m_bicK),
132 m_delayMin (sock.m_delayMin),
133 m_epochStart (sock.m_epochStart),
134 m_found (sock.m_found),
135 m_roundStart (sock.m_roundStart),
136 m_endSeq (sock.m_endSeq),
137 m_lastAck (sock.m_lastAck),
138 m_cubicDelta (sock.m_cubicDelta),
139 m_currRtt (sock.m_currRtt),
140 m_sampleCnt (sock.m_sampleCnt)
193 uint32_t cnt =
Update (tcb);
208 NS_LOG_INFO (
"Not enough segments have been ACKed to increment cwnd."
209 "Until now " <<
m_cWndCnt <<
" cnd " << cnt);
219 uint32_t delta, bicTarget, cnt = 0;
229 NS_LOG_DEBUG (
"lastMaxCwnd <= m_cWnd. K=0 and origin=" << segCwnd);
258 delta =
m_c * std::pow (offs, 3);
279 if (bicTarget > segCwnd)
281 cnt = segCwnd / (bicTarget - segCwnd);
400 uint32_t segCwnd = tcb->GetCwndInSegments ();
401 NS_LOG_DEBUG (
"Loss at cWnd=" << segCwnd <<
" segments in flight=" << bytesInFlight / tcb->m_segmentSize);
416 uint32_t ssThresh =
std::max (
static_cast<uint32_t
> (segCwnd *
m_beta ), 2U) * tcb->m_segmentSize;
451 return CopyObject<TcpCubic> (
this);
AttributeValue implementation for Boolean.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold a signed integer type.
Smart pointer class similar to boost::intrusive_ptr.
static Time Now(void)
Return the current simulation virtual time.
Congestion control abstract class.
The Cubic Congestion Control Algorithm.
Time m_currRtt
Current Rtt.
void HystartReset(Ptr< const TcpSocketState > tcb)
Reset HyStart parameters.
Time m_hystartDelayMax
Maximum time for hystart algorithm.
Time m_cubicDelta
Time to wait after recovery before update.
uint32_t m_bicOriginPoint
Origin point of bic function.
uint32_t Update(Ptr< TcpSocketState > tcb)
Cubic window update after a new ack received.
uint32_t m_sampleCnt
Count of samples for HyStart.
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across sockets.
bool m_hystart
Enable or disable HyStart algorithm.
double m_bicK
Time to origin point from the beginning.
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Congestion avoidance algorithm implementation.
int m_hystartDetect
Detect way for HyStart algorithm.
uint32_t m_cWndCnt
cWnd integer-to-float counter
Time m_hystartDelayMin
Minimum time for hystart algorithm.
bool m_found
The exit point is found?
SequenceNumber32 m_endSeq
End sequence of the round.
double m_beta
Beta for cubic multiplicative increase.
Time m_lastAck
Last time when the ACK spacing is close.
Time m_hystartAckDelta
Spacing between ack's indicating train.
bool m_fastConvergence
Enable or disable fast convergence algorithm.
Time m_delayMin
Min delay.
Time m_roundStart
Beginning of each round.
virtual std::string GetName() const
Get the name of the congestion control algorithm.
Time m_epochStart
Beginning of an epoch.
uint8_t m_cntClamp
Modulo of the (avoided) float division for cWnd.
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Timing information on received ACK.
void HystartUpdate(Ptr< TcpSocketState > tcb, const Time &delay)
Update HyStart parameters.
double m_c
Cubic Scaling factor.
void CubicReset(Ptr< const TcpSocketState > tcb)
Reset Cubic parameters.
static TypeId GetTypeId(void)
Get the type ID.
virtual void CongestionStateSet(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState)
Trigger events/calculations specific to a congestion state.
@ DELAY
Detection by delay value.
@ PACKET_TRAIN
Detection by trains of packet.
uint32_t m_lastMaxCwnd
Last maximum cWnd.
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)
Get the slow start threshold after a loss event.
Time HystartDelayThresh(const Time &t) const
Clamp time value in a range.
uint8_t m_hystartMinSamples
Number of delay samples for detecting the increase of delay.
uint32_t m_hystartLowWindow
Lower bound cWnd for hybrid slow start (segments)
A base class for implementation of a stream socket using TCP.
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_LOSS
CWND was reduced due to RTO timeout or SACK reneging.
SequenceNumber32 m_lastAckedSeq
Last sequence ACKed.
TracedValue< uint32_t > m_cWnd
Congestion window.
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
Simulation virtual time values and global simulation resolution.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
static Time Min()
Minimum representable Time Not to be confused with Min(Time,Time).
AttributeValue implementation for Time.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
int64x64_t Min(const int64x64_t &a, const int64x64_t &b)
Minimum.
#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_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.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.