[PKT_SCHED]: Restore TBF change semantic

When TBF was converted to a classful qdisc, the semantic of the limit
parameter was broken. On initilization an inner bfifo qdisc is created
for backwards compatibility, when changing parameters however the new
limit is ignored and the current child qdisc remains in place.

Always replace the child qdisc by the default bfifo when limit is above
zero, otherwise don't touch the inner qdisc. Current tc version enforce
a limit above zero, other users can avoid creating the inner qdisc by
using zero.

Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>

---
commit 56758971645ddbc93999707c0fdef89e9e55d44b
tree b7e34f96b9f3ee2ce2cf0477d4bd992e5baf149d
parent 3394462061e134f6f4e0d5d4910b63227d810ab7
author Patrick McHardy <[EMAIL PROTECTED]> Mon, 13 Feb 2006 21:04:01 +0100
committer Patrick McHardy <[EMAIL PROTECTED]> Mon, 13 Feb 2006 21:04:01 +0100

 net/sched/sch_tbf.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index e9e4734..d8e03c7 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -341,13 +341,14 @@ static int tbf_change(struct Qdisc* sch,
        if (max_size < 0)
                goto done;
 
-       if (q->qdisc == &noop_qdisc) {
+       if (qopt->limit > 0) {
                if ((child = tbf_create_dflt_qdisc(sch->dev, qopt->limit)) == 
NULL)
                        goto done;
        }
 
        sch_tree_lock(sch);
-       if (child) q->qdisc = child;
+       if (child)
+               qdisc_destroy(xchg(&q->qdisc, child));
        q->limit = qopt->limit;
        q->mtu = qopt->mtu;
        q->max_size = max_size;
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to