diff options
-rw-r--r-- | net/ipv4/tcp_offload.c | 27 | ||||
-rw-r--r-- | net/ipv6/tcpv6_offload.c | 26 |
2 files changed, 6 insertions, 47 deletions
diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c index bc1b83cb8309..72912533a191 100644 --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c | |||
@@ -288,35 +288,14 @@ static int tcp_v4_gso_send_check(struct sk_buff *skb) | |||
288 | 288 | ||
289 | static struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *skb) | 289 | static struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *skb) |
290 | { | 290 | { |
291 | /* Use the IP hdr immediately proceeding for this transport */ | ||
292 | const struct iphdr *iph = skb_gro_network_header(skb); | ||
293 | __wsum wsum; | ||
294 | |||
295 | /* Don't bother verifying checksum if we're going to flush anyway. */ | 291 | /* Don't bother verifying checksum if we're going to flush anyway. */ |
296 | if (NAPI_GRO_CB(skb)->flush) | 292 | if (!NAPI_GRO_CB(skb)->flush && |
297 | goto skip_csum; | 293 | skb_gro_checksum_validate(skb, IPPROTO_TCP, |
298 | 294 | inet_gro_compute_pseudo)) { | |
299 | wsum = NAPI_GRO_CB(skb)->csum; | ||
300 | |||
301 | switch (skb->ip_summed) { | ||
302 | case CHECKSUM_NONE: | ||
303 | wsum = skb_checksum(skb, skb_gro_offset(skb), skb_gro_len(skb), | ||
304 | 0); | ||
305 | |||
306 | /* fall through */ | ||
307 | |||
308 | case CHECKSUM_COMPLETE: | ||
309 | if (!tcp_v4_check(skb_gro_len(skb), iph->saddr, iph->daddr, | ||
310 | wsum)) { | ||
311 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
312 | break; | ||
313 | } | ||
314 | |||
315 | NAPI_GRO_CB(skb)->flush = 1; | 295 | NAPI_GRO_CB(skb)->flush = 1; |
316 | return NULL; | 296 | return NULL; |
317 | } | 297 | } |
318 | 298 | ||
319 | skip_csum: | ||
320 | return tcp_gro_receive(head, skb); | 299 | return tcp_gro_receive(head, skb); |
321 | } | 300 | } |
322 | 301 | ||
diff --git a/net/ipv6/tcpv6_offload.c b/net/ipv6/tcpv6_offload.c index 01b0ff9a0c2c..dbb3d9262bf6 100644 --- a/net/ipv6/tcpv6_offload.c +++ b/net/ipv6/tcpv6_offload.c | |||
@@ -35,34 +35,14 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb) | |||
35 | static struct sk_buff **tcp6_gro_receive(struct sk_buff **head, | 35 | static struct sk_buff **tcp6_gro_receive(struct sk_buff **head, |
36 | struct sk_buff *skb) | 36 | struct sk_buff *skb) |
37 | { | 37 | { |
38 | const struct ipv6hdr *iph = skb_gro_network_header(skb); | ||
39 | __wsum wsum; | ||
40 | |||
41 | /* Don't bother verifying checksum if we're going to flush anyway. */ | 38 | /* Don't bother verifying checksum if we're going to flush anyway. */ |
42 | if (NAPI_GRO_CB(skb)->flush) | 39 | if (!NAPI_GRO_CB(skb)->flush && |
43 | goto skip_csum; | 40 | skb_gro_checksum_validate(skb, IPPROTO_TCP, |
44 | 41 | ip6_gro_compute_pseudo)) { | |
45 | wsum = NAPI_GRO_CB(skb)->csum; | ||
46 | |||
47 | switch (skb->ip_summed) { | ||
48 | case CHECKSUM_NONE: | ||
49 | wsum = skb_checksum(skb, skb_gro_offset(skb), skb_gro_len(skb), | ||
50 | wsum); | ||
51 | |||
52 | /* fall through */ | ||
53 | |||
54 | case CHECKSUM_COMPLETE: | ||
55 | if (!tcp_v6_check(skb_gro_len(skb), &iph->saddr, &iph->daddr, | ||
56 | wsum)) { | ||
57 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
58 | break; | ||
59 | } | ||
60 | |||
61 | NAPI_GRO_CB(skb)->flush = 1; | 42 | NAPI_GRO_CB(skb)->flush = 1; |
62 | return NULL; | 43 | return NULL; |
63 | } | 44 | } |
64 | 45 | ||
65 | skip_csum: | ||
66 | return tcp_gro_receive(head, skb); | 46 | return tcp_gro_receive(head, skb); |
67 | } | 47 | } |
68 | 48 | ||