diff options
Diffstat (limited to 'net/core/skbuff.c')
-rw-r--r-- | net/core/skbuff.c | 58 |
1 files changed, 2 insertions, 56 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 820761f9eeef..336958fbbcb2 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -197,61 +197,6 @@ nodata: | |||
197 | } | 197 | } |
198 | 198 | ||
199 | /** | 199 | /** |
200 | * alloc_skb_from_cache - allocate a network buffer | ||
201 | * @cp: kmem_cache from which to allocate the data area | ||
202 | * (object size must be big enough for @size bytes + skb overheads) | ||
203 | * @size: size to allocate | ||
204 | * @gfp_mask: allocation mask | ||
205 | * | ||
206 | * Allocate a new &sk_buff. The returned buffer has no headroom and | ||
207 | * tail room of size bytes. The object has a reference count of one. | ||
208 | * The return is the buffer. On a failure the return is %NULL. | ||
209 | * | ||
210 | * Buffers may only be allocated from interrupts using a @gfp_mask of | ||
211 | * %GFP_ATOMIC. | ||
212 | */ | ||
213 | struct sk_buff *alloc_skb_from_cache(struct kmem_cache *cp, | ||
214 | unsigned int size, | ||
215 | gfp_t gfp_mask) | ||
216 | { | ||
217 | struct sk_buff *skb; | ||
218 | u8 *data; | ||
219 | |||
220 | /* Get the HEAD */ | ||
221 | skb = kmem_cache_alloc(skbuff_head_cache, | ||
222 | gfp_mask & ~__GFP_DMA); | ||
223 | if (!skb) | ||
224 | goto out; | ||
225 | |||
226 | /* Get the DATA. */ | ||
227 | size = SKB_DATA_ALIGN(size); | ||
228 | data = kmem_cache_alloc(cp, gfp_mask); | ||
229 | if (!data) | ||
230 | goto nodata; | ||
231 | |||
232 | memset(skb, 0, offsetof(struct sk_buff, truesize)); | ||
233 | skb->truesize = size + sizeof(struct sk_buff); | ||
234 | atomic_set(&skb->users, 1); | ||
235 | skb->head = data; | ||
236 | skb->data = data; | ||
237 | skb->tail = data; | ||
238 | skb->end = data + size; | ||
239 | |||
240 | atomic_set(&(skb_shinfo(skb)->dataref), 1); | ||
241 | skb_shinfo(skb)->nr_frags = 0; | ||
242 | skb_shinfo(skb)->gso_size = 0; | ||
243 | skb_shinfo(skb)->gso_segs = 0; | ||
244 | skb_shinfo(skb)->gso_type = 0; | ||
245 | skb_shinfo(skb)->frag_list = NULL; | ||
246 | out: | ||
247 | return skb; | ||
248 | nodata: | ||
249 | kmem_cache_free(skbuff_head_cache, skb); | ||
250 | skb = NULL; | ||
251 | goto out; | ||
252 | } | ||
253 | |||
254 | /** | ||
255 | * __netdev_alloc_skb - allocate an skbuff for rx on a specific device | 200 | * __netdev_alloc_skb - allocate an skbuff for rx on a specific device |
256 | * @dev: network device to receive on | 201 | * @dev: network device to receive on |
257 | * @length: length to allocate | 202 | * @length: length to allocate |
@@ -463,6 +408,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask) | |||
463 | memcpy(n->cb, skb->cb, sizeof(skb->cb)); | 408 | memcpy(n->cb, skb->cb, sizeof(skb->cb)); |
464 | C(len); | 409 | C(len); |
465 | C(data_len); | 410 | C(data_len); |
411 | C(mac_len); | ||
466 | C(csum); | 412 | C(csum); |
467 | C(local_df); | 413 | C(local_df); |
468 | n->cloned = 1; | 414 | n->cloned = 1; |
@@ -495,7 +441,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask) | |||
495 | n->tc_verd = SET_TC_VERD(skb->tc_verd,0); | 441 | n->tc_verd = SET_TC_VERD(skb->tc_verd,0); |
496 | n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd); | 442 | n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd); |
497 | n->tc_verd = CLR_TC_MUNGED(n->tc_verd); | 443 | n->tc_verd = CLR_TC_MUNGED(n->tc_verd); |
498 | C(input_dev); | 444 | C(iif); |
499 | #endif | 445 | #endif |
500 | skb_copy_secmark(n, skb); | 446 | skb_copy_secmark(n, skb); |
501 | #endif | 447 | #endif |