net: bcmgenet: fix skb_len in bcmgenet_xmit_single()
authorPetri Gynther <pgynther@google.com>
Thu, 24 Mar 2016 18:27:21 +0000 (11:27 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Mar 2016 19:11:40 +0000 (15:11 -0400)
commit7dd399130efb5a454daf24075b7563d197114e39
tree7aeb9902b73897621a3594ea686aed37093ef1e4
parent55868120a3e5420bf5aa26a816c07d691579c9e6
net: bcmgenet: fix skb_len in bcmgenet_xmit_single()

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>
drivers/net/ethernet/broadcom/genet/bcmgenet.c