|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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);
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void HystartUpdate(Ptr< TcpSocketState > tcb, const Time &delay)
Update HyStart parameters.
uint8_t m_cntClamp
Modulo of the (avoided) float division for cWnd.
bool m_fastConvergence
Enable or disable fast convergence algorithm.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time m_hystartAckDelta
Spacing between ack's indicating train.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
AttributeValue implementation for Boolean.
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Time m_delayMin
Min delay.
uint32_t Update(Ptr< TcpSocketState > tcb)
Cubic window update after a new ack received.
static Time Now(void)
Return the current simulation virtual time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void CubicReset(Ptr< const TcpSocketState > tcb)
Reset Cubic parameters.
Hold a signed integer type.
static TypeId GetTypeId(void)
Get the type ID.
uint32_t m_segmentSize
Segment size.
Time m_cubicDelta
Time to wait after recovery before update.
uint32_t m_hystartLowWindow
Lower bound cWnd for hybrid slow start (segments)
TcpCongState_t
Definition of the Congestion state machine.
virtual void CongestionStateSet(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState)
Trigger events/calculations specific to a congestion state.
bool m_found
The exit point is found?
SequenceNumber32 m_lastAckedSeq
Last sequence ACKed.
A base class for implementation of a stream socket using TCP.
Ptr< const AttributeAccessor > MakeBooleanAccessor(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.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Time m_lastAck
Last time when the ACK spacing is close.
Time m_hystartDelayMax
Maximum time for hystart algorithm.
double m_c
Cubic Scaling factor.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
@ PACKET_TRAIN
Detection by trains of packet.
Time m_currRtt
Current Rtt.
uint8_t m_hystartMinSamples
Number of delay samples for detecting the increase of delay.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Timing information on received ACK.
Simulation virtual time values and global simulation resolution.
The Cubic Congestion Control Algorithm.
double m_beta
Beta for cubic multiplicative increase.
virtual std::string GetName() const
Get the name of the congestion control algorithm.
uint32_t m_cWndCnt
cWnd integer-to-float counter
bool m_hystart
Enable or disable HyStart algorithm.
@ CA_LOSS
CWND was reduced due to RTO timeout or SACK reneging.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
static Time Min()
Minimum representable Time Not to be confused with Min(Time,Time).
Congestion control abstract class.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
uint32_t GetCwndInSegments() const
Get cwnd in segments rather than bytes.
double m_bicK
Time to origin point from the beginning.
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)
Get the slow start threshold after a loss event.
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across sockets.
uint32_t m_bicOriginPoint
Origin point of bic function.
AttributeValue implementation for Time.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
int m_hystartDetect
Detect way for HyStart algorithm.
TracedValue< uint32_t > m_cWnd
Congestion window.
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Congestion avoidance algorithm implementation.
void HystartReset(Ptr< const TcpSocketState > tcb)
Reset HyStart parameters.
Hold an unsigned integer type.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Time m_roundStart
Beginning of each round.
SequenceNumber32 m_endSeq
End sequence of the round.
@ DELAY
Detection by delay value.
Time m_epochStart
Beginning of an epoch.
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
uint32_t m_sampleCnt
Count of samples for HyStart.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Time HystartDelayThresh(const Time &t) const
Clamp time value in a range.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Time m_hystartDelayMin
Minimum time for hystart algorithm.
uint32_t m_lastMaxCwnd
Last maximum cWnd.