ia64/xen-unstable

view linux-2.6-xen-sparse/net/core/skbuff.c @ 8612:d783bdd14f2e

Remove the free_vcpu() interface I added in the preceding
changeset. It makes no sense, since an allocated VCPU
cannot be freed at any arbitrary point because individual
VCPUs are not refcounted.

Instead extend free_domain() slightly so it really does do
the reverse of alloc_vcpu() for every allocated VCPU.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Sat Jan 14 23:40:09 2006 +0100 (2006-01-14)
parents 98bcd8fbd5e3
children fd9b2c1bb577
line source
1 /*
2 * Routines having to do with the 'struct sk_buff' memory handlers.
3 *
4 * Authors: Alan Cox <iiitac@pyr.swan.ac.uk>
5 * Florian La Roche <rzsfl@rz.uni-sb.de>
6 *
7 * Version: $Id: skbuff.c,v 1.90 2001/11/07 05:56:19 davem Exp $
8 *
9 * Fixes:
10 * Alan Cox : Fixed the worst of the load
11 * balancer bugs.
12 * Dave Platt : Interrupt stacking fix.
13 * Richard Kooijman : Timestamp fixes.
14 * Alan Cox : Changed buffer format.
15 * Alan Cox : destructor hook for AF_UNIX etc.
16 * Linus Torvalds : Better skb_clone.
17 * Alan Cox : Added skb_copy.
18 * Alan Cox : Added all the changed routines Linus
19 * only put in the headers
20 * Ray VanTassle : Fixed --skb->lock in free
21 * Alan Cox : skb_copy copy arp field
22 * Andi Kleen : slabified it.
23 * Robert Olsson : Removed skb_head_pool
24 *
25 * NOTE:
26 * The __skb_ routines should be called with interrupts
27 * disabled, or you better be *real* sure that the operation is atomic
28 * with respect to whatever list is being frobbed (e.g. via lock_sock()
29 * or via disabling bottom half handlers, etc).
30 *
31 * This program is free software; you can redistribute it and/or
32 * modify it under the terms of the GNU General Public License
33 * as published by the Free Software Foundation; either version
34 * 2 of the License, or (at your option) any later version.
35 */
37 /*
38 * The functions in this file will not compile correctly with gcc 2.4.x
39 */
41 #include <linux/config.h>
42 #include <linux/module.h>
43 #include <linux/types.h>
44 #include <linux/kernel.h>
45 #include <linux/sched.h>
46 #include <linux/mm.h>
47 #include <linux/interrupt.h>
48 #include <linux/in.h>
49 #include <linux/inet.h>
50 #include <linux/slab.h>
51 #include <linux/netdevice.h>
52 #ifdef CONFIG_NET_CLS_ACT
53 #include <net/pkt_sched.h>
54 #endif
55 #include <linux/string.h>
56 #include <linux/skbuff.h>
57 #include <linux/cache.h>
58 #include <linux/rtnetlink.h>
59 #include <linux/init.h>
60 #include <linux/highmem.h>
62 #include <net/protocol.h>
63 #include <net/dst.h>
64 #include <net/sock.h>
65 #include <net/checksum.h>
66 #include <net/xfrm.h>
68 #include <asm/uaccess.h>
69 #include <asm/system.h>
71 static kmem_cache_t *skbuff_head_cache;
73 /*
74 * Keep out-of-line to prevent kernel bloat.
75 * __builtin_return_address is not used because it is not always
76 * reliable.
77 */
79 /**
80 * skb_over_panic - private function
81 * @skb: buffer
82 * @sz: size
83 * @here: address
84 *
85 * Out of line support code for skb_put(). Not user callable.
86 */
87 void skb_over_panic(struct sk_buff *skb, int sz, void *here)
88 {
89 printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p "
90 "data:%p tail:%p end:%p dev:%s\n",
91 here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end,
92 skb->dev ? skb->dev->name : "<NULL>");
93 BUG();
94 }
96 /**
97 * skb_under_panic - private function
98 * @skb: buffer
99 * @sz: size
100 * @here: address
101 *
102 * Out of line support code for skb_push(). Not user callable.
103 */
105 void skb_under_panic(struct sk_buff *skb, int sz, void *here)
106 {
107 printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p "
108 "data:%p tail:%p end:%p dev:%s\n",
109 here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end,
110 skb->dev ? skb->dev->name : "<NULL>");
111 BUG();
112 }
114 /* Allocate a new skbuff. We do this ourselves so we can fill in a few
115 * 'private' fields and also do memory statistics to find all the
116 * [BEEP] leaks.
117 *
118 */
120 /**
121 * alloc_skb - allocate a network buffer
122 * @size: size to allocate
123 * @gfp_mask: allocation mask
124 *
125 * Allocate a new &sk_buff. The returned buffer has no headroom and a
126 * tail room of size bytes. The object has a reference count of one.
127 * The return is the buffer. On a failure the return is %NULL.
128 *
129 * Buffers may only be allocated from interrupts using a @gfp_mask of
130 * %GFP_ATOMIC.
131 */
132 #ifndef CONFIG_HAVE_ARCH_ALLOC_SKB
133 struct sk_buff *alloc_skb(unsigned int size, int gfp_mask)
134 {
135 struct sk_buff *skb;
136 u8 *data;
138 /* Get the HEAD */
139 skb = kmem_cache_alloc(skbuff_head_cache,
140 gfp_mask & ~__GFP_DMA);
141 if (!skb)
142 goto out;
144 /* Get the DATA. Size must match skb_add_mtu(). */
145 size = SKB_DATA_ALIGN(size);
146 data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask);
147 if (!data)
148 goto nodata;
150 memset(skb, 0, offsetof(struct sk_buff, truesize));
151 skb->truesize = size + sizeof(struct sk_buff);
152 atomic_set(&skb->users, 1);
153 skb->head = data;
154 skb->data = data;
155 skb->tail = data;
156 skb->end = data + size;
158 atomic_set(&(skb_shinfo(skb)->dataref), 1);
159 skb_shinfo(skb)->nr_frags = 0;
160 skb_shinfo(skb)->tso_size = 0;
161 skb_shinfo(skb)->tso_segs = 0;
162 skb_shinfo(skb)->frag_list = NULL;
163 out:
164 return skb;
165 nodata:
166 kmem_cache_free(skbuff_head_cache, skb);
167 skb = NULL;
168 goto out;
169 }
170 #endif /* !CONFIG_HAVE_ARCH_ALLOC_SKB */
172 /**
173 * alloc_skb_from_cache - allocate a network buffer
174 * @cp: kmem_cache from which to allocate the data area
175 * (object size must be big enough for @size bytes + skb overheads)
176 * @size: size to allocate
177 * @gfp_mask: allocation mask
178 *
179 * Allocate a new &sk_buff. The returned buffer has no headroom and
180 * tail room of size bytes. The object has a reference count of one.
181 * The return is the buffer. On a failure the return is %NULL.
182 *
183 * Buffers may only be allocated from interrupts using a @gfp_mask of
184 * %GFP_ATOMIC.
185 */
186 struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
187 unsigned int size, int gfp_mask)
188 {
189 struct sk_buff *skb;
190 u8 *data;
192 /* Get the HEAD */
193 skb = kmem_cache_alloc(skbuff_head_cache,
194 gfp_mask & ~__GFP_DMA);
195 if (!skb)
196 goto out;
198 /* Get the DATA. */
199 size = SKB_DATA_ALIGN(size);
200 data = kmem_cache_alloc(cp, gfp_mask);
201 if (!data)
202 goto nodata;
204 memset(skb, 0, offsetof(struct sk_buff, truesize));
205 skb->truesize = size + sizeof(struct sk_buff);
206 atomic_set(&skb->users, 1);
207 skb->head = data;
208 skb->data = data;
209 skb->tail = data;
210 skb->end = data + size;
212 atomic_set(&(skb_shinfo(skb)->dataref), 1);
213 skb_shinfo(skb)->nr_frags = 0;
214 skb_shinfo(skb)->tso_size = 0;
215 skb_shinfo(skb)->tso_segs = 0;
216 skb_shinfo(skb)->frag_list = NULL;
217 out:
218 return skb;
219 nodata:
220 kmem_cache_free(skbuff_head_cache, skb);
221 skb = NULL;
222 goto out;
223 }
226 static void skb_drop_fraglist(struct sk_buff *skb)
227 {
228 struct sk_buff *list = skb_shinfo(skb)->frag_list;
230 skb_shinfo(skb)->frag_list = NULL;
232 do {
233 struct sk_buff *this = list;
234 list = list->next;
235 kfree_skb(this);
236 } while (list);
237 }
239 static void skb_clone_fraglist(struct sk_buff *skb)
240 {
241 struct sk_buff *list;
243 for (list = skb_shinfo(skb)->frag_list; list; list = list->next)
244 skb_get(list);
245 }
247 void skb_release_data(struct sk_buff *skb)
248 {
249 if (!skb->cloned ||
250 !atomic_sub_return(skb->nohdr ? (1 << SKB_DATAREF_SHIFT) + 1 : 1,
251 &skb_shinfo(skb)->dataref)) {
252 if (skb_shinfo(skb)->nr_frags) {
253 int i;
254 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
255 put_page(skb_shinfo(skb)->frags[i].page);
256 }
258 if (skb_shinfo(skb)->frag_list)
259 skb_drop_fraglist(skb);
261 kfree(skb->head);
262 }
263 }
265 /*
266 * Free an skbuff by memory without cleaning the state.
267 */
268 void kfree_skbmem(struct sk_buff *skb)
269 {
270 skb_release_data(skb);
271 kmem_cache_free(skbuff_head_cache, skb);
272 }
274 /**
275 * __kfree_skb - private function
276 * @skb: buffer
277 *
278 * Free an sk_buff. Release anything attached to the buffer.
279 * Clean the state. This is an internal helper function. Users should
280 * always call kfree_skb
281 */
283 void __kfree_skb(struct sk_buff *skb)
284 {
285 BUG_ON(skb->list != NULL);
287 dst_release(skb->dst);
288 #ifdef CONFIG_XFRM
289 secpath_put(skb->sp);
290 #endif
291 if (skb->destructor) {
292 WARN_ON(in_irq());
293 skb->destructor(skb);
294 }
295 #ifdef CONFIG_NETFILTER
296 nf_conntrack_put(skb->nfct);
297 #ifdef CONFIG_BRIDGE_NETFILTER
298 nf_bridge_put(skb->nf_bridge);
299 #endif
300 #endif
301 /* XXX: IS this still necessary? - JHS */
302 #ifdef CONFIG_NET_SCHED
303 skb->tc_index = 0;
304 #ifdef CONFIG_NET_CLS_ACT
305 skb->tc_verd = 0;
306 skb->tc_classid = 0;
307 #endif
308 #endif
310 kfree_skbmem(skb);
311 }
313 /**
314 * skb_clone - duplicate an sk_buff
315 * @skb: buffer to clone
316 * @gfp_mask: allocation priority
317 *
318 * Duplicate an &sk_buff. The new one is not owned by a socket. Both
319 * copies share the same packet data but not structure. The new
320 * buffer has a reference count of 1. If the allocation fails the
321 * function returns %NULL otherwise the new buffer is returned.
322 *
323 * If this function is called from an interrupt gfp_mask() must be
324 * %GFP_ATOMIC.
325 */
327 struct sk_buff *skb_clone(struct sk_buff *skb, int gfp_mask)
328 {
329 struct sk_buff *n = kmem_cache_alloc(skbuff_head_cache, gfp_mask);
331 if (!n)
332 return NULL;
334 #define C(x) n->x = skb->x
336 n->next = n->prev = NULL;
337 n->list = NULL;
338 n->sk = NULL;
339 C(stamp);
340 C(dev);
341 C(real_dev);
342 C(h);
343 C(nh);
344 C(mac);
345 C(dst);
346 dst_clone(skb->dst);
347 C(sp);
348 #ifdef CONFIG_INET
349 secpath_get(skb->sp);
350 #endif
351 memcpy(n->cb, skb->cb, sizeof(skb->cb));
352 C(len);
353 C(data_len);
354 C(csum);
355 C(local_df);
356 n->cloned = 1;
357 n->nohdr = 0;
358 C(proto_csum_valid);
359 C(proto_csum_blank);
360 C(pkt_type);
361 C(ip_summed);
362 C(priority);
363 C(protocol);
364 C(security);
365 n->destructor = NULL;
366 #ifdef CONFIG_NETFILTER
367 C(nfmark);
368 C(nfcache);
369 C(nfct);
370 nf_conntrack_get(skb->nfct);
371 C(nfctinfo);
372 #ifdef CONFIG_NETFILTER_DEBUG
373 C(nf_debug);
374 #endif
375 #ifdef CONFIG_BRIDGE_NETFILTER
376 C(nf_bridge);
377 nf_bridge_get(skb->nf_bridge);
378 #endif
379 #endif /*CONFIG_NETFILTER*/
380 #if defined(CONFIG_HIPPI)
381 C(private);
382 #endif
383 #ifdef CONFIG_NET_SCHED
384 C(tc_index);
385 #ifdef CONFIG_NET_CLS_ACT
386 n->tc_verd = SET_TC_VERD(skb->tc_verd,0);
387 n->tc_verd = CLR_TC_OK2MUNGE(skb->tc_verd);
388 n->tc_verd = CLR_TC_MUNGED(skb->tc_verd);
389 C(input_dev);
390 C(tc_classid);
391 #endif
393 #endif
394 C(truesize);
395 atomic_set(&n->users, 1);
396 C(head);
397 C(data);
398 C(tail);
399 C(end);
401 atomic_inc(&(skb_shinfo(skb)->dataref));
402 skb->cloned = 1;
404 return n;
405 }
407 static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
408 {
409 /*
410 * Shift between the two data areas in bytes
411 */
412 unsigned long offset = new->data - old->data;
414 new->list = NULL;
415 new->sk = NULL;
416 new->dev = old->dev;
417 new->real_dev = old->real_dev;
418 new->priority = old->priority;
419 new->protocol = old->protocol;
420 new->dst = dst_clone(old->dst);
421 #ifdef CONFIG_INET
422 new->sp = secpath_get(old->sp);
423 #endif
424 new->h.raw = old->h.raw + offset;
425 new->nh.raw = old->nh.raw + offset;
426 new->mac.raw = old->mac.raw + offset;
427 memcpy(new->cb, old->cb, sizeof(old->cb));
428 new->local_df = old->local_df;
429 new->pkt_type = old->pkt_type;
430 new->stamp = old->stamp;
431 new->destructor = NULL;
432 new->security = old->security;
433 #ifdef CONFIG_NETFILTER
434 new->nfmark = old->nfmark;
435 new->nfcache = old->nfcache;
436 new->nfct = old->nfct;
437 nf_conntrack_get(old->nfct);
438 new->nfctinfo = old->nfctinfo;
439 #ifdef CONFIG_NETFILTER_DEBUG
440 new->nf_debug = old->nf_debug;
441 #endif
442 #ifdef CONFIG_BRIDGE_NETFILTER
443 new->nf_bridge = old->nf_bridge;
444 nf_bridge_get(old->nf_bridge);
445 #endif
446 #endif
447 #ifdef CONFIG_NET_SCHED
448 #ifdef CONFIG_NET_CLS_ACT
449 new->tc_verd = old->tc_verd;
450 #endif
451 new->tc_index = old->tc_index;
452 #endif
453 atomic_set(&new->users, 1);
454 skb_shinfo(new)->tso_size = skb_shinfo(old)->tso_size;
455 skb_shinfo(new)->tso_segs = skb_shinfo(old)->tso_segs;
456 }
458 /**
459 * skb_copy - create private copy of an sk_buff
460 * @skb: buffer to copy
461 * @gfp_mask: allocation priority
462 *
463 * Make a copy of both an &sk_buff and its data. This is used when the
464 * caller wishes to modify the data and needs a private copy of the
465 * data to alter. Returns %NULL on failure or the pointer to the buffer
466 * on success. The returned buffer has a reference count of 1.
467 *
468 * As by-product this function converts non-linear &sk_buff to linear
469 * one, so that &sk_buff becomes completely private and caller is allowed
470 * to modify all the data of returned buffer. This means that this
471 * function is not recommended for use in circumstances when only
472 * header is going to be modified. Use pskb_copy() instead.
473 */
475 struct sk_buff *skb_copy(const struct sk_buff *skb, int gfp_mask)
476 {
477 int headerlen = skb->data - skb->head;
478 /*
479 * Allocate the copy buffer
480 */
481 struct sk_buff *n = alloc_skb(skb->end - skb->head + skb->data_len,
482 gfp_mask);
483 if (!n)
484 return NULL;
486 /* Set the data pointer */
487 skb_reserve(n, headerlen);
488 /* Set the tail pointer and length */
489 skb_put(n, skb->len);
490 n->csum = skb->csum;
491 n->ip_summed = skb->ip_summed;
493 if (skb_copy_bits(skb, -headerlen, n->head, headerlen + skb->len))
494 BUG();
496 copy_skb_header(n, skb);
497 return n;
498 }
501 /**
502 * pskb_copy - create copy of an sk_buff with private head.
503 * @skb: buffer to copy
504 * @gfp_mask: allocation priority
505 *
506 * Make a copy of both an &sk_buff and part of its data, located
507 * in header. Fragmented data remain shared. This is used when
508 * the caller wishes to modify only header of &sk_buff and needs
509 * private copy of the header to alter. Returns %NULL on failure
510 * or the pointer to the buffer on success.
511 * The returned buffer has a reference count of 1.
512 */
514 struct sk_buff *pskb_copy(struct sk_buff *skb, int gfp_mask)
515 {
516 /*
517 * Allocate the copy buffer
518 */
519 struct sk_buff *n = alloc_skb(skb->end - skb->head, gfp_mask);
521 if (!n)
522 goto out;
524 /* Set the data pointer */
525 skb_reserve(n, skb->data - skb->head);
526 /* Set the tail pointer and length */
527 skb_put(n, skb_headlen(skb));
528 /* Copy the bytes */
529 memcpy(n->data, skb->data, n->len);
530 n->csum = skb->csum;
531 n->ip_summed = skb->ip_summed;
533 n->data_len = skb->data_len;
534 n->len = skb->len;
536 if (skb_shinfo(skb)->nr_frags) {
537 int i;
539 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
540 skb_shinfo(n)->frags[i] = skb_shinfo(skb)->frags[i];
541 get_page(skb_shinfo(n)->frags[i].page);
542 }
543 skb_shinfo(n)->nr_frags = i;
544 }
546 if (skb_shinfo(skb)->frag_list) {
547 skb_shinfo(n)->frag_list = skb_shinfo(skb)->frag_list;
548 skb_clone_fraglist(n);
549 }
551 copy_skb_header(n, skb);
552 out:
553 return n;
554 }
556 /**
557 * pskb_expand_head - reallocate header of &sk_buff
558 * @skb: buffer to reallocate
559 * @nhead: room to add at head
560 * @ntail: room to add at tail
561 * @gfp_mask: allocation priority
562 *
563 * Expands (or creates identical copy, if &nhead and &ntail are zero)
564 * header of skb. &sk_buff itself is not changed. &sk_buff MUST have
565 * reference count of 1. Returns zero in the case of success or error,
566 * if expansion failed. In the last case, &sk_buff is not changed.
567 *
568 * All the pointers pointing into skb header may change and must be
569 * reloaded after call to this function.
570 */
572 int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, int gfp_mask)
573 {
574 int i;
575 u8 *data;
576 int size = nhead + (skb->end - skb->head) + ntail;
577 long off;
579 if (skb_shared(skb))
580 BUG();
582 size = SKB_DATA_ALIGN(size);
584 data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask);
585 if (!data)
586 goto nodata;
588 /* Copy only real data... and, alas, header. This should be
589 * optimized for the cases when header is void. */
590 memcpy(data + nhead, skb->head, skb->tail - skb->head);
591 memcpy(data + size, skb->end, sizeof(struct skb_shared_info));
593 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
594 get_page(skb_shinfo(skb)->frags[i].page);
596 if (skb_shinfo(skb)->frag_list)
597 skb_clone_fraglist(skb);
599 skb_release_data(skb);
601 off = (data + nhead) - skb->head;
603 skb->head = data;
604 skb->end = data + size;
605 skb->data += off;
606 skb->tail += off;
607 skb->mac.raw += off;
608 skb->h.raw += off;
609 skb->nh.raw += off;
610 skb->cloned = 0;
611 skb->nohdr = 0;
612 atomic_set(&skb_shinfo(skb)->dataref, 1);
613 return 0;
615 nodata:
616 return -ENOMEM;
617 }
619 /* Make private copy of skb with writable head and some headroom */
621 struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, unsigned int headroom)
622 {
623 struct sk_buff *skb2;
624 int delta = headroom - skb_headroom(skb);
626 if (delta <= 0)
627 skb2 = pskb_copy(skb, GFP_ATOMIC);
628 else {
629 skb2 = skb_clone(skb, GFP_ATOMIC);
630 if (skb2 && pskb_expand_head(skb2, SKB_DATA_ALIGN(delta), 0,
631 GFP_ATOMIC)) {
632 kfree_skb(skb2);
633 skb2 = NULL;
634 }
635 }
636 return skb2;
637 }
640 /**
641 * skb_copy_expand - copy and expand sk_buff
642 * @skb: buffer to copy
643 * @newheadroom: new free bytes at head
644 * @newtailroom: new free bytes at tail
645 * @gfp_mask: allocation priority
646 *
647 * Make a copy of both an &sk_buff and its data and while doing so
648 * allocate additional space.
649 *
650 * This is used when the caller wishes to modify the data and needs a
651 * private copy of the data to alter as well as more space for new fields.
652 * Returns %NULL on failure or the pointer to the buffer
653 * on success. The returned buffer has a reference count of 1.
654 *
655 * You must pass %GFP_ATOMIC as the allocation priority if this function
656 * is called from an interrupt.
657 *
658 * BUG ALERT: ip_summed is not copied. Why does this work? Is it used
659 * only by netfilter in the cases when checksum is recalculated? --ANK
660 */
661 struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
662 int newheadroom, int newtailroom, int gfp_mask)
663 {
664 /*
665 * Allocate the copy buffer
666 */
667 struct sk_buff *n = alloc_skb(newheadroom + skb->len + newtailroom,
668 gfp_mask);
669 int head_copy_len, head_copy_off;
671 if (!n)
672 return NULL;
674 skb_reserve(n, newheadroom);
676 /* Set the tail pointer and length */
677 skb_put(n, skb->len);
679 head_copy_len = skb_headroom(skb);
680 head_copy_off = 0;
681 if (newheadroom <= head_copy_len)
682 head_copy_len = newheadroom;
683 else
684 head_copy_off = newheadroom - head_copy_len;
686 /* Copy the linear header and data. */
687 if (skb_copy_bits(skb, -head_copy_len, n->head + head_copy_off,
688 skb->len + head_copy_len))
689 BUG();
691 copy_skb_header(n, skb);
693 return n;
694 }
696 /**
697 * skb_pad - zero pad the tail of an skb
698 * @skb: buffer to pad
699 * @pad: space to pad
700 *
701 * Ensure that a buffer is followed by a padding area that is zero
702 * filled. Used by network drivers which may DMA or transfer data
703 * beyond the buffer end onto the wire.
704 *
705 * May return NULL in out of memory cases.
706 */
708 struct sk_buff *skb_pad(struct sk_buff *skb, int pad)
709 {
710 struct sk_buff *nskb;
712 /* If the skbuff is non linear tailroom is always zero.. */
713 if (skb_tailroom(skb) >= pad) {
714 memset(skb->data+skb->len, 0, pad);
715 return skb;
716 }
718 nskb = skb_copy_expand(skb, skb_headroom(skb), skb_tailroom(skb) + pad, GFP_ATOMIC);
719 kfree_skb(skb);
720 if (nskb)
721 memset(nskb->data+nskb->len, 0, pad);
722 return nskb;
723 }
725 /* Trims skb to length len. It can change skb pointers, if "realloc" is 1.
726 * If realloc==0 and trimming is impossible without change of data,
727 * it is BUG().
728 */
730 int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc)
731 {
732 int offset = skb_headlen(skb);
733 int nfrags = skb_shinfo(skb)->nr_frags;
734 int i;
736 for (i = 0; i < nfrags; i++) {
737 int end = offset + skb_shinfo(skb)->frags[i].size;
738 if (end > len) {
739 if (skb_cloned(skb)) {
740 if (!realloc)
741 BUG();
742 if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
743 return -ENOMEM;
744 }
745 if (len <= offset) {
746 put_page(skb_shinfo(skb)->frags[i].page);
747 skb_shinfo(skb)->nr_frags--;
748 } else {
749 skb_shinfo(skb)->frags[i].size = len - offset;
750 }
751 }
752 offset = end;
753 }
755 if (offset < len) {
756 skb->data_len -= skb->len - len;
757 skb->len = len;
758 } else {
759 if (len <= skb_headlen(skb)) {
760 skb->len = len;
761 skb->data_len = 0;
762 skb->tail = skb->data + len;
763 if (skb_shinfo(skb)->frag_list && !skb_cloned(skb))
764 skb_drop_fraglist(skb);
765 } else {
766 skb->data_len -= skb->len - len;
767 skb->len = len;
768 }
769 }
771 return 0;
772 }
774 /**
775 * __pskb_pull_tail - advance tail of skb header
776 * @skb: buffer to reallocate
777 * @delta: number of bytes to advance tail
778 *
779 * The function makes a sense only on a fragmented &sk_buff,
780 * it expands header moving its tail forward and copying necessary
781 * data from fragmented part.
782 *
783 * &sk_buff MUST have reference count of 1.
784 *
785 * Returns %NULL (and &sk_buff does not change) if pull failed
786 * or value of new tail of skb in the case of success.
787 *
788 * All the pointers pointing into skb header may change and must be
789 * reloaded after call to this function.
790 */
792 /* Moves tail of skb head forward, copying data from fragmented part,
793 * when it is necessary.
794 * 1. It may fail due to malloc failure.
795 * 2. It may change skb pointers.
796 *
797 * It is pretty complicated. Luckily, it is called only in exceptional cases.
798 */
799 unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta)
800 {
801 /* If skb has not enough free space at tail, get new one
802 * plus 128 bytes for future expansions. If we have enough
803 * room at tail, reallocate without expansion only if skb is cloned.
804 */
805 int i, k, eat = (skb->tail + delta) - skb->end;
807 if (eat > 0 || skb_cloned(skb)) {
808 if (pskb_expand_head(skb, 0, eat > 0 ? eat + 128 : 0,
809 GFP_ATOMIC))
810 return NULL;
811 }
813 if (skb_copy_bits(skb, skb_headlen(skb), skb->tail, delta))
814 BUG();
816 /* Optimization: no fragments, no reasons to preestimate
817 * size of pulled pages. Superb.
818 */
819 if (!skb_shinfo(skb)->frag_list)
820 goto pull_pages;
822 /* Estimate size of pulled pages. */
823 eat = delta;
824 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
825 if (skb_shinfo(skb)->frags[i].size >= eat)
826 goto pull_pages;
827 eat -= skb_shinfo(skb)->frags[i].size;
828 }
830 /* If we need update frag list, we are in troubles.
831 * Certainly, it possible to add an offset to skb data,
832 * but taking into account that pulling is expected to
833 * be very rare operation, it is worth to fight against
834 * further bloating skb head and crucify ourselves here instead.
835 * Pure masohism, indeed. 8)8)
836 */
837 if (eat) {
838 struct sk_buff *list = skb_shinfo(skb)->frag_list;
839 struct sk_buff *clone = NULL;
840 struct sk_buff *insp = NULL;
842 do {
843 if (!list)
844 BUG();
846 if (list->len <= eat) {
847 /* Eaten as whole. */
848 eat -= list->len;
849 list = list->next;
850 insp = list;
851 } else {
852 /* Eaten partially. */
854 if (skb_shared(list)) {
855 /* Sucks! We need to fork list. :-( */
856 clone = skb_clone(list, GFP_ATOMIC);
857 if (!clone)
858 return NULL;
859 insp = list->next;
860 list = clone;
861 } else {
862 /* This may be pulled without
863 * problems. */
864 insp = list;
865 }
866 if (!pskb_pull(list, eat)) {
867 if (clone)
868 kfree_skb(clone);
869 return NULL;
870 }
871 break;
872 }
873 } while (eat);
875 /* Free pulled out fragments. */
876 while ((list = skb_shinfo(skb)->frag_list) != insp) {
877 skb_shinfo(skb)->frag_list = list->next;
878 kfree_skb(list);
879 }
880 /* And insert new clone at head. */
881 if (clone) {
882 clone->next = list;
883 skb_shinfo(skb)->frag_list = clone;
884 }
885 }
886 /* Success! Now we may commit changes to skb data. */
888 pull_pages:
889 eat = delta;
890 k = 0;
891 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
892 if (skb_shinfo(skb)->frags[i].size <= eat) {
893 put_page(skb_shinfo(skb)->frags[i].page);
894 eat -= skb_shinfo(skb)->frags[i].size;
895 } else {
896 skb_shinfo(skb)->frags[k] = skb_shinfo(skb)->frags[i];
897 if (eat) {
898 skb_shinfo(skb)->frags[k].page_offset += eat;
899 skb_shinfo(skb)->frags[k].size -= eat;
900 eat = 0;
901 }
902 k++;
903 }
904 }
905 skb_shinfo(skb)->nr_frags = k;
907 skb->tail += delta;
908 skb->data_len -= delta;
910 return skb->tail;
911 }
913 /* Copy some data bits from skb to kernel buffer. */
915 int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len)
916 {
917 int i, copy;
918 int start = skb_headlen(skb);
920 if (offset > (int)skb->len - len)
921 goto fault;
923 /* Copy header. */
924 if ((copy = start - offset) > 0) {
925 if (copy > len)
926 copy = len;
927 memcpy(to, skb->data + offset, copy);
928 if ((len -= copy) == 0)
929 return 0;
930 offset += copy;
931 to += copy;
932 }
934 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
935 int end;
937 BUG_TRAP(start <= offset + len);
939 end = start + skb_shinfo(skb)->frags[i].size;
940 if ((copy = end - offset) > 0) {
941 u8 *vaddr;
943 if (copy > len)
944 copy = len;
946 vaddr = kmap_skb_frag(&skb_shinfo(skb)->frags[i]);
947 memcpy(to,
948 vaddr + skb_shinfo(skb)->frags[i].page_offset+
949 offset - start, copy);
950 kunmap_skb_frag(vaddr);
952 if ((len -= copy) == 0)
953 return 0;
954 offset += copy;
955 to += copy;
956 }
957 start = end;
958 }
960 if (skb_shinfo(skb)->frag_list) {
961 struct sk_buff *list = skb_shinfo(skb)->frag_list;
963 for (; list; list = list->next) {
964 int end;
966 BUG_TRAP(start <= offset + len);
968 end = start + list->len;
969 if ((copy = end - offset) > 0) {
970 if (copy > len)
971 copy = len;
972 if (skb_copy_bits(list, offset - start,
973 to, copy))
974 goto fault;
975 if ((len -= copy) == 0)
976 return 0;
977 offset += copy;
978 to += copy;
979 }
980 start = end;
981 }
982 }
983 if (!len)
984 return 0;
986 fault:
987 return -EFAULT;
988 }
990 /**
991 * skb_store_bits - store bits from kernel buffer to skb
992 * @skb: destination buffer
993 * @offset: offset in destination
994 * @from: source buffer
995 * @len: number of bytes to copy
996 *
997 * Copy the specified number of bytes from the source buffer to the
998 * destination skb. This function handles all the messy bits of
999 * traversing fragment lists and such.
1000 */
1002 int skb_store_bits(const struct sk_buff *skb, int offset, void *from, int len)
1004 int i, copy;
1005 int start = skb_headlen(skb);
1007 if (offset > (int)skb->len - len)
1008 goto fault;
1010 if ((copy = start - offset) > 0) {
1011 if (copy > len)
1012 copy = len;
1013 memcpy(skb->data + offset, from, copy);
1014 if ((len -= copy) == 0)
1015 return 0;
1016 offset += copy;
1017 from += copy;
1020 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
1021 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
1022 int end;
1024 BUG_TRAP(start <= offset + len);
1026 end = start + frag->size;
1027 if ((copy = end - offset) > 0) {
1028 u8 *vaddr;
1030 if (copy > len)
1031 copy = len;
1033 vaddr = kmap_skb_frag(frag);
1034 memcpy(vaddr + frag->page_offset + offset - start,
1035 from, copy);
1036 kunmap_skb_frag(vaddr);
1038 if ((len -= copy) == 0)
1039 return 0;
1040 offset += copy;
1041 from += copy;
1043 start = end;
1046 if (skb_shinfo(skb)->frag_list) {
1047 struct sk_buff *list = skb_shinfo(skb)->frag_list;
1049 for (; list; list = list->next) {
1050 int end;
1052 BUG_TRAP(start <= offset + len);
1054 end = start + list->len;
1055 if ((copy = end - offset) > 0) {
1056 if (copy > len)
1057 copy = len;
1058 if (skb_store_bits(list, offset - start,
1059 from, copy))
1060 goto fault;
1061 if ((len -= copy) == 0)
1062 return 0;
1063 offset += copy;
1064 from += copy;
1066 start = end;
1069 if (!len)
1070 return 0;
1072 fault:
1073 return -EFAULT;
1076 EXPORT_SYMBOL(skb_store_bits);
1078 /* Checksum skb data. */
1080 unsigned int skb_checksum(const struct sk_buff *skb, int offset,
1081 int len, unsigned int csum)
1083 int start = skb_headlen(skb);
1084 int i, copy = start - offset;
1085 int pos = 0;
1087 /* Checksum header. */
1088 if (copy > 0) {
1089 if (copy > len)
1090 copy = len;
1091 csum = csum_partial(skb->data + offset, copy, csum);
1092 if ((len -= copy) == 0)
1093 return csum;
1094 offset += copy;
1095 pos = copy;
1098 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
1099 int end;
1101 BUG_TRAP(start <= offset + len);
1103 end = start + skb_shinfo(skb)->frags[i].size;
1104 if ((copy = end - offset) > 0) {
1105 unsigned int csum2;
1106 u8 *vaddr;
1107 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
1109 if (copy > len)
1110 copy = len;
1111 vaddr = kmap_skb_frag(frag);
1112 csum2 = csum_partial(vaddr + frag->page_offset +
1113 offset - start, copy, 0);
1114 kunmap_skb_frag(vaddr);
1115 csum = csum_block_add(csum, csum2, pos);
1116 if (!(len -= copy))
1117 return csum;
1118 offset += copy;
1119 pos += copy;
1121 start = end;
1124 if (skb_shinfo(skb)->frag_list) {
1125 struct sk_buff *list = skb_shinfo(skb)->frag_list;
1127 for (; list; list = list->next) {
1128 int end;
1130 BUG_TRAP(start <= offset + len);
1132 end = start + list->len;
1133 if ((copy = end - offset) > 0) {
1134 unsigned int csum2;
1135 if (copy > len)
1136 copy = len;
1137 csum2 = skb_checksum(list, offset - start,
1138 copy, 0);
1139 csum = csum_block_add(csum, csum2, pos);
1140 if ((len -= copy) == 0)
1141 return csum;
1142 offset += copy;
1143 pos += copy;
1145 start = end;
1148 if (len)
1149 BUG();
1151 return csum;
1154 /* Both of above in one bottle. */
1156 unsigned int skb_copy_and_csum_bits(const struct sk_buff *skb, int offset,
1157 u8 *to, int len, unsigned int csum)
1159 int start = skb_headlen(skb);
1160 int i, copy = start - offset;
1161 int pos = 0;
1163 /* Copy header. */
1164 if (copy > 0) {
1165 if (copy > len)
1166 copy = len;
1167 csum = csum_partial_copy_nocheck(skb->data + offset, to,
1168 copy, csum);
1169 if ((len -= copy) == 0)
1170 return csum;
1171 offset += copy;
1172 to += copy;
1173 pos = copy;
1176 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
1177 int end;
1179 BUG_TRAP(start <= offset + len);
1181 end = start + skb_shinfo(skb)->frags[i].size;
1182 if ((copy = end - offset) > 0) {
1183 unsigned int csum2;
1184 u8 *vaddr;
1185 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
1187 if (copy > len)
1188 copy = len;
1189 vaddr = kmap_skb_frag(frag);
1190 csum2 = csum_partial_copy_nocheck(vaddr +
1191 frag->page_offset +
1192 offset - start, to,
1193 copy, 0);
1194 kunmap_skb_frag(vaddr);
1195 csum = csum_block_add(csum, csum2, pos);
1196 if (!(len -= copy))
1197 return csum;
1198 offset += copy;
1199 to += copy;
1200 pos += copy;
1202 start = end;
1205 if (skb_shinfo(skb)->frag_list) {
1206 struct sk_buff *list = skb_shinfo(skb)->frag_list;
1208 for (; list; list = list->next) {
1209 unsigned int csum2;
1210 int end;
1212 BUG_TRAP(start <= offset + len);
1214 end = start + list->len;
1215 if ((copy = end - offset) > 0) {
1216 if (copy > len)
1217 copy = len;
1218 csum2 = skb_copy_and_csum_bits(list,
1219 offset - start,
1220 to, copy, 0);
1221 csum = csum_block_add(csum, csum2, pos);
1222 if ((len -= copy) == 0)
1223 return csum;
1224 offset += copy;
1225 to += copy;
1226 pos += copy;
1228 start = end;
1231 if (len)
1232 BUG();
1233 return csum;
1236 void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
1238 unsigned int csum;
1239 long csstart;
1241 if (skb->ip_summed == CHECKSUM_HW)
1242 csstart = skb->h.raw - skb->data;
1243 else
1244 csstart = skb_headlen(skb);
1246 if (csstart > skb_headlen(skb))
1247 BUG();
1249 memcpy(to, skb->data, csstart);
1251 csum = 0;
1252 if (csstart != skb->len)
1253 csum = skb_copy_and_csum_bits(skb, csstart, to + csstart,
1254 skb->len - csstart, 0);
1256 if (skb->ip_summed == CHECKSUM_HW) {
1257 long csstuff = csstart + skb->csum;
1259 *((unsigned short *)(to + csstuff)) = csum_fold(csum);
1263 /**
1264 * skb_dequeue - remove from the head of the queue
1265 * @list: list to dequeue from
1267 * Remove the head of the list. The list lock is taken so the function
1268 * may be used safely with other locking list functions. The head item is
1269 * returned or %NULL if the list is empty.
1270 */
1272 struct sk_buff *skb_dequeue(struct sk_buff_head *list)
1274 unsigned long flags;
1275 struct sk_buff *result;
1277 spin_lock_irqsave(&list->lock, flags);
1278 result = __skb_dequeue(list);
1279 spin_unlock_irqrestore(&list->lock, flags);
1280 return result;
1283 /**
1284 * skb_dequeue_tail - remove from the tail of the queue
1285 * @list: list to dequeue from
1287 * Remove the tail of the list. The list lock is taken so the function
1288 * may be used safely with other locking list functions. The tail item is
1289 * returned or %NULL if the list is empty.
1290 */
1291 struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list)
1293 unsigned long flags;
1294 struct sk_buff *result;
1296 spin_lock_irqsave(&list->lock, flags);
1297 result = __skb_dequeue_tail(list);
1298 spin_unlock_irqrestore(&list->lock, flags);
1299 return result;
1302 /**
1303 * skb_queue_purge - empty a list
1304 * @list: list to empty
1306 * Delete all buffers on an &sk_buff list. Each buffer is removed from
1307 * the list and one reference dropped. This function takes the list
1308 * lock and is atomic with respect to other list locking functions.
1309 */
1310 void skb_queue_purge(struct sk_buff_head *list)
1312 struct sk_buff *skb;
1313 while ((skb = skb_dequeue(list)) != NULL)
1314 kfree_skb(skb);
1317 /**
1318 * skb_queue_head - queue a buffer at the list head
1319 * @list: list to use
1320 * @newsk: buffer to queue
1322 * Queue a buffer at the start of the list. This function takes the
1323 * list lock and can be used safely with other locking &sk_buff functions
1324 * safely.
1326 * A buffer cannot be placed on two lists at the same time.
1327 */
1328 void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk)
1330 unsigned long flags;
1332 spin_lock_irqsave(&list->lock, flags);
1333 __skb_queue_head(list, newsk);
1334 spin_unlock_irqrestore(&list->lock, flags);
1337 /**
1338 * skb_queue_tail - queue a buffer at the list tail
1339 * @list: list to use
1340 * @newsk: buffer to queue
1342 * Queue a buffer at the tail of the list. This function takes the
1343 * list lock and can be used safely with other locking &sk_buff functions
1344 * safely.
1346 * A buffer cannot be placed on two lists at the same time.
1347 */
1348 void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk)
1350 unsigned long flags;
1352 spin_lock_irqsave(&list->lock, flags);
1353 __skb_queue_tail(list, newsk);
1354 spin_unlock_irqrestore(&list->lock, flags);
1356 /**
1357 * skb_unlink - remove a buffer from a list
1358 * @skb: buffer to remove
1360 * Place a packet after a given packet in a list. The list locks are taken
1361 * and this function is atomic with respect to other list locked calls
1363 * Works even without knowing the list it is sitting on, which can be
1364 * handy at times. It also means that THE LIST MUST EXIST when you
1365 * unlink. Thus a list must have its contents unlinked before it is
1366 * destroyed.
1367 */
1368 void skb_unlink(struct sk_buff *skb)
1370 struct sk_buff_head *list = skb->list;
1372 if (list) {
1373 unsigned long flags;
1375 spin_lock_irqsave(&list->lock, flags);
1376 if (skb->list == list)
1377 __skb_unlink(skb, skb->list);
1378 spin_unlock_irqrestore(&list->lock, flags);
1383 /**
1384 * skb_append - append a buffer
1385 * @old: buffer to insert after
1386 * @newsk: buffer to insert
1388 * Place a packet after a given packet in a list. The list locks are taken
1389 * and this function is atomic with respect to other list locked calls.
1390 * A buffer cannot be placed on two lists at the same time.
1391 */
1393 void skb_append(struct sk_buff *old, struct sk_buff *newsk)
1395 unsigned long flags;
1397 spin_lock_irqsave(&old->list->lock, flags);
1398 __skb_append(old, newsk);
1399 spin_unlock_irqrestore(&old->list->lock, flags);
1403 /**
1404 * skb_insert - insert a buffer
1405 * @old: buffer to insert before
1406 * @newsk: buffer to insert
1408 * Place a packet before a given packet in a list. The list locks are taken
1409 * and this function is atomic with respect to other list locked calls
1410 * A buffer cannot be placed on two lists at the same time.
1411 */
1413 void skb_insert(struct sk_buff *old, struct sk_buff *newsk)
1415 unsigned long flags;
1417 spin_lock_irqsave(&old->list->lock, flags);
1418 __skb_insert(newsk, old->prev, old, old->list);
1419 spin_unlock_irqrestore(&old->list->lock, flags);
1422 #if 0
1423 /*
1424 * Tune the memory allocator for a new MTU size.
1425 */
1426 void skb_add_mtu(int mtu)
1428 /* Must match allocation in alloc_skb */
1429 mtu = SKB_DATA_ALIGN(mtu) + sizeof(struct skb_shared_info);
1431 kmem_add_cache_size(mtu);
1433 #endif
1435 static inline void skb_split_inside_header(struct sk_buff *skb,
1436 struct sk_buff* skb1,
1437 const u32 len, const int pos)
1439 int i;
1441 memcpy(skb_put(skb1, pos - len), skb->data + len, pos - len);
1443 /* And move data appendix as is. */
1444 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
1445 skb_shinfo(skb1)->frags[i] = skb_shinfo(skb)->frags[i];
1447 skb_shinfo(skb1)->nr_frags = skb_shinfo(skb)->nr_frags;
1448 skb_shinfo(skb)->nr_frags = 0;
1449 skb1->data_len = skb->data_len;
1450 skb1->len += skb1->data_len;
1451 skb->data_len = 0;
1452 skb->len = len;
1453 skb->tail = skb->data + len;
1456 static inline void skb_split_no_header(struct sk_buff *skb,
1457 struct sk_buff* skb1,
1458 const u32 len, int pos)
1460 int i, k = 0;
1461 const int nfrags = skb_shinfo(skb)->nr_frags;
1463 skb_shinfo(skb)->nr_frags = 0;
1464 skb1->len = skb1->data_len = skb->len - len;
1465 skb->len = len;
1466 skb->data_len = len - pos;
1468 for (i = 0; i < nfrags; i++) {
1469 int size = skb_shinfo(skb)->frags[i].size;
1471 if (pos + size > len) {
1472 skb_shinfo(skb1)->frags[k] = skb_shinfo(skb)->frags[i];
1474 if (pos < len) {
1475 /* Split frag.
1476 * We have two variants in this case:
1477 * 1. Move all the frag to the second
1478 * part, if it is possible. F.e.
1479 * this approach is mandatory for TUX,
1480 * where splitting is expensive.
1481 * 2. Split is accurately. We make this.
1482 */
1483 get_page(skb_shinfo(skb)->frags[i].page);
1484 skb_shinfo(skb1)->frags[0].page_offset += len - pos;
1485 skb_shinfo(skb1)->frags[0].size -= len - pos;
1486 skb_shinfo(skb)->frags[i].size = len - pos;
1487 skb_shinfo(skb)->nr_frags++;
1489 k++;
1490 } else
1491 skb_shinfo(skb)->nr_frags++;
1492 pos += size;
1494 skb_shinfo(skb1)->nr_frags = k;
1497 /**
1498 * skb_split - Split fragmented skb to two parts at length len.
1499 * @skb: the buffer to split
1500 * @skb1: the buffer to receive the second part
1501 * @len: new length for skb
1502 */
1503 void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len)
1505 int pos = skb_headlen(skb);
1507 if (len < pos) /* Split line is inside header. */
1508 skb_split_inside_header(skb, skb1, len, pos);
1509 else /* Second chunk has no header, nothing to copy. */
1510 skb_split_no_header(skb, skb1, len, pos);
1513 void __init skb_init(void)
1515 skbuff_head_cache = kmem_cache_create("skbuff_head_cache",
1516 sizeof(struct sk_buff),
1517 0,
1518 SLAB_HWCACHE_ALIGN,
1519 NULL, NULL);
1520 if (!skbuff_head_cache)
1521 panic("cannot create skbuff cache");
1524 EXPORT_SYMBOL(___pskb_trim);
1525 EXPORT_SYMBOL(__kfree_skb);
1526 EXPORT_SYMBOL(__pskb_pull_tail);
1527 EXPORT_SYMBOL(alloc_skb);
1528 EXPORT_SYMBOL(pskb_copy);
1529 EXPORT_SYMBOL(pskb_expand_head);
1530 EXPORT_SYMBOL(skb_checksum);
1531 EXPORT_SYMBOL(skb_clone);
1532 EXPORT_SYMBOL(skb_clone_fraglist);
1533 EXPORT_SYMBOL(skb_copy);
1534 EXPORT_SYMBOL(skb_copy_and_csum_bits);
1535 EXPORT_SYMBOL(skb_copy_and_csum_dev);
1536 EXPORT_SYMBOL(skb_copy_bits);
1537 EXPORT_SYMBOL(skb_copy_expand);
1538 EXPORT_SYMBOL(skb_over_panic);
1539 EXPORT_SYMBOL(skb_pad);
1540 EXPORT_SYMBOL(skb_realloc_headroom);
1541 EXPORT_SYMBOL(skb_under_panic);
1542 EXPORT_SYMBOL(skb_dequeue);
1543 EXPORT_SYMBOL(skb_dequeue_tail);
1544 EXPORT_SYMBOL(skb_insert);
1545 EXPORT_SYMBOL(skb_queue_purge);
1546 EXPORT_SYMBOL(skb_queue_head);
1547 EXPORT_SYMBOL(skb_queue_tail);
1548 EXPORT_SYMBOL(skb_unlink);
1549 EXPORT_SYMBOL(skb_append);
1550 EXPORT_SYMBOL(skb_split);