Hi list,
I'm not sure if a more appropriate list (ns-dev ?) exists, so I'm
posting here. Please tell me if this suggestion would better be posted on
another list/tracking systems.
A part of the DCCP patch (by Nils-Erik Mattsson) for ns [0,1] contains
support for RFC3168 Codepoints [2].
This code is not strictly DCCP-related, and other protocols may benefit
from this being integrated in the trunk.
I stripped the patch down to the relevant section to help reviewing. Can
somebody have an educated look at it?
Hope this helps (:
[0] http://lifc.univ-fcomte.fr/~dedu/ns2/dccp-ns2.31.patch
[1] http://nicta.com.au/__data/assets/file/0011/16868/ns-233-dccp-1.patch
[2] http://www.ietf.org/rfc/rfc3168.txt
--
Olivier Mehani <[EMAIL PROTECTED]>
PGP fingerprint: 3720 A1F7 1367 9FA3 C654 6DFB 6845 4071 E346 2FD1
diff -urNU5 ns-2.33/queue/errmodel.cc ns-2.33-dccp/queue/errmodel.cc
--- ns-2.33/queue/errmodel.cc 2008-04-01 13:00:08.000000000 +1100
+++ ns-2.33-dccp/queue/errmodel.cc 2008-05-05 17:17:43.000000000 +1000
@@ -192,11 +192,13 @@
if (error) {
ch->error() |= error;
if (markecn_) {
hdr_flags* hf = hdr_flags::access(p);
- hf->ce() = 1;
+ /* --- Altered to support the codepoints in rfc3168
--- */
+ hf->ce() = 1; //set ce codepoint
+ hf->ect() = 1;
} else if (delay_pkt_) {
// Delay the packet.
Scheduler::instance().schedule(target_, p, delay_);
return;
} else if (drop_) {
diff -urNU5 ns-2.33/queue/gk.cc ns-2.33-dccp/queue/gk.cc
--- ns-2.33/queue/gk.cc 2008-04-01 13:00:08.000000000 +1100
+++ ns-2.33-dccp/queue/gk.cc 2008-05-05 17:17:43.000000000 +1000
@@ -170,12 +170,16 @@
/* If the Real queue has packets and the mark_flag is set, mark the
outgoing packet. */
if((q_->length() > 0) && (mark_flag == 1)){
Packet *pp = q_->deque();
hdr_flags* hf = hdr_flags::access(pp);
- if(hf->ect() == 1) // ECN capable flow
- hf->ce() = 1; // Mark the TCP Flow;
+
+ /* --- Altered to support the codepoints in rfc3168 --- */
+ if(hf->ect() != hf->ce()){ // ECN capable flow (ECT(0), ECT(1))
+ hf->ce() = 1; // Set ce codepoint
+ hf->ect() = 1;
+ }
return pp;
}
else return q_->deque();
}
diff -urNU5 ns-2.33/queue/pi.cc ns-2.33-dccp/queue/pi.cc
--- ns-2.33/queue/pi.cc 2008-04-01 13:00:08.000000000 +1100
+++ ns-2.33-dccp/queue/pi.cc 2008-05-05 17:17:43.000000000 +1000
@@ -197,12 +197,17 @@
double u = Random::uniform();
if (u <= p) {
edv_.count = 0;
edv_.count_bytes = 0;
hdr_flags* hf = hdr_flags::access(pickPacketForECN(pkt));
- if (edp_.setbit && hf->ect()) {
- hf->ce() = 1; // mark Congestion Experienced bit
+
+ /* --- Altered to support the codepoints in rfc3168 --- */
+ if (edp_.setbit &&
+ (hf->ect() != hf->ce() || //ecn capable
+ hf->ect() == 1 && hf->ce() == 1)) { //or marked
+ hf->ce() = 1; // set ce codepoint
+ hf->ect() = 1;
return (0); // no drop
} else {
return (1); // drop
}
}
diff -urNU5 ns-2.33/queue/red.cc ns-2.33-dccp/queue/red.cc
--- ns-2.33/queue/red.cc 2008-04-01 13:00:08.000000000 +1100
+++ ns-2.33-dccp/queue/red.cc 2008-05-05 17:19:59.000000000 +1000
@@ -557,13 +557,18 @@
if (u <= edv_.v_prob) {
// DROP or MARK
edv_.count = 0;
edv_.count_bytes = 0;
hdr_flags* hf = hdr_flags::access(pickPacketForECN(pkt));
- if (edp_.setbit && hf->ect() &&
- (!edp_.use_mark_p || edv_.v_prob1 < edp_.mark_p)) {
+
+ /* --- Altered to support the codepoints in rfc3168 --- */
+ if (edp_.setbit &&
+ (hf->ect() != hf->ce() || //packet is ecn capabel
+ hf->ect() == 1 && hf->ce() == 1) //or already marked
+ && (!edp_.use_mark_p || edv_.v_prob1 < edp_.mark_p)) {
hf->ce() = 1; // mark Congestion Experienced bit
+ hf->ect() = 1;
// Tell the queue monitor here - call emark(pkt)
return (0); // no drop
} else {
return (1); // drop
}
diff -urNU5 ns-2.33/queue/rem.cc ns-2.33-dccp/queue/rem.cc
--- ns-2.33/queue/rem.cc 2008-04-01 13:00:08.000000000 +1100
+++ ns-2.33-dccp/queue/rem.cc 2008-05-05 17:17:43.000000000 +1000
@@ -209,12 +209,16 @@
int size = hdr_cmn::access(p)->size ();
pro = remv_.v_prob*size/remp_.p_pktsize;
}
if ( u <= pro ) {
hdr_flags* hf = hdr_flags::access(p);
- if(hf->ect() == 1) {
- hf->ce() = 1;
+
+ /* --- Altered to support the codepoints in
rfc3168 --- */
+ if(hf->ect() != hf->ce() || // ECN capable
+ hf->ect() == 1 && hf->ce() == 1) { //marked
+ hf->ce() = 1; // Set ce codepoint
+ hf->ect() = 1;
pmark_++;
}
}
}
}
diff -urNU5 ns-2.33/queue/rio.cc ns-2.33-dccp/queue/rio.cc
--- ns-2.33/queue/rio.cc 2008-04-01 13:00:08.000000000 +1100
+++ ns-2.33-dccp/queue/rio.cc 2008-05-05 17:17:43.000000000 +1000
@@ -209,13 +209,18 @@
if (u <= edv_in_.v_prob) {
// DROP or MARK
edv_in_.count = 0;
edv_in_.count_bytes = 0;
hdr_flags* hf = hdr_flags::access(pickPacketForECN(pkt));
- if (edp_.setbit && hf->ect() &&
+
+ /* --- Altered to support the codepoints in rfc3168 --- */
+ if (edp_.setbit &&
+ (hf->ect() != hf->ce() || //packet is ecn capable
+ hf->ect() == 1 && hf->ce() == 1) && //or marked
edv_in_.v_ave < edp_in_.th_max) {
- hf->ce() = 1; // mark Congestion Experienced bit
+ hf->ce() = 1; // set ce codepoint
+ hf->ect() = 1;
return (0); // no drop
} else {
return (1); // drop
}
}
diff -urNU5 ns-2.33/queue/vq.cc ns-2.33-dccp/queue/vq.cc
--- ns-2.33/queue/vq.cc 2008-04-01 13:00:08.000000000 +1100
+++ ns-2.33-dccp/queue/vq.cc 2008-05-05 17:17:43.000000000 +1000
@@ -257,18 +257,24 @@
if(vq_len < 0.0) vq_len = 0.0;
if(markfront_){
Packet *pp = q_->head();
hdr_flags* hf = hdr_flags::access(pp);
- if(hf->ect() == 1) // ECN capable flow
- hf->ce() = 1; // Mark the TCP Flow;
+ /* --- Altered to support the codepoints in rfc3168 --- */
+ if(hf->ect() != hf->ce()){ // ECN capable flow
+ hf->ce() = 1; // set ce codepoint
+ hf->ect() = 1;
+ }
}
else{
/* Mark the current packet and forget about it */
hdr_flags* hdr = hdr_flags::access(pkt);
- if(hdr->ect() == 1) // ECN capable flow
- hdr->ce() = 1; // For TCP Flows
+ /* --- Altered to support the codepoints in rfc3168 --- */
+ if(hdr->ect() != hdr->ce()){ // ECN capable flow
+ hdr->ce() = 1; // set ce codepoint
+ hdr->ect() = 1;
+ }
}
}
/* Implements a simple drop-tail/drop-front here. If needed other
mechanism (like drop-random ) can also be implemented */