Patrick McHardy wrote:
Should be fixed by this patch. Non-delayed packet enqueues don't
increase q.qlen, but it is decreased at dequeue, so q.qlen becomes
negative (actually, qlen is unsigned, but qdisc_restart returns
(int)q.qlen) and the device is constantly beeing dequeued from
qdisc_run.
I forgot to mention, the patch is also required for 2.4 and
applies with some offset.
Regards
Patrick
------------------------------------------------------------------------
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/10/18 23:42:47+02:00 kaber@coreworks.de
# [PKT_SCHED]: Fix netem qlen accounting
#
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
# net/sched/sch_netem.c
# 2004/10/18 23:42:13+02:00 kaber@coreworks.de +6 -2
# [PKT_SCHED]: Fix netem qlen accounting
#
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
diff -Nru a/net/sched/sch_netem.c b/net/sched/sch_netem.c
--- a/net/sched/sch_netem.c 2004-10-18 23:43:36 +02:00
+++ b/net/sched/sch_netem.c 2004-10-18 23:43:36 +02:00
@@ -195,7 +195,11 @@
++q->counter;
ret = q->qdisc->enqueue(skb, q->qdisc);
- if (ret)
+ if (likely(ret == NET_XMIT_SUCCESS)) {
+ sch->q.qlen++;
+ sch->stats.bytes += skb->len;
+ sch->stats.packets++;
+ } else
sch->stats.drops++;
return ret;
}
@@ -487,7 +491,7 @@
sch_tree_lock(sch);
*old = xchg(&q->qdisc, new);
qdisc_reset(*old);
- sch->q.qlen = 0;
+ sch->q.qlen = q->delayed.qlen;
sch_tree_unlock(sch);
return 0;
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html