Skip to content

Commit

Permalink
rtl818x: make sure TX descriptor writes are done before kicking DMA
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
andrea merello authored and John W. Linville committed Mar 4, 2014
1 parent 4c552a5 commit c24782e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/wireless/rtl818x/rtl8180/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c24782e

Please sign in to comment.