diff options
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 2e7405500626..e1c2392ecb56 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -246,9 +246,6 @@ struct sk_buff { | |||
246 | int iif; | 246 | int iif; |
247 | /* 4 byte hole on 64 bit*/ | 247 | /* 4 byte hole on 64 bit*/ |
248 | 248 | ||
249 | sk_buff_data_t transport_header; | ||
250 | sk_buff_data_t network_header; | ||
251 | sk_buff_data_t mac_header; | ||
252 | struct dst_entry *dst; | 249 | struct dst_entry *dst; |
253 | struct sec_path *sp; | 250 | struct sec_path *sp; |
254 | 251 | ||
@@ -303,13 +300,16 @@ struct sk_buff { | |||
303 | 300 | ||
304 | __u32 mark; | 301 | __u32 mark; |
305 | 302 | ||
303 | sk_buff_data_t transport_header; | ||
304 | sk_buff_data_t network_header; | ||
305 | sk_buff_data_t mac_header; | ||
306 | /* These elements must be at the end, see alloc_skb() for details. */ | 306 | /* These elements must be at the end, see alloc_skb() for details. */ |
307 | unsigned int truesize; | 307 | sk_buff_data_t tail; |
308 | atomic_t users; | ||
309 | unsigned char *head, | 308 | unsigned char *head, |
310 | *data, | 309 | *data, |
311 | *tail, | ||
312 | *end; | 310 | *end; |
311 | unsigned int truesize; | ||
312 | atomic_t users; | ||
313 | }; | 313 | }; |
314 | 314 | ||
315 | #ifdef __KERNEL__ | 315 | #ifdef __KERNEL__ |
@@ -812,12 +812,45 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i, | |||
812 | #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) | 812 | #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) |
813 | #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) | 813 | #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) |
814 | 814 | ||
815 | #ifdef NET_SKBUFF_DATA_USES_OFFSET | ||
816 | static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) | ||
817 | { | ||
818 | return skb->head + skb->tail; | ||
819 | } | ||
820 | |||
821 | static inline void skb_reset_tail_pointer(struct sk_buff *skb) | ||
822 | { | ||
823 | skb->tail = skb->data - skb->head; | ||
824 | } | ||
825 | |||
826 | static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) | ||
827 | { | ||
828 | skb_reset_tail_pointer(skb); | ||
829 | skb->tail += offset; | ||
830 | } | ||
831 | #else /* NET_SKBUFF_DATA_USES_OFFSET */ | ||
832 | static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) | ||
833 | { | ||
834 | return skb->tail; | ||
835 | } | ||
836 | |||
837 | static inline void skb_reset_tail_pointer(struct sk_buff *skb) | ||
838 | { | ||
839 | skb->tail = skb->data; | ||
840 | } | ||
841 | |||
842 | static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) | ||
843 | { | ||
844 | skb->tail = skb->data + offset; | ||
845 | } | ||
846 | #endif /* NET_SKBUFF_DATA_USES_OFFSET */ | ||
847 | |||
815 | /* | 848 | /* |
816 | * Add data to an sk_buff | 849 | * Add data to an sk_buff |
817 | */ | 850 | */ |
818 | static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) | 851 | static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) |
819 | { | 852 | { |
820 | unsigned char *tmp = skb->tail; | 853 | unsigned char *tmp = skb_tail_pointer(skb); |
821 | SKB_LINEAR_ASSERT(skb); | 854 | SKB_LINEAR_ASSERT(skb); |
822 | skb->tail += len; | 855 | skb->tail += len; |
823 | skb->len += len; | 856 | skb->len += len; |
@@ -835,11 +868,11 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) | |||
835 | */ | 868 | */ |
836 | static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) | 869 | static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) |
837 | { | 870 | { |
838 | unsigned char *tmp = skb->tail; | 871 | unsigned char *tmp = skb_tail_pointer(skb); |
839 | SKB_LINEAR_ASSERT(skb); | 872 | SKB_LINEAR_ASSERT(skb); |
840 | skb->tail += len; | 873 | skb->tail += len; |
841 | skb->len += len; | 874 | skb->len += len; |
842 | if (unlikely(skb->tail>skb->end)) | 875 | if (unlikely(skb_tail_pointer(skb) > skb->end)) |
843 | skb_over_panic(skb, len, current_text_addr()); | 876 | skb_over_panic(skb, len, current_text_addr()); |
844 | return tmp; | 877 | return tmp; |
845 | } | 878 | } |
@@ -935,7 +968,7 @@ static inline int skb_headroom(const struct sk_buff *skb) | |||
935 | */ | 968 | */ |
936 | static inline int skb_tailroom(const struct sk_buff *skb) | 969 | static inline int skb_tailroom(const struct sk_buff *skb) |
937 | { | 970 | { |
938 | return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail; | 971 | return skb_is_nonlinear(skb) ? 0 : skb->end - skb_tail_pointer(skb); |
939 | } | 972 | } |
940 | 973 | ||
941 | /** | 974 | /** |
@@ -1127,8 +1160,8 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len) | |||
1127 | WARN_ON(1); | 1160 | WARN_ON(1); |
1128 | return; | 1161 | return; |
1129 | } | 1162 | } |
1130 | skb->len = len; | 1163 | skb->len = len; |
1131 | skb->tail = skb->data + len; | 1164 | skb_set_tail_pointer(skb, len); |
1132 | } | 1165 | } |
1133 | 1166 | ||
1134 | /** | 1167 | /** |