aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_skbedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/act_skbedit.c')
-rw-r--r--net/sched/act_skbedit.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
index 8e573c0f8742..a133dcb82132 100644
--- a/net/sched/act_skbedit.c
+++ b/net/sched/act_skbedit.c
@@ -30,11 +30,12 @@
30#define SKBEDIT_TAB_MASK 15 30#define SKBEDIT_TAB_MASK 15
31 31
32static int skbedit_net_id; 32static int skbedit_net_id;
33static struct tc_action_ops act_skbedit_ops;
33 34
34static int tcf_skbedit(struct sk_buff *skb, const struct tc_action *a, 35static int tcf_skbedit(struct sk_buff *skb, const struct tc_action *a,
35 struct tcf_result *res) 36 struct tcf_result *res)
36{ 37{
37 struct tcf_skbedit *d = a->priv; 38 struct tcf_skbedit *d = to_skbedit(a);
38 39
39 spin_lock(&d->tcf_lock); 40 spin_lock(&d->tcf_lock);
40 tcf_lastuse_update(&d->tcf_tm); 41 tcf_lastuse_update(&d->tcf_tm);
@@ -63,7 +64,7 @@ static const struct nla_policy skbedit_policy[TCA_SKBEDIT_MAX + 1] = {
63}; 64};
64 65
65static int tcf_skbedit_init(struct net *net, struct nlattr *nla, 66static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
66 struct nlattr *est, struct tc_action *a, 67 struct nlattr *est, struct tc_action **a,
67 int ovr, int bind) 68 int ovr, int bind)
68{ 69{
69 struct tc_action_net *tn = net_generic(net, skbedit_net_id); 70 struct tc_action_net *tn = net_generic(net, skbedit_net_id);
@@ -114,21 +115,21 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
114 return 0; 115 return 0;
115 116
116 if (!flags) { 117 if (!flags) {
117 tcf_hash_release(a, bind); 118 tcf_hash_release(*a, bind);
118 return -EINVAL; 119 return -EINVAL;
119 } 120 }
120 121
121 if (!exists) { 122 if (!exists) {
122 ret = tcf_hash_create(tn, parm->index, est, a, 123 ret = tcf_hash_create(tn, parm->index, est, a,
123 sizeof(*d), bind, false); 124 &act_skbedit_ops, bind, false);
124 if (ret) 125 if (ret)
125 return ret; 126 return ret;
126 127
127 d = to_skbedit(a); 128 d = to_skbedit(*a);
128 ret = ACT_P_CREATED; 129 ret = ACT_P_CREATED;
129 } else { 130 } else {
130 d = to_skbedit(a); 131 d = to_skbedit(*a);
131 tcf_hash_release(a, bind); 132 tcf_hash_release(*a, bind);
132 if (!ovr) 133 if (!ovr)
133 return -EEXIST; 134 return -EEXIST;
134 } 135 }
@@ -150,7 +151,7 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
150 spin_unlock_bh(&d->tcf_lock); 151 spin_unlock_bh(&d->tcf_lock);
151 152
152 if (ret == ACT_P_CREATED) 153 if (ret == ACT_P_CREATED)
153 tcf_hash_insert(tn, a); 154 tcf_hash_insert(tn, *a);
154 return ret; 155 return ret;
155} 156}
156 157
@@ -158,7 +159,7 @@ static int tcf_skbedit_dump(struct sk_buff *skb, struct tc_action *a,
158 int bind, int ref) 159 int bind, int ref)
159{ 160{
160 unsigned char *b = skb_tail_pointer(skb); 161 unsigned char *b = skb_tail_pointer(skb);
161 struct tcf_skbedit *d = a->priv; 162 struct tcf_skbedit *d = to_skbedit(a);
162 struct tc_skbedit opt = { 163 struct tc_skbedit opt = {
163 .index = d->tcf_index, 164 .index = d->tcf_index,
164 .refcnt = d->tcf_refcnt - ref, 165 .refcnt = d->tcf_refcnt - ref,
@@ -194,14 +195,14 @@ nla_put_failure:
194 195
195static int tcf_skbedit_walker(struct net *net, struct sk_buff *skb, 196static int tcf_skbedit_walker(struct net *net, struct sk_buff *skb,
196 struct netlink_callback *cb, int type, 197 struct netlink_callback *cb, int type,
197 struct tc_action *a) 198 const struct tc_action_ops *ops)
198{ 199{
199 struct tc_action_net *tn = net_generic(net, skbedit_net_id); 200 struct tc_action_net *tn = net_generic(net, skbedit_net_id);
200 201
201 return tcf_generic_walker(tn, skb, cb, type, a); 202 return tcf_generic_walker(tn, skb, cb, type, ops);
202} 203}
203 204
204static int tcf_skbedit_search(struct net *net, struct tc_action *a, u32 index) 205static int tcf_skbedit_search(struct net *net, struct tc_action **a, u32 index)
205{ 206{
206 struct tc_action_net *tn = net_generic(net, skbedit_net_id); 207 struct tc_action_net *tn = net_generic(net, skbedit_net_id);
207 208
@@ -217,6 +218,7 @@ static struct tc_action_ops act_skbedit_ops = {
217 .init = tcf_skbedit_init, 218 .init = tcf_skbedit_init,
218 .walk = tcf_skbedit_walker, 219 .walk = tcf_skbedit_walker,
219 .lookup = tcf_skbedit_search, 220 .lookup = tcf_skbedit_search,
221 .size = sizeof(struct tcf_skbedit),
220}; 222};
221 223
222static __net_init int skbedit_init_net(struct net *net) 224static __net_init int skbedit_init_net(struct net *net)