1 --- a/drivers/net/wireless/ath/ath9k/ar9002_mac.c
2 +++ b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
3 @@ -170,33 +170,104 @@ static bool ar9002_hw_get_isr(struct ath
7 -static void ar9002_hw_fill_txdesc(struct ath_hw *ah, void *ds, u32 seglen,
8 - bool is_firstseg, bool is_lastseg,
9 - const void *ds0, dma_addr_t buf_addr,
12 +ar9002_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
14 struct ar5416_desc *ads = AR5416DESC(ds);
17 - ads->ds_data = buf_addr;
20 - ads->ds_ctl1 |= seglen | (is_lastseg ? 0 : AR_TxMore);
21 - } else if (is_lastseg) {
23 - ads->ds_ctl1 = seglen;
24 - ads->ds_ctl2 = AR5416DESC_CONST(ds0)->ds_ctl2;
25 - ads->ds_ctl3 = AR5416DESC_CONST(ds0)->ds_ctl3;
28 - ads->ds_ctl1 = seglen | AR_TxMore;
32 ads->ds_txstatus0 = ads->ds_txstatus1 = 0;
33 ads->ds_txstatus2 = ads->ds_txstatus3 = 0;
34 ads->ds_txstatus4 = ads->ds_txstatus5 = 0;
35 ads->ds_txstatus6 = ads->ds_txstatus7 = 0;
36 ads->ds_txstatus8 = ads->ds_txstatus9 = 0;
38 + ACCESS_ONCE(ads->ds_link) = i->link;
39 + ACCESS_ONCE(ads->ds_data) = i->buf_addr[0];
41 + ctl1 = i->buf_len[0] | (i->is_last ? 0 : AR_TxMore);
42 + ctl6 = SM(i->keytype, AR_EncrType);
44 + if (AR_SREV_9285(ah)) {
51 + if ((i->is_first || i->is_last) &&
52 + i->aggr != AGGR_BUF_MIDDLE && i->aggr != AGGR_BUF_LAST) {
53 + ACCESS_ONCE(ads->ds_ctl2) = set11nTries(i->rates, 0)
54 + | set11nTries(i->rates, 1)
55 + | set11nTries(i->rates, 2)
56 + | set11nTries(i->rates, 3)
57 + | (i->dur_update ? AR_DurUpdateEna : 0)
58 + | SM(0, AR_BurstDur);
60 + ACCESS_ONCE(ads->ds_ctl3) = set11nRate(i->rates, 0)
61 + | set11nRate(i->rates, 1)
62 + | set11nRate(i->rates, 2)
63 + | set11nRate(i->rates, 3);
65 + ACCESS_ONCE(ads->ds_ctl2) = 0;
66 + ACCESS_ONCE(ads->ds_ctl3) = 0;
70 + ACCESS_ONCE(ads->ds_ctl0) = 0;
71 + ACCESS_ONCE(ads->ds_ctl1) = ctl1;
72 + ACCESS_ONCE(ads->ds_ctl6) = ctl6;
76 + ctl1 |= (i->keyix != ATH9K_TXKEYIX_INVALID ? SM(i->keyix, AR_DestIdx) : 0)
77 + | SM(i->type, AR_FrameType)
78 + | (i->flags & ATH9K_TXDESC_NOACK ? AR_NoAck : 0)
79 + | (i->flags & ATH9K_TXDESC_EXT_ONLY ? AR_ExtOnly : 0)
80 + | (i->flags & ATH9K_TXDESC_EXT_AND_CTL ? AR_ExtAndCtl : 0);
83 + case AGGR_BUF_FIRST:
84 + ctl6 |= SM(i->aggr_len, AR_AggrLen);
86 + case AGGR_BUF_MIDDLE:
87 + ctl1 |= AR_IsAggr | AR_MoreAggr;
88 + ctl6 |= SM(i->ndelim, AR_PadDelim);
97 + ACCESS_ONCE(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
98 + | (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
99 + | SM(i->txpower, AR_XmitPower)
100 + | (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
101 + | (i->flags & ATH9K_TXDESC_INTREQ ? AR_TxIntrReq : 0)
102 + | (i->keyix != ATH9K_TXKEYIX_INVALID ? AR_DestIdxValid : 0)
103 + | (i->flags & ATH9K_TXDESC_CLRDMASK ? AR_ClrDestMask : 0)
104 + | (i->flags & ATH9K_TXDESC_RTSENA ? AR_RTSEnable :
105 + (i->flags & ATH9K_TXDESC_CTSENA ? AR_CTSEnable : 0));
107 + ACCESS_ONCE(ads->ds_ctl1) = ctl1;
108 + ACCESS_ONCE(ads->ds_ctl6) = ctl6;
110 + if (i->aggr == AGGR_BUF_MIDDLE || i->aggr == AGGR_BUF_LAST)
113 + ACCESS_ONCE(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
114 + | set11nPktDurRTSCTS(i->rates, 1);
116 + ACCESS_ONCE(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
117 + | set11nPktDurRTSCTS(i->rates, 3);
119 + ACCESS_ONCE(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
120 + | set11nRateFlags(i->rates, 1)
121 + | set11nRateFlags(i->rates, 2)
122 + | set11nRateFlags(i->rates, 3)
123 + | SM(i->rtscts_rate, AR_RTSCTSRate);
126 static int ar9002_hw_proc_txdesc(struct ath_hw *ah, void *ds,
127 @@ -271,145 +342,6 @@ static int ar9002_hw_proc_txdesc(struct
131 -static void ar9002_hw_set11n_txdesc(struct ath_hw *ah, void *ds,
132 - u32 pktLen, enum ath9k_pkt_type type,
133 - u32 txPower, u8 keyIx,
134 - enum ath9k_key_type keyType, u32 flags)
136 - struct ar5416_desc *ads = AR5416DESC(ds);
141 - ads->ds_ctl0 = (pktLen & AR_FrameLen)
142 - | (flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
143 - | SM(txPower, AR_XmitPower)
144 - | (flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
145 - | (flags & ATH9K_TXDESC_INTREQ ? AR_TxIntrReq : 0)
146 - | (keyIx != ATH9K_TXKEYIX_INVALID ? AR_DestIdxValid : 0);
149 - (keyIx != ATH9K_TXKEYIX_INVALID ? SM(keyIx, AR_DestIdx) : 0)
150 - | SM(type, AR_FrameType)
151 - | (flags & ATH9K_TXDESC_NOACK ? AR_NoAck : 0)
152 - | (flags & ATH9K_TXDESC_EXT_ONLY ? AR_ExtOnly : 0)
153 - | (flags & ATH9K_TXDESC_EXT_AND_CTL ? AR_ExtAndCtl : 0);
155 - ads->ds_ctl6 = SM(keyType, AR_EncrType);
157 - if (AR_SREV_9285(ah) || AR_SREV_9271(ah)) {
165 -static void ar9002_hw_set_clrdmask(struct ath_hw *ah, void *ds, bool val)
167 - struct ar5416_desc *ads = AR5416DESC(ds);
170 - ads->ds_ctl0 |= AR_ClrDestMask;
172 - ads->ds_ctl0 &= ~AR_ClrDestMask;
175 -static void ar9002_hw_set11n_ratescenario(struct ath_hw *ah, void *ds,
177 - u32 durUpdateEn, u32 rtsctsRate,
178 - u32 rtsctsDuration,
179 - struct ath9k_11n_rate_series series[],
180 - u32 nseries, u32 flags)
182 - struct ar5416_desc *ads = AR5416DESC(ds);
183 - struct ar5416_desc *last_ads = AR5416DESC(lastds);
186 - if (flags & (ATH9K_TXDESC_RTSENA | ATH9K_TXDESC_CTSENA)) {
187 - ds_ctl0 = ads->ds_ctl0;
189 - if (flags & ATH9K_TXDESC_RTSENA) {
190 - ds_ctl0 &= ~AR_CTSEnable;
191 - ds_ctl0 |= AR_RTSEnable;
193 - ds_ctl0 &= ~AR_RTSEnable;
194 - ds_ctl0 |= AR_CTSEnable;
197 - ads->ds_ctl0 = ds_ctl0;
200 - (ads->ds_ctl0 & ~(AR_RTSEnable | AR_CTSEnable));
203 - ads->ds_ctl2 = set11nTries(series, 0)
204 - | set11nTries(series, 1)
205 - | set11nTries(series, 2)
206 - | set11nTries(series, 3)
207 - | (durUpdateEn ? AR_DurUpdateEna : 0)
208 - | SM(0, AR_BurstDur);
210 - ads->ds_ctl3 = set11nRate(series, 0)
211 - | set11nRate(series, 1)
212 - | set11nRate(series, 2)
213 - | set11nRate(series, 3);
215 - ads->ds_ctl4 = set11nPktDurRTSCTS(series, 0)
216 - | set11nPktDurRTSCTS(series, 1);
218 - ads->ds_ctl5 = set11nPktDurRTSCTS(series, 2)
219 - | set11nPktDurRTSCTS(series, 3);
221 - ads->ds_ctl7 = set11nRateFlags(series, 0)
222 - | set11nRateFlags(series, 1)
223 - | set11nRateFlags(series, 2)
224 - | set11nRateFlags(series, 3)
225 - | SM(rtsctsRate, AR_RTSCTSRate);
226 - last_ads->ds_ctl2 = ads->ds_ctl2;
227 - last_ads->ds_ctl3 = ads->ds_ctl3;
230 -static void ar9002_hw_set11n_aggr_first(struct ath_hw *ah, void *ds,
233 - struct ar5416_desc *ads = AR5416DESC(ds);
235 - ads->ds_ctl1 |= (AR_IsAggr | AR_MoreAggr);
236 - ads->ds_ctl6 &= ~AR_AggrLen;
237 - ads->ds_ctl6 |= SM(aggrLen, AR_AggrLen);
240 -static void ar9002_hw_set11n_aggr_middle(struct ath_hw *ah, void *ds,
243 - struct ar5416_desc *ads = AR5416DESC(ds);
246 - ads->ds_ctl1 |= (AR_IsAggr | AR_MoreAggr);
248 - ctl6 = ads->ds_ctl6;
249 - ctl6 &= ~AR_PadDelim;
250 - ctl6 |= SM(numDelims, AR_PadDelim);
251 - ads->ds_ctl6 = ctl6;
254 -static void ar9002_hw_set11n_aggr_last(struct ath_hw *ah, void *ds)
256 - struct ar5416_desc *ads = AR5416DESC(ds);
258 - ads->ds_ctl1 |= AR_IsAggr;
259 - ads->ds_ctl1 &= ~AR_MoreAggr;
260 - ads->ds_ctl6 &= ~AR_PadDelim;
263 -static void ar9002_hw_clr11n_aggr(struct ath_hw *ah, void *ds)
265 - struct ar5416_desc *ads = AR5416DESC(ds);
267 - ads->ds_ctl1 &= (~AR_IsAggr & ~AR_MoreAggr);
270 void ath9k_hw_setuprxdesc(struct ath_hw *ah, struct ath_desc *ds,
273 @@ -433,13 +365,6 @@ void ar9002_hw_attach_mac_ops(struct ath
274 ops->rx_enable = ar9002_hw_rx_enable;
275 ops->set_desc_link = ar9002_hw_set_desc_link;
276 ops->get_isr = ar9002_hw_get_isr;
277 - ops->fill_txdesc = ar9002_hw_fill_txdesc;
278 + ops->set_txdesc = ar9002_set_txdesc;
279 ops->proc_txdesc = ar9002_hw_proc_txdesc;
280 - ops->set11n_txdesc = ar9002_hw_set11n_txdesc;
281 - ops->set11n_ratescenario = ar9002_hw_set11n_ratescenario;
282 - ops->set11n_aggr_first = ar9002_hw_set11n_aggr_first;
283 - ops->set11n_aggr_middle = ar9002_hw_set11n_aggr_middle;
284 - ops->set11n_aggr_last = ar9002_hw_set11n_aggr_last;
285 - ops->clr11n_aggr = ar9002_hw_clr11n_aggr;
286 - ops->set_clrdmask = ar9002_hw_set_clrdmask;
288 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
289 +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
290 @@ -652,8 +652,9 @@ static void ar9003_hw_detect_outlier(int
291 outlier_idx = max_idx;
293 outlier_idx = min_idx;
295 + mp_coeff[outlier_idx] = mp_avg;
297 - mp_coeff[outlier_idx] = mp_avg;
300 static void ar9003_hw_tx_iqcal_load_avg_2_passes(struct ath_hw *ah,
301 @@ -884,6 +885,7 @@ static bool ar9003_hw_init_cal(struct at
303 ar9003_hw_tx_iq_cal_post_proc(ah);
305 + ath9k_hw_loadnf(ah, chan);
306 ath9k_hw_start_nfcal(ah, true);
308 /* Initialize list pointers */
309 --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
310 +++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
311 @@ -21,6 +21,132 @@ static void ar9003_hw_rx_enable(struct a
312 REG_WRITE(hw, AR_CR, 0);
316 +ar9003_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
318 + struct ar9003_txc *ads = ds;
320 + u32 val, ctl12, ctl17;
322 + val = (ATHEROS_VENDOR_ID << AR_DescId_S) |
323 + (1 << AR_TxRxDesc_S) |
324 + (1 << AR_CtrlStat_S) |
325 + (i->qcu << AR_TxQcuNum_S) | 0x17;
328 + ACCESS_ONCE(ads->info) = val;
330 + checksum += i->link;
331 + ACCESS_ONCE(ads->link) = i->link;
333 + checksum += i->buf_addr[0];
334 + ACCESS_ONCE(ads->data0) = i->buf_addr[0];
335 + checksum += i->buf_addr[1];
336 + ACCESS_ONCE(ads->data1) = i->buf_addr[1];
337 + checksum += i->buf_addr[2];
338 + ACCESS_ONCE(ads->data2) = i->buf_addr[2];
339 + checksum += i->buf_addr[3];
340 + ACCESS_ONCE(ads->data3) = i->buf_addr[3];
342 + checksum += (val = (i->buf_len[0] << AR_BufLen_S) & AR_BufLen);
343 + ACCESS_ONCE(ads->ctl3) = val;
344 + checksum += (val = (i->buf_len[1] << AR_BufLen_S) & AR_BufLen);
345 + ACCESS_ONCE(ads->ctl5) = val;
346 + checksum += (val = (i->buf_len[2] << AR_BufLen_S) & AR_BufLen);
347 + ACCESS_ONCE(ads->ctl7) = val;
348 + checksum += (val = (i->buf_len[3] << AR_BufLen_S) & AR_BufLen);
349 + ACCESS_ONCE(ads->ctl9) = val;
351 + checksum = (u16) (((checksum & 0xffff) + (checksum >> 16)) & 0xffff);
352 + ACCESS_ONCE(ads->ctl10) = checksum;
354 + if (i->is_first || i->is_last) {
355 + ACCESS_ONCE(ads->ctl13) = set11nTries(i->rates, 0)
356 + | set11nTries(i->rates, 1)
357 + | set11nTries(i->rates, 2)
358 + | set11nTries(i->rates, 3)
359 + | (i->dur_update ? AR_DurUpdateEna : 0)
360 + | SM(0, AR_BurstDur);
362 + ACCESS_ONCE(ads->ctl14) = set11nRate(i->rates, 0)
363 + | set11nRate(i->rates, 1)
364 + | set11nRate(i->rates, 2)
365 + | set11nRate(i->rates, 3);
367 + ACCESS_ONCE(ads->ctl13) = 0;
368 + ACCESS_ONCE(ads->ctl14) = 0;
375 + ctl17 = SM(i->keytype, AR_EncrType);
376 + if (!i->is_first) {
377 + ACCESS_ONCE(ads->ctl11) = 0;
378 + ACCESS_ONCE(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
379 + ACCESS_ONCE(ads->ctl15) = 0;
380 + ACCESS_ONCE(ads->ctl16) = 0;
381 + ACCESS_ONCE(ads->ctl17) = ctl17;
382 + ACCESS_ONCE(ads->ctl18) = 0;
383 + ACCESS_ONCE(ads->ctl19) = 0;
387 + ACCESS_ONCE(ads->ctl11) = (i->pkt_len & AR_FrameLen)
388 + | (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
389 + | SM(i->txpower, AR_XmitPower)
390 + | (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
391 + | (i->keyix != ATH9K_TXKEYIX_INVALID ? AR_DestIdxValid : 0)
392 + | (i->flags & ATH9K_TXDESC_LOWRXCHAIN ? AR_LowRxChain : 0)
393 + | (i->flags & ATH9K_TXDESC_CLRDMASK ? AR_ClrDestMask : 0)
394 + | (i->flags & ATH9K_TXDESC_RTSENA ? AR_RTSEnable :
395 + (i->flags & ATH9K_TXDESC_CTSENA ? AR_CTSEnable : 0));
397 + ctl12 = (i->keyix != ATH9K_TXKEYIX_INVALID ?
398 + SM(i->keyix, AR_DestIdx) : 0)
399 + | SM(i->type, AR_FrameType)
400 + | (i->flags & ATH9K_TXDESC_NOACK ? AR_NoAck : 0)
401 + | (i->flags & ATH9K_TXDESC_EXT_ONLY ? AR_ExtOnly : 0)
402 + | (i->flags & ATH9K_TXDESC_EXT_AND_CTL ? AR_ExtAndCtl : 0);
404 + ctl17 |= (i->flags & ATH9K_TXDESC_LDPC ? AR_LDPC : 0);
406 + case AGGR_BUF_FIRST:
407 + ctl17 |= SM(i->aggr_len, AR_AggrLen);
409 + case AGGR_BUF_MIDDLE:
410 + ctl12 |= AR_IsAggr | AR_MoreAggr;
411 + ctl17 |= SM(i->ndelim, AR_PadDelim);
413 + case AGGR_BUF_LAST:
414 + ctl12 |= AR_IsAggr;
416 + case AGGR_BUF_NONE:
420 + val = (i->flags & ATH9K_TXDESC_PAPRD) >> ATH9K_TXDESC_PAPRD_S;
421 + ctl12 |= SM(val, AR_PAPRDChainMask);
423 + ACCESS_ONCE(ads->ctl12) = ctl12;
424 + ACCESS_ONCE(ads->ctl17) = ctl17;
426 + ACCESS_ONCE(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
427 + | set11nPktDurRTSCTS(i->rates, 1);
429 + ACCESS_ONCE(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
430 + | set11nPktDurRTSCTS(i->rates, 3);
432 + ACCESS_ONCE(ads->ctl18) = set11nRateFlags(i->rates, 0)
433 + | set11nRateFlags(i->rates, 1)
434 + | set11nRateFlags(i->rates, 2)
435 + | set11nRateFlags(i->rates, 3)
436 + | SM(i->rtscts_rate, AR_RTSCTSRate);
438 + ACCESS_ONCE(ads->ctl19) = AR_Not_Sounding;
441 static u16 ar9003_calc_ptr_chksum(struct ar9003_txc *ads)
444 @@ -185,47 +311,6 @@ static bool ar9003_hw_get_isr(struct ath
448 -static void ar9003_hw_fill_txdesc(struct ath_hw *ah, void *ds, u32 seglen,
449 - bool is_firstseg, bool is_lastseg,
450 - const void *ds0, dma_addr_t buf_addr,
453 - struct ar9003_txc *ads = (struct ar9003_txc *) ds;
454 - unsigned int descid = 0;
456 - ads->info = (ATHEROS_VENDOR_ID << AR_DescId_S) |
457 - (1 << AR_TxRxDesc_S) |
458 - (1 << AR_CtrlStat_S) |
459 - (qcu << AR_TxQcuNum_S) | 0x17;
461 - ads->data0 = buf_addr;
466 - ads->ctl3 = (seglen << AR_BufLen_S);
467 - ads->ctl3 &= AR_BufLen;
469 - /* Fill in pointer checksum and descriptor id */
470 - ads->ctl10 = ar9003_calc_ptr_chksum(ads);
471 - ads->ctl10 |= (descid << AR_TxDescId_S);
474 - ads->ctl12 |= (is_lastseg ? 0 : AR_TxMore);
475 - } else if (is_lastseg) {
478 - ads->ctl13 = AR9003TXC_CONST(ds0)->ctl13;
479 - ads->ctl14 = AR9003TXC_CONST(ds0)->ctl14;
481 - /* XXX Intermediate descriptor in a multi-descriptor frame.*/
483 - ads->ctl12 = AR_TxMore;
489 static int ar9003_hw_proc_txdesc(struct ath_hw *ah, void *ds,
490 struct ath_tx_status *ts)
492 @@ -310,161 +395,6 @@ static int ar9003_hw_proc_txdesc(struct
496 -static void ar9003_hw_set11n_txdesc(struct ath_hw *ah, void *ds,
497 - u32 pktlen, enum ath9k_pkt_type type, u32 txpower,
498 - u8 keyIx, enum ath9k_key_type keyType, u32 flags)
500 - struct ar9003_txc *ads = (struct ar9003_txc *) ds;
502 - if (txpower > ah->txpower_limit)
503 - txpower = ah->txpower_limit;
508 - ads->ctl11 = (pktlen & AR_FrameLen)
509 - | (flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
510 - | SM(txpower, AR_XmitPower)
511 - | (flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
512 - | (keyIx != ATH9K_TXKEYIX_INVALID ? AR_DestIdxValid : 0)
513 - | (flags & ATH9K_TXDESC_LOWRXCHAIN ? AR_LowRxChain : 0);
516 - (keyIx != ATH9K_TXKEYIX_INVALID ? SM(keyIx, AR_DestIdx) : 0)
517 - | SM(type, AR_FrameType)
518 - | (flags & ATH9K_TXDESC_NOACK ? AR_NoAck : 0)
519 - | (flags & ATH9K_TXDESC_EXT_ONLY ? AR_ExtOnly : 0)
520 - | (flags & ATH9K_TXDESC_EXT_AND_CTL ? AR_ExtAndCtl : 0);
522 - ads->ctl17 = SM(keyType, AR_EncrType) |
523 - (flags & ATH9K_TXDESC_LDPC ? AR_LDPC : 0);
525 - ads->ctl19 = AR_Not_Sounding;
532 -static void ar9003_hw_set_clrdmask(struct ath_hw *ah, void *ds, bool val)
534 - struct ar9003_txc *ads = (struct ar9003_txc *) ds;
537 - ads->ctl11 |= AR_ClrDestMask;
539 - ads->ctl11 &= ~AR_ClrDestMask;
542 -static void ar9003_hw_set11n_ratescenario(struct ath_hw *ah, void *ds,
544 - u32 durUpdateEn, u32 rtsctsRate,
545 - u32 rtsctsDuration,
546 - struct ath9k_11n_rate_series series[],
547 - u32 nseries, u32 flags)
549 - struct ar9003_txc *ads = (struct ar9003_txc *) ds;
550 - struct ar9003_txc *last_ads = (struct ar9003_txc *) lastds;
553 - if (flags & (ATH9K_TXDESC_RTSENA | ATH9K_TXDESC_CTSENA)) {
554 - ctl11 = ads->ctl11;
556 - if (flags & ATH9K_TXDESC_RTSENA) {
557 - ctl11 &= ~AR_CTSEnable;
558 - ctl11 |= AR_RTSEnable;
560 - ctl11 &= ~AR_RTSEnable;
561 - ctl11 |= AR_CTSEnable;
564 - ads->ctl11 = ctl11;
566 - ads->ctl11 = (ads->ctl11 & ~(AR_RTSEnable | AR_CTSEnable));
569 - ads->ctl13 = set11nTries(series, 0)
570 - | set11nTries(series, 1)
571 - | set11nTries(series, 2)
572 - | set11nTries(series, 3)
573 - | (durUpdateEn ? AR_DurUpdateEna : 0)
574 - | SM(0, AR_BurstDur);
576 - ads->ctl14 = set11nRate(series, 0)
577 - | set11nRate(series, 1)
578 - | set11nRate(series, 2)
579 - | set11nRate(series, 3);
581 - ads->ctl15 = set11nPktDurRTSCTS(series, 0)
582 - | set11nPktDurRTSCTS(series, 1);
584 - ads->ctl16 = set11nPktDurRTSCTS(series, 2)
585 - | set11nPktDurRTSCTS(series, 3);
587 - ads->ctl18 = set11nRateFlags(series, 0)
588 - | set11nRateFlags(series, 1)
589 - | set11nRateFlags(series, 2)
590 - | set11nRateFlags(series, 3)
591 - | SM(rtsctsRate, AR_RTSCTSRate);
592 - ads->ctl19 = AR_Not_Sounding;
594 - last_ads->ctl13 = ads->ctl13;
595 - last_ads->ctl14 = ads->ctl14;
598 -static void ar9003_hw_set11n_aggr_first(struct ath_hw *ah, void *ds,
601 - struct ar9003_txc *ads = (struct ar9003_txc *) ds;
603 - ads->ctl12 |= (AR_IsAggr | AR_MoreAggr);
605 - ads->ctl17 &= ~AR_AggrLen;
606 - ads->ctl17 |= SM(aggrLen, AR_AggrLen);
609 -static void ar9003_hw_set11n_aggr_middle(struct ath_hw *ah, void *ds,
612 - struct ar9003_txc *ads = (struct ar9003_txc *) ds;
613 - unsigned int ctl17;
615 - ads->ctl12 |= (AR_IsAggr | AR_MoreAggr);
618 - * We use a stack variable to manipulate ctl6 to reduce uncached
619 - * read modify, modfiy, write.
621 - ctl17 = ads->ctl17;
622 - ctl17 &= ~AR_PadDelim;
623 - ctl17 |= SM(numDelims, AR_PadDelim);
624 - ads->ctl17 = ctl17;
627 -static void ar9003_hw_set11n_aggr_last(struct ath_hw *ah, void *ds)
629 - struct ar9003_txc *ads = (struct ar9003_txc *) ds;
631 - ads->ctl12 |= AR_IsAggr;
632 - ads->ctl12 &= ~AR_MoreAggr;
633 - ads->ctl17 &= ~AR_PadDelim;
636 -static void ar9003_hw_clr11n_aggr(struct ath_hw *ah, void *ds)
638 - struct ar9003_txc *ads = (struct ar9003_txc *) ds;
640 - ads->ctl12 &= (~AR_IsAggr & ~AR_MoreAggr);
643 -void ar9003_hw_set_paprd_txdesc(struct ath_hw *ah, void *ds, u8 chains)
645 - struct ar9003_txc *ads = ds;
647 - ads->ctl12 |= SM(chains, AR_PAPRDChainMask);
649 -EXPORT_SYMBOL(ar9003_hw_set_paprd_txdesc);
651 void ar9003_hw_attach_mac_ops(struct ath_hw *hw)
653 struct ath_hw_ops *ops = ath9k_hw_ops(hw);
654 @@ -472,15 +402,8 @@ void ar9003_hw_attach_mac_ops(struct ath
655 ops->rx_enable = ar9003_hw_rx_enable;
656 ops->set_desc_link = ar9003_hw_set_desc_link;
657 ops->get_isr = ar9003_hw_get_isr;
658 - ops->fill_txdesc = ar9003_hw_fill_txdesc;
659 + ops->set_txdesc = ar9003_set_txdesc;
660 ops->proc_txdesc = ar9003_hw_proc_txdesc;
661 - ops->set11n_txdesc = ar9003_hw_set11n_txdesc;
662 - ops->set11n_ratescenario = ar9003_hw_set11n_ratescenario;
663 - ops->set11n_aggr_first = ar9003_hw_set11n_aggr_first;
664 - ops->set11n_aggr_middle = ar9003_hw_set11n_aggr_middle;
665 - ops->set11n_aggr_last = ar9003_hw_set11n_aggr_last;
666 - ops->clr11n_aggr = ar9003_hw_clr11n_aggr;
667 - ops->set_clrdmask = ar9003_hw_set_clrdmask;
670 void ath9k_hw_set_rx_bufsize(struct ath_hw *ah, u16 buf_size)
671 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
672 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
673 @@ -87,17 +87,14 @@ struct ath_config {
674 * @BUF_AMPDU: This buffer is an ampdu, as part of an aggregate (during TX)
675 * @BUF_AGGR: Indicates whether the buffer can be aggregated
676 * (used in aggregation scheduling)
677 - * @BUF_XRETRY: To denote excessive retries of the buffer
682 - BUF_XRETRY = BIT(2),
685 #define bf_isampdu(bf) (bf->bf_state.bf_type & BUF_AMPDU)
686 #define bf_isaggr(bf) (bf->bf_state.bf_type & BUF_AGGR)
687 -#define bf_isxretried(bf) (bf->bf_state.bf_type & BUF_XRETRY)
689 #define ATH_TXSTATUS_RING_SIZE 64
691 @@ -216,6 +213,7 @@ struct ath_frame_info {
692 struct ath_buf_state {
697 unsigned long bfs_paprd_timestamp;
699 @@ -230,7 +228,6 @@ struct ath_buf {
700 dma_addr_t bf_daddr; /* physical addr of desc */
701 dma_addr_t bf_buf_addr; /* physical addr of data buffer, for DMA */
704 struct ath_buf_state bf_state;
707 @@ -277,8 +274,7 @@ struct ath_tx_control {
710 #define ATH_TX_ERROR 0x01
711 -#define ATH_TX_XRETRY 0x02
712 -#define ATH_TX_BAR 0x04
713 +#define ATH_TX_BAR 0x02
716 * @txq_map: Index is mac80211 queue number. This is
717 --- a/drivers/net/wireless/ath/ath9k/beacon.c
718 +++ b/drivers/net/wireless/ath/ath9k/beacon.c
719 @@ -73,44 +73,39 @@ static void ath_beacon_setup(struct ath_
720 struct sk_buff *skb = bf->bf_mpdu;
721 struct ath_hw *ah = sc->sc_ah;
722 struct ath_common *common = ath9k_hw_common(ah);
723 - struct ath_desc *ds;
724 - struct ath9k_11n_rate_series series[4];
725 - int flags, ctsrate = 0, ctsduration = 0;
726 + struct ath_tx_info info;
727 struct ieee80211_supported_band *sband;
728 + u8 chainmask = ah->txchainmask;
731 ath9k_reset_beacon_status(sc);
734 - flags = ATH9K_TXDESC_NOACK;
738 sband = &sc->sbands[common->hw->conf.channel->band];
739 rate = sband->bitrates[rateidx].hw_value;
740 if (sc->sc_flags & SC_OP_PREAMBLE_SHORT)
741 rate |= sband->bitrates[rateidx].hw_value_short;
743 - ath9k_hw_set11n_txdesc(ah, ds, skb->len + FCS_LEN,
744 - ATH9K_PKT_TYPE_BEACON,
746 - ATH9K_TXKEYIX_INVALID,
747 - ATH9K_KEY_TYPE_CLEAR,
750 - /* NB: beacon's BufLen must be a multiple of 4 bytes */
751 - ath9k_hw_filltxdesc(ah, ds, roundup(skb->len, 4),
752 - true, true, ds, bf->bf_buf_addr,
753 - sc->beacon.beaconq);
755 - memset(series, 0, sizeof(struct ath9k_11n_rate_series) * 4);
756 - series[0].Tries = 1;
757 - series[0].Rate = rate;
758 - series[0].ChSel = ath_txchainmask_reduction(sc,
759 - ah->txchainmask, series[0].Rate);
760 - series[0].RateFlags = (ctsrate) ? ATH9K_RATESERIES_RTS_CTS : 0;
761 - ath9k_hw_set11n_ratescenario(ah, ds, ds, 0, ctsrate, ctsduration,
763 + memset(&info, 0, sizeof(info));
764 + info.pkt_len = skb->len + FCS_LEN;
765 + info.type = ATH9K_PKT_TYPE_BEACON;
766 + info.txpower = MAX_RATE_POWER;
767 + info.keyix = ATH9K_TXKEYIX_INVALID;
768 + info.keytype = ATH9K_KEY_TYPE_CLEAR;
769 + info.flags = ATH9K_TXDESC_NOACK;
771 + info.buf_addr[0] = bf->bf_buf_addr;
772 + info.buf_len[0] = roundup(skb->len, 4);
774 + info.is_first = true;
775 + info.is_last = true;
777 + info.qcu = sc->beacon.beaconq;
779 + info.rates[0].Tries = 1;
780 + info.rates[0].Rate = rate;
781 + info.rates[0].ChSel = ath_txchainmask_reduction(sc, chainmask, rate);
783 + ath9k_hw_set_txdesc(ah, bf->bf_desc, &info);
786 static void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb)
787 @@ -517,6 +512,7 @@ static void ath_beacon_config_ap(struct
788 /* Set the computed AP beacon timers */
790 ath9k_hw_disable_interrupts(ah);
791 + sc->sc_flags |= SC_OP_TSF_RESET;
792 ath9k_beacon_init(sc, nexttbtt, intval);
793 sc->beacon.bmisscnt = 0;
794 ath9k_hw_set_interrupts(ah, ah->imask);
795 --- a/drivers/net/wireless/ath/ath9k/debug.c
796 +++ b/drivers/net/wireless/ath/ath9k/debug.c
797 @@ -826,7 +826,8 @@ static ssize_t read_file_misc(struct fil
800 void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
801 - struct ath_tx_status *ts, struct ath_txq *txq)
802 + struct ath_tx_status *ts, struct ath_txq *txq,
803 + unsigned int flags)
805 #define TX_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].ts\
807 @@ -836,12 +837,12 @@ void ath_debug_stat_tx(struct ath_softc
808 sc->debug.stats.txstats[qnum].tx_bytes_all += bf->bf_mpdu->len;
810 if (bf_isampdu(bf)) {
811 - if (bf_isxretried(bf))
812 + if (flags & ATH_TX_BAR)
813 TX_STAT_INC(qnum, a_xretries);
815 TX_STAT_INC(qnum, a_completed);
817 - if (bf_isxretried(bf))
818 + if (ts->ts_status & ATH9K_TXERR_XRETRY)
819 TX_STAT_INC(qnum, xretries);
821 TX_STAT_INC(qnum, completed);
822 --- a/drivers/net/wireless/ath/ath9k/debug.h
823 +++ b/drivers/net/wireless/ath/ath9k/debug.h
824 @@ -230,7 +230,8 @@ int ath9k_init_debug(struct ath_hw *ah);
825 void ath9k_debug_samp_bb_mac(struct ath_softc *sc);
826 void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
827 void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
828 - struct ath_tx_status *ts, struct ath_txq *txq);
829 + struct ath_tx_status *ts, struct ath_txq *txq,
830 + unsigned int flags);
831 void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs);
834 @@ -252,7 +253,8 @@ static inline void ath_debug_stat_interr
835 static inline void ath_debug_stat_tx(struct ath_softc *sc,
837 struct ath_tx_status *ts,
838 - struct ath_txq *txq)
839 + struct ath_txq *txq,
840 + unsigned int flags)
844 --- a/drivers/net/wireless/ath/ath9k/hw-ops.h
845 +++ b/drivers/net/wireless/ath/ath9k/hw-ops.h
846 @@ -54,13 +54,10 @@ static inline bool ath9k_hw_getisr(struc
847 return ath9k_hw_ops(ah)->get_isr(ah, masked);
850 -static inline void ath9k_hw_filltxdesc(struct ath_hw *ah, void *ds, u32 seglen,
851 - bool is_firstseg, bool is_lastseg,
852 - const void *ds0, dma_addr_t buf_addr,
854 +static inline void ath9k_hw_set_txdesc(struct ath_hw *ah, void *ds,
855 + struct ath_tx_info *i)
857 - ath9k_hw_ops(ah)->fill_txdesc(ah, ds, seglen, is_firstseg, is_lastseg,
858 - ds0, buf_addr, qcu);
859 + return ath9k_hw_ops(ah)->set_txdesc(ah, ds, i);
862 static inline int ath9k_hw_txprocdesc(struct ath_hw *ah, void *ds,
863 @@ -69,55 +66,6 @@ static inline int ath9k_hw_txprocdesc(st
864 return ath9k_hw_ops(ah)->proc_txdesc(ah, ds, ts);
867 -static inline void ath9k_hw_set11n_txdesc(struct ath_hw *ah, void *ds,
868 - u32 pktLen, enum ath9k_pkt_type type,
869 - u32 txPower, u32 keyIx,
870 - enum ath9k_key_type keyType,
873 - ath9k_hw_ops(ah)->set11n_txdesc(ah, ds, pktLen, type, txPower, keyIx,
877 -static inline void ath9k_hw_set11n_ratescenario(struct ath_hw *ah, void *ds,
879 - u32 durUpdateEn, u32 rtsctsRate,
880 - u32 rtsctsDuration,
881 - struct ath9k_11n_rate_series series[],
882 - u32 nseries, u32 flags)
884 - ath9k_hw_ops(ah)->set11n_ratescenario(ah, ds, lastds, durUpdateEn,
885 - rtsctsRate, rtsctsDuration, series,
889 -static inline void ath9k_hw_set11n_aggr_first(struct ath_hw *ah, void *ds,
892 - ath9k_hw_ops(ah)->set11n_aggr_first(ah, ds, aggrLen);
895 -static inline void ath9k_hw_set11n_aggr_middle(struct ath_hw *ah, void *ds,
898 - ath9k_hw_ops(ah)->set11n_aggr_middle(ah, ds, numDelims);
901 -static inline void ath9k_hw_set11n_aggr_last(struct ath_hw *ah, void *ds)
903 - ath9k_hw_ops(ah)->set11n_aggr_last(ah, ds);
906 -static inline void ath9k_hw_clr11n_aggr(struct ath_hw *ah, void *ds)
908 - ath9k_hw_ops(ah)->clr11n_aggr(ah, ds);
911 -static inline void ath9k_hw_set_clrdmask(struct ath_hw *ah, void *ds, bool val)
913 - ath9k_hw_ops(ah)->set_clrdmask(ah, ds, val);
916 static inline void ath9k_hw_antdiv_comb_conf_get(struct ath_hw *ah,
917 struct ath_hw_antcomb_conf *antconf)
919 @@ -233,11 +181,6 @@ static inline void ath9k_hw_restore_chai
920 return ath9k_hw_private_ops(ah)->restore_chainmask(ah);
923 -static inline void ath9k_hw_set_diversity(struct ath_hw *ah, bool value)
925 - return ath9k_hw_private_ops(ah)->set_diversity(ah, value);
928 static inline bool ath9k_hw_ani_control(struct ath_hw *ah,
929 enum ath9k_ani_cmd cmd, int param)
931 --- a/drivers/net/wireless/ath/ath9k/hw.c
932 +++ b/drivers/net/wireless/ath/ath9k/hw.c
933 @@ -1496,14 +1496,16 @@ int ath9k_hw_reset(struct ath_hw *ah, st
935 ah->noise = ath9k_hw_getchan_noise(ah, chan);
937 + if ((AR_SREV_9280(ah) && common->bus_ops->ath_bus_type == ATH_PCI) ||
938 + (AR_SREV_9300_20_OR_LATER(ah) && IS_CHAN_5GHZ(chan)))
939 + bChannelChange = false;
941 if (bChannelChange &&
942 (ah->chip_fullsleep != true) &&
943 (ah->curchan != NULL) &&
944 (chan->channel != ah->curchan->channel) &&
945 ((chan->channelFlags & CHANNEL_ALL) ==
946 - (ah->curchan->channelFlags & CHANNEL_ALL)) &&
947 - (!AR_SREV_9280(ah) || AR_DEVID_7010(ah))) {
949 + (ah->curchan->channelFlags & CHANNEL_ALL))) {
950 if (ath9k_hw_channel_change(ah, chan)) {
951 ath9k_hw_loadnf(ah, ah->curchan);
952 ath9k_hw_start_nfcal(ah, true);
953 --- a/drivers/net/wireless/ath/ath9k/hw.h
954 +++ b/drivers/net/wireless/ath/ath9k/hw.h
955 @@ -583,7 +583,6 @@ struct ath_hw_private_ops {
956 bool (*rfbus_req)(struct ath_hw *ah);
957 void (*rfbus_done)(struct ath_hw *ah);
958 void (*restore_chainmask)(struct ath_hw *ah);
959 - void (*set_diversity)(struct ath_hw *ah, bool value);
960 u32 (*compute_pll_control)(struct ath_hw *ah,
961 struct ath9k_channel *chan);
962 bool (*ani_control)(struct ath_hw *ah, enum ath9k_ani_cmd cmd,
963 @@ -615,30 +614,10 @@ struct ath_hw_ops {
966 bool (*get_isr)(struct ath_hw *ah, enum ath9k_int *masked);
967 - void (*fill_txdesc)(struct ath_hw *ah, void *ds, u32 seglen,
968 - bool is_firstseg, bool is_is_lastseg,
969 - const void *ds0, dma_addr_t buf_addr,
971 + void (*set_txdesc)(struct ath_hw *ah, void *ds,
972 + struct ath_tx_info *i);
973 int (*proc_txdesc)(struct ath_hw *ah, void *ds,
974 struct ath_tx_status *ts);
975 - void (*set11n_txdesc)(struct ath_hw *ah, void *ds,
976 - u32 pktLen, enum ath9k_pkt_type type,
977 - u32 txPower, u8 keyIx,
978 - enum ath9k_key_type keyType,
980 - void (*set11n_ratescenario)(struct ath_hw *ah, void *ds,
982 - u32 durUpdateEn, u32 rtsctsRate,
983 - u32 rtsctsDuration,
984 - struct ath9k_11n_rate_series series[],
985 - u32 nseries, u32 flags);
986 - void (*set11n_aggr_first)(struct ath_hw *ah, void *ds,
988 - void (*set11n_aggr_middle)(struct ath_hw *ah, void *ds,
990 - void (*set11n_aggr_last)(struct ath_hw *ah, void *ds);
991 - void (*clr11n_aggr)(struct ath_hw *ah, void *ds);
992 - void (*set_clrdmask)(struct ath_hw *ah, void *ds, bool val);
993 void (*antdiv_comb_conf_get)(struct ath_hw *ah,
994 struct ath_hw_antcomb_conf *antconf);
995 void (*antdiv_comb_conf_set)(struct ath_hw *ah,
996 --- a/drivers/net/wireless/ath/ath9k/mac.c
997 +++ b/drivers/net/wireless/ath/ath9k/mac.c
998 @@ -62,18 +62,6 @@ void ath9k_hw_txstart(struct ath_hw *ah,
1000 EXPORT_SYMBOL(ath9k_hw_txstart);
1002 -void ath9k_hw_cleartxdesc(struct ath_hw *ah, void *ds)
1004 - struct ar5416_desc *ads = AR5416DESC(ds);
1006 - ads->ds_txstatus0 = ads->ds_txstatus1 = 0;
1007 - ads->ds_txstatus2 = ads->ds_txstatus3 = 0;
1008 - ads->ds_txstatus4 = ads->ds_txstatus5 = 0;
1009 - ads->ds_txstatus6 = ads->ds_txstatus7 = 0;
1010 - ads->ds_txstatus8 = ads->ds_txstatus9 = 0;
1012 -EXPORT_SYMBOL(ath9k_hw_cleartxdesc);
1014 u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q)
1017 @@ -596,7 +584,7 @@ int ath9k_hw_rxprocdesc(struct ath_hw *a
1019 rs->rs_keyix = ATH9K_RXKEYIX_INVALID;
1021 - rs->rs_rate = RXSTATUS_RATE(ah, (&ads));
1022 + rs->rs_rate = MS(ads.ds_rxstatus0, AR_RxRate);
1023 rs->rs_more = (ads.ds_rxstatus1 & AR_RxMore) ? 1 : 0;
1025 rs->rs_isaggr = (ads.ds_rxstatus8 & AR_RxAggr) ? 1 : 0;
1026 --- a/drivers/net/wireless/ath/ath9k/mac.h
1027 +++ b/drivers/net/wireless/ath/ath9k/mac.h
1032 -#define RXSTATUS_RATE(ah, ads) (AR_SREV_5416_20_OR_LATER(ah) ? \
1033 - MS(ads->ds_rxstatus0, AR_RxRate) : \
1034 - (ads->ds_rxstatus3 >> 2) & 0xFF)
1036 #define set11nTries(_series, _index) \
1037 (SM((_series)[_index].Tries, AR_XmitDataTries##_index))
1039 @@ -263,7 +259,11 @@ struct ath_desc {
1040 #define ATH9K_TXDESC_VMF 0x0100
1041 #define ATH9K_TXDESC_FRAG_IS_ON 0x0200
1042 #define ATH9K_TXDESC_LOWRXCHAIN 0x0400
1043 -#define ATH9K_TXDESC_LDPC 0x00010000
1044 +#define ATH9K_TXDESC_LDPC 0x0800
1045 +#define ATH9K_TXDESC_CLRDMASK 0x1000
1047 +#define ATH9K_TXDESC_PAPRD 0x70000
1048 +#define ATH9K_TXDESC_PAPRD_S 16
1050 #define ATH9K_RXDESC_INTREQ 0x0020
1052 @@ -659,6 +659,13 @@ struct ath9k_11n_rate_series {
1063 enum ath9k_key_type {
1064 ATH9K_KEY_TYPE_CLEAR,
1066 @@ -666,6 +673,33 @@ enum ath9k_key_type {
1067 ATH9K_KEY_TYPE_TKIP,
1070 +struct ath_tx_info {
1076 + enum aggr_type aggr;
1084 + dma_addr_t buf_addr[4];
1087 + struct ath9k_11n_rate_series rates[4];
1091 + enum ath9k_pkt_type type;
1092 + enum ath9k_key_type keytype;
1098 struct ath9k_channel;
1100 @@ -673,7 +707,6 @@ enum ath9k_int;
1101 u32 ath9k_hw_gettxbuf(struct ath_hw *ah, u32 q);
1102 void ath9k_hw_puttxbuf(struct ath_hw *ah, u32 q, u32 txdp);
1103 void ath9k_hw_txstart(struct ath_hw *ah, u32 q);
1104 -void ath9k_hw_cleartxdesc(struct ath_hw *ah, void *ds);
1105 u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q);
1106 bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel);
1107 bool ath9k_hw_stop_dma_queue(struct ath_hw *ah, u32 q);
1108 --- a/drivers/net/wireless/ath/ath9k/main.c
1109 +++ b/drivers/net/wireless/ath/ath9k/main.c
1110 @@ -111,24 +111,29 @@ void ath9k_ps_wakeup(struct ath_softc *s
1111 void ath9k_ps_restore(struct ath_softc *sc)
1113 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1114 + enum ath9k_power_mode mode;
1115 unsigned long flags;
1117 spin_lock_irqsave(&sc->sc_pm_lock, flags);
1118 if (--sc->ps_usecount != 0)
1121 - spin_lock(&common->cc_lock);
1122 - ath_hw_cycle_counters_update(common);
1123 - spin_unlock(&common->cc_lock);
1126 - ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP);
1127 + mode = ATH9K_PM_FULL_SLEEP;
1128 else if (sc->ps_enabled &&
1129 !(sc->ps_flags & (PS_WAIT_FOR_BEACON |
1131 PS_WAIT_FOR_PSPOLL_DATA |
1132 PS_WAIT_FOR_TX_ACK)))
1133 - ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_NETWORK_SLEEP);
1134 + mode = ATH9K_PM_NETWORK_SLEEP;
1138 + spin_lock(&common->cc_lock);
1139 + ath_hw_cycle_counters_update(common);
1140 + spin_unlock(&common->cc_lock);
1142 + ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_NETWORK_SLEEP);
1145 spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
1146 @@ -247,8 +252,8 @@ static bool ath_prepare_reset(struct ath
1149 if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
1150 - ath_rx_tasklet(sc, 0, true);
1151 - ath_rx_tasklet(sc, 0, false);
1152 + ath_rx_tasklet(sc, 1, true);
1153 + ath_rx_tasklet(sc, 1, false);
1157 @@ -669,15 +674,15 @@ void ath9k_tasklet(unsigned long data)
1158 u32 status = sc->intrstatus;
1161 + ath9k_ps_wakeup(sc);
1162 + spin_lock(&sc->sc_pcu_lock);
1164 if ((status & ATH9K_INT_FATAL) ||
1165 (status & ATH9K_INT_BB_WATCHDOG)) {
1166 ieee80211_queue_work(sc->hw, &sc->hw_reset_work);
1171 - ath9k_ps_wakeup(sc);
1172 - spin_lock(&sc->sc_pcu_lock);
1175 * Only run the baseband hang check if beacons stop working in AP or
1176 * IBSS mode, because it has a high false positive rate. For station
1177 @@ -725,6 +730,7 @@ void ath9k_tasklet(unsigned long data)
1178 if (status & ATH9K_INT_GENTIMER)
1179 ath_gen_timer_isr(sc->sc_ah);
1182 /* re-enable hardware interrupt */
1183 ath9k_hw_enable_interrupts(ah);
1185 @@ -2015,6 +2021,7 @@ static void ath9k_config_bss(struct ath_
1187 sc->sc_flags &= ~SC_OP_ANI_RUN;
1188 del_timer_sync(&common->ani.timer);
1189 + memset(&sc->caldata, 0, sizeof(sc->caldata));
1193 --- a/drivers/net/wireless/ath/ath9k/pci.c
1194 +++ b/drivers/net/wireless/ath/ath9k/pci.c
1195 @@ -332,16 +332,16 @@ static int ath_pci_resume(struct device
1196 if ((val & 0x0000ff00) != 0)
1197 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
1199 + ath9k_ps_wakeup(sc);
1201 ath9k_hw_cfg_output(sc->sc_ah, sc->sc_ah->led_pin,
1202 AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
1203 - ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);
1204 + ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 0);
1207 * Reset key cache to sane defaults (all entries cleared) instead of
1208 * semi-random values after suspend/resume.
1210 - ath9k_ps_wakeup(sc);
1211 ath9k_cmn_init_crypto(sc->sc_ah);
1212 ath9k_ps_restore(sc);
1214 --- a/drivers/net/wireless/ath/ath9k/recv.c
1215 +++ b/drivers/net/wireless/ath/ath9k/recv.c
1216 @@ -1839,7 +1839,7 @@ int ath_rx_tasklet(struct ath_softc *sc,
1217 * If we're asked to flush receive queue, directly
1218 * chain it back at the queue without processing it.
1221 + if (sc->sc_flags & SC_OP_RXFLUSH)
1222 goto requeue_drop_frag;
1224 retval = ath9k_rx_skb_preprocess(common, hw, hdr, &rs,
1225 @@ -1967,7 +1967,8 @@ requeue:
1227 list_move_tail(&bf->list, &sc->rx.rxbuf);
1228 ath_rx_buf_link(sc, bf);
1229 - ath9k_hw_rxena(ah);
1231 + ath9k_hw_rxena(ah);
1235 --- a/drivers/net/wireless/ath/ath9k/xmit.c
1236 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
1237 @@ -56,10 +56,9 @@ static void ath_tx_complete_buf(struct a
1238 struct ath_tx_status *ts, int txok, int sendbar);
1239 static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
1240 struct list_head *head, bool internal);
1241 -static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len);
1242 static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
1243 struct ath_tx_status *ts, int nframes, int nbad,
1244 - int txok, bool update_rc);
1246 static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
1248 static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
1249 @@ -263,6 +262,7 @@ static void ath_tx_set_retry(struct ath_
1250 struct sk_buff *skb)
1252 struct ath_frame_info *fi = get_frame_info(skb);
1253 + struct ath_buf *bf = fi->bf;
1254 struct ieee80211_hdr *hdr;
1256 TX_STAT_INC(txq->axq_qnum, a_retries);
1257 @@ -271,6 +271,8 @@ static void ath_tx_set_retry(struct ath_
1259 hdr = (struct ieee80211_hdr *)skb->data;
1260 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_RETRY);
1261 + dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
1262 + sizeof(*hdr), DMA_TO_DEVICE);
1265 static struct ath_buf *ath_tx_get_buffer(struct ath_softc *sc)
1266 @@ -390,11 +392,9 @@ static void ath_tx_complete_aggr(struct
1268 bf_next = bf->bf_next;
1270 - bf->bf_state.bf_type |= BUF_XRETRY;
1271 if (!bf->bf_stale || bf_next != NULL)
1272 list_move_tail(&bf->list, &bf_head);
1274 - ath_tx_rc_status(sc, bf, ts, 1, 1, 0, false);
1275 ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
1278 @@ -470,7 +470,6 @@ static void ath_tx_complete_aggr(struct
1279 clear_filter = true;
1282 - bf->bf_state.bf_type |= BUF_XRETRY;
1286 @@ -497,17 +496,14 @@ static void ath_tx_complete_aggr(struct
1288 if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) {
1289 memcpy(tx_info->control.rates, rates, sizeof(rates));
1290 - ath_tx_rc_status(sc, bf, ts, nframes, nbad, txok, true);
1291 + ath_tx_rc_status(sc, bf, ts, nframes, nbad, txok);
1294 - ath_tx_rc_status(sc, bf, ts, nframes, nbad, txok, false);
1297 ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
1300 /* retry the un-acked ones */
1301 - ath9k_hw_set_clrdmask(sc->sc_ah, bf->bf_desc, false);
1302 if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)) {
1303 if (bf->bf_next == NULL && bf_last->bf_stale) {
1304 struct ath_buf *tbf;
1305 @@ -523,26 +519,13 @@ static void ath_tx_complete_aggr(struct
1306 ath_tx_update_baw(sc, tid, seqno);
1307 spin_unlock_bh(&txq->axq_lock);
1309 - bf->bf_state.bf_type |=
1311 - ath_tx_rc_status(sc, bf, ts, nframes,
1313 ath_tx_complete_buf(sc, bf, txq,
1320 - ath9k_hw_cleartxdesc(sc->sc_ah,
1325 - * Clear descriptor status words for
1328 - ath9k_hw_cleartxdesc(sc->sc_ah,
1333 @@ -778,7 +761,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_
1337 - bf->bf_state.bf_type |= BUF_AMPDU;
1338 + bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR;
1339 seqno = bf->bf_state.seqno;
1342 @@ -805,8 +788,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_
1345 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
1346 - if (nframes && ((tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) ||
1347 - !(tx_info->control.rates[0].flags & IEEE80211_TX_RC_MCS)))
1348 + if (nframes && (tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE))
1351 /* do not exceed subframe limit */
1352 @@ -828,20 +810,17 @@ static enum ATH_AGGR_STATUS ath_tx_form_
1356 - ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, 0);
1358 /* link buffers of this frame to the aggregate */
1360 ath_tx_addto_baw(sc, tid, seqno);
1361 - ath9k_hw_set11n_aggr_middle(sc->sc_ah, bf->bf_desc, ndelim);
1362 + bf->bf_state.ndelim = ndelim;
1364 __skb_unlink(skb, &tid->buf_q);
1365 list_add_tail(&bf->list, bf_q);
1368 bf_prev->bf_next = bf;
1369 - ath9k_hw_set_desc_link(sc->sc_ah, bf_prev->bf_desc,
1375 } while (!skb_queue_empty(&tid->buf_q));
1376 @@ -852,12 +831,245 @@ static enum ATH_AGGR_STATUS ath_tx_form_
1381 + * rix - rate index
1382 + * pktlen - total bytes (delims + data + fcs + pads + pad delims)
1383 + * width - 0 for 20 MHz, 1 for 40 MHz
1384 + * half_gi - to use 4us v/s 3.6 us for symbol time
1386 +static u32 ath_pkt_duration(struct ath_softc *sc, u8 rix, int pktlen,
1387 + int width, int half_gi, bool shortPreamble)
1389 + u32 nbits, nsymbits, duration, nsymbols;
1392 + /* find number of symbols: PLCP + data */
1393 + streams = HT_RC_2_STREAMS(rix);
1394 + nbits = (pktlen << 3) + OFDM_PLCP_BITS;
1395 + nsymbits = bits_per_symbol[rix % 8][width] * streams;
1396 + nsymbols = (nbits + nsymbits - 1) / nsymbits;
1399 + duration = SYMBOL_TIME(nsymbols);
1401 + duration = SYMBOL_TIME_HALFGI(nsymbols);
1403 + /* addup duration for legacy/ht training and signal fields */
1404 + duration += L_STF + L_LTF + L_SIG + HT_SIG + HT_STF + HT_LTF(streams);
1409 +static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf,
1410 + struct ath_tx_info *info, int len)
1412 + struct ath_hw *ah = sc->sc_ah;
1413 + struct sk_buff *skb;
1414 + struct ieee80211_tx_info *tx_info;
1415 + struct ieee80211_tx_rate *rates;
1416 + const struct ieee80211_rate *rate;
1417 + struct ieee80211_hdr *hdr;
1421 + skb = bf->bf_mpdu;
1422 + tx_info = IEEE80211_SKB_CB(skb);
1423 + rates = tx_info->control.rates;
1424 + hdr = (struct ieee80211_hdr *)skb->data;
1426 + /* set dur_update_en for l-sig computation except for PS-Poll frames */
1427 + info->dur_update = !ieee80211_is_pspoll(hdr->frame_control);
1430 + * We check if Short Preamble is needed for the CTS rate by
1431 + * checking the BSS's global flag.
1432 + * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used.
1434 + rate = ieee80211_get_rts_cts_rate(sc->hw, tx_info);
1435 + info->rtscts_rate = rate->hw_value;
1436 + if (sc->sc_flags & SC_OP_PREAMBLE_SHORT)
1437 + info->rtscts_rate |= rate->hw_value_short;
1439 + for (i = 0; i < 4; i++) {
1440 + bool is_40, is_sgi, is_sp;
1443 + if (!rates[i].count || (rates[i].idx < 0))
1446 + rix = rates[i].idx;
1447 + info->rates[i].Tries = rates[i].count;
1449 + if (rates[i].flags & IEEE80211_TX_RC_USE_RTS_CTS) {
1450 + info->rates[i].RateFlags |= ATH9K_RATESERIES_RTS_CTS;
1451 + info->flags |= ATH9K_TXDESC_RTSENA;
1452 + } else if (rates[i].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
1453 + info->rates[i].RateFlags |= ATH9K_RATESERIES_RTS_CTS;
1454 + info->flags |= ATH9K_TXDESC_CTSENA;
1457 + if (rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
1458 + info->rates[i].RateFlags |= ATH9K_RATESERIES_2040;
1459 + if (rates[i].flags & IEEE80211_TX_RC_SHORT_GI)
1460 + info->rates[i].RateFlags |= ATH9K_RATESERIES_HALFGI;
1462 + is_sgi = !!(rates[i].flags & IEEE80211_TX_RC_SHORT_GI);
1463 + is_40 = !!(rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH);
1464 + is_sp = !!(rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE);
1466 + if (rates[i].flags & IEEE80211_TX_RC_MCS) {
1468 + info->rates[i].Rate = rix | 0x80;
1469 + info->rates[i].ChSel = ath_txchainmask_reduction(sc,
1470 + ah->txchainmask, info->rates[i].Rate);
1471 + info->rates[i].PktDuration = ath_pkt_duration(sc, rix, len,
1472 + is_40, is_sgi, is_sp);
1473 + if (rix < 8 && (tx_info->flags & IEEE80211_TX_CTL_STBC))
1474 + info->rates[i].RateFlags |= ATH9K_RATESERIES_STBC;
1478 + /* legacy rates */
1479 + if ((tx_info->band == IEEE80211_BAND_2GHZ) &&
1480 + !(rate->flags & IEEE80211_RATE_ERP_G))
1481 + phy = WLAN_RC_PHY_CCK;
1483 + phy = WLAN_RC_PHY_OFDM;
1485 + rate = &sc->sbands[tx_info->band].bitrates[rates[i].idx];
1486 + info->rates[i].Rate = rate->hw_value;
1487 + if (rate->hw_value_short) {
1488 + if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
1489 + info->rates[i].Rate |= rate->hw_value_short;
1494 + if (bf->bf_state.bfs_paprd)
1495 + info->rates[i].ChSel = ah->txchainmask;
1497 + info->rates[i].ChSel = ath_txchainmask_reduction(sc,
1498 + ah->txchainmask, info->rates[i].Rate);
1500 + info->rates[i].PktDuration = ath9k_hw_computetxtime(sc->sc_ah,
1501 + phy, rate->bitrate * 100, len, rix, is_sp);
1504 + /* For AR5416 - RTS cannot be followed by a frame larger than 8K */
1505 + if (bf_isaggr(bf) && (len > sc->sc_ah->caps.rts_aggr_limit))
1506 + info->flags &= ~ATH9K_TXDESC_RTSENA;
1508 + /* ATH9K_TXDESC_RTSENA and ATH9K_TXDESC_CTSENA are mutually exclusive. */
1509 + if (info->flags & ATH9K_TXDESC_RTSENA)
1510 + info->flags &= ~ATH9K_TXDESC_CTSENA;
1513 +static enum ath9k_pkt_type get_hw_packet_type(struct sk_buff *skb)
1515 + struct ieee80211_hdr *hdr;
1516 + enum ath9k_pkt_type htype;
1519 + hdr = (struct ieee80211_hdr *)skb->data;
1520 + fc = hdr->frame_control;
1522 + if (ieee80211_is_beacon(fc))
1523 + htype = ATH9K_PKT_TYPE_BEACON;
1524 + else if (ieee80211_is_probe_resp(fc))
1525 + htype = ATH9K_PKT_TYPE_PROBE_RESP;
1526 + else if (ieee80211_is_atim(fc))
1527 + htype = ATH9K_PKT_TYPE_ATIM;
1528 + else if (ieee80211_is_pspoll(fc))
1529 + htype = ATH9K_PKT_TYPE_PSPOLL;
1531 + htype = ATH9K_PKT_TYPE_NORMAL;
1536 +static void ath_tx_fill_desc(struct ath_softc *sc, struct ath_buf *bf,
1537 + struct ath_txq *txq, int len)
1539 + struct ath_hw *ah = sc->sc_ah;
1540 + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
1541 + struct ath_buf *bf_first = bf;
1542 + struct ath_tx_info info;
1543 + bool aggr = !!(bf->bf_state.bf_type & BUF_AGGR);
1545 + memset(&info, 0, sizeof(info));
1546 + info.is_first = true;
1547 + info.is_last = true;
1548 + info.txpower = MAX_RATE_POWER;
1549 + info.qcu = txq->axq_qnum;
1551 + info.flags = ATH9K_TXDESC_INTREQ;
1552 + if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK)
1553 + info.flags |= ATH9K_TXDESC_NOACK;
1554 + if (tx_info->flags & IEEE80211_TX_CTL_LDPC)
1555 + info.flags |= ATH9K_TXDESC_LDPC;
1557 + ath_buf_set_rate(sc, bf, &info, len);
1559 + if (tx_info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
1560 + info.flags |= ATH9K_TXDESC_CLRDMASK;
1562 + if (bf->bf_state.bfs_paprd)
1563 + info.flags |= (u32) bf->bf_state.bfs_paprd << ATH9K_TXDESC_PAPRD_S;
1567 + struct sk_buff *skb = bf->bf_mpdu;
1568 + struct ath_frame_info *fi = get_frame_info(skb);
1569 + struct ieee80211_hdr *hdr;
1570 + int padpos, padsize;
1572 + info.type = get_hw_packet_type(skb);
1574 + info.link = bf->bf_next->bf_daddr;
1578 + if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
1579 + hdr = (struct ieee80211_hdr *)skb->data;
1580 + padpos = ath9k_cmn_padpos(hdr->frame_control);
1581 + padsize = padpos & 3;
1583 + info.buf_addr[0] = bf->bf_buf_addr;
1584 + info.buf_len[0] = padpos + padsize;
1585 + info.buf_addr[1] = info.buf_addr[0] + padpos;
1586 + info.buf_len[1] = skb->len - padpos;
1588 + info.buf_addr[0] = bf->bf_buf_addr;
1589 + info.buf_len[0] = skb->len;
1592 + info.pkt_len = fi->framelen;
1593 + info.keyix = fi->keyix;
1594 + info.keytype = fi->keytype;
1597 + if (bf == bf_first)
1598 + info.aggr = AGGR_BUF_FIRST;
1599 + else if (!bf->bf_next)
1600 + info.aggr = AGGR_BUF_LAST;
1602 + info.aggr = AGGR_BUF_MIDDLE;
1604 + info.ndelim = bf->bf_state.ndelim;
1605 + info.aggr_len = len;
1608 + ath9k_hw_set_txdesc(ah, bf->bf_desc, &info);
1613 static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
1614 struct ath_atx_tid *tid)
1617 enum ATH_AGGR_STATUS status;
1618 - struct ath_frame_info *fi;
1619 + struct ieee80211_tx_info *tx_info;
1620 struct list_head bf_q;
1623 @@ -878,34 +1090,25 @@ static void ath_tx_sched_aggr(struct ath
1625 bf = list_first_entry(&bf_q, struct ath_buf, list);
1626 bf->bf_lastbf = list_entry(bf_q.prev, struct ath_buf, list);
1627 + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
1629 if (tid->ac->clear_ps_filter) {
1630 tid->ac->clear_ps_filter = false;
1631 - ath9k_hw_set_clrdmask(sc->sc_ah, bf->bf_desc, true);
1632 + tx_info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1634 + tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT;
1637 /* if only one frame, send as non-aggregate */
1638 if (bf == bf->bf_lastbf) {
1639 - fi = get_frame_info(bf->bf_mpdu);
1641 - bf->bf_state.bf_type &= ~BUF_AGGR;
1642 - ath9k_hw_clr11n_aggr(sc->sc_ah, bf->bf_desc);
1643 - ath_buf_set_rate(sc, bf, fi->framelen);
1644 - ath_tx_txqaddbuf(sc, txq, &bf_q, false);
1646 + aggr_len = get_frame_info(bf->bf_mpdu)->framelen;
1647 + bf->bf_state.bf_type = BUF_AMPDU;
1649 + TX_STAT_INC(txq->axq_qnum, a_aggr);
1652 - /* setup first desc of aggregate */
1653 - bf->bf_state.bf_type |= BUF_AGGR;
1654 - ath_buf_set_rate(sc, bf, aggr_len);
1655 - ath9k_hw_set11n_aggr_first(sc->sc_ah, bf->bf_desc, aggr_len);
1657 - /* anchor last desc of aggregate */
1658 - ath9k_hw_set11n_aggr_last(sc->sc_ah, bf->bf_lastbf->bf_desc);
1660 + ath_tx_fill_desc(sc, bf, txq, aggr_len);
1661 ath_tx_txqaddbuf(sc, txq, &bf_q, false);
1662 - TX_STAT_INC(txq->axq_qnum, a_aggr);
1664 } while (txq->axq_ampdu_depth < ATH_AGGR_MIN_QDEPTH &&
1665 status != ATH_AGGR_BAW_CLOSED);
1667 @@ -1483,7 +1686,7 @@ static void ath_tx_send_ampdu(struct ath
1671 - bf->bf_state.bf_type |= BUF_AMPDU;
1672 + bf->bf_state.bf_type = BUF_AMPDU;
1673 INIT_LIST_HEAD(&bf_head);
1674 list_add(&bf->list, &bf_head);
1676 @@ -1493,7 +1696,7 @@ static void ath_tx_send_ampdu(struct ath
1677 /* Queue to h/w without aggregation */
1678 TX_STAT_INC(txctl->txq->axq_qnum, a_queued_hw);
1680 - ath_buf_set_rate(sc, bf, fi->framelen);
1681 + ath_tx_fill_desc(sc, bf, txctl->txq, fi->framelen);
1682 ath_tx_txqaddbuf(sc, txctl->txq, &bf_head, false);
1685 @@ -1513,41 +1716,18 @@ static void ath_tx_send_normal(struct at
1687 INIT_LIST_HEAD(&bf_head);
1688 list_add_tail(&bf->list, &bf_head);
1689 - bf->bf_state.bf_type &= ~BUF_AMPDU;
1690 + bf->bf_state.bf_type = 0;
1692 /* update starting sequence number for subsequent ADDBA request */
1694 INCR(tid->seq_start, IEEE80211_SEQ_MAX);
1697 - ath_buf_set_rate(sc, bf, fi->framelen);
1698 + ath_tx_fill_desc(sc, bf, txq, fi->framelen);
1699 ath_tx_txqaddbuf(sc, txq, &bf_head, false);
1700 TX_STAT_INC(txq->axq_qnum, queued);
1703 -static enum ath9k_pkt_type get_hw_packet_type(struct sk_buff *skb)
1705 - struct ieee80211_hdr *hdr;
1706 - enum ath9k_pkt_type htype;
1709 - hdr = (struct ieee80211_hdr *)skb->data;
1710 - fc = hdr->frame_control;
1712 - if (ieee80211_is_beacon(fc))
1713 - htype = ATH9K_PKT_TYPE_BEACON;
1714 - else if (ieee80211_is_probe_resp(fc))
1715 - htype = ATH9K_PKT_TYPE_PROBE_RESP;
1716 - else if (ieee80211_is_atim(fc))
1717 - htype = ATH9K_PKT_TYPE_ATIM;
1718 - else if (ieee80211_is_pspoll(fc))
1719 - htype = ATH9K_PKT_TYPE_PSPOLL;
1721 - htype = ATH9K_PKT_TYPE_NORMAL;
1726 static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb,
1729 @@ -1575,51 +1755,6 @@ static void setup_frame_info(struct ieee
1730 fi->framelen = framelen;
1733 -static int setup_tx_flags(struct sk_buff *skb)
1735 - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
1738 - flags |= ATH9K_TXDESC_INTREQ;
1740 - if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK)
1741 - flags |= ATH9K_TXDESC_NOACK;
1743 - if (tx_info->flags & IEEE80211_TX_CTL_LDPC)
1744 - flags |= ATH9K_TXDESC_LDPC;
1750 - * rix - rate index
1751 - * pktlen - total bytes (delims + data + fcs + pads + pad delims)
1752 - * width - 0 for 20 MHz, 1 for 40 MHz
1753 - * half_gi - to use 4us v/s 3.6 us for symbol time
1755 -static u32 ath_pkt_duration(struct ath_softc *sc, u8 rix, int pktlen,
1756 - int width, int half_gi, bool shortPreamble)
1758 - u32 nbits, nsymbits, duration, nsymbols;
1761 - /* find number of symbols: PLCP + data */
1762 - streams = HT_RC_2_STREAMS(rix);
1763 - nbits = (pktlen << 3) + OFDM_PLCP_BITS;
1764 - nsymbits = bits_per_symbol[rix % 8][width] * streams;
1765 - nsymbols = (nbits + nsymbits - 1) / nsymbits;
1768 - duration = SYMBOL_TIME(nsymbols);
1770 - duration = SYMBOL_TIME_HALFGI(nsymbols);
1772 - /* addup duration for legacy/ht training and signal fields */
1773 - duration += L_STF + L_LTF + L_SIG + HT_SIG + HT_STF + HT_LTF(streams);
1778 u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate)
1780 struct ath_hw *ah = sc->sc_ah;
1781 @@ -1632,118 +1767,6 @@ u8 ath_txchainmask_reduction(struct ath_
1785 -static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len)
1787 - struct ath_hw *ah = sc->sc_ah;
1788 - struct ath9k_11n_rate_series series[4];
1789 - struct sk_buff *skb;
1790 - struct ieee80211_tx_info *tx_info;
1791 - struct ieee80211_tx_rate *rates;
1792 - const struct ieee80211_rate *rate;
1793 - struct ieee80211_hdr *hdr;
1795 - u8 rix = 0, ctsrate = 0;
1798 - memset(series, 0, sizeof(struct ath9k_11n_rate_series) * 4);
1800 - skb = bf->bf_mpdu;
1801 - tx_info = IEEE80211_SKB_CB(skb);
1802 - rates = tx_info->control.rates;
1803 - hdr = (struct ieee80211_hdr *)skb->data;
1804 - is_pspoll = ieee80211_is_pspoll(hdr->frame_control);
1807 - * We check if Short Preamble is needed for the CTS rate by
1808 - * checking the BSS's global flag.
1809 - * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used.
1811 - rate = ieee80211_get_rts_cts_rate(sc->hw, tx_info);
1812 - ctsrate = rate->hw_value;
1813 - if (sc->sc_flags & SC_OP_PREAMBLE_SHORT)
1814 - ctsrate |= rate->hw_value_short;
1816 - for (i = 0; i < 4; i++) {
1817 - bool is_40, is_sgi, is_sp;
1820 - if (!rates[i].count || (rates[i].idx < 0))
1823 - rix = rates[i].idx;
1824 - series[i].Tries = rates[i].count;
1826 - if (rates[i].flags & IEEE80211_TX_RC_USE_RTS_CTS) {
1827 - series[i].RateFlags |= ATH9K_RATESERIES_RTS_CTS;
1828 - flags |= ATH9K_TXDESC_RTSENA;
1829 - } else if (rates[i].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
1830 - series[i].RateFlags |= ATH9K_RATESERIES_RTS_CTS;
1831 - flags |= ATH9K_TXDESC_CTSENA;
1834 - if (rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
1835 - series[i].RateFlags |= ATH9K_RATESERIES_2040;
1836 - if (rates[i].flags & IEEE80211_TX_RC_SHORT_GI)
1837 - series[i].RateFlags |= ATH9K_RATESERIES_HALFGI;
1839 - is_sgi = !!(rates[i].flags & IEEE80211_TX_RC_SHORT_GI);
1840 - is_40 = !!(rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH);
1841 - is_sp = !!(rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE);
1843 - if (rates[i].flags & IEEE80211_TX_RC_MCS) {
1845 - series[i].Rate = rix | 0x80;
1846 - series[i].ChSel = ath_txchainmask_reduction(sc,
1847 - ah->txchainmask, series[i].Rate);
1848 - series[i].PktDuration = ath_pkt_duration(sc, rix, len,
1849 - is_40, is_sgi, is_sp);
1850 - if (rix < 8 && (tx_info->flags & IEEE80211_TX_CTL_STBC))
1851 - series[i].RateFlags |= ATH9K_RATESERIES_STBC;
1855 - /* legacy rates */
1856 - if ((tx_info->band == IEEE80211_BAND_2GHZ) &&
1857 - !(rate->flags & IEEE80211_RATE_ERP_G))
1858 - phy = WLAN_RC_PHY_CCK;
1860 - phy = WLAN_RC_PHY_OFDM;
1862 - rate = &sc->sbands[tx_info->band].bitrates[rates[i].idx];
1863 - series[i].Rate = rate->hw_value;
1864 - if (rate->hw_value_short) {
1865 - if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
1866 - series[i].Rate |= rate->hw_value_short;
1871 - if (bf->bf_state.bfs_paprd)
1872 - series[i].ChSel = ah->txchainmask;
1874 - series[i].ChSel = ath_txchainmask_reduction(sc,
1875 - ah->txchainmask, series[i].Rate);
1877 - series[i].PktDuration = ath9k_hw_computetxtime(sc->sc_ah,
1878 - phy, rate->bitrate * 100, len, rix, is_sp);
1881 - /* For AR5416 - RTS cannot be followed by a frame larger than 8K */
1882 - if (bf_isaggr(bf) && (len > sc->sc_ah->caps.rts_aggr_limit))
1883 - flags &= ~ATH9K_TXDESC_RTSENA;
1885 - /* ATH9K_TXDESC_RTSENA and ATH9K_TXDESC_CTSENA are mutually exclusive. */
1886 - if (flags & ATH9K_TXDESC_RTSENA)
1887 - flags &= ~ATH9K_TXDESC_CTSENA;
1889 - /* set dur_update_en for l-sig computation except for PS-Poll frames */
1890 - ath9k_hw_set11n_ratescenario(sc->sc_ah, bf->bf_desc,
1891 - bf->bf_lastbf->bf_desc,
1892 - !is_pspoll, ctsrate,
1893 - 0, series, 4, flags);
1898 * Assign a descriptor (and sequence number if necessary,
1899 * and map buffer for DMA. Frees skb on error
1900 @@ -1753,13 +1776,10 @@ static struct ath_buf *ath_tx_setup_buff
1901 struct ath_atx_tid *tid,
1902 struct sk_buff *skb)
1904 - struct ath_hw *ah = sc->sc_ah;
1905 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1906 struct ath_frame_info *fi = get_frame_info(skb);
1907 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1909 - struct ath_desc *ds;
1913 bf = ath_tx_get_buffer(sc);
1914 @@ -1777,7 +1797,6 @@ static struct ath_buf *ath_tx_setup_buff
1915 bf->bf_state.seqno = seqno;
1918 - bf->bf_flags = setup_tx_flags(skb);
1921 bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
1922 @@ -1791,22 +1810,6 @@ static struct ath_buf *ath_tx_setup_buff
1926 - frm_type = get_hw_packet_type(skb);
1929 - ath9k_hw_set_desc_link(ah, ds, 0);
1931 - ath9k_hw_set11n_txdesc(ah, ds, fi->framelen, frm_type, MAX_RATE_POWER,
1932 - fi->keyix, fi->keytype, bf->bf_flags);
1934 - ath9k_hw_filltxdesc(ah, ds,
1935 - skb->len, /* segment length */
1936 - true, /* first segment */
1937 - true, /* last segment */
1938 - ds, /* first descriptor */
1945 @@ -1849,16 +1852,9 @@ static void ath_tx_start_dma(struct ath_
1947 bf->bf_state.bfs_paprd = txctl->paprd;
1949 - if (bf->bf_state.bfs_paprd)
1950 - ar9003_hw_set_paprd_txdesc(sc->sc_ah, bf->bf_desc,
1951 - bf->bf_state.bfs_paprd);
1954 bf->bf_state.bfs_paprd_timestamp = jiffies;
1956 - if (tx_info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
1957 - ath9k_hw_set_clrdmask(sc->sc_ah, bf->bf_desc, true);
1959 ath_tx_send_normal(sc, txctl->txq, tid, skb);
1962 @@ -1899,15 +1895,18 @@ int ath_tx_start(struct ieee80211_hw *hw
1963 hdr->seq_ctrl |= cpu_to_le16(sc->tx.seq_no);
1966 - /* Add the padding after the header if this is not already done */
1967 - padpos = ath9k_cmn_padpos(hdr->frame_control);
1968 - padsize = padpos & 3;
1969 - if (padsize && skb->len > padpos) {
1970 - if (skb_headroom(skb) < padsize)
1973 - skb_push(skb, padsize);
1974 - memmove(skb->data, skb->data + padsize, padpos);
1975 + if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)) {
1976 + /* Add the padding after the header if this is not already done */
1977 + padpos = ath9k_cmn_padpos(hdr->frame_control);
1978 + padsize = padpos & 3;
1979 + if (padsize && skb->len > padpos) {
1980 + if (skb_headroom(skb) < padsize)
1983 + skb_push(skb, padsize);
1984 + memmove(skb->data, skb->data + padsize, padpos);
1985 + hdr = (struct ieee80211_hdr *) skb->data;
1989 if ((vif && vif->type != NL80211_IFTYPE_AP &&
1990 @@ -1953,20 +1952,21 @@ static void ath_tx_complete(struct ath_s
1991 if (tx_flags & ATH_TX_BAR)
1992 tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
1994 - if (!(tx_flags & (ATH_TX_ERROR | ATH_TX_XRETRY))) {
1995 + if (!(tx_flags & ATH_TX_ERROR))
1996 /* Frame was ACKed */
1997 tx_info->flags |= IEEE80211_TX_STAT_ACK;
2000 - padpos = ath9k_cmn_padpos(hdr->frame_control);
2001 - padsize = padpos & 3;
2002 - if (padsize && skb->len>padpos+padsize) {
2004 - * Remove MAC header padding before giving the frame back to
2007 - memmove(skb->data + padsize, skb->data, padpos);
2008 - skb_pull(skb, padsize);
2009 + if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)) {
2010 + padpos = ath9k_cmn_padpos(hdr->frame_control);
2011 + padsize = padpos & 3;
2012 + if (padsize && skb->len>padpos+padsize) {
2014 + * Remove MAC header padding before giving the frame back to
2017 + memmove(skb->data + padsize, skb->data, padpos);
2018 + skb_pull(skb, padsize);
2022 if (sc->ps_flags & PS_WAIT_FOR_TX_ACK) {
2023 @@ -2000,18 +2000,18 @@ static void ath_tx_complete_buf(struct a
2024 struct ath_tx_status *ts, int txok, int sendbar)
2026 struct sk_buff *skb = bf->bf_mpdu;
2027 + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
2028 unsigned long flags;
2032 tx_flags = ATH_TX_BAR;
2036 tx_flags |= ATH_TX_ERROR;
2038 - if (bf_isxretried(bf))
2039 - tx_flags |= ATH_TX_XRETRY;
2041 + if (ts->ts_status & ATH9K_TXERR_FILT)
2042 + tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
2044 dma_unmap_single(sc->dev, bf->bf_buf_addr, skb->len, DMA_TO_DEVICE);
2045 bf->bf_buf_addr = 0;
2046 @@ -2024,7 +2024,7 @@ static void ath_tx_complete_buf(struct a
2048 complete(&sc->paprd_complete);
2050 - ath_debug_stat_tx(sc, bf, ts, txq);
2051 + ath_debug_stat_tx(sc, bf, ts, txq, tx_flags);
2052 ath_tx_complete(sc, skb, tx_flags, txq);
2054 /* At this point, skb (bf->bf_mpdu) is consumed...make sure we don't
2055 @@ -2042,7 +2042,7 @@ static void ath_tx_complete_buf(struct a
2057 static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
2058 struct ath_tx_status *ts, int nframes, int nbad,
2059 - int txok, bool update_rc)
2062 struct sk_buff *skb = bf->bf_mpdu;
2063 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2064 @@ -2057,9 +2057,7 @@ static void ath_tx_rc_status(struct ath_
2065 tx_rateindex = ts->ts_rateindex;
2066 WARN_ON(tx_rateindex >= hw->max_rates);
2068 - if (ts->ts_status & ATH9K_TXERR_FILT)
2069 - tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
2070 - if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && update_rc) {
2071 + if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
2072 tx_info->flags |= IEEE80211_TX_STAT_AMPDU;
2074 BUG_ON(nbad > nframes);
2075 @@ -2069,7 +2067,7 @@ static void ath_tx_rc_status(struct ath_
2078 if ((ts->ts_status & ATH9K_TXERR_FILT) == 0 &&
2079 - (bf->bf_flags & ATH9K_TXDESC_NOACK) == 0 && update_rc) {
2080 + (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) == 0) {
2082 * If an underrun error is seen assume it as an excessive
2083 * retry only if max frame trigger level has been reached
2084 @@ -2082,9 +2080,9 @@ static void ath_tx_rc_status(struct ath_
2085 * successfully by eventually preferring slower rates.
2086 * This itself should also alleviate congestion on the bus.
2088 - if (ieee80211_is_data(hdr->frame_control) &&
2089 - (ts->ts_flags & (ATH9K_TX_DATA_UNDERRUN |
2090 - ATH9K_TX_DELIM_UNDERRUN)) &&
2091 + if (unlikely(ts->ts_flags & (ATH9K_TX_DATA_UNDERRUN |
2092 + ATH9K_TX_DELIM_UNDERRUN)) &&
2093 + ieee80211_is_data(hdr->frame_control) &&
2094 ah->tx_trig_level >= sc->sc_ah->config.max_txtrig_level)
2095 tx_info->status.rates[tx_rateindex].count =
2097 @@ -2115,13 +2113,7 @@ static void ath_tx_process_buffer(struct
2098 spin_unlock_bh(&txq->axq_lock);
2100 if (!bf_isampdu(bf)) {
2102 - * This frame is sent out as a single frame.
2103 - * Use hardware retry status for this frame.
2105 - if (ts->ts_status & ATH9K_TXERR_XRETRY)
2106 - bf->bf_state.bf_type |= BUF_XRETRY;
2107 - ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok, true);
2108 + ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok);
2109 ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok, 0);
2111 ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok, true);
2112 --- a/net/mac80211/agg-rx.c
2113 +++ b/net/mac80211/agg-rx.c
2114 @@ -180,6 +180,8 @@ static void ieee80211_send_addba_resp(st
2115 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
2116 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
2117 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
2118 + else if (sdata->vif.type == NL80211_IFTYPE_WDS)
2119 + memcpy(mgmt->bssid, da, ETH_ALEN);
2121 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
2122 IEEE80211_STYPE_ACTION);
2123 --- a/net/mac80211/agg-tx.c
2124 +++ b/net/mac80211/agg-tx.c
2125 @@ -77,7 +77,8 @@ static void ieee80211_send_addba_request
2126 memcpy(mgmt->da, da, ETH_ALEN);
2127 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
2128 if (sdata->vif.type == NL80211_IFTYPE_AP ||
2129 - sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
2130 + sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
2131 + sdata->vif.type == NL80211_IFTYPE_WDS)
2132 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
2133 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
2134 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
2135 @@ -397,7 +398,8 @@ int ieee80211_start_tx_ba_session(struct
2137 if (sdata->vif.type != NL80211_IFTYPE_STATION &&
2138 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
2139 - sdata->vif.type != NL80211_IFTYPE_AP)
2140 + sdata->vif.type != NL80211_IFTYPE_AP &&
2141 + sdata->vif.type != NL80211_IFTYPE_WDS)
2144 if (test_sta_flags(sta, WLAN_STA_BLOCK_BA)) {
2145 --- a/net/mac80211/debugfs_sta.c
2146 +++ b/net/mac80211/debugfs_sta.c
2147 @@ -59,7 +59,7 @@ static ssize_t sta_flags_read(struct fil
2149 struct sta_info *sta = file->private_data;
2150 u32 staflags = get_sta_flags(sta);
2151 - int res = scnprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s",
2152 + int res = scnprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s",
2153 staflags & WLAN_STA_AUTH ? "AUTH\n" : "",
2154 staflags & WLAN_STA_ASSOC ? "ASSOC\n" : "",
2155 staflags & WLAN_STA_PS_STA ? "PS (sta)\n" : "",
2156 @@ -67,7 +67,6 @@ static ssize_t sta_flags_read(struct fil
2157 staflags & WLAN_STA_AUTHORIZED ? "AUTHORIZED\n" : "",
2158 staflags & WLAN_STA_SHORT_PREAMBLE ? "SHORT PREAMBLE\n" : "",
2159 staflags & WLAN_STA_WME ? "WME\n" : "",
2160 - staflags & WLAN_STA_WDS ? "WDS\n" : "",
2161 staflags & WLAN_STA_MFP ? "MFP\n" : "");
2162 return simple_read_from_buffer(userbuf, count, ppos, buf, res);
2164 --- a/net/mac80211/iface.c
2165 +++ b/net/mac80211/iface.c
2166 @@ -178,7 +178,6 @@ static int ieee80211_do_open(struct net_
2168 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2169 struct ieee80211_local *local = sdata->local;
2170 - struct sta_info *sta;
2173 u32 hw_reconf_flags = 0;
2174 @@ -290,27 +289,6 @@ static int ieee80211_do_open(struct net_
2176 set_bit(SDATA_STATE_RUNNING, &sdata->state);
2178 - if (sdata->vif.type == NL80211_IFTYPE_WDS) {
2179 - /* Create STA entry for the WDS peer */
2180 - sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
2184 - goto err_del_interface;
2187 - /* no locking required since STA is not live yet */
2188 - sta->flags |= WLAN_STA_AUTHORIZED;
2190 - res = sta_info_insert(sta);
2192 - /* STA has been freed */
2193 - goto err_del_interface;
2196 - rate_control_rate_init(sta);
2200 * set_multicast_list will be invoked by the networking core
2201 * which will check whether any increments here were done in
2202 @@ -344,8 +322,7 @@ static int ieee80211_do_open(struct net_
2203 netif_tx_start_all_queues(dev);
2206 - err_del_interface:
2207 - drv_remove_interface(local, &sdata->vif);
2210 if (!local->open_count)
2212 @@ -718,6 +695,70 @@ static void ieee80211_if_setup(struct ne
2213 dev->destructor = free_netdev;
2216 +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
2217 + struct sk_buff *skb)
2219 + struct ieee80211_local *local = sdata->local;
2220 + struct ieee80211_rx_status *rx_status;
2221 + struct ieee802_11_elems elems;
2222 + struct ieee80211_mgmt *mgmt;
2223 + struct sta_info *sta;
2228 + enum ieee80211_band band = local->hw.conf.channel->band;
2229 + struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
2231 + rx_status = IEEE80211_SKB_RXCB(skb);
2232 + mgmt = (struct ieee80211_mgmt *) skb->data;
2233 + stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE;
2235 + if (stype != IEEE80211_STYPE_BEACON)
2238 + baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
2239 + if (baselen > skb->len)
2242 + ieee802_11_parse_elems(mgmt->u.probe_resp.variable,
2243 + skb->len - baselen, &elems);
2245 + rates = ieee80211_sta_get_rates(local, &elems, band);
2249 + sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
2252 + rcu_read_unlock();
2253 + sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
2261 + sta->last_rx = jiffies;
2262 + sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
2264 + if (elems.ht_cap_elem)
2265 + ieee80211_ht_cap_ie_to_sta_ht_cap(sband,
2266 + elems.ht_cap_elem, &sta->sta.ht_cap);
2268 + if (elems.wmm_param)
2269 + set_sta_flags(sta, WLAN_STA_WME);
2272 + sta->flags = WLAN_STA_AUTHORIZED;
2273 + rate_control_rate_init(sta);
2274 + sta_info_insert_rcu(sta);
2277 + rcu_read_unlock();
2280 static void ieee80211_iface_work(struct work_struct *work)
2282 struct ieee80211_sub_if_data *sdata =
2283 @@ -822,6 +863,9 @@ static void ieee80211_iface_work(struct
2285 ieee80211_mesh_rx_queued_mgmt(sdata, skb);
2287 + case NL80211_IFTYPE_WDS:
2288 + ieee80211_wds_rx_queued_mgmt(sdata, skb);
2291 WARN(1, "frame for unexpected interface type");
2293 --- a/net/mac80211/rx.c
2294 +++ b/net/mac80211/rx.c
2295 @@ -2163,7 +2163,8 @@ ieee80211_rx_h_action(struct ieee80211_r
2297 if (sdata->vif.type != NL80211_IFTYPE_STATION &&
2298 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
2299 - sdata->vif.type != NL80211_IFTYPE_AP)
2300 + sdata->vif.type != NL80211_IFTYPE_AP &&
2301 + sdata->vif.type != NL80211_IFTYPE_WDS)
2304 /* verify action_code is present */
2305 @@ -2378,13 +2379,14 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
2307 if (!ieee80211_vif_is_mesh(&sdata->vif) &&
2308 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
2309 - sdata->vif.type != NL80211_IFTYPE_STATION)
2310 + sdata->vif.type != NL80211_IFTYPE_STATION &&
2311 + sdata->vif.type != NL80211_IFTYPE_WDS)
2312 return RX_DROP_MONITOR;
2315 case cpu_to_le16(IEEE80211_STYPE_BEACON):
2316 case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
2317 - /* process for all: mesh, mlme, ibss */
2318 + /* process for all: mesh, mlme, ibss, wds */
2320 case cpu_to_le16(IEEE80211_STYPE_DEAUTH):
2321 case cpu_to_le16(IEEE80211_STYPE_DISASSOC):
2322 @@ -2727,10 +2729,16 @@ static int prepare_for_handlers(struct i
2325 case NL80211_IFTYPE_WDS:
2326 - if (bssid || !ieee80211_is_data(hdr->frame_control))
2328 if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2))
2331 + if (ieee80211_is_data(hdr->frame_control) ||
2332 + ieee80211_is_action(hdr->frame_control)) {
2333 + if (compare_ether_addr(sdata->vif.addr, hdr->addr1))
2335 + } else if (!ieee80211_is_beacon(hdr->frame_control))
2340 /* should never get here */
2341 --- a/net/mac80211/sta_info.h
2342 +++ b/net/mac80211/sta_info.h
2345 * @WLAN_STA_ASSOC_AP: We're associated to that station, it is an AP.
2346 * @WLAN_STA_WME: Station is a QoS-STA.
2347 - * @WLAN_STA_WDS: Station is one of our WDS peers.
2348 * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
2349 * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
2350 * frame to this station is transmitted.
2351 @@ -54,7 +53,6 @@ enum ieee80211_sta_info_flags {
2352 WLAN_STA_SHORT_PREAMBLE = 1<<4,
2353 WLAN_STA_ASSOC_AP = 1<<5,
2354 WLAN_STA_WME = 1<<6,
2355 - WLAN_STA_WDS = 1<<7,
2356 WLAN_STA_CLEAR_PS_FILT = 1<<9,
2357 WLAN_STA_MFP = 1<<10,
2358 WLAN_STA_BLOCK_BA = 1<<11,
2359 --- a/net/mac80211/status.c
2360 +++ b/net/mac80211/status.c
2361 @@ -278,17 +278,19 @@ void ieee80211_tx_status(struct ieee8021
2364 if (!acked && ieee80211_is_back_req(fc)) {
2368 - * BAR failed, let's tear down the BA session as a
2369 - * last resort as some STAs (Intel 5100 on Windows)
2370 - * can get stuck when the BA window isn't flushed
2372 + * BAR failed, store the last SSN and retry sending
2373 + * the BAR when the next unicast transmission on the
2374 + * same TID succeeds.
2376 bar = (struct ieee80211_bar *) skb->data;
2377 - if (!(bar->control & IEEE80211_BAR_CTRL_MULTI_TID)) {
2378 + control = le16_to_cpu(bar->control);
2379 + if (!(control & IEEE80211_BAR_CTRL_MULTI_TID)) {
2380 u16 ssn = le16_to_cpu(bar->start_seq_num);
2382 - tid = (bar->control &
2384 IEEE80211_BAR_CTRL_TID_INFO_MASK) >>
2385 IEEE80211_BAR_CTRL_TID_INFO_SHIFT;
2387 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
2388 +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
2389 @@ -704,8 +704,10 @@ static void ar5008_hw_override_ini(struc
2390 REG_WRITE(ah, AR_PCU_MISC_MODE2, val);
2393 - if (!AR_SREV_5416_20_OR_LATER(ah) ||
2394 - AR_SREV_9280_20_OR_LATER(ah))
2395 + REG_SET_BIT(ah, AR_PHY_CCK_DETECT,
2396 + AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV);
2398 + if (AR_SREV_9280_20_OR_LATER(ah))
2401 * Disable BB clock gating
2402 @@ -802,7 +804,8 @@ static int ar5008_hw_process_ini(struct
2404 /* Write ADDAC shifts */
2405 REG_WRITE(ah, AR_PHY_ADC_SERIAL_CTL, AR_PHY_SEL_EXTERNAL_RADIO);
2406 - ah->eep_ops->set_addac(ah, chan);
2407 + if (ah->eep_ops->set_addac)
2408 + ah->eep_ops->set_addac(ah, chan);
2410 if (AR_SREV_5416_22_OR_LATER(ah)) {
2411 REG_WRITE_ARRAY(&ah->iniAddac, 1, regWrites);
2412 @@ -1007,24 +1010,6 @@ static void ar5008_restore_chainmask(str
2416 -static void ar5008_set_diversity(struct ath_hw *ah, bool value)
2418 - u32 v = REG_READ(ah, AR_PHY_CCK_DETECT);
2420 - v |= AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV;
2422 - v &= ~AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV;
2423 - REG_WRITE(ah, AR_PHY_CCK_DETECT, v);
2426 -static u32 ar9100_hw_compute_pll_control(struct ath_hw *ah,
2427 - struct ath9k_channel *chan)
2429 - if (chan && IS_CHAN_5GHZ(chan))
2434 static u32 ar9160_hw_compute_pll_control(struct ath_hw *ah,
2435 struct ath9k_channel *chan)
2437 @@ -1654,7 +1639,6 @@ void ar5008_hw_attach_phy_ops(struct ath
2438 priv_ops->rfbus_req = ar5008_hw_rfbus_req;
2439 priv_ops->rfbus_done = ar5008_hw_rfbus_done;
2440 priv_ops->restore_chainmask = ar5008_restore_chainmask;
2441 - priv_ops->set_diversity = ar5008_set_diversity;
2442 priv_ops->do_getnf = ar5008_hw_do_getnf;
2443 priv_ops->set_radar_params = ar5008_hw_set_radar_params;
2445 @@ -1664,9 +1648,7 @@ void ar5008_hw_attach_phy_ops(struct ath
2447 priv_ops->ani_control = ar5008_hw_ani_control_old;
2449 - if (AR_SREV_9100(ah))
2450 - priv_ops->compute_pll_control = ar9100_hw_compute_pll_control;
2451 - else if (AR_SREV_9160_10_OR_LATER(ah))
2452 + if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah))
2453 priv_ops->compute_pll_control = ar9160_hw_compute_pll_control;
2455 priv_ops->compute_pll_control = ar5008_hw_compute_pll_control;
2456 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
2457 +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
2458 @@ -592,6 +592,9 @@ static void ar9003_hw_override_ini(struc
2459 val = REG_READ(ah, AR_PCU_MISC_MODE2) & (~AR_ADHOC_MCAST_KEYID_ENABLE);
2460 REG_WRITE(ah, AR_PCU_MISC_MODE2,
2461 val | AR_AGG_WEP_ENABLE_FIX | AR_AGG_WEP_ENABLE);
2463 + REG_SET_BIT(ah, AR_PHY_CCK_DETECT,
2464 + AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV);
2467 static void ar9003_hw_prog_ini(struct ath_hw *ah,
2468 @@ -785,16 +788,6 @@ static void ar9003_hw_rfbus_done(struct
2469 REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0);
2472 -static void ar9003_hw_set_diversity(struct ath_hw *ah, bool value)
2474 - u32 v = REG_READ(ah, AR_PHY_CCK_DETECT);
2476 - v |= AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV;
2478 - v &= ~AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV;
2479 - REG_WRITE(ah, AR_PHY_CCK_DETECT, v);
2482 static bool ar9003_hw_ani_control(struct ath_hw *ah,
2483 enum ath9k_ani_cmd cmd, int param)
2485 @@ -1277,7 +1270,6 @@ void ar9003_hw_attach_phy_ops(struct ath
2486 priv_ops->set_delta_slope = ar9003_hw_set_delta_slope;
2487 priv_ops->rfbus_req = ar9003_hw_rfbus_req;
2488 priv_ops->rfbus_done = ar9003_hw_rfbus_done;
2489 - priv_ops->set_diversity = ar9003_hw_set_diversity;
2490 priv_ops->ani_control = ar9003_hw_ani_control;
2491 priv_ops->do_getnf = ar9003_hw_do_getnf;
2492 priv_ops->ani_cache_ini_regs = ar9003_hw_ani_cache_ini_regs;
2493 --- a/drivers/net/wireless/ath/ath9k/eeprom.c
2494 +++ b/drivers/net/wireless/ath/ath9k/eeprom.c
2495 @@ -456,12 +456,7 @@ void ath9k_hw_get_gain_boundaries_pdadcs
2496 pPdGainBoundaries[i] =
2497 min((u16)MAX_RATE_POWER, pPdGainBoundaries[i]);
2499 - if ((i == 0) && !AR_SREV_5416_20_OR_LATER(ah)) {
2500 - minDelta = pPdGainBoundaries[0] - 23;
2501 - pPdGainBoundaries[0] = 23;
2508 if (AR_SREV_9280_20_OR_LATER(ah))
2509 --- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
2510 +++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
2511 @@ -405,12 +405,7 @@ static void ath9k_hw_set_4k_power_cal_ta
2512 REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3, 0);
2514 for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
2515 - if (AR_SREV_5416_20_OR_LATER(ah) &&
2516 - (ah->rxchainmask == 5 || ah->txchainmask == 5) &&
2518 - regChainOffset = (i == 1) ? 0x2000 : 0x1000;
2520 - regChainOffset = i * 0x1000;
2521 + regChainOffset = i * 0x1000;
2523 if (pEepData->baseEepHeader.txMask & (1 << i)) {
2524 pRawDataset = pEepData->calPierData2G[i];
2525 @@ -423,19 +418,17 @@ static void ath9k_hw_set_4k_power_cal_ta
2527 ENABLE_REGWRITE_BUFFER(ah);
2529 - if ((i == 0) || AR_SREV_5416_20_OR_LATER(ah)) {
2530 - REG_WRITE(ah, AR_PHY_TPCRG5 + regChainOffset,
2531 - SM(pdGainOverlap_t2,
2532 - AR_PHY_TPCRG5_PD_GAIN_OVERLAP)
2533 - | SM(gainBoundaries[0],
2534 - AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1)
2535 - | SM(gainBoundaries[1],
2536 - AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2)
2537 - | SM(gainBoundaries[2],
2538 - AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3)
2539 - | SM(gainBoundaries[3],
2540 - AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4));
2542 + REG_WRITE(ah, AR_PHY_TPCRG5 + regChainOffset,
2543 + SM(pdGainOverlap_t2,
2544 + AR_PHY_TPCRG5_PD_GAIN_OVERLAP)
2545 + | SM(gainBoundaries[0],
2546 + AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1)
2547 + | SM(gainBoundaries[1],
2548 + AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2)
2549 + | SM(gainBoundaries[2],
2550 + AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3)
2551 + | SM(gainBoundaries[3],
2552 + AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4));
2554 regOffset = AR_PHY_BASE + (672 << 2) + regChainOffset;
2555 for (j = 0; j < 32; j++) {
2556 @@ -715,10 +708,8 @@ static void ath9k_hw_4k_set_txpower(stru
2560 - if (AR_SREV_9280_20_OR_LATER(ah)) {
2561 - for (i = 0; i < Ar5416RateSize; i++)
2562 - ratesArray[i] -= AR5416_PWR_TABLE_OFFSET_DB * 2;
2564 + for (i = 0; i < Ar5416RateSize; i++)
2565 + ratesArray[i] -= AR5416_PWR_TABLE_OFFSET_DB * 2;
2567 ENABLE_REGWRITE_BUFFER(ah);
2569 @@ -788,28 +779,6 @@ static void ath9k_hw_4k_set_txpower(stru
2570 REGWRITE_BUFFER_FLUSH(ah);
2573 -static void ath9k_hw_4k_set_addac(struct ath_hw *ah,
2574 - struct ath9k_channel *chan)
2576 - struct modal_eep_4k_header *pModal;
2577 - struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k;
2580 - if (ah->hw_version.macVersion != AR_SREV_VERSION_9160)
2583 - if (ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_MINOR_VER_7)
2586 - pModal = &eep->modalHeader;
2588 - if (pModal->xpaBiasLvl != 0xff) {
2589 - biaslevel = pModal->xpaBiasLvl;
2590 - INI_RA(&ah->iniAddac, 7, 1) =
2591 - (INI_RA(&ah->iniAddac, 7, 1) & (~0x18)) | biaslevel << 3;
2595 static void ath9k_hw_4k_set_gain(struct ath_hw *ah,
2596 struct modal_eep_4k_header *pModal,
2597 struct ar5416_eeprom_4k *eep,
2598 @@ -877,6 +846,7 @@ static void ath9k_hw_4k_set_board_values
2600 u8 ob[5], db1[5], db2[5];
2601 u8 ant_div_control1, ant_div_control2;
2602 + u8 bb_desired_scale;
2605 pModal = &eep->modalHeader;
2606 @@ -1096,30 +1066,29 @@ static void ath9k_hw_4k_set_board_values
2607 AR_PHY_SETTLING_SWITCH,
2608 pModal->swSettleHt40);
2610 - if (AR_SREV_9271(ah) || AR_SREV_9285(ah)) {
2611 - u8 bb_desired_scale = (pModal->bb_scale_smrt_antenna &
2612 - EEP_4K_BB_DESIRED_SCALE_MASK);
2613 - if ((pBase->txGainType == 0) && (bb_desired_scale != 0)) {
2614 - u32 pwrctrl, mask, clr;
2616 - mask = BIT(0)|BIT(5)|BIT(10)|BIT(15)|BIT(20)|BIT(25);
2617 - pwrctrl = mask * bb_desired_scale;
2618 - clr = mask * 0x1f;
2619 - REG_RMW(ah, AR_PHY_TX_PWRCTRL8, pwrctrl, clr);
2620 - REG_RMW(ah, AR_PHY_TX_PWRCTRL10, pwrctrl, clr);
2621 - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL12, pwrctrl, clr);
2623 - mask = BIT(0)|BIT(5)|BIT(15);
2624 - pwrctrl = mask * bb_desired_scale;
2625 - clr = mask * 0x1f;
2626 - REG_RMW(ah, AR_PHY_TX_PWRCTRL9, pwrctrl, clr);
2628 - mask = BIT(0)|BIT(5);
2629 - pwrctrl = mask * bb_desired_scale;
2630 - clr = mask * 0x1f;
2631 - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL11, pwrctrl, clr);
2632 - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL13, pwrctrl, clr);
2635 + bb_desired_scale = (pModal->bb_scale_smrt_antenna &
2636 + EEP_4K_BB_DESIRED_SCALE_MASK);
2637 + if ((pBase->txGainType == 0) && (bb_desired_scale != 0)) {
2638 + u32 pwrctrl, mask, clr;
2640 + mask = BIT(0)|BIT(5)|BIT(10)|BIT(15)|BIT(20)|BIT(25);
2641 + pwrctrl = mask * bb_desired_scale;
2642 + clr = mask * 0x1f;
2643 + REG_RMW(ah, AR_PHY_TX_PWRCTRL8, pwrctrl, clr);
2644 + REG_RMW(ah, AR_PHY_TX_PWRCTRL10, pwrctrl, clr);
2645 + REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL12, pwrctrl, clr);
2647 + mask = BIT(0)|BIT(5)|BIT(15);
2648 + pwrctrl = mask * bb_desired_scale;
2649 + clr = mask * 0x1f;
2650 + REG_RMW(ah, AR_PHY_TX_PWRCTRL9, pwrctrl, clr);
2652 + mask = BIT(0)|BIT(5);
2653 + pwrctrl = mask * bb_desired_scale;
2654 + clr = mask * 0x1f;
2655 + REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL11, pwrctrl, clr);
2656 + REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL13, pwrctrl, clr);
2660 @@ -1161,7 +1130,6 @@ const struct eeprom_ops eep_4k_ops = {
2661 .get_eeprom_ver = ath9k_hw_4k_get_eeprom_ver,
2662 .get_eeprom_rev = ath9k_hw_4k_get_eeprom_rev,
2663 .set_board_values = ath9k_hw_4k_set_board_values,
2664 - .set_addac = ath9k_hw_4k_set_addac,
2665 .set_txpower = ath9k_hw_4k_set_txpower,
2666 .get_spur_channel = ath9k_hw_4k_get_spur_channel
2668 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
2669 +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
2670 @@ -851,10 +851,8 @@ static void ath9k_hw_ar9287_set_txpower(
2674 - if (AR_SREV_9280_20_OR_LATER(ah)) {
2675 - for (i = 0; i < Ar5416RateSize; i++)
2676 - ratesArray[i] -= AR9287_PWR_TABLE_OFFSET_DB * 2;
2678 + for (i = 0; i < Ar5416RateSize; i++)
2679 + ratesArray[i] -= AR9287_PWR_TABLE_OFFSET_DB * 2;
2681 ENABLE_REGWRITE_BUFFER(ah);
2683 @@ -944,11 +942,6 @@ static void ath9k_hw_ar9287_set_txpower(
2684 REGWRITE_BUFFER_FLUSH(ah);
2687 -static void ath9k_hw_ar9287_set_addac(struct ath_hw *ah,
2688 - struct ath9k_channel *chan)
2692 static void ath9k_hw_ar9287_set_board_values(struct ath_hw *ah,
2693 struct ath9k_channel *chan)
2695 @@ -1100,7 +1093,6 @@ const struct eeprom_ops eep_ar9287_ops =
2696 .get_eeprom_ver = ath9k_hw_ar9287_get_eeprom_ver,
2697 .get_eeprom_rev = ath9k_hw_ar9287_get_eeprom_rev,
2698 .set_board_values = ath9k_hw_ar9287_set_board_values,
2699 - .set_addac = ath9k_hw_ar9287_set_addac,
2700 .set_txpower = ath9k_hw_ar9287_set_txpower,
2701 .get_spur_channel = ath9k_hw_ar9287_get_spur_channel
2703 --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
2704 +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
2705 @@ -547,8 +547,7 @@ static void ath9k_hw_def_set_board_value
2709 - if (AR_SREV_5416_20_OR_LATER(ah) &&
2710 - (ah->rxchainmask == 5 || ah->txchainmask == 5) && (i != 0))
2711 + if ((ah->rxchainmask == 5 || ah->txchainmask == 5) && (i != 0))
2712 regChainOffset = (i == 1) ? 0x2000 : 0x1000;
2714 regChainOffset = i * 0x1000;
2715 @@ -565,9 +564,8 @@ static void ath9k_hw_def_set_board_value
2716 SM(pModal->iqCalQCh[i],
2717 AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF));
2719 - if ((i == 0) || AR_SREV_5416_20_OR_LATER(ah))
2720 - ath9k_hw_def_set_gain(ah, pModal, eep, txRxAttenLocal,
2721 - regChainOffset, i);
2722 + ath9k_hw_def_set_gain(ah, pModal, eep, txRxAttenLocal,
2723 + regChainOffset, i);
2726 if (AR_SREV_9280_20_OR_LATER(ah)) {
2727 @@ -893,8 +891,7 @@ static void ath9k_hw_set_def_power_cal_t
2730 for (i = 0; i < AR5416_MAX_CHAINS; i++) {
2731 - if (AR_SREV_5416_20_OR_LATER(ah) &&
2732 - (ah->rxchainmask == 5 || ah->txchainmask == 5) &&
2733 + if ((ah->rxchainmask == 5 || ah->txchainmask == 5) &&
2735 regChainOffset = (i == 1) ? 0x2000 : 0x1000;
2737 @@ -935,27 +932,24 @@ static void ath9k_hw_set_def_power_cal_t
2739 ENABLE_REGWRITE_BUFFER(ah);
2741 - if ((i == 0) || AR_SREV_5416_20_OR_LATER(ah)) {
2742 - if (OLC_FOR_AR9280_20_LATER) {
2744 - AR_PHY_TPCRG5 + regChainOffset,
2746 - AR_PHY_TPCRG5_PD_GAIN_OVERLAP) |
2747 - SM_PD_GAIN(1) | SM_PD_GAIN(2) |
2748 - SM_PD_GAIN(3) | SM_PD_GAIN(4));
2751 - AR_PHY_TPCRG5 + regChainOffset,
2752 - SM(pdGainOverlap_t2,
2753 - AR_PHY_TPCRG5_PD_GAIN_OVERLAP)|
2754 - SM_PDGAIN_B(0, 1) |
2755 - SM_PDGAIN_B(1, 2) |
2756 - SM_PDGAIN_B(2, 3) |
2757 - SM_PDGAIN_B(3, 4));
2759 + if (OLC_FOR_AR9280_20_LATER) {
2761 + AR_PHY_TPCRG5 + regChainOffset,
2763 + AR_PHY_TPCRG5_PD_GAIN_OVERLAP) |
2764 + SM_PD_GAIN(1) | SM_PD_GAIN(2) |
2765 + SM_PD_GAIN(3) | SM_PD_GAIN(4));
2768 + AR_PHY_TPCRG5 + regChainOffset,
2769 + SM(pdGainOverlap_t2,
2770 + AR_PHY_TPCRG5_PD_GAIN_OVERLAP)|
2771 + SM_PDGAIN_B(0, 1) |
2772 + SM_PDGAIN_B(1, 2) |
2773 + SM_PDGAIN_B(2, 3) |
2774 + SM_PDGAIN_B(3, 4));
2778 ath9k_adjust_pdadc_values(ah, pwr_table_offset,
2781 --- a/drivers/net/wireless/ath/ath9k/init.c
2782 +++ b/drivers/net/wireless/ath/ath9k/init.c
2783 @@ -506,7 +506,6 @@ static void ath9k_init_misc(struct ath_s
2784 sc->sc_flags |= SC_OP_RXAGGR;
2787 - ath9k_hw_set_diversity(sc->sc_ah, true);
2788 sc->rx.defant = ath9k_hw_getdefantenna(sc->sc_ah);
2790 memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
2791 --- a/drivers/net/wireless/ath/ath9k/reg.h
2792 +++ b/drivers/net/wireless/ath/ath9k/reg.h
2793 @@ -800,10 +800,6 @@
2794 #define AR_SREV_5416(_ah) \
2795 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_5416_PCI) || \
2796 ((_ah)->hw_version.macVersion == AR_SREV_VERSION_5416_PCIE))
2797 -#define AR_SREV_5416_20_OR_LATER(_ah) \
2798 - (((AR_SREV_5416(_ah)) && \
2799 - ((_ah)->hw_version.macRev >= AR_SREV_REVISION_5416_20)) || \
2800 - ((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9100))
2801 #define AR_SREV_5416_22_OR_LATER(_ah) \
2802 (((AR_SREV_5416(_ah)) && \
2803 ((_ah)->hw_version.macRev >= AR_SREV_REVISION_5416_22)) || \
2804 --- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
2805 +++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
2806 @@ -869,6 +869,7 @@ static bool ar9002_hw_init_cal(struct at
2807 ar9002_hw_pa_cal(ah, true);
2809 /* Do NF Calibration after DC offset and other calibrations */
2810 + ath9k_hw_loadnf(ah, chan);
2811 ath9k_hw_start_nfcal(ah, true);
2814 --- a/net/mac80211/ieee80211_i.h
2815 +++ b/net/mac80211/ieee80211_i.h
2816 @@ -671,7 +671,6 @@ enum queue_stop_reason {
2817 IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
2818 IEEE80211_QUEUE_STOP_REASON_SUSPEND,
2819 IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
2820 - IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE,
2823 #ifdef CONFIG_MAC80211_LEDS
2824 --- a/net/mac80211/mlme.c
2825 +++ b/net/mac80211/mlme.c
2826 @@ -1921,24 +1921,8 @@ static void ieee80211_rx_mgmt_beacon(str
2831 - * Whenever the AP announces the HT mode change that can be
2832 - * 40MHz intolerant or etc., it would be safer to stop tx
2833 - * queues before doing hw config to avoid buffer overflow.
2835 - ieee80211_stop_queues_by_reason(&sdata->local->hw,
2836 - IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE);
2838 - /* flush out all packets */
2839 - synchronize_net();
2841 - drv_flush(local, false);
2843 changed |= ieee80211_enable_ht(sdata, elems.ht_info_elem,
2844 bssid, ap_ht_cap_flags);
2846 - ieee80211_wake_queues_by_reason(&sdata->local->hw,
2847 - IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE);
2850 /* Note: country IE parsing is done for us by cfg80211 */