net_sched: move tc_action into tcf_common
[cascardo/linux.git] / net / sched / act_skbedit.c
index 8e573c0..a133dcb 100644 (file)
 #define SKBEDIT_TAB_MASK     15
 
 static int skbedit_net_id;
+static struct tc_action_ops act_skbedit_ops;
 
 static int tcf_skbedit(struct sk_buff *skb, const struct tc_action *a,
                       struct tcf_result *res)
 {
-       struct tcf_skbedit *d = a->priv;
+       struct tcf_skbedit *d = to_skbedit(a);
 
        spin_lock(&d->tcf_lock);
        tcf_lastuse_update(&d->tcf_tm);
@@ -63,7 +64,7 @@ static const struct nla_policy skbedit_policy[TCA_SKBEDIT_MAX + 1] = {
 };
 
 static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
-                           struct nlattr *est, struct tc_action *a,
+                           struct nlattr *est, struct tc_action **a,
                            int ovr, int bind)
 {
        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,
                return 0;
 
        if (!flags) {
-               tcf_hash_release(a, bind);
+               tcf_hash_release(*a, bind);
                return -EINVAL;
        }
 
        if (!exists) {
                ret = tcf_hash_create(tn, parm->index, est, a,
-                                     sizeof(*d), bind, false);
+                                     &act_skbedit_ops, bind, false);
                if (ret)
                        return ret;
 
-               d = to_skbedit(a);
+               d = to_skbedit(*a);
                ret = ACT_P_CREATED;
        } else {
-               d = to_skbedit(a);
-               tcf_hash_release(a, bind);
+               d = to_skbedit(*a);
+               tcf_hash_release(*a, bind);
                if (!ovr)
                        return -EEXIST;
        }
@@ -150,7 +151,7 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
        spin_unlock_bh(&d->tcf_lock);
 
        if (ret == ACT_P_CREATED)
-               tcf_hash_insert(tn, a);
+               tcf_hash_insert(tn, *a);
        return ret;
 }
 
@@ -158,7 +159,7 @@ static int tcf_skbedit_dump(struct sk_buff *skb, struct tc_action *a,
                            int bind, int ref)
 {
        unsigned char *b = skb_tail_pointer(skb);
-       struct tcf_skbedit *d = a->priv;
+       struct tcf_skbedit *d = to_skbedit(a);
        struct tc_skbedit opt = {
                .index   = d->tcf_index,
                .refcnt  = d->tcf_refcnt - ref,
@@ -194,14 +195,14 @@ nla_put_failure:
 
 static int tcf_skbedit_walker(struct net *net, struct sk_buff *skb,
                              struct netlink_callback *cb, int type,
-                             struct tc_action *a)
+                             const struct tc_action_ops *ops)
 {
        struct tc_action_net *tn = net_generic(net, skbedit_net_id);
 
-       return tcf_generic_walker(tn, skb, cb, type, a);
+       return tcf_generic_walker(tn, skb, cb, type, ops);
 }
 
-static int tcf_skbedit_search(struct net *net, struct tc_action *a, u32 index)
+static int tcf_skbedit_search(struct net *net, struct tc_action **a, u32 index)
 {
        struct tc_action_net *tn = net_generic(net, skbedit_net_id);
 
@@ -217,6 +218,7 @@ static struct tc_action_ops act_skbedit_ops = {
        .init           =       tcf_skbedit_init,
        .walk           =       tcf_skbedit_walker,
        .lookup         =       tcf_skbedit_search,
+       .size           =       sizeof(struct tcf_skbedit),
 };
 
 static __net_init int skbedit_init_net(struct net *net)