]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
tbf: stop wanton destruction of children (v2)
authorstephen hemminger <shemminger@vyatta.com>
Fri, 14 May 2010 14:38:59 +0000 (14:38 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 May 2010 00:44:35 +0000 (17:44 -0700)
Several netem users use TBF for rate control. But every time the parameters
of TBF are changed it destroys the child qdisc, requiring reconfigation.
Better to just keep child qdisc and just notify it of changed limit.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_tbf.c

index 8fb8107ab18847402b94278ee420f9623ed40b8c..0991c640cd3e8f3e5ae836c44b16b9e27f743c7e 100644 (file)
@@ -273,7 +273,11 @@ static int tbf_change(struct Qdisc* sch, struct nlattr *opt)
        if (max_size < 0)
                goto done;
 
-       if (qopt->limit > 0) {
+       if (q->qdisc != &noop_qdisc) {
+               err = fifo_set_limit(q->qdisc, qopt->limit);
+               if (err)
+                       goto done;
+       } else if (qopt->limit > 0) {
                child = fifo_create_dflt(sch, &bfifo_qdisc_ops, qopt->limit);
                if (IS_ERR(child)) {
                        err = PTR_ERR(child);