aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2009-09-04 02:41:15 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-06 05:06:12 -0400
commit71ebe5e91947392bc276af713827eab12b6db8e4 (patch)
tree198ff02e23f8606ff2a3bec51c7044ec408e19c4 /net
parentc9f1d0389b962521af1e2b699c8ee5e299d77b85 (diff)
net_sched: make cls_ops->tcf_chain() optional
Some qdiscs don't support attaching filters. Handle this centrally in cls_api and return a proper errno code (EOPNOTSUPP) instead of EINVAL. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/sched/cls_api.c5
-rw-r--r--net/sched/sch_red.c6
-rw-r--r--net/sched/sch_tbf.c6
3 files changed, 5 insertions, 12 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 09cdcdfe7e91..bcfbdb4758c9 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -181,6 +181,9 @@ replay:
181 if ((cops = q->ops->cl_ops) == NULL) 181 if ((cops = q->ops->cl_ops) == NULL)
182 return -EINVAL; 182 return -EINVAL;
183 183
184 if (cops->tcf_chain == NULL)
185 return -EOPNOTSUPP;
186
184 /* Do we search for filter, attached to class? */ 187 /* Do we search for filter, attached to class? */
185 if (TC_H_MIN(parent)) { 188 if (TC_H_MIN(parent)) {
186 cl = cops->get(q, parent); 189 cl = cops->get(q, parent);
@@ -433,6 +436,8 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
433 goto out; 436 goto out;
434 if ((cops = q->ops->cl_ops) == NULL) 437 if ((cops = q->ops->cl_ops) == NULL)
435 goto errout; 438 goto errout;
439 if (cops->tcf_chain == NULL)
440 goto errout;
436 if (TC_H_MIN(tcm->tcm_parent)) { 441 if (TC_H_MIN(tcm->tcm_parent)) {
437 cl = cops->get(q, tcm->tcm_parent); 442 cl = cops->get(q, tcm->tcm_parent);
438 if (cl == 0) 443 if (cl == 0)
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index 2bdf241f6315..c27b8023f079 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -331,11 +331,6 @@ static void red_walk(struct Qdisc *sch, struct qdisc_walker *walker)
331 } 331 }
332} 332}
333 333
334static struct tcf_proto **red_find_tcf(struct Qdisc *sch, unsigned long cl)
335{
336 return NULL;
337}
338
339static const struct Qdisc_class_ops red_class_ops = { 334static const struct Qdisc_class_ops red_class_ops = {
340 .graft = red_graft, 335 .graft = red_graft,
341 .leaf = red_leaf, 336 .leaf = red_leaf,
@@ -344,7 +339,6 @@ static const struct Qdisc_class_ops red_class_ops = {
344 .change = red_change_class, 339 .change = red_change_class,
345 .delete = red_delete, 340 .delete = red_delete,
346 .walk = red_walk, 341 .walk = red_walk,
347 .tcf_chain = red_find_tcf,
348 .dump = red_dump_class, 342 .dump = red_dump_class,
349}; 343};
350 344
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index e22dfe85e43e..28909699d24d 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -433,11 +433,6 @@ static void tbf_walk(struct Qdisc *sch, struct qdisc_walker *walker)
433 } 433 }
434} 434}
435 435
436static struct tcf_proto **tbf_find_tcf(struct Qdisc *sch, unsigned long cl)
437{
438 return NULL;
439}
440
441static const struct Qdisc_class_ops tbf_class_ops = 436static const struct Qdisc_class_ops tbf_class_ops =
442{ 437{
443 .graft = tbf_graft, 438 .graft = tbf_graft,
@@ -447,7 +442,6 @@ static const struct Qdisc_class_ops tbf_class_ops =
447 .change = tbf_change_class, 442 .change = tbf_change_class,
448 .delete = tbf_delete, 443 .delete = tbf_delete,
449 .walk = tbf_walk, 444 .walk = tbf_walk,
450 .tcf_chain = tbf_find_tcf,
451 .dump = tbf_dump_class, 445 .dump = tbf_dump_class,
452}; 446};
453 447