diff options
Diffstat (limited to 'net/sched/sch_red.c')
-rw-r--r-- | net/sched/sch_red.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index d65cadddea69..acddad08850f 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c | |||
@@ -175,12 +175,14 @@ static void red_destroy(struct Qdisc *sch) | |||
175 | qdisc_destroy(q->qdisc); | 175 | qdisc_destroy(q->qdisc); |
176 | } | 176 | } |
177 | 177 | ||
178 | static struct Qdisc *red_create_dflt(struct net_device *dev, u32 limit) | 178 | static struct Qdisc *red_create_dflt(struct Qdisc *sch, u32 limit) |
179 | { | 179 | { |
180 | struct Qdisc *q = qdisc_create_dflt(dev, &bfifo_qdisc_ops); | 180 | struct Qdisc *q; |
181 | struct rtattr *rta; | 181 | struct rtattr *rta; |
182 | int ret; | 182 | int ret; |
183 | 183 | ||
184 | q = qdisc_create_dflt(sch->dev, &bfifo_qdisc_ops, | ||
185 | TC_H_MAKE(sch->handle, 1)); | ||
184 | if (q) { | 186 | if (q) { |
185 | rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), | 187 | rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), |
186 | GFP_KERNEL); | 188 | GFP_KERNEL); |
@@ -219,7 +221,7 @@ static int red_change(struct Qdisc *sch, struct rtattr *opt) | |||
219 | ctl = RTA_DATA(tb[TCA_RED_PARMS-1]); | 221 | ctl = RTA_DATA(tb[TCA_RED_PARMS-1]); |
220 | 222 | ||
221 | if (ctl->limit > 0) { | 223 | if (ctl->limit > 0) { |
222 | child = red_create_dflt(sch->dev, ctl->limit); | 224 | child = red_create_dflt(sch, ctl->limit); |
223 | if (child == NULL) | 225 | if (child == NULL) |
224 | return -ENOMEM; | 226 | return -ENOMEM; |
225 | } | 227 | } |
@@ -227,8 +229,10 @@ static int red_change(struct Qdisc *sch, struct rtattr *opt) | |||
227 | sch_tree_lock(sch); | 229 | sch_tree_lock(sch); |
228 | q->flags = ctl->flags; | 230 | q->flags = ctl->flags; |
229 | q->limit = ctl->limit; | 231 | q->limit = ctl->limit; |
230 | if (child) | 232 | if (child) { |
233 | qdisc_tree_decrease_qlen(q->qdisc, q->qdisc->q.qlen); | ||
231 | qdisc_destroy(xchg(&q->qdisc, child)); | 234 | qdisc_destroy(xchg(&q->qdisc, child)); |
235 | } | ||
232 | 236 | ||
233 | red_set_parms(&q->parms, ctl->qth_min, ctl->qth_max, ctl->Wlog, | 237 | red_set_parms(&q->parms, ctl->qth_min, ctl->qth_max, ctl->Wlog, |
234 | ctl->Plog, ctl->Scell_log, | 238 | ctl->Plog, ctl->Scell_log, |
@@ -306,8 +310,8 @@ static int red_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, | |||
306 | 310 | ||
307 | sch_tree_lock(sch); | 311 | sch_tree_lock(sch); |
308 | *old = xchg(&q->qdisc, new); | 312 | *old = xchg(&q->qdisc, new); |
313 | qdisc_tree_decrease_qlen(*old, (*old)->q.qlen); | ||
309 | qdisc_reset(*old); | 314 | qdisc_reset(*old); |
310 | sch->q.qlen = 0; | ||
311 | sch_tree_unlock(sch); | 315 | sch_tree_unlock(sch); |
312 | return 0; | 316 | return 0; |
313 | } | 317 | } |