diff options
Diffstat (limited to 'linux-2.6-xen-sparse/net/core/skbuff.c')
-rw-r--r-- | linux-2.6-xen-sparse/net/core/skbuff.c | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/linux-2.6-xen-sparse/net/core/skbuff.c b/linux-2.6-xen-sparse/net/core/skbuff.c index 5a524946b0..ab4b6079e5 100644 --- a/linux-2.6-xen-sparse/net/core/skbuff.c +++ b/linux-2.6-xen-sparse/net/core/skbuff.c @@ -132,7 +132,6 @@ void skb_under_panic(struct sk_buff *skb, int sz, void *here) * Buffers may only be allocated from interrupts using a @gfp_mask of * %GFP_ATOMIC. */ -#ifndef CONFIG_HAVE_ARCH_ALLOC_SKB struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, int fclone) { @@ -187,7 +186,6 @@ nodata: skb = NULL; goto out; } -#endif /* !CONFIG_HAVE_ARCH_ALLOC_SKB */ /** * alloc_skb_from_cache - allocate a network buffer @@ -205,18 +203,14 @@ nodata: */ struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, unsigned int size, - gfp_t gfp_mask, - int fclone) + gfp_t gfp_mask) { - kmem_cache_t *cache; - struct skb_shared_info *shinfo; struct sk_buff *skb; u8 *data; - cache = fclone ? skbuff_fclone_cache : skbuff_head_cache; - /* Get the HEAD */ - skb = kmem_cache_alloc(cache, gfp_mask & ~__GFP_DMA); + skb = kmem_cache_alloc(skbuff_head_cache, + gfp_mask & ~__GFP_DMA); if (!skb) goto out; @@ -233,29 +227,18 @@ struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, skb->data = data; skb->tail = data; skb->end = data + size; - /* make sure we initialize shinfo sequentially */ - shinfo = skb_shinfo(skb); - atomic_set(&shinfo->dataref, 1); - shinfo->nr_frags = 0; - shinfo->gso_size = 0; - shinfo->gso_segs = 0; - shinfo->gso_type = 0; - shinfo->ip6_frag_id = 0; - shinfo->frag_list = NULL; - - if (fclone) { - struct sk_buff *child = skb + 1; - atomic_t *fclone_ref = (atomic_t *) (child + 1); - - skb->fclone = SKB_FCLONE_ORIG; - atomic_set(fclone_ref, 1); - child->fclone = SKB_FCLONE_UNAVAILABLE; - } + 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)->ip6_frag_id = 0; + skb_shinfo(skb)->frag_list = NULL; out: return skb; nodata: - kmem_cache_free(cache, skb); + kmem_cache_free(skbuff_head_cache, skb); skb = NULL; goto out; } |