Subject: Re: [PATCH] sch_htb.c consume the classes's tokens bellow the HTB_CAN_SEND level

From: Jarek Poplawski <[email-masked]>
Date: Wed, 4 Nov 2009 00:00:35 +0100

On Tue, Nov 03, 2009 at 09:18:49PM +0800, Changli Gao wrote:
> On Tue, Nov 3, 2009 at 6:05 PM, Jarek Poplawski <[email-masked]> wrote:
> >
> > The ceil specification is controlled only by ctokens, which are always
> > updated, so no such risk.
> >
> Nevertheless, updating tokens is necessary too.

If it's really necessary you should present some test case fixed by
your patch, I guess.

In the meantime let's consider what could be broken:
class 1:1 (parent) rate 10 packets/sec
class 1:2 rate 5 packets/sec ceil 10 packets/sec
class 1:3 rate 5 packets/sec ceil 10 packets/sec

class 1:2 doesn't use all its rate, and sends every other second
	(in even seconds)
class 1:3 sends 10 packets during the first second, so with your
	patch it will use its tokens for 2 seconds
class 1:2 uses its rate in the second second..., so class 1:1
	can't lend anything
class 1:3 can only borrow, so it won't be able to send during
	this second anything

So, the effect would be class 1:3 sending every odd second 10 packets
while every even second - nothing...

Of course the example is a simplification of the htb algorithm. There
should be also considered priority of borrowing, which should add
similar effects even with regular traffic. But generally the
guaranteed rates would be simply...  less guaranteed.

Regards,
Jarek P.