2011-05-25 00:40:54

by Mike McCormack

[permalink] [raw]
Subject: [PATCH 6/8] rtlwifi: Assign rx buffer ownership to hardware last

Ownership of an rx buffer should only be given to the hardware
after all other changes are written, otherwise there's
a potential race.

Signed-off-by: Mike McCormack <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
---
drivers/net/wireless/rtlwifi/pci.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index fd74396..4fe405a 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -782,8 +782,6 @@ done:
rtlpriv->cfg->ops->set_desc((u8 *) pdesc, false,
HW_DESC_RXBUFF_ADDR,
(u8 *)&bufferaddress);
- rtlpriv->cfg->ops->set_desc((u8 *)pdesc, false, HW_DESC_RXOWN,
- (u8 *)&tmp_one);
rtlpriv->cfg->ops->set_desc((u8 *)pdesc, false,
HW_DESC_RXPKT_LEN,
(u8 *)&rtlpci->rxbuffersize);
@@ -793,6 +791,9 @@ done:
HW_DESC_RXERO,
(u8 *)&tmp_one);

+ rtlpriv->cfg->ops->set_desc((u8 *)pdesc, false, HW_DESC_RXOWN,
+ (u8 *)&tmp_one);
+
index = (index + 1) % rtlpci->rxringcount;
}

--
1.7.4.1