diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2013-12-15 20:15:07 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-18 12:52:07 -0500 |
commit | 5da57f422d89c504a1d72dadd4e19d3dca8e974e (patch) | |
tree | e67d0f6b9f50c60707a26c58b0937e6fd6eef22d /net/sched/cls_api.c | |
parent | 33be627159913b094bb578e83e9a7fdc66c10208 (diff) |
net_sched: cls: refactor out struct tcf_ext_map
These information can be saved in tcf_exts, and this will
simplify the code.
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_api.c')
-rw-r--r-- | net/sched/cls_api.c | 31 |
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) EXPORT_SYMBOL(tcf_exts_destroy); int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, - struct nlattr *rate_tlv, struct tcf_exts *exts, - const struct tcf_ext_map *map) + struct nlattr *rate_tlv, struct tcf_exts *exts) { - memset(exts, 0, sizeof(*exts)); - #ifdef CONFIG_NET_CLS_ACT { struct tc_action *act; INIT_LIST_HEAD(&exts->actions); - if (map->police && tb[map->police]) { - act = tcf_action_init_1(net, tb[map->police], rate_tlv, + if (exts->police && tb[exts->police]) { + act = tcf_action_init_1(net, tb[exts->police], rate_tlv, "police", TCA_ACT_NOREPLACE, TCA_ACT_BIND); if (IS_ERR(act)) @@ -526,9 +523,9 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, act->type = exts->type = TCA_OLD_COMPAT; list_add(&act->list, &exts->actions); - } else if (map->action && tb[map->action]) { + } else if (exts->action && tb[exts->action]) { int err; - err = tcf_action_init(net, tb[map->action], rate_tlv, + err = tcf_action_init(net, tb[exts->action], rate_tlv, NULL, TCA_ACT_NOREPLACE, TCA_ACT_BIND, &exts->actions); if (err) @@ -536,8 +533,8 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, } } #else - if ((map->action && tb[map->action]) || - (map->police && tb[map->police])) + if ((exts->action && tb[exts->action]) || + (exts->police && tb[exts->police])) return -EOPNOTSUPP; #endif @@ -564,11 +561,10 @@ EXPORT_SYMBOL(tcf_exts_change); #define tcf_exts_first_act(ext) \ list_first_entry(&(exts)->actions, struct tc_action, list) -int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts, - const struct tcf_ext_map *map) +int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts) { #ifdef CONFIG_NET_CLS_ACT - if (map->action && !list_empty(&exts->actions)) { + if (exts->action && !list_empty(&exts->actions)) { /* * again for backward compatible mode - we want * 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, */ struct nlattr *nest; if (exts->type != TCA_OLD_COMPAT) { - nest = nla_nest_start(skb, map->action); + nest = nla_nest_start(skb, exts->action); if (nest == NULL) goto nla_put_failure; if (tcf_action_dump(skb, &exts->actions, 0, 0) < 0) goto nla_put_failure; nla_nest_end(skb, nest); - } else if (map->police) { + } else if (exts->police) { struct tc_action *act = tcf_exts_first_act(exts); - nest = nla_nest_start(skb, map->police); + nest = nla_nest_start(skb, exts->police); if (nest == NULL) goto nla_put_failure; if (tcf_action_dump_old(skb, act, 0, 0) < 0) @@ -600,8 +596,7 @@ nla_put_failure: __attribute__ ((unused)) EXPORT_SYMBOL(tcf_exts_dump); -int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts, - const struct tcf_ext_map *map) +int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts) { #ifdef CONFIG_NET_CLS_ACT struct tc_action *a = tcf_exts_first_act(exts); |