[PATCH] tg3: fix ipv6 header length computation

Subsystems: broadcom tg3 gigabit ethernet driver, networking drivers, the rest

STALE5340d

2 messages, 2 authors, 2012-01-23 · open the first message on its own page

[PATCH] tg3: fix ipv6 header length computation

From: Eric Dumazet <hidden>
Date: 2012-01-23 11:22:14

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

Signed-off-by: Eric Dumazet <redacted>
CC: Matt Carlson <redacted>
CC: Michael Chan <mchan@broadcom.com>
---
I dont have a compatable hardware (5755_PLUS ?) so please guys test
this...

 drivers/net/ethernet/broadcom/tg3.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index d529af9..a1f2e0f 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -6667,14 +6667,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);
 		}

Re: [PATCH] tg3: fix ipv6 header length computation

From: David Miller <davem@davemloft.net>
Date: 2012-01-23 19:25:55

From: Eric Dumazet <redacted>
Date: Mon, 23 Jan 2012 12:22:09 +0100
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

Signed-off-by: Eric Dumazet <redacted>
CC: Matt Carlson <redacted>
CC: Michael Chan <mchan@broadcom.com>
---
I dont have a compatable hardware (5755_PLUS ?) so please guys test
this...
I've applied this, if testing finds problems we can fix it up or revert.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help