Subject: Re: [PATCH] netem: account for packets in delayed queue in qlen

From: Patrick McHardy <[email-masked]>
Date: Tue, 05 Apr 2005 21:48:45 +0200

Stephen Hemminger wrote:
> Netem has a private queue for delayed packets, and currently, packets
> in this queue are not accounted for in the qdisc qlen statistics.
> This is a problem if netem is used inside another qdisc doing rate
> control that peeks at the qlen.
> 
> This patch changes the statistics to include the packets held but
> not ready to send.

There is one troublesome spot left, netem_watchdog() decreases q.qlen
when the packet couldn't be enqueued. I don't think it is possible
to make netem useable as leaf-qdisc, it will always have to touch
q.qlen from timer context and classful qdiscs can't deal with this
since they all maintain their own q.qlen counters and expect changes
only in the +-1 range in enqueue/dequeue/requeue/drop. Best thing IMO
would be to refuse to work as anything but root qdisc.

Regards
Patrick