]> err.no Git - linux-2.6/blobdiff - net/sched/sch_htb.c
[NET_SCHED]: Set parent classid in default qdiscs
[linux-2.6] / net / sched / sch_htb.c
index 4b52fa78935a025dfd338c374e939bd630c06111..3b36e9d60c200c5326aacb2af4c230eb9bd87aa2 100644 (file)
@@ -1223,8 +1223,9 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
        struct htb_class *cl = (struct htb_class *)arg;
 
        if (cl && !cl->level) {
-               if (new == NULL && (new = qdisc_create_dflt(sch->dev,
-                                                           &pfifo_qdisc_ops))
+               if (new == NULL &&
+                   (new = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops,
+                                            cl->classid))
                    == NULL)
                        return -ENOBUFS;
                sch_tree_lock(sch);
@@ -1269,9 +1270,9 @@ static void htb_destroy_filters(struct tcf_proto **fl)
 static void htb_destroy_class(struct Qdisc *sch, struct htb_class *cl)
 {
        struct htb_sched *q = qdisc_priv(sch);
+
        if (!cl->level) {
                BUG_TRAP(cl->un.leaf.q);
-               sch->q.qlen -= cl->un.leaf.q->q.qlen;
                qdisc_destroy(cl->un.leaf.q);
        }
        qdisc_put_rtab(cl->rate);
@@ -1334,6 +1335,11 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg)
        /* delete from hash and active; remainder in destroy_class */
        hlist_del_init(&cl->hlist);
 
+       if (!cl->level) {
+               sch->q.qlen -= cl->un.leaf.q->q.qlen;
+               qdisc_reset(cl->un.leaf.q);
+       }
+
        if (cl->prio_activity)
                htb_deactivate(q, cl);
 
@@ -1410,7 +1416,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
                /* create leaf qdisc early because it uses kmalloc(GFP_KERNEL)
                   so that can't be used inside of sch_tree_lock
                   -- thanks to Karlis Peisenieks */
-               new_q = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops);
+               new_q = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops, classid);
                sch_tree_lock(sch);
                if (parent && !parent->level) {
                        /* turn parent into inner node */