From: Eric Dumazet Date: Mon, 23 Jan 2012 01:22:09 +0000 (+0000) Subject: tg3: fix ipv6 header length computation X-Git-Tag: v2.6.39-400.9.0~423^2~19^2~11^2~649 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=2dd41ca6deb873f93a2c48d13b43c2432a5623e9;p=users%2Fjedix%2Flinux-maple.git tg3: fix ipv6 header length computation tg3_start_xmit() makes the wrong assumption for TSOV6 that skb->head doesnt include any payload data. if (skb_is_gso_v6(skb)) hdr_len = skb_headlen(skb) - ETH_HLEN; This is not true anymore after commit f07d960df3 (tcp: avoid frag allocation for small frames) We should instead use : skb_transport_offset(skb) + tcp_hdrlen(skb) Its also true for IPv4 (cherry picked from commit a5a1195559f2e20bd975f58e50f53ebe84d5cca6) Signed-off-by: Eric Dumazet CC: Matt Carlson CC: Michael Chan Signed-off-by: David S. Miller Signed-off-by: Joe Jin --- diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 268b4916a1cd..3b8368bbeb17 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -6699,14 +6699,9 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) iph = ip_hdr(skb); tcp_opt_len = tcp_optlen(skb); - if (skb_is_gso_v6(skb)) { - hdr_len = skb_headlen(skb) - ETH_HLEN; - } else { - u32 ip_tcp_len; - - ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr); - hdr_len = ip_tcp_len + tcp_opt_len; + hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb) - ETH_HLEN; + if (!skb_is_gso_v6(skb)) { iph->check = 0; iph->tot_len = htons(mss + hdr_len); }