This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / net / sched / cls_api.c
index 520312c..71c85ad 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
-#include <linux/bitops.h>
+#include <asm/bitops.h>
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
@@ -36,7 +36,6 @@
 #include <linux/kmod.h>
 #include <net/sock.h>
 #include <net/pkt_sched.h>
-#include <net/pkt_cls.h>
 
 #if 0 /* control */
 #define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)
@@ -53,18 +52,15 @@ static rwlock_t cls_mod_lock = RW_LOCK_UNLOCKED;
 
 /* Find classifier type by string name */
 
-static struct tcf_proto_ops * tcf_proto_lookup_ops(struct rtattr *kind)
+struct tcf_proto_ops * tcf_proto_lookup_ops(struct rtattr *kind)
 {
        struct tcf_proto_ops *t = NULL;
 
        if (kind) {
                read_lock(&cls_mod_lock);
                for (t = tcf_proto_base; t; t = t->next) {
-                       if (rtattr_strcmp(kind, t->kind) == 0) {
-                               if (!try_module_get(t->owner))
-                                       t = NULL;
+                       if (rtattr_strcmp(kind, t->kind) == 0)
                                break;
-                       }
                }
                read_unlock(&cls_mod_lock);
        }
@@ -234,6 +230,11 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
                tp->q = q;
                tp->classify = tp_ops->classify;
                tp->classid = parent;
+               err = -EBUSY;
+               if (!try_module_get(tp_ops->owner)) {
+                       kfree(tp);
+                       goto errout;
+               }
                if ((err = tp_ops->init(tp)) != 0) {
                        module_put(tp_ops->owner);
                        kfree(tp);
@@ -296,6 +297,19 @@ errout:
        return err;
 }
 
+unsigned long tcf_set_class(struct tcf_proto *tp, unsigned long *clp, 
+                           unsigned long cl)
+{
+       unsigned long old_cl;
+
+       tcf_tree_lock(tp);
+       old_cl = __cls_set_class(clp, cl);
+       tcf_tree_unlock(tp);
+
+       return old_cl;
+}
+
+
 static int
 tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, unsigned long fh,
              u32 pid, u32 seq, unsigned flags, int event)
@@ -461,3 +475,4 @@ subsys_initcall(tc_filter_init);
 
 EXPORT_SYMBOL(register_tcf_proto_ops);
 EXPORT_SYMBOL(unregister_tcf_proto_ops);
+EXPORT_SYMBOL(tcf_set_class);