tree 6f14e606ae491eaf143be225513433803ed6dfc0
parent 3d54b82fdf0ca79608f61448fb8ab92676487645
author Thomas Graf <[EMAIL PROTECTED]> Wed, 06 Jul 2005 04:15:53 -0700
committer David S. Miller <[EMAIL PROTECTED]> Wed, 06 Jul 2005 04:15:53 -0700

[PKT_SCHED]: Report rate estimator configuration errors during qdisc allocation

Current behaviour is to not report an error if a rate
estimator is created together with a qdisc and the
configuration of the rate estimator is bogus. This leads
to unexpected behaviour because the user is not notified.

New behaviour is to report the error and let the whole
qdisc creation operation fail so the user is able to fix
his mistake.

Signed-off-by: Thomas Graf <[EMAIL PROTECTED]>
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>

 net/sched/sch_api.c |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -454,15 +454,27 @@ qdisc_create(struct net_device *dev, u32
        sch->handle = handle;
 
        if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS-1])) == 0) {
+#ifdef CONFIG_NET_ESTIMATOR
+               if (tca[TCA_RATE-1]) {
+                       err = gen_new_estimator(&sch->bstats, &sch->rate_est,
+                                               sch->stats_lock,
+                                               tca[TCA_RATE-1]);
+                       if (err) {
+                               /*
+                                * Any broken qdiscs that would require
+                                * a ops->reset() here? The qdisc was never
+                                * in action so it shouldn't be necessary.
+                                */
+                               if (ops->destroy)
+                                       ops->destroy(sch);
+                               goto err_out3;
+                       }
+               }
+#endif
                qdisc_lock_tree(dev);
                list_add_tail(&sch->list, &dev->qdisc_list);
                qdisc_unlock_tree(dev);
 
-#ifdef CONFIG_NET_ESTIMATOR
-               if (tca[TCA_RATE-1])
-                       gen_new_estimator(&sch->bstats, &sch->rate_est,
-                               sch->stats_lock, tca[TCA_RATE-1]);
-#endif
                return sch;
        }
 err_out3:
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to