Commit cf5cca6e authored by Antoine Tenart's avatar Antoine Tenart Committed by David S. Miller

net: mvneta: fix the Rx desc buffer DMA unmapping

With CONFIG_DMA_API_DEBUG enabled we now get a warning when using the
mvneta driver:

  mvneta d0030000.ethernet: DMA-API: device driver frees DMA memory with
  wrong function [device address=0x000000001165b000] [size=4096 bytes]
  [mapped as page] [unmapped as single]

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

Fixes: 562e2f46 ("net: mvneta: Improve the buffer allocation method for SWBM")
Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 76c0ddd8
...@@ -2008,8 +2008,8 @@ static int mvneta_rx_swbm(struct napi_struct *napi, ...@@ -2008,8 +2008,8 @@ static int mvneta_rx_swbm(struct napi_struct *napi,
skb_add_rx_frag(rxq->skb, frag_num, page, skb_add_rx_frag(rxq->skb, frag_num, page,
frag_offset, frag_size, frag_offset, frag_size,
PAGE_SIZE); PAGE_SIZE);
dma_unmap_single(dev->dev.parent, phys_addr, dma_unmap_page(dev->dev.parent, phys_addr,
PAGE_SIZE, DMA_FROM_DEVICE); PAGE_SIZE, DMA_FROM_DEVICE);
rxq->left_size -= frag_size; rxq->left_size -= frag_size;
} }
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment