1 --- a/drivers/net/wireless/ath/ath9k/ar9002_mac.c
2 +++ b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
3 @@ -208,77 +208,68 @@ static int ar9002_hw_proc_txdesc(struct
4 struct ath_tx_status *ts)
6 struct ar5416_desc *ads = AR5416DESC(ds);
9 - if ((ads->ds_txstatus9 & AR_TxDone) == 0)
10 + status = ACCESS_ONCE(ads->ds_txstatus9);
11 + if ((status & AR_TxDone) == 0)
14 - ts->ts_seqnum = MS(ads->ds_txstatus9, AR_SeqNum);
15 ts->ts_tstamp = ads->AR_SendTimestamp;
19 - if (ads->ds_txstatus1 & AR_FrmXmitOK)
20 + if (status & AR_TxOpExceeded)
21 + ts->ts_status |= ATH9K_TXERR_XTXOP;
22 + ts->tid = MS(status, AR_TxTid);
23 + ts->ts_rateindex = MS(status, AR_FinalTxIdx);
24 + ts->ts_seqnum = MS(status, AR_SeqNum);
26 + status = ACCESS_ONCE(ads->ds_txstatus0);
27 + ts->ts_rssi_ctl0 = MS(status, AR_TxRSSIAnt00);
28 + ts->ts_rssi_ctl1 = MS(status, AR_TxRSSIAnt01);
29 + ts->ts_rssi_ctl2 = MS(status, AR_TxRSSIAnt02);
30 + if (status & AR_TxBaStatus) {
31 + ts->ts_flags |= ATH9K_TX_BA;
32 + ts->ba_low = ads->AR_BaBitmapLow;
33 + ts->ba_high = ads->AR_BaBitmapHigh;
36 + status = ACCESS_ONCE(ads->ds_txstatus1);
37 + if (status & AR_FrmXmitOK)
38 ts->ts_status |= ATH9K_TX_ACKED;
39 - if (ads->ds_txstatus1 & AR_ExcessiveRetries)
40 + if (status & AR_ExcessiveRetries)
41 ts->ts_status |= ATH9K_TXERR_XRETRY;
42 - if (ads->ds_txstatus1 & AR_Filtered)
43 + if (status & AR_Filtered)
44 ts->ts_status |= ATH9K_TXERR_FILT;
45 - if (ads->ds_txstatus1 & AR_FIFOUnderrun) {
46 + if (status & AR_FIFOUnderrun) {
47 ts->ts_status |= ATH9K_TXERR_FIFO;
48 ath9k_hw_updatetxtriglevel(ah, true);
50 - if (ads->ds_txstatus9 & AR_TxOpExceeded)
51 - ts->ts_status |= ATH9K_TXERR_XTXOP;
52 - if (ads->ds_txstatus1 & AR_TxTimerExpired)
53 + if (status & AR_TxTimerExpired)
54 ts->ts_status |= ATH9K_TXERR_TIMER_EXPIRED;
56 - if (ads->ds_txstatus1 & AR_DescCfgErr)
57 + if (status & AR_DescCfgErr)
58 ts->ts_flags |= ATH9K_TX_DESC_CFG_ERR;
59 - if (ads->ds_txstatus1 & AR_TxDataUnderrun) {
60 + if (status & AR_TxDataUnderrun) {
61 ts->ts_flags |= ATH9K_TX_DATA_UNDERRUN;
62 ath9k_hw_updatetxtriglevel(ah, true);
64 - if (ads->ds_txstatus1 & AR_TxDelimUnderrun) {
65 + if (status & AR_TxDelimUnderrun) {
66 ts->ts_flags |= ATH9K_TX_DELIM_UNDERRUN;
67 ath9k_hw_updatetxtriglevel(ah, true);
69 - if (ads->ds_txstatus0 & AR_TxBaStatus) {
70 - ts->ts_flags |= ATH9K_TX_BA;
71 - ts->ba_low = ads->AR_BaBitmapLow;
72 - ts->ba_high = ads->AR_BaBitmapHigh;
75 - ts->ts_rateindex = MS(ads->ds_txstatus9, AR_FinalTxIdx);
76 - switch (ts->ts_rateindex) {
78 - ts->ts_ratecode = MS(ads->ds_ctl3, AR_XmitRate0);
81 - ts->ts_ratecode = MS(ads->ds_ctl3, AR_XmitRate1);
84 - ts->ts_ratecode = MS(ads->ds_ctl3, AR_XmitRate2);
87 - ts->ts_ratecode = MS(ads->ds_ctl3, AR_XmitRate3);
90 + ts->ts_shortretry = MS(status, AR_RTSFailCnt);
91 + ts->ts_longretry = MS(status, AR_DataFailCnt);
92 + ts->ts_virtcol = MS(status, AR_VirtRetryCnt);
94 + status = ACCESS_ONCE(ads->ds_txstatus5);
95 + ts->ts_rssi = MS(status, AR_TxRSSICombined);
96 + ts->ts_rssi_ext0 = MS(status, AR_TxRSSIAnt10);
97 + ts->ts_rssi_ext1 = MS(status, AR_TxRSSIAnt11);
98 + ts->ts_rssi_ext2 = MS(status, AR_TxRSSIAnt12);
100 - ts->ts_rssi = MS(ads->ds_txstatus5, AR_TxRSSICombined);
101 - ts->ts_rssi_ctl0 = MS(ads->ds_txstatus0, AR_TxRSSIAnt00);
102 - ts->ts_rssi_ctl1 = MS(ads->ds_txstatus0, AR_TxRSSIAnt01);
103 - ts->ts_rssi_ctl2 = MS(ads->ds_txstatus0, AR_TxRSSIAnt02);
104 - ts->ts_rssi_ext0 = MS(ads->ds_txstatus5, AR_TxRSSIAnt10);
105 - ts->ts_rssi_ext1 = MS(ads->ds_txstatus5, AR_TxRSSIAnt11);
106 - ts->ts_rssi_ext2 = MS(ads->ds_txstatus5, AR_TxRSSIAnt12);
107 ts->evm0 = ads->AR_TxEVM0;
108 ts->evm1 = ads->AR_TxEVM1;
109 ts->evm2 = ads->AR_TxEVM2;
110 - ts->ts_shortretry = MS(ads->ds_txstatus1, AR_RTSFailCnt);
111 - ts->ts_longretry = MS(ads->ds_txstatus1, AR_DataFailCnt);
112 - ts->ts_virtcol = MS(ads->ds_txstatus1, AR_VirtRetryCnt);
113 - ts->tid = MS(ads->ds_txstatus9, AR_TxTid);
114 - ts->ts_antenna = 0;
118 --- a/drivers/net/wireless/ath/ath9k/mac.h
119 +++ b/drivers/net/wireless/ath/ath9k/mac.h
120 @@ -104,13 +104,11 @@ struct ath_tx_status {
134 @@ -121,7 +119,6 @@ struct ath_tx_status {
142 --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
143 +++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
144 @@ -237,10 +237,12 @@ static int ar9003_hw_proc_txdesc(struct
145 struct ath_tx_status *ts)
147 struct ar9003_txs *ads;
150 ads = &ah->ts_ring[ah->ts_tail];
152 - if ((ads->status8 & AR_TxDone) == 0)
153 + status = ACCESS_ONCE(ads->status8);
154 + if ((status & AR_TxDone) == 0)
157 ah->ts_tail = (ah->ts_tail + 1) % ah->ts_size;
158 @@ -253,57 +255,58 @@ static int ar9003_hw_proc_txdesc(struct
162 + if (status & AR_TxOpExceeded)
163 + ts->ts_status |= ATH9K_TXERR_XTXOP;
164 + ts->ts_rateindex = MS(status, AR_FinalTxIdx);
165 + ts->ts_seqnum = MS(status, AR_SeqNum);
166 + ts->tid = MS(status, AR_TxTid);
168 ts->qid = MS(ads->ds_info, AR_TxQcuNum);
169 ts->desc_id = MS(ads->status1, AR_TxDescId);
170 - ts->ts_seqnum = MS(ads->status8, AR_SeqNum);
171 ts->ts_tstamp = ads->status4;
175 - if (ads->status3 & AR_ExcessiveRetries)
176 + status = ACCESS_ONCE(ads->status2);
177 + ts->ts_rssi_ctl0 = MS(status, AR_TxRSSIAnt00);
178 + ts->ts_rssi_ctl1 = MS(status, AR_TxRSSIAnt01);
179 + ts->ts_rssi_ctl2 = MS(status, AR_TxRSSIAnt02);
180 + if (status & AR_TxBaStatus) {
181 + ts->ts_flags |= ATH9K_TX_BA;
182 + ts->ba_low = ads->status5;
183 + ts->ba_high = ads->status6;
186 + status = ACCESS_ONCE(ads->status3);
187 + if (status & AR_ExcessiveRetries)
188 ts->ts_status |= ATH9K_TXERR_XRETRY;
189 - if (ads->status3 & AR_Filtered)
190 + if (status & AR_Filtered)
191 ts->ts_status |= ATH9K_TXERR_FILT;
192 - if (ads->status3 & AR_FIFOUnderrun) {
193 + if (status & AR_FIFOUnderrun) {
194 ts->ts_status |= ATH9K_TXERR_FIFO;
195 ath9k_hw_updatetxtriglevel(ah, true);
197 - if (ads->status8 & AR_TxOpExceeded)
198 - ts->ts_status |= ATH9K_TXERR_XTXOP;
199 - if (ads->status3 & AR_TxTimerExpired)
200 + if (status & AR_TxTimerExpired)
201 ts->ts_status |= ATH9K_TXERR_TIMER_EXPIRED;
203 - if (ads->status3 & AR_DescCfgErr)
204 + if (status & AR_DescCfgErr)
205 ts->ts_flags |= ATH9K_TX_DESC_CFG_ERR;
206 - if (ads->status3 & AR_TxDataUnderrun) {
207 + if (status & AR_TxDataUnderrun) {
208 ts->ts_flags |= ATH9K_TX_DATA_UNDERRUN;
209 ath9k_hw_updatetxtriglevel(ah, true);
211 - if (ads->status3 & AR_TxDelimUnderrun) {
212 + if (status & AR_TxDelimUnderrun) {
213 ts->ts_flags |= ATH9K_TX_DELIM_UNDERRUN;
214 ath9k_hw_updatetxtriglevel(ah, true);
216 - if (ads->status2 & AR_TxBaStatus) {
217 - ts->ts_flags |= ATH9K_TX_BA;
218 - ts->ba_low = ads->status5;
219 - ts->ba_high = ads->status6;
222 - ts->ts_rateindex = MS(ads->status8, AR_FinalTxIdx);
224 - ts->ts_rssi = MS(ads->status7, AR_TxRSSICombined);
225 - ts->ts_rssi_ctl0 = MS(ads->status2, AR_TxRSSIAnt00);
226 - ts->ts_rssi_ctl1 = MS(ads->status2, AR_TxRSSIAnt01);
227 - ts->ts_rssi_ctl2 = MS(ads->status2, AR_TxRSSIAnt02);
228 - ts->ts_rssi_ext0 = MS(ads->status7, AR_TxRSSIAnt10);
229 - ts->ts_rssi_ext1 = MS(ads->status7, AR_TxRSSIAnt11);
230 - ts->ts_rssi_ext2 = MS(ads->status7, AR_TxRSSIAnt12);
231 - ts->ts_shortretry = MS(ads->status3, AR_RTSFailCnt);
232 - ts->ts_longretry = MS(ads->status3, AR_DataFailCnt);
233 - ts->ts_virtcol = MS(ads->status3, AR_VirtRetryCnt);
234 - ts->ts_antenna = 0;
236 - ts->tid = MS(ads->status8, AR_TxTid);
237 + ts->ts_shortretry = MS(status, AR_RTSFailCnt);
238 + ts->ts_longretry = MS(status, AR_DataFailCnt);
239 + ts->ts_virtcol = MS(status, AR_VirtRetryCnt);
241 + status = ACCESS_ONCE(ads->status7);
242 + ts->ts_rssi = MS(status, AR_TxRSSICombined);
243 + ts->ts_rssi_ext0 = MS(status, AR_TxRSSIAnt10);
244 + ts->ts_rssi_ext1 = MS(status, AR_TxRSSIAnt11);
245 + ts->ts_rssi_ext2 = MS(status, AR_TxRSSIAnt12);
247 memset(ads, 0, sizeof(*ads));