Merge tag 'drivers-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[sfrench/cifs-2.6.git] / net / sched / act_gact.c
index a0eed30d58111ab49e11f9cc97c4dc0d30e93c9e..d6bcbd9f7791eb25cd250358b21b73b7bb80c3a0 100644 (file)
@@ -24,7 +24,6 @@
 #include <net/tc_act/tc_gact.h>
 
 #define GACT_TAB_MASK  15
-static struct tcf_hashinfo gact_hash_info;
 
 #ifdef CONFIG_GACT_PROB
 static int gact_net_rand(struct tcf_gact *gact)
@@ -57,7 +56,6 @@ static int tcf_gact_init(struct net *net, struct nlattr *nla,
        struct nlattr *tb[TCA_GACT_MAX + 1];
        struct tc_gact *parm;
        struct tcf_gact *gact;
-       struct tcf_common *pc;
        int ret = 0;
        int err;
 #ifdef CONFIG_GACT_PROB
@@ -86,21 +84,20 @@ static int tcf_gact_init(struct net *net, struct nlattr *nla,
        }
 #endif
 
-       pc = tcf_hash_check(parm->index, a, bind);
-       if (!pc) {
-               pc = tcf_hash_create(parm->index, est, a, sizeof(*gact), bind);
-               if (IS_ERR(pc))
-                       return PTR_ERR(pc);
+       if (!tcf_hash_check(parm->index, a, bind)) {
+               ret = tcf_hash_create(parm->index, est, a, sizeof(*gact), bind);
+               if (ret)
+                       return ret;
                ret = ACT_P_CREATED;
        } else {
                if (bind)/* dont override defaults */
                        return 0;
-               tcf_hash_release(pc, bind, a->ops->hinfo);
+               tcf_hash_release(a, bind);
                if (!ovr)
                        return -EEXIST;
        }
 
-       gact = to_gact(pc);
+       gact = to_gact(a);
 
        spin_lock_bh(&gact->tcf_lock);
        gact->tcf_action = parm->action;
@@ -113,19 +110,10 @@ static int tcf_gact_init(struct net *net, struct nlattr *nla,
 #endif
        spin_unlock_bh(&gact->tcf_lock);
        if (ret == ACT_P_CREATED)
-               tcf_hash_insert(pc, a->ops->hinfo);
+               tcf_hash_insert(a);
        return ret;
 }
 
-static int tcf_gact_cleanup(struct tc_action *a, int bind)
-{
-       struct tcf_gact *gact = a->priv;
-
-       if (gact)
-               return tcf_hash_release(&gact->common, bind, a->ops->hinfo);
-       return 0;
-}
-
 static int tcf_gact(struct sk_buff *skb, const struct tc_action *a,
                    struct tcf_result *res)
 {
@@ -191,12 +179,10 @@ nla_put_failure:
 
 static struct tc_action_ops act_gact_ops = {
        .kind           =       "gact",
-       .hinfo          =       &gact_hash_info,
        .type           =       TCA_ACT_GACT,
        .owner          =       THIS_MODULE,
        .act            =       tcf_gact,
        .dump           =       tcf_gact_dump,
-       .cleanup        =       tcf_gact_cleanup,
        .init           =       tcf_gact_init,
 };
 
@@ -206,21 +192,17 @@ MODULE_LICENSE("GPL");
 
 static int __init gact_init_module(void)
 {
-       int err = tcf_hashinfo_init(&gact_hash_info, GACT_TAB_MASK);
-       if (err)
-               return err;
 #ifdef CONFIG_GACT_PROB
        pr_info("GACT probability on\n");
 #else
        pr_info("GACT probability NOT on\n");
 #endif
-       return tcf_register_action(&act_gact_ops);
+       return tcf_register_action(&act_gact_ops, GACT_TAB_MASK);
 }
 
 static void __exit gact_cleanup_module(void)
 {
        tcf_unregister_action(&act_gact_ops);
-       tcf_hashinfo_destroy(&gact_hash_info);
 }
 
 module_init(gact_init_module);