net_sched: move tc_action into tcf_common
[cascardo/linux.git] / net / sched / act_connmark.c
index 35a5270..eae07a2 100644 (file)
@@ -31,6 +31,7 @@
 #define CONNMARK_TAB_MASK     3
 
 static int connmark_net_id;
+static struct tc_action_ops act_connmark_ops;
 
 static int tcf_connmark(struct sk_buff *skb, const struct tc_action *a,
                        struct tcf_result *res)
@@ -38,7 +39,7 @@ static int tcf_connmark(struct sk_buff *skb, const struct tc_action *a,
        const struct nf_conntrack_tuple_hash *thash;
        struct nf_conntrack_tuple tuple;
        enum ip_conntrack_info ctinfo;
-       struct tcf_connmark_info *ca = a->priv;
+       struct tcf_connmark_info *ca = to_connmark(a);
        struct nf_conntrack_zone zone;
        struct nf_conn *c;
        int proto;
@@ -96,7 +97,7 @@ static const struct nla_policy connmark_policy[TCA_CONNMARK_MAX + 1] = {
 };
 
 static int tcf_connmark_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, connmark_net_id);
@@ -116,22 +117,22 @@ static int tcf_connmark_init(struct net *net, struct nlattr *nla,
 
        if (!tcf_hash_check(tn, parm->index, a, bind)) {
                ret = tcf_hash_create(tn, parm->index, est, a,
-                                     sizeof(*ci), bind, false);
+                                     &act_connmark_ops, bind, false);
                if (ret)
                        return ret;
 
-               ci = to_connmark(a);
+               ci = to_connmark(*a);
                ci->tcf_action = parm->action;
                ci->net = net;
                ci->zone = parm->zone;
 
-               tcf_hash_insert(tn, a);
+               tcf_hash_insert(tn, *a);
                ret = ACT_P_CREATED;
        } else {
-               ci = to_connmark(a);
+               ci = to_connmark(*a);
                if (bind)
                        return 0;
-               tcf_hash_release(a, bind);
+               tcf_hash_release(*a, bind);
                if (!ovr)
                        return -EEXIST;
                /* replacing action and zone */
@@ -146,7 +147,7 @@ static inline int tcf_connmark_dump(struct sk_buff *skb, struct tc_action *a,
                                    int bind, int ref)
 {
        unsigned char *b = skb_tail_pointer(skb);
-       struct tcf_connmark_info *ci = a->priv;
+       struct tcf_connmark_info *ci = to_connmark(a);
 
        struct tc_connmark opt = {
                .index   = ci->tcf_index,
@@ -173,14 +174,14 @@ nla_put_failure:
 
 static int tcf_connmark_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, connmark_net_id);
 
-       return tcf_generic_walker(tn, skb, cb, type, a);
+       return tcf_generic_walker(tn, skb, cb, type, ops);
 }
 
-static int tcf_connmark_search(struct net *net, struct tc_action *a, u32 index)
+static int tcf_connmark_search(struct net *net, struct tc_action **a, u32 index)
 {
        struct tc_action_net *tn = net_generic(net, connmark_net_id);
 
@@ -196,6 +197,7 @@ static struct tc_action_ops act_connmark_ops = {
        .init           =       tcf_connmark_init,
        .walk           =       tcf_connmark_walker,
        .lookup         =       tcf_connmark_search,
+       .size           =       sizeof(struct tcf_connmark_info),
 };
 
 static __net_init int connmark_init_net(struct net *net)