25 #include "ns3/abort.h"
41 .AddConstructor<TcpDctcp>()
42 .SetGroupName(
"Internet")
43 .AddAttribute(
"DctcpShiftG",
44 "Parameter G for updating dctcp_alpha",
47 MakeDoubleChecker<double>(0, 1))
48 .AddAttribute(
"DctcpAlphaOnInit",
49 "Initial alpha value",
52 MakeDoubleChecker<double>(0, 1))
53 .AddAttribute(
"UseEct0",
54 "Use ECT(0) for ECN codepoint, if false use ECT(1)",
58 .AddTraceSource(
"CongestionEstimate",
59 "Update sender-side congestion estimate state",
61 "ns3::TcpDctcp::CongestionEstimateTracedCallback");
76 m_priorRcvNxtFlag(false),
80 m_delayedAckReserved(false),
88 m_ackedBytesEcn(sock.m_ackedBytesEcn),
89 m_ackedBytesTotal(sock.m_ackedBytesTotal),
90 m_priorRcvNxt(sock.m_priorRcvNxt),
91 m_priorRcvNxtFlag(sock.m_priorRcvNxtFlag),
92 m_alpha(sock.m_alpha),
93 m_nextSeq(sock.m_nextSeq),
94 m_nextSeqFlag(sock.m_nextSeqFlag),
95 m_ceState(sock.m_ceState),
96 m_delayedAckReserved(sock.m_delayedAckReserved),
98 m_useEct0(sock.m_useEct0),
99 m_initialized(sock.m_initialized)
113 return CopyObject<TcpDctcp>(
this);
120 NS_LOG_INFO(
this <<
"Enabling DctcpEcn for DCTCP");
134 return static_cast<uint32_t
>((1 -
m_alpha / 2.0) * tcb->m_cWnd);
153 double bytesEcn = 0.0;
190 tmpRcvNxt = tcb->
m_rxBuffer->NextRxSequence();
197 tcb->
m_rxBuffer->SetNextRxSequence(tmpRcvNxt);
217 tmpRcvNxt = tcb->
m_rxBuffer->NextRxSequence();
224 tcb->
m_rxBuffer->SetNextRxSequence(tmpRcvNxt);
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Smart pointer class similar to boost::intrusive_ptr.
An implementation of DCTCP.
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
static TypeId GetTypeId()
Get the type ID.
SequenceNumber32 m_priorRcvNxt
Sequence number of the first missing byte in data.
double m_alpha
Parameter used to estimate the amount of network congestion.
double m_g
Estimation gain.
bool m_initialized
Whether DCTCP has been initialized.
bool m_ceState
DCTCP Congestion Experienced state.
bool m_priorRcvNxtFlag
Variable used in setting the value of m_priorRcvNxt for first time.
void InitializeDctcpAlpha(double alpha)
Initialize the value of m_alpha.
SequenceNumber32 m_nextSeq
TCP sequence number threshold for beginning a new observation window.
uint32_t m_ackedBytesEcn
Number of acked bytes which are marked.
void Init(Ptr< TcpSocketState > tcb) override
Set configuration required by congestion control algorithm, This method will force DctcpEcn mode and ...
TcpDctcp()
Create an unbound tcp socket.
void Reset(Ptr< TcpSocketState > tcb)
Resets the value of m_ackedBytesEcn, m_ackedBytesTotal and m_nextSeq.
uint32_t m_ackedBytesTotal
Total number of acked bytes.
bool m_nextSeqFlag
Variable used in setting the value of m_nextSeq for first time.
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 PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt) override
Timing information on received ACK.
void CwndEvent(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event) override
Trigger events/calculations on occurrence of congestion window event.
void CeState1to0(Ptr< TcpSocketState > tcb)
Changes state of m_ceState to false.
void UpdateAckReserved(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event)
Updates the value of m_delayedAckReserved.
bool m_delayedAckReserved
Delayed Ack state.
TracedCallback< uint32_t, uint32_t, double > m_traceCongestionEstimate
Callback pointer for congestion state update.
bool m_useEct0
Use ECT(0) for ECN codepoint.
void CeState0to1(Ptr< TcpSocketState > tcb)
Changes state of m_ceState to true.
~TcpDctcp() override
Destructor.
Reno congestion control algorithm.
uint32_t m_segmentSize
Segment size.
TcpCAEvent_t
Congestion avoidance events.
@ CA_EVENT_ECN_IS_CE
received CE marked IP packet.
@ CA_EVENT_ECN_NO_CE
ECT set, but not CE marked.
@ CA_EVENT_DELAYED_ACK
Delayed ack is sent.
@ CA_EVENT_NON_DELAYED_ACK
Non-delayed ack is sent.
EcnMode_t m_ecnMode
ECN mode.
Callback< void, uint8_t > m_sendEmptyPacketCallback
Callback to send an empty packet.
UseEcn_t m_useEcn
Socket ECN capability.
SequenceNumber32 m_lastAckedSeq
Last sequence ACKed.
@ DctcpEcn
ECN functionality as described in RFC 8257.
@ ECN_ECE_RCVD
Last ACK received had ECE bit set in TCP header.
@ ECN_IDLE
ECN is enabled but currently there is no action pertaining to ECE or CWR to be taken.
@ ECN_CE_RCVD
Last packet received had CE bit set in IP header.
@ ECN_SENDING_ECE
Receiver sends an ACK with ECE bit set in TCP header.
Ptr< TcpRxBuffer > m_rxBuffer
Rx buffer (reordering buffer)
TracedValue< SequenceNumber32 > m_nextTxSequence
Next seqnum to be sent (SND.NXT), ReTx pushes it back.
TracedValue< EcnState_t > m_ecnState
Current ECN State, represented as combination of EcnState values.
EcnCodePoint_t m_ectCodePoint
ECT code point to use.
Simulation virtual time values and global simulation resolution.
T Get() const
Get the underlying value.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#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.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)