diff options
-rw-r--r-- | 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 index 1ef482ba6b36..b9a069af4a02 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -454,15 +454,27 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp) | |||
454 | sch->handle = handle; | 454 | sch->handle = handle; |
455 | 455 | ||
456 | if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS-1])) == 0) { | 456 | if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS-1])) == 0) { |
457 | #ifdef CONFIG_NET_ESTIMATOR | ||
458 | if (tca[TCA_RATE-1]) { | ||
459 | err = gen_new_estimator(&sch->bstats, &sch->rate_est, | ||
460 | sch->stats_lock, | ||
461 | tca[TCA_RATE-1]); | ||
462 | if (err) { | ||
463 | /* | ||
464 | * Any broken qdiscs that would require | ||
465 | * a ops->reset() here? The qdisc was never | ||
466 | * in action so it shouldn't be necessary. | ||
467 | */ | ||
468 | if (ops->destroy) | ||
469 | ops->destroy(sch); | ||
470 | goto err_out3; | ||
471 | } | ||
472 | } | ||
473 | #endif | ||
457 | qdisc_lock_tree(dev); | 474 | qdisc_lock_tree(dev); |
458 | list_add_tail(&sch->list, &dev->qdisc_list); | 475 | list_add_tail(&sch->list, &dev->qdisc_list); |
459 | qdisc_unlock_tree(dev); | 476 | qdisc_unlock_tree(dev); |
460 | 477 | ||
461 | #ifdef CONFIG_NET_ESTIMATOR | ||
462 | if (tca[TCA_RATE-1]) | ||
463 | gen_new_estimator(&sch->bstats, &sch->rate_est, | ||
464 | sch->stats_lock, tca[TCA_RATE-1]); | ||
465 | #endif | ||
466 | return sch; | 478 | return sch; |
467 | } | 479 | } |
468 | err_out3: | 480 | err_out3: |