]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/sched/ematch.c
[XFRM]: Kill some bloat
[linux-2.6-omap-h63xx.git] / net / sched / ematch.c
index d3ad36b361295ca371b8ec864738d5425546d79f..f3a104e323bddd50c299c74c928a95038f1f5af5 100644 (file)
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
 #include <linux/errno.h>
-#include <linux/interrupt.h>
 #include <linux/rtnetlink.h>
 #include <linux/skbuff.h>
 #include <net/pkt_cls.h>
@@ -225,6 +222,19 @@ static int tcf_em_validate(struct tcf_proto *tp,
 
                if (em->ops == NULL) {
                        err = -ENOENT;
+#ifdef CONFIG_KMOD
+                       __rtnl_unlock();
+                       request_module("ematch-kind-%u", em_hdr->kind);
+                       rtnl_lock();
+                       em->ops = tcf_em_lookup(em_hdr->kind);
+                       if (em->ops) {
+                               /* We dropped the RTNL mutex in order to
+                                * perform the module load. Tell the caller
+                                * to replay the request. */
+                               module_put(em->ops->owner);
+                               err = -EAGAIN;
+                       }
+#endif
                        goto errout;
                }
 
@@ -419,17 +429,19 @@ void tcf_em_tree_destroy(struct tcf_proto *tp, struct tcf_ematch_tree *tree)
 int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv)
 {
        int i;
-       struct rtattr * top_start = (struct rtattr*) skb->tail;
-       struct rtattr * list_start;
+       u8 *tail;
+       struct rtattr *top_start = (struct rtattr *)skb_tail_pointer(skb);
+       struct rtattr *list_start;
 
        RTA_PUT(skb, tlv, 0, NULL);
        RTA_PUT(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr);
 
-       list_start = (struct rtattr *) skb->tail;
+       list_start = (struct rtattr *)skb_tail_pointer(skb);
        RTA_PUT(skb, TCA_EMATCH_TREE_LIST, 0, NULL);
 
+       tail = skb_tail_pointer(skb);
        for (i = 0; i < tree->hdr.nmatches; i++) {
-               struct rtattr *match_start = (struct rtattr*) skb->tail;
+               struct rtattr *match_start = (struct rtattr *)tail;
                struct tcf_ematch *em = tcf_em_get_match(tree, i);
                struct tcf_ematch_hdr em_hdr = {
                        .kind = em->ops ? em->ops->kind : TCF_EM_CONTAINER,
@@ -448,11 +460,12 @@ int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv)
                } else if (em->datalen > 0)
                        RTA_PUT_NOHDR(skb, em->datalen, (void *) em->data);
 
-               match_start->rta_len = skb->tail - (u8*) match_start;
+               tail = skb_tail_pointer(skb);
+               match_start->rta_len = tail - (u8 *)match_start;
        }
 
-       list_start->rta_len = skb->tail - (u8 *) list_start;
-       top_start->rta_len = skb->tail - (u8 *) top_start;
+       list_start->rta_len = tail - (u8 *)list_start;
+       top_start->rta_len = tail - (u8 *)top_start;
 
        return 0;