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_tcindex.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_tcindex.c')
-rw-r--r-- | net/sched/cls_tcindex.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index c39bbfc0300a..ffad18791c93 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c | |||
@@ -50,11 +50,6 @@ struct tcindex_data { | |||
50 | int fall_through; /* 0: only classify if explicit match */ | 50 | int fall_through; /* 0: only classify if explicit match */ |
51 | }; | 51 | }; |
52 | 52 | ||
53 | static const struct tcf_ext_map tcindex_ext_map = { | ||
54 | .police = TCA_TCINDEX_POLICE, | ||
55 | .action = TCA_TCINDEX_ACT | ||
56 | }; | ||
57 | |||
58 | static inline int | 53 | static inline int |
59 | tcindex_filter_is_set(struct tcindex_filter_result *r) | 54 | tcindex_filter_is_set(struct tcindex_filter_result *r) |
60 | { | 55 | { |
@@ -209,19 +204,20 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base, | |||
209 | struct tcindex_filter *f = NULL; /* make gcc behave */ | 204 | struct tcindex_filter *f = NULL; /* make gcc behave */ |
210 | struct tcf_exts e; | 205 | struct tcf_exts e; |
211 | 206 | ||
212 | err = tcf_exts_validate(net, tp, tb, est, &e, &tcindex_ext_map); | 207 | tcf_exts_init(&e, TCA_TCINDEX_ACT, TCA_TCINDEX_POLICE); |
208 | err = tcf_exts_validate(net, tp, tb, est, &e); | ||
213 | if (err < 0) | 209 | if (err < 0) |
214 | return err; | 210 | return err; |
215 | 211 | ||
216 | memcpy(&cp, p, sizeof(cp)); | 212 | memcpy(&cp, p, sizeof(cp)); |
217 | memset(&new_filter_result, 0, sizeof(new_filter_result)); | 213 | memset(&new_filter_result, 0, sizeof(new_filter_result)); |
218 | tcf_exts_init(&new_filter_result.exts); | 214 | tcf_exts_init(&new_filter_result.exts, TCA_TCINDEX_ACT, TCA_TCINDEX_POLICE); |
219 | 215 | ||
220 | if (old_r) | 216 | if (old_r) |
221 | memcpy(&cr, r, sizeof(cr)); | 217 | memcpy(&cr, r, sizeof(cr)); |
222 | else { | 218 | else { |
223 | memset(&cr, 0, sizeof(cr)); | 219 | memset(&cr, 0, sizeof(cr)); |
224 | tcf_exts_init(&cr.exts); | 220 | tcf_exts_init(&cr.exts, TCA_TCINDEX_ACT, TCA_TCINDEX_POLICE); |
225 | } | 221 | } |
226 | 222 | ||
227 | if (tb[TCA_TCINDEX_HASH]) | 223 | if (tb[TCA_TCINDEX_HASH]) |
@@ -471,11 +467,11 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh, | |||
471 | nla_put_u32(skb, TCA_TCINDEX_CLASSID, r->res.classid)) | 467 | nla_put_u32(skb, TCA_TCINDEX_CLASSID, r->res.classid)) |
472 | goto nla_put_failure; | 468 | goto nla_put_failure; |
473 | 469 | ||
474 | if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0) | 470 | if (tcf_exts_dump(skb, &r->exts) < 0) |
475 | goto nla_put_failure; | 471 | goto nla_put_failure; |
476 | nla_nest_end(skb, nest); | 472 | nla_nest_end(skb, nest); |
477 | 473 | ||
478 | if (tcf_exts_dump_stats(skb, &r->exts, &tcindex_ext_map) < 0) | 474 | if (tcf_exts_dump_stats(skb, &r->exts) < 0) |
479 | goto nla_put_failure; | 475 | goto nla_put_failure; |
480 | } | 476 | } |
481 | 477 | ||