aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/sched/sch_cbq.c38
-rw-r--r--net/sched/sch_hfsc.c4
-rw-r--r--net/sched/sch_htb.c35
-rw-r--r--net/sched/sch_multiq.c11
-rw-r--r--net/sched/sch_prio.c11
-rw-r--r--net/sched/sch_red.c2
-rw-r--r--net/sched/sch_tbf.c3
7 files changed, 37 insertions, 67 deletions
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index d5798e17a832..5b132c473264 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -1621,29 +1621,25 @@ static int cbq_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
1621{ 1621{
1622 struct cbq_class *cl = (struct cbq_class*)arg; 1622 struct cbq_class *cl = (struct cbq_class*)arg;
1623 1623
1624 if (cl) { 1624 if (new == NULL) {
1625 if (new == NULL) { 1625 new = qdisc_create_dflt(qdisc_dev(sch), sch->dev_queue,
1626 new = qdisc_create_dflt(qdisc_dev(sch), sch->dev_queue, 1626 &pfifo_qdisc_ops, cl->common.classid);
1627 &pfifo_qdisc_ops, 1627 if (new == NULL)
1628 cl->common.classid); 1628 return -ENOBUFS;
1629 if (new == NULL) 1629 } else {
1630 return -ENOBUFS;
1631 } else {
1632#ifdef CONFIG_NET_CLS_ACT 1630#ifdef CONFIG_NET_CLS_ACT
1633 if (cl->police == TC_POLICE_RECLASSIFY) 1631 if (cl->police == TC_POLICE_RECLASSIFY)
1634 new->reshape_fail = cbq_reshape_fail; 1632 new->reshape_fail = cbq_reshape_fail;
1635#endif 1633#endif
1636 }
1637 sch_tree_lock(sch);
1638 *old = cl->q;
1639 cl->q = new;
1640 qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
1641 qdisc_reset(*old);
1642 sch_tree_unlock(sch);
1643
1644 return 0;
1645 } 1634 }
1646 return -ENOENT; 1635 sch_tree_lock(sch);
1636 *old = cl->q;
1637 cl->q = new;
1638 qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
1639 qdisc_reset(*old);
1640 sch_tree_unlock(sch);
1641
1642 return 0;
1647} 1643}
1648 1644
1649static struct Qdisc * 1645static struct Qdisc *
@@ -1651,7 +1647,7 @@ cbq_leaf(struct Qdisc *sch, unsigned long arg)
1651{ 1647{
1652 struct cbq_class *cl = (struct cbq_class*)arg; 1648 struct cbq_class *cl = (struct cbq_class*)arg;
1653 1649
1654 return cl ? cl->q : NULL; 1650 return cl->q;
1655} 1651}
1656 1652
1657static void cbq_qlen_notify(struct Qdisc *sch, unsigned long arg) 1653static void cbq_qlen_notify(struct Qdisc *sch, unsigned long arg)
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index dad0144423da..375d64cb1a3d 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1203,8 +1203,6 @@ hfsc_graft_class(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
1203{ 1203{
1204 struct hfsc_class *cl = (struct hfsc_class *)arg; 1204 struct hfsc_class *cl = (struct hfsc_class *)arg;
1205 1205
1206 if (cl == NULL)
1207 return -ENOENT;
1208 if (cl->level > 0) 1206 if (cl->level > 0)
1209 return -EINVAL; 1207 return -EINVAL;
1210 if (new == NULL) { 1208 if (new == NULL) {
@@ -1228,7 +1226,7 @@ hfsc_class_leaf(struct Qdisc *sch, unsigned long arg)
1228{ 1226{
1229 struct hfsc_class *cl = (struct hfsc_class *)arg; 1227 struct hfsc_class *cl = (struct hfsc_class *)arg;
1230 1228
1231 if (cl != NULL && cl->level == 0) 1229 if (cl->level == 0)
1232 return cl->qdisc; 1230 return cl->qdisc;
1233 1231
1234 return NULL; 1232 return NULL;
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index ec4d46399d59..85acab9dc6fd 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1117,30 +1117,29 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
1117{ 1117{
1118 struct htb_class *cl = (struct htb_class *)arg; 1118 struct htb_class *cl = (struct htb_class *)arg;
1119 1119
1120 if (cl && !cl->level) { 1120 if (cl->level)
1121 if (new == NULL && 1121 return -EINVAL;
1122 (new = qdisc_create_dflt(qdisc_dev(sch), sch->dev_queue, 1122 if (new == NULL &&
1123 &pfifo_qdisc_ops, 1123 (new = qdisc_create_dflt(qdisc_dev(sch), sch->dev_queue,
1124 cl->common.classid)) 1124 &pfifo_qdisc_ops,
1125 == NULL) 1125 cl->common.classid)) == NULL)
1126 return -ENOBUFS; 1126 return -ENOBUFS;
1127 sch_tree_lock(sch); 1127
1128 *old = cl->un.leaf.q; 1128 sch_tree_lock(sch);
1129 cl->un.leaf.q = new; 1129 *old = cl->un.leaf.q;
1130 if (*old != NULL) { 1130 cl->un.leaf.q = new;
1131 qdisc_tree_decrease_qlen(*old, (*old)->q.qlen); 1131 if (*old != NULL) {
1132 qdisc_reset(*old); 1132 qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
1133 } 1133 qdisc_reset(*old);
1134 sch_tree_unlock(sch);
1135 return 0;
1136 } 1134 }
1137 return -ENOENT; 1135 sch_tree_unlock(sch);
1136 return 0;
1138} 1137}
1139 1138
1140static struct Qdisc *htb_leaf(struct Qdisc *sch, unsigned long arg) 1139static struct Qdisc *htb_leaf(struct Qdisc *sch, unsigned long arg)
1141{ 1140{
1142 struct htb_class *cl = (struct htb_class *)arg; 1141 struct htb_class *cl = (struct htb_class *)arg;
1143 return (cl && !cl->level) ? cl->un.leaf.q : NULL; 1142 return !cl->level ? cl->un.leaf.q : NULL;
1144} 1143}
1145 1144
1146static void htb_qlen_notify(struct Qdisc *sch, unsigned long arg) 1145static void htb_qlen_notify(struct Qdisc *sch, unsigned long arg)
diff --git a/net/sched/sch_multiq.c b/net/sched/sch_multiq.c
index a0ffe7158ff3..069f81c97277 100644
--- a/net/sched/sch_multiq.c
+++ b/net/sched/sch_multiq.c
@@ -298,9 +298,6 @@ static int multiq_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
298 struct multiq_sched_data *q = qdisc_priv(sch); 298 struct multiq_sched_data *q = qdisc_priv(sch);
299 unsigned long band = arg - 1; 299 unsigned long band = arg - 1;
300 300
301 if (band >= q->bands)
302 return -EINVAL;
303
304 if (new == NULL) 301 if (new == NULL)
305 new = &noop_qdisc; 302 new = &noop_qdisc;
306 303
@@ -320,9 +317,6 @@ multiq_leaf(struct Qdisc *sch, unsigned long arg)
320 struct multiq_sched_data *q = qdisc_priv(sch); 317 struct multiq_sched_data *q = qdisc_priv(sch);
321 unsigned long band = arg - 1; 318 unsigned long band = arg - 1;
322 319
323 if (band >= q->bands)
324 return NULL;
325
326 return q->queues[band]; 320 return q->queues[band];
327} 321}
328 322
@@ -353,11 +347,8 @@ static int multiq_dump_class(struct Qdisc *sch, unsigned long cl,
353{ 347{
354 struct multiq_sched_data *q = qdisc_priv(sch); 348 struct multiq_sched_data *q = qdisc_priv(sch);
355 349
356 if (cl - 1 > q->bands)
357 return -ENOENT;
358 tcm->tcm_handle |= TC_H_MIN(cl); 350 tcm->tcm_handle |= TC_H_MIN(cl);
359 if (q->queues[cl-1]) 351 tcm->tcm_info = q->queues[cl-1]->handle;
360 tcm->tcm_info = q->queues[cl-1]->handle;
361 return 0; 352 return 0;
362} 353}
363 354
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index 209a4ca4b98d..0f73c412d04b 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -262,9 +262,6 @@ static int prio_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
262 struct prio_sched_data *q = qdisc_priv(sch); 262 struct prio_sched_data *q = qdisc_priv(sch);
263 unsigned long band = arg - 1; 263 unsigned long band = arg - 1;
264 264
265 if (band >= q->bands)
266 return -EINVAL;
267
268 if (new == NULL) 265 if (new == NULL)
269 new = &noop_qdisc; 266 new = &noop_qdisc;
270 267
@@ -284,9 +281,6 @@ prio_leaf(struct Qdisc *sch, unsigned long arg)
284 struct prio_sched_data *q = qdisc_priv(sch); 281 struct prio_sched_data *q = qdisc_priv(sch);
285 unsigned long band = arg - 1; 282 unsigned long band = arg - 1;
286 283
287 if (band >= q->bands)
288 return NULL;
289
290 return q->queues[band]; 284 return q->queues[band];
291} 285}
292 286
@@ -316,11 +310,8 @@ static int prio_dump_class(struct Qdisc *sch, unsigned long cl, struct sk_buff *
316{ 310{
317 struct prio_sched_data *q = qdisc_priv(sch); 311 struct prio_sched_data *q = qdisc_priv(sch);
318 312
319 if (cl - 1 > q->bands)
320 return -ENOENT;
321 tcm->tcm_handle |= TC_H_MIN(cl); 313 tcm->tcm_handle |= TC_H_MIN(cl);
322 if (q->queues[cl-1]) 314 tcm->tcm_info = q->queues[cl-1]->handle;
323 tcm->tcm_info = q->queues[cl-1]->handle;
324 return 0; 315 return 0;
325} 316}
326 317
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index a2c4d1aa3cb1..072cdf442f8e 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -268,8 +268,6 @@ static int red_dump_class(struct Qdisc *sch, unsigned long cl,
268{ 268{
269 struct red_sched_data *q = qdisc_priv(sch); 269 struct red_sched_data *q = qdisc_priv(sch);
270 270
271 if (cl != 1)
272 return -ENOENT;
273 tcm->tcm_handle |= TC_H_MIN(1); 271 tcm->tcm_handle |= TC_H_MIN(1);
274 tcm->tcm_info = q->qdisc->handle; 272 tcm->tcm_info = q->qdisc->handle;
275 return 0; 273 return 0;
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index d904167e73b3..8fb8107ab188 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -368,9 +368,6 @@ static int tbf_dump_class(struct Qdisc *sch, unsigned long cl,
368{ 368{
369 struct tbf_sched_data *q = qdisc_priv(sch); 369 struct tbf_sched_data *q = qdisc_priv(sch);
370 370
371 if (cl != 1) /* only one class */
372 return -ENOENT;
373
374 tcm->tcm_handle |= TC_H_MIN(1); 371 tcm->tcm_handle |= TC_H_MIN(1);
375 tcm->tcm_info = q->qdisc->handle; 372 tcm->tcm_info = q->qdisc->handle;
376 373