24 #include "ns3/abort.h"
25 #include "ns3/tcp-socket-state.h"
37 .AddConstructor<TcpDctcp> ()
38 .SetGroupName (
"Internet")
39 .AddAttribute (
"DctcpShiftG",
40 "Parameter G for updating dctcp_alpha",
43 MakeDoubleChecker<double> (0, 1))
44 .AddAttribute (
"DctcpAlphaOnInit",
45 "Initial alpha value",
48 MakeDoubleChecker<double> (0, 1))
49 .AddAttribute (
"UseEct0",
50 "Use ECT(0) for ECN codepoint, if false use ECT(1)",
54 .AddTraceSource (
"CongestionEstimate",
55 "Update sender-side congestion estimate state",
57 "ns3::TcpDctcp::CongestionEstimateTracedCallback")
70 m_ackedBytesTotal (0),
72 m_priorRcvNxtFlag (false),
74 m_nextSeqFlag (false),
76 m_delayedAckReserved (false),
84 m_ackedBytesEcn (sock.m_ackedBytesEcn),
85 m_ackedBytesTotal (sock.m_ackedBytesTotal),
86 m_priorRcvNxt (sock.m_priorRcvNxt),
87 m_priorRcvNxtFlag (sock.m_priorRcvNxtFlag),
88 m_alpha (sock.m_alpha),
89 m_nextSeq (sock.m_nextSeq),
90 m_nextSeqFlag (sock.m_nextSeqFlag),
91 m_ceState (sock.m_ceState),
92 m_delayedAckReserved (sock.m_delayedAckReserved),
94 m_useEct0 (sock.m_useEct0),
95 m_initialized (sock.m_initialized)
108 return CopyObject<TcpDctcp> (
this);
115 NS_LOG_INFO (
this <<
"Enabling DctcpEcn for DCTCP");
129 return static_cast<uint32_t
> ((1 -
m_alpha / 2.0) * tcb->m_cWnd);
148 double bytesEcn = 0.0;
185 tmpRcvNxt = tcb->
m_rxBuffer->NextRxSequence ();
192 tcb->
m_rxBuffer->SetNextRxSequence (tmpRcvNxt);
212 tmpRcvNxt = tcb->
m_rxBuffer->NextRxSequence ();
219 tcb->
m_rxBuffer->SetNextRxSequence (tmpRcvNxt);
AttributeValue implementation for Boolean.
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.
SequenceNumber32 m_priorRcvNxt
Sequence number of the first missing byte in data.
double m_alpha
Parameter used to estimate the amount of network congestion.
virtual void CwndEvent(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event)
Trigger events/calculations on occurrence of congestion window event.
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.
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across sockets.
uint32_t m_ackedBytesEcn
Number of acked bytes which are marked.
virtual void Init(Ptr< TcpSocketState > tcb)
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.
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)
Get the slow start threshold after a loss event.
static TypeId GetTypeId(void)
Get the type ID.
virtual std::string GetName() const
Get the name of the congestion control algorithm.
bool m_nextSeqFlag
Variable used in setting the value of m_nextSeq for first time.
void CeState1to0(Ptr< TcpSocketState > tcb)
Changes state of m_ceState to false.
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Timing information on received ACK.
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.
virtual ~TcpDctcp(void)
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.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
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.
#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.
float alpha
Plot alpha value (transparency)