netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: davem@davemloft.net
Cc: devik@cdi.cz, netdev@vger.kernel.org, Patrick McHardy <kaber@trash.net>
Subject: [NET_SCHED 05/06]: Fix endless loops (part 3): HFSC
Date: Mon, 20 Nov 2006 14:08:46 +0100 (MET)	[thread overview]
Message-ID: <20061120130845.22347.81357.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20061120130834.22347.34853.sendpatchset@localhost.localdomain>

[NET_SCHED]: Fix endless loops (part 3): HFSC

Convert HFSC to use qdisc_tree_decrease_len() and add a callback
for deactivating a class when its child queue becomes empty.

All queue purging goes through hfsc_purge_queue(), which is used in
three cases: grafting, class creation (when a leaf class is turned
into an intermediate class by attaching a new class) and class
deletion. In all cases qdisc_tree_decrease_len() is needed.

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit 62ab4431af7bccd0a8cd9b1933fb03e78fd63252
tree 79911d570a56ac3752790808ae8139983253524a
parent 0ce9475d7baf678698eb70369f734b8feeb03e13
author Patrick McHardy <kaber@trash.net> Mon, 20 Nov 2006 13:46:23 +0100
committer Patrick McHardy <kaber@trash.net> Mon, 20 Nov 2006 13:46:23 +0100

 net/sched/sch_hfsc.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 1142d29..2d43744 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -957,11 +957,7 @@ hfsc_purge_queue(struct Qdisc *sch, stru
 	unsigned int len = cl->qdisc->q.qlen;
 
 	qdisc_reset(cl->qdisc);
-	if (len > 0) {
-		update_vf(cl, 0, 0);
-		set_passive(cl);
-		sch->q.qlen -= len;
-	}
+	qdisc_tree_decrease_qlen(cl->qdisc, len);
 }
 
 static void
@@ -1295,6 +1291,17 @@ hfsc_class_leaf(struct Qdisc *sch, unsig
 	return NULL;
 }
 
+static void
+hfsc_qlen_notify(struct Qdisc *sch, unsigned long arg)
+{
+	struct hfsc_class *cl = (struct hfsc_class *)arg;
+
+	if (cl->qdisc->q.qlen == 0) {
+		update_vf(cl, 0, 0);
+		set_passive(cl);
+	}
+}
+
 static unsigned long
 hfsc_get_class(struct Qdisc *sch, u32 classid)
 {
@@ -1779,6 +1786,7 @@ static struct Qdisc_class_ops hfsc_class
 	.delete		= hfsc_delete_class,
 	.graft		= hfsc_graft_class,
 	.leaf		= hfsc_class_leaf,
+	.qlen_notify	= hfsc_qlen_notify,
 	.get		= hfsc_get_class,
 	.put		= hfsc_put_class,
 	.bind_tcf	= hfsc_bind_tcf,

  parent reply	other threads:[~2006-11-20 13:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-20 13:08 [NET_SCHED 00/06]: Fix endless dequeue loops Patrick McHardy
2006-11-20 13:08 ` [NET_SCHED 01/06]: sch_htb: perform qlen adjustment immediately in ->delete Patrick McHardy
2006-11-30  1:35   ` David Miller
2006-11-20 13:08 ` [NET_SCHED 02/06]: Set parent classid in default qdiscs Patrick McHardy
2006-11-30  1:35   ` David Miller
2006-11-20 13:08 ` [NET_SCHED 03/06]: Fix endless loops caused by inaccurate qlen counters (part 1) Patrick McHardy
2006-11-20 14:23   ` Mika Penttilä
2006-11-20 14:31     ` Patrick McHardy
2006-11-20 14:44       ` Mika Penttilä
2006-11-20 14:51         ` Patrick McHardy
2006-11-20 16:07           ` Mika Penttilä
2006-11-20 16:42             ` Patrick McHardy
2006-11-30  1:35   ` David Miller
2006-11-20 13:08 ` [NET_SCHED 04/06]: Fix endless loops (part 2): "simple" qdiscs Patrick McHardy
2006-11-24 12:33   ` Jarek Poplawski
2006-11-24 13:07     ` Patrick McHardy
2006-11-24 13:37       ` Jarek Poplawski
2006-11-27  6:46       ` Jarek Poplawski
2006-11-30  1:36   ` David Miller
2006-11-20 13:08 ` Patrick McHardy [this message]
2006-11-30  1:36   ` [NET_SCHED 05/06]: Fix endless loops (part 3): HFSC David Miller
2006-11-20 13:08 ` [NET_SCHED 06/06]: Fix endless loops (part 4): HTB Patrick McHardy
2006-11-20 13:39   ` Martin Devera
2006-11-23  8:39   ` Jarek Poplawski
2006-11-23  8:44     ` Patrick McHardy
2006-11-23  9:01       ` Jarek Poplawski
2006-11-23  9:07         ` Patrick McHardy
2006-11-23  9:32           ` Martin Devera
2006-11-23  9:48             ` Patrick McHardy
2006-11-23 10:59             ` Jarek Poplawski
2006-11-30  1:37   ` David Miller

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=20061120130845.22347.81357.sendpatchset@localhost.localdomain \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=devik@cdi.cz \
    --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).