aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_htb.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-12-05 09:37:56 -0500
committerDavid Howells <dhowells@warthog.cambridge.redhat.com>2006-12-05 09:37:56 -0500
commit4c1ac1b49122b805adfa4efc620592f68dccf5db (patch)
tree87557f4bc2fd4fe65b7570489c2f610c45c0adcd /net/sched/sch_htb.c
parentc4028958b6ecad064b1a6303a6a5906d4fe48d73 (diff)
parentd916faace3efc0bf19fe9a615a1ab8fa1a24cd93 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/infiniband/core/iwcm.c drivers/net/chelsio/cxgb2.c drivers/net/wireless/bcm43xx/bcm43xx_main.c drivers/net/wireless/prism54/islpci_eth.c drivers/usb/core/hub.h drivers/usb/input/hid-core.c net/core/netpoll.c Fix up merge failures with Linus's head and fix new compilation failures. Signed-Off-By: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net/sched/sch_htb.c')
-rw-r--r--net/sched/sch_htb.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 4b52fa78935a..215e68c2b615 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1223,17 +1223,14 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
1223 struct htb_class *cl = (struct htb_class *)arg; 1223 struct htb_class *cl = (struct htb_class *)arg;
1224 1224
1225 if (cl && !cl->level) { 1225 if (cl && !cl->level) {
1226 if (new == NULL && (new = qdisc_create_dflt(sch->dev, 1226 if (new == NULL &&
1227 &pfifo_qdisc_ops)) 1227 (new = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops,
1228 cl->classid))
1228 == NULL) 1229 == NULL)
1229 return -ENOBUFS; 1230 return -ENOBUFS;
1230 sch_tree_lock(sch); 1231 sch_tree_lock(sch);
1231 if ((*old = xchg(&cl->un.leaf.q, new)) != NULL) { 1232 if ((*old = xchg(&cl->un.leaf.q, new)) != NULL) {
1232 if (cl->prio_activity) 1233 qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
1233 htb_deactivate(qdisc_priv(sch), cl);
1234
1235 /* TODO: is it correct ? Why CBQ doesn't do it ? */
1236 sch->q.qlen -= (*old)->q.qlen;
1237 qdisc_reset(*old); 1234 qdisc_reset(*old);
1238 } 1235 }
1239 sch_tree_unlock(sch); 1236 sch_tree_unlock(sch);
@@ -1248,6 +1245,14 @@ static struct Qdisc *htb_leaf(struct Qdisc *sch, unsigned long arg)
1248 return (cl && !cl->level) ? cl->un.leaf.q : NULL; 1245 return (cl && !cl->level) ? cl->un.leaf.q : NULL;
1249} 1246}
1250 1247
1248static void htb_qlen_notify(struct Qdisc *sch, unsigned long arg)
1249{
1250 struct htb_class *cl = (struct htb_class *)arg;
1251
1252 if (cl->un.leaf.q->q.qlen == 0)
1253 htb_deactivate(qdisc_priv(sch), cl);
1254}
1255
1251static unsigned long htb_get(struct Qdisc *sch, u32 classid) 1256static unsigned long htb_get(struct Qdisc *sch, u32 classid)
1252{ 1257{
1253 struct htb_class *cl = htb_find(classid, sch); 1258 struct htb_class *cl = htb_find(classid, sch);
@@ -1269,9 +1274,9 @@ static void htb_destroy_filters(struct tcf_proto **fl)
1269static void htb_destroy_class(struct Qdisc *sch, struct htb_class *cl) 1274static void htb_destroy_class(struct Qdisc *sch, struct htb_class *cl)
1270{ 1275{
1271 struct htb_sched *q = qdisc_priv(sch); 1276 struct htb_sched *q = qdisc_priv(sch);
1277
1272 if (!cl->level) { 1278 if (!cl->level) {
1273 BUG_TRAP(cl->un.leaf.q); 1279 BUG_TRAP(cl->un.leaf.q);
1274 sch->q.qlen -= cl->un.leaf.q->q.qlen;
1275 qdisc_destroy(cl->un.leaf.q); 1280 qdisc_destroy(cl->un.leaf.q);
1276 } 1281 }
1277 qdisc_put_rtab(cl->rate); 1282 qdisc_put_rtab(cl->rate);
@@ -1322,6 +1327,7 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg)
1322{ 1327{
1323 struct htb_sched *q = qdisc_priv(sch); 1328 struct htb_sched *q = qdisc_priv(sch);
1324 struct htb_class *cl = (struct htb_class *)arg; 1329 struct htb_class *cl = (struct htb_class *)arg;
1330 unsigned int qlen;
1325 1331
1326 // TODO: why don't allow to delete subtree ? references ? does 1332 // TODO: why don't allow to delete subtree ? references ? does
1327 // tc subsys quarantee us that in htb_destroy it holds no class 1333 // tc subsys quarantee us that in htb_destroy it holds no class
@@ -1334,6 +1340,12 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg)
1334 /* delete from hash and active; remainder in destroy_class */ 1340 /* delete from hash and active; remainder in destroy_class */
1335 hlist_del_init(&cl->hlist); 1341 hlist_del_init(&cl->hlist);
1336 1342
1343 if (!cl->level) {
1344 qlen = cl->un.leaf.q->q.qlen;
1345 qdisc_reset(cl->un.leaf.q);
1346 qdisc_tree_decrease_qlen(cl->un.leaf.q, qlen);
1347 }
1348
1337 if (cl->prio_activity) 1349 if (cl->prio_activity)
1338 htb_deactivate(q, cl); 1350 htb_deactivate(q, cl);
1339 1351
@@ -1410,11 +1422,14 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
1410 /* create leaf qdisc early because it uses kmalloc(GFP_KERNEL) 1422 /* create leaf qdisc early because it uses kmalloc(GFP_KERNEL)
1411 so that can't be used inside of sch_tree_lock 1423 so that can't be used inside of sch_tree_lock
1412 -- thanks to Karlis Peisenieks */ 1424 -- thanks to Karlis Peisenieks */
1413 new_q = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops); 1425 new_q = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops, classid);
1414 sch_tree_lock(sch); 1426 sch_tree_lock(sch);
1415 if (parent && !parent->level) { 1427 if (parent && !parent->level) {
1428 unsigned int qlen = parent->un.leaf.q->q.qlen;
1429
1416 /* turn parent into inner node */ 1430 /* turn parent into inner node */
1417 sch->q.qlen -= parent->un.leaf.q->q.qlen; 1431 qdisc_reset(parent->un.leaf.q);
1432 qdisc_tree_decrease_qlen(parent->un.leaf.q, qlen);
1418 qdisc_destroy(parent->un.leaf.q); 1433 qdisc_destroy(parent->un.leaf.q);
1419 if (parent->prio_activity) 1434 if (parent->prio_activity)
1420 htb_deactivate(q, parent); 1435 htb_deactivate(q, parent);
@@ -1562,6 +1577,7 @@ static void htb_walk(struct Qdisc *sch, struct qdisc_walker *arg)
1562static struct Qdisc_class_ops htb_class_ops = { 1577static struct Qdisc_class_ops htb_class_ops = {
1563 .graft = htb_graft, 1578 .graft = htb_graft,
1564 .leaf = htb_leaf, 1579 .leaf = htb_leaf,
1580 .qlen_notify = htb_qlen_notify,
1565 .get = htb_get, 1581 .get = htb_get,
1566 .put = htb_put, 1582 .put = htb_put,
1567 .change = htb_change_class, 1583 .change = htb_change_class,