Nothing happens using ECN.

274 views
Skip to first unread message

Kurt Erikson

unread,
Apr 10, 2017, 4:09:34 PM4/10/17
to ns-3-users
Hi,

I recently switched from Omnetpp to NS3. I did the Tutorial and tried the " find . -name '*.cc' | xargs grep -i XY" now im horrible stuck using ECN.

I am currently working on a new Queuedisc.
Im trying to give certain packages an ECN-Marking, to enforce fairness. But my simulation results look like i am operating without any algorithm. If i drop the packages everything works perfectly.

My Approach:

I mark packets using this class: I assume there is an easier way marking packets, but i have not found it jet.
Ptr<QueueDiscItem> NewQueueDisc::mark(Ptr<QueueDiscItem> item) {
    Ptr<const Ipv4QueueDiscItem> ipv4Item =
            DynamicCast<const Ipv4QueueDiscItem>(item);
    Ipv4Header ipHeader = ipv4Item->GetHeader();
    ipHeader.SetEcn(Ipv4Header::ECN_CE);
    Ptr<Ipv4QueueDiscItem> newPacket = Create<Ipv4QueueDiscItem>(
            ipv4Item->GetPacket(), ipv4Item->GetAddress(),
            ipv4Item->GetProtocol(), ipHeader);
    return newPacket;
}


This is used in the "DoEnqueue(Ptr<QueueDiscItem> item)" method like:
         item = mark(item);
    bool intEnqueue = GetInternalQueue(0)->Enqueue(item);

To test this i use in the "DoDequeue" method:
ipv4Item->GetHeader().GetEcn()
which results in many 3s. Thus i guess i make everything correct. Also source / dest addresses seem to be fine. But my results are horrible.


Im using TCP-New Reno
    Config::SetDefault("ns3::TcpL4Protocol::SocketType",
            StringValue("ns3::TcpNewReno"));
My Sink uses:
    PacketSinkHelper sink("ns3::TcpSocketFactory",
            InetSocketAddress(Ipv4Address::GetAny(), port));

And my channels are a P2P channel.


My guess:
My packet receiving node sends no ECN-Feedback, thus the sendubg nodes never reduce their congestion window.


My Question:
1. Is there a better / shorter / easier way to give QueueDiscItems/Ipv4QueueDiscItems ECN-Markings?
2. Do I have to change anything in my topology? I do not enable ECN anywhere?

System:
I tried it using ns3-3.26 and ns3-dev-dce. My OS is Ubuntu.



Attached File:
The queuediscs goal is it to enforce fairness (force every user to forward the same amount of bytes over a bottleneck). The attached file shows my result. The line looking like a "U" shows that my queuedisc is able to enforce fairness
(for some configuration), if the Queuedisc drops packets. The line which is constant on 10.3 is the result if i do not drop packets but give them ECN-Markings. Since the queuedisc works, if i drop packets, i assume my implementation is correct and i am using ECN the wrong way.
Using Omnetpp i got my desired fairness using ECN-Markings and Drops, thus its not typical ECN behavior and my current result is wrong.
In my despair i even tried to mark EVERY package, resulting in the same result I attached.


with kind regards
Kurt

measuredUnfairness.png
Message has been deleted

Kurt Erikson

unread,
Apr 11, 2017, 4:41:25 AM4/11/17
to ns-3-users
I found a Solution to my first question.
The Ipv4QueueDiscItem has an function called
 
Mark ( void  )






It works like it should by
"Marks the packet by setting ECN_CE bits if the packet has ECN_ECT0 or ECN_ECT1 bits set."
I used it instead of my mark function and it did what it should. Marking nothing, since none of my packages has  "ECN_ECT0 or ECN_ECT1" set. Those bits are used to mark packages as ECN-Capable, since ECN is only optional. But how do I set them?
Is the current implementation of ECN complete? Is ist possible to set my TCP-Apps ECN-Cappable?


With kind Regards
Kurt

Mohit P. Tahiliani

unread,
Apr 12, 2017, 2:34:27 AM4/12/17
to ns-3-users
Hi Kurt,

At present, the TCP models in ns-3 are not ECN-Capable.

However, the code for same is ready, and is being reviewed here:


Feel free to patch your ns-3-dev with the code given on that link, and do let us know if you have any further queries.

Regards,
Mohit P. Tahiliani

Kurt Erikson

unread,
Apr 13, 2017, 4:00:15 AM4/13/17
to ns-3-users
Hi,

Thank you it worked great!


Regards,
Kurt

kashif nadeem

unread,
Oct 30, 2017, 3:36:51 AM10/30/17
to ns-3-users
Hi Mohit,
I did patch ECN in ns3.26 but it is not working as it should. After ecn negotiation in tcp hand shake sender sets ECT (0) but receiver node never reply with ECT (0). I added following to ECN patches to NS3.26 
Here is my script and xml trace file.

Please guide me.
Thanks in advance
mptcp-testing-example.cc
mptcp-example.xml

Mohit P. Tahiliani

unread,
Oct 31, 2017, 3:23:17 PM10/31/17
to ns-3-users
Hi Kashif,

ECT (0) and ECT (1) codepoints are set only by the sender.

If receiver receives a CE codepoint, it sends ECE codepoint (of TCP header) to the sender to inform about congestion that is building up.

I think the code is working fine.

Thanks,
Mohit P. Tahiliani

P.S.: Please open a new thread for this discussion. The previous discussion on this thread has been already Marked as Completed. Thanks!
Reply all
Reply to author
Forward
0 new messages