The Cubic Congestion Control Algorithm. More...
#include "tcp-cubic.h"
Public Types | |
enum | HybridSSDetectionMode { PACKET_TRAIN = 1 , DELAY = 2 , BOTH = 3 } |
Values to detect the Slow Start mode of HyStart. More... | |
Public Member Functions | |
TcpCubic () | |
TcpCubic (const TcpCubic &sock) | |
Copy constructor. More... | |
void | CongestionStateSet (Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState) override |
Trigger events/calculations specific to a congestion state. More... | |
Ptr< TcpCongestionOps > | Fork () override |
Copy the congestion control algorithm across sockets. More... | |
std::string | GetName () const override |
Get the name of the congestion control algorithm. More... | |
uint32_t | GetSsThresh (Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override |
Get the slow start threshold after a loss event. More... | |
void | IncreaseWindow (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override |
Congestion avoidance algorithm implementation. More... | |
void | PktsAcked (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt) override |
Timing information on received ACK. More... | |
Public Member Functions inherited from ns3::TcpCongestionOps | |
TcpCongestionOps () | |
TcpCongestionOps (const TcpCongestionOps &other) | |
Copy constructor. More... | |
~TcpCongestionOps () override | |
virtual void | CongControl (Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateConnection &rc, const TcpRateOps::TcpRateSample &rs) |
Called when packets are delivered to update cwnd and pacing rate. More... | |
virtual void | CwndEvent (Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event) |
Trigger events/calculations on occurrence of congestion window event. More... | |
virtual bool | HasCongControl () const |
Returns true when Congestion Control Algorithm implements CongControl. More... | |
virtual void | Init (Ptr< TcpSocketState > tcb[[maybe_unused]]) |
Set configuration required by congestion control algorithm. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. More... | |
~Object () override | |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose () |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. More... | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. More... | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. More... | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized () const |
Check if the object has been initialized. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o[[maybe_unused]]) |
Assignment operator. More... | |
void | Ref () const |
Increment the reference count. More... | |
void | Unref () const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::TcpCongestionOps | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Private Member Functions | |
void | CubicReset (Ptr< const TcpSocketState > tcb) |
Reset Cubic parameters. More... | |
Time | HystartDelayThresh (const Time &t) const |
Clamp time value in a range. More... | |
void | HystartReset (Ptr< const TcpSocketState > tcb) |
Reset HyStart parameters. More... | |
void | HystartUpdate (Ptr< TcpSocketState > tcb, const Time &delay) |
Update HyStart parameters. More... | |
uint32_t | Update (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) |
Cubic window update after a new ack received. More... | |
Private Attributes | |
uint32_t | m_ackCnt |
Count the number of ACKed packets. More... | |
double | m_beta |
Beta for cubic multiplicative increase. More... | |
double | m_bicK |
Time to origin point from the beginning. More... | |
uint32_t | m_bicOriginPoint |
Origin point of bic function. More... | |
double | m_c |
Cubic Scaling factor. More... | |
uint8_t | m_cntClamp |
Modulo of the (avoided) float division for cWnd. More... | |
Time | m_cubicDelta |
Time to wait after recovery before update. More... | |
Time | m_currRtt |
Current Rtt. More... | |
uint32_t | m_cWndCnt |
cWnd integer-to-float counter More... | |
Time | m_delayMin |
Min delay. More... | |
SequenceNumber32 | m_endSeq |
End sequence of the round. More... | |
Time | m_epochStart |
Beginning of an epoch. More... | |
bool | m_fastConvergence |
Enable or disable fast convergence algorithm. More... | |
bool | m_found |
The exit point is found? More... | |
bool | m_hystart |
Enable or disable HyStart algorithm. More... | |
Time | m_hystartAckDelta |
Spacing between ack's indicating train. More... | |
Time | m_hystartDelayMax |
Maximum time for hystart algorithm. More... | |
Time | m_hystartDelayMin |
Minimum time for hystart algorithm. More... | |
HybridSSDetectionMode | m_hystartDetect |
Detect way for HyStart algorithm. More... | |
uint32_t | m_hystartLowWindow |
Lower bound cWnd for hybrid slow start (segments) More... | |
uint8_t | m_hystartMinSamples |
Number of delay samples for detecting the increase of delay. More... | |
uint32_t | m_initialCwnd |
Initial cWnd. More... | |
Time | m_lastAck |
Last time when the ACK spacing is close. More... | |
uint32_t | m_lastMaxCwnd |
Last maximum cWnd. More... | |
Time | m_roundStart |
Beginning of each round. More... | |
uint32_t | m_sampleCnt |
Count of samples for HyStart. More... | |
uint32_t | m_tcpCwnd |
Estimated tcp cwnd (for Reno-friendliness) More... | |
bool | m_tcpFriendliness |
Enable or disable TCP-friendliness heuristic. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | DoDispose () |
Destructor implementation. More... | |
virtual void | DoInitialize () |
Initialize() implementation. More... | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. More... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
The Cubic Congestion Control Algorithm.
TCP Cubic is a protocol that enhances the fairness property of Bic while retaining its scalability and stability. The main feature is that the window growth function is defined in real time in order to be independent from the RTT. More specifically, the congestion window of Cubic is determined by a function of the elapsed time from the last window reduction.
The Cubic code is quite similar to that of Bic. The main difference is located in the method Update, an edit necessary for satisfying the Cubic window growth, that can be tuned with the attribute C (the Cubic scaling factor).
Following the Linux implementation, we included the Hybrid Slow Start, that effectively prevents the overshooting of slow start while maintaining a full utilization of the network. This new type of slow start can be disabled through the HyStart attribute.
CUBIC TCP is implemented and used by default in Linux kernels 2.6.19 and above; this version follows the implementation in Linux 3.14, which slightly differ from the CUBIC paper. It also features HyStart.
Home page: https://web.archive.org/web/20080607093013/http://netsrv.csc.ncsu.edu/twiki/bin/view/Main/BIC The work starts from the implementation of CUBIC TCP in Sangtae Ha, Injong Rhee and Lisong Xu, "CUBIC: A New TCP-Friendly High-Speed TCP Variant" in ACM SIGOPS Operating System Review, July 2008. Available from: https://web.archive.org/web/20160505194415/http://netsrv.csc.ncsu.edu/export/cubic_a_new_tcp_2008.pdf
CUBIC integrates a new slow start algorithm, called HyStart. The details of HyStart are presented in Sangtae Ha and Injong Rhee, "Taming the Elephants: New TCP Slow Start", NCSU TechReport 2008. Available from: https://web.archive.org/web/20160528233754/http://netsrv.csc.ncsu.edu/export/hystart_techreport_2008.pdf
More information on this implementation: http://dl.acm.org/citation.cfm?id=2756518
Definition at line 69 of file tcp-cubic.h.
Values to detect the Slow Start mode of HyStart.
Enumerator | |
---|---|
PACKET_TRAIN | Detection by trains of packet. |
DELAY | Detection by delay value. |
BOTH | Detection by both. |
Definition at line 75 of file tcp-cubic.h.
ns3::TcpCubic::TcpCubic | ( | ) |
Definition at line 120 of file tcp-cubic.cc.
References NS_LOG_FUNCTION.
ns3::TcpCubic::TcpCubic | ( | const TcpCubic & | sock | ) |
Copy constructor.
sock | Socket to copy |
Definition at line 139 of file tcp-cubic.cc.
References NS_LOG_FUNCTION.
|
overridevirtual |
Trigger events/calculations specific to a congestion state.
This function mimics the notification function set_state in Linux. The function does not change the congestion state in the tcb; it notifies the congestion control algorithm that this state is about to be changed. The tcb->m_congState variable must be separately set; for example:
tcb | internal congestion state |
newState | new congestion state to which the TCP is going to switch |
Reimplemented from ns3::TcpCongestionOps.
Definition at line 477 of file tcp-cubic.cc.
References ns3::TcpSocketState::CA_LOSS, CubicReset(), HystartReset(), and NS_LOG_FUNCTION.
|
private |
Reset Cubic parameters.
tcb | Transmission Control Block of the connection |
Definition at line 489 of file tcp-cubic.cc.
References m_ackCnt, m_bicK, m_bicOriginPoint, m_delayMin, m_found, m_lastMaxCwnd, m_tcpCwnd, ns3::Time::Min(), and NS_LOG_FUNCTION.
Referenced by CongestionStateSet().
|
overridevirtual |
Copy the congestion control algorithm across sockets.
Implements ns3::TcpCongestionOps.
Definition at line 503 of file tcp-cubic.cc.
References NS_LOG_FUNCTION.
|
overridevirtual |
Get the name of the congestion control algorithm.
Implements ns3::TcpCongestionOps.
Definition at line 171 of file tcp-cubic.cc.
|
overridevirtual |
Get the slow start threshold after a loss event.
Is guaranteed that the congestion control state (TcpAckState_t
) is changed BEFORE the invocation of this method. The implementer should return the slow start threshold (and not change it directly) because, in the future, the TCP implementation may require to instantly recover from a loss event (e.g. when there is a network with an high reordering factor).
tcb | internal congestion state |
bytesInFlight | total bytes in flight |
Implements ns3::TcpCongestionOps.
Definition at line 448 of file tcp-cubic.cc.
References m_beta, m_epochStart, m_fastConvergence, m_lastMaxCwnd, max, ns3::Time::Min(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 36 of file tcp-cubic.cc.
References DELAY, m_beta, m_c, m_cntClamp, m_cubicDelta, m_fastConvergence, m_hystart, m_hystartAckDelta, m_hystartDelayMax, m_hystartDelayMin, m_hystartDetect, m_hystartLowWindow, m_hystartMinSamples, m_tcpFriendliness, ns3::MakeBooleanAccessor(), ns3::MakeBooleanChecker(), ns3::MakeDoubleAccessor(), ns3::MakeEnumChecker(), ns3::MakeTimeAccessor(), ns3::MakeTimeChecker(), ns3::MakeUintegerAccessor(), ns3::MilliSeconds(), and ns3::TypeId::SetParent().
Referenced by ns3::TcpL4Protocol::GetTypeId().
Clamp time value in a range.
The returned value is t, clamped in a range specified by attributes (HystartDelayMin < t < HystartDelayMax)
t | Time value to clamp |
Definition at line 430 of file tcp-cubic.cc.
References m_hystartDelayMax, m_hystartDelayMin, and NS_LOG_FUNCTION.
Referenced by HystartUpdate().
|
private |
Reset HyStart parameters.
tcb | Transmission Control Block of the connection |
Definition at line 177 of file tcp-cubic.cc.
References m_currRtt, m_endSeq, m_lastAck, m_roundStart, m_sampleCnt, ns3::Time::Min(), ns3::Simulator::Now(), and NS_LOG_FUNCTION.
Referenced by CongestionStateSet(), and IncreaseWindow().
|
private |
Update HyStart parameters.
tcb | Transmission Control Block of the connection |
delay | Delay for HyStart algorithm |
Definition at line 375 of file tcp-cubic.cc.
References DELAY, HystartDelayThresh(), m_currRtt, ns3::TcpSocketState::m_cWnd, m_delayMin, m_found, m_hystartAckDelta, m_hystartDetect, m_hystartMinSamples, m_lastAck, m_roundStart, m_sampleCnt, ns3::TcpSocketState::m_ssThresh, ns3::Time::Min(), ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by PktsAcked().
|
overridevirtual |
Congestion avoidance algorithm implementation.
Mimic the function cong_avoid in Linux. New segments have been ACKed, and the congestion control duty is to update the window.
The function is allowed to change directly cWnd and/or ssThresh.
tcb | internal congestion state |
segmentsAcked | count of segments acked |
Reimplemented from ns3::TcpCongestionOps.
Definition at line 188 of file tcp-cubic.cc.
References HystartReset(), ns3::TcpSocketState::m_cWnd, m_cWndCnt, m_endSeq, m_hystart, ns3::TcpSocketState::m_lastAckedSeq, ns3::TcpSocketState::m_segmentSize, ns3::TcpSocketState::m_ssThresh, NS_LOG_FUNCTION, NS_LOG_INFO, and Update().
|
overridevirtual |
Timing information on received ACK.
The function is called every time an ACK is received (only one time also for cumulative ACKs) and contains timing information. It is optional (congestion controls need not implement it) and the default implementation does nothing.
tcb | internal congestion state |
segmentsAcked | count of segments acked |
rtt | last rtt |
Reimplemented from ns3::TcpCongestionOps.
Definition at line 350 of file tcp-cubic.cc.
References HystartUpdate(), m_cubicDelta, ns3::TcpSocketState::m_cWnd, m_delayMin, m_epochStart, m_hystart, m_hystartLowWindow, ns3::TcpSocketState::m_segmentSize, ns3::TcpSocketState::m_ssThresh, ns3::Time::Min(), ns3::Simulator::Now(), and NS_LOG_FUNCTION.
|
private |
Cubic window update after a new ack received.
tcb | Transmission Control Block of the connection |
segmentsAcked | Segments acked |
Definition at line 240 of file tcp-cubic.cc.
References two-ray-to-three-gpp-ch-calibration::delta, ns3::TcpSocketState::GetCwndInSegments(), ns3::Time::GetSeconds(), m_ackCnt, m_beta, m_bicK, m_bicOriginPoint, m_c, m_cntClamp, m_delayMin, m_epochStart, m_lastMaxCwnd, m_tcpCwnd, m_tcpFriendliness, max, ns3::Time::Min(), ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by IncreaseWindow().
|
private |
Count the number of ACKed packets.
Definition at line 138 of file tcp-cubic.h.
Referenced by CubicReset(), and Update().
|
private |
Beta for cubic multiplicative increase.
Definition at line 108 of file tcp-cubic.h.
Referenced by GetSsThresh(), GetTypeId(), and Update().
|
private |
Time to origin point from the beginning.
Definition at line 127 of file tcp-cubic.h.
Referenced by CubicReset(), and Update().
|
private |
Origin point of bic function.
Definition at line 126 of file tcp-cubic.h.
Referenced by CubicReset(), and Update().
|
private |
Cubic Scaling factor.
Definition at line 121 of file tcp-cubic.h.
Referenced by GetTypeId(), and Update().
|
private |
Modulo of the (avoided) float division for cWnd.
Definition at line 119 of file tcp-cubic.h.
Referenced by GetTypeId(), and Update().
|
private |
Time to wait after recovery before update.
Definition at line 135 of file tcp-cubic.h.
Referenced by GetTypeId(), and PktsAcked().
|
private |
Current Rtt.
Definition at line 136 of file tcp-cubic.h.
Referenced by HystartReset(), and HystartUpdate().
|
private |
cWnd integer-to-float counter
Definition at line 124 of file tcp-cubic.h.
Referenced by IncreaseWindow().
|
private |
Min delay.
Definition at line 129 of file tcp-cubic.h.
Referenced by CubicReset(), HystartUpdate(), PktsAcked(), and Update().
|
private |
End sequence of the round.
Definition at line 133 of file tcp-cubic.h.
Referenced by HystartReset(), and IncreaseWindow().
|
private |
Beginning of an epoch.
Definition at line 130 of file tcp-cubic.h.
Referenced by GetSsThresh(), PktsAcked(), and Update().
|
private |
Enable or disable fast convergence algorithm.
Definition at line 106 of file tcp-cubic.h.
Referenced by GetSsThresh(), and GetTypeId().
|
private |
The exit point is found?
Definition at line 131 of file tcp-cubic.h.
Referenced by CubicReset(), and HystartUpdate().
|
private |
Enable or disable HyStart algorithm.
Definition at line 110 of file tcp-cubic.h.
Referenced by GetTypeId(), IncreaseWindow(), and PktsAcked().
|
private |
Spacing between ack's indicating train.
Definition at line 113 of file tcp-cubic.h.
Referenced by GetTypeId(), and HystartUpdate().
|
private |
Maximum time for hystart algorithm.
Definition at line 115 of file tcp-cubic.h.
Referenced by GetTypeId(), and HystartDelayThresh().
|
private |
Minimum time for hystart algorithm.
Definition at line 114 of file tcp-cubic.h.
Referenced by GetTypeId(), and HystartDelayThresh().
|
private |
Detect way for HyStart algorithm.
Definition at line 111 of file tcp-cubic.h.
Referenced by GetTypeId(), and HystartUpdate().
|
private |
Lower bound cWnd for hybrid slow start (segments)
Definition at line 112 of file tcp-cubic.h.
Referenced by GetTypeId(), and PktsAcked().
|
private |
Number of delay samples for detecting the increase of delay.
Definition at line 116 of file tcp-cubic.h.
Referenced by GetTypeId(), and HystartUpdate().
|
private |
Initial cWnd.
Definition at line 118 of file tcp-cubic.h.
|
private |
Last time when the ACK spacing is close.
Definition at line 134 of file tcp-cubic.h.
Referenced by HystartReset(), and HystartUpdate().
|
private |
Last maximum cWnd.
Definition at line 125 of file tcp-cubic.h.
Referenced by CubicReset(), GetSsThresh(), and Update().
|
private |
Beginning of each round.
Definition at line 132 of file tcp-cubic.h.
Referenced by HystartReset(), and HystartUpdate().
|
private |
Count of samples for HyStart.
Definition at line 137 of file tcp-cubic.h.
Referenced by HystartReset(), and HystartUpdate().
|
private |
Estimated tcp cwnd (for Reno-friendliness)
Definition at line 139 of file tcp-cubic.h.
Referenced by CubicReset(), and Update().
|
private |
Enable or disable TCP-friendliness heuristic.
Definition at line 107 of file tcp-cubic.h.
Referenced by GetTypeId(), and Update().