aboutsummaryrefslogtreecommitdiffstats
path: root/patches.at91/0111-net-macb-memory-barriers-cleanup.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches.at91/0111-net-macb-memory-barriers-cleanup.patch')
-rw-r--r--patches.at91/0111-net-macb-memory-barriers-cleanup.patch96
1 files changed, 96 insertions, 0 deletions
diff --git a/patches.at91/0111-net-macb-memory-barriers-cleanup.patch b/patches.at91/0111-net-macb-memory-barriers-cleanup.patch
new file mode 100644
index 00000000000000..42240f7cc2c6ba
--- /dev/null
+++ b/patches.at91/0111-net-macb-memory-barriers-cleanup.patch
@@ -0,0 +1,96 @@
+From ae87461f10e59a207038af4df8944fabc8c9ac55 Mon Sep 17 00:00:00 2001
+From: Havard Skinnemoen <havard@skinnemoen.net>
+Date: Fri, 28 May 2010 17:13:33 +0200
+Subject: net/macb: memory barriers cleanup
+
+Remove a couple of unneeded barriers and document the remaining ones.
+
+Signed-off-by: Havard Skinnemoen <havard@skinnemoen.net>
+[nicolas.ferre@atmel.com: split patch in topics]
+Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
+---
+ drivers/net/ethernet/cadence/macb.c | 18 ++++++++++++++----
+ 1 file changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
+index e9b909a..a4dcd11 100644
+--- a/drivers/net/ethernet/cadence/macb.c
++++ b/drivers/net/ethernet/cadence/macb.c
+@@ -372,7 +372,9 @@ static void macb_tx(struct macb *bp)
+
+ BUG_ON(skb == NULL);
+
++ /* Make hw descriptor updates visible to CPU */
+ rmb();
++
+ bufstat = bp->tx_ring[tail].ctrl;
+
+ if (!(bufstat & MACB_BIT(TX_USED)))
+@@ -415,7 +417,10 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
+ if (frag == last_frag)
+ break;
+ }
++
++ /* Make descriptor updates visible to hardware */
+ wmb();
++
+ return 1;
+ }
+
+@@ -436,12 +441,14 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
+ frag_len);
+ offset += RX_BUFFER_SIZE;
+ bp->rx_ring[frag].addr &= ~MACB_BIT(RX_USED);
+- wmb();
+
+ if (frag == last_frag)
+ break;
+ }
+
++ /* Make descriptor updates visible to hardware */
++ wmb();
++
+ skb->protocol = eth_type_trans(skb, bp->dev);
+
+ bp->stats.rx_packets++;
+@@ -461,6 +468,8 @@ static void discard_partial_frame(struct macb *bp, unsigned int begin,
+
+ for (frag = begin; frag != end; frag = NEXT_RX(frag))
+ bp->rx_ring[frag].addr &= ~MACB_BIT(RX_USED);
++
++ /* Make descriptor updates visible to hardware */
+ wmb();
+
+ /*
+@@ -479,7 +488,9 @@ static int macb_rx(struct macb *bp, int budget)
+ for (; budget > 0; tail = NEXT_RX(tail)) {
+ u32 addr, ctrl;
+
++ /* Make hw descriptor updates visible to CPU */
+ rmb();
++
+ addr = bp->rx_ring[tail].addr;
+ ctrl = bp->rx_ring[tail].ctrl;
+
+@@ -674,6 +685,8 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
+
+ bp->tx_ring[entry].addr = mapping;
+ bp->tx_ring[entry].ctrl = ctrl;
++
++ /* Make newly initialized descriptor visible to hardware */
+ wmb();
+
+ entry = NEXT_TX(entry);
+@@ -782,9 +795,6 @@ static void macb_init_rings(struct macb *bp)
+
+ static void macb_reset_hw(struct macb *bp)
+ {
+- /* Make sure we have the write buffer for ourselves */
+- wmb();
+-
+ /*
+ * Disable RX and TX (XXX: Should we halt the transmission
+ * more gracefully?)
+--
+1.8.0.197.g5a90748
+