aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/cls_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/cls_api.c')
-rw-r--r--net/sched/cls_api.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 3c056d73d394..028c980ef87d 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -507,18 +507,15 @@ void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts)
507EXPORT_SYMBOL(tcf_exts_destroy); 507EXPORT_SYMBOL(tcf_exts_destroy);
508 508
509int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, 509int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb,
510 struct nlattr *rate_tlv, struct tcf_exts *exts, 510 struct nlattr *rate_tlv, struct tcf_exts *exts)
511 const struct tcf_ext_map *map)
512{ 511{
513 memset(exts, 0, sizeof(*exts));
514
515#ifdef CONFIG_NET_CLS_ACT 512#ifdef CONFIG_NET_CLS_ACT
516 { 513 {
517 struct tc_action *act; 514 struct tc_action *act;
518 515
519 INIT_LIST_HEAD(&exts->actions); 516 INIT_LIST_HEAD(&exts->actions);
520 if (map->police && tb[map->police]) { 517 if (exts->police && tb[exts->police]) {
521 act = tcf_action_init_1(net, tb[map->police], rate_tlv, 518 act = tcf_action_init_1(net, tb[exts->police], rate_tlv,
522 "police", TCA_ACT_NOREPLACE, 519 "police", TCA_ACT_NOREPLACE,
523 TCA_ACT_BIND); 520 TCA_ACT_BIND);
524 if (IS_ERR(act)) 521 if (IS_ERR(act))
@@ -526,9 +523,9 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb,
526 523
527 act->type = exts->type = TCA_OLD_COMPAT; 524 act->type = exts->type = TCA_OLD_COMPAT;
528 list_add(&act->list, &exts->actions); 525 list_add(&act->list, &exts->actions);
529 } else if (map->action && tb[map->action]) { 526 } else if (exts->action && tb[exts->action]) {
530 int err; 527 int err;
531 err = tcf_action_init(net, tb[map->action], rate_tlv, 528 err = tcf_action_init(net, tb[exts->action], rate_tlv,
532 NULL, TCA_ACT_NOREPLACE, 529 NULL, TCA_ACT_NOREPLACE,
533 TCA_ACT_BIND, &exts->actions); 530 TCA_ACT_BIND, &exts->actions);
534 if (err) 531 if (err)
@@ -536,8 +533,8 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb,
536 } 533 }
537 } 534 }
538#else 535#else
539 if ((map->action && tb[map->action]) || 536 if ((exts->action && tb[exts->action]) ||
540 (map->police && tb[map->police])) 537 (exts->police && tb[exts->police]))
541 return -EOPNOTSUPP; 538 return -EOPNOTSUPP;
542#endif 539#endif
543 540
@@ -564,11 +561,10 @@ EXPORT_SYMBOL(tcf_exts_change);
564#define tcf_exts_first_act(ext) \ 561#define tcf_exts_first_act(ext) \
565 list_first_entry(&(exts)->actions, struct tc_action, list) 562 list_first_entry(&(exts)->actions, struct tc_action, list)
566 563
567int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts, 564int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts)
568 const struct tcf_ext_map *map)
569{ 565{
570#ifdef CONFIG_NET_CLS_ACT 566#ifdef CONFIG_NET_CLS_ACT
571 if (map->action && !list_empty(&exts->actions)) { 567 if (exts->action && !list_empty(&exts->actions)) {
572 /* 568 /*
573 * again for backward compatible mode - we want 569 * again for backward compatible mode - we want
574 * to work with both old and new modes of entering 570 * to work with both old and new modes of entering
@@ -576,15 +572,15 @@ int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts,
576 */ 572 */
577 struct nlattr *nest; 573 struct nlattr *nest;
578 if (exts->type != TCA_OLD_COMPAT) { 574 if (exts->type != TCA_OLD_COMPAT) {
579 nest = nla_nest_start(skb, map->action); 575 nest = nla_nest_start(skb, exts->action);
580 if (nest == NULL) 576 if (nest == NULL)
581 goto nla_put_failure; 577 goto nla_put_failure;
582 if (tcf_action_dump(skb, &exts->actions, 0, 0) < 0) 578 if (tcf_action_dump(skb, &exts->actions, 0, 0) < 0)
583 goto nla_put_failure; 579 goto nla_put_failure;
584 nla_nest_end(skb, nest); 580 nla_nest_end(skb, nest);
585 } else if (map->police) { 581 } else if (exts->police) {
586 struct tc_action *act = tcf_exts_first_act(exts); 582 struct tc_action *act = tcf_exts_first_act(exts);
587 nest = nla_nest_start(skb, map->police); 583 nest = nla_nest_start(skb, exts->police);
588 if (nest == NULL) 584 if (nest == NULL)
589 goto nla_put_failure; 585 goto nla_put_failure;
590 if (tcf_action_dump_old(skb, act, 0, 0) < 0) 586 if (tcf_action_dump_old(skb, act, 0, 0) < 0)
@@ -600,8 +596,7 @@ nla_put_failure: __attribute__ ((unused))
600EXPORT_SYMBOL(tcf_exts_dump); 596EXPORT_SYMBOL(tcf_exts_dump);
601 597
602 598
603int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts, 599int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts)
604 const struct tcf_ext_map *map)
605{ 600{
606#ifdef CONFIG_NET_CLS_ACT 601#ifdef CONFIG_NET_CLS_ACT
607 struct tc_action *a = tcf_exts_first_act(exts); 602 struct tc_action *a = tcf_exts_first_act(exts);