1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef _LINUX_SKBUFF_H
15#define _LINUX_SKBUFF_H
16
17#include <linux/config.h>
18#include <linux/kernel.h>
19#include <linux/compiler.h>
20#include <linux/time.h>
21#include <linux/cache.h>
22
23#include <asm/atomic.h>
24#include <asm/types.h>
25#include <linux/spinlock.h>
26#include <linux/mm.h>
27#include <linux/highmem.h>
28#include <linux/poll.h>
29#include <linux/net.h>
30
31#define HAVE_ALLOC_SKB
32#define HAVE_ALIGNABLE_SKB
33#define SLAB_SKB
34
35#define CHECKSUM_NONE 0
36#define CHECKSUM_HW 1
37#define CHECKSUM_UNNECESSARY 2
38
39#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \
40 ~(SMP_CACHE_BYTES - 1))
41#define SKB_MAX_ORDER(X, ORDER) (((PAGE_SIZE << (ORDER)) - (X) - \
42 sizeof(struct skb_shared_info)) & \
43 ~(SMP_CACHE_BYTES - 1))
44#define SKB_MAX_HEAD(X) (SKB_MAX_ORDER((X), 0))
45#define SKB_MAX_ALLOC (SKB_MAX_ORDER(0, 2))
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85#ifdef __i386__
86#define NET_CALLER(arg) (*(((void **)&arg) - 1))
87#else
88#define NET_CALLER(arg) __builtin_return_address(0)
89#endif
90
91#ifdef CONFIG_NETFILTER
92struct nf_conntrack {
93 atomic_t use;
94 void (*destroy)(struct nf_conntrack *);
95};
96
97struct nf_ct_info {
98 struct nf_conntrack *master;
99};
100
101#ifdef CONFIG_BRIDGE_NETFILTER
102struct nf_bridge_info {
103 atomic_t use;
104 struct net_device *physindev;
105 struct net_device *physoutdev;
106#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
107 struct net_device *netoutdev;
108#endif
109 unsigned int mask;
110 unsigned long data[32 / sizeof(unsigned long)];
111};
112#endif
113
114#endif
115
116struct sk_buff_head {
117
118 struct sk_buff *next;
119 struct sk_buff *prev;
120
121 __u32 qlen;
122 spinlock_t lock;
123};
124
125struct sk_buff;
126
127
128#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2)
129
130typedef struct skb_frag_struct skb_frag_t;
131
132struct skb_frag_struct {
133 struct page *page;
134 __u16 page_offset;
135 __u16 size;
136};
137
138
139
140
141struct skb_shared_info {
142 atomic_t dataref;
143 unsigned int nr_frags;
144 unsigned short tso_size;
145 unsigned short tso_segs;
146 struct sk_buff *frag_list;
147 skb_frag_t frags[MAX_SKB_FRAGS];
148};
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190struct sk_buff {
191
192 struct sk_buff *next;
193 struct sk_buff *prev;
194
195 struct sk_buff_head *list;
196 struct sock *sk;
197 struct timeval stamp;
198 struct net_device *dev;
199 struct net_device *real_dev;
200
201 union {
202 struct tcphdr *th;
203 struct udphdr *uh;
204 struct icmphdr *icmph;
205 struct igmphdr *igmph;
206 struct iphdr *ipiph;
207 unsigned char *raw;
208 } h;
209
210 union {
211 struct iphdr *iph;
212 struct ipv6hdr *ipv6h;
213 struct arphdr *arph;
214 unsigned char *raw;
215 } nh;
216
217 union {
218 struct ethhdr *ethernet;
219 unsigned char *raw;
220 } mac;
221
222 struct dst_entry *dst;
223 struct sec_path *sp;
224
225
226
227
228
229
230
231 char cb[48];
232
233 unsigned int len,
234 data_len,
235 csum;
236 unsigned char local_df,
237 cloned,
238 pkt_type,
239 ip_summed;
240 __u32 priority;
241 unsigned short protocol,
242 security;
243
244 void (*destructor)(struct sk_buff *skb);
245#ifdef CONFIG_NETFILTER
246 unsigned long nfmark;
247 __u32 nfcache;
248 struct nf_ct_info *nfct;
249#ifdef CONFIG_NETFILTER_DEBUG
250 unsigned int nf_debug;
251#endif
252#ifdef CONFIG_BRIDGE_NETFILTER
253 struct nf_bridge_info *nf_bridge;
254#endif
255#endif
256#if defined(CONFIG_HIPPI)
257 union {
258 __u32 ifield;
259 } private;
260#endif
261#ifdef CONFIG_NET_SCHED
262 __u32 tc_index;
263#endif
264
265
266 unsigned int truesize;
267 atomic_t users;
268 unsigned char *head,
269 *data,
270 *tail,
271 *end;
272};
273
274#define SK_WMEM_MAX 65535
275#define SK_RMEM_MAX 65535
276
277#ifdef __KERNEL__
278
279
280
281#include <linux/slab.h>
282
283#include <asm/system.h>
284
285extern void __kfree_skb(struct sk_buff *skb);
286extern struct sk_buff *alloc_skb(unsigned int size, int priority);
287extern void kfree_skbmem(struct sk_buff *skb);
288extern struct sk_buff *skb_clone(struct sk_buff *skb, int priority);
289extern struct sk_buff *skb_copy(const struct sk_buff *skb, int priority);
290extern struct sk_buff *pskb_copy(struct sk_buff *skb, int gfp_mask);
291extern int pskb_expand_head(struct sk_buff *skb,
292 int nhead, int ntail, int gfp_mask);
293extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
294 unsigned int headroom);
295extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
296 int newheadroom, int newtailroom,
297 int priority);
298extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad);
299#define dev_kfree_skb(a) kfree_skb(a)
300extern void skb_over_panic(struct sk_buff *skb, int len,
301 void *here);
302extern void skb_under_panic(struct sk_buff *skb, int len,
303 void *here);
304
305
306#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end))
307
308
309
310
311
312
313
314static inline int skb_queue_empty(const struct sk_buff_head *list)
315{
316 return list->next == (struct sk_buff *)list;
317}
318
319
320
321
322
323
324
325
326static inline struct sk_buff *skb_get(struct sk_buff *skb)
327{
328 atomic_inc(&skb->users);
329 return skb;
330}
331
332
333
334
335
336
337
338
339
340
341
342
343
344static inline void kfree_skb(struct sk_buff *skb)
345{
346 if (atomic_read(&skb->users) == 1 || atomic_dec_and_test(&skb->users))
347 __kfree_skb(skb);
348}
349
350
351static inline void kfree_skb_fast(struct sk_buff *skb)
352{
353 if (atomic_read(&skb->users) == 1 || atomic_dec_and_test(&skb->users))
354 kfree_skbmem(skb);
355}
356
357
358
359
360
361
362
363
364
365static inline int skb_cloned(const struct sk_buff *skb)
366{
367 return skb->cloned && atomic_read(&skb_shinfo(skb)->dataref) != 1;
368}
369
370
371
372
373
374
375
376
377static inline int skb_shared(const struct sk_buff *skb)
378{
379 return atomic_read(&skb->users) != 1;
380}
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395static inline struct sk_buff *skb_share_check(struct sk_buff *skb, int pri)
396{
397 might_sleep_if(pri & __GFP_WAIT);
398 if (skb_shared(skb)) {
399 struct sk_buff *nskb = skb_clone(skb, pri);
400 kfree_skb(skb);
401 skb = nskb;
402 }
403 return skb;
404}
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426static inline struct sk_buff *skb_unshare(struct sk_buff *skb, int pri)
427{
428 might_sleep_if(pri & __GFP_WAIT);
429 if (skb_cloned(skb)) {
430 struct sk_buff *nskb = skb_copy(skb, pri);
431 kfree_skb(skb);
432 skb = nskb;
433 }
434 return skb;
435}
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450static inline struct sk_buff *skb_peek(struct sk_buff_head *list_)
451{
452 struct sk_buff *list = ((struct sk_buff *)list_)->next;
453 if (list == (struct sk_buff *)list_)
454 list = NULL;
455 return list;
456}
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471static inline struct sk_buff *skb_peek_tail(struct sk_buff_head *list_)
472{
473 struct sk_buff *list = ((struct sk_buff *)list_)->prev;
474 if (list == (struct sk_buff *)list_)
475 list = NULL;
476 return list;
477}
478
479
480
481
482
483
484
485static inline __u32 skb_queue_len(const struct sk_buff_head *list_)
486{
487 return list_->qlen;
488}
489
490static inline void skb_queue_head_init(struct sk_buff_head *list)
491{
492 spin_lock_init(&list->lock);
493 list->prev = list->next = (struct sk_buff *)list;
494 list->qlen = 0;
495}
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514static inline void __skb_queue_head(struct sk_buff_head *list,
515 struct sk_buff *newsk)
516{
517 struct sk_buff *prev, *next;
518
519 newsk->list = list;
520 list->qlen++;
521 prev = (struct sk_buff *)list;
522 next = prev->next;
523 newsk->next = next;
524 newsk->prev = prev;
525 next->prev = prev->next = newsk;
526}
527
528
529
530
531
532
533
534
535
536
537
538
539
540static inline void skb_queue_head(struct sk_buff_head *list,
541 struct sk_buff *newsk)
542{
543 unsigned long flags;
544
545 spin_lock_irqsave(&list->lock, flags);
546 __skb_queue_head(list, newsk);
547 spin_unlock_irqrestore(&list->lock, flags);
548}
549
550
551
552
553
554
555
556
557
558
559
560static inline void __skb_queue_tail(struct sk_buff_head *list,
561 struct sk_buff *newsk)
562{
563 struct sk_buff *prev, *next;
564
565 newsk->list = list;
566 list->qlen++;
567 next = (struct sk_buff *)list;
568 prev = next->prev;
569 newsk->next = next;
570 newsk->prev = prev;
571 next->prev = prev->next = newsk;
572}
573
574
575
576
577
578
579
580
581
582
583
584
585static inline void skb_queue_tail(struct sk_buff_head *list,
586 struct sk_buff *newsk)
587{
588 unsigned long flags;
589
590 spin_lock_irqsave(&list->lock, flags);
591 __skb_queue_tail(list, newsk);
592 spin_unlock_irqrestore(&list->lock, flags);
593}
594
595
596
597
598
599
600
601
602
603static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
604{
605 struct sk_buff *next, *prev, *result;
606
607 prev = (struct sk_buff *) list;
608 next = prev->next;
609 result = NULL;
610 if (next != prev) {
611 result = next;
612 next = next->next;
613 list->qlen--;
614 next->prev = prev;
615 prev->next = next;
616 result->next = result->prev = NULL;
617 result->list = NULL;
618 }
619 return result;
620}
621
622
623
624
625
626
627
628
629
630
631static inline struct sk_buff *skb_dequeue(struct sk_buff_head *list)
632{
633 unsigned long flags;
634 struct sk_buff *result;
635
636 spin_lock_irqsave(&list->lock, flags);
637 result = __skb_dequeue(list);
638 spin_unlock_irqrestore(&list->lock, flags);
639 return result;
640}
641
642
643
644
645
646static inline void __skb_insert(struct sk_buff *newsk,
647 struct sk_buff *prev, struct sk_buff *next,
648 struct sk_buff_head *list)
649{
650 newsk->next = next;
651 newsk->prev = prev;
652 next->prev = prev->next = newsk;
653 newsk->list = list;
654 list->qlen++;
655}
656
657
658
659
660
661
662
663
664
665
666
667static inline void skb_insert(struct sk_buff *old, struct sk_buff *newsk)
668{
669 unsigned long flags;
670
671 spin_lock_irqsave(&old->list->lock, flags);
672 __skb_insert(newsk, old->prev, old, old->list);
673 spin_unlock_irqrestore(&old->list->lock, flags);
674}
675
676
677
678
679
680static inline void __skb_append(struct sk_buff *old, struct sk_buff *newsk)
681{
682 __skb_insert(newsk, old, old->next, old->list);
683}
684
685
686
687
688
689
690
691
692
693
694
695
696static inline void skb_append(struct sk_buff *old, struct sk_buff *newsk)
697{
698 unsigned long flags;
699
700 spin_lock_irqsave(&old->list->lock, flags);
701 __skb_append(old, newsk);
702 spin_unlock_irqrestore(&old->list->lock, flags);
703}
704
705
706
707
708
709static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
710{
711 struct sk_buff *next, *prev;
712
713 list->qlen--;
714 next = skb->next;
715 prev = skb->prev;
716 skb->next = skb->prev = NULL;
717 skb->list = NULL;
718 next->prev = prev;
719 prev->next = next;
720}
721
722
723
724
725
726
727
728
729
730
731
732
733
734static inline void skb_unlink(struct sk_buff *skb)
735{
736 struct sk_buff_head *list = skb->list;
737
738 if (list) {
739 unsigned long flags;
740
741 spin_lock_irqsave(&list->lock, flags);
742 if (skb->list == list)
743 __skb_unlink(skb, skb->list);
744 spin_unlock_irqrestore(&list->lock, flags);
745 }
746}
747
748
749
750
751
752
753
754
755
756
757
758static inline struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list)
759{
760 struct sk_buff *skb = skb_peek_tail(list);
761 if (skb)
762 __skb_unlink(skb, list);
763 return skb;
764}
765
766
767
768
769
770
771
772
773
774static inline struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list)
775{
776 unsigned long flags;
777 struct sk_buff *result;
778
779 spin_lock_irqsave(&list->lock, flags);
780 result = __skb_dequeue_tail(list);
781 spin_unlock_irqrestore(&list->lock, flags);
782 return result;
783}
784
785static inline int skb_is_nonlinear(const struct sk_buff *skb)
786{
787 return skb->data_len;
788}
789
790static inline unsigned int skb_headlen(const struct sk_buff *skb)
791{
792 return skb->len - skb->data_len;
793}
794
795static inline int skb_pagelen(const struct sk_buff *skb)
796{
797 int i, len = 0;
798
799 for (i = (int)skb_shinfo(skb)->nr_frags - 1; i >= 0; i--)
800 len += skb_shinfo(skb)->frags[i].size;
801 return len + skb_headlen(skb);
802}
803
804static inline void skb_fill_page_desc(struct sk_buff *skb, int i, struct page *page, int off, int size)
805{
806 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
807 frag->page = page;
808 frag->page_offset = off;
809 frag->size = size;
810 skb_shinfo(skb)->nr_frags = i+1;
811}
812
813#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags)
814#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list)
815#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb))
816
817
818
819
820static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
821{
822 unsigned char *tmp = skb->tail;
823 SKB_LINEAR_ASSERT(skb);
824 skb->tail += len;
825 skb->len += len;
826 return tmp;
827}
828
829
830
831
832
833
834
835
836
837
838static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
839{
840 unsigned char *tmp = skb->tail;
841 SKB_LINEAR_ASSERT(skb);
842 skb->tail += len;
843 skb->len += len;
844 if (unlikely(skb->tail>skb->end))
845 skb_over_panic(skb, len, current_text_addr());
846 return tmp;
847}
848
849static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len)
850{
851 skb->data -= len;
852 skb->len += len;
853 return skb->data;
854}
855
856
857
858
859
860
861
862
863
864
865static inline unsigned char *skb_push(struct sk_buff *skb, unsigned int len)
866{
867 skb->data -= len;
868 skb->len += len;
869 if (unlikely(skb->data<skb->head))
870 skb_under_panic(skb, len, current_text_addr());
871 return skb->data;
872}
873
874static inline char *__skb_pull(struct sk_buff *skb, unsigned int len)
875{
876 skb->len -= len;
877 BUG_ON(skb->len < skb->data_len);
878 return skb->data += len;
879}
880
881
882
883
884
885
886
887
888
889
890
891static inline unsigned char *skb_pull(struct sk_buff *skb, unsigned int len)
892{
893 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
894}
895
896extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
897
898static inline char *__pskb_pull(struct sk_buff *skb, unsigned int len)
899{
900 if (len > skb_headlen(skb) &&
901 !__pskb_pull_tail(skb, len-skb_headlen(skb)))
902 return NULL;
903 skb->len -= len;
904 return skb->data += len;
905}
906
907static inline unsigned char *pskb_pull(struct sk_buff *skb, unsigned int len)
908{
909 return unlikely(len > skb->len) ? NULL : __pskb_pull(skb, len);
910}
911
912static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len)
913{
914 if (likely(len <= skb_headlen(skb)))
915 return 1;
916 if (unlikely(len > skb->len))
917 return 0;
918 return __pskb_pull_tail(skb, len-skb_headlen(skb)) != NULL;
919}
920
921
922
923
924
925
926
927static inline int skb_headroom(const struct sk_buff *skb)
928{
929 return skb->data - skb->head;
930}
931
932
933
934
935
936
937
938static inline int skb_tailroom(const struct sk_buff *skb)
939{
940 return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail;
941}
942
943
944
945
946
947
948
949
950
951static inline void skb_reserve(struct sk_buff *skb, unsigned int len)
952{
953 skb->data += len;
954 skb->tail += len;
955}
956
957extern int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc);
958
959static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
960{
961 if (!skb->data_len) {
962 skb->len = len;
963 skb->tail = skb->data + len;
964 } else
965 ___pskb_trim(skb, len, 0);
966}
967
968
969
970
971
972
973
974
975
976static inline void skb_trim(struct sk_buff *skb, unsigned int len)
977{
978 if (skb->len > len)
979 __skb_trim(skb, len);
980}
981
982
983static inline int __pskb_trim(struct sk_buff *skb, unsigned int len)
984{
985 if (!skb->data_len) {
986 skb->len = len;
987 skb->tail = skb->data+len;
988 return 0;
989 }
990 return ___pskb_trim(skb, len, 1);
991}
992
993static inline int pskb_trim(struct sk_buff *skb, unsigned int len)
994{
995 return (len < skb->len) ? __pskb_trim(skb, len) : 0;
996}
997
998
999
1000
1001
1002
1003
1004
1005
1006static inline void skb_orphan(struct sk_buff *skb)
1007{
1008 if (skb->destructor)
1009 skb->destructor(skb);
1010 skb->destructor = NULL;
1011 skb->sk = NULL;
1012}
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022static inline void skb_queue_purge(struct sk_buff_head *list)
1023{
1024 struct sk_buff *skb;
1025 while ((skb = skb_dequeue(list)) != NULL)
1026 kfree_skb(skb);
1027}
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037static inline void __skb_queue_purge(struct sk_buff_head *list)
1038{
1039 struct sk_buff *skb;
1040 while ((skb = __skb_dequeue(list)) != NULL)
1041 kfree_skb(skb);
1042}
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1057 int gfp_mask)
1058{
1059 struct sk_buff *skb = alloc_skb(length + 16, gfp_mask);
1060 if (likely(skb))
1061 skb_reserve(skb, 16);
1062 return skb;
1063}
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077static inline struct sk_buff *dev_alloc_skb(unsigned int length)
1078{
1079 return __dev_alloc_skb(length, GFP_ATOMIC);
1080}
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094static inline int skb_cow(struct sk_buff *skb, unsigned int headroom)
1095{
1096 int delta = (headroom > 16 ? headroom : 16) - skb_headroom(skb);
1097
1098 if (delta < 0)
1099 delta = 0;
1100
1101 if (delta || skb_cloned(skb))
1102 return pskb_expand_head(skb, (delta + 15) & ~15, 0, GFP_ATOMIC);
1103 return 0;
1104}
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118static inline struct sk_buff *skb_padto(struct sk_buff *skb, unsigned int len)
1119{
1120 unsigned int size = skb->len;
1121 if (likely(size >= len))
1122 return skb;
1123 return skb_pad(skb, len-size);
1124}
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134extern int __skb_linearize(struct sk_buff *skb, int gfp);
1135static inline int skb_linearize(struct sk_buff *skb, int gfp)
1136{
1137 return __skb_linearize(skb, gfp);
1138}
1139
1140static inline void *kmap_skb_frag(const skb_frag_t *frag)
1141{
1142#ifdef CONFIG_HIGHMEM
1143 BUG_ON(in_irq());
1144
1145 local_bh_disable();
1146#endif
1147 return kmap_atomic(frag->page, KM_SKB_DATA_SOFTIRQ);
1148}
1149
1150static inline void kunmap_skb_frag(void *vaddr)
1151{
1152 kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ);
1153#ifdef CONFIG_HIGHMEM
1154 local_bh_enable();
1155#endif
1156}
1157
1158#define skb_queue_walk(queue, skb) \
1159 for (skb = (queue)->next, prefetch(skb->next); \
1160 (skb != (struct sk_buff *)(queue)); \
1161 skb = skb->next, prefetch(skb->next))
1162
1163
1164extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags,
1165 int noblock, int *err);
1166extern unsigned int datagram_poll(struct file *file, struct socket *sock,
1167 struct poll_table_struct *wait);
1168extern int skb_copy_datagram(const struct sk_buff *from,
1169 int offset, char *to, int size);
1170extern int skb_copy_datagram_iovec(const struct sk_buff *from,
1171 int offset, struct iovec *to,
1172 int size);
1173extern int skb_copy_and_csum_datagram(const struct sk_buff *skb,
1174 int offset, u8 *to, int len,
1175 unsigned int *csump);
1176extern int skb_copy_and_csum_datagram_iovec(const
1177 struct sk_buff *skb,
1178 int hlen,
1179 struct iovec *iov);
1180extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1181extern unsigned int skb_checksum(const struct sk_buff *skb, int offset,
1182 int len, unsigned int csum);
1183extern int skb_copy_bits(const struct sk_buff *skb, int offset,
1184 void *to, int len);
1185extern unsigned int skb_copy_and_csum_bits(const struct sk_buff *skb,
1186 int offset, u8 *to, int len,
1187 unsigned int csum);
1188extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
1189
1190extern void skb_init(void);
1191extern void skb_add_mtu(int mtu);
1192
1193#ifdef CONFIG_NETFILTER
1194static inline void nf_conntrack_put(struct nf_ct_info *nfct)
1195{
1196 if (nfct && atomic_dec_and_test(&nfct->master->use))
1197 nfct->master->destroy(nfct->master);
1198}
1199static inline void nf_conntrack_get(struct nf_ct_info *nfct)
1200{
1201 if (nfct)
1202 atomic_inc(&nfct->master->use);
1203}
1204
1205#ifdef CONFIG_BRIDGE_NETFILTER
1206static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
1207{
1208 if (nf_bridge && atomic_dec_and_test(&nf_bridge->use))
1209 kfree(nf_bridge);
1210}
1211static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge)
1212{
1213 if (nf_bridge)
1214 atomic_inc(&nf_bridge->use);
1215}
1216#endif
1217
1218#endif
1219
1220#endif
1221#endif
1222