Weekly Progress - roshanls1997/Implementation-and-evaluation-of-eXtended-ECN-XECN-in-ns-3 GitHub Wiki
- Assignment allotted.
- Read about ECN.
- Read about how ECN marking is done in IP header and TCP header.
- met with sir.
- Learned about how XECN can be used to to estimate the number of packets marked by the router by using "11" codepoint which can be sent from reciever to sender in the ACK to inform the sender that the Data Packet of currently received packet was marked by router.
-
We implemented the XECN by modifying the ECN properties in tcp-socket-base.cc.
-
We added to new states in tcp-socket-state.h and tcp-socket-state.cc for XECN.
- ECN_SENDING_CC - Receiver sends an ACK packet with both CWR and ECE bit set (SYN bit is 0).
- ECN_CC_RCVD - Sender receives both CWR and ECE both set in received ACK.
-
Now in tcp-socket-state.cc
- We added a variable (count_cc), which counts the number of packets marked by the router at sender side.
- When receiver receives both CE and ECT bit set in IP header, instead of sending ECE we will sent CWR and ECE. The XECN state will change to ECN_SENDING_CC.
- When sender receives both CWR and ECE bit set in the ACK, the sender infer that the packet is marked by the router so count_cc is incremented by one. The XECN state will change to ECN_CWR_SENT.
-
For testing we used RED AQM and Network topology shown below.
10Mb/s, 2ms 10Mb/s, 4ms n0--------------| |---------------n4 | 1.5Mbps/s, 20ms | n2------------------n3 10Mb/s, 3ms | | 10Mb/s, 5ms n1--------------| |---------------n5
we also disabled the hardrop because RED AQM drops the packet when avg queue length becomes more than maxth, which affects our counting of packets marked by the router. so after running the XECN with RED AQM and above mentioned Network topology.
The output is
we see that packets marked count by router n2 is same at both router as well as sender side i.e 545.
-
In tcp-socket-base.h Added ExtendedEcn in enum
typedef enum { NoEcn = 0, //!< ECN is not enabled. ClassicEcn, //!< ECN functionality as described in RFC 3168. ExtendedEcn } EcnMode_t;
-
Connection establishment process for Classic Ecn and Extended Ecn is same.
-
When ExtendedEcn is enabled, ClassicEcn automatically gets enabled. But, when ClassicEcn is enabled ExtendedEcn is not enabled.
-
In tcp-socket-base.cc, we are checking the mode of ecn.
-
If the sender/receiver have ecn mode as ClassicEcn the the packet marked by the router will not be calculated at sender side. But when ecn mode is ExtendedEcn then the packet marked by the router will be calculated at sender side.
-
Added Attribute for ExtendedEcn
.AddAttribute ("EcnMode", "Determines the mode of ECN", EnumValue (EcnMode_t::NoEcn), MakeEnumAccessor (&TcpSocketBase::m_ecnMode), MakeEnumChecker (EcnMode_t::NoEcn, "NoEcn", EcnMode_t::ClassicEcn, "ClassicEcn", EcnMode_t::ExtendedEcn, "ExtendedEcn"))
-
In function ProcessEstablished(), ReceivedData(), DelayAckTimeout(), SetRcvBufSize()
If ExtendedEcn is enabled then ECE and CWR bits are set instead of only ECE when packet received has CE bit set// Receiver sets ECE and CWR flags when it receives a packet with CE bit on. if(m_ecnMode == EcnMode_t::ExtendedEcn) { if (m_tcb->m_ecnState == TcpSocketState::ECN_CE_RCVD ) { SendEmptyPacket (TcpHeader::ACK | TcpHeader::ECE | TcpHeader::CWR); NS_LOG_DEBUG (TcpSocketState::EcnStateName[m_tcb->m_ecnState] << " -> ECN_SENDING_CC"); m_tcb->m_ecnState = TcpSocketState::ECN_SENDING_CC; } // Receiver sets ECE flags when it receives a packet without CE bit on or sender hasn’t responded to ECN echo sent by receiver else if (m_tcb->m_ecnState == TcpSocketState::ECN_SENDING_ECE || m_tcb->m_ecnState == TcpSocketState::ECN_SENDING_CC) { SendEmptyPacket (TcpHeader::ACK | TcpHeader::ECE); NS_LOG_DEBUG (TcpSocketState::EcnStateName[m_tcb->m_ecnState] << " -> ECN_SENDING_ECE"); m_tcb->m_ecnState = TcpSocketState::ECN_SENDING_ECE; } }
-
In function ReceivedAck()
When Ecn mode is Extended Ecn. And ACK received at sender side has ECE and CWR bit set then count_cc is increased by 1 at sender side.if (ackNumber > oldHeadSequence && m_ecnMode == EcnMode_t::ExtendedEcn && (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED) && ((tcpHeader.GetFlags () & TcpHeader::ECE) && (tcpHeader.GetFlags () & TcpHeader::CWR))) { if (m_ecnEchoSeq < ackNumber) { count_cc++; NS_LOG_INFO ("Received ECN Echo is valid"); m_ecnEchoSeq = ackNumber; NS_LOG_DEBUG (TcpSocketState::EcnStateName[m_tcb->m_ecnState] << " -> ECN_CC_RCVD"); m_tcb->m_ecnState = TcpSocketState::ECN_CC_RCVD; } }
-
- We evaluated Extended Ecn with pie-example
-
For ExtendedEcn functionality, we added attribute in pie-queue-disc.cc
.AddAttribute ("UseXEcn", "True to use Extended ECN ", BooleanValue(false), MakeBooleanAccessor (&PieQueueDisc::m_useXEcn), MakeBooleanChecker())
and added
bool m_useXEcn ; // // true if Extended ecn is used
in pie-queue-disc.h -
use
Config::SetDefault ("ns3::TcpSocketBase::EcnMode", StringValue("ExtendedEcn"));
Config::SetDefault ("ns3::RedQueueDisc::UseXEcn", BooleanValue (true));
to enable ExtendedEcn in pie-example.cc -
Network topology
10Mb/s, 2ms 10Mb/s, 4ms n0--------------| |---------------n4 | 1.5Mbps, 20ms | n2------------------n3 10Mb/s, 3ms | QueueLimit = 100 | 10Mb/s, 5ms n1--------------| |---------------n5
-
-
When only Classic ECN is enabled.
-
When ExtendedEcn is enabled.
Note: The last line in the output (Number of packets marked by router:) is calculated at sender side. Therefore in output 1 with ClassicEcn packets marked by the router is not calculated(hence value is 0) whereas in output 2 with ExtendedEcn packets marked by the router is calculated(hence value is 359).