net: bcmgenet: fix skb_len in bcmgenet_xmit_single()
commitab020c41702b37db378401581d10ce5abdf58d75
authorPetri Gynther <pgynther@google.com>
Thu, 24 Mar 2016 18:27:21 +0000 (24 11:27 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 30 Apr 2016 22:06:05 +0000 (1 00:06 +0200)
tree27fee20004c6750558db0af442a1c5e9db4af634
parent6ab3a4331a1de5a20c3dc97f5211d00f1b35ce50
net: bcmgenet: fix skb_len in bcmgenet_xmit_single()

commit 7dd399130efb5a454daf24075b7563d197114e39 upstream.

skb_len needs to be skb_headlen(skb) in bcmgenet_xmit_single().

Fragmented skbs can have only Ethernet + IP + TCP headers (14+20+20=54 bytes)
in the linear buffer, followed by the rest in fragments. Bumping skb_len to
ETH_ZLEN would be incorrect for this case, as it would introduce garbage
between TCP header and the fragment data.

This also works with regular/non-fragmented small packets < ETH_ZLEN bytes.
Successfully tested this on GENETv3 with 42-byte ARP frames.

For testing, I used:
ethtool -K eth0 tx-checksum-ipv4 off
ethtool -K eth0 tx-checksum-ipv6 off
echo 0 > /proc/sys/net/ipv4/tcp_timestamps

Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file")
Signed-off-by: Petri Gynther <pgynther@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/ethernet/broadcom/genet/bcmgenet.c