All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre TORGUE <alexandre.torgue@st.com>
To: <netdev@vger.kernel.org>
Cc: <peppe.cavallaro@st.com>, <fabrice.gasnier@st.com>,
	<maxime.coquelin@st.com>
Subject: [PATCH v3 06/17] stmmac: add last_segment field to dma data
Date: Mon, 29 Feb 2016 14:27:32 +0100	[thread overview]
Message-ID: <1456752463-27128-7-git-send-email-alexandre.torgue@st.com> (raw)
In-Reply-To: <1456752463-27128-1-git-send-email-alexandre.torgue@st.com>

From: Giuseppe Cavallaro <peppe.cavallaro@st.com>

last_segment field is read twice from dma descriptors in stmmac_clean().
Add last_segment to dma data so that this flag is from priv
structure in cache instead of memory.
It avoids reading twice from memory for each loop in stmmac_clean().

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>

diff --git a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
index 7fa7ab0d..355eafb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
+++ b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
@@ -150,8 +150,9 @@ static void stmmac_refill_desc3(void *priv_ptr, struct dma_desc *p)
 static void stmmac_clean_desc3(void *priv_ptr, struct dma_desc *p)
 {
 	struct stmmac_priv *priv = (struct stmmac_priv *)priv_ptr;
+	unsigned int entry = priv->dirty_tx;
 
-	if (priv->hw->desc->get_tx_ls(p) && !priv->extend_desc)
+	if (priv->tx_skbuff_dma[entry].last_segment && !priv->extend_desc)
 		/* NOTE: Device will overwrite des3 with timestamp value if
 		 * 1588-2002 time stamping is enabled, hence reinitialize it
 		 * to keep explicit chaining in the descriptor.
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index c497460..0436918 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -46,6 +46,7 @@ struct stmmac_tx_info {
 	dma_addr_t buf;
 	bool map_as_page;
 	unsigned len;
+	bool last_segment;
 };
 
 struct stmmac_priv {
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 90a946f..feae0de 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1094,6 +1094,7 @@ static int init_dma_desc_rings(struct net_device *dev, gfp_t flags)
 		priv->tx_skbuff_dma[i].buf = 0;
 		priv->tx_skbuff_dma[i].map_as_page = false;
 		priv->tx_skbuff_dma[i].len = 0;
+		priv->tx_skbuff_dma[i].last_segment = false;
 		priv->tx_skbuff[i] = NULL;
 	}
 
@@ -1326,7 +1327,7 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
 			break;
 
 		/* Verify tx error by looking at the last segment. */
-		last = priv->hw->desc->get_tx_ls(p);
+		last = priv->tx_skbuff_dma[entry].last_segment;
 		if (likely(last)) {
 			int tx_error =
 			    priv->hw->desc->tx_status(&priv->dev->stats,
@@ -1359,6 +1360,7 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
 			priv->tx_skbuff_dma[entry].map_as_page = false;
 		}
 		priv->hw->mode->clean_desc3(priv, p);
+		priv->tx_skbuff_dma[entry].last_segment = false;
 
 		if (likely(skb != NULL)) {
 			pkts_compl++;
@@ -2028,6 +2030,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	/* Finalize the latest segment. */
 	priv->hw->desc->close_tx_desc(desc);
+	priv->tx_skbuff_dma[entry].last_segment = true;
 
 	wmb();
 	/* According to the coalesce parameter the IC bit for the latest
-- 
1.9.1

  parent reply	other threads:[~2016-02-29 13:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 13:27 [PATCH v3 00/17] stmmac: enhance driver performances and update the version Alexandre TORGUE
2016-02-29 13:27 ` [PATCH v3 01/17] stmmac: share reset function between dwmac100 and dwmac1000 Alexandre TORGUE
2016-02-29 13:27 ` [PATCH v3 02/17] stmmac: rework DMA bus setting and introduce new platform AXI structure Alexandre TORGUE
2016-02-29 13:27 ` [PATCH v3 03/17] stmmac: change descriptor layout Alexandre TORGUE
2016-02-29 13:27 ` [PATCH v3 04/17] stmmac: review RX/TX ring management Alexandre TORGUE
2016-02-29 13:27 ` [PATCH v3 05/17] stmmac: add length field to dma data Alexandre TORGUE
2016-02-29 13:27 ` Alexandre TORGUE [this message]
2016-02-29 13:27 ` [PATCH v3 07/17] stmmac: add is_jumbo " Alexandre TORGUE
2016-02-29 13:27 ` [PATCH v3 08/17] stmmac: merge get_rx_owner into rx_status routine Alexandre TORGUE
2016-02-29 13:27 ` [PATCH v3 09/17] stmmac: optimize tx desc management Alexandre TORGUE
2016-02-29 13:27 ` [PATCH v3 10/17] stmmac: optimize tx clean function Alexandre TORGUE
2016-02-29 13:27 ` [PATCH v3 11/17] stmmac: set dirty index out of the loop Alexandre TORGUE
2016-02-29 13:27 ` [PATCH v3 12/17] stmmac: first frame prep at the end of xmit routine Alexandre TORGUE
2016-02-29 13:27 ` [PATCH v3 13/17] stmmac: do not poll phy handler when attach a switch Alexandre TORGUE
2016-02-29 13:27 ` [PATCH v3 14/17] stmmac: fix phy init when attached to a phy Alexandre TORGUE
2016-02-29 13:27 ` [PATCH v3 15/17] stmmac: do not perform zero-copy for rx frames Alexandre TORGUE
2016-02-29 13:27 ` [PATCH v3 16/17] stmmac: tune rx copy via threshold Alexandre TORGUE
2016-02-29 13:27 ` [PATCH v3 17/17] stmmac: update version to Oct_2015 Alexandre TORGUE
2016-02-29 14:19 ` [PATCH v3 00/17] stmmac: enhance driver performances and update the version Giuseppe CAVALLARO
2016-02-29 16:50 ` Giuseppe CAVALLARO
2016-03-01  9:15   ` Lars Persson
2016-03-01  9:40     ` Giuseppe CAVALLARO
2016-03-02 19:27 ` 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=1456752463-27128-7-git-send-email-alexandre.torgue@st.com \
    --to=alexandre.torgue@st.com \
    --cc=fabrice.gasnier@st.com \
    --cc=maxime.coquelin@st.com \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.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.