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_route.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_route.c')
-rw-r--r-- | net/sched/cls_route.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index f1f1dfdf4eb3..2473953a5948 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -59,11 +59,6 @@ struct route4_filter { | |||
59 | 59 | ||
60 | #define ROUTE4_FAILURE ((struct route4_filter *)(-1L)) | 60 | #define ROUTE4_FAILURE ((struct route4_filter *)(-1L)) |
61 | 61 | ||
62 | static const struct tcf_ext_map route_ext_map = { | ||
63 | .police = TCA_ROUTE4_POLICE, | ||
64 | .action = TCA_ROUTE4_ACT | ||
65 | }; | ||
66 | |||
67 | static inline int route4_fastmap_hash(u32 id, int iif) | 62 | static inline int route4_fastmap_hash(u32 id, int iif) |
68 | { | 63 | { |
69 | return id & 0xF; | 64 | return id & 0xF; |
@@ -347,7 +342,8 @@ static int route4_set_parms(struct net *net, struct tcf_proto *tp, | |||
347 | struct route4_bucket *b; | 342 | struct route4_bucket *b; |
348 | struct tcf_exts e; | 343 | struct tcf_exts e; |
349 | 344 | ||
350 | err = tcf_exts_validate(net, tp, tb, est, &e, &route_ext_map); | 345 | tcf_exts_init(&e, TCA_ROUTE4_ACT, TCA_ROUTE4_POLICE); |
346 | err = tcf_exts_validate(net, tp, tb, est, &e); | ||
351 | if (err < 0) | 347 | if (err < 0) |
352 | return err; | 348 | return err; |
353 | 349 | ||
@@ -481,7 +477,7 @@ static int route4_change(struct net *net, struct sk_buff *in_skb, | |||
481 | if (f == NULL) | 477 | if (f == NULL) |
482 | goto errout; | 478 | goto errout; |
483 | 479 | ||
484 | tcf_exts_init(&f->exts); | 480 | tcf_exts_init(&f->exts, TCA_ROUTE4_ACT, TCA_ROUTE4_POLICE); |
485 | err = route4_set_parms(net, tp, base, f, handle, head, tb, | 481 | err = route4_set_parms(net, tp, base, f, handle, head, tb, |
486 | tca[TCA_RATE], 1); | 482 | tca[TCA_RATE], 1); |
487 | if (err < 0) | 483 | if (err < 0) |
@@ -590,12 +586,12 @@ static int route4_dump(struct tcf_proto *tp, unsigned long fh, | |||
590 | nla_put_u32(skb, TCA_ROUTE4_CLASSID, f->res.classid)) | 586 | nla_put_u32(skb, TCA_ROUTE4_CLASSID, f->res.classid)) |
591 | goto nla_put_failure; | 587 | goto nla_put_failure; |
592 | 588 | ||
593 | if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0) | 589 | if (tcf_exts_dump(skb, &f->exts) < 0) |
594 | goto nla_put_failure; | 590 | goto nla_put_failure; |
595 | 591 | ||
596 | nla_nest_end(skb, nest); | 592 | nla_nest_end(skb, nest); |
597 | 593 | ||
598 | if (tcf_exts_dump_stats(skb, &f->exts, &route_ext_map) < 0) | 594 | if (tcf_exts_dump_stats(skb, &f->exts) < 0) |
599 | goto nla_put_failure; | 595 | goto nla_put_failure; |
600 | 596 | ||
601 | return skb->len; | 597 | return skb->len; |