An implementation of DCTCP. More...
#include "tcp-dctcp.h"
Public Types | |
typedef void(* | CongestionEstimateTracedCallback) (uint32_t bytesAcked, uint32_t bytesMarked, double alpha) |
TracedCallback signature for DCTCP update of congestion state. | |
Public Member Functions | |
TcpDctcp () | |
Create an unbound tcp socket. | |
TcpDctcp (const TcpDctcp &sock) | |
Copy constructor. | |
~TcpDctcp () override | |
Destructor. | |
void | CwndEvent (Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event) override |
Trigger events/calculations on occurrence of congestion window event. | |
Ptr< TcpCongestionOps > | Fork () override |
Copy the congestion control algorithm across sockets. | |
std::string | GetName () const override |
Get the name of the congestion control algorithm. | |
uint32_t | GetSsThresh (Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override |
Get the slow start threshold after a loss event. | |
void | Init (Ptr< TcpSocketState > tcb) override |
Set configuration required by congestion control algorithm, This method will force DctcpEcn mode and will force usage of either ECT(0) or ECT(1) (depending on the 'UseEct0' attribute), despite any other configuration in the base classes. | |
void | PktsAcked (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt) override |
Timing information on received ACK. | |
Public Member Functions inherited from ns3::TcpLinuxReno | |
TcpLinuxReno () | |
TcpLinuxReno (const TcpLinuxReno &sock) | |
Copy constructor. | |
~TcpLinuxReno () override | |
Ptr< TcpCongestionOps > | Fork () override |
Copy the congestion control algorithm across sockets. | |
std::string | GetName () const override |
Get the name of the congestion control algorithm. | |
uint32_t | GetSsThresh (Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override |
Get the slow start threshold after a loss event. | |
void | IncreaseWindow (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override |
Congestion avoidance algorithm implementation. | |
Public Member Functions inherited from ns3::TcpCongestionOps | |
TcpCongestionOps () | |
TcpCongestionOps (const TcpCongestionOps &other) | |
Copy constructor. | |
~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. | |
virtual void | CongestionStateSet (Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState) |
Trigger events/calculations specific to a congestion state. | |
virtual bool | HasCongControl () const |
Returns true when Congestion Control Algorithm implements CongControl. | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. | |
~Object () override | |
Destructor. | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. | |
void | Dispose () |
Dispose of this Object. | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. | |
bool | IsInitialized () const |
Check if the object has been initialized. | |
void | UnidirectionalAggregateObject (Ptr< Object > other) |
Aggregate an Object to another Object. | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::TcpLinuxReno | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::TcpCongestionOps | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Private Member Functions | |
void | CeState0to1 (Ptr< TcpSocketState > tcb) |
Changes state of m_ceState to true. | |
void | CeState1to0 (Ptr< TcpSocketState > tcb) |
Changes state of m_ceState to false. | |
void | InitializeDctcpAlpha (double alpha) |
Initialize the value of m_alpha. | |
void | Reset (Ptr< TcpSocketState > tcb) |
Resets the value of m_ackedBytesEcn, m_ackedBytesTotal and m_nextSeq. | |
void | UpdateAckReserved (Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event) |
Updates the value of m_delayedAckReserved. | |
Private Attributes | |
uint32_t | m_ackedBytesEcn |
Number of acked bytes which are marked. | |
uint32_t | m_ackedBytesTotal |
Total number of acked bytes. | |
double | m_alpha |
Parameter used to estimate the amount of network congestion. | |
bool | m_ceState |
DCTCP Congestion Experienced state. | |
bool | m_delayedAckReserved |
Delayed Ack state. | |
double | m_g |
Estimation gain. | |
bool | m_initialized |
Whether DCTCP has been initialized. | |
SequenceNumber32 | m_nextSeq |
TCP sequence number threshold for beginning a new observation window. | |
bool | m_nextSeqFlag |
Variable used in setting the value of m_nextSeq for first time. | |
SequenceNumber32 | m_priorRcvNxt |
Sequence number of the first missing byte in data. | |
bool | m_priorRcvNxtFlag |
Variable used in setting the value of m_priorRcvNxt for first time. | |
TracedCallback< uint32_t, uint32_t, double > | m_traceCongestionEstimate |
Callback pointer for congestion state update. | |
bool | m_useEct0 |
Use ECT(0) for ECN codepoint. | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::TcpLinuxReno | |
virtual void | CongestionAvoidance (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) |
Congestion avoidance phase handler. | |
void | SetSuppressIncreaseIfCwndLimited (bool value) |
TcpSocketBase follows the Linux way of setting a flag 'isCwndLimited' when BytesInFlight() >= cwnd. | |
virtual uint32_t | SlowStart (Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) |
Slow start phase handler. | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. | |
virtual void | DoDispose () |
Destructor implementation. | |
virtual void | DoInitialize () |
Initialize() implementation. | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
Related Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
An implementation of DCTCP.
This model implements all of the endpoint capabilities mentioned in the DCTCP SIGCOMM paper. Note that this model presently will not do any fallback to RFC 5681 congestion avoidance as specified in RFC 8257 Section 3.5, so it should only be used in a simulation that does not involve packet loss.
Definition at line 31 of file tcp-dctcp.h.
typedef void(* ns3::TcpDctcp::CongestionEstimateTracedCallback) (uint32_t bytesAcked, uint32_t bytesMarked, double alpha) |
TracedCallback signature for DCTCP update of congestion state.
[in] | bytesAcked | Bytes acked in this observation window |
[in] | bytesMarked | Bytes marked in this observation window |
[in] | alpha | New alpha (congestion estimate) value |
Definition at line 76 of file tcp-dctcp.h.
ns3::TcpDctcp::TcpDctcp | ( | ) |
Create an unbound tcp socket.
Definition at line 60 of file tcp-dctcp.cc.
References NS_LOG_FUNCTION.
ns3::TcpDctcp::TcpDctcp | ( | const TcpDctcp & | sock | ) |
Copy constructor.
sock | the object to copy |
Definition at line 75 of file tcp-dctcp.cc.
References NS_LOG_FUNCTION.
|
override |
|
private |
Changes state of m_ceState to true.
tcb | internal congestion state |
Definition at line 173 of file tcp-dctcp.cc.
References ns3::TcpHeader::ACK, ns3::TcpSocketState::ECN_CE_RCVD, m_ceState, m_delayedAckReserved, m_priorRcvNxt, m_priorRcvNxtFlag, and NS_LOG_FUNCTION.
Referenced by CwndEvent().
|
private |
Changes state of m_ceState to false.
tcb | internal congestion state |
Definition at line 200 of file tcp-dctcp.cc.
References ns3::TcpHeader::ACK, ns3::TcpHeader::ECE, ns3::TcpSocketState::ECN_CE_RCVD, ns3::TcpSocketState::ECN_IDLE, ns3::TcpSocketState::ECN_SENDING_ECE, m_ceState, m_delayedAckReserved, m_priorRcvNxt, m_priorRcvNxtFlag, and NS_LOG_FUNCTION.
Referenced by CwndEvent().
|
overridevirtual |
Trigger events/calculations on occurrence of congestion window event.
This function mimics the function cwnd_event in Linux. The function is called in case of congestion window events.
tcb | internal congestion state |
event | the event which triggered this function |
Reimplemented from ns3::TcpCongestionOps.
Definition at line 256 of file tcp-dctcp.cc.
References ns3::TcpSocketState::CA_EVENT_DELAYED_ACK, ns3::TcpSocketState::CA_EVENT_ECN_IS_CE, ns3::TcpSocketState::CA_EVENT_ECN_NO_CE, ns3::TcpSocketState::CA_EVENT_NON_DELAYED_ACK, CeState0to1(), CeState1to0(), NS_LOG_FUNCTION, and UpdateAckReserved().
|
overridevirtual |
Copy the congestion control algorithm across sockets.
Implements ns3::TcpCongestionOps.
Definition at line 99 of file tcp-dctcp.cc.
References ns3::Object::CopyObject, and NS_LOG_FUNCTION.
|
overridevirtual |
Get the name of the congestion control algorithm.
Implements ns3::TcpCongestionOps.
Definition at line 55 of file tcp-dctcp.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 121 of file tcp-dctcp.cc.
References m_alpha, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 25 of file tcp-dctcp.cc.
References InitializeDctcpAlpha(), m_g, m_traceCongestionEstimate, m_useEct0, ns3::MakeBooleanAccessor(), ns3::MakeBooleanChecker(), ns3::MakeDoubleAccessor(), ns3::MakeDoubleChecker(), ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().
Referenced by TcpDctcpCodePointsTest::CreateReceiverSocket(), and TcpDctcpCodePointsTest::CreateSenderSocket().
|
overridevirtual |
Set configuration required by congestion control algorithm, This method will force DctcpEcn mode and will force usage of either ECT(0) or ECT(1) (depending on the 'UseEct0' attribute), despite any other configuration in the base classes.
tcb | internal congestion state |
Reimplemented from ns3::TcpCongestionOps.
Definition at line 106 of file tcp-dctcp.cc.
References ns3::TcpSocketState::DctcpEcn, ns3::TcpSocketState::Ect0, ns3::TcpSocketState::Ect1, m_initialized, m_useEct0, NS_LOG_FUNCTION, NS_LOG_INFO, ns3::TcpSocketState::On, and ns3::TcpLinuxReno::SetSuppressIncreaseIfCwndLimited().
|
private |
Initialize the value of m_alpha.
alpha | DCTCP alpha parameter |
Definition at line 156 of file tcp-dctcp.cc.
References m_alpha, m_initialized, NS_ABORT_MSG_IF, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
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 128 of file tcp-dctcp.cc.
References ns3::TcpSocketState::ECN_ECE_RCVD, m_ackedBytesEcn, m_ackedBytesTotal, m_alpha, m_g, m_nextSeq, m_nextSeqFlag, m_traceCongestionEstimate, NS_LOG_FUNCTION, NS_LOG_INFO, and Reset().
|
private |
Resets the value of m_ackedBytesEcn, m_ackedBytesTotal and m_nextSeq.
tcb | internal congestion state |
Definition at line 164 of file tcp-dctcp.cc.
References m_ackedBytesEcn, m_ackedBytesTotal, m_nextSeq, and NS_LOG_FUNCTION.
Referenced by PktsAcked().
|
private |
Updates the value of m_delayedAckReserved.
tcb | internal congestion state |
event | the congestion window event |
Definition at line 232 of file tcp-dctcp.cc.
References ns3::TcpSocketState::CA_EVENT_DELAYED_ACK, ns3::TcpSocketState::CA_EVENT_NON_DELAYED_ACK, m_delayedAckReserved, and NS_LOG_FUNCTION.
Referenced by CwndEvent().
|
private |
Number of acked bytes which are marked.
Definition at line 123 of file tcp-dctcp.h.
Referenced by PktsAcked(), and Reset().
|
private |
Total number of acked bytes.
Definition at line 124 of file tcp-dctcp.h.
Referenced by PktsAcked(), and Reset().
|
private |
Parameter used to estimate the amount of network congestion.
Definition at line 127 of file tcp-dctcp.h.
Referenced by GetSsThresh(), InitializeDctcpAlpha(), and PktsAcked().
|
private |
DCTCP Congestion Experienced state.
Definition at line 131 of file tcp-dctcp.h.
Referenced by CeState0to1(), and CeState1to0().
|
private |
Delayed Ack state.
Definition at line 132 of file tcp-dctcp.h.
Referenced by CeState0to1(), CeState1to0(), and UpdateAckReserved().
|
private |
Estimation gain.
Definition at line 133 of file tcp-dctcp.h.
Referenced by GetTypeId(), and PktsAcked().
|
private |
Whether DCTCP has been initialized.
Definition at line 135 of file tcp-dctcp.h.
Referenced by Init(), and InitializeDctcpAlpha().
|
private |
TCP sequence number threshold for beginning a new observation window.
Definition at line 129 of file tcp-dctcp.h.
Referenced by PktsAcked(), and Reset().
|
private |
Variable used in setting the value of m_nextSeq for first time.
Definition at line 130 of file tcp-dctcp.h.
Referenced by PktsAcked().
|
private |
Sequence number of the first missing byte in data.
Definition at line 125 of file tcp-dctcp.h.
Referenced by CeState0to1(), and CeState1to0().
|
private |
Variable used in setting the value of m_priorRcvNxt for first time.
Definition at line 126 of file tcp-dctcp.h.
Referenced by CeState0to1(), and CeState1to0().
|
private |
Callback pointer for congestion state update.
Definition at line 139 of file tcp-dctcp.h.
Referenced by GetTypeId(), and PktsAcked().
|
private |
Use ECT(0) for ECN codepoint.
Definition at line 134 of file tcp-dctcp.h.
Referenced by GetTypeId(), and Init().