]> git.baikalelectronics.ru Git - kernel.git/commit
net: ethernet: ftgmac100: Fix DMA coherency issue with SW checksum
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 25 Oct 2019 02:47:24 +0000 (13:47 +1100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Oct 2019 23:22:50 +0000 (16:22 -0700)
commit82e061f437ff2ebe99c0e73d804693ef85f429e7
tree5d65689d64319c79df82aea5a35d8c058481ecf3
parent9879fabb7f9f50c105523eeeddd953920908c75b
net: ethernet: ftgmac100: Fix DMA coherency issue with SW checksum

We are calling the checksum helper after the dma_map_single()
call to map the packet. This is incorrect as the checksumming
code will touch the packet from the CPU. This means the cache
won't be properly flushes (or the bounce buffering will leave
us with the unmodified packet to DMA).

This moves the calculation of the checksum & vlan tags to
before the DMA mapping.

This also has the side effect of fixing another bug: If the
checksum helper fails, we goto "drop" to drop the packet, which
will not unmap the DMA mapping.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Fixes: df1f65d4130b ("ftgmac100: Upgrade to NETIF_F_HW_CSUM")
Reviewed-by: Vijay Khemka <vijaykhemka@fb.com>
Tested-by: Vijay Khemka <vijaykhemka@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/faraday/ftgmac100.c