diff options
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 830f58fa03a..93e4db22158 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -975,15 +975,16 @@ static inline void skb_reserve(struct sk_buff *skb, int len) | |||
975 | #define NET_SKB_PAD 16 | 975 | #define NET_SKB_PAD 16 |
976 | #endif | 976 | #endif |
977 | 977 | ||
978 | extern int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc); | 978 | extern int ___pskb_trim(struct sk_buff *skb, unsigned int len); |
979 | 979 | ||
980 | static inline void __skb_trim(struct sk_buff *skb, unsigned int len) | 980 | static inline void __skb_trim(struct sk_buff *skb, unsigned int len) |
981 | { | 981 | { |
982 | if (!skb->data_len) { | 982 | if (unlikely(skb->data_len)) { |
983 | skb->len = len; | 983 | WARN_ON(1); |
984 | skb->tail = skb->data + len; | 984 | return; |
985 | } else | 985 | } |
986 | ___pskb_trim(skb, len, 0); | 986 | skb->len = len; |
987 | skb->tail = skb->data + len; | ||
987 | } | 988 | } |
988 | 989 | ||
989 | /** | 990 | /** |
@@ -993,6 +994,7 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len) | |||
993 | * | 994 | * |
994 | * Cut the length of a buffer down by removing data from the tail. If | 995 | * Cut the length of a buffer down by removing data from the tail. If |
995 | * the buffer is already under the length specified it is not modified. | 996 | * the buffer is already under the length specified it is not modified. |
997 | * The skb must be linear. | ||
996 | */ | 998 | */ |
997 | static inline void skb_trim(struct sk_buff *skb, unsigned int len) | 999 | static inline void skb_trim(struct sk_buff *skb, unsigned int len) |
998 | { | 1000 | { |
@@ -1003,12 +1005,10 @@ static inline void skb_trim(struct sk_buff *skb, unsigned int len) | |||
1003 | 1005 | ||
1004 | static inline int __pskb_trim(struct sk_buff *skb, unsigned int len) | 1006 | static inline int __pskb_trim(struct sk_buff *skb, unsigned int len) |
1005 | { | 1007 | { |
1006 | if (!skb->data_len) { | 1008 | if (skb->data_len) |
1007 | skb->len = len; | 1009 | return ___pskb_trim(skb, len); |
1008 | skb->tail = skb->data+len; | 1010 | __skb_trim(skb, len); |
1009 | return 0; | 1011 | return 0; |
1010 | } | ||
1011 | return ___pskb_trim(skb, len, 1); | ||
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | static inline int pskb_trim(struct sk_buff *skb, unsigned int len) | 1014 | static inline int pskb_trim(struct sk_buff *skb, unsigned int len) |