netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
To: <netdev@vger.kernel.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	David Miller <davem@davemloft.net>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	Gregory Clement <gregory.clement@free-electrons.com>,
	Lior Amsalem <alior@marvell.com>,
	Tawfik Bayouk <tawfik@marvell.com>,
	fugang.duan@freescale.com, Willy Tarreau <w@1wt.eu>,
	Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Subject: [PATCH 8/8] net: mv643xx_eth: Avoid unmapping the TSO header buffers
Date: Fri, 30 May 2014 13:40:11 -0300	[thread overview]
Message-ID: <1401468011-10609-9-git-send-email-ezequiel.garcia@free-electrons.com> (raw)
In-Reply-To: <1401468011-10609-1-git-send-email-ezequiel.garcia@free-electrons.com>

The buffers for the TSO headers belong to a DMA coherent region which is
allocated at ndo_open() time, and released at ndo_stop() time.

Therefore, and contrary to the TSO payload descriptor buffers, the TSO header
buffers don't need to be unmapped. This commit adds a check to detect a
TSO header buffer and explicitly prevent the unmap.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
 drivers/net/ethernet/marvell/mv643xx_eth.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 88afbe0..b151a94 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -189,6 +189,9 @@ static char mv643xx_eth_driver_version[] = "1.4";
 #define MV643XX_MAX_TSO_SEGS 100
 #define MV643XX_MAX_SKB_DESCS (MV643XX_MAX_TSO_SEGS * 2 + MAX_SKB_FRAGS)
 
+#define IS_TSO_HEADER(txq, addr) \
+	((addr >= txq->tso_hdrs_dma) && \
+	 (addr < txq->tso_hdrs_dma + txq->tx_ring_size * TSO_HEADER_SIZE))
 /*
  * RX/TX descriptors.
  */
@@ -1072,8 +1075,9 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force)
 			mp->dev->stats.tx_errors++;
 		}
 
-		dma_unmap_single(mp->dev->dev.parent, desc->buf_ptr,
-				 desc->byte_cnt, DMA_TO_DEVICE);
+		if (!IS_TSO_HEADER(txq, desc->buf_ptr))
+			dma_unmap_single(mp->dev->dev.parent, desc->buf_ptr,
+					 desc->byte_cnt, DMA_TO_DEVICE);
 		dev_kfree_skb(skb);
 	}
 
-- 
1.9.1

  parent reply	other threads:[~2014-05-30 16:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-30 16:40 [PATCH 0/8] ethernet: marvell: After-TSO fixes Ezequiel Garcia
2014-05-30 16:40 ` [PATCH 1/8] net: mvneta: Use default NAPI weight instead of a custom one Ezequiel Garcia
2014-05-30 16:40 ` [PATCH 2/8] net: mvneta: Limit the TSO segments and adjust stop/wake thresholds Ezequiel Garcia
2014-05-30 16:40 ` [PATCH 3/8] net: mvneta: Fix missing DMA region unmap Ezequiel Garcia
2014-05-30 16:40 ` [PATCH 4/8] net: mvneta: Avoid unmapping the TSO header buffers Ezequiel Garcia
2014-05-30 16:40 ` [PATCH 5/8] net: mv643xx_eth: Count dropped packets properly Ezequiel Garcia
2014-05-30 16:40 ` [PATCH 6/8] net: mv643xx_eth: Limit the TSO segments and adjust stop/wake thresholds Ezequiel Garcia
2014-05-30 17:21   ` Eric Dumazet
2014-05-30 18:08     ` Ezequiel Garcia
2014-05-30 16:40 ` [PATCH 7/8] net: mv643xx_eth: Drop the NETDEV_TX_BUSY return path Ezequiel Garcia
2014-05-30 16:40 ` Ezequiel Garcia [this message]
2014-06-02 23:16 ` [PATCH 0/8] ethernet: marvell: After-TSO fixes David Miller

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=1401468011-10609-9-git-send-email-ezequiel.garcia@free-electrons.com \
    --to=ezequiel.garcia@free-electrons.com \
    --cc=alior@marvell.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=fugang.duan@freescale.com \
    --cc=gregory.clement@free-electrons.com \
    --cc=netdev@vger.kernel.org \
    --cc=tawfik@marvell.com \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=w@1wt.eu \
    /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).