All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Brooks <brian.brooks@linaro.org>
To: davem@davemloft.net
Cc: antoine.tenart@bootlin.com, maxime.chevallier@bootlin.com,
	ymarkman@marvell.com, stefanc@marvell.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	bjorn.topel@intel.com, brian.brooks@arm.com,
	Brian Brooks <brian.brooks@linaro.org>
Subject: [PATCH] net: mvpp2: avoid bouncing buffers
Date: Sun, 19 Aug 2018 21:47:30 -0500	[thread overview]
Message-ID: <20180820024730.9147-1-brian.brooks@linaro.org> (raw)

Some memory regions used by this device need to share the same
upper 8 bits of the 40-bit bus address. Currently, a coherent
DMA mask of 32 bits is used so that dma_alloc_coherent() regions
have the same upper 8 bits. Packet buffers are not allocated via
DMA APIs, and the device does not require these memory regions
to have the same upper 8 bits. However, packet buffers are being
bounced during streaming mappings because streaming and coherent
DMA are using the same DMA mask, i.e. dev->dma_mask points to
dev->coherent_dma_mask.

Avoid bouncing packet buffers by ensuring streaming DMA uses a
mask of 40 bits and coherent DMA uses a mask of 32 bits. iperf3
shows throughput increases from 4.04 Gbps to 9.14 Gbps.

Signed-off-by: Brian Brooks <brian.brooks@linaro.org>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2.h      | 3 +++
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
index def00dc3eb4e..3eb0c3ede8d2 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
@@ -676,6 +676,9 @@ struct mvpp2 {
 	struct clk *mg_core_clk;
 	struct clk *axi_clk;
 
+	/* DMA mask for streaming mappings */
+	u64 dma_mask;
+
 	/* List of pointers to port structures */
 	int port_count;
 	struct mvpp2_port *port_list[MVPP2_MAX_PORTS];
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 0319ed9ef8b8..3a190c489589 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -5126,6 +5126,12 @@ static int mvpp2_probe(struct platform_device *pdev)
 	}
 
 	if (priv->hw_version == MVPP22) {
+		/* Platform code may have set dev->dma_mask to point
+		 * to dev->coherent_dma_mask, but we want to ensure
+		 * they take different values due to comment below.
+		 */
+		pdev->dev.dma_mask = &priv->dma_mask;
+
 		err = dma_set_mask(&pdev->dev, MVPP2_DESC_DMA_MASK);
 		if (err)
 			goto err_axi_clk;
-- 
2.17.1


             reply	other threads:[~2018-08-20  2:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-20  2:47 Brian Brooks [this message]
2018-08-20  2:55 ` [PATCH] net: mvpp2: avoid bouncing buffers David Miller
2018-08-20  6:23   ` Christoph Hellwig
2018-08-20  7:02     ` Yan Markman
2018-08-27 13:55     ` Brian Brooks
2018-08-27 15:48       ` Christoph Hellwig
2018-08-27 15:48         ` Christoph Hellwig
2018-09-02  2:10         ` Brian Brooks
2019-03-01 14:26         ` Antoine Tenart
2019-03-11 15:46           ` Christoph Hellwig

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=20180820024730.9147-1-brian.brooks@linaro.org \
    --to=brian.brooks@linaro.org \
    --cc=antoine.tenart@bootlin.com \
    --cc=bjorn.topel@intel.com \
    --cc=brian.brooks@arm.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=stefanc@marvell.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.