linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / net / sched / sch_tbf.c
index d9a5d29..cb9711e 100644 (file)
@@ -12,6 +12,7 @@
  *
  */
 
+#include <linux/config.h>
 #include <linux/module.h>
 #include <asm/uaccess.h>
 #include <asm/system.h>
@@ -176,9 +177,9 @@ static int tbf_requeue(struct sk_buff *skb, struct Qdisc* sch)
 static unsigned int tbf_drop(struct Qdisc* sch)
 {
        struct tbf_sched_data *q = qdisc_priv(sch);
-       unsigned int len = 0;
+       unsigned int len;
 
-       if (q->qdisc->ops->drop && (len = q->qdisc->ops->drop(q->qdisc)) != 0) {
+       if ((len = q->qdisc->ops->drop(q->qdisc)) != 0) {
                sch->q.qlen--;
                sch->qstats.drops++;
        }
@@ -340,14 +341,13 @@ static int tbf_change(struct Qdisc* sch, struct rtattr *opt)
        if (max_size < 0)
                goto done;
 
-       if (qopt->limit > 0) {
+       if (q->qdisc == &noop_qdisc) {
                if ((child = tbf_create_dflt_qdisc(sch->dev, qopt->limit)) == NULL)
                        goto done;
        }
 
        sch_tree_lock(sch);
-       if (child)
-               qdisc_destroy(xchg(&q->qdisc, child));
+       if (child) q->qdisc = child;
        q->limit = qopt->limit;
        q->mtu = qopt->mtu;
        q->max_size = max_size;