2 * Routines having to do with the 'struct sk_buff' memory handlers.
4 * Authors: Alan Cox <iiitac@pyr.swan.ac.uk>
5 * Florian La Roche <rzsfl@rz.uni-sb.de>
7 * Version: $Id: skbuff.c,v 1.90 2001/11/07 05:56:19 davem Exp $
10 * Alan Cox : Fixed the worst of the load
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
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).
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.
38 * The functions in this file will not compile correctly with gcc 2.4.x
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>
47 #include <linux/interrupt.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>
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>
65 #include <net/checksum.h>
68 #include <asm/uaccess.h>
69 #include <asm/system.h>
71 static kmem_cache_t *skbuff_head_cache __read_mostly;
72 static kmem_cache_t *skbuff_fclone_cache __read_mostly;
75 * Keep out-of-line to prevent kernel bloat.
76 * __builtin_return_address is not used because it is not always
81 * skb_over_panic - private function
86 * Out of line support code for skb_put(). Not user callable.
88 void skb_over_panic(struct sk_buff *skb, int sz, void *here)
90 printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p "
91 "data:%p tail:%p end:%p dev:%s\n",
92 here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end,
93 skb->dev ? skb->dev->name : "<NULL>");
98 * skb_under_panic - private function
103 * Out of line support code for skb_push(). Not user callable.
106 void skb_under_panic(struct sk_buff *skb, int sz, void *here)
108 printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p "
109 "data:%p tail:%p end:%p dev:%s\n",
110 here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end,
111 skb->dev ? skb->dev->name : "<NULL>");
115 void skb_truesize_bug(struct sk_buff *skb)
117 printk(KERN_ERR "SKB BUG: Invalid truesize (%u) "
118 "len=%u, sizeof(sk_buff)=%Zd\n",
119 skb->truesize, skb->len, sizeof(struct sk_buff));
121 EXPORT_SYMBOL(skb_truesize_bug);
123 /* Allocate a new skbuff. We do this ourselves so we can fill in a few
124 * 'private' fields and also do memory statistics to find all the
130 * __alloc_skb - allocate a network buffer
131 * @size: size to allocate
132 * @gfp_mask: allocation mask
133 * @fclone: allocate from fclone cache instead of head cache
134 * and allocate a cloned (child) skb
136 * Allocate a new &sk_buff. The returned buffer has no headroom and a
137 * tail room of size bytes. The object has a reference count of one.
138 * The return is the buffer. On a failure the return is %NULL.
140 * Buffers may only be allocated from interrupts using a @gfp_mask of
143 struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
147 struct skb_shared_info *shinfo;
151 cache = fclone ? skbuff_fclone_cache : skbuff_head_cache;
154 skb = kmem_cache_alloc(cache, gfp_mask & ~__GFP_DMA);
158 /* Get the DATA. Size must match skb_add_mtu(). */
159 size = SKB_DATA_ALIGN(size);
160 data = ____kmalloc(size + sizeof(struct skb_shared_info), gfp_mask);
164 memset(skb, 0, offsetof(struct sk_buff, truesize));
165 skb->truesize = size + sizeof(struct sk_buff);
166 atomic_set(&skb->users, 1);
170 skb->end = data + size;
171 /* make sure we initialize shinfo sequentially */
172 shinfo = skb_shinfo(skb);
173 atomic_set(&shinfo->dataref, 1);
174 shinfo->nr_frags = 0;
175 shinfo->tso_size = 0;
176 shinfo->tso_segs = 0;
177 shinfo->ufo_size = 0;
178 shinfo->ip6_frag_id = 0;
179 shinfo->frag_list = NULL;
182 struct sk_buff *child = skb + 1;
183 atomic_t *fclone_ref = (atomic_t *) (child + 1);
185 skb->fclone = SKB_FCLONE_ORIG;
186 atomic_set(fclone_ref, 1);
188 child->fclone = SKB_FCLONE_UNAVAILABLE;
193 kmem_cache_free(cache, skb);
199 * alloc_skb_from_cache - allocate a network buffer
200 * @cp: kmem_cache from which to allocate the data area
201 * (object size must be big enough for @size bytes + skb overheads)
202 * @size: size to allocate
203 * @gfp_mask: allocation mask
205 * Allocate a new &sk_buff. The returned buffer has no headroom and
206 * tail room of size bytes. The object has a reference count of one.
207 * The return is the buffer. On a failure the return is %NULL.
209 * Buffers may only be allocated from interrupts using a @gfp_mask of
212 struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
220 skb = kmem_cache_alloc(skbuff_head_cache,
221 gfp_mask & ~__GFP_DMA);
226 size = SKB_DATA_ALIGN(size);
227 data = kmem_cache_alloc(cp, gfp_mask);
231 memset(skb, 0, offsetof(struct sk_buff, truesize));
232 skb->truesize = size + sizeof(struct sk_buff);
233 atomic_set(&skb->users, 1);
237 skb->end = data + size;
239 atomic_set(&(skb_shinfo(skb)->dataref), 1);
240 skb_shinfo(skb)->nr_frags = 0;
241 skb_shinfo(skb)->tso_size = 0;
242 skb_shinfo(skb)->tso_segs = 0;
243 skb_shinfo(skb)->frag_list = NULL;
247 kmem_cache_free(skbuff_head_cache, skb);
253 static void skb_drop_fraglist(struct sk_buff *skb)
255 struct sk_buff *list = skb_shinfo(skb)->frag_list;
257 skb_shinfo(skb)->frag_list = NULL;
260 struct sk_buff *this = list;
266 static void skb_clone_fraglist(struct sk_buff *skb)
268 struct sk_buff *list;
270 for (list = skb_shinfo(skb)->frag_list; list; list = list->next)
274 void skb_release_data(struct sk_buff *skb)
277 !atomic_sub_return(skb->nohdr ? (1 << SKB_DATAREF_SHIFT) + 1 : 1,
278 &skb_shinfo(skb)->dataref)) {
279 if (skb_shinfo(skb)->nr_frags) {
281 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
282 put_page(skb_shinfo(skb)->frags[i].page);
285 if (skb_shinfo(skb)->frag_list)
286 skb_drop_fraglist(skb);
293 * Free an skbuff by memory without cleaning the state.
295 void kfree_skbmem(struct sk_buff *skb)
297 struct sk_buff *other;
298 atomic_t *fclone_ref;
300 skb_release_data(skb);
301 switch (skb->fclone) {
302 case SKB_FCLONE_UNAVAILABLE:
303 kmem_cache_free(skbuff_head_cache, skb);
306 case SKB_FCLONE_ORIG:
307 fclone_ref = (atomic_t *) (skb + 2);
308 if (atomic_dec_and_test(fclone_ref))
309 kmem_cache_free(skbuff_fclone_cache, skb);
312 case SKB_FCLONE_CLONE:
313 fclone_ref = (atomic_t *) (skb + 1);
316 /* The clone portion is available for
317 * fast-cloning again.
319 skb->fclone = SKB_FCLONE_UNAVAILABLE;
321 if (atomic_dec_and_test(fclone_ref))
322 kmem_cache_free(skbuff_fclone_cache, other);
328 * __kfree_skb - private function
331 * Free an sk_buff. Release anything attached to the buffer.
332 * Clean the state. This is an internal helper function. Users should
333 * always call kfree_skb
336 void __kfree_skb(struct sk_buff *skb)
338 dst_release(skb->dst);
340 secpath_put(skb->sp);
342 if (skb->destructor) {
344 skb->destructor(skb);
346 #ifdef CONFIG_NETFILTER
347 nf_conntrack_put(skb->nfct);
348 #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
349 nf_conntrack_put_reasm(skb->nfct_reasm);
351 #ifdef CONFIG_BRIDGE_NETFILTER
352 nf_bridge_put(skb->nf_bridge);
355 /* XXX: IS this still necessary? - JHS */
356 #ifdef CONFIG_NET_SCHED
358 #ifdef CONFIG_NET_CLS_ACT
367 * kfree_skb - free an sk_buff
368 * @skb: buffer to free
370 * Drop a reference to the buffer and free it if the usage count has
373 void kfree_skb(struct sk_buff *skb)
377 if (likely(atomic_read(&skb->users) == 1))
379 else if (likely(!atomic_dec_and_test(&skb->users)))
385 * skb_clone - duplicate an sk_buff
386 * @skb: buffer to clone
387 * @gfp_mask: allocation priority
389 * Duplicate an &sk_buff. The new one is not owned by a socket. Both
390 * copies share the same packet data but not structure. The new
391 * buffer has a reference count of 1. If the allocation fails the
392 * function returns %NULL otherwise the new buffer is returned.
394 * If this function is called from an interrupt gfp_mask() must be
398 struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
403 if (skb->fclone == SKB_FCLONE_ORIG &&
404 n->fclone == SKB_FCLONE_UNAVAILABLE) {
405 atomic_t *fclone_ref = (atomic_t *) (n + 1);
406 n->fclone = SKB_FCLONE_CLONE;
407 atomic_inc(fclone_ref);
409 n = kmem_cache_alloc(skbuff_head_cache, gfp_mask);
412 n->fclone = SKB_FCLONE_UNAVAILABLE;
415 #define C(x) n->x = skb->x
417 n->next = n->prev = NULL;
428 secpath_get(skb->sp);
430 memcpy(n->cb, skb->cb, sizeof(skb->cb));
440 #if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
444 n->destructor = NULL;
445 #ifdef CONFIG_NETFILTER
448 nf_conntrack_get(skb->nfct);
450 #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
452 nf_conntrack_get_reasm(skb->nfct_reasm);
454 #ifdef CONFIG_BRIDGE_NETFILTER
456 nf_bridge_get(skb->nf_bridge);
458 #endif /*CONFIG_NETFILTER*/
459 #ifdef CONFIG_NET_SCHED
461 #ifdef CONFIG_NET_CLS_ACT
462 n->tc_verd = SET_TC_VERD(skb->tc_verd,0);
463 n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd);
464 n->tc_verd = CLR_TC_MUNGED(n->tc_verd);
467 skb_copy_secmark(n, skb);
470 atomic_set(&n->users, 1);
476 atomic_inc(&(skb_shinfo(skb)->dataref));
482 static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
485 * Shift between the two data areas in bytes
487 unsigned long offset = new->data - old->data;
491 new->priority = old->priority;
492 new->protocol = old->protocol;
493 new->dst = dst_clone(old->dst);
495 new->sp = secpath_get(old->sp);
497 new->h.raw = old->h.raw + offset;
498 new->nh.raw = old->nh.raw + offset;
499 new->mac.raw = old->mac.raw + offset;
500 memcpy(new->cb, old->cb, sizeof(old->cb));
501 new->local_df = old->local_df;
502 new->fclone = SKB_FCLONE_UNAVAILABLE;
503 new->pkt_type = old->pkt_type;
504 new->tstamp = old->tstamp;
505 new->destructor = NULL;
506 #ifdef CONFIG_NETFILTER
507 new->nfmark = old->nfmark;
508 new->nfct = old->nfct;
509 nf_conntrack_get(old->nfct);
510 new->nfctinfo = old->nfctinfo;
511 #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
512 new->nfct_reasm = old->nfct_reasm;
513 nf_conntrack_get_reasm(old->nfct_reasm);
515 #if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
516 new->ipvs_property = old->ipvs_property;
518 #ifdef CONFIG_BRIDGE_NETFILTER
519 new->nf_bridge = old->nf_bridge;
520 nf_bridge_get(old->nf_bridge);
523 #ifdef CONFIG_NET_SCHED
524 #ifdef CONFIG_NET_CLS_ACT
525 new->tc_verd = old->tc_verd;
527 new->tc_index = old->tc_index;
529 skb_copy_secmark(new, old);
530 atomic_set(&new->users, 1);
531 skb_shinfo(new)->tso_size = skb_shinfo(old)->tso_size;
532 skb_shinfo(new)->tso_segs = skb_shinfo(old)->tso_segs;
536 * skb_copy - create private copy of an sk_buff
537 * @skb: buffer to copy
538 * @gfp_mask: allocation priority
540 * Make a copy of both an &sk_buff and its data. This is used when the
541 * caller wishes to modify the data and needs a private copy of the
542 * data to alter. Returns %NULL on failure or the pointer to the buffer
543 * on success. The returned buffer has a reference count of 1.
545 * As by-product this function converts non-linear &sk_buff to linear
546 * one, so that &sk_buff becomes completely private and caller is allowed
547 * to modify all the data of returned buffer. This means that this
548 * function is not recommended for use in circumstances when only
549 * header is going to be modified. Use pskb_copy() instead.
552 struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask)
554 int headerlen = skb->data - skb->head;
556 * Allocate the copy buffer
558 struct sk_buff *n = alloc_skb(skb->end - skb->head + skb->data_len,
563 /* Set the data pointer */
564 skb_reserve(n, headerlen);
565 /* Set the tail pointer and length */
566 skb_put(n, skb->len);
568 n->ip_summed = skb->ip_summed;
570 if (skb_copy_bits(skb, -headerlen, n->head, headerlen + skb->len))
573 copy_skb_header(n, skb);
579 * pskb_copy - create copy of an sk_buff with private head.
580 * @skb: buffer to copy
581 * @gfp_mask: allocation priority
583 * Make a copy of both an &sk_buff and part of its data, located
584 * in header. Fragmented data remain shared. This is used when
585 * the caller wishes to modify only header of &sk_buff and needs
586 * private copy of the header to alter. Returns %NULL on failure
587 * or the pointer to the buffer on success.
588 * The returned buffer has a reference count of 1.
591 struct sk_buff *pskb_copy(struct sk_buff *skb, gfp_t gfp_mask)
594 * Allocate the copy buffer
596 struct sk_buff *n = alloc_skb(skb->end - skb->head, gfp_mask);
601 /* Set the data pointer */
602 skb_reserve(n, skb->data - skb->head);
603 /* Set the tail pointer and length */
604 skb_put(n, skb_headlen(skb));
606 memcpy(n->data, skb->data, n->len);
608 n->ip_summed = skb->ip_summed;
610 n->data_len = skb->data_len;
613 if (skb_shinfo(skb)->nr_frags) {
616 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
617 skb_shinfo(n)->frags[i] = skb_shinfo(skb)->frags[i];
618 get_page(skb_shinfo(n)->frags[i].page);
620 skb_shinfo(n)->nr_frags = i;
623 if (skb_shinfo(skb)->frag_list) {
624 skb_shinfo(n)->frag_list = skb_shinfo(skb)->frag_list;
625 skb_clone_fraglist(n);
628 copy_skb_header(n, skb);
634 * pskb_expand_head - reallocate header of &sk_buff
635 * @skb: buffer to reallocate
636 * @nhead: room to add at head
637 * @ntail: room to add at tail
638 * @gfp_mask: allocation priority
640 * Expands (or creates identical copy, if &nhead and &ntail are zero)
641 * header of skb. &sk_buff itself is not changed. &sk_buff MUST have
642 * reference count of 1. Returns zero in the case of success or error,
643 * if expansion failed. In the last case, &sk_buff is not changed.
645 * All the pointers pointing into skb header may change and must be
646 * reloaded after call to this function.
649 int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
654 int size = nhead + (skb->end - skb->head) + ntail;
660 size = SKB_DATA_ALIGN(size);
662 data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask);
666 /* Copy only real data... and, alas, header. This should be
667 * optimized for the cases when header is void. */
668 memcpy(data + nhead, skb->head, skb->tail - skb->head);
669 memcpy(data + size, skb->end, sizeof(struct skb_shared_info));
671 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
672 get_page(skb_shinfo(skb)->frags[i].page);
674 if (skb_shinfo(skb)->frag_list)
675 skb_clone_fraglist(skb);
677 skb_release_data(skb);
679 off = (data + nhead) - skb->head;
682 skb->end = data + size;
690 atomic_set(&skb_shinfo(skb)->dataref, 1);
697 /* Make private copy of skb with writable head and some headroom */
699 struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, unsigned int headroom)
701 struct sk_buff *skb2;
702 int delta = headroom - skb_headroom(skb);
705 skb2 = pskb_copy(skb, GFP_ATOMIC);
707 skb2 = skb_clone(skb, GFP_ATOMIC);
708 if (skb2 && pskb_expand_head(skb2, SKB_DATA_ALIGN(delta), 0,
719 * skb_copy_expand - copy and expand sk_buff
720 * @skb: buffer to copy
721 * @newheadroom: new free bytes at head
722 * @newtailroom: new free bytes at tail
723 * @gfp_mask: allocation priority
725 * Make a copy of both an &sk_buff and its data and while doing so
726 * allocate additional space.
728 * This is used when the caller wishes to modify the data and needs a
729 * private copy of the data to alter as well as more space for new fields.
730 * Returns %NULL on failure or the pointer to the buffer
731 * on success. The returned buffer has a reference count of 1.
733 * You must pass %GFP_ATOMIC as the allocation priority if this function
734 * is called from an interrupt.
736 * BUG ALERT: ip_summed is not copied. Why does this work? Is it used
737 * only by netfilter in the cases when checksum is recalculated? --ANK
739 struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
740 int newheadroom, int newtailroom,
744 * Allocate the copy buffer
746 struct sk_buff *n = alloc_skb(newheadroom + skb->len + newtailroom,
748 int head_copy_len, head_copy_off;
753 skb_reserve(n, newheadroom);
755 /* Set the tail pointer and length */
756 skb_put(n, skb->len);
758 head_copy_len = skb_headroom(skb);
760 if (newheadroom <= head_copy_len)
761 head_copy_len = newheadroom;
763 head_copy_off = newheadroom - head_copy_len;
765 /* Copy the linear header and data. */
766 if (skb_copy_bits(skb, -head_copy_len, n->head + head_copy_off,
767 skb->len + head_copy_len))
770 copy_skb_header(n, skb);
776 * skb_pad - zero pad the tail of an skb
777 * @skb: buffer to pad
780 * Ensure that a buffer is followed by a padding area that is zero
781 * filled. Used by network drivers which may DMA or transfer data
782 * beyond the buffer end onto the wire.
784 * May return error in out of memory cases. The skb is freed on error.
787 int skb_pad(struct sk_buff *skb, int pad)
792 /* If the skbuff is non linear tailroom is always zero.. */
793 if (!skb_cloned(skb) && skb_tailroom(skb) >= pad) {
794 memset(skb->data+skb->len, 0, pad);
798 ntail = skb->data_len + pad - (skb->end - skb->tail);
799 if (likely(skb_cloned(skb) || ntail > 0)) {
800 err = pskb_expand_head(skb, 0, ntail, GFP_ATOMIC);
805 /* FIXME: The use of this function with non-linear skb's really needs
808 err = skb_linearize(skb);
812 memset(skb->data + skb->len, 0, pad);
820 /* Trims skb to length len. It can change skb pointers.
823 int ___pskb_trim(struct sk_buff *skb, unsigned int len)
825 int offset = skb_headlen(skb);
826 int nfrags = skb_shinfo(skb)->nr_frags;
829 for (i = 0; i < nfrags; i++) {
830 int end = offset + skb_shinfo(skb)->frags[i].size;
832 if (skb_cloned(skb)) {
833 if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
837 put_page(skb_shinfo(skb)->frags[i].page);
838 skb_shinfo(skb)->nr_frags--;
840 skb_shinfo(skb)->frags[i].size = len - offset;
847 skb->data_len -= skb->len - len;
850 if (len <= skb_headlen(skb)) {
853 skb->tail = skb->data + len;
854 if (skb_shinfo(skb)->frag_list && !skb_cloned(skb))
855 skb_drop_fraglist(skb);
857 skb->data_len -= skb->len - len;
866 * __pskb_pull_tail - advance tail of skb header
867 * @skb: buffer to reallocate
868 * @delta: number of bytes to advance tail
870 * The function makes a sense only on a fragmented &sk_buff,
871 * it expands header moving its tail forward and copying necessary
872 * data from fragmented part.
874 * &sk_buff MUST have reference count of 1.
876 * Returns %NULL (and &sk_buff does not change) if pull failed
877 * or value of new tail of skb in the case of success.
879 * All the pointers pointing into skb header may change and must be
880 * reloaded after call to this function.
883 /* Moves tail of skb head forward, copying data from fragmented part,
884 * when it is necessary.
885 * 1. It may fail due to malloc failure.
886 * 2. It may change skb pointers.
888 * It is pretty complicated. Luckily, it is called only in exceptional cases.
890 unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta)
892 /* If skb has not enough free space at tail, get new one
893 * plus 128 bytes for future expansions. If we have enough
894 * room at tail, reallocate without expansion only if skb is cloned.
896 int i, k, eat = (skb->tail + delta) - skb->end;
898 if (eat > 0 || skb_cloned(skb)) {
899 if (pskb_expand_head(skb, 0, eat > 0 ? eat + 128 : 0,
904 if (skb_copy_bits(skb, skb_headlen(skb), skb->tail, delta))
907 /* Optimization: no fragments, no reasons to preestimate
908 * size of pulled pages. Superb.
910 if (!skb_shinfo(skb)->frag_list)
913 /* Estimate size of pulled pages. */
915 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
916 if (skb_shinfo(skb)->frags[i].size >= eat)
918 eat -= skb_shinfo(skb)->frags[i].size;
921 /* If we need update frag list, we are in troubles.
922 * Certainly, it possible to add an offset to skb data,
923 * but taking into account that pulling is expected to
924 * be very rare operation, it is worth to fight against
925 * further bloating skb head and crucify ourselves here instead.
926 * Pure masohism, indeed. 8)8)
929 struct sk_buff *list = skb_shinfo(skb)->frag_list;
930 struct sk_buff *clone = NULL;
931 struct sk_buff *insp = NULL;
936 if (list->len <= eat) {
937 /* Eaten as whole. */
942 /* Eaten partially. */
944 if (skb_shared(list)) {
945 /* Sucks! We need to fork list. :-( */
946 clone = skb_clone(list, GFP_ATOMIC);
952 /* This may be pulled without
956 if (!pskb_pull(list, eat)) {
965 /* Free pulled out fragments. */
966 while ((list = skb_shinfo(skb)->frag_list) != insp) {
967 skb_shinfo(skb)->frag_list = list->next;
970 /* And insert new clone at head. */
973 skb_shinfo(skb)->frag_list = clone;
976 /* Success! Now we may commit changes to skb data. */
981 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
982 if (skb_shinfo(skb)->frags[i].size <= eat) {
983 put_page(skb_shinfo(skb)->frags[i].page);
984 eat -= skb_shinfo(skb)->frags[i].size;
986 skb_shinfo(skb)->frags[k] = skb_shinfo(skb)->frags[i];
988 skb_shinfo(skb)->frags[k].page_offset += eat;
989 skb_shinfo(skb)->frags[k].size -= eat;
995 skb_shinfo(skb)->nr_frags = k;
998 skb->data_len -= delta;
1003 /* Copy some data bits from skb to kernel buffer. */
1005 int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len)
1008 int start = skb_headlen(skb);
1010 if (offset > (int)skb->len - len)
1014 if ((copy = start - offset) > 0) {
1017 memcpy(to, skb->data + offset, copy);
1018 if ((len -= copy) == 0)
1024 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
1027 BUG_TRAP(start <= offset + len);
1029 end = start + skb_shinfo(skb)->frags[i].size;
1030 if ((copy = end - offset) > 0) {
1036 vaddr = kmap_skb_frag(&skb_shinfo(skb)->frags[i]);
1038 vaddr + skb_shinfo(skb)->frags[i].page_offset+
1039 offset - start, copy);
1040 kunmap_skb_frag(vaddr);
1042 if ((len -= copy) == 0)
1050 if (skb_shinfo(skb)->frag_list) {
1051 struct sk_buff *list = skb_shinfo(skb)->frag_list;
1053 for (; list; list = list->next) {
1056 BUG_TRAP(start <= offset + len);
1058 end = start + list->len;
1059 if ((copy = end - offset) > 0) {
1062 if (skb_copy_bits(list, offset - start,
1065 if ((len -= copy) == 0)
1081 * skb_store_bits - store bits from kernel buffer to skb
1082 * @skb: destination buffer
1083 * @offset: offset in destination
1084 * @from: source buffer
1085 * @len: number of bytes to copy
1087 * Copy the specified number of bytes from the source buffer to the
1088 * destination skb. This function handles all the messy bits of
1089 * traversing fragment lists and such.
1092 int skb_store_bits(const struct sk_buff *skb, int offset, void *from, int len)
1095 int start = skb_headlen(skb);
1097 if (offset > (int)skb->len - len)
1100 if ((copy = start - offset) > 0) {
1103 memcpy(skb->data + offset, from, copy);
1104 if ((len -= copy) == 0)
1110 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
1111 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
1114 BUG_TRAP(start <= offset + len);
1116 end = start + frag->size;
1117 if ((copy = end - offset) > 0) {
1123 vaddr = kmap_skb_frag(frag);
1124 memcpy(vaddr + frag->page_offset + offset - start,
1126 kunmap_skb_frag(vaddr);
1128 if ((len -= copy) == 0)
1136 if (skb_shinfo(skb)->frag_list) {
1137 struct sk_buff *list = skb_shinfo(skb)->frag_list;
1139 for (; list; list = list->next) {
1142 BUG_TRAP(start <= offset + len);
1144 end = start + list->len;
1145 if ((copy = end - offset) > 0) {
1148 if (skb_store_bits(list, offset - start,
1151 if ((len -= copy) == 0)
1166 EXPORT_SYMBOL(skb_store_bits);
1168 /* Checksum skb data. */
1170 unsigned int skb_checksum(const struct sk_buff *skb, int offset,
1171 int len, unsigned int csum)
1173 int start = skb_headlen(skb);
1174 int i, copy = start - offset;
1177 /* Checksum header. */
1181 csum = csum_partial(skb->data + offset, copy, csum);
1182 if ((len -= copy) == 0)
1188 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
1191 BUG_TRAP(start <= offset + len);
1193 end = start + skb_shinfo(skb)->frags[i].size;
1194 if ((copy = end - offset) > 0) {
1197 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
1201 vaddr = kmap_skb_frag(frag);
1202 csum2 = csum_partial(vaddr + frag->page_offset +
1203 offset - start, copy, 0);
1204 kunmap_skb_frag(vaddr);
1205 csum = csum_block_add(csum, csum2, pos);
1214 if (skb_shinfo(skb)->frag_list) {
1215 struct sk_buff *list = skb_shinfo(skb)->frag_list;
1217 for (; list; list = list->next) {
1220 BUG_TRAP(start <= offset + len);
1222 end = start + list->len;
1223 if ((copy = end - offset) > 0) {
1227 csum2 = skb_checksum(list, offset - start,
1229 csum = csum_block_add(csum, csum2, pos);
1230 if ((len -= copy) == 0)
1243 /* Both of above in one bottle. */
1245 unsigned int skb_copy_and_csum_bits(const struct sk_buff *skb, int offset,
1246 u8 *to, int len, unsigned int csum)
1248 int start = skb_headlen(skb);
1249 int i, copy = start - offset;
1256 csum = csum_partial_copy_nocheck(skb->data + offset, to,
1258 if ((len -= copy) == 0)
1265 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
1268 BUG_TRAP(start <= offset + len);
1270 end = start + skb_shinfo(skb)->frags[i].size;
1271 if ((copy = end - offset) > 0) {
1274 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
1278 vaddr = kmap_skb_frag(frag);
1279 csum2 = csum_partial_copy_nocheck(vaddr +
1283 kunmap_skb_frag(vaddr);
1284 csum = csum_block_add(csum, csum2, pos);
1294 if (skb_shinfo(skb)->frag_list) {
1295 struct sk_buff *list = skb_shinfo(skb)->frag_list;
1297 for (; list; list = list->next) {
1301 BUG_TRAP(start <= offset + len);
1303 end = start + list->len;
1304 if ((copy = end - offset) > 0) {
1307 csum2 = skb_copy_and_csum_bits(list,
1310 csum = csum_block_add(csum, csum2, pos);
1311 if ((len -= copy) == 0)
1324 void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
1329 if (skb->ip_summed == CHECKSUM_HW)
1330 csstart = skb->h.raw - skb->data;
1332 csstart = skb_headlen(skb);
1334 BUG_ON(csstart > skb_headlen(skb));
1336 memcpy(to, skb->data, csstart);
1339 if (csstart != skb->len)
1340 csum = skb_copy_and_csum_bits(skb, csstart, to + csstart,
1341 skb->len - csstart, 0);
1343 if (skb->ip_summed == CHECKSUM_HW) {
1344 long csstuff = csstart + skb->csum;
1346 *((unsigned short *)(to + csstuff)) = csum_fold(csum);
1351 * skb_dequeue - remove from the head of the queue
1352 * @list: list to dequeue from
1354 * Remove the head of the list. The list lock is taken so the function
1355 * may be used safely with other locking list functions. The head item is
1356 * returned or %NULL if the list is empty.
1359 struct sk_buff *skb_dequeue(struct sk_buff_head *list)
1361 unsigned long flags;
1362 struct sk_buff *result;
1364 spin_lock_irqsave(&list->lock, flags);
1365 result = __skb_dequeue(list);
1366 spin_unlock_irqrestore(&list->lock, flags);
1371 * skb_dequeue_tail - remove from the tail of the queue
1372 * @list: list to dequeue from
1374 * Remove the tail of the list. The list lock is taken so the function
1375 * may be used safely with other locking list functions. The tail item is
1376 * returned or %NULL if the list is empty.
1378 struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list)
1380 unsigned long flags;
1381 struct sk_buff *result;
1383 spin_lock_irqsave(&list->lock, flags);
1384 result = __skb_dequeue_tail(list);
1385 spin_unlock_irqrestore(&list->lock, flags);
1390 * skb_queue_purge - empty a list
1391 * @list: list to empty
1393 * Delete all buffers on an &sk_buff list. Each buffer is removed from
1394 * the list and one reference dropped. This function takes the list
1395 * lock and is atomic with respect to other list locking functions.
1397 void skb_queue_purge(struct sk_buff_head *list)
1399 struct sk_buff *skb;
1400 while ((skb = skb_dequeue(list)) != NULL)
1405 * skb_queue_head - queue a buffer at the list head
1406 * @list: list to use
1407 * @newsk: buffer to queue
1409 * Queue a buffer at the start of the list. This function takes the
1410 * list lock and can be used safely with other locking &sk_buff functions
1413 * A buffer cannot be placed on two lists at the same time.
1415 void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk)
1417 unsigned long flags;
1419 spin_lock_irqsave(&list->lock, flags);
1420 __skb_queue_head(list, newsk);
1421 spin_unlock_irqrestore(&list->lock, flags);
1425 * skb_queue_tail - queue a buffer at the list tail
1426 * @list: list to use
1427 * @newsk: buffer to queue
1429 * Queue a buffer at the tail of the list. This function takes the
1430 * list lock and can be used safely with other locking &sk_buff functions
1433 * A buffer cannot be placed on two lists at the same time.
1435 void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk)
1437 unsigned long flags;
1439 spin_lock_irqsave(&list->lock, flags);
1440 __skb_queue_tail(list, newsk);
1441 spin_unlock_irqrestore(&list->lock, flags);
1445 * skb_unlink - remove a buffer from a list
1446 * @skb: buffer to remove
1447 * @list: list to use
1449 * Remove a packet from a list. The list locks are taken and this
1450 * function is atomic with respect to other list locked calls
1452 * You must know what list the SKB is on.
1454 void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
1456 unsigned long flags;
1458 spin_lock_irqsave(&list->lock, flags);
1459 __skb_unlink(skb, list);
1460 spin_unlock_irqrestore(&list->lock, flags);
1464 * skb_append - append a buffer
1465 * @old: buffer to insert after
1466 * @newsk: buffer to insert
1467 * @list: list to use
1469 * Place a packet after a given packet in a list. The list locks are taken
1470 * and this function is atomic with respect to other list locked calls.
1471 * A buffer cannot be placed on two lists at the same time.
1473 void skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list)
1475 unsigned long flags;
1477 spin_lock_irqsave(&list->lock, flags);
1478 __skb_append(old, newsk, list);
1479 spin_unlock_irqrestore(&list->lock, flags);
1484 * skb_insert - insert a buffer
1485 * @old: buffer to insert before
1486 * @newsk: buffer to insert
1487 * @list: list to use
1489 * Place a packet before a given packet in a list. The list locks are
1490 * taken and this function is atomic with respect to other list locked
1493 * A buffer cannot be placed on two lists at the same time.
1495 void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list)
1497 unsigned long flags;
1499 spin_lock_irqsave(&list->lock, flags);
1500 __skb_insert(newsk, old->prev, old, list);
1501 spin_unlock_irqrestore(&list->lock, flags);
1506 * Tune the memory allocator for a new MTU size.
1508 void skb_add_mtu(int mtu)
1510 /* Must match allocation in alloc_skb */
1511 mtu = SKB_DATA_ALIGN(mtu) + sizeof(struct skb_shared_info);
1513 kmem_add_cache_size(mtu);
1517 static inline void skb_split_inside_header(struct sk_buff *skb,
1518 struct sk_buff* skb1,
1519 const u32 len, const int pos)
1523 memcpy(skb_put(skb1, pos - len), skb->data + len, pos - len);
1525 /* And move data appendix as is. */
1526 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
1527 skb_shinfo(skb1)->frags[i] = skb_shinfo(skb)->frags[i];
1529 skb_shinfo(skb1)->nr_frags = skb_shinfo(skb)->nr_frags;
1530 skb_shinfo(skb)->nr_frags = 0;
1531 skb1->data_len = skb->data_len;
1532 skb1->len += skb1->data_len;
1535 skb->tail = skb->data + len;
1538 static inline void skb_split_no_header(struct sk_buff *skb,
1539 struct sk_buff* skb1,
1540 const u32 len, int pos)
1543 const int nfrags = skb_shinfo(skb)->nr_frags;
1545 skb_shinfo(skb)->nr_frags = 0;
1546 skb1->len = skb1->data_len = skb->len - len;
1548 skb->data_len = len - pos;
1550 for (i = 0; i < nfrags; i++) {
1551 int size = skb_shinfo(skb)->frags[i].size;
1553 if (pos + size > len) {
1554 skb_shinfo(skb1)->frags[k] = skb_shinfo(skb)->frags[i];
1558 * We have two variants in this case:
1559 * 1. Move all the frag to the second
1560 * part, if it is possible. F.e.
1561 * this approach is mandatory for TUX,
1562 * where splitting is expensive.
1563 * 2. Split is accurately. We make this.
1565 get_page(skb_shinfo(skb)->frags[i].page);
1566 skb_shinfo(skb1)->frags[0].page_offset += len - pos;
1567 skb_shinfo(skb1)->frags[0].size -= len - pos;
1568 skb_shinfo(skb)->frags[i].size = len - pos;
1569 skb_shinfo(skb)->nr_frags++;
1573 skb_shinfo(skb)->nr_frags++;
1576 skb_shinfo(skb1)->nr_frags = k;
1580 * skb_split - Split fragmented skb to two parts at length len.
1581 * @skb: the buffer to split
1582 * @skb1: the buffer to receive the second part
1583 * @len: new length for skb
1585 void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len)
1587 int pos = skb_headlen(skb);
1589 if (len < pos) /* Split line is inside header. */
1590 skb_split_inside_header(skb, skb1, len, pos);
1591 else /* Second chunk has no header, nothing to copy. */
1592 skb_split_no_header(skb, skb1, len, pos);
1596 * skb_prepare_seq_read - Prepare a sequential read of skb data
1597 * @skb: the buffer to read
1598 * @from: lower offset of data to be read
1599 * @to: upper offset of data to be read
1600 * @st: state variable
1602 * Initializes the specified state variable. Must be called before
1603 * invoking skb_seq_read() for the first time.
1605 void skb_prepare_seq_read(struct sk_buff *skb, unsigned int from,
1606 unsigned int to, struct skb_seq_state *st)
1608 st->lower_offset = from;
1609 st->upper_offset = to;
1610 st->root_skb = st->cur_skb = skb;
1611 st->frag_idx = st->stepped_offset = 0;
1612 st->frag_data = NULL;
1616 * skb_seq_read - Sequentially read skb data
1617 * @consumed: number of bytes consumed by the caller so far
1618 * @data: destination pointer for data to be returned
1619 * @st: state variable
1621 * Reads a block of skb data at &consumed relative to the
1622 * lower offset specified to skb_prepare_seq_read(). Assigns
1623 * the head of the data block to &data and returns the length
1624 * of the block or 0 if the end of the skb data or the upper
1625 * offset has been reached.
1627 * The caller is not required to consume all of the data
1628 * returned, i.e. &consumed is typically set to the number
1629 * of bytes already consumed and the next call to
1630 * skb_seq_read() will return the remaining part of the block.
1632 * Note: The size of each block of data returned can be arbitary,
1633 * this limitation is the cost for zerocopy seqeuental
1634 * reads of potentially non linear data.
1636 * Note: Fragment lists within fragments are not implemented
1637 * at the moment, state->root_skb could be replaced with
1638 * a stack for this purpose.
1640 unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
1641 struct skb_seq_state *st)
1643 unsigned int block_limit, abs_offset = consumed + st->lower_offset;
1646 if (unlikely(abs_offset >= st->upper_offset))
1650 block_limit = skb_headlen(st->cur_skb);
1652 if (abs_offset < block_limit) {
1653 *data = st->cur_skb->data + abs_offset;
1654 return block_limit - abs_offset;
1657 if (st->frag_idx == 0 && !st->frag_data)
1658 st->stepped_offset += skb_headlen(st->cur_skb);
1660 while (st->frag_idx < skb_shinfo(st->cur_skb)->nr_frags) {
1661 frag = &skb_shinfo(st->cur_skb)->frags[st->frag_idx];
1662 block_limit = frag->size + st->stepped_offset;
1664 if (abs_offset < block_limit) {
1666 st->frag_data = kmap_skb_frag(frag);
1668 *data = (u8 *) st->frag_data + frag->page_offset +
1669 (abs_offset - st->stepped_offset);
1671 return block_limit - abs_offset;
1674 if (st->frag_data) {
1675 kunmap_skb_frag(st->frag_data);
1676 st->frag_data = NULL;
1680 st->stepped_offset += frag->size;
1683 if (st->cur_skb->next) {
1684 st->cur_skb = st->cur_skb->next;
1687 } else if (st->root_skb == st->cur_skb &&
1688 skb_shinfo(st->root_skb)->frag_list) {
1689 st->cur_skb = skb_shinfo(st->root_skb)->frag_list;
1697 * skb_abort_seq_read - Abort a sequential read of skb data
1698 * @st: state variable
1700 * Must be called if skb_seq_read() was not called until it
1703 void skb_abort_seq_read(struct skb_seq_state *st)
1706 kunmap_skb_frag(st->frag_data);
1709 #define TS_SKB_CB(state) ((struct skb_seq_state *) &((state)->cb))
1711 static unsigned int skb_ts_get_next_block(unsigned int offset, const u8 **text,
1712 struct ts_config *conf,
1713 struct ts_state *state)
1715 return skb_seq_read(offset, text, TS_SKB_CB(state));
1718 static void skb_ts_finish(struct ts_config *conf, struct ts_state *state)
1720 skb_abort_seq_read(TS_SKB_CB(state));
1724 * skb_find_text - Find a text pattern in skb data
1725 * @skb: the buffer to look in
1726 * @from: search offset
1728 * @config: textsearch configuration
1729 * @state: uninitialized textsearch state variable
1731 * Finds a pattern in the skb data according to the specified
1732 * textsearch configuration. Use textsearch_next() to retrieve
1733 * subsequent occurrences of the pattern. Returns the offset
1734 * to the first occurrence or UINT_MAX if no match was found.
1736 unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
1737 unsigned int to, struct ts_config *config,
1738 struct ts_state *state)
1740 config->get_next_block = skb_ts_get_next_block;
1741 config->finish = skb_ts_finish;
1743 skb_prepare_seq_read(skb, from, to, TS_SKB_CB(state));
1745 return textsearch_find(config, state);
1749 * skb_append_datato_frags: - append the user data to a skb
1750 * @sk: sock structure
1751 * @skb: skb structure to be appened with user data.
1752 * @getfrag: call back function to be used for getting the user data
1753 * @from: pointer to user message iov
1754 * @length: length of the iov message
1756 * Description: This procedure append the user data in the fragment part
1757 * of the skb if any page alloc fails user this procedure returns -ENOMEM
1759 int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
1760 int (*getfrag)(void *from, char *to, int offset,
1761 int len, int odd, struct sk_buff *skb),
1762 void *from, int length)
1765 skb_frag_t *frag = NULL;
1766 struct page *page = NULL;
1772 /* Return error if we don't have space for new frag */
1773 frg_cnt = skb_shinfo(skb)->nr_frags;
1774 if (frg_cnt >= MAX_SKB_FRAGS)
1777 /* allocate a new page for next frag */
1778 page = alloc_pages(sk->sk_allocation, 0);
1780 /* If alloc_page fails just return failure and caller will
1781 * free previous allocated pages by doing kfree_skb()
1786 /* initialize the next frag */
1787 sk->sk_sndmsg_page = page;
1788 sk->sk_sndmsg_off = 0;
1789 skb_fill_page_desc(skb, frg_cnt, page, 0, 0);
1790 skb->truesize += PAGE_SIZE;
1791 atomic_add(PAGE_SIZE, &sk->sk_wmem_alloc);
1793 /* get the new initialized frag */
1794 frg_cnt = skb_shinfo(skb)->nr_frags;
1795 frag = &skb_shinfo(skb)->frags[frg_cnt - 1];
1797 /* copy the user data to page */
1798 left = PAGE_SIZE - frag->page_offset;
1799 copy = (length > left)? left : length;
1801 ret = getfrag(from, (page_address(frag->page) +
1802 frag->page_offset + frag->size),
1803 offset, copy, 0, skb);
1807 /* copy was successful so update the size parameters */
1808 sk->sk_sndmsg_off += copy;
1811 skb->data_len += copy;
1815 } while (length > 0);
1821 * skb_pull_rcsum - pull skb and update receive checksum
1822 * @skb: buffer to update
1823 * @start: start of data before pull
1824 * @len: length of data pulled
1826 * This function performs an skb_pull on the packet and updates
1827 * update the CHECKSUM_HW checksum. It should be used on receive
1828 * path processing instead of skb_pull unless you know that the
1829 * checksum difference is zero (e.g., a valid IP header) or you
1830 * are setting ip_summed to CHECKSUM_NONE.
1832 unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len)
1834 BUG_ON(len > skb->len);
1836 BUG_ON(skb->len < skb->data_len);
1837 skb_postpull_rcsum(skb, skb->data, len);
1838 return skb->data += len;
1841 EXPORT_SYMBOL_GPL(skb_pull_rcsum);
1843 void __init skb_init(void)
1845 skbuff_head_cache = kmem_cache_create("skbuff_head_cache",
1846 sizeof(struct sk_buff),
1850 if (!skbuff_head_cache)
1851 panic("cannot create skbuff cache");
1853 skbuff_fclone_cache = kmem_cache_create("skbuff_fclone_cache",
1854 (2*sizeof(struct sk_buff)) +
1859 if (!skbuff_fclone_cache)
1860 panic("cannot create skbuff cache");
1863 EXPORT_SYMBOL(___pskb_trim);
1864 EXPORT_SYMBOL(__kfree_skb);
1865 EXPORT_SYMBOL(kfree_skb);
1866 EXPORT_SYMBOL(__pskb_pull_tail);
1867 EXPORT_SYMBOL(__alloc_skb);
1868 EXPORT_SYMBOL(pskb_copy);
1869 EXPORT_SYMBOL(pskb_expand_head);
1870 EXPORT_SYMBOL(skb_checksum);
1871 EXPORT_SYMBOL(skb_clone);
1872 EXPORT_SYMBOL(skb_clone_fraglist);
1873 EXPORT_SYMBOL(skb_copy);
1874 EXPORT_SYMBOL(skb_copy_and_csum_bits);
1875 EXPORT_SYMBOL(skb_copy_and_csum_dev);
1876 EXPORT_SYMBOL(skb_copy_bits);
1877 EXPORT_SYMBOL(skb_copy_expand);
1878 EXPORT_SYMBOL(skb_over_panic);
1879 EXPORT_SYMBOL(skb_pad);
1880 EXPORT_SYMBOL(skb_realloc_headroom);
1881 EXPORT_SYMBOL(skb_under_panic);
1882 EXPORT_SYMBOL(skb_dequeue);
1883 EXPORT_SYMBOL(skb_dequeue_tail);
1884 EXPORT_SYMBOL(skb_insert);
1885 EXPORT_SYMBOL(skb_queue_purge);
1886 EXPORT_SYMBOL(skb_queue_head);
1887 EXPORT_SYMBOL(skb_queue_tail);
1888 EXPORT_SYMBOL(skb_unlink);
1889 EXPORT_SYMBOL(skb_append);
1890 EXPORT_SYMBOL(skb_split);
1891 EXPORT_SYMBOL(skb_prepare_seq_read);
1892 EXPORT_SYMBOL(skb_seq_read);
1893 EXPORT_SYMBOL(skb_abort_seq_read);
1894 EXPORT_SYMBOL(skb_find_text);
1895 EXPORT_SYMBOL(skb_append_datato_frags);