netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] stmmac: add memory barriers at appropriate places
@ 2011-07-18  6:54 Giuseppe CAVALLARO
  2011-07-18  6:54 ` [PATCH 2/2] stmmac: Allow SOCs to use Store forward mode eventhough tx_coe is 0. (V2) Giuseppe CAVALLARO
  2011-07-18 17:47 ` [PATCH 1/2] stmmac: add memory barriers at appropriate places David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Giuseppe CAVALLARO @ 2011-07-18  6:54 UTC (permalink / raw)
  To: netdev; +Cc: Shiraz Hashim, Giuseppe Cavallaro

From: Shiraz Hashim <shiraz.hashim@st.com>

This patch, provided by ST SPEAr developers,
has fixed a problem raised on ARM CA9 where
happened that the dma_transmission was enabled before
the dma descriptors were properly filled. To guarantee this
data memory barriers have been explicity used in the driver.

Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com>
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
 drivers/net/stmmac/stmmac_main.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index e25e44a..f3d16d85 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -1045,6 +1045,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
 					  len, DMA_TO_DEVICE);
 		priv->tx_skbuff[entry] = NULL;
 		priv->hw->desc->prepare_tx_desc(desc, 0, len, csum_insertion);
+		wmb();
 		priv->hw->desc->set_tx_owner(desc);
 	}
 
@@ -1056,6 +1057,9 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
 	if (likely(priv->tm->enable))
 		priv->hw->desc->clear_tx_ic(desc);
 #endif
+
+	wmb();
+
 	/* To avoid raise condition */
 	priv->hw->desc->set_tx_owner(first);
 
@@ -1116,6 +1120,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv)
 			}
 			RX_DBG(KERN_INFO "\trefill entry #%d\n", entry);
 		}
+		wmb();
 		priv->hw->desc->set_rx_owner(p + entry);
 	}
 }
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] stmmac: Allow SOCs to use Store forward mode eventhough tx_coe is 0. (V2)
  2011-07-18  6:54 [PATCH 1/2] stmmac: add memory barriers at appropriate places Giuseppe CAVALLARO
@ 2011-07-18  6:54 ` Giuseppe CAVALLARO
  2011-07-18 17:47   ` David Miller
  2011-07-18 17:47 ` [PATCH 1/2] stmmac: add memory barriers at appropriate places David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Giuseppe CAVALLARO @ 2011-07-18  6:54 UTC (permalink / raw)
  To: netdev; +Cc: Srinivas Kandagatla, Giuseppe Cavallaro

From: Srinivas Kandagatla <srinivas.kandagatla@st.com>

This patch adds new field 'force_sf_dma_mode' to plat_stmmacenet_data
struct to allow users to specify if they want to use force store forward
eventhough tx_coe is not available in hw.
without this flag stmmac driver will use cut-thru mode not use
store-forward mode.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
 drivers/net/stmmac/stmmac_main.c |    8 +++++---
 include/linux/stmmac.h           |    1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index f3d16d85..0e0134e 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -557,9 +557,11 @@ static void free_dma_desc_resources(struct stmmac_priv *priv)
  */
 static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
 {
-	if (likely((priv->plat->tx_coe) && (!priv->no_csum_insertion))) {
-		/* In case of GMAC, SF mode has to be enabled
-		 * to perform the TX COE. This depends on:
+	if (likely(priv->plat->force_sf_dma_mode ||
+		((priv->plat->tx_coe) && (!priv->no_csum_insertion)))) {
+		/*
+		 * In case of GMAC, SF mode can be enabled
+		 * to perform the TX COE in HW. This depends on:
 		 * 1) TX COE if actually supported
 		 * 2) There is no bugged Jumbo frame support
 		 *    that needs to not insert csum in the TDES.
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 9529e49..05d7756 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -40,6 +40,7 @@ struct plat_stmmacenet_data {
 	int tx_coe;
 	int bugged_jumbo;
 	int pmt;
+	int force_sf_dma_mode;
 	void (*fix_mac_speed)(void *priv, unsigned int speed);
 	void (*bus_setup)(void __iomem *ioaddr);
 	int (*init)(struct platform_device *pdev);
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] stmmac: add memory barriers at appropriate places
  2011-07-18  6:54 [PATCH 1/2] stmmac: add memory barriers at appropriate places Giuseppe CAVALLARO
  2011-07-18  6:54 ` [PATCH 2/2] stmmac: Allow SOCs to use Store forward mode eventhough tx_coe is 0. (V2) Giuseppe CAVALLARO
@ 2011-07-18 17:47 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2011-07-18 17:47 UTC (permalink / raw)
  To: peppe.cavallaro; +Cc: netdev, shiraz.hashim

From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Date: Mon, 18 Jul 2011 08:54:08 +0200

> From: Shiraz Hashim <shiraz.hashim@st.com>
> 
> This patch, provided by ST SPEAr developers,
> has fixed a problem raised on ARM CA9 where
> happened that the dma_transmission was enabled before
> the dma descriptors were properly filled. To guarantee this
> data memory barriers have been explicity used in the driver.
> 
> Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] stmmac: Allow SOCs to use Store forward mode eventhough tx_coe is 0. (V2)
  2011-07-18  6:54 ` [PATCH 2/2] stmmac: Allow SOCs to use Store forward mode eventhough tx_coe is 0. (V2) Giuseppe CAVALLARO
@ 2011-07-18 17:47   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2011-07-18 17:47 UTC (permalink / raw)
  To: peppe.cavallaro; +Cc: netdev, srinivas.kandagatla

From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Date: Mon, 18 Jul 2011 08:54:09 +0200

> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
> 
> This patch adds new field 'force_sf_dma_mode' to plat_stmmacenet_data
> struct to allow users to specify if they want to use force store forward
> eventhough tx_coe is not available in hw.
> without this flag stmmac driver will use cut-thru mode not use
> store-forward mode.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-18 17:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-18  6:54 [PATCH 1/2] stmmac: add memory barriers at appropriate places Giuseppe CAVALLARO
2011-07-18  6:54 ` [PATCH 2/2] stmmac: Allow SOCs to use Store forward mode eventhough tx_coe is 0. (V2) Giuseppe CAVALLARO
2011-07-18 17:47   ` David Miller
2011-07-18 17:47 ` [PATCH 1/2] stmmac: add memory barriers at appropriate places David Miller

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).