[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5ab58500e78549618b597fdc2e54356a@IL-EXCH01.marvell.com>
Date: Thu, 20 Sep 2018 10:14:56 +0000
From: Yelena Krivosheev <yelena@...vell.com>
To: Antoine Tenart <antoine.tenart@...tlin.com>,
"davem@...emloft.net" <davem@...emloft.net>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"thomas.petazzoni@...tlin.com" <thomas.petazzoni@...tlin.com>,
"maxime.chevallier@...tlin.com" <maxime.chevallier@...tlin.com>,
"gregory.clement@...tlin.com" <gregory.clement@...tlin.com>,
"miquel.raynal@...tlin.com" <miquel.raynal@...tlin.com>,
Nadav Haklai <nadavh@...vell.com>,
Stefan Chulski <stefanc@...vell.com>,
Yan Markman <ymarkman@...vell.com>,
"mw@...ihalf.com" <mw@...ihalf.com>
Subject: RE: [EXT] [PATCH net] net: mvneta: fix the Rx desc buffer DMA
unmapping
Hi Antoine.
Good point.
Please, check and fix all cases of dma_unmap_single() usage.
See mvneta_rxq_drop_pkts()
...
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);
__free_page(data);
...
Thanks.
Yelena
-----Original Message-----
From: Antoine Tenart [mailto:antoine.tenart@...tlin.com]
Sent: Wednesday, September 19, 2018 4:29 PM
To: davem@...emloft.net; Yelena Krivosheev <yelena@...vell.com>
Cc: Antoine Tenart <antoine.tenart@...tlin.com>; netdev@...r.kernel.org; linux-kernel@...r.kernel.org; thomas.petazzoni@...tlin.com; maxime.chevallier@...tlin.com; gregory.clement@...tlin.com; miquel.raynal@...tlin.com; Nadav Haklai <nadavh@...vell.com>; Stefan Chulski <stefanc@...vell.com>; Yan Markman <ymarkman@...vell.com>; mw@...ihalf.com
Subject: [EXT] [PATCH net] net: mvneta: fix the Rx desc buffer DMA unmapping
External Email
----------------------------------------------------------------------
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: 562e2f467e71 ("net: mvneta: Improve the buffer allocation method for SWBM")
Signed-off-by: Antoine Tenart <antoine.tenart@...tlin.com>
---
drivers/net/ethernet/marvell/mvneta.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index bc80a678abc3..2db9708f2e24 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -2008,8 +2008,8 @@ static int mvneta_rx_swbm(struct napi_struct *napi,
skb_add_rx_frag(rxq->skb, frag_num, page,
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;
}
} else {
--
2.17.1
Powered by blists - more mailing lists