Skip to content

Commit

Permalink
net: mvneta: fix the remaining Rx descriptor unmapping issues
Browse files Browse the repository at this point in the history
With CONFIG_DMA_API_DEBUG enabled we get DMA unmapping warning in
various places of the mvneta driver, for example when putting down an
interface while traffic is passing through.

The issue is when using s/w buffer management, the Rx buffers are mapped
using dma_map_page but unmapped with dma_unmap_single. This patch fixes
this by using the right unmapping function.

Fixes: 562e2f4 ("net: mvneta: Improve the buffer allocation method for SWBM")
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Reviewed-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Antoine Tenart authored and David S. Miller committed Sep 24, 2018
1 parent ccfec9e commit f4a5187
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/net/ethernet/marvell/mvneta.c
Original file line number Diff line number Diff line change
Expand Up @@ -1890,8 +1890,8 @@ static void mvneta_rxq_drop_pkts(struct mvneta_port *pp,
if (!data || !(rx_desc->buf_phys_addr))
continue;

dma_unmap_single(pp->dev->dev.parent, rx_desc->buf_phys_addr,
MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
dma_unmap_page(pp->dev->dev.parent, rx_desc->buf_phys_addr,
PAGE_SIZE, DMA_FROM_DEVICE);
__free_page(data);
}
}
Expand Down Expand Up @@ -2039,9 +2039,8 @@ static int mvneta_rx_swbm(struct napi_struct *napi,
frag_offset, frag_size,
PAGE_SIZE);

dma_unmap_single(dev->dev.parent, phys_addr,
PAGE_SIZE,
DMA_FROM_DEVICE);
dma_unmap_page(dev->dev.parent, phys_addr,
PAGE_SIZE, DMA_FROM_DEVICE);

rxq->left_size -= frag_size;
}
Expand Down

0 comments on commit f4a5187

Please sign in to comment.