[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] Bug in DiffServ Module - PQ scheduler
Hi everybody,
as work of my thesis I'm evaluating the DiffServ module. I found a bug
in the PQ scheduler.
This scheduler provides the possibility to assign a maximun rate to each
queue. For instance let us consider the example in the ns distribution
(ds-cbr-tb-PRI.tcl):
...
# Set DS RED parameters from Core to Edge2:
$qCE2 setSchedularMode PRI
$qCE2 addQueueRate 0 3000000
...
In this example on the output interface of the core a PQ scheduler is
set and a maximum rate of 3000000 bit/s is assigned to the 0 queue. The
real assigned bandwith is more than 3Mbit/s as you can see in diagram
before.ps.
This is because when there is a new packet to be dequeued, only the
AvgRate of the related queue is updated. When a new comparison among
AvgRate and MaxRate is made to select the queue to dequeue, only the
last served has got AvgRate updated. Instead every AvgRate should be
updated.
I attach to this my patch. For a more easy solution I made the choice to
change the interface of applyTSWMeter method. I tested it and it seems
to work (have a look at after.ps).
I hope to be right and useful.
Please, send me comments/questions if you have.
Bye
Sergio
before.ps
after.ps
--- dsred.h.orig Fri Jun 8 17:22:11 2001
+++ dsred.h Fri Jun 8 17:16:41 2001
@@ -159,7 +159,7 @@
void addQueueWeights(int queueNum, int weight); // Add a maxRate to a PRI queue
void addQueueRate(int queueNum, int rate); // Add a weigth to a WRR or WIRR queue
void printWRRcount(); // print various stats
- void applyTSWMeter(Packet *pkt); // apply meter to calculate average rate of a PRI queue
+ void applyTSWMeter(int qToDq, int size); // apply meter to calculate average rate of a PRI queue
};
#endif
--- dsred.cc.orig Fri Jun 8 17:22:02 2001
+++ dsred.cc Fri Jun 8 17:21:19 2001
@@ -143,7 +143,7 @@
/*------------------------------------------------------------------------------
-void applyTSWMeter(Packet *pkt)
+void applyTSWMeter(int qToDq, int size)
Pre: policy's variables avgRate, arrivalTime, and winLen hold valid values; and
pkt points to a newly-arrived packet.
Post: Adjusts policy's TSW state variables avgRate and arrivalTime (also called
@@ -151,13 +151,12 @@
Note: See the paper "Explicit Allocation of Best effor Delivery Service" (David
Clark and Wenjia Fang), Section 3.3, for a description of the TSW Tagger.
------------------------------------------------------------------------------*/
-void dsREDQueue::applyTSWMeter(Packet *pkt) {
+void dsREDQueue::applyTSWMeter(int qToDq, int size) {
double now, bytesInTSW, newBytes;
- hdr_cmn* hdr = hdr_cmn::access(pkt);
double winLen = 1.0;
bytesInTSW = queueAvgRate[qToDq] * winLen;
- newBytes = bytesInTSW + (double) hdr->size();
+ newBytes = bytesInTSW+size;
now = Scheduler::instance().clock();
queueAvgRate[qToDq] = newBytes / (now - queueArrTime[qToDq] + winLen);
queueArrTime[qToDq] = now;
@@ -233,7 +232,9 @@
fid = iph->flowid()/32;
pktcount[qToDq]+=1;
- if (schedMode==schedModePRI && queueMaxRate[qToDq]) applyTSWMeter(p);
+ if (schedMode==schedModePRI)
+ for (int i=0;i<numQueues_;i++)
+ if (queueMaxRate[i]) applyTSWMeter(i,(i==qToDq) ? hdr_cmn::access(p)->size() : 0);
/* There was a packet to be dequed;
find the precedence level (or virtual queue)