]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - net/sched/cls_basic.c
[SK_BUFF]: Convert skb->tail to sk_buff_data_t
[karo-tx-linux.git] / net / sched / cls_basic.c
index 09fda68c8b39f494f6b5802a99efc34a39cdc030..800ec2ac326b5ae91be25d5ee051b391ec63c9a2 100644 (file)
@@ -12,7 +12,6 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/errno.h>
@@ -82,6 +81,13 @@ static void basic_put(struct tcf_proto *tp, unsigned long f)
 
 static int basic_init(struct tcf_proto *tp)
 {
+       struct basic_head *head;
+
+       head = kzalloc(sizeof(*head), GFP_KERNEL);
+       if (head == NULL)
+               return -ENOBUFS;
+       INIT_LIST_HEAD(&head->flist);
+       tp->root = head;
        return 0;
 }
 
@@ -98,11 +104,12 @@ static void basic_destroy(struct tcf_proto *tp)
 {
        struct basic_head *head = (struct basic_head *) xchg(&tp->root, NULL);
        struct basic_filter *f, *n;
-       
+
        list_for_each_entry_safe(f, n, &head->flist, link) {
                list_del(&f->link);
                basic_delete_filter(tp, f);
        }
+       kfree(head);
 }
 
 static int basic_delete(struct tcf_proto *tp, unsigned long arg)
@@ -157,7 +164,7 @@ errout:
 }
 
 static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,
-                       struct rtattr **tca, unsigned long *arg)
+                       struct rtattr **tca, unsigned long *arg)
 {
        int err = -EINVAL;
        struct basic_head *head = (struct basic_head *) tp->root;
@@ -177,15 +184,6 @@ static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,
        }
 
        err = -ENOBUFS;
-       if (head == NULL) {
-               head = kzalloc(sizeof(*head), GFP_KERNEL);
-               if (head == NULL)
-                       goto errout;
-
-               INIT_LIST_HEAD(&head->flist);
-               tp->root = head;
-       }
-
        f = kzalloc(sizeof(*f), GFP_KERNEL);
        if (f == NULL)
                goto errout;
@@ -247,7 +245,7 @@ static int basic_dump(struct tcf_proto *tp, unsigned long fh,
                      struct sk_buff *skb, struct tcmsg *t)
 {
        struct basic_filter *f = (struct basic_filter *) fh;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta;
 
        if (f == NULL)
@@ -265,7 +263,7 @@ static int basic_dump(struct tcf_proto *tp, unsigned long fh,
            tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0)
                goto rtattr_failure;
 
-       rta->rta_len = (skb->tail - b);
+       rta->rta_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
 rtattr_failure:
@@ -292,7 +290,7 @@ static int __init init_basic(void)
        return register_tcf_proto_ops(&cls_basic_ops);
 }
 
-static void __exit exit_basic(void) 
+static void __exit exit_basic(void)
 {
        unregister_tcf_proto_ops(&cls_basic_ops);
 }