aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_tbf.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/sch_tbf.c')
-rw-r--r--net/sched/sch_tbf.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index cb9711ea8c6c..d8e03c74ca76 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -177,9 +177,9 @@ static int tbf_requeue(struct sk_buff *skb, struct Qdisc* sch)
177static unsigned int tbf_drop(struct Qdisc* sch) 177static unsigned int tbf_drop(struct Qdisc* sch)
178{ 178{
179 struct tbf_sched_data *q = qdisc_priv(sch); 179 struct tbf_sched_data *q = qdisc_priv(sch);
180 unsigned int len; 180 unsigned int len = 0;
181 181
182 if ((len = q->qdisc->ops->drop(q->qdisc)) != 0) { 182 if (q->qdisc->ops->drop && (len = q->qdisc->ops->drop(q->qdisc)) != 0) {
183 sch->q.qlen--; 183 sch->q.qlen--;
184 sch->qstats.drops++; 184 sch->qstats.drops++;
185 } 185 }
@@ -341,13 +341,14 @@ static int tbf_change(struct Qdisc* sch, struct rtattr *opt)
341 if (max_size < 0) 341 if (max_size < 0)
342 goto done; 342 goto done;
343 343
344 if (q->qdisc == &noop_qdisc) { 344 if (qopt->limit > 0) {
345 if ((child = tbf_create_dflt_qdisc(sch->dev, qopt->limit)) == NULL) 345 if ((child = tbf_create_dflt_qdisc(sch->dev, qopt->limit)) == NULL)
346 goto done; 346 goto done;
347 } 347 }
348 348
349 sch_tree_lock(sch); 349 sch_tree_lock(sch);
350 if (child) q->qdisc = child; 350 if (child)
351 qdisc_destroy(xchg(&q->qdisc, child));
351 q->limit = qopt->limit; 352 q->limit = qopt->limit;
352 q->mtu = qopt->mtu; 353 q->mtu = qopt->mtu;
353 q->max_size = max_size; 354 q->max_size = max_size;