aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatteo Croce <mcroce@redhat.com>2019-10-24 19:24:57 +0200
committerDavid S. Miller <davem@davemloft.net>2019-10-28 13:44:26 -0700
commite1921168bbd4810de4197446e52f652cd0dd9541 (patch)
tree1aded7546e094a2bf0f8e89c50a8471dc57facd6
parentmvpp2: refactor frame drop routine (diff)
downloadlinux-dev-e1921168bbd4810de4197446e52f652cd0dd9541.tar.xz
linux-dev-e1921168bbd4810de4197446e52f652cd0dd9541.zip
mvpp2: sync only the received frame
In the RX path we always sync against the maximum frame size for that pool. Do the DMA sync and the unmap separately, so we can only sync by the size of the received frame. Signed-off-by: Matteo Croce <mcroce@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index b61e0ad0978a..c66943219e1b 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -2959,6 +2959,10 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
if (rx_status & MVPP2_RXD_ERR_SUMMARY)
goto err_drop_frame;
+ dma_sync_single_for_cpu(dev->dev.parent, dma_addr,
+ rx_bytes + MVPP2_MH_SIZE,
+ DMA_FROM_DEVICE);
+
if (bm_pool->frag_size > PAGE_SIZE)
frag_size = 0;
else
@@ -2976,8 +2980,9 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
goto err_drop_frame;
}
- dma_unmap_single(dev->dev.parent, dma_addr,
- bm_pool->buf_size, DMA_FROM_DEVICE);
+ dma_unmap_single_attrs(dev->dev.parent, dma_addr,
+ bm_pool->buf_size, DMA_FROM_DEVICE,
+ DMA_ATTR_SKIP_CPU_SYNC);
rcvd_pkts++;
rcvd_bytes += rx_bytes;