summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandrea merello <andrea.merello@gmail.com>2014-02-18 01:10:46 (GMT)
committerJohn W. Linville <linville@tuxdriver.com>2014-03-04 18:09:42 (GMT)
commitc24782e612dce377cf9149ad787998af7694f757 (patch)
treebc3c0243d176bc3ae8773e483624c961ed6d29a1
parent4c552a5be78bd66abd59441a21fec348ee376b49 (diff)
downloadlinux-c24782e612dce377cf9149ad787998af7694f757.tar.xz
rtl818x: make sure TX descriptor writes are done before kicking DMA
The TX descriptors are consumed by the HW using DMA. Even if in the driver code the TX descriptor writes appears before the HW "dma kick" register writes, the CPU may reorder them. If this happens, the TX may not happen at all becase the "valid" descriptor flag may have not been set yet. This patch adds a write memory barrier to ensures the TX descriptor is written before writing to the HW "dma kick" register. Signed-off-by: Andrea Merello <andrea.merello@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/dev.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c
index 45d2cc1..959e699 100644
--- a/drivers/net/wireless/rtl818x/rtl8180/dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c
@@ -341,6 +341,12 @@ static void rtl8180_tx(struct ieee80211_hw *dev,
*/
wmb();
entry->flags = cpu_to_le32(tx_flags);
+ /* We must be sure this has been written before followings HW
+ * register write, because this write will made the HW attempts
+ * to DMA the just-written data
+ */
+ wmb();
+
__skb_queue_tail(&ring->queue, skb);
if (ring->entries - skb_queue_len(&ring->queue) < 2)
ieee80211_stop_queue(dev, prio);