summaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-01-04 16:03:48 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-01-04 16:03:48 +0000
commit78c388aed2b7184182c08428db1de6c872d815f5 (patch)
tree4b2003b1b4ceb241a17faa995da8dd1004bb8e45 /net/sched
parenteb7a5bf93aaa4be1d7c6181100ab7639e74d67f7 (diff)
Merge with Linux 2.1.131 and more MIPS goodies.
(Did I mention that CVS is buggy ...)
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/sch_cbq.c2
-rw-r--r--net/sched/sch_red.c35
2 files changed, 32 insertions, 5 deletions
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 52512e879..9ae14c243 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -54,7 +54,7 @@
-----------------------------------------------------------------------
- Algorithm skeleton was taken from from NS simulator cbq.cc.
+ Algorithm skeleton was taken from NS simulator cbq.cc.
If someone wants to check this code against the LBL version,
he should take into account that ONLY the skeleton was borrowed,
the implementation is different. Particularly:
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index 80bc0a96f..eac678b83 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -7,6 +7,9 @@
* 2 of the License, or (at your option) any later version.
*
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
+ *
+ * Changes:
+ * J Hadi Salim <hadi@nortel.com> 980914: computation fixes
*/
#include <linux/config.h>
@@ -156,9 +159,9 @@ red_enqueue(struct sk_buff *skb, struct Qdisc* sch)
if (!PSCHED_IS_PASTPERFECT(q->qidlestart)) {
long us_idle;
- PSCHED_SET_PASTPERFECT(q->qidlestart);
PSCHED_GET_TIME(now);
us_idle = PSCHED_TDIFF_SAFE(now, q->qidlestart, q->Scell_max, 0);
+ PSCHED_SET_PASTPERFECT(q->qidlestart);
/*
The problem: ideally, average length queue recalcultion should
@@ -177,10 +180,18 @@ red_enqueue(struct sk_buff *skb, struct Qdisc* sch)
but it is field for experiments.
*/
q->qave >>= q->Stab[(us_idle>>q->Scell_log)&0xFF];
+ } else {
+ q->qave += sch->stats.backlog - (q->qave >> q->Wlog);
+ /* NOTE:
+ q->qave is fixed point number with point at Wlog.
+ The formulae above is equvalent to floating point
+ version:
+
+ qave = qave*(1-W) + sch->stats.backlog*W;
+ --ANK (980924)
+ */
}
- q->qave += sch->stats.backlog - (q->qave >> q->Wlog);
-
if (q->qave < q->qth_min) {
enqueue:
q->qcount = -1;
@@ -202,6 +213,22 @@ drop:
goto drop;
}
if (++q->qcount) {
+ /* The formula used below causes questions.
+
+ OK. qR is random number in the interval 0..Rmask
+ i.e. 0..(2^Plog). If we used floating point
+ arithmetics, it would be: (2^Plog)*rnd_num,
+ where rnd_num is less 1.
+
+ Taking into account, that qave have fixed
+ point at Wlog, and Plog is related to max_P by
+ max_P = (qth_max-qth_min)/2^Plog; two lines
+ below have the following floating point equivalent:
+
+ max_P*(qave - qth_min)/(qth_max-qth_min) < rnd/qcount
+
+ Any questions? --ANK (980924)
+ */
if (((q->qave - q->qth_min)>>q->Wlog)*q->qcount < q->qR)
goto enqueue;
q->qcount = 0;
@@ -289,7 +316,7 @@ static int red_init(struct Qdisc *sch, struct rtattr *opt)
q->Plog = ctl->Plog;
q->Rmask = ctl->Plog < 32 ? ((1<<ctl->Plog) - 1) : ~0UL;
q->Scell_log = ctl->Scell_log;
- q->Scell_max = (256<<q->Scell_log)-1;
+ q->Scell_max = (255<<q->Scell_log);
q->qth_min = ctl->qth_min<<ctl->Wlog;
q->qth_max = ctl->qth_max<<ctl->Wlog;
q->limit = ctl->limit;