]> Pileus Git - ~andy/linux/blobdiff - net/sched/act_skbedit.c
ipv6: add the IPV6_FL_F_REFLECT flag to IPV6_FL_A_GET
[~andy/linux] / net / sched / act_skbedit.c
index 35ea643b4325562d74c4c05d9950a4f8a8a7ad32..74af4612706000940f2210e9b01ed53990691844 100644 (file)
@@ -11,8 +11,7 @@
  * more details.
  *
  * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
+ * this program; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Alexander Duyck <alexander.h.duyck@intel.com>
  */
 #include <net/tc_act/tc_skbedit.h>
 
 #define SKBEDIT_TAB_MASK     15
-static struct tcf_common *tcf_skbedit_ht[SKBEDIT_TAB_MASK + 1];
-static u32 skbedit_idx_gen;
-static DEFINE_RWLOCK(skbedit_lock);
-
-static struct tcf_hashinfo skbedit_hash_info = {
-       .htab   =       tcf_skbedit_ht,
-       .hmask  =       SKBEDIT_TAB_MASK,
-       .lock   =       &skbedit_lock,
-};
+static struct tcf_hashinfo skbedit_hash_info;
 
 static int tcf_skbedit(struct sk_buff *skb, const struct tc_action *a,
                       struct tcf_result *res)
@@ -112,7 +103,7 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
        pc = tcf_hash_check(parm->index, a, bind, &skbedit_hash_info);
        if (!pc) {
                pc = tcf_hash_create(parm->index, est, a, sizeof(*d), bind,
-                                    &skbedit_idx_gen, &skbedit_hash_info);
+                                    &skbedit_hash_info);
                if (IS_ERR(pc))
                        return PTR_ERR(pc);
 
@@ -120,10 +111,11 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
                ret = ACT_P_CREATED;
        } else {
                d = to_skbedit(pc);
-               if (!ovr) {
-                       tcf_hash_release(pc, bind, &skbedit_hash_info);
+               if (bind)
+                       return 0;
+               tcf_hash_release(pc, bind, &skbedit_hash_info);
+               if (!ovr)
                        return -EEXIST;
-               }
        }
 
        spin_lock_bh(&d->tcf_lock);
@@ -211,11 +203,15 @@ MODULE_LICENSE("GPL");
 
 static int __init skbedit_init_module(void)
 {
+       int err = tcf_hashinfo_init(&skbedit_hash_info, SKBEDIT_TAB_MASK);
+       if (err)
+               return err;
        return tcf_register_action(&act_skbedit_ops);
 }
 
 static void __exit skbedit_cleanup_module(void)
 {
+       tcf_hashinfo_destroy(&skbedit_hash_info);
        tcf_unregister_action(&act_skbedit_ops);
 }