Difference between revisions of "ECN support for qdiscs in ns-3"

From Nsnam
Jump to: navigation, search
Line 130: Line 130:
 
3. Trace sources required for ECN :
 
3. Trace sources required for ECN :
 
In order to keep track of the statistics of forced and unforced marks, new variables of type Stats should be implemented in red-queue-disc.cc. If the packet is marked, then there should be no forced or unforced drops.
 
In order to keep track of the statistics of forced and unforced marks, new variables of type Stats should be implemented in red-queue-disc.cc. If the packet is marked, then there should be no forced or unforced drops.
 +
</pre>
 +
 +
=== '''Week 3''' ===
 +
<pre>
 +
Following methods have been added to support ECN marking by queue discs:
 +
 +
* IsEcnCapable () method: declared in queue-disc.h, ipv4-queue-disc-item.h  and implemented in ipv4-queue-disc-item.cc. It is a boolean method and returns true if the packet is ECN-capable i.e., packets have ECT(0) or ECT(1) bit set in IP header.
 +
 +
* Mark () method: declared in queue-disc.h, ipv4-queue-disc-item.h and implemented in ipv4-queue-disc-item.cc. It is a boolean method and returns true if marking the packet happens successfully, i.e., it successfully sets the CE bit in IP header. The Mark () method calls the IsEcnCapable () method and marks the packet only if it is ECN-capable.
 +
 +
* IsMarked () method: declared in queue-disc.h, ipv4-queue-disc-item.h and implemented in ipv4-queue-disc-item.cc. It is a boolean method and returns true if the packet is already marked, i.e., it has CE bit already set (whether to update the unforcedMark or forcedMark stats in such cases is yet to be decided).
 +
 
</pre>
 
</pre>

Revision as of 12:53, 29 August 2016

Project overview

  • Project: Enabling support for Explicit Congestion Notification (ECN) in ns-3 queue disciplines
  • Student: Shravya Kaudki Srinivas
  • Mentors: Mohit P. Tahiliani , Tom Henderson
  • Abstract: Explicit Congestion Notification (RFC 3168) is a mechanism for Active Queue Management (AQM) to notify endpoints of congestion that may be developing in a bottleneck queue, without resorting to packet drops. In ns-3, the current queue disciplines (e.g., RED) only support packet drops but not an ECN mode of operation. In this work, I plan to implement ECN mechanism in ns-3, enable its support in QueueDiscs and write tests to verify its functionality.
  • Project Code : ns3-ecn
  • Reference: The Addition of Explicit Congestion Notification (ECN) to IP (RFC 3168)
  • About me: I am pursuing B.Tech in Computer Science from National Institute of Technology Karnataka, Surathkal, India. Currently, I am a Mitacs intern working under Dr. Ehab Elmallah on Wireless Underwater Sensor Networks at University of Alberta, Canada.

Overview of ECN

ECN uses two bits in the IP header: ECN Capable Transport (ECT bit) and Congestion Experienced (CE bit), and two bits in the TCP header: Congestion Window Reduced (CWR) and ECN Echo (ECE). ns-3-dev already provides an implementation of ECN bits in the IP and TCP headers along with necessary setters and getters.

Although there has been a previous attempt to implement ECN in ns-3 [1], the approach adopted was non-trivial because of the lack of traffic-control layer in ns-3. Recently, traffic-control layer has been merged in the mainline of ns-3 and I plan to use the same for implementing ECN.

[1] Implementing explicit congestion notification in ns-3

Design assumptions and requirements

  1. Current behavior and performance of RED queue should be unaffected by the addition of ECN, if ECN is not in use.
  2. It should be possible to enable and disable ECN marking on a per-queue basis.
  3. Statistics for packets marked should be kept, and should be separate from drop statistics.
  4. A "Mark" trace source should be provided. It may or may not be appropriate to keep this in the QueueDisc base class, where a "Drop" trace source already exists, since marking may not be applicable to all QueueDiscs. (This item is an open issue)

Implementation plan

The overall implementation is planned for two phases. In the first phase, ECN marking capability will be provided to RED queue, and the capability will be unit tested by injecting packets directly to the queue disc, without the operation of TCP. In the second phase, TCP will be extended to support ECN, and the RED queue disc will be tested with TCP flows.

Weekly plan

Week 1 (July 19 - July 25)

* Walk through of RFC 3168
* Walk through of TrafficControlLayer and QueueDisc classes
* Walk through of RedQueueDisc class

Week 2 (July 26 - Aug 1)

* Prepare a plan to implement Mark() method. It includes identifying an appropriate class to contain this 
  method (i.e., QueueDisc or RedQueueDisc)
* Understanding the scope of existing trace sources in case of marking a packet and the need of new ones
* List the method(s) in RedQueueDisc that require modification to support ECN marking.

Week 3 (Aug 2 - Aug 8)

* Get the plan reviewed by mentors and make revisions to it
* Implement Mark () method. This method would check whether ECT bit is enabled, and if so, will set CE bit 
  in IPv4 header when RED detects congestion
* Provide support for generating ECN related stats (e.g., unforcedMark and forcedMark)

Week 4 (Aug 9 - Aug 15)

* Write unit tests by injecting packets directly to RedQueueDisc to verify the functionality of Mark(). These 
  tests will be defined in the internet module.
* Update the documentation
* Clean up the code and submit a patch for review

The first phase of the project gets completed here, and a mid term review can be scheduled around this period.

Week 5 (Aug 16 - Aug 22)

* Extend TCP to support ECN. It includes negotiating ECN feature during the handshake
* Update the documentation

Week 6 (Aug 23 - Aug 29)

* Test the implementation of ECN in RedQueueDisc with TCP flows
* Update the documentation
* Get feedback from the mentors and reviewers

Week 7 (Aug 30 - Sept 5)

* Extend other AQMs to support ECN
* Write unit tests for ECN support in each AQM
* Update the documentation

Week 8 (Sept 6 - Sept 12)

* Provide some examples for the user
* Update the documentation
* Incorporate final suggestions from the mentors and reviewers
* Make code merge ready

Weekly Progress

Week 1

After going through the existing tcp and ip model of ns-3 , here are the points I found out:

tcp-header.h and tcp-header.cc

The tcp header has last 2 bits reserved for ecn, i.e Ece|cwr is already present

SetFlag(int)-> This function is used to set m_flags variable of TCP header. The current documentation mention it to be working as only
a uint6_t variable as only 6 bits are in use, we will make use of the last two reserved bits for ECN. Since the function is already
 implemented we will call this with modified parameter.

For example: The negotiation step of ECN Enable TCP connection will be 
Sender to Receiver -> SetFlag(TcpHeader::SYN | TcpHeader::ECE | TcpHeader::CWR)
Receiver to Sender -> SetFlag(TcpHeader::SYN | TcpHeader::ECE | TcpHeader::ACK)
Sender to Receiver -> SetFlag(TcpHeader::ACK)

ipv4-header.h and ipv4-header.cc

Ipv4 header also has the ECNtype enum with all 4 ecn codepoints  defined and also the setter(SetEcn()) and getter(GetEcn()) functions 
to set ECN values in m_tos and retrieve it. These functions haven’t been used in the implementation of any modules. We will use these 
setter and getter function for the  ECN manipulation in Ipv4.

Week 2

1. Decision to implement Mark () method in QueueDiscItem :
Mark () method has been declared as virtual in QueueDiscItem class in  queue-disc.h because marking is a feature that can be applied to a queue disc item. Classes in the internet model, that inherit the QueueDiscItem, can implement the Mark () method based on the requirement.

2. List of methods to be modified to include ECN support :
 DoEnqueue method in red-queue-disc.cc
 
3. Trace sources required for ECN :
In order to keep track of the statistics of forced and unforced marks, new variables of type Stats should be implemented in red-queue-disc.cc. If the packet is marked, then there should be no forced or unforced drops.

Week 3

Following methods have been added to support ECN marking by queue discs:

* IsEcnCapable () method: declared in queue-disc.h, ipv4-queue-disc-item.h  and implemented in ipv4-queue-disc-item.cc. It is a boolean method and returns true if the packet is ECN-capable i.e., packets have ECT(0) or ECT(1) bit set in IP header.

* Mark () method: declared in queue-disc.h, ipv4-queue-disc-item.h and implemented in ipv4-queue-disc-item.cc. It is a boolean method and returns true if marking the packet happens successfully, i.e., it successfully sets the CE bit in IP header. The Mark () method calls the IsEcnCapable () method and marks the packet only if it is ECN-capable.

* IsMarked () method: declared in queue-disc.h, ipv4-queue-disc-item.h and implemented in ipv4-queue-disc-item.cc. It is a boolean method and returns true if the packet is already marked, i.e., it has CE bit already set (whether to update the unforcedMark or forcedMark stats in such cases is yet to be decided).