diff options
-rw-r--r-- | include/linux/netdevice.h | 11 | ||||
-rw-r--r-- | net/core/dev.c | 3 |
2 files changed, 8 insertions, 6 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 61890ed0bcf2..d1afc3b64854 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1135,22 +1135,23 @@ static inline void *skb_gro_header(struct sk_buff *skb, unsigned int hlen) | |||
1135 | 1135 | ||
1136 | hlen += offset; | 1136 | hlen += offset; |
1137 | if (!NAPI_GRO_CB(skb)->frag0 || | 1137 | if (!NAPI_GRO_CB(skb)->frag0 || |
1138 | unlikely(skb_shinfo(skb)->frags[0].size + skb_headlen(skb) < hlen)) | 1138 | unlikely(skb_shinfo(skb)->frags[0].size < hlen)) { |
1139 | NAPI_GRO_CB(skb)->frag0 = NULL; | ||
1139 | return pskb_may_pull(skb, hlen) ? skb->data + offset : NULL; | 1140 | return pskb_may_pull(skb, hlen) ? skb->data + offset : NULL; |
1141 | } | ||
1140 | 1142 | ||
1141 | return NAPI_GRO_CB(skb)->frag0 + offset; | 1143 | return NAPI_GRO_CB(skb)->frag0 + offset; |
1142 | } | 1144 | } |
1143 | 1145 | ||
1144 | static inline void *skb_gro_mac_header(struct sk_buff *skb) | 1146 | static inline void *skb_gro_mac_header(struct sk_buff *skb) |
1145 | { | 1147 | { |
1146 | return skb_headlen(skb) ? skb_mac_header(skb) : | 1148 | return NAPI_GRO_CB(skb)->frag0 ?: skb_mac_header(skb); |
1147 | NAPI_GRO_CB(skb)->frag0; | ||
1148 | } | 1149 | } |
1149 | 1150 | ||
1150 | static inline void *skb_gro_network_header(struct sk_buff *skb) | 1151 | static inline void *skb_gro_network_header(struct sk_buff *skb) |
1151 | { | 1152 | { |
1152 | return skb_headlen(skb) ? skb_network_header(skb) : | 1153 | return (NAPI_GRO_CB(skb)->frag0 ?: skb->data) + |
1153 | NAPI_GRO_CB(skb)->frag0 + skb_network_offset(skb); | 1154 | skb_network_offset(skb); |
1154 | } | 1155 | } |
1155 | 1156 | ||
1156 | static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, | 1157 | static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, |
diff --git a/net/core/dev.c b/net/core/dev.c index bdb1a738193d..f9d90c56b6f0 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2510,7 +2510,8 @@ void skb_gro_reset_offset(struct sk_buff *skb) | |||
2510 | NAPI_GRO_CB(skb)->data_offset = 0; | 2510 | NAPI_GRO_CB(skb)->data_offset = 0; |
2511 | NAPI_GRO_CB(skb)->frag0 = NULL; | 2511 | NAPI_GRO_CB(skb)->frag0 = NULL; |
2512 | 2512 | ||
2513 | if (!skb_headlen(skb) && !PageHighMem(skb_shinfo(skb)->frags[0].page)) | 2513 | if (skb->mac_header == skb->tail && |
2514 | !PageHighMem(skb_shinfo(skb)->frags[0].page)) | ||
2514 | NAPI_GRO_CB(skb)->frag0 = | 2515 | NAPI_GRO_CB(skb)->frag0 = |
2515 | page_address(skb_shinfo(skb)->frags[0].page) + | 2516 | page_address(skb_shinfo(skb)->frags[0].page) + |
2516 | skb_shinfo(skb)->frags[0].page_offset; | 2517 | skb_shinfo(skb)->frags[0].page_offset; |