netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Changli Gao <xiaosuo@gmail.com>
To: Jamal Hadi Salim <hadi@cyberus.ca>
Cc: devik@cdi.cz, netdev@vger.kernel.org, xiaosuo <xiaosuo@gmail.com>
Subject: [PATCH] sch_htb.c consume the classes's tokens bellow the HTB_CAN_SEND level
Date: Tue, 03 Nov 2009 10:41:38 +0800	[thread overview]
Message-ID: <4AEF9862.8040404@gmail.com> (raw)

sch_htb.c consume the classes's tokens bellow the HTB_CAN_SEND level.

When a class enters HTB_MAY_BORROW state, it relies on its parents to
sent packets. The parent class in HTB_CAN_SEND state only consumes
itself and its parents's tokens, but ADD tokens to the classes under its
level. It is totally wrong. It means that a class, which sends packets
in ceil rate, can also enter HTB_CAN_SEND state now and then.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>

----
net/sched/sch_htb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 85acab9..2705702 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -629,11 +629,10 @@ static void htb_charge_class(struct htb_sched *q, struct htb_class *cl,
 		if (cl->level >= level) {
 			if (cl->level == level)
 				cl->xstats.lends++;
-			htb_accnt_tokens(cl, bytes, diff);
 		} else {
 			cl->xstats.borrows++;
-			cl->tokens += diff;	/* we moved t_c; update tokens */
 		}
+		htb_accnt_tokens(cl, bytes, diff);
 		htb_accnt_ctokens(cl, bytes, diff);
 		cl->t_c = q->now;
 



             reply	other threads:[~2009-11-03  2:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-03  2:41 Changli Gao [this message]
2009-11-03  8:00 ` [PATCH] sch_htb.c consume the classes's tokens bellow the HTB_CAN_SEND level Jarek Poplawski
2009-11-03  9:47   ` Changli Gao
2009-11-03 10:05     ` Jarek Poplawski
2009-11-03 13:18       ` Changli Gao
2009-11-03 23:00         ` Jarek Poplawski
2009-11-04  1:53           ` Changli Gao
2009-11-04  8:28             ` Jarek Poplawski
2009-11-04  9:16               ` Changli Gao
2009-11-04 10:42                 ` Jarek Poplawski
2009-11-04 10:58                   ` Martin Devera
2009-11-04 11:30                     ` Changli Gao
2009-11-04 11:51                       ` Martin Devera
2009-11-04 11:58                       ` Martin Devera
2009-11-04 12:08                         ` Changli Gao
2009-11-04 12:15                           ` Martin Devera
2009-11-05  5:44                             ` Changli Gao
2009-11-04 11:21                   ` Changli Gao
2009-11-04 11:49                     ` Jarek Poplawski
2009-11-04 12:01                       ` Changli Gao
2009-11-04 12:11                         ` Jarek Poplawski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AEF9862.8040404@gmail.com \
    --to=xiaosuo@gmail.com \
    --cc=devik@cdi.cz \
    --cc=hadi@cyberus.ca \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).