]> git.baikalelectronics.ru Git - kernel.git/commit
net: stmmac: Sync RX Buffer upon allocation
authorJose Abreu <Jose.Abreu@synopsys.com>
Tue, 30 Jul 2019 13:57:16 +0000 (15:57 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 30 Jul 2019 17:25:58 +0000 (10:25 -0700)
commit838d0250468fb99df38d023ea2d7dbc12ea46726
tree3e9e925a0876704aded483ffb55cc7ead471130a
parent61c9d3df160ecddffd2c125291d1d9e9c99ac8bd
net: stmmac: Sync RX Buffer upon allocation

With recent changes that introduced support for Page Pool in stmmac, Jon
reported that NFS boot was no longer working on an ARM64 based platform
that had the IP behind an IOMMU.

As Page Pool API does not guarantee DMA syncing because of the use of
DMA_ATTR_SKIP_CPU_SYNC flag, we have to explicit sync the whole buffer upon
re-allocation because we are always re-using same pages.

In fact, ARM64 code invalidates the DMA area upon two situations [1]:
- sync_single_for_cpu(): Invalidates if direction != DMA_TO_DEVICE
- sync_single_for_device(): Invalidates if direction == DMA_FROM_DEVICE

So, as we must invalidate both the current RX buffer and the newly allocated
buffer we propose this fix.

[1] arch/arm64/mm/cache.S

Reported-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Fixes: 232086e65d14 ("net: stmmac: Introducing support for Page Pool")
Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c