aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_cbq.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/sch_cbq.c')
-rw-r--r--net/sched/sch_cbq.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 3a9569a3396c..9e43ed949167 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -1765,11 +1765,23 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
1765 } 1765 }
1766 1766
1767 if (tb[TCA_CBQ_RATE]) { 1767 if (tb[TCA_CBQ_RATE]) {
1768 rtab = qdisc_get_rtab(nla_data(tb[TCA_CBQ_RATE]), tb[TCA_CBQ_RTAB]); 1768 rtab = qdisc_get_rtab(nla_data(tb[TCA_CBQ_RATE]),
1769 tb[TCA_CBQ_RTAB]);
1769 if (rtab == NULL) 1770 if (rtab == NULL)
1770 return -EINVAL; 1771 return -EINVAL;
1771 } 1772 }
1772 1773
1774 if (tca[TCA_RATE]) {
1775 err = gen_replace_estimator(&cl->bstats, &cl->rate_est,
1776 qdisc_root_sleeping_lock(sch),
1777 tca[TCA_RATE]);
1778 if (err) {
1779 if (rtab)
1780 qdisc_put_rtab(rtab);
1781 return err;
1782 }
1783 }
1784
1773 /* Change class parameters */ 1785 /* Change class parameters */
1774 sch_tree_lock(sch); 1786 sch_tree_lock(sch);
1775 1787
@@ -1805,10 +1817,6 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
1805 1817
1806 sch_tree_unlock(sch); 1818 sch_tree_unlock(sch);
1807 1819
1808 if (tca[TCA_RATE])
1809 gen_replace_estimator(&cl->bstats, &cl->rate_est,
1810 qdisc_root_sleeping_lock(sch),
1811 tca[TCA_RATE]);
1812 return 0; 1820 return 0;
1813 } 1821 }
1814 1822
@@ -1855,6 +1863,17 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
1855 cl = kzalloc(sizeof(*cl), GFP_KERNEL); 1863 cl = kzalloc(sizeof(*cl), GFP_KERNEL);
1856 if (cl == NULL) 1864 if (cl == NULL)
1857 goto failure; 1865 goto failure;
1866
1867 if (tca[TCA_RATE]) {
1868 err = gen_new_estimator(&cl->bstats, &cl->rate_est,
1869 qdisc_root_sleeping_lock(sch),
1870 tca[TCA_RATE]);
1871 if (err) {
1872 kfree(cl);
1873 goto failure;
1874 }
1875 }
1876
1858 cl->R_tab = rtab; 1877 cl->R_tab = rtab;
1859 rtab = NULL; 1878 rtab = NULL;
1860 cl->refcnt = 1; 1879 cl->refcnt = 1;
@@ -1896,10 +1915,6 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
1896 1915
1897 qdisc_class_hash_grow(sch, &q->clhash); 1916 qdisc_class_hash_grow(sch, &q->clhash);
1898 1917
1899 if (tca[TCA_RATE])
1900 gen_new_estimator(&cl->bstats, &cl->rate_est,
1901 qdisc_root_sleeping_lock(sch), tca[TCA_RATE]);
1902
1903 *arg = (unsigned long)cl; 1918 *arg = (unsigned long)cl;
1904 return 0; 1919 return 0;
1905 1920