Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15573
b: refs/heads/master
c: 4947d3e
h: refs/heads/master
i:
  15571: 6bd822e
v: v3
  • Loading branch information
Benjamin LaHaise authored and David S. Miller committed Jan 3, 2006
1 parent 0ec3fb0 commit dae1f9f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 17ba15fb6264f27374bc87f4c3f8519b80289d85
refs/heads/master: 4947d3ef8de7b4f42aed6ea9ba689dc8fb45b5a5
2 changes: 1 addition & 1 deletion trunk/include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ struct skb_frag_struct {
*/
struct skb_shared_info {
atomic_t dataref;
unsigned int nr_frags;
unsigned short nr_frags;
unsigned short tso_size;
unsigned short tso_segs;
unsigned short ufo_size;
Expand Down
27 changes: 13 additions & 14 deletions trunk/net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,13 @@ void skb_under_panic(struct sk_buff *skb, int sz, void *here)
struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
int fclone)
{
struct skb_shared_info *shinfo;
struct sk_buff *skb;
u8 *data;

/* Get the HEAD */
if (fclone)
skb = kmem_cache_alloc(skbuff_fclone_cache,
gfp_mask & ~__GFP_DMA);
else
skb = kmem_cache_alloc(skbuff_head_cache,
gfp_mask & ~__GFP_DMA);

skb = kmem_cache_alloc(fclone ? skbuff_fclone_cache : skbuff_head_cache,
gfp_mask & ~__GFP_DMA);
if (!skb)
goto out;

Expand All @@ -162,6 +158,16 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
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->tso_size = 0;
shinfo->tso_segs = 0;
shinfo->ufo_size = 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);
Expand All @@ -171,13 +177,6 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,

child->fclone = SKB_FCLONE_UNAVAILABLE;
}
atomic_set(&(skb_shinfo(skb)->dataref), 1);
skb_shinfo(skb)->nr_frags = 0;
skb_shinfo(skb)->tso_size = 0;
skb_shinfo(skb)->tso_segs = 0;
skb_shinfo(skb)->frag_list = NULL;
skb_shinfo(skb)->ufo_size = 0;
skb_shinfo(skb)->ip6_frag_id = 0;
out:
return skb;
nodata:
Expand Down

0 comments on commit dae1f9f

Please sign in to comment.