aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_csum.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/act_csum.c')
-rw-r--r--net/sched/act_csum.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index dcd9ababd351..b5dbf633a863 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -43,9 +43,10 @@ static const struct nla_policy csum_policy[TCA_CSUM_MAX + 1] = {
43}; 43};
44 44
45static int csum_net_id; 45static int csum_net_id;
46static struct tc_action_ops act_csum_ops;
46 47
47static int tcf_csum_init(struct net *net, struct nlattr *nla, 48static int tcf_csum_init(struct net *net, struct nlattr *nla,
48 struct nlattr *est, struct tc_action *a, int ovr, 49 struct nlattr *est, struct tc_action **a, int ovr,
49 int bind) 50 int bind)
50{ 51{
51 struct tc_action_net *tn = net_generic(net, csum_net_id); 52 struct tc_action_net *tn = net_generic(net, csum_net_id);
@@ -67,26 +68,26 @@ static int tcf_csum_init(struct net *net, struct nlattr *nla,
67 68
68 if (!tcf_hash_check(tn, parm->index, a, bind)) { 69 if (!tcf_hash_check(tn, parm->index, a, bind)) {
69 ret = tcf_hash_create(tn, parm->index, est, a, 70 ret = tcf_hash_create(tn, parm->index, est, a,
70 sizeof(*p), bind, false); 71 &act_csum_ops, bind, false);
71 if (ret) 72 if (ret)
72 return ret; 73 return ret;
73 ret = ACT_P_CREATED; 74 ret = ACT_P_CREATED;
74 } else { 75 } else {
75 if (bind)/* dont override defaults */ 76 if (bind)/* dont override defaults */
76 return 0; 77 return 0;
77 tcf_hash_release(a, bind); 78 tcf_hash_release(*a, bind);
78 if (!ovr) 79 if (!ovr)
79 return -EEXIST; 80 return -EEXIST;
80 } 81 }
81 82
82 p = to_tcf_csum(a); 83 p = to_tcf_csum(*a);
83 spin_lock_bh(&p->tcf_lock); 84 spin_lock_bh(&p->tcf_lock);
84 p->tcf_action = parm->action; 85 p->tcf_action = parm->action;
85 p->update_flags = parm->update_flags; 86 p->update_flags = parm->update_flags;
86 spin_unlock_bh(&p->tcf_lock); 87 spin_unlock_bh(&p->tcf_lock);
87 88
88 if (ret == ACT_P_CREATED) 89 if (ret == ACT_P_CREATED)
89 tcf_hash_insert(tn, a); 90 tcf_hash_insert(tn, *a);
90 91
91 return ret; 92 return ret;
92} 93}
@@ -496,7 +497,7 @@ fail:
496static int tcf_csum(struct sk_buff *skb, 497static int tcf_csum(struct sk_buff *skb,
497 const struct tc_action *a, struct tcf_result *res) 498 const struct tc_action *a, struct tcf_result *res)
498{ 499{
499 struct tcf_csum *p = a->priv; 500 struct tcf_csum *p = to_tcf_csum(a);
500 int action; 501 int action;
501 u32 update_flags; 502 u32 update_flags;
502 503
@@ -534,7 +535,7 @@ static int tcf_csum_dump(struct sk_buff *skb,
534 struct tc_action *a, int bind, int ref) 535 struct tc_action *a, int bind, int ref)
535{ 536{
536 unsigned char *b = skb_tail_pointer(skb); 537 unsigned char *b = skb_tail_pointer(skb);
537 struct tcf_csum *p = a->priv; 538 struct tcf_csum *p = to_tcf_csum(a);
538 struct tc_csum opt = { 539 struct tc_csum opt = {
539 .update_flags = p->update_flags, 540 .update_flags = p->update_flags,
540 .index = p->tcf_index, 541 .index = p->tcf_index,
@@ -560,14 +561,14 @@ nla_put_failure:
560 561
561static int tcf_csum_walker(struct net *net, struct sk_buff *skb, 562static int tcf_csum_walker(struct net *net, struct sk_buff *skb,
562 struct netlink_callback *cb, int type, 563 struct netlink_callback *cb, int type,
563 struct tc_action *a) 564 const struct tc_action_ops *ops)
564{ 565{
565 struct tc_action_net *tn = net_generic(net, csum_net_id); 566 struct tc_action_net *tn = net_generic(net, csum_net_id);
566 567
567 return tcf_generic_walker(tn, skb, cb, type, a); 568 return tcf_generic_walker(tn, skb, cb, type, ops);
568} 569}
569 570
570static int tcf_csum_search(struct net *net, struct tc_action *a, u32 index) 571static int tcf_csum_search(struct net *net, struct tc_action **a, u32 index)
571{ 572{
572 struct tc_action_net *tn = net_generic(net, csum_net_id); 573 struct tc_action_net *tn = net_generic(net, csum_net_id);
573 574
@@ -583,6 +584,7 @@ static struct tc_action_ops act_csum_ops = {
583 .init = tcf_csum_init, 584 .init = tcf_csum_init,
584 .walk = tcf_csum_walker, 585 .walk = tcf_csum_walker,
585 .lookup = tcf_csum_search, 586 .lookup = tcf_csum_search,
587 .size = sizeof(struct tcf_csum),
586}; 588};
587 589
588static __net_init int csum_init_net(struct net *net) 590static __net_init int csum_init_net(struct net *net)