[SK_BUFF]: Introduce skb_reset_mac_header(skb)
[deliverable/linux.git] / net / core / skbuff.c
index 3d5646869022240ea2136843a17c2fa76e115750..8f6ebd0d36935dee4f7499f8fbaf6936d1d38bdb 100644 (file)
@@ -41,7 +41,6 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
 #include <linux/in.h>
@@ -197,61 +196,6 @@ nodata:
        goto out;
 }
 
-/**
- *     alloc_skb_from_cache    -       allocate a network buffer
- *     @cp: kmem_cache from which to allocate the data area
- *           (object size must be big enough for @size bytes + skb overheads)
- *     @size: size to allocate
- *     @gfp_mask: allocation mask
- *
- *     Allocate a new &sk_buff. The returned buffer has no headroom and
- *     tail room of size bytes. The object has a reference count of one.
- *     The return is the buffer. On a failure the return is %NULL.
- *
- *     Buffers may only be allocated from interrupts using a @gfp_mask of
- *     %GFP_ATOMIC.
- */
-struct sk_buff *alloc_skb_from_cache(struct kmem_cache *cp,
-                                    unsigned int size,
-                                    gfp_t gfp_mask)
-{
-       struct sk_buff *skb;
-       u8 *data;
-
-       /* Get the HEAD */
-       skb = kmem_cache_alloc(skbuff_head_cache,
-                              gfp_mask & ~__GFP_DMA);
-       if (!skb)
-               goto out;
-
-       /* Get the DATA. */
-       size = SKB_DATA_ALIGN(size);
-       data = kmem_cache_alloc(cp, gfp_mask);
-       if (!data)
-               goto nodata;
-
-       memset(skb, 0, offsetof(struct sk_buff, truesize));
-       skb->truesize = size + sizeof(struct sk_buff);
-       atomic_set(&skb->users, 1);
-       skb->head = data;
-       skb->data = data;
-       skb->tail = data;
-       skb->end  = data + size;
-
-       atomic_set(&(skb_shinfo(skb)->dataref), 1);
-       skb_shinfo(skb)->nr_frags  = 0;
-       skb_shinfo(skb)->gso_size = 0;
-       skb_shinfo(skb)->gso_segs = 0;
-       skb_shinfo(skb)->gso_type = 0;
-       skb_shinfo(skb)->frag_list = NULL;
-out:
-       return skb;
-nodata:
-       kmem_cache_free(skbuff_head_cache, skb);
-       skb = NULL;
-       goto out;
-}
-
 /**
  *     __netdev_alloc_skb - allocate an skbuff for rx on a specific device
  *     @dev: network device to receive on
@@ -464,6 +408,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
        memcpy(n->cb, skb->cb, sizeof(skb->cb));
        C(len);
        C(data_len);
+       C(mac_len);
        C(csum);
        C(local_df);
        n->cloned = 1;
@@ -496,7 +441,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
        n->tc_verd = SET_TC_VERD(skb->tc_verd,0);
        n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd);
        n->tc_verd = CLR_TC_MUNGED(n->tc_verd);
-       C(input_dev);
+       C(iif);
 #endif
        skb_copy_secmark(n, skb);
 #endif
@@ -1983,7 +1928,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features)
                nskb->mac_len = skb->mac_len;
 
                skb_reserve(nskb, headroom);
-               nskb->mac.raw = nskb->data;
+               skb_reset_mac_header(nskb);
                nskb->nh.raw = nskb->data + skb->mac_len;
                nskb->h.raw = nskb->nh.raw + (skb->h.raw - skb->nh.raw);
                memcpy(skb_put(nskb, doffset), skb->data, doffset);
@@ -2038,7 +1983,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features)
 err:
        while ((skb = segs)) {
                segs = skb->next;
-               kfree(skb);
+               kfree_skb(skb);
        }
        return ERR_PTR(err);
 }
This page took 0.024777 seconds and 5 git commands to generate.