]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/sched/sch_multiq.c
Merge branch 'core/debug' into core/core
[linux-2.6-omap-h63xx.git] / net / sched / sch_multiq.c
index 49a8b67ed3b880dae136a1e6ca3b71e3160391cb..915f3149dde23c6d5391d505ae957714961cd2d1 100644 (file)
@@ -97,6 +97,7 @@ static int
 multiq_requeue(struct sk_buff *skb, struct Qdisc *sch)
 {
        struct Qdisc *qdisc;
+       struct multiq_sched_data *q = qdisc_priv(sch);
        int ret;
 
        qdisc = multiq_classify(skb, sch, &ret);
@@ -113,6 +114,10 @@ multiq_requeue(struct sk_buff *skb, struct Qdisc *sch)
        if (ret == NET_XMIT_SUCCESS) {
                sch->q.qlen++;
                sch->qstats.requeues++;
+               if (q->curband)
+                       q->curband--;
+               else
+                       q->curband = q->bands - 1;
                return NET_XMIT_SUCCESS;
        }
        if (net_xmit_drop_count(ret))
@@ -214,8 +219,8 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt)
        sch_tree_lock(sch);
        q->bands = qopt->bands;
        for (i = q->bands; i < q->max_bands; i++) {
-               struct Qdisc *child = xchg(&q->queues[i], &noop_qdisc);
-               if (child != &noop_qdisc) {
+               if (q->queues[i] != &noop_qdisc) {
+                       struct Qdisc *child = xchg(&q->queues[i], &noop_qdisc);
                        qdisc_tree_decrease_qlen(child, child->q.qlen);
                        qdisc_destroy(child);
                }
@@ -250,7 +255,7 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt)
 static int multiq_init(struct Qdisc *sch, struct nlattr *opt)
 {
        struct multiq_sched_data *q = qdisc_priv(sch);
-       int i;
+       int i, err;
 
        q->queues = NULL;
 
@@ -265,7 +270,12 @@ static int multiq_init(struct Qdisc *sch, struct nlattr *opt)
        for (i = 0; i < q->max_bands; i++)
                q->queues[i] = &noop_qdisc;
 
-       return multiq_tune(sch, opt);
+       err = multiq_tune(sch,opt);
+
+       if (err)
+               kfree(q->queues);
+
+       return err;
 }
 
 static int multiq_dump(struct Qdisc *sch, struct sk_buff *skb)