FreeBSD kernel ATH device code
ar5416_xmit.c
Go to the documentation of this file.
1/*-
2 * SPDX-License-Identifier: ISC
3 *
4 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
5 * Copyright (c) 2002-2008 Atheros Communications, Inc.
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 *
19 * $FreeBSD$
20 */
21#include "opt_ah.h"
22
23#include "ah.h"
24#include "ah_desc.h"
25#include "ah_internal.h"
26
27#include "ar5416/ar5416.h"
28#include "ar5416/ar5416reg.h"
29#include "ar5416/ar5416phy.h"
30#include "ar5416/ar5416desc.h"
31
32/*
33 * Stop transmit on the specified queue
34 */
36ar5416StopTxDma(struct ath_hal *ah, u_int q)
37{
38#define STOP_DMA_TIMEOUT 4000 /* us */
39#define STOP_DMA_ITER 100 /* us */
40 u_int i;
41
42 HALASSERT(q < AH_PRIVATE(ah)->ah_caps.halTotalQueues);
43
44 HALASSERT(AH5212(ah)->ah_txq[q].tqi_type != HAL_TX_QUEUE_INACTIVE);
45
46 OS_REG_WRITE(ah, AR_Q_TXD, 1 << q);
47 for (i = STOP_DMA_TIMEOUT/STOP_DMA_ITER; i != 0; i--) {
48 if (ar5212NumTxPending(ah, q) == 0)
49 break;
51 }
52#ifdef AH_DEBUG
53 if (i == 0) {
55 "%s: queue %u DMA did not stop in 400 msec\n", __func__, q);
57 "%s: QSTS 0x%x Q_TXE 0x%x Q_TXD 0x%x Q_CBR 0x%x\n", __func__,
61 "%s: Q_MISC 0x%x Q_RDYTIMECFG 0x%x Q_RDYTIMESHDN 0x%x\n",
62 __func__, OS_REG_READ(ah, AR_QMISC(q)),
65 }
66#endif /* AH_DEBUG */
67
68 /* ar5416 and up can kill packets at the PCU level */
69 if (ar5212NumTxPending(ah, q)) {
70 uint32_t j;
71
73 "%s: Num of pending TX Frames %d on Q %d\n",
74 __func__, ar5212NumTxPending(ah, q), q);
75
76 /* Kill last PCU Tx Frame */
77 /* TODO - save off and restore current values of Q1/Q2? */
78 for (j = 0; j < 2; j++) {
79 uint32_t tsfLow = OS_REG_READ(ah, AR_TSF_L32);
83 OS_REG_WRITE(ah, AR_NEXT_QUIET, tsfLow >> 10);
85
86 if ((OS_REG_READ(ah, AR_TSF_L32)>>10) == (tsfLow>>10))
87 break;
88
90 "%s: TSF moved while trying to set quiet time "
91 "TSF: 0x%08x\n", __func__, tsfLow);
92 HALASSERT(j < 1); /* TSF shouldn't count twice or reg access is taking forever */
93 }
94
96
97 /* Allow the quiet mechanism to do its work */
98 OS_DELAY(200);
100
101 /* Verify the transmit q is empty */
102 for (i = STOP_DMA_TIMEOUT/STOP_DMA_ITER; i != 0; i--) {
103 if (ar5212NumTxPending(ah, q) == 0)
104 break;
106 }
107 if (i == 0) {
109 "%s: Failed to stop Tx DMA in %d msec after killing"
110 " last frame\n", __func__, STOP_DMA_TIMEOUT / 1000);
111 }
113 }
114
115 OS_REG_WRITE(ah, AR_Q_TXD, 0);
116 return (i != 0);
117#undef STOP_DMA_ITER
118#undef STOP_DMA_TIMEOUT
119}
120
121#define VALID_KEY_TYPES \
122 ((1 << HAL_KEY_TYPE_CLEAR) | (1 << HAL_KEY_TYPE_WEP)|\
123 (1 << HAL_KEY_TYPE_AES) | (1 << HAL_KEY_TYPE_TKIP))
124#define isValidKeyType(_t) ((1 << (_t)) & VALID_KEY_TYPES)
125
126#define set11nTries(_series, _index) \
127 (SM((_series)[_index].Tries, AR_XmitDataTries##_index))
128
129#define set11nRate(_series, _index) \
130 (SM((_series)[_index].Rate, AR_XmitRate##_index))
131
132#define set11nPktDurRTSCTS(_series, _index) \
133 (SM((_series)[_index].PktDuration, AR_PacketDur##_index) |\
134 ((_series)[_index].RateFlags & HAL_RATESERIES_RTS_CTS ?\
135 AR_RTSCTSQual##_index : 0))
136
137#define set11nRateFlags(_series, _index) \
138 ((_series)[_index].RateFlags & HAL_RATESERIES_2040 ? AR_2040_##_index : 0) \
139 |((_series)[_index].RateFlags & HAL_RATESERIES_HALFGI ? AR_GI##_index : 0) \
140 |((_series)[_index].RateFlags & HAL_RATESERIES_STBC ? AR_STBC##_index : 0) \
141 |SM((_series)[_index].ChSel, AR_ChainSel##_index)
142
143/*
144 * Descriptor Access Functions
145 */
146
147#define VALID_PKT_TYPES \
148 ((1<<HAL_PKT_TYPE_NORMAL)|(1<<HAL_PKT_TYPE_ATIM)|\
149 (1<<HAL_PKT_TYPE_PSPOLL)|(1<<HAL_PKT_TYPE_PROBE_RESP)|\
150 (1<<HAL_PKT_TYPE_BEACON)|(1<<HAL_PKT_TYPE_AMPDU))
151#define isValidPktType(_t) ((1<<(_t)) & VALID_PKT_TYPES)
152#define VALID_TX_RATES \
153 ((1<<0x0b)|(1<<0x0f)|(1<<0x0a)|(1<<0x0e)|(1<<0x09)|(1<<0x0d)|\
154 (1<<0x08)|(1<<0x0c)|(1<<0x1b)|(1<<0x1a)|(1<<0x1e)|(1<<0x19)|\
155 (1<<0x1d)|(1<<0x18)|(1<<0x1c)|(1<<0x01)|(1<<0x02)|(1<<0x03)|\
156 (1<<0x04)|(1<<0x05)|(1<<0x06)|(1<<0x07)|(1<<0x00))
157/* NB: accept HT rates */
158#define isValidTxRate(_r) ((1<<((_r) & 0x7f)) & VALID_TX_RATES)
159
160static inline int
161ar5416RateToRateTable(struct ath_hal *ah, uint8_t rate, HAL_BOOL is_ht40)
162{
163
164 /*
165 * Handle the non-MCS rates
166 */
167 switch (rate) {
168 case /* 1 Mb */ 0x1b:
169 case /* 1 MbS*/ 0x1b | 0x4:
170 return (AH5416(ah)->ah_ratesArray[rate1l]);
171 case /* 2 Mb */ 0x1a:
172 return (AH5416(ah)->ah_ratesArray[rate2l]);
173 case /* 2 MbS*/ 0x1a | 0x4:
174 return (AH5416(ah)->ah_ratesArray[rate2s]);
175 case /* 5.5 Mb */ 0x19:
176 return (AH5416(ah)->ah_ratesArray[rate5_5l]);
177 case /* 5.5 MbS*/ 0x19 | 0x4:
178 return (AH5416(ah)->ah_ratesArray[rate5_5s]);
179 case /* 11 Mb */ 0x18:
180 return (AH5416(ah)->ah_ratesArray[rate11l]);
181 case /* 11 MbS*/ 0x18 | 0x4:
182 return (AH5416(ah)->ah_ratesArray[rate11s]);
183 }
184
185 /* OFDM rates */
186 switch (rate) {
187 case /* 6 Mb */ 0x0b:
188 return (AH5416(ah)->ah_ratesArray[rate6mb]);
189 case /* 9 Mb */ 0x0f:
190 return (AH5416(ah)->ah_ratesArray[rate9mb]);
191 case /* 12 Mb */ 0x0a:
192 return (AH5416(ah)->ah_ratesArray[rate12mb]);
193 case /* 18 Mb */ 0x0e:
194 return (AH5416(ah)->ah_ratesArray[rate18mb]);
195 case /* 24 Mb */ 0x09:
196 return (AH5416(ah)->ah_ratesArray[rate24mb]);
197 case /* 36 Mb */ 0x0d:
198 return (AH5416(ah)->ah_ratesArray[rate36mb]);
199 case /* 48 Mb */ 0x08:
200 return (AH5416(ah)->ah_ratesArray[rate48mb]);
201 case /* 54 Mb */ 0x0c:
202 return (AH5416(ah)->ah_ratesArray[rate54mb]);
203 }
204
205 /*
206 * Handle HT20/HT40 - we only have to do MCS0-7;
207 * there's no stream differences.
208 */
209 if ((rate & 0x80) && is_ht40) {
210 return (AH5416(ah)->ah_ratesArray[rateHt40_0 + (rate & 0x7)]);
211 } else if (rate & 0x80) {
212 return (AH5416(ah)->ah_ratesArray[rateHt20_0 + (rate & 0x7)]);
213 }
214
215 /* XXX default (eg XR, bad bad person!) */
216 return (AH5416(ah)->ah_ratesArray[rate6mb]);
217}
218
219/*
220 * Return the TX power to be used for the given rate/chains/TX power.
221 *
222 * There are a bunch of tweaks to make to a given TX power based on
223 * the current configuration, so...
224 */
225static uint16_t
226ar5416GetTxRatePower(struct ath_hal *ah, uint8_t rate, uint8_t tx_chainmask,
227 uint16_t txPower, HAL_BOOL is_ht40)
228{
229 int n_txpower, max_txpower;
230 const int cck_ofdm_delta = 2;
231#define EEP_MINOR(_ah) \
232 (AH_PRIVATE(_ah)->ah_eeversion & AR5416_EEP_VER_MINOR_MASK)
233#define IS_EEP_MINOR_V2(_ah) (EEP_MINOR(_ah) >= AR5416_EEP_MINOR_VER_2)
234
235 /* Take a copy ; we may underflow and thus need to clamp things */
236 n_txpower = txPower;
237
238 /* HT40? Need to adjust the TX power by this */
239 if (is_ht40)
240 n_txpower += AH5416(ah)->ah_ht40PowerIncForPdadc;
241
242 /*
243 * Merlin? Offset the target TX power offset - it defaults to
244 * starting at -5.0dBm, but that can change!
245 *
246 * Kiwi/Kite? Always -5.0dBm offset.
247 */
248 if (AR_SREV_KIWI_10_OR_LATER(ah)) {
249 n_txpower -= (AR5416_PWR_TABLE_OFFSET_DB * 2);
250 } else if (AR_SREV_MERLIN_20_OR_LATER(ah)) {
251 int8_t pwr_table_offset = 0;
252 /* This is in dBm, convert to 1/2 dBm */
254 &pwr_table_offset);
255 n_txpower -= (pwr_table_offset * 2);
256 }
257
258 /*
259 * If Open-loop TX power control is used, the CCK rates need
260 * to be offset by that.
261 *
262 * Rates: 2S, 2L, 1S, 1L, 5.5S, 5.5L
263 *
264 * XXX Odd, we don't have a PHY table entry for long preamble
265 * 1mbit CCK?
266 */
269 if (rate == 0x19 || rate == 0x1a || rate == 0x1b ||
270 rate == (0x19 | 0x04) || rate == (0x1a | 0x04) ||
271 rate == (0x1b | 0x04)) {
272 n_txpower -= cck_ofdm_delta;
273 }
274 }
275
276 /*
277 * We're now offset by the same amount that the static maximum
278 * PHY power tables are. So, clamp the value based on that rate.
279 */
280 max_txpower = ar5416RateToRateTable(ah, rate, is_ht40);
281#if 0
282 ath_hal_printf(ah, "%s: n_txpower = %d, max_txpower = %d, "
283 "rate = 0x%x , is_ht40 = %d\n",
284 __func__,
285 n_txpower,
286 max_txpower,
287 rate,
288 is_ht40);
289#endif
290 n_txpower = MIN(max_txpower, n_txpower);
291
292 /*
293 * We don't have to offset the TX power for two or three
294 * chain operation here - it's done by the AR_PHY_POWER_TX_SUB
295 * register setting via the EEPROM.
296 *
297 * So for vendors that programmed the maximum target power assuming
298 * that 2/3 chains are always on, things will just plain work.
299 * (They won't reach that target power if only one chain is on, but
300 * that's a different problem.)
301 */
302
303 /* Over/underflow? Adjust */
304 if (n_txpower < 0)
305 n_txpower = 0;
306 else if (n_txpower > 63)
307 n_txpower = 63;
308
309 /*
310 * For some odd reason the AR9160 with txpower=0 results in a
311 * much higher (max?) TX power. So, if it's a chipset before
312 * AR9220/AR9280, just clamp the minimum value at 1.
313 */
314 if ((! AR_SREV_MERLIN_10_OR_LATER(ah)) && (n_txpower == 0))
315 n_txpower = 1;
316
317 return (n_txpower);
318#undef EEP_MINOR
319#undef IS_EEP_MINOR_V2
320}
321
323ar5416SetupTxDesc(struct ath_hal *ah, struct ath_desc *ds,
324 u_int pktLen,
325 u_int hdrLen,
326 HAL_PKT_TYPE type,
327 u_int txPower,
328 u_int txRate0, u_int txTries0,
329 u_int keyIx,
330 u_int antMode,
331 u_int flags,
332 u_int rtsctsRate,
333 u_int rtsctsDuration,
334 u_int compicvLen,
335 u_int compivLen,
336 u_int comp)
337{
338#define RTSCTS (HAL_TXDESC_RTSENA|HAL_TXDESC_CTSENA)
339 struct ar5416_desc *ads = AR5416DESC(ds);
340 struct ath_hal_5416 *ahp = AH5416(ah);
341
342 (void) hdrLen;
343
344 HALASSERT(txTries0 != 0);
346 HALASSERT(isValidTxRate(txRate0));
347 HALASSERT((flags & RTSCTS) != RTSCTS);
348 /* XXX validate antMode */
349
350 txPower = (txPower + AH5212(ah)->ah_txPowerIndexOffset);
351 if (txPower > 63)
352 txPower = 63;
353
354 /*
355 * XXX For now, just assume that this isn't a HT40 frame.
356 * It'll get over-ridden by the multi-rate TX power setup.
357 */
358 if (AH5212(ah)->ah_tpcEnabled) {
359 txPower = ar5416GetTxRatePower(ah, txRate0,
360 ahp->ah_tx_chainmask,
361 txPower,
362 AH_FALSE);
363 }
364
365 ads->ds_ctl0 = (pktLen & AR_FrameLen)
366 | (txPower << AR_XmitPower_S)
367 | (flags & HAL_TXDESC_VEOL ? AR_VEOL : 0)
368 | (flags & HAL_TXDESC_CLRDMASK ? AR_ClrDestMask : 0)
369 | (flags & HAL_TXDESC_INTREQ ? AR_TxIntrReq : 0)
370 ;
371 ads->ds_ctl1 = (type << AR_FrameType_S)
372 | (flags & HAL_TXDESC_NOACK ? AR_NoAck : 0)
373 | (flags & HAL_TXDESC_HWTS ? AR_InsertTS : 0)
374 ;
375 ads->ds_ctl2 = SM(txTries0, AR_XmitDataTries0)
376 | (flags & HAL_TXDESC_DURENA ? AR_DurUpdateEn : 0)
377 ;
378 ads->ds_ctl3 = (txRate0 << AR_XmitRate0_S)
379 ;
380 ads->ds_ctl4 = 0;
381 ads->ds_ctl5 = 0;
382 ads->ds_ctl6 = 0;
383 ads->ds_ctl7 = SM(ahp->ah_tx_chainmask, AR_ChainSel0)
387 ;
388 ads->ds_ctl8 = SM(0, AR_AntCtl0);
389 ads->ds_ctl9 = SM(0, AR_AntCtl1) | SM(txPower, AR_XmitPower1);
390 ads->ds_ctl10 = SM(0, AR_AntCtl2) | SM(txPower, AR_XmitPower2);
391 ads->ds_ctl11 = SM(0, AR_AntCtl3) | SM(txPower, AR_XmitPower3);
392
393 if (keyIx != HAL_TXKEYIX_INVALID) {
394 /* XXX validate key index */
395 ads->ds_ctl1 |= SM(keyIx, AR_DestIdx);
396 ads->ds_ctl0 |= AR_DestIdxValid;
397 ads->ds_ctl6 |= SM(ahp->ah_keytype[keyIx], AR_EncrType);
398 }
399 if (flags & RTSCTS) {
400 if (!isValidTxRate(rtsctsRate)) {
402 "%s: invalid rts/cts rate 0x%x\n",
403 __func__, rtsctsRate);
404 return AH_FALSE;
405 }
406 /* XXX validate rtsctsDuration */
407 ads->ds_ctl0 |= (flags & HAL_TXDESC_CTSENA ? AR_CTSEnable : 0)
408 | (flags & HAL_TXDESC_RTSENA ? AR_RTSEnable : 0)
409 ;
410 ads->ds_ctl7 |= (rtsctsRate << AR_RTSCTSRate_S);
411 }
412
413 /*
414 * Set the TX antenna to 0 for Kite
415 * To preserve existing behaviour, also set the TPC bits to 0;
416 * when TPC is enabled these should be filled in appropriately.
417 *
418 * XXX TODO: when doing TPC, set the TX power up appropriately?
419 */
420 if (AR_SREV_KITE(ah)) {
421 ads->ds_ctl8 = SM(0, AR_AntCtl0);
422 ads->ds_ctl9 = SM(0, AR_AntCtl1) | SM(0, AR_XmitPower1);
423 ads->ds_ctl10 = SM(0, AR_AntCtl2) | SM(0, AR_XmitPower2);
424 ads->ds_ctl11 = SM(0, AR_AntCtl3) | SM(0, AR_XmitPower3);
425 }
426 return AH_TRUE;
427#undef RTSCTS
428}
429
431ar5416SetupXTxDesc(struct ath_hal *ah, struct ath_desc *ds,
432 u_int txRate1, u_int txTries1,
433 u_int txRate2, u_int txTries2,
434 u_int txRate3, u_int txTries3)
435{
436 struct ar5416_desc *ads = AR5416DESC(ds);
437
438 if (txTries1) {
439 HALASSERT(isValidTxRate(txRate1));
440 ads->ds_ctl2 |= SM(txTries1, AR_XmitDataTries1);
441 ads->ds_ctl3 |= (txRate1 << AR_XmitRate1_S);
442 }
443 if (txTries2) {
444 HALASSERT(isValidTxRate(txRate2));
445 ads->ds_ctl2 |= SM(txTries2, AR_XmitDataTries2);
446 ads->ds_ctl3 |= (txRate2 << AR_XmitRate2_S);
447 }
448 if (txTries3) {
449 HALASSERT(isValidTxRate(txRate3));
450 ads->ds_ctl2 |= SM(txTries3, AR_XmitDataTries3);
451 ads->ds_ctl3 |= (txRate3 << AR_XmitRate3_S);
452 }
453 return AH_TRUE;
454}
455
456/*
457 * XXX TODO: Figure out if AR_InsertTS is required on all sub-frames
458 * of a TX descriptor.
459 */
461ar5416FillTxDesc(struct ath_hal *ah, struct ath_desc *ds,
462 HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList, u_int descId,
463 u_int qcuId, HAL_BOOL firstSeg, HAL_BOOL lastSeg,
464 const struct ath_desc *ds0)
465{
466 struct ar5416_desc *ads = AR5416DESC(ds);
467 uint32_t segLen = segLenList[0];
468
469 HALASSERT((segLen &~ AR_BufLen) == 0);
470
471 ds->ds_data = bufAddrList[0];
472
473 if (firstSeg) {
474 /*
475 * First descriptor, don't clobber xmit control data
476 * setup by ar5212SetupTxDesc.
477 */
478 ads->ds_ctl1 |= segLen | (lastSeg ? 0 : AR_TxMore);
479 } else if (lastSeg) { /* !firstSeg && lastSeg */
480 /*
481 * Last descriptor in a multi-descriptor frame,
482 * copy the multi-rate transmit parameters from
483 * the first frame for processing on completion.
484 */
485 ads->ds_ctl1 = segLen;
486#ifdef AH_NEED_DESC_SWAP
487 ads->ds_ctl0 = __bswap32(AR5416DESC_CONST(ds0)->ds_ctl0)
488 & AR_TxIntrReq;
489 ads->ds_ctl2 = __bswap32(AR5416DESC_CONST(ds0)->ds_ctl2);
490 ads->ds_ctl3 = __bswap32(AR5416DESC_CONST(ds0)->ds_ctl3);
491 /* ctl6 - we only need encrtype; the rest are blank */
492 ads->ds_ctl6 = __bswap32(AR5416DESC_CONST(ds0)->ds_ctl6 & AR_EncrType);
493#else
494 ads->ds_ctl0 = AR5416DESC_CONST(ds0)->ds_ctl0 & AR_TxIntrReq;
495 ads->ds_ctl2 = AR5416DESC_CONST(ds0)->ds_ctl2;
496 ads->ds_ctl3 = AR5416DESC_CONST(ds0)->ds_ctl3;
497 /* ctl6 - we only need encrtype; the rest are blank */
498 ads->ds_ctl6 = AR5416DESC_CONST(ds0)->ds_ctl6 & AR_EncrType;
499#endif
500 } else { /* !firstSeg && !lastSeg */
501 /*
502 * Intermediate descriptor in a multi-descriptor frame.
503 */
504#ifdef AH_NEED_DESC_SWAP
505 ads->ds_ctl0 = __bswap32(AR5416DESC_CONST(ds0)->ds_ctl0)
506 & AR_TxIntrReq;
507 ads->ds_ctl6 = __bswap32(AR5416DESC_CONST(ds0)->ds_ctl6 & AR_EncrType);
508#else
509 ads->ds_ctl0 = AR5416DESC_CONST(ds0)->ds_ctl0 & AR_TxIntrReq;
510 ads->ds_ctl6 = AR5416DESC_CONST(ds0)->ds_ctl6 & AR_EncrType;
511#endif
512 ads->ds_ctl1 = segLen | AR_TxMore;
513 ads->ds_ctl2 = 0;
514 ads->ds_ctl3 = 0;
515 }
516 /* XXX only on last descriptor? */
517 OS_MEMZERO(ads->u.tx.status, sizeof(ads->u.tx.status));
518 return AH_TRUE;
519}
520
521/*
522 * NB: cipher is no longer used, it's calculated.
523 */
525ar5416ChainTxDesc(struct ath_hal *ah, struct ath_desc *ds,
526 HAL_DMA_ADDR *bufAddrList,
527 uint32_t *segLenList,
528 u_int pktLen,
529 u_int hdrLen,
530 HAL_PKT_TYPE type,
531 u_int keyIx,
532 HAL_CIPHER cipher,
533 uint8_t delims,
534 HAL_BOOL firstSeg,
535 HAL_BOOL lastSeg,
536 HAL_BOOL lastAggr)
537{
538 struct ar5416_desc *ads = AR5416DESC(ds);
539 uint32_t *ds_txstatus = AR5416_DS_TXSTATUS(ah,ads);
540 struct ath_hal_5416 *ahp = AH5416(ah);
541 u_int segLen = segLenList[0];
542
543 int isaggr = 0;
544 uint32_t last_aggr = 0;
545
546 (void) hdrLen;
547 (void) ah;
548
549 HALASSERT((segLen &~ AR_BufLen) == 0);
550 ds->ds_data = bufAddrList[0];
551
553 if (type == HAL_PKT_TYPE_AMPDU) {
554 type = HAL_PKT_TYPE_NORMAL;
555 isaggr = 1;
556 if (lastAggr == AH_FALSE)
557 last_aggr = AR_MoreAggr;
558 }
559
560 /*
561 * Since this function is called before any of the other
562 * descriptor setup functions (at least in this particular
563 * 802.11n aggregation implementation), always bzero() the
564 * descriptor. Previously this would be done for all but
565 * the first segment.
566 * XXX TODO: figure out why; perhaps I'm using this slightly
567 * XXX incorrectly.
568 */
570
571 /*
572 * Note: VEOL should only be for the last descriptor in the chain.
573 */
574 ads->ds_ctl0 = (pktLen & AR_FrameLen);
575
576 /*
577 * For aggregates:
578 * + IsAggr must be set for all descriptors of all subframes of
579 * the aggregate
580 * + MoreAggr must be set for all descriptors of all subframes
581 * of the aggregate EXCEPT the last subframe;
582 * + MoreAggr must be _CLEAR_ for all descrpitors of the last
583 * subframe of the aggregate.
584 */
585 ads->ds_ctl1 = (type << AR_FrameType_S)
586 | (isaggr ? (AR_IsAggr | last_aggr) : 0);
587
588 ads->ds_ctl2 = 0;
589 ads->ds_ctl3 = 0;
590 if (keyIx != HAL_TXKEYIX_INVALID) {
591 /* XXX validate key index */
592 ads->ds_ctl1 |= SM(keyIx, AR_DestIdx);
593 ads->ds_ctl0 |= AR_DestIdxValid;
594 }
595
596 ads->ds_ctl6 |= SM(ahp->ah_keytype[keyIx], AR_EncrType);
597 if (isaggr) {
598 ads->ds_ctl6 |= SM(delims, AR_PadDelim);
599 }
600
601 if (firstSeg) {
602 ads->ds_ctl1 |= segLen | (lastSeg ? 0 : AR_TxMore);
603 } else if (lastSeg) { /* !firstSeg && lastSeg */
604 ads->ds_ctl0 = 0;
605 ads->ds_ctl1 |= segLen;
606 } else { /* !firstSeg && !lastSeg */
607 /*
608 * Intermediate descriptor in a multi-descriptor frame.
609 */
610 ads->ds_ctl0 = 0;
611 ads->ds_ctl1 |= segLen | AR_TxMore;
612 }
613 ds_txstatus[0] = ds_txstatus[1] = 0;
614 ds_txstatus[9] &= ~AR_TxDone;
615
616 return AH_TRUE;
617}
618
621 u_int aggrLen, u_int flags, u_int txPower,
622 u_int txRate0, u_int txTries0, u_int antMode,
623 u_int rtsctsRate, u_int rtsctsDuration)
624{
625#define RTSCTS (HAL_TXDESC_RTSENA|HAL_TXDESC_CTSENA)
626 struct ar5416_desc *ads = AR5416DESC(ds);
627 struct ath_hal_5212 *ahp = AH5212(ah);
628
629 HALASSERT(txTries0 != 0);
630 HALASSERT(isValidTxRate(txRate0));
631 HALASSERT((flags & RTSCTS) != RTSCTS);
632 /* XXX validate antMode */
633
634 txPower = (txPower + ahp->ah_txPowerIndexOffset );
635 if(txPower > 63) txPower=63;
636
637 ads->ds_ctl0 |= (txPower << AR_XmitPower_S)
638 | (flags & HAL_TXDESC_VEOL ? AR_VEOL : 0)
639 | (flags & HAL_TXDESC_CLRDMASK ? AR_ClrDestMask : 0)
640 | (flags & HAL_TXDESC_INTREQ ? AR_TxIntrReq : 0);
641 ads->ds_ctl1 |= (flags & HAL_TXDESC_NOACK ? AR_NoAck : 0);
642 ads->ds_ctl2 |= SM(txTries0, AR_XmitDataTries0);
643 ads->ds_ctl3 |= (txRate0 << AR_XmitRate0_S);
644 ads->ds_ctl7 = SM(AH5416(ah)->ah_tx_chainmask, AR_ChainSel0)
648
649 /* NB: no V1 WAR */
650 ads->ds_ctl8 = SM(0, AR_AntCtl0);
651 ads->ds_ctl9 = SM(0, AR_AntCtl1) | SM(txPower, AR_XmitPower1);
652 ads->ds_ctl10 = SM(0, AR_AntCtl2) | SM(txPower, AR_XmitPower2);
653 ads->ds_ctl11 = SM(0, AR_AntCtl3) | SM(txPower, AR_XmitPower3);
654
655 ads->ds_ctl6 &= ~(0xffff);
656 ads->ds_ctl6 |= SM(aggrLen, AR_AggrLen);
657
658 if (flags & RTSCTS) {
659 /* XXX validate rtsctsDuration */
660 ads->ds_ctl0 |= (flags & HAL_TXDESC_CTSENA ? AR_CTSEnable : 0)
661 | (flags & HAL_TXDESC_RTSENA ? AR_RTSEnable : 0);
662 }
663
664 /*
665 * Set the TX antenna to 0 for Kite
666 * To preserve existing behaviour, also set the TPC bits to 0;
667 * when TPC is enabled these should be filled in appropriately.
668 */
669 if (AR_SREV_KITE(ah)) {
670 ads->ds_ctl8 = SM(0, AR_AntCtl0);
671 ads->ds_ctl9 = SM(0, AR_AntCtl1) | SM(0, AR_XmitPower1);
672 ads->ds_ctl10 = SM(0, AR_AntCtl2) | SM(0, AR_XmitPower2);
673 ads->ds_ctl11 = SM(0, AR_AntCtl3) | SM(0, AR_XmitPower3);
674 }
675
676 return AH_TRUE;
677#undef RTSCTS
678}
679
682 const struct ath_desc *ds0)
683{
684 struct ar5416_desc *ads = AR5416DESC(ds);
685
686 ads->ds_ctl1 &= ~AR_MoreAggr;
687 ads->ds_ctl6 &= ~AR_PadDelim;
688
689 /* hack to copy rate info to last desc for later processing */
690#ifdef AH_NEED_DESC_SWAP
691 ads->ds_ctl2 = __bswap32(AR5416DESC_CONST(ds0)->ds_ctl2);
692 ads->ds_ctl3 = __bswap32(AR5416DESC_CONST(ds0)->ds_ctl3);
693#else
694 ads->ds_ctl2 = AR5416DESC_CONST(ds0)->ds_ctl2;
695 ads->ds_ctl3 = AR5416DESC_CONST(ds0)->ds_ctl3;
696#endif
697 return AH_TRUE;
698}
699
700#ifdef AH_NEED_DESC_SWAP
701/* Swap transmit descriptor */
702static __inline void
703ar5416SwapTxDesc(struct ath_desc *ds)
704{
705 ds->ds_data = __bswap32(ds->ds_data);
706 ds->ds_ctl0 = __bswap32(ds->ds_ctl0);
707 ds->ds_ctl1 = __bswap32(ds->ds_ctl1);
708 ds->ds_hw[0] = __bswap32(ds->ds_hw[0]);
709 ds->ds_hw[1] = __bswap32(ds->ds_hw[1]);
710 ds->ds_hw[2] = __bswap32(ds->ds_hw[2]);
711 ds->ds_hw[3] = __bswap32(ds->ds_hw[3]);
712}
713#endif
714
715/*
716 * Processing of HW TX descriptor.
717 */
720 struct ath_desc *ds, struct ath_tx_status *ts)
721{
722 struct ar5416_desc *ads = AR5416DESC(ds);
723 uint32_t *ds_txstatus = AR5416_DS_TXSTATUS(ah,ads);
724
725#ifdef AH_NEED_DESC_SWAP
726 if ((ds_txstatus[9] & __bswap32(AR_TxDone)) == 0)
727 return HAL_EINPROGRESS;
728 ar5416SwapTxDesc(ds);
729#else
730 if ((ds_txstatus[9] & AR_TxDone) == 0)
731 return HAL_EINPROGRESS;
732#endif
733
734 /* Update software copies of the HW status */
735 ts->ts_seqnum = MS(ds_txstatus[9], AR_SeqNum);
736 ts->ts_tstamp = AR_SendTimestamp(ds_txstatus);
737 ts->ts_tid = MS(ds_txstatus[9], AR_TxTid);
738
739 ts->ts_status = 0;
740 if (ds_txstatus[1] & AR_ExcessiveRetries)
742 if (ds_txstatus[1] & AR_Filtered)
744 if (ds_txstatus[1] & AR_FIFOUnderrun)
746 if (ds_txstatus[9] & AR_TxOpExceeded)
748 if (ds_txstatus[1] & AR_TxTimerExpired)
750
751 ts->ts_flags = 0;
752 if (ds_txstatus[0] & AR_TxBaStatus) {
753 ts->ts_flags |= HAL_TX_BA;
754 ts->ts_ba_low = AR_BaBitmapLow(ds_txstatus);
755 ts->ts_ba_high = AR_BaBitmapHigh(ds_txstatus);
756 }
757 if (ds->ds_ctl1 & AR_IsAggr)
758 ts->ts_flags |= HAL_TX_AGGR;
759 if (ds_txstatus[1] & AR_DescCfgErr)
761 if (ds_txstatus[1] & AR_TxDataUnderrun)
763 if (ds_txstatus[1] & AR_TxDelimUnderrun)
765
766 /*
767 * Extract the transmit rate used and mark the rate as
768 * ``alternate'' if it wasn't the series 0 rate.
769 */
770 ts->ts_finaltsi = MS(ds_txstatus[9], AR_FinalTxIdx);
771 switch (ts->ts_finaltsi) {
772 case 0:
773 ts->ts_rate = MS(ads->ds_ctl3, AR_XmitRate0);
774 break;
775 case 1:
776 ts->ts_rate = MS(ads->ds_ctl3, AR_XmitRate1);
777 break;
778 case 2:
779 ts->ts_rate = MS(ads->ds_ctl3, AR_XmitRate2);
780 break;
781 case 3:
782 ts->ts_rate = MS(ads->ds_ctl3, AR_XmitRate3);
783 break;
784 }
785
786 ts->ts_rssi = MS(ds_txstatus[5], AR_TxRSSICombined);
787 ts->ts_rssi_ctl[0] = MS(ds_txstatus[0], AR_TxRSSIAnt00);
788 ts->ts_rssi_ctl[1] = MS(ds_txstatus[0], AR_TxRSSIAnt01);
789 ts->ts_rssi_ctl[2] = MS(ds_txstatus[0], AR_TxRSSIAnt02);
790 ts->ts_rssi_ext[0] = MS(ds_txstatus[5], AR_TxRSSIAnt10);
791 ts->ts_rssi_ext[1] = MS(ds_txstatus[5], AR_TxRSSIAnt11);
792 ts->ts_rssi_ext[2] = MS(ds_txstatus[5], AR_TxRSSIAnt12);
793 ts->ts_evm0 = AR_TxEVM0(ds_txstatus);
794 ts->ts_evm1 = AR_TxEVM1(ds_txstatus);
795 ts->ts_evm2 = AR_TxEVM2(ds_txstatus);
796
797 ts->ts_shortretry = MS(ds_txstatus[1], AR_RTSFailCnt);
798 ts->ts_longretry = MS(ds_txstatus[1], AR_DataFailCnt);
799 /*
800 * The retry count has the number of un-acked tries for the
801 * final series used. When doing multi-rate retry we must
802 * fixup the retry count by adding in the try counts for
803 * each series that was fully-processed. Beware that this
804 * takes values from the try counts in the final descriptor.
805 * These are not required by the hardware. We assume they
806 * are placed there by the driver as otherwise we have no
807 * access and the driver can't do the calculation because it
808 * doesn't know the descriptor format.
809 */
810 switch (ts->ts_finaltsi) {
811 case 3: ts->ts_longretry += MS(ads->ds_ctl2, AR_XmitDataTries2);
812 case 2: ts->ts_longretry += MS(ads->ds_ctl2, AR_XmitDataTries1);
813 case 1: ts->ts_longretry += MS(ads->ds_ctl2, AR_XmitDataTries0);
814 }
815
816 /*
817 * These fields are not used. Zero these to preserve compatibility
818 * with existing drivers.
819 */
821 ts->ts_antenna = 0; /* We don't switch antennas on Owl*/
822
823 /* handle tx trigger level changes internally */
824 if ((ts->ts_status & HAL_TXERR_FIFO) ||
827
828 return HAL_OK;
829}
830
833{
834 struct ath_hal_5416 *ahp = AH5416(ah);
835
836 if (tu > 0xFFFF) {
837 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: bad global tx timeout %u\n",
838 __func__, tu);
839 /* restore default handling */
840 ahp->ah_globaltxtimeout = (u_int) -1;
841 return AH_FALSE;
842 }
844 ahp->ah_globaltxtimeout = tu;
845 return AH_TRUE;
846}
847
848u_int
850{
852}
853
854#define HT_RC_2_MCS(_rc) ((_rc) & 0x0f)
855static const u_int8_t baDurationDelta[] = {
856 24, // 0: BPSK
857 12, // 1: QPSK 1/2
858 12, // 2: QPSK 3/4
859 4, // 3: 16-QAM 1/2
860 4, // 4: 16-QAM 3/4
861 4, // 5: 64-QAM 2/3
862 4, // 6: 64-QAM 3/4
863 4, // 7: 64-QAM 5/6
864 24, // 8: BPSK
865 12, // 9: QPSK 1/2
866 12, // 10: QPSK 3/4
867 4, // 11: 16-QAM 1/2
868 4, // 12: 16-QAM 3/4
869 4, // 13: 64-QAM 2/3
870 4, // 14: 64-QAM 3/4
871 4, // 15: 64-QAM 5/6
872};
873
874void
876 u_int durUpdateEn, u_int rtsctsRate,
877 HAL_11N_RATE_SERIES series[], u_int nseries, u_int flags)
878{
879 struct ar5416_desc *ads = AR5416DESC(ds);
880 uint32_t ds_ctl0;
881
882 HALASSERT(nseries == 4);
883 (void)nseries;
884
885 /*
886 * Only one of RTS and CTS enable must be set.
887 * If a frame has both set, just do RTS protection -
888 * that's enough to satisfy legacy protection.
889 */
890 if (flags & (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA)) {
891 ds_ctl0 = ads->ds_ctl0;
892
893 if (flags & HAL_TXDESC_RTSENA) {
894 ds_ctl0 &= ~AR_CTSEnable;
896 } else {
897 ds_ctl0 &= ~AR_RTSEnable;
899 }
900
901 ads->ds_ctl0 = ds_ctl0;
902 } else {
903 ads->ds_ctl0 =
904 (ads->ds_ctl0 & ~(AR_RTSEnable | AR_CTSEnable));
905 }
906
907 ads->ds_ctl2 = set11nTries(series, 0)
908 | set11nTries(series, 1)
909 | set11nTries(series, 2)
910 | set11nTries(series, 3)
911 | (durUpdateEn ? AR_DurUpdateEn : 0);
912
913 ads->ds_ctl3 = set11nRate(series, 0)
914 | set11nRate(series, 1)
915 | set11nRate(series, 2)
916 | set11nRate(series, 3);
917
918 ads->ds_ctl4 = set11nPktDurRTSCTS(series, 0)
919 | set11nPktDurRTSCTS(series, 1);
920
921 ads->ds_ctl5 = set11nPktDurRTSCTS(series, 2)
922 | set11nPktDurRTSCTS(series, 3);
923
924 ads->ds_ctl7 = set11nRateFlags(series, 0)
925 | set11nRateFlags(series, 1)
926 | set11nRateFlags(series, 2)
927 | set11nRateFlags(series, 3)
928 | SM(rtsctsRate, AR_RTSCTSRate);
929
930 /*
931 * Doing per-packet TPC - update the TX power for the first
932 * field; program in the other series.
933 */
934 if (AH5212(ah)->ah_tpcEnabled) {
935 uint32_t ds_ctl0;
936 uint16_t txPower;
937
938 /* Modify the tx power field for rate 0 */
939 txPower = ar5416GetTxRatePower(ah, series[0].Rate,
940 series[0].ChSel,
941 series[0].tx_power_cap,
942 !! (series[0].RateFlags & HAL_RATESERIES_2040));
943 ds_ctl0 = ads->ds_ctl0 & ~AR_XmitPower;
944 ds_ctl0 |= (txPower << AR_XmitPower_S);
945 ads->ds_ctl0 = ds_ctl0;
946
947 /*
948 * Override the whole descriptor field for each TX power.
949 *
950 * This will need changing if we ever support antenna control
951 * programming.
952 */
953 txPower = ar5416GetTxRatePower(ah, series[1].Rate,
954 series[1].ChSel,
955 series[1].tx_power_cap,
956 !! (series[1].RateFlags & HAL_RATESERIES_2040));
957 ads->ds_ctl9 = SM(0, AR_AntCtl1) | SM(txPower, AR_XmitPower1);
958
959 txPower = ar5416GetTxRatePower(ah, series[2].Rate,
960 series[2].ChSel,
961 series[2].tx_power_cap,
962 !! (series[2].RateFlags & HAL_RATESERIES_2040));
963 ads->ds_ctl10 = SM(0, AR_AntCtl2) | SM(txPower, AR_XmitPower2);
964
965 txPower = ar5416GetTxRatePower(ah, series[3].Rate,
966 series[3].ChSel,
967 series[3].tx_power_cap,
968 !! (series[3].RateFlags & HAL_RATESERIES_2040));
969 ads->ds_ctl11 = SM(0, AR_AntCtl3) | SM(txPower, AR_XmitPower3);
970 }
971}
972
973/*
974 * Note: this should be called before calling ar5416SetBurstDuration()
975 * (if it is indeed called) in order to ensure that the burst duration
976 * is correctly updated with the BA delta workaround.
977 */
978void
979ar5416Set11nAggrFirst(struct ath_hal *ah, struct ath_desc *ds, u_int aggrLen,
980 u_int numDelims)
981{
982 struct ar5416_desc *ads = AR5416DESC(ds);
983 uint32_t flags;
984 uint32_t burstDur;
985 uint8_t rate;
986
987 ads->ds_ctl1 |= (AR_IsAggr | AR_MoreAggr);
988
989 ads->ds_ctl6 &= ~(AR_AggrLen | AR_PadDelim);
990 ads->ds_ctl6 |= SM(aggrLen, AR_AggrLen);
991 ads->ds_ctl6 |= SM(numDelims, AR_PadDelim);
992
993 if (! AR_SREV_MERLIN_10_OR_LATER(ah)) {
994 /*
995 * XXX It'd be nice if I were passed in the rate scenario
996 * at this point..
997 */
998 rate = MS(ads->ds_ctl3, AR_XmitRate0);
999 flags = ads->ds_ctl0 & (AR_CTSEnable | AR_RTSEnable);
1000 /*
1001 * WAR - MAC assumes normal ACK time instead of
1002 * block ACK while computing packet duration.
1003 * Add this delta to the burst duration in the descriptor.
1004 */
1005 if (flags && (ads->ds_ctl1 & AR_IsAggr)) {
1006 burstDur = baDurationDelta[HT_RC_2_MCS(rate)];
1007 ads->ds_ctl2 &= ~(AR_BurstDur);
1008 ads->ds_ctl2 |= SM(burstDur, AR_BurstDur);
1009 }
1010 }
1011}
1012
1013void
1014ar5416Set11nAggrMiddle(struct ath_hal *ah, struct ath_desc *ds, u_int numDelims)
1015{
1016 struct ar5416_desc *ads = AR5416DESC(ds);
1017 uint32_t *ds_txstatus = AR5416_DS_TXSTATUS(ah,ads);
1018
1019 ads->ds_ctl1 |= (AR_IsAggr | AR_MoreAggr);
1020
1021 ads->ds_ctl6 &= ~AR_PadDelim;
1022 ads->ds_ctl6 |= SM(numDelims, AR_PadDelim);
1023 ads->ds_ctl6 &= ~AR_AggrLen;
1024
1025 /*
1026 * Clear the TxDone status here, may need to change
1027 * func name to reflect this
1028 */
1029 ds_txstatus[9] &= ~AR_TxDone;
1030}
1031
1032void
1034{
1035 struct ar5416_desc *ads = AR5416DESC(ds);
1036
1037 ads->ds_ctl1 |= AR_IsAggr;
1038 ads->ds_ctl1 &= ~AR_MoreAggr;
1039 ads->ds_ctl6 &= ~AR_PadDelim;
1040}
1041
1042void
1043ar5416Clr11nAggr(struct ath_hal *ah, struct ath_desc *ds)
1044{
1045 struct ar5416_desc *ads = AR5416DESC(ds);
1046
1047 ads->ds_ctl1 &= (~AR_IsAggr & ~AR_MoreAggr);
1048 ads->ds_ctl6 &= ~AR_PadDelim;
1049 ads->ds_ctl6 &= ~AR_AggrLen;
1050}
1051
1052void
1054 u_int vmf)
1055{
1056 struct ar5416_desc *ads = AR5416DESC(ds);
1057 if (vmf)
1058 ads->ds_ctl0 |= AR_VirtMoreFrag;
1059 else
1060 ads->ds_ctl0 &= ~AR_VirtMoreFrag;
1061}
1062
1063/*
1064 * Program the burst duration, with the included BA delta if it's
1065 * applicable.
1066 */
1067void
1069 u_int burstDuration)
1070{
1071 struct ar5416_desc *ads = AR5416DESC(ds);
1072 uint32_t burstDur = 0;
1073 uint8_t rate;
1074
1075 if (! AR_SREV_MERLIN_10_OR_LATER(ah)) {
1076 /*
1077 * XXX It'd be nice if I were passed in the rate scenario
1078 * at this point..
1079 */
1080 rate = MS(ads->ds_ctl3, AR_XmitDataTries0);
1081 /*
1082 * WAR - MAC assumes normal ACK time instead of
1083 * block ACK while computing packet duration.
1084 * Add this delta to the burst duration in the descriptor.
1085 */
1086 if (ads->ds_ctl1 & AR_IsAggr) {
1087 burstDur = baDurationDelta[HT_RC_2_MCS(rate)];
1088 }
1089 }
1090
1091 ads->ds_ctl2 &= ~AR_BurstDur;
1092 ads->ds_ctl2 |= SM(burstDur + burstDuration, AR_BurstDur);
1093}
1094
1095/*
1096 * Retrieve the rate table from the given TX completion descriptor
1097 */
1099ar5416GetTxCompletionRates(struct ath_hal *ah, const struct ath_desc *ds0, int *rates, int *tries)
1100{
1101 const struct ar5416_desc *ads = AR5416DESC_CONST(ds0);
1102
1103 rates[0] = MS(ads->ds_ctl3, AR_XmitRate0);
1104 rates[1] = MS(ads->ds_ctl3, AR_XmitRate1);
1105 rates[2] = MS(ads->ds_ctl3, AR_XmitRate2);
1106 rates[3] = MS(ads->ds_ctl3, AR_XmitRate3);
1107
1108 tries[0] = MS(ads->ds_ctl2, AR_XmitDataTries0);
1109 tries[1] = MS(ads->ds_ctl2, AR_XmitDataTries1);
1110 tries[2] = MS(ads->ds_ctl2, AR_XmitDataTries2);
1111 tries[3] = MS(ads->ds_ctl2, AR_XmitDataTries3);
1112
1113 return AH_TRUE;
1114}
1115
1116/*
1117 * TX queue management routines - AR5416 and later chipsets
1118 */
1119
1120/*
1121 * Allocate and initialize a tx DCU/QCU combination.
1122 */
1123int
1125 const HAL_TXQ_INFO *qInfo)
1126{
1127 struct ath_hal_5212 *ahp = AH5212(ah);
1129 HAL_CAPABILITIES *pCap = &AH_PRIVATE(ah)->ah_caps;
1130 int q, defqflags;
1131
1132 /* by default enable OK+ERR+DESC+URN interrupts */
1133 defqflags = HAL_TXQ_TXOKINT_ENABLE
1137 /* XXX move queue assignment to driver */
1138 switch (type) {
1140 q = pCap->halTotalQueues-1; /* highest priority */
1141 defqflags |= HAL_TXQ_DBA_GATED
1145 break;
1146 case HAL_TX_QUEUE_CAB:
1147 q = pCap->halTotalQueues-2; /* next highest priority */
1148 defqflags |= HAL_TXQ_DBA_GATED
1153 break;
1155 q = 1; /* lowest priority */
1156 defqflags |= HAL_TXQ_DBA_GATED
1161 break;
1162 case HAL_TX_QUEUE_UAPSD:
1163 q = pCap->halTotalQueues-3; /* nextest highest priority */
1164 if (ahp->ah_txq[q].tqi_type != HAL_TX_QUEUE_INACTIVE) {
1166 "%s: no available UAPSD tx queue\n", __func__);
1167 return -1;
1168 }
1169 break;
1170 case HAL_TX_QUEUE_DATA:
1171 for (q = 0; q < pCap->halTotalQueues; q++)
1172 if (ahp->ah_txq[q].tqi_type == HAL_TX_QUEUE_INACTIVE)
1173 break;
1174 if (q == pCap->halTotalQueues) {
1176 "%s: no available tx queue\n", __func__);
1177 return -1;
1178 }
1179 break;
1180 default:
1182 "%s: bad tx queue type %u\n", __func__, type);
1183 return -1;
1184 }
1185
1186 HALDEBUG(ah, HAL_DEBUG_TXQUEUE, "%s: queue %u\n", __func__, q);
1187
1188 qi = &ahp->ah_txq[q];
1189 if (qi->tqi_type != HAL_TX_QUEUE_INACTIVE) {
1190 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: tx queue %u already active\n",
1191 __func__, q);
1192 return -1;
1193 }
1194 OS_MEMZERO(qi, sizeof(HAL_TX_QUEUE_INFO));
1195 qi->tqi_type = type;
1196 if (qInfo == AH_NULL) {
1197 qi->tqi_qflags = defqflags;
1198 qi->tqi_aifs = INIT_AIFS;
1199 qi->tqi_cwmin = HAL_TXQ_USEDEFAULT; /* NB: do at reset */
1200 qi->tqi_cwmax = INIT_CWMAX;
1203 qi->tqi_physCompBuf = 0;
1204 } else {
1205 qi->tqi_physCompBuf = qInfo->tqi_compBuf;
1206 (void) ar5212SetTxQueueProps(ah, q, qInfo);
1207 }
1208 /* NB: must be followed by ar5212ResetTxQueue */
1209 return q;
1210}
1211
1212/*
1213 * Update the h/w interrupt registers to reflect a tx q's configuration.
1214 */
1215static void
1217{
1218 struct ath_hal_5212 *ahp = AH5212(ah);
1219
1221 "%s: tx ok 0x%x err 0x%x desc 0x%x eol 0x%x urn 0x%x\n", __func__,
1225
1229 );
1233 );
1236}
1237
1238/*
1239 * Set the retry, aifs, cwmin/max, readyTime regs for specified queue
1240 * Assumes:
1241 * phwChannel has been set to point to the current channel
1242 */
1243#define TU_TO_USEC(_tu) ((_tu) << 10)
1245ar5416ResetTxQueue(struct ath_hal *ah, u_int q)
1246{
1247 struct ath_hal_5212 *ahp = AH5212(ah);
1248 HAL_CAPABILITIES *pCap = &AH_PRIVATE(ah)->ah_caps;
1249 const struct ieee80211_channel *chan = AH_PRIVATE(ah)->ah_curchan;
1251 uint32_t cwMin, chanCwMin, qmisc, dmisc;
1252
1253 if (q >= pCap->halTotalQueues) {
1254 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: invalid queue num %u\n",
1255 __func__, q);
1256 return AH_FALSE;
1257 }
1258 qi = &ahp->ah_txq[q];
1259 if (qi->tqi_type == HAL_TX_QUEUE_INACTIVE) {
1260 HALDEBUG(ah, HAL_DEBUG_TXQUEUE, "%s: inactive queue %u\n",
1261 __func__, q);
1262 return AH_TRUE; /* XXX??? */
1263 }
1264
1265 HALDEBUG(ah, HAL_DEBUG_TXQUEUE, "%s: reset queue %u\n", __func__, q);
1266
1267 if (qi->tqi_cwmin == HAL_TXQ_USEDEFAULT) {
1268 /*
1269 * Select cwmin according to channel type.
1270 * NB: chan can be NULL during attach
1271 */
1272 if (chan && IEEE80211_IS_CHAN_B(chan))
1273 chanCwMin = INIT_CWMIN_11B;
1274 else
1275 chanCwMin = INIT_CWMIN;
1276 /* make sure that the CWmin is of the form (2^n - 1) */
1277 for (cwMin = 1; cwMin < chanCwMin; cwMin = (cwMin << 1) | 1)
1278 ;
1279 } else
1280 cwMin = qi->tqi_cwmin;
1281
1282 /* set cwMin/Max and AIFS values */
1284 SM(cwMin, AR_D_LCL_IFS_CWMIN)
1286 | SM(qi->tqi_aifs, AR_D_LCL_IFS_AIFS));
1287
1288 /* Set retry limit values */
1294 );
1295
1296 /* NB: always enable early termination on the QCU */
1299
1300 /* NB: always enable DCU to wait for next fragment from QCU */
1301 dmisc = AR_D_MISC_FRAG_WAIT_EN;
1302
1303 /* Enable exponential backoff window */
1305
1306 /*
1307 * The chip reset default is to use a DCU backoff threshold of 0x2.
1308 * Restore this when programming the DCU MISC register.
1309 */
1310 dmisc |= 0x2;
1311
1312 /* multiqueue support */
1313 if (qi->tqi_cbrPeriod) {
1314 OS_REG_WRITE(ah, AR_QCBRCFG(q),
1317 qmisc = (qmisc &~ AR_Q_MISC_FSP) | AR_Q_MISC_FSP_CBR;
1318 if (qi->tqi_cbrOverflowLimit)
1320 }
1321
1322 if (qi->tqi_readyTime && (qi->tqi_type != HAL_TX_QUEUE_CAB)) {
1326 }
1327
1330 | (qi->tqi_burstTime ? AR_D_CHNTIME_EN : 0));
1331
1332 if (qi->tqi_readyTime &&
1335 if (qi->tqi_qflags & HAL_TXQ_DBA_GATED)
1336 qmisc = (qmisc &~ AR_Q_MISC_FSP) | AR_Q_MISC_FSP_DBA_GATED;
1337 if (MS(qmisc, AR_Q_MISC_FSP) != AR_Q_MISC_FSP_ASAP) {
1338 /*
1339 * These are meangingful only when not scheduled asap.
1340 */
1342 qmisc |= AR_Q_MISC_CBR_INCR_DIS0;
1343 else
1344 qmisc &= ~AR_Q_MISC_CBR_INCR_DIS0;
1346 qmisc |= AR_Q_MISC_CBR_INCR_DIS1;
1347 else
1348 qmisc &= ~AR_Q_MISC_CBR_INCR_DIS1;
1349 }
1350
1354 dmisc |= AR_D_MISC_FRAG_BKOFF_EN;
1366
1367 /*
1368 * Fillin type-dependent bits. Most of this can be
1369 * removed by specifying the queue parameters in the
1370 * driver; it's here for backwards compatibility.
1371 */
1372 switch (qi->tqi_type) {
1373 case HAL_TX_QUEUE_BEACON: /* beacon frames */
1377
1382 break;
1383 case HAL_TX_QUEUE_CAB: /* CAB frames */
1384 /*
1385 * No longer Enable AR_Q_MISC_RDYTIME_EXP_POLICY,
1386 * There is an issue with the CAB Queue
1387 * not properly refreshing the Tx descriptor if
1388 * the TXE clear setting is used.
1389 */
1393 HALDEBUG(ah, HAL_DEBUG_TXQUEUE, "%s: CAB: tqi_readyTime = %d\n",
1394 __func__, qi->tqi_readyTime);
1395 if (qi->tqi_readyTime) {
1397 "%s: using tqi_readyTime\n", __func__);
1401 } else {
1402 int value;
1403 /*
1404 * NB: don't set default ready time if driver
1405 * has explicitly specified something. This is
1406 * here solely for backwards compatibility.
1407 */
1408 /*
1409 * XXX for now, hard-code a CAB interval of 70%
1410 * XXX of the total beacon interval.
1411 *
1412 * XXX This keeps Merlin and later based MACs
1413 * XXX quite a bit happier (stops stuck beacons,
1414 * XXX which I gather is because of such a long
1415 * XXX cabq time.)
1416 */
1417 value = (ahp->ah_beaconInterval * 50 / 100)
1421 /*
1422 * XXX Ensure it isn't too low - nothing lower
1423 * XXX than 10 TU
1424 */
1425 if (value < 10)
1426 value = 10;
1428 "%s: defaulting to rdytime = %d uS\n",
1429 __func__, value);
1433 }
1436 break;
1438 qmisc |= AR_Q_MISC_CBR_INCR_DIS1;
1439 break;
1440 case HAL_TX_QUEUE_UAPSD:
1442 break;
1443 default: /* NB: silence compiler */
1444 break;
1445 }
1446
1447 OS_REG_WRITE(ah, AR_QMISC(q), qmisc);
1448 OS_REG_WRITE(ah, AR_DMISC(q), dmisc);
1449
1450 /* Setup compression scratchpad buffer */
1451 /*
1452 * XXX: calling this asynchronously to queue operation can
1453 * cause unexpected behavior!!!
1454 */
1455 if (qi->tqi_physCompBuf) {
1458 OS_REG_WRITE(ah, AR_Q_CBBS, (80 + 2*q));
1461 OS_REG_WRITE(ah, AR_Q0_MISC + 4*q,
1462 OS_REG_READ(ah, AR_Q0_MISC + 4*q)
1464 }
1465
1466 /*
1467 * Always update the secondary interrupt mask registers - this
1468 * could be a new queue getting enabled in a running system or
1469 * hw getting re-initialized during a reset!
1470 *
1471 * Since we don't differentiate between tx interrupts corresponding
1472 * to individual queues - secondary tx mask regs are always unmasked;
1473 * tx interrupts are enabled/disabled for all queues collectively
1474 * using the primary mask reg
1475 */
1477 ahp->ah_txOkInterruptMask |= 1 << q;
1478 else
1479 ahp->ah_txOkInterruptMask &= ~(1 << q);
1481 ahp->ah_txErrInterruptMask |= 1 << q;
1482 else
1483 ahp->ah_txErrInterruptMask &= ~(1 << q);
1485 ahp->ah_txDescInterruptMask |= 1 << q;
1486 else
1487 ahp->ah_txDescInterruptMask &= ~(1 << q);
1489 ahp->ah_txEolInterruptMask |= 1 << q;
1490 else
1491 ahp->ah_txEolInterruptMask &= ~(1 << q);
1493 ahp->ah_txUrnInterruptMask |= 1 << q;
1494 else
1495 ahp->ah_txUrnInterruptMask &= ~(1 << q);
1496 setTxQInterrupts(ah, qi);
1497
1498 return AH_TRUE;
1499}
1500#undef TU_TO_USEC
HAL_STATUS
Definition: ah.h:71
@ HAL_OK
Definition: ah.h:72
@ HAL_EINPROGRESS
Definition: ah.h:87
HAL_PKT_TYPE
Definition: ah.h:398
@ HAL_PKT_TYPE_NORMAL
Definition: ah.h:399
@ HAL_PKT_TYPE_AMPDU
Definition: ah.h:406
#define HAL_COMP_BUF_MAX_SIZE
Definition: ah.h:387
HAL_CIPHER
Definition: ah.h:804
@ HAL_TXQ_TXDESCINT_ENABLE
Definition: ah.h:293
@ HAL_TXQ_IGNORE_VIRTCOL
Definition: ah.h:360
@ HAL_TXQ_ARB_LOCKOUT_GLOBAL
Definition: ah.h:358
@ HAL_TXQ_DBA_GATED
Definition: ah.h:314
@ HAL_TXQ_TXERRINT_ENABLE
Definition: ah.h:292
@ HAL_TXQ_RDYTIME_EXP_POLICY_ENABLE
Definition: ah.h:308
@ HAL_TXQ_TXURNINT_ENABLE
Definition: ah.h:295
@ HAL_TXQ_FRAG_BURST_BACKOFF_ENABLE
Definition: ah.h:340
@ HAL_TXQ_CBR_DIS_QEMPTY
Definition: ah.h:328
@ HAL_TXQ_CBR_DIS_BEMPTY
Definition: ah.h:329
@ HAL_TXQ_TXEOLINT_ENABLE
Definition: ah.h:294
@ HAL_TXQ_ARB_LOCKOUT_INTRA
Definition: ah.h:357
@ HAL_TXQ_SEQNUM_INC_DIS
Definition: ah.h:361
@ HAL_TXQ_BACKOFF_DISABLE
Definition: ah.h:344
@ HAL_TXQ_TXOKINT_ENABLE
Definition: ah.h:291
HAL_TX_QUEUE
Definition: ah.h:240
@ HAL_TX_QUEUE_DATA
Definition: ah.h:242
@ HAL_TX_QUEUE_INACTIVE
Definition: ah.h:241
@ HAL_TX_QUEUE_UAPSD
Definition: ah.h:245
@ HAL_TX_QUEUE_PSPOLL
Definition: ah.h:246
@ HAL_TX_QUEUE_BEACON
Definition: ah.h:243
@ HAL_TX_QUEUE_CAB
Definition: ah.h:244
#define HAL_TXQ_USEDEFAULT
Definition: ah.h:384
#define HAL_RATESERIES_2040
Definition: ah.h:721
HAL_BOOL
Definition: ah.h:93
@ AH_FALSE
Definition: ah.h:94
@ AH_TRUE
Definition: ah.h:95
@ HAL_DEBUG_TXQUEUE
Definition: ah_debug.h:38
@ HAL_DEBUG_ANY
Definition: ah_debug.h:62
#define HAL_TX_AGGR
Definition: ah_desc.h:71
#define HAL_TXERR_FILT
Definition: ah_desc.h:64
#define HAL_TXDESC_VEOL
Definition: ah_desc.h:265
#define HAL_TXDESC_DURENA
Definition: ah_desc.h:267
#define HAL_TX_BA
Definition: ah_desc.h:70
#define HAL_TXERR_TIMER_EXPIRED
Definition: ah_desc.h:67
#define HAL_TXDESC_INTREQ
Definition: ah_desc.h:264
#define HAL_TX_DESC_CFG_ERR
Definition: ah_desc.h:72
#define HAL_TXKEYIX_INVALID
Definition: ah_desc.h:215
#define HAL_TXDESC_CTSENA
Definition: ah_desc.h:263
#define HAL_TXDESC_NOACK
Definition: ah_desc.h:261
#define HAL_TX_DELIM_UNDERRUN
Definition: ah_desc.h:74
#define HAL_TXERR_XTXOP
Definition: ah_desc.h:66
#define HAL_TX_DATA_UNDERRUN
Definition: ah_desc.h:73
#define HAL_TXDESC_HWTS
Definition: ah_desc.h:273
#define HAL_TXDESC_CLRDMASK
Definition: ah_desc.h:260
#define HAL_TXERR_XRETRY
Definition: ah_desc.h:63
#define HAL_TXERR_FIFO
Definition: ah_desc.h:65
#define HAL_TXDESC_RTSENA
Definition: ah_desc.h:262
@ AR_EEP_PWR_TABLE_OFFSET
Definition: ah_eeprom.h:105
@ AR_EEP_OL_PWRCTRL
Definition: ah_eeprom.h:100
#define AR5416_PWR_TABLE_OFFSET_DB
Definition: ah_eeprom_v14.h:85
#define OS_REG_SET_BIT(_a, _r, _f)
Definition: ah_internal.h:594
#define SM(_v, _f)
Definition: ah_internal.h:587
#define MS(_v, _f)
Definition: ah_internal.h:588
#define INIT_CWMIN_11B
Definition: ah_internal.h:517
#define INIT_SH_RETRY
Definition: ah_internal.h:519
#define INIT_AIFS
Definition: ah_internal.h:515
#define ath_hal_eepromGet(_ah, _param, _val)
Definition: ah_internal.h:486
#define OS_REG_CLR_BIT(_a, _r, _f)
Definition: ah_internal.h:596
#define AH_PRIVATE(_ah)
Definition: ah_internal.h:442
#define INIT_LG_RETRY
Definition: ah_internal.h:520
#define INIT_SSH_RETRY
Definition: ah_internal.h:521
#define INIT_CWMIN
Definition: ah_internal.h:516
#define OS_REG_RMW_FIELD(_a, _r, _f, _v)
Definition: ah_internal.h:591
#define AH_NULL
Definition: ah_internal.h:28
#define HALASSERT(_x)
Definition: ah_internal.h:683
#define HALDEBUG(_ah, __m,...)
Definition: ah_internal.h:658
#define INIT_CWMAX
Definition: ah_internal.h:518
#define INIT_SLG_RETRY
Definition: ah_internal.h:522
#define ath_hal_eepromGetFlag(_ah, _param)
Definition: ah_internal.h:490
void ath_hal_printf(struct ath_hal *, const char *,...)
Definition: ah_osdep.c:80
#define OS_DELAY(_n)
Definition: ah_osdep.h:69
#define OS_MEMZERO(_a, _n)
Definition: ah_osdep.h:72
#define OS_REG_WRITE(_ah, _reg, _val)
Definition: ah_osdep.h:139
uint32_t HAL_DMA_ADDR
Definition: ah_osdep.h:57
#define OS_REG_READ(_ah, _reg)
Definition: ah_osdep.h:140
#define AR_ExcessiveRetries
Definition: ar5210desc.h:83
#define AR_FrameLen
Definition: ar5210desc.h:42
#define AR_SendTimestamp
Definition: ar5210desc.h:91
#define AR_BufLen
Definition: ar5210desc.h:70
#define AR_FIFOUnderrun
Definition: ar5210desc.h:84
#define AR_Filtered
Definition: ar5210desc.h:85
#define AR_SeqNum
Definition: ar5210desc.h:105
#define AR_TSF_L32
Definition: ar5210reg.h:96
#define AR_DIAG_SW
Definition: ar5210reg.h:95
#define AR_VEOL
Definition: ar5211desc.h:47
#define AR_NoAck
Definition: ar5211desc.h:67
#define AR_D_CHNTIME_DUR
Definition: ar5211reg.h:566
#define AR_D_MISC_ARB_LOCKOUT_CNTRL
Definition: ar5211reg.h:579
#define AR_D_LCL_IFS_CWMIN
Definition: ar5211reg.h:546
#define AR_D_MISC_BKOFF_PERSISTENCE
Definition: ar5211reg.h:572
#define AR_Q_CBRCFG_CBR_INTERVAL
Definition: ar5211reg.h:490
#define AR_D_MISC_ARB_LOCKOUT_CNTRL_INTRA_FR
Definition: ar5211reg.h:582
#define AR_Q_RDYTIMECFG_INT
Definition: ar5211reg.h:495
#define AR_Q_RDYTIMESHDN
Definition: ar5211reg.h:137
#define AR_Q_MISC_CBR_EXP_CNTR_LIMIT
Definition: ar5211reg.h:517
#define AR_D_MISC_FRAG_BKOFF_EN
Definition: ar5211reg.h:570
#define AR_D_MISC_SEQ_NUM_INCR_DIS
Definition: ar5211reg.h:585
#define AR_Q_MISC_FSP_CBR
Definition: ar5211reg.h:509
#define AR_Q_MISC_FSP_DBA_GATED
Definition: ar5211reg.h:510
#define AR_DCHNTIME(i)
Definition: ar5211reg.h:184
#define AR_D_MISC_BEACON_USE
Definition: ar5211reg.h:578
#define AR_IMR_S1_QCU_TXEOL
Definition: ar5211reg.h:454
#define AR_QCBRCFG(i)
Definition: ar5211reg.h:96
#define AR_QRDYTIMECFG(i)
Definition: ar5211reg.h:108
#define AR_D_RETRY_LIMIT_FR_LG
Definition: ar5211reg.h:556
#define AR_Q_MISC_CBR_INCR_DIS1
Definition: ar5211reg.h:514
#define AR_D_MISC_VIR_COL_HANDLING_IGNORE
Definition: ar5211reg.h:577
#define AR_Q_CBRCFG_CBR_OVF_THRESH
Definition: ar5211reg.h:492
#define AR_IMR_S2
Definition: ar5211reg.h:60
#define AR_DLCL_IFS(i)
Definition: ar5211reg.h:160
#define AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL
Definition: ar5211reg.h:583
#define AR_IMR_S1
Definition: ar5211reg.h:59
#define AR_IMR_S0_QCU_TXDESC
Definition: ar5211reg.h:449
#define AR_DMISC(i)
Definition: ar5211reg.h:196
#define AR_D_LCL_IFS_CWMAX
Definition: ar5211reg.h:548
#define AR_IMR_S0_QCU_TXOK
Definition: ar5211reg.h:447
#define AR_QSTS(i)
Definition: ar5211reg.h:135
#define AR_D_CHNTIME_EN
Definition: ar5211reg.h:564
#define AR_Q_MISC_RDYTIME_EXP_POLICY
Definition: ar5211reg.h:518
#define AR_IMR_S0
Definition: ar5211reg.h:58
#define AR_DRETRY_LIMIT(i)
Definition: ar5211reg.h:172
#define AR_D_RETRY_LIMIT_FR_SH
Definition: ar5211reg.h:554
#define AR_Q_MISC_FSP_ASAP
Definition: ar5211reg.h:508
#define AR_D_LCL_IFS_AIFS
Definition: ar5211reg.h:550
#define AR_D_RETRY_LIMIT_STA_SH
Definition: ar5211reg.h:558
#define AR_Q_MISC_CBR_INCR_DIS0
Definition: ar5211reg.h:515
#define AR_D_RETRY_LIMIT_STA_LG
Definition: ar5211reg.h:560
#define AR_Q_MISC_DCU_EARLY_TERM_REQ
Definition: ar5211reg.h:520
#define AR_Q0_MISC
Definition: ar5211reg.h:113
#define AR_D_MISC_POST_FR_BKOFF_DIS
Definition: ar5211reg.h:586
#define AR_IMR_S1_QCU_TXERR
Definition: ar5211reg.h:452
#define AR_Q_MISC_BEACON_USE
Definition: ar5211reg.h:516
#define AR_Q_TXE
Definition: ar5211reg.h:83
#define AR_QMISC(i)
Definition: ar5211reg.h:123
#define AR_IMR_S2_QCU_TXURN
Definition: ar5211reg.h:457
#define AR_Q_TXD
Definition: ar5211reg.h:84
HAL_BOOL ar5212SetTxQueueProps(struct ath_hal *ah, int q, const HAL_TXQ_INFO *qInfo)
Definition: ar5212_xmit.c:88
HAL_BOOL ar5212UpdateTxTrigLevel(struct ath_hal *, HAL_BOOL IncTrigLevel)
Definition: ar5212_xmit.c:48
uint32_t ar5212NumTxPending(struct ath_hal *ah, u_int q)
Definition: ar5212_xmit.c:566
#define AH5212(_ah)
Definition: ar5212.h:354
#define AR_XmitRate2_S
Definition: ar5212desc.h:108
#define AR_DataFailCnt
Definition: ar5212desc.h:128
#define AR_XmitRate3
Definition: ar5212desc.h:109
#define AR_XmitDataTries2
Definition: ar5212desc.h:97
#define AR_RTSFailCnt
Definition: ar5212desc.h:126
#define AR_XmitRate1
Definition: ar5212desc.h:105
#define AR_XmitDataTries1
Definition: ar5212desc.h:95
#define AR_XmitRate0_S
Definition: ar5212desc.h:104
#define AR_XmitRate3_S
Definition: ar5212desc.h:110
#define ds_ctl3
Definition: ar5212desc.h:53
#define AR_DestIdxValid
Definition: ar5212desc.h:70
#define AR_CTSEnable
Definition: ar5212desc.h:71
#define AR_XmitPower_S
Definition: ar5212desc.h:63
#define AR_RTSCTSRate_S
Definition: ar5212desc.h:112
#define AR_RTSCTSRate
Definition: ar5212desc.h:111
#define AR_DestIdx
Definition: ar5212desc.h:76
#define AR_XmitRate1_S
Definition: ar5212desc.h:106
#define ds_ctl2
Definition: ar5212desc.h:52
#define AR_XmitDataTries3
Definition: ar5212desc.h:99
#define AR_XmitRate2
Definition: ar5212desc.h:107
#define AR_XmitRate0
Definition: ar5212desc.h:103
#define AR_XmitDataTries0
Definition: ar5212desc.h:93
#define AR_Q_MISC_QCU_COMP_EN
Definition: ar5212reg.h:593
#define AR_Q_CBBA
Definition: ar5212reg.h:156
#define AR_QUIET2
Definition: ar5212reg.h:309
#define AR_Q_RDYTIMECFG_ENA
Definition: ar5212reg.h:575
#define AR_QUIET2_QUIET_DUR
Definition: ar5212reg.h:313
#define AR_D_MISC_VIR_COL_HANDLING
Definition: ar5212reg.h:654
#define AR_Q_CBC
Definition: ar5212reg.h:157
#define AR_Q_CBBS
Definition: ar5212reg.h:155
#define AR_DIAG_CHAN_IDLE
Definition: ar5212reg.h:919
#define AR_D_MISC_FRAG_WAIT_EN
Definition: ar5212reg.h:649
#define AR_Q_MISC_FSP
Definition: ar5212reg.h:578
#define AH5416(_ah)
Definition: ar5416.h:162
@ rate5_5s
Definition: ar5416.h:40
@ rate48mb
Definition: ar5416.h:38
@ rate12mb
Definition: ar5416.h:37
@ rate9mb
Definition: ar5416.h:37
@ rate18mb
Definition: ar5416.h:37
@ rate11l
Definition: ar5416.h:40
@ rateHt20_0
Definition: ar5416.h:41
@ rate6mb
Definition: ar5416.h:37
@ rate36mb
Definition: ar5416.h:38
@ rate5_5l
Definition: ar5416.h:39
@ rate1l
Definition: ar5416.h:39
@ rate54mb
Definition: ar5416.h:38
@ rate24mb
Definition: ar5416.h:38
@ rate2s
Definition: ar5416.h:39
@ rate11s
Definition: ar5416.h:40
@ rate2l
Definition: ar5416.h:39
@ rateHt40_0
Definition: ar5416.h:43
void ar5416Set11nBurstDuration(struct ath_hal *ah, struct ath_desc *ds, u_int burstDuration)
Definition: ar5416_xmit.c:1068
#define STOP_DMA_ITER
void ar5416Set11nVirtualMoreFrag(struct ath_hal *ah, struct ath_desc *ds, u_int vmf)
Definition: ar5416_xmit.c:1053
HAL_BOOL ar5416ChainTxDesc(struct ath_hal *ah, struct ath_desc *ds, HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList, u_int pktLen, u_int hdrLen, HAL_PKT_TYPE type, u_int keyIx, HAL_CIPHER cipher, uint8_t delims, HAL_BOOL firstSeg, HAL_BOOL lastSeg, HAL_BOOL lastAggr)
Definition: ar5416_xmit.c:525
HAL_BOOL ar5416SetupTxDesc(struct ath_hal *ah, struct ath_desc *ds, u_int pktLen, u_int hdrLen, HAL_PKT_TYPE type, u_int txPower, u_int txRate0, u_int txTries0, u_int keyIx, u_int antMode, u_int flags, u_int rtsctsRate, u_int rtsctsDuration, u_int compicvLen, u_int compivLen, u_int comp)
Definition: ar5416_xmit.c:323
HAL_BOOL ar5416SetGlobalTxTimeout(struct ath_hal *ah, u_int tu)
Definition: ar5416_xmit.c:832
static const u_int8_t baDurationDelta[]
Definition: ar5416_xmit.c:855
HAL_BOOL ar5416GetTxCompletionRates(struct ath_hal *ah, const struct ath_desc *ds0, int *rates, int *tries)
Definition: ar5416_xmit.c:1099
HAL_BOOL ar5416SetupXTxDesc(struct ath_hal *ah, struct ath_desc *ds, u_int txRate1, u_int txTries1, u_int txRate2, u_int txTries2, u_int txRate3, u_int txTries3)
Definition: ar5416_xmit.c:431
#define set11nPktDurRTSCTS(_series, _index)
Definition: ar5416_xmit.c:132
static void setTxQInterrupts(struct ath_hal *ah, HAL_TX_QUEUE_INFO *qi)
Definition: ar5416_xmit.c:1216
#define RTSCTS
#define isValidPktType(_t)
Definition: ar5416_xmit.c:151
static uint16_t ar5416GetTxRatePower(struct ath_hal *ah, uint8_t rate, uint8_t tx_chainmask, uint16_t txPower, HAL_BOOL is_ht40)
Definition: ar5416_xmit.c:226
HAL_BOOL ar5416ResetTxQueue(struct ath_hal *ah, u_int q)
Definition: ar5416_xmit.c:1245
void ar5416Set11nRateScenario(struct ath_hal *ah, struct ath_desc *ds, u_int durUpdateEn, u_int rtsctsRate, HAL_11N_RATE_SERIES series[], u_int nseries, u_int flags)
Definition: ar5416_xmit.c:875
#define HT_RC_2_MCS(_rc)
Definition: ar5416_xmit.c:854
void ar5416Clr11nAggr(struct ath_hal *ah, struct ath_desc *ds)
Definition: ar5416_xmit.c:1043
static int ar5416RateToRateTable(struct ath_hal *ah, uint8_t rate, HAL_BOOL is_ht40)
Definition: ar5416_xmit.c:161
#define set11nRateFlags(_series, _index)
Definition: ar5416_xmit.c:137
HAL_BOOL ar5416FillTxDesc(struct ath_hal *ah, struct ath_desc *ds, HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList, u_int descId, u_int qcuId, HAL_BOOL firstSeg, HAL_BOOL lastSeg, const struct ath_desc *ds0)
Definition: ar5416_xmit.c:461
#define isValidTxRate(_r)
Definition: ar5416_xmit.c:158
void ar5416Set11nAggrMiddle(struct ath_hal *ah, struct ath_desc *ds, u_int numDelims)
Definition: ar5416_xmit.c:1014
void ar5416Set11nAggrFirst(struct ath_hal *ah, struct ath_desc *ds, u_int aggrLen, u_int numDelims)
Definition: ar5416_xmit.c:979
HAL_STATUS ar5416ProcTxDesc(struct ath_hal *ah, struct ath_desc *ds, struct ath_tx_status *ts)
Definition: ar5416_xmit.c:719
HAL_BOOL ar5416StopTxDma(struct ath_hal *ah, u_int q)
Definition: ar5416_xmit.c:36
void ar5416Set11nAggrLast(struct ath_hal *ah, struct ath_desc *ds)
Definition: ar5416_xmit.c:1033
HAL_BOOL ar5416SetupLastTxDesc(struct ath_hal *ah, struct ath_desc *ds, const struct ath_desc *ds0)
Definition: ar5416_xmit.c:681
HAL_BOOL ar5416SetupFirstTxDesc(struct ath_hal *ah, struct ath_desc *ds, u_int aggrLen, u_int flags, u_int txPower, u_int txRate0, u_int txTries0, u_int antMode, u_int rtsctsRate, u_int rtsctsDuration)
Definition: ar5416_xmit.c:620
u_int ar5416GetGlobalTxTimeout(struct ath_hal *ah)
Definition: ar5416_xmit.c:849
int ar5416SetupTxQueue(struct ath_hal *ah, HAL_TX_QUEUE type, const HAL_TXQ_INFO *qInfo)
Definition: ar5416_xmit.c:1124
#define STOP_DMA_TIMEOUT
#define set11nTries(_series, _index)
Definition: ar5416_xmit.c:126
#define TU_TO_USEC(_tu)
Definition: ar5416_xmit.c:1243
#define set11nRate(_series, _index)
Definition: ar5416_xmit.c:129
#define AR_ChainSel3
Definition: ar5416desc.h:199
#define AR_AntCtl0
Definition: ar5416desc.h:209
#define AR_VirtMoreFrag
Definition: ar5416desc.h:107
#define AR_XmitPower3
Definition: ar5416desc.h:228
#define AR_ChainSel0
Definition: ar5416desc.h:187
#define AR_TxEVM2(_ptr)
Definition: ar5416desc.h:292
#define AR_FrameType_S
Definition: ar5416desc.h:125
#define AR_TxRSSIAnt02
Definition: ar5416desc.h:240
#define AR_TxIntrReq
Definition: ar5416desc.h:115
#define AR_TxRSSICombined
Definition: ar5416desc.h:282
#define AR_VirtRetryCnt
Definition: ar5416desc.h:255
#define AR_TxDone
Definition: ar5416desc.h:295
#define AR_IsAggr
Definition: ar5416desc.h:132
#define AR_TxDelimUnderrun
Definition: ar5416desc.h:257
#define AR_PadDelim
Definition: ar5416desc.h:178
#define AR_XmitPower1
Definition: ar5416desc.h:216
#define AR_TxMore
Definition: ar5416desc.h:121
#define AR_TxOpExceeded
Definition: ar5416desc.h:299
#define AR_BurstDur
Definition: ar5416desc.h:136
#define AR_TxRSSIAnt00
Definition: ar5416desc.h:236
#define AR_EncrType
Definition: ar5416desc.h:180
#define AR_BaBitmapHigh(_ptr)
Definition: ar5416desc.h:273
#define AR_TxBaStatus
Definition: ar5416desc.h:243
#define AR5416DESC(_ds)
Definition: ar5416desc.h:77
#define AR_FinalTxIdx
Definition: ar5416desc.h:301
#define AR_InsertTS
Definition: ar5416desc.h:127
#define AR_DescCfgErr
Definition: ar5416desc.h:261
#define AR_ChainSel2
Definition: ar5416desc.h:195
#define AR_ClrDestMask
Definition: ar5416desc.h:113
#define AR_TxDataUnderrun
Definition: ar5416desc.h:259
#define AR_TxRSSIAnt10
Definition: ar5416desc.h:276
#define AR_TxEVM0(_ptr)
Definition: ar5416desc.h:286
#define AR5416_DESC_TX_CTL_SZ
Definition: ar5416desc.h:39
#define AR_BaBitmapLow(_ptr)
Definition: ar5416desc.h:270
#define AR_MoreAggr
Definition: ar5416desc.h:131
#define ds_ctl6
Definition: ar5416desc.h:84
#define AR_AntCtl3
Definition: ar5416desc.h:226
#define AR_TxTimerExpired
Definition: ar5416desc.h:263
#define AR_RTSEnable
Definition: ar5416desc.h:111
#define AR_AntCtl2
Definition: ar5416desc.h:220
#define AR_TxTid
Definition: ar5416desc.h:305
#define AR_XmitPower2
Definition: ar5416desc.h:222
#define AR5416_DS_TXSTATUS(_ah, _ads)
Definition: ar5416desc.h:32
#define AR_TxEVM1(_ptr)
Definition: ar5416desc.h:289
#define AR_TxRSSIAnt12
Definition: ar5416desc.h:280
#define AR_DurUpdateEn
Definition: ar5416desc.h:138
#define AR_AntCtl1
Definition: ar5416desc.h:214
#define AR_AggrLen
Definition: ar5416desc.h:175
#define AR_TxRSSIAnt01
Definition: ar5416desc.h:238
#define AR_TxRSSIAnt11
Definition: ar5416desc.h:278
#define AR5416DESC_CONST(_ds)
Definition: ar5416desc.h:78
#define AR_ChainSel1
Definition: ar5416desc.h:191
#define AR_SREV_KIWI_10_OR_LATER(_ah)
Definition: ar5416reg.h:785
#define AR_SREV_KITE(_ah)
Definition: ar5416reg.h:754
#define AR_SREV_MERLIN_20_OR_LATER(_ah)
Definition: ar5416reg.h:747
#define AR_GTXTO
Definition: ar5416reg.h:32
#define AR_NEXT_QUIET
Definition: ar5416reg.h:164
#define AR_TIMER_MODE
Definition: ar5416reg.h:174
#define AR_SREV_MERLIN_10_OR_LATER(_ah)
Definition: ar5416reg.h:740
#define AR_TIMER_MODE_QUIET
Definition: ar5416reg.h:504
#define AR_GTXTO_TIMEOUT_LIMIT
Definition: ar5416reg.h:207
#define AR_QUIET_PERIOD
Definition: ar5416reg.h:172
#define MIN(a, b)
Definition: sample.h:120
uint16_t halTotalQueues
Definition: ah_internal.h:296
int ah_additional_swba_backoff
Definition: ah.h:1161
int ah_dma_beacon_response_time
Definition: ah.h:1159
int ah_sw_beacon_response_time
Definition: ah.h:1160
uint32_t tqi_compBuf
Definition: ah.h:378
HAL_TX_QUEUE tqi_type
Definition: ah_internal.h:526
uint32_t tqi_readyTime
Definition: ah_internal.h:538
uint32_t tqi_physCompBuf
Definition: ah_internal.h:539
uint16_t tqi_lgretry
Definition: ah_internal.h:534
uint16_t tqi_shretry
Definition: ah_internal.h:533
uint32_t tqi_burstTime
Definition: ah_internal.h:537
HAL_TX_QUEUE_FLAGS tqi_qflags
Definition: ah_internal.h:528
uint32_t tqi_cbrOverflowLimit
Definition: ah_internal.h:536
uint32_t tqi_cwmin
Definition: ah_internal.h:531
uint32_t tqi_cbrPeriod
Definition: ah_internal.h:535
uint32_t tqi_cwmax
Definition: ah_internal.h:532
uint32_t ds_ctl1
Definition: ar5416desc.h:71
union ar5416_desc::@27 u
struct ar5416_tx_desc tx
Definition: ar5416desc.h:73
uint32_t ds_ctl0
Definition: ar5416desc.h:70
uint32_t status[AR5416_NUM_TX_STATUS]
Definition: ar5416desc.h:52
uint32_t ds_ctl0
Definition: ah_desc.h:237
uint32_t ds_ctl1
Definition: ah_desc.h:238
uint32_t ds_data
Definition: ah_desc.h:236
uint32_t ds_hw[HAL_DESC_HW_SIZE]
Definition: ah_desc.h:239
uint32_t ah_txUrnInterruptMask
Definition: ar5212.h:272
uint32_t ah_txEolInterruptMask
Definition: ar5212.h:271
int16_t ah_txPowerIndexOffset
Definition: ar5212.h:301
uint32_t ah_txDescInterruptMask
Definition: ar5212.h:270
uint32_t ah_txOkInterruptMask
Definition: ar5212.h:268
uint32_t ah_txErrInterruptMask
Definition: ar5212.h:269
HAL_TX_QUEUE_INFO ah_txq[HAL_NUM_TX_QUEUES]
Definition: ar5212.h:273
uint32_t ah_tx_chainmask
Definition: ar5212.h:349
uint32_t ah_beaconInterval
Definition: ar5212.h:294
uint32_t ah_tx_chainmask
Definition: ar5416.h:122
u_int ah_globaltxtimeout
Definition: ar5416.h:109
uint8_t ah_keytype[AR5416_KEYTABLE_SIZE]
Definition: ar5416.h:112
Definition: ah.h:1219
HAL_OPS_CONFIG ah_config
Definition: ah.h:1243
uint8_t ts_flags
Definition: ah_desc.h:47
int8_t ts_rssi_ctl[3]
Definition: ah_desc.h:57
uint8_t ts_status
Definition: ah_desc.h:38
uint32_t ts_ba_high
Definition: ah_desc.h:53
int8_t ts_rssi
Definition: ah_desc.h:40
uint32_t ts_evm0
Definition: ah_desc.h:54
uint32_t ts_tstamp
Definition: ah_desc.h:37
uint8_t ts_finaltsi
Definition: ah_desc.h:45
uint32_t ts_ba_low
Definition: ah_desc.h:52
int8_t ts_rssi_ext[3]
Definition: ah_desc.h:58
uint8_t ts_longretry
Definition: ah_desc.h:42
uint8_t ts_antenna
Definition: ah_desc.h:44
uint16_t ts_seqnum
Definition: ah_desc.h:35
uint32_t ts_evm1
Definition: ah_desc.h:55
uint8_t ts_tid
Definition: ah_desc.h:50
uint8_t ts_virtcol
Definition: ah_desc.h:43
uint8_t ts_rate
Definition: ah_desc.h:39
uint8_t ts_shortretry
Definition: ah_desc.h:41
uint32_t ts_evm2
Definition: ah_desc.h:56