From: Yelena Krivosheev <yelena@marvell.com>
To: Antoine Tenart <antoine.tenart@bootlin.com>,
"davem@davemloft.net" <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"thomas.petazzoni@bootlin.com" <thomas.petazzoni@bootlin.com>,
"maxime.chevallier@bootlin.com" <maxime.chevallier@bootlin.com>,
"gregory.clement@bootlin.com" <gregory.clement@bootlin.com>,
"miquel.raynal@bootlin.com" <miquel.raynal@bootlin.com>,
Nadav Haklai <nadavh@marvell.com>,
Stefan Chulski <stefanc@marvell.com>,
Yan Markman <ymarkman@marvell.com>,
"mw@semihalf.com" <mw@semihalf.com>
Subject: RE: [EXT] [PATCH net] net: mvneta: fix the Rx desc buffer DMA unmapping
Date: Thu, 20 Sep 2018 10:14:56 +0000 [thread overview]
Message-ID: <5ab58500e78549618b597fdc2e54356a@IL-EXCH01.marvell.com> (raw)
In-Reply-To: <20180919132906.26868-1-antoine.tenart@bootlin.com>
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@bootlin.com]
Sent: Wednesday, September 19, 2018 4:29 PM
To: davem@davemloft.net; Yelena Krivosheev <yelena@marvell.com>
Cc: Antoine Tenart <antoine.tenart@bootlin.com>; netdev@vger.kernel.org; linux-kernel@vger.kernel.org; thomas.petazzoni@bootlin.com; maxime.chevallier@bootlin.com; gregory.clement@bootlin.com; miquel.raynal@bootlin.com; Nadav Haklai <nadavh@marvell.com>; Stefan Chulski <stefanc@marvell.com>; Yan Markman <ymarkman@marvell.com>; mw@semihalf.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@bootlin.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
next prev parent reply other threads:[~2018-09-20 10:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-19 13:29 [PATCH net] net: mvneta: fix the Rx desc buffer DMA unmapping Antoine Tenart
2018-09-20 4:25 ` David Miller
2018-09-20 10:14 ` Yelena Krivosheev [this message]
2018-09-20 11:20 ` [EXT] " Antoine Tenart
2018-09-20 14:59 ` Gregory CLEMENT
2018-09-22 7:07 ` Yelena Krivosheev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5ab58500e78549618b597fdc2e54356a@IL-EXCH01.marvell.com \
--to=yelena@marvell.com \
--cc=antoine.tenart@bootlin.com \
--cc=davem@davemloft.net \
--cc=gregory.clement@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.chevallier@bootlin.com \
--cc=miquel.raynal@bootlin.com \
--cc=mw@semihalf.com \
--cc=nadavh@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=stefanc@marvell.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=ymarkman@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).