diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2013-12-15 23:15:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-18 12:52:07 -0500 |
commit | 5da57f422d89c504a1d72dadd4e19d3dca8e974e (patch) | |
tree | e67d0f6b9f50c60707a26c58b0937e6fd6eef22d /net/sched/cls_u32.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_u32.c')
-rw-r--r-- | net/sched/cls_u32.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 492d9a6401ce..20f2fb79c747 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -79,11 +79,6 @@ struct tc_u_common { | |||
79 | u32 hgenerator; | 79 | u32 hgenerator; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | static const struct tcf_ext_map u32_ext_map = { | ||
83 | .action = TCA_U32_ACT, | ||
84 | .police = TCA_U32_POLICE | ||
85 | }; | ||
86 | |||
87 | static inline unsigned int u32_hash_fold(__be32 key, | 82 | static inline unsigned int u32_hash_fold(__be32 key, |
88 | const struct tc_u32_sel *sel, | 83 | const struct tc_u32_sel *sel, |
89 | u8 fshift) | 84 | u8 fshift) |
@@ -496,7 +491,8 @@ static int u32_set_parms(struct net *net, struct tcf_proto *tp, | |||
496 | int err; | 491 | int err; |
497 | struct tcf_exts e; | 492 | struct tcf_exts e; |
498 | 493 | ||
499 | err = tcf_exts_validate(net, tp, tb, est, &e, &u32_ext_map); | 494 | tcf_exts_init(&e, TCA_U32_ACT, TCA_U32_POLICE); |
495 | err = tcf_exts_validate(net, tp, tb, est, &e); | ||
500 | if (err < 0) | 496 | if (err < 0) |
501 | return err; | 497 | return err; |
502 | 498 | ||
@@ -646,7 +642,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, | |||
646 | n->ht_up = ht; | 642 | n->ht_up = ht; |
647 | n->handle = handle; | 643 | n->handle = handle; |
648 | n->fshift = s->hmask ? ffs(ntohl(s->hmask)) - 1 : 0; | 644 | n->fshift = s->hmask ? ffs(ntohl(s->hmask)) - 1 : 0; |
649 | tcf_exts_init(&n->exts); | 645 | tcf_exts_init(&n->exts, TCA_U32_ACT, TCA_U32_POLICE); |
650 | 646 | ||
651 | #ifdef CONFIG_CLS_U32_MARK | 647 | #ifdef CONFIG_CLS_U32_MARK |
652 | if (tb[TCA_U32_MARK]) { | 648 | if (tb[TCA_U32_MARK]) { |
@@ -760,7 +756,7 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh, | |||
760 | goto nla_put_failure; | 756 | goto nla_put_failure; |
761 | #endif | 757 | #endif |
762 | 758 | ||
763 | if (tcf_exts_dump(skb, &n->exts, &u32_ext_map) < 0) | 759 | if (tcf_exts_dump(skb, &n->exts) < 0) |
764 | goto nla_put_failure; | 760 | goto nla_put_failure; |
765 | 761 | ||
766 | #ifdef CONFIG_NET_CLS_IND | 762 | #ifdef CONFIG_NET_CLS_IND |
@@ -779,7 +775,7 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh, | |||
779 | nla_nest_end(skb, nest); | 775 | nla_nest_end(skb, nest); |
780 | 776 | ||
781 | if (TC_U32_KEY(n->handle)) | 777 | if (TC_U32_KEY(n->handle)) |
782 | if (tcf_exts_dump_stats(skb, &n->exts, &u32_ext_map) < 0) | 778 | if (tcf_exts_dump_stats(skb, &n->exts) < 0) |
783 | goto nla_put_failure; | 779 | goto nla_put_failure; |
784 | return skb->len; | 780 | return skb->len; |
785 | 781 | ||