ath5k: A few updates + cleanups + kerneldoc
Nick Kossifidis
maintainerv2 cover ath5k: A few updates + cleanups + kerneldoc
This series of patches includes some stability fixes related to interrupt handling, an updated version of a calibration-related patch I posted some time ago but never submited here and a new module parameter to disable GPIO based rfkill switch (we had a few bug reports on that recently).
It also adds kernel doc on all ath5k_hw_* functions and structs (needs some more work but it should be fine, I reviewed the output, spell-ckecked it etc) and a few minor fixes and optimizations.
v2: Adress comments from Adrian, Felix, Jiri and Bob. Thanks a lot for the review !
Nick Kossifidis (12):
ath5k: Switch from read-and-clear to write-to-clear method when
handling PISR/SISR registers
ath5k: Add TXNOFRM to INT_TX_ALL
ath5k: Cleanups v1
ath5k: Calibration re-work
ath5k: Use usleep_range where possible
ath5k: Cleanups v2 + add kerneldoc on all hw functions
ath5k: We always do full calibration on AR5210
ath5k: Add a module parameter to disable hw rf kill switch
ath5k: MRR support and 2GHz radio override belong in ah_capabilities
ath5k: ath5k_ani_period_restart only touches struct ath5k_ani_state
ath5k: Renumber hw queue ids
ath5k: Optimize ath5k_cw_validate
drivers/net/wireless/ath/ath5k/ahb.c | 4 +- drivers/net/wireless/ath/ath5k/ani.c | 91 ++-- drivers/net/wireless/ath/ath5k/ani.h | 32 +- drivers/net/wireless/ath/ath5k/ath5k.h | 569 +++++++++++++------ drivers/net/wireless/ath/ath5k/attach.c | 16 +- drivers/net/wireless/ath/ath5k/base.c | 287 +++++++---- drivers/net/wireless/ath/ath5k/caps.c | 27 +- drivers/net/wireless/ath/ath5k/desc.c | 217 ++++++-- drivers/net/wireless/ath/ath5k/desc.h | 124 +++-- drivers/net/wireless/ath/ath5k/dma.c | 370 ++++++++----- drivers/net/wireless/ath/ath5k/gpio.c | 81 +++- drivers/net/wireless/ath/ath5k/initvals.c | 75 ++- drivers/net/wireless/ath/ath5k/pci.c | 2 +- drivers/net/wireless/ath/ath5k/pcu.c | 222 +++++--- drivers/net/wireless/ath/ath5k/phy.c | 853 +++++++++++++++++++++++------ drivers/net/wireless/ath/ath5k/qcu.c | 143 ++++-- drivers/net/wireless/ath/ath5k/reg.h | 27 +- drivers/net/wireless/ath/ath5k/reset.c | 230 ++++++-- drivers/net/wireless/ath/ath5k/rfbuffer.h | 59 ++- drivers/net/wireless/ath/ath5k/rfgain.h | 22 +- 20 files changed, 2465 insertions(+), 986 deletions(-)
Signature · 1 line
1.7.8.rc3
Nick Kossifidis
maintainerPATCH v2 1/12 ath5k: Switch from read-and-clear to write-to-clear method when handling PISR/SISR registers
Since card has 12 tx queues and we want to keep track of the interrupts per queue we can't fit all these interrupt bits on a single register. So we have 5 registers, the primary interrupt status register (PISR) and the 4 secondary interupt status registers (SISRs).
In order to be able to read them all at once (atomic operation) Atheros introduced the Read-And-Clear registers to make things easier. So when reading RAC_PISR register, hw does a read on PISR and all SISRs, returns the value of PISR, copies all SISR values to their shadow copies (RAC_SISRx) and clears PISR and SISRs. This saves us from reading PISR/SISRs in a sequence.
So far we 've used this approach and MadWiFi/Windows driver etc also used it for years.
It turns out this operation is not atomic after all (at least not on all cards) That means it's possible to loose some interrupts because they came after the copy step and hw cleared them on the clean step !
That's probably the reason we got missed beacons, got stuck queues etc and couldn't figure out what was going on.
With this patch we switch from RaC operation to an alternative method (that makes more sense IMHO anyway, I just chose to be on the safe side so far). Instead of reading RAC registers, we read the normal PISR/SISR registers and clear any bits we got by writing them back on the register. This will clear only the bits we got on our read step and leave any new bits unaffected (at least that's what docs say). So if any new interrupts come up we won't miss it.
I've tested this with an AR5213 and an AR2425 and it seems O.K.
Many thanks to Adrian Chadd for debuging this and reviewing the patch !
v2: Make sure we don't clear PISR bits that map to SISR generated interrupts (added a comment on the code for this)
--- drivers/net/wireless/ath/ath5k/ath5k.h | 8 +- drivers/net/wireless/ath/ath5k/base.c | 2 +- drivers/net/wireless/ath/ath5k/dma.c | 245 +++++++++++++++++++++----------- drivers/net/wireless/ath/ath5k/reg.h | 27 +++- 4 files changed, 189 insertions(+), 93 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +7 -1
@@ -1187,7 +1187,13 @@ struct ath5k_hw {u32 ah_txq_imr_cbrurn;u32 ah_txq_imr_qtrig;u32 ah_txq_imr_nofrm; -u32 ah_txq_isr; + +u32 ah_txq_isr_txok_all; +u32 ah_txq_isr_txurn; +u32 ah_txq_isr_qcborn; +u32 ah_txq_isr_qcburn; +u32 ah_txq_isr_qtrig; +u32 *ah_rf_banks;size_t ah_rf_banks_size;size_t ah_rf_regs_count;
drivers/net/wireless/ath/ath5k/base.c +1 -1
@@ -1689,7 +1689,7 @@ ath5k_tasklet_tx(unsigned long data)struct ath5k_hw *ah = (void *)data;for (i =0 ; i <AR5K_NUM_TX_QUEUES ; i++) -if (ah->txqs[i].setup && (ah->ah_txq_isr &BIT (i))) +if (ah->txqs[i].setup && (ah->ah_txq_isr_txok_all &BIT (i)))ath5k_tx_processq (ah, &ah->txqs[i]); ah->tx_pending = false;
drivers/net/wireless/ath/ath5k/dma.c +160 -85
292 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/reg.h +21 -6
@@ -280,6 +280,10 @@* 5211/5212 we have one primary and 4 secondary registers. * So we have AR5K_ISR for 5210 and AR5K_PISR /SISRx for 5211/5212. * Most of these bits are common for all chipsets. +* +* NOTE: On 5211+ TXOK, TXDESC, TXERR, TXEOL and TXURN contain +* the logical OR from per-queue interrupt bits found on SISR registers +* (see below). */ #define AR5K_ISR 0x001c/* Register Address [5210] */ #define AR5K_PISR 0x0080/* Register Address [5211+] */
@@ -292,7 +296,10 @@#define AR5K_ISR_TXOK 0x00000040/* Frame successfully transmitted */ #define AR5K_ISR_TXDESC 0x00000080/* TX descriptor request */ #define AR5K_ISR_TXERR 0x00000100/* Transmit error */ -#define AR5K_ISR_TXNOFRM 0x00000200/* No frame transmitted (transmit timeout) */ +#define AR5K_ISR_TXNOFRM 0x00000200/* No frame transmitted (transmit timeout) +* NOTE: We don't have per-queue info for this +* one, but we can enable it per-queue through +* TXNOFRM_QCU field on TXNOFRM register */ #define AR5K_ISR_TXEOL 0x00000400/* Empty TX descriptor */ #define AR5K_ISR_TXURN 0x00000800/* Transmit FIFO underrun */ #define AR5K_ISR_MIB 0x00001000/* Update MIB counters */
@@ -302,21 +309,29 @@#define AR5K_ISR_SWBA 0x00010000/* Software beacon alert */ #define AR5K_ISR_BRSSI 0x00020000/* Beacon rssi below threshold (?) */ #define AR5K_ISR_BMISS 0x00040000/* Beacon missed */ -#define AR5K_ISR_HIUERR 0x00080000/* Host Interface Unit error [5211+] */ +#define AR5K_ISR_HIUERR 0x00080000/* Host Interface Unit error [5211+] +* 'or' of MCABT, SSERR, DPERR from SISR2 */ #define AR5K_ISR_BNR 0x00100000/* Beacon not ready [5211+] */ #define AR5K_ISR_MCABT 0x00100000/* Master Cycle Abort [5210] */ #define AR5K_ISR_RXCHIRP 0x00200000/* CHIRP Received [5212+] */ #define AR5K_ISR_SSERR 0x00200000/* Signaled System Error [5210] */ -#define AR5K_ISR_DPERR 0x00400000/* Det par Error (?) [5210] */ +#define AR5K_ISR_DPERR 0x00400000/* Bus parity error [5210] */ #define AR5K_ISR_RXDOPPLER 0x00400000/* Doppler chirp received [5212+] */ #define AR5K_ISR_TIM 0x00800000/* [5211+] */ -#define AR5K_ISR_BCNMISC 0x00800000/* 'or' of TIM, CAB_END, DTIM_SYNC, BCN_TIMEOUT, -CAB_TIMEOUT and DTIM bits from SISR2 [5212+] */ +#define AR5K_ISR_BCNMISC 0x00800000/* Misc beacon related interrupt +* 'or' of TIM, CAB_END, DTIM_SYNC, BCN_TIMEOUT, +* CAB_TIMEOUT and DTIM bits from SISR2 [5212+] */ #define AR5K_ISR_GPIO 0x01000000/* GPIO (rf kill) */ #define AR5K_ISR_QCBRORN 0x02000000/* QCU CBR overrun [5211+] */ #define AR5K_ISR_QCBRURN 0x04000000/* QCU CBR underrun [5211+] */ #define AR5K_ISR_QTRIG 0x08000000/* QCU scheduling trigger [5211+] */ +#define AR5K_ISR_BITS_FROM_SISRS (AR5K_ISR_TXOK | AR5K_ISR_TXDESC |\ + AR5K_ISR_TXERR | AR5K_ISR_TXEOL |\ + AR5K_ISR_TXURN | AR5K_ISR_HIUERR |\ + AR5K_ISR_BCNMISC | AR5K_ISR_QCBRORN |\ + AR5K_ISR_QCBRURN | AR5K_ISR_QTRIG) +/* * Secondary status registers [5211+] (0 - 4) *
@@ -347,7 +362,7 @@#define AR5K_SISR2_BCN_TIMEOUT 0x08000000/* Beacon Timeout [5212+] */ #define AR5K_SISR2_CAB_TIMEOUT 0x10000000/* CAB Timeout [5212+] */ #define AR5K_SISR2_DTIM 0x20000000/* [5212+] */ -#define AR5K_SISR2_TSFOOR 0x80000000/* TSF OOR (?) */ +#define AR5K_SISR2_TSFOOR 0x80000000/* TSF Out of range */ #define AR5K_SISR3 0x0090/* Register Address [5211+] */ #define AR5K_SISR3_QCBRORN 0x000003ff/* Mask for QCBRORN */
Signature · 1 line
1.7.8.rc3
Nick Kossifidis
maintainerPATCH v2 2/12 ath5k: Add TXNOFRM to INT_TX_ALL
In reply to Nick KossifidisAdd TXNOFRM to INT_TX_ALL since it's a TX interrupt too.
--- drivers/net/wireless/ath/ath5k/ath5k.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +1 -0
@@ -856,6 +856,7 @@ enum ath5k_int {AR5K_INT_TX_ALL =AR5K_INT_TXOK |AR5K_INT_TXDESC |AR5K_INT_TXERR + |AR5K_INT_TXNOFRM |AR5K_INT_TXEOL | AR5K_INT_TXURN,
Signature · 1 line
1.7.8.rc3
Nick Kossifidis
maintainerPATCH v2 3/12 ath5k: Cleanups v1
In reply to Nick KossifidisNo functional changes, just a few comments/documentation/cleanup
--- drivers/net/wireless/ath/ath5k/base.c | 112 ++++++++++++++++++++++++--------- drivers/net/wireless/ath/ath5k/dma.c | 17 ++++- 2 files changed, 96 insertions(+), 33 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +83 -29
@@ -2149,69 +2149,110 @@ ath5k_intr(int irq, void *dev_id)enum ath5k_int status;unsigned int counter =1000 ; + +/* +* If hw is not ready (or detached) and we get an +* interrupt, or if we have no interrupts pending +* (that means it's not for us) skip it. +* +* NOTE: Group 0/1 PCI interface registers are not +* supported on WiSOCs, so we can't check for pending +* interrupts (ISR belongs to another register group +* so we are ok). +*/ if (unlikely (test_bit (ATH_STAT_INVALID , ah->status) || - ((ath5k_get_bus_type (ah) !=ATH_AHB ) && - !ath5k_hw_is_intr_pending (ah)))) + ((ath5k_get_bus_type (ah) !=ATH_AHB ) && + !ath5k_hw_is_intr_pending (ah))))return IRQ_NONE ; +/** Main loop **/ do { - ath5k_hw_get_isr(ah, &status); /* NB: clears IRQ too */ + ath5k_hw_get_isr(ah, &status); /* NB: clears IRQ too */ + ATH5K_DBG(ah, ATH5K_DEBUG_INTR, "status 0x%x/0x%x\n", status, ah->imask); + + /* + * Fatal hw error -> Log and reset + * + * Fatal errors are unrecoverable so we have to + * reset the card. These errors include bus and + * dma errors. + */ if (unlikely(status & AR5K_INT_FATAL)) { - /* - * Fatal errors are unrecoverable. - * Typically these are caused by DMA errors. - */ + ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "fatal int, resetting\n"); ieee80211_queue_work(ah->hw, &ah->reset_work); + + /* + * RX Overrun -> Count and reset if needed + * + * Receive buffers are full. Either the bus is busy or + * the CPU is not fast enough to process all received + * frames. + */ } else if (unlikely(status & AR5K_INT_RXORN)) { + /* - * Receive buffers are full. Either the bus is busy or - * the CPU is not fast enough to process all received - * frames. * Older chipsets need a reset to come out of this * condition, but we treat it as RX for newer chips. - * We don't know exactly which versions need a reset - + * We don't know exactly which versions need a reset * this guess is copied from the HAL. */ ah->stats.rxorn_intr++; + if (ah->ah_mac_srev < AR5K_SREV_AR5212) { ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "rx overrun, resetting\n"); ieee80211_queue_work(ah->hw, &ah->reset_work); } else ath5k_schedule_rx(ah); + } else { + + /* Software Beacon Alert -> Schedule beacon tasklet */ if (status & AR5K_INT_SWBA) tasklet_hi_schedule(&ah->beacontq); - if (status & AR5K_INT_RXEOL) { - /* - * NB: the hardware should re-read the link when - * RXE bit is written, but it doesn't work at - * least on older hardware revs. - */ + /* + * No more RX descriptors -> Just count + * + * NB: the hardware should re-read the link when + * RXE bit is written, but it doesn't work at + * least on older hardware revs. + */ + if (status & AR5K_INT_RXEOL) ah->stats.rxeol_intr++; - } - if (status & AR5K_INT_TXURN) { - /* bump tx trigger level */ + + + /* TX Underrun -> Bump tx trigger level */ + if (status & AR5K_INT_TXURN) ath5k_hw_update_tx_triglevel(ah, true); - } + + /* RX -> Schedule rx tasklet */ if (status & (AR5K_INT_RXOK | AR5K_INT_RXERR)) ath5k_schedule_rx(ah); - if (status & (AR5K_INT_TXOK | AR5K_INT_TXDESC - | AR5K_INT_TXERR | AR5K_INT_TXEOL)) + + /* TX -> Schedule tx tasklet */ + if (status & (AR5K_INT_TXOK + | AR5K_INT_TXDESC + | AR5K_INT_TXERR + | AR5K_INT_TXEOL)) ath5k_schedule_tx(ah); - if (status & AR5K_INT_BMISS) { - /* TODO */ - } + + /* Missed beacon -> TODO + if (status & AR5K_INT_BMISS) + */ + + /* MIB event -> Update counters and notify ANI */ if (status & AR5K_INT_MIB) { ah->stats.mib_intr++; ath5k_hw_update_mib_counters(ah); ath5k_ani_mib_intr(ah); } + + /* GPIO -> Notify RFKill layer */ if (status & AR5K_INT_GPIO) tasklet_schedule(&ah->rf_kill.toggleq);
@@ -2222,12 +2263,19 @@ ath5k_intr(int irq, void *dev_id) }while (ath5k_hw_is_intr_pending (ah) && --counter >0 ); +/* +* Until we handle rx/tx interrupts mask them on IMR +* +* NOTE: ah->(rx/tx)_pending are set when scheduling the tasklets +* and unset after we 've handled the interrupts. +*/ if (ah->rx_pending || ah->tx_pending)ath5k_set_current_imask (ah);if (unlikely (!counter))ATH5K_WARN (ah,"too many interrupts, giving up for now\n" ); +/* Fire up calibration poll */ ath5k_intr_calibration_poll (ah);return IRQ_HANDLED ;
@@ -2544,9 +2592,15 @@ int ath5k_start(struct ieee80211_hw *hw)* and then setup of the interrupt mask. */ ah->curchan = ah->hw->conf.channel; - ah->imask =AR5K_INT_RXOK |AR5K_INT_RXERR |AR5K_INT_RXEOL | -AR5K_INT_RXORN |AR5K_INT_TXDESC |AR5K_INT_TXEOL | -AR5K_INT_FATAL |AR5K_INT_GLOBAL |AR5K_INT_MIB ; + ah->imask =AR5K_INT_RXOK + |AR5K_INT_RXERR + |AR5K_INT_RXEOL + |AR5K_INT_RXORN + |AR5K_INT_TXDESC + |AR5K_INT_TXEOL + |AR5K_INT_FATAL + |AR5K_INT_GLOBAL + |AR5K_INT_MIB ; ret =ath5k_reset (ah,NULL , false);if (ret)
drivers/net/wireless/ath/ath5k/dma.c +13 -4
@@ -701,21 +701,25 @@ int ath5k_hw_get_isr(struct ath5k_hw *ah, enum ath5k_int *interrupt_mask)if (unlikely (pisr & (AR5K_ISR_BNR ))) *interrupt_mask |=AR5K_INT_BNR ; +/* Doppler chirp received */ if (unlikely (pisr & (AR5K_ISR_RXDOPPLER ))) *interrupt_mask |=AR5K_INT_RX_DOPPLER ; +/* A queue got CBR overrun */ if (unlikely (pisr & (AR5K_ISR_QCBRORN ))) { *interrupt_mask |=AR5K_INT_QCBRORN ; ah->ah_txq_isr_qcborn |=AR5K_REG_MS (sisr3,AR5K_SISR3_QCBRORN ); } +/* A queue got CBR underrun */ if (unlikely (pisr & (AR5K_ISR_QCBRURN ))) { *interrupt_mask |=AR5K_INT_QCBRURN ; ah->ah_txq_isr_qcburn |=AR5K_REG_MS (sisr3,AR5K_SISR3_QCBRURN ); } +/* A queue got triggered */ if (unlikely (pisr & (AR5K_ISR_QTRIG ))) { *interrupt_mask |=AR5K_INT_QTRIG ; ah->ah_txq_isr_qtrig |= AR5K_REG_MS(sisr4,
@@ -772,16 +776,14 @@ enum ath5k_int ath5k_hw_set_imr(struct ath5k_hw *ah, enum ath5k_int new_mask)u32 simr2 =ath5k_hw_reg_read (ah,AR5K_SIMR2 ) &AR5K_SIMR2_QCU_TXURN ; +/* Fatal interrupt abstraction for 5211+ */ if (new_mask &AR5K_INT_FATAL ) { int_mask |=AR5K_IMR_HIUERR ; simr2 |= (AR5K_SIMR2_MCABT |AR5K_SIMR2_SSERR |AR5K_SIMR2_DPERR ); } -/*Beacon Not Ready*/ -if (new_mask &AR5K_INT_BNR ) - int_mask |=AR5K_INT_BNR ; - +/* Misc beacon related interrupts */ if (new_mask &AR5K_INT_TIM ) int_mask |=AR5K_IMR_TIM ;
@@ -796,6 +798,11 @@ enum ath5k_int ath5k_hw_set_imr(struct ath5k_hw *ah, enum ath5k_int new_mask)if (new_mask &AR5K_INT_CAB_TIMEOUT ) simr2 |=AR5K_SISR2_CAB_TIMEOUT ; +/*Beacon Not Ready*/ +if (new_mask &AR5K_INT_BNR ) + int_mask |=AR5K_INT_BNR ; + +/* RX doppler chirp */ if (new_mask &AR5K_INT_RX_DOPPLER ) int_mask |=AR5K_IMR_RXDOPPLER ;
@@ -805,10 +812,12 @@ enum ath5k_int ath5k_hw_set_imr(struct ath5k_hw *ah, enum ath5k_int new_mask)ath5k_hw_reg_write (ah, simr2,AR5K_SIMR2 ); }else { +/* Fatal interrupt abstraction for 5210 */ if (new_mask &AR5K_INT_FATAL ) int_mask |= (AR5K_IMR_SSERR |AR5K_IMR_MCABT |AR5K_IMR_HIUERR |AR5K_IMR_DPERR ); +/* Only common interrupts left for 5210 (no SIMRs) */ ath5k_hw_reg_write (ah, int_mask,AR5K_IMR ); }
Signature · 1 line
1.7.8.rc3
Nick Kossifidis
maintainerPATCH v2 4/12 ath5k: Calibration re-work
In reply to Nick KossifidisNoise floor calibration does not interfere with traffic and should run more often as part of our "short calibration". The full calibration is not the noise floor calibration but the AGC + Gain_F (on RF5111 and RF5112) calibration and should run less often because it does interfere with traffic.
So
Short calibration -> I/Q & NF Calibration
Long calibration -> Short + AGC + Gain_F
This patch was for some time on my pub/ dir on www.kernel.org and has been tested by a few people and me. I think it's O.K. to go in.
I also changed ah_calibration to ah_iq_cal_needed to make more sense.
v2 Use a workqueue instead of a tasklet for calibration
--- drivers/net/wireless/ath/ath5k/ath5k.h | 15 ++-- drivers/net/wireless/ath/ath5k/base.c | 112 ++++++++++++++++++++++---------- drivers/net/wireless/ath/ath5k/phy.c | 82 ++++++++++++++++++------ 3 files changed, 147 insertions(+), 62 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +7 -8
@@ -187,10 +187,9 @@#define AR5K_TUNE_MAX_TXPOWER 63#define AR5K_TUNE_DEFAULT_TXPOWER 25#define AR5K_TUNE_TPC_TXPOWER false -#define ATH5K_TUNE_CALIBRATION_INTERVAL_FULL 10000/* 10 sec */ +#define ATH5K_TUNE_CALIBRATION_INTERVAL_FULL 60000/* 60 sec */ +#define ATH5K_TUNE_CALIBRATION_INTERVAL_SHORT 10000/* 10 sec */ #define ATH5K_TUNE_CALIBRATION_INTERVAL_ANI 1000/* 1 sec */ -#define ATH5K_TUNE_CALIBRATION_INTERVAL_NF 60000/* 60 sec */ -#define ATH5K_TX_COMPLETE_POLL_INT 3000/* 3 sec */ #define AR5K_INIT_CARR_SENSE_EN 1
@@ -896,7 +895,8 @@ enum ath5k_int {enum ath5k_calibration_mask {AR5K_CALIBRATION_FULL =0x01 ,AR5K_CALIBRATION_SHORT =0x02 , -AR5K_CALIBRATION_ANI =0x04 , +AR5K_CALIBRATION_NF =0x04 , +AR5K_CALIBRATION_ANI =0x08 , };/*
@@ -1098,6 +1098,7 @@ struct ath5k_hw { led_on;/* pin setting for LED on */ struct work_struct reset_work;/* deferred chip reset */ +struct work_struct calib_work;/* deferred phy calibration */ struct list_head rxbuf;/* receive buffer */ spinlock_t rxbuflock;
@@ -1114,8 +1115,6 @@ struct ath5k_hw {struct ath5k_rfkill rf_kill; -struct tasklet_struct calib;/* calibration tasklet */ -spinlock_t block;/* protects beacon */ struct tasklet_struct beacontq;/* beacon intr tasklet */ struct list_head bcbuf;/* beacon buffer */
@@ -1145,7 +1144,7 @@ struct ath5k_hw {enum ath5k_int ah_imr;struct ieee80211_channel *ah_current_channel; -bool ah_calibration; +bool ah_iq_cal_needed;bool ah_single_chip;enum ath5k_version ah_version;
@@ -1235,8 +1234,8 @@ struct ath5k_hw {/* Calibration timestamp */ unsigned long ah_cal_next_full; +unsigned long ah_cal_next_short;unsigned long ah_cal_next_ani; -unsigned long ah_cal_next_nf;/* Calibration mask */ u8 ah_cal_mask;
drivers/net/wireless/ath/ath5k/base.c +78 -34
162 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/phy.c +62 -20
142 lines not on this page · raw message
Signature · 1 line
1.7.8.rc3
Nick Kossifidis
maintainerPATCH v2 5/12 ath5k: Use usleep_range where possible
In reply to Nick KossifidisUse usleep_range where possible to reduce busy waits
--- drivers/net/wireless/ath/ath5k/attach.c | 2 +- drivers/net/wireless/ath/ath5k/pci.c | 2 +- drivers/net/wireless/ath/ath5k/phy.c | 22 +++++++++++----------- drivers/net/wireless/ath/ath5k/reset.c | 14 +++++++------- 4 files changed, 20 insertions(+), 20 deletions(-)
drivers/net/wireless/ath/ath5k/attach.c +1 -1
@@ -298,7 +298,7 @@ int ath5k_hw_init(struct ath5k_hw *ah)/* Reset SERDES to load new settings */ ath5k_hw_reg_write (ah,0x00000000 ,AR5K_PCIE_SERDES_RESET ); -mdelay (1 ); +usleep_range (1000 ,1500 ); }/* Get misc capabilities */
drivers/net/wireless/ath/ath5k/pci.c +1 -1
@@ -97,7 +97,7 @@ ath5k_pci_eeprom_read(struct ath_common *common, u32 offset, u16 *data) 0xffff);return true; } -udelay (15 ); +usleep_range (15 ,20 ); }return false;
drivers/net/wireless/ath/ath5k/phy.c +11 -11
@@ -58,7 +58,7 @@ u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, enum ieee80211_band band)return 0 ; } -mdelay (2 ); +usleep_range (2000 ,2500 );/* ...wait until PHY is ready and read the selected radio revision */ ath5k_hw_reg_write (ah,0x00001c16 ,AR5K_PHY (0x34 ));
@@ -308,9 +308,9 @@ static void ath5k_hw_wait_for_synth(struct ath5k_hw *ah, delay = delay <<2 ;/* XXX: /2 on turbo ? Let's be safe * for now */ -udelay (100 + delay); +usleep_range (100 + delay,100 + (2 * delay)); }else { -mdelay (1 ); +usleep_range (1000 ,1500 ); } }
@@ -1083,7 +1083,7 @@ static int ath5k_hw_rf5110_channel(struct ath5k_hw *ah, data =ath5k_hw_rf5110_chan2athchan (channel);ath5k_hw_reg_write (ah, data,AR5K_RF_BUFFER );ath5k_hw_reg_write (ah,0 ,AR5K_RF_BUFFER_CONTROL_0 ); -mdelay (1 ); +usleep_range (1000 ,1500 );return 0 ; }
@@ -1454,7 +1454,7 @@ static int ath5k_hw_rf5110_calibrate(struct ath5k_hw *ah, beacon =ath5k_hw_reg_read (ah,AR5K_BEACON_5210 );ath5k_hw_reg_write (ah, beacon & ~AR5K_BEACON_ENABLE ,AR5K_BEACON_5210 ); -mdelay (2 ); +usleep_range (2000 ,2500 );/* * Set the channel (with AGC turned off)
@@ -1467,7 +1467,7 @@ static int ath5k_hw_rf5110_calibrate(struct ath5k_hw *ah,* Activate PHY and wait */ ath5k_hw_reg_write (ah,AR5K_PHY_ACT_ENABLE ,AR5K_PHY_ACT ); -mdelay (1 ); +usleep_range (1000 ,1500 );AR5K_REG_DISABLE_BITS (ah,AR5K_PHY_AGC ,AR5K_PHY_AGC_DISABLE );
@@ -1504,7 +1504,7 @@ static int ath5k_hw_rf5110_calibrate(struct ath5k_hw *ah,ath5k_hw_reg_write (ah,AR5K_PHY_RFSTG_DISABLE ,AR5K_PHY_RFSTG );AR5K_REG_DISABLE_BITS (ah,AR5K_PHY_AGC ,AR5K_PHY_AGC_DISABLE ); -mdelay (1 ); +usleep_range (1000 ,1500 );/* * Enable calibration and wait until completion
@@ -3397,7 +3397,7 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,if (ret)return ret; -mdelay (1 ); +usleep_range (1000 ,1500 );/* * Write RF buffer
@@ -3418,10 +3418,10 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, } }else if (ah->ah_version ==AR5K_AR5210 ) { -mdelay (1 ); +usleep_range (1000 ,1500 );/* Disable phy and wait */ ath5k_hw_reg_write (ah,AR5K_PHY_ACT_DISABLE ,AR5K_PHY_ACT ); -mdelay (1 ); +usleep_range (1000 ,1500 ); }/* Set channel on PHY */
@@ -3447,7 +3447,7 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,for (i =0 ; i <=20 ; i++) {if (!(ath5k_hw_reg_read (ah,AR5K_PHY_ADC_TEST ) &0x10 ))break ; -udelay (200 ); +usleep_range (200 ,250 ); }ath5k_hw_reg_write (ah, phy_tst1,AR5K_PHY_TST1 );
drivers/net/wireless/ath/ath5k/reset.c +7 -7
@@ -357,7 +357,7 @@ static int ath5k_hw_nic_reset(struct ath5k_hw *ah, u32 val)ath5k_hw_reg_write (ah, val,AR5K_RESET_CTL );/* Wait at least 128 PCI clocks */ -udelay (15 ); +usleep_range (15 ,20 );if (ah->ah_version ==AR5K_AR5210 ) { val &=AR5K_RESET_CTL_PCU |AR5K_RESET_CTL_DMA
@@ -422,7 +422,7 @@ static int ath5k_hw_wisoc_reset(struct ath5k_hw *ah, u32 flags) regval =__raw_readl (reg);__raw_writel (regval | val, reg); regval =__raw_readl (reg); -udelay (100 ); +usleep_range (100 ,150 );/* Bring BB/MAC out of reset */ __raw_writel (regval & ~val, reg);
@@ -493,7 +493,7 @@ static int ath5k_hw_set_power(struct ath5k_hw *ah, enum ath5k_power_mode mode,ath5k_hw_reg_write (ah, data |AR5K_SLEEP_CTL_SLE_WAKE ,AR5K_SLEEP_CTL ); -udelay (15 ); +usleep_range (15 ,20 );for (i =200 ; i >0 ; i--) {/* Check if the chip did wake up */
@@ -502,7 +502,7 @@ static int ath5k_hw_set_power(struct ath5k_hw *ah, enum ath5k_power_mode mode,break ;/* Wait a bit and retry */ -udelay (50 ); +usleep_range (50 ,75 );ath5k_hw_reg_write (ah, data |AR5K_SLEEP_CTL_SLE_WAKE ,AR5K_SLEEP_CTL ); }
@@ -563,7 +563,7 @@ int ath5k_hw_on_hold(struct ath5k_hw *ah) ret =ath5k_hw_nic_reset (ah,AR5K_RESET_CTL_PCU |AR5K_RESET_CTL_MAC |AR5K_RESET_CTL_DMA |AR5K_RESET_CTL_PHY |AR5K_RESET_CTL_PCI ); -mdelay (2 ); +usleep_range (2000 ,2500 ); }else { ret =ath5k_hw_nic_reset (ah,AR5K_RESET_CTL_PCU |AR5K_RESET_CTL_BASEBAND | bus_flags);
@@ -621,7 +621,7 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, struct ieee80211_channel *channel) ret =ath5k_hw_nic_reset (ah,AR5K_RESET_CTL_PCU |AR5K_RESET_CTL_MAC |AR5K_RESET_CTL_DMA |AR5K_RESET_CTL_PHY |AR5K_RESET_CTL_PCI ); -mdelay (2 ); +usleep_range (2000 ,2500 ); }else {if (ath5k_get_bus_type (ah) ==ATH_AHB ) ret = ath5k_hw_wisoc_reset(ah, AR5K_RESET_CTL_PCU |
@@ -739,7 +739,7 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, struct ieee80211_channel *channel)/* ...update PLL if needed */ if (ath5k_hw_reg_read (ah,AR5K_PHY_PLL ) != clock) {ath5k_hw_reg_write (ah, clock,AR5K_PHY_PLL ); -udelay (300 ); +usleep_range (300 ,350 ); }/* ...set the PHY operating mode */
Signature · 1 line
1.7.8.rc3
Nick Kossifidis
maintainerPATCH v2 6/12 ath5k: Cleanups v2 + add kerneldoc on all hw functions
In reply to Nick KossifidisNo functional changes
Add kernel doc for all ath5k_hw_* functions and strcucts. Also do some cleanup, rename ath5k_hw_init_beacon to ath5k_hw_init_beacon_timers, remove an unused variable from ath5k_hw_pcu_init and a few obsolete macros, mostly related to XR.
--- drivers/net/wireless/ath/ath5k/ani.c | 86 +++-- drivers/net/wireless/ath/ath5k/ani.h | 32 +- drivers/net/wireless/ath/ath5k/ath5k.h | 531 ++++++++++++++------- drivers/net/wireless/ath/ath5k/attach.c | 9 +- drivers/net/wireless/ath/ath5k/base.c | 3 +- drivers/net/wireless/ath/ath5k/desc.c | 217 +++++++-- drivers/net/wireless/ath/ath5k/desc.h | 124 ++++-- drivers/net/wireless/ath/ath5k/dma.c | 120 ++--- drivers/net/wireless/ath/ath5k/gpio.c | 81 +++- drivers/net/wireless/ath/ath5k/initvals.c | 75 ++- drivers/net/wireless/ath/ath5k/pcu.c | 222 ++++++--- drivers/net/wireless/ath/ath5k/phy.c | 748 +++++++++++++++++++++++------ drivers/net/wireless/ath/ath5k/qcu.c | 124 ++++-- drivers/net/wireless/ath/ath5k/reset.c | 216 +++++++-- drivers/net/wireless/ath/ath5k/rfbuffer.h | 59 ++- drivers/net/wireless/ath/ath5k/rfgain.h | 22 +- 16 files changed, 1944 insertions(+), 725 deletions(-)
drivers/net/wireless/ath/ath5k/ani.c +56 -30
@@ -27,15 +27,21 @@* or reducing sensitivity as necessary. * * The parameters are: +* * - "noise immunity" +* * - "spur immunity" +* * - "firstep level" +* * - "OFDM weak signal detection" +* * - "CCK weak signal detection" * * Basically we look at the amount of ODFM and CCK timing errors we get and then * raise or lower immunity accordingly by setting one or more of these * parameters. +* * Newer chipsets have PHY error counters in hardware which will generate a MIB * interrupt when they overflow. Older hardware has too enable PHY error frames * by setting a RX flag and then count every single PHY error. When a specified
@@ -45,11 +51,13 @@*/ -/*** ANI parameter control ***/ +/***********************\ +* ANI parameter control * +\***********************/ /** * ath5k_ani_set_noise_immunity_level() - Set noise immunity level -* +* @ah: The &struct ath5k_hw * @level: level between 0 and @ATH5K_ANI_MAX_NOISE_IMM_LVL */ void
@@ -91,12 +99,11 @@ ath5k_ani_set_noise_immunity_level(struct ath5k_hw *ah, int level)ATH5K_DBG_UNLIMIT (ah,ATH5K_DEBUG_ANI ,"new level %d" , level); } -/** * ath5k_ani_set_spur_immunity_level() - Set spur immunity level -* +* @ah: The &struct ath5k_hw * @level: level between 0 and @max_spur_level (the maximum level is dependent -* on the chip revision). +* on the chip revision). */ void ath5k_ani_set_spur_immunity_level (struct ath5k_hw *ah,int level)
@@ -117,10 +124,9 @@ ath5k_ani_set_spur_immunity_level(struct ath5k_hw *ah, int level)ATH5K_DBG_UNLIMIT (ah,ATH5K_DEBUG_ANI ,"new level %d" , level); } -/** * ath5k_ani_set_firstep_level() - Set "firstep" level -* +* @ah: The &struct ath5k_hw * @level: level between 0 and @ATH5K_ANI_MAX_FIRSTEP_LVL */ void
@@ -140,11 +146,9 @@ ath5k_ani_set_firstep_level(struct ath5k_hw *ah, int level)ATH5K_DBG_UNLIMIT (ah,ATH5K_DEBUG_ANI ,"new level %d" , level); } -/** -* ath5k_ani_set_ofdm_weak_signal_detection() - Control OFDM weak signal -* detection -* +* ath5k_ani_set_ofdm_weak_signal_detection() - Set OFDM weak signal detection +* @ah: The &struct ath5k_hw * @on: turn on or off */ void
@@ -182,10 +186,9 @@ ath5k_ani_set_ofdm_weak_signal_detection(struct ath5k_hw *ah, bool on) on ? "on" : "off"); } -/** -* ath5k_ani_set_cck_weak_signal_detection() - control CCK weak signal detection -* +* ath5k_ani_set_cck_weak_signal_detection() - Set CCK weak signal detection +* @ah: The &struct ath5k_hw * @on: turn on or off */ void
@@ -200,13 +203,16 @@ ath5k_ani_set_cck_weak_signal_detection(struct ath5k_hw *ah, bool on) } -/*** ANI algorithm ***/ +/***************\ +* ANI algorithm * +\***************/ /** * ath5k_ani_raise_immunity() - Increase noise immunity -* +* @ah: The &struct ath5k_hw +* @as: The &struct ath5k_ani_state * @ofdm_trigger: If this is true we are called because of too many OFDM errors, -* the algorithm will tune more parameters then. +* the algorithm will tune more parameters then. * * Try to raise noise immunity (=decrease sensitivity) in several steps * depending on the average RSSI of the beacons we received.
@@ -290,9 +296,10 @@ ath5k_ani_raise_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as,*/ } -/** * ath5k_ani_lower_immunity() - Decrease noise immunity +* @ah: The &struct ath5k_hw +* @as: The &struct ath5k_ani_state * * Try to lower noise immunity (=increase sensitivity) in several steps * depending on the average RSSI of the beacons we received.
@@ -352,9 +359,10 @@ ath5k_ani_lower_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as) } } -/** * ath5k_hw_ani_get_listen_time() - Update counters and return listening time +* @ah: The &struct ath5k_hw +* @as: The &struct ath5k_ani_state * * Return an approximation of the time spent "listening" in milliseconds (ms) * since the last call of this function.
@@ -379,9 +387,10 @@ ath5k_hw_ani_get_listen_time(struct ath5k_hw *ah, struct ath5k_ani_state *as)return listen; } -/** * ath5k_ani_save_and_clear_phy_errors() - Clear and save PHY error counters +* @ah: The &struct ath5k_hw +* @as: The &struct ath5k_ani_state * * Clear the PHY error counters as soon as possible, since this might be called * from a MIB interrupt and we want to make sure we don't get interrupted again.
@@ -429,9 +438,10 @@ ath5k_ani_save_and_clear_phy_errors(struct ath5k_hw *ah,return 1 ; } -/** * ath5k_ani_period_restart() - Restart ANI period +* @ah: The &struct ath5k_hw +* @as: The &struct ath5k_ani_state * * Just reset counters, so they are clear for the next "ani period". */
@@ -448,9 +458,9 @@ ath5k_ani_period_restart(struct ath5k_hw *ah, struct ath5k_ani_state *as) as->listen_time =0 ; } -/** * ath5k_ani_calibration() - The main ANI calibration function +* @ah: The &struct ath5k_hw * * We count OFDM and CCK errors relative to the time where we did not send or * receive ("listen" time) and raise or lower immunity accordingly.
@@ -509,10 +519,13 @@ ath5k_ani_calibration(struct ath5k_hw *ah) } -/*** INTERRUPT HANDLER ***/ +/*******************\ +* Interrupt handler * +\*******************/ /** * ath5k_ani_mib_intr() - Interrupt handler for ANI MIB counters +* @ah: The &struct ath5k_hw * * Just read & reset the registers quickly, so they don't generate more * interrupts, save the counters and schedule the tasklet to decide whether
@@ -549,9 +562,11 @@ ath5k_ani_mib_intr(struct ath5k_hw *ah)tasklet_schedule (&ah->ani_tasklet); } -/** -* ath5k_ani_phy_error_report() - Used by older HW to report PHY errors +* ath5k_ani_phy_error_report - Used by older HW to report PHY errors +* +* @ah: The &struct ath5k_hw +* @phyerr: One of enum ath5k_phy_error_code * * This is used by hardware without PHY error counters to report PHY errors * on a frame-by-frame basis, instead of the interrupt.
@@ -574,10 +589,13 @@ ath5k_ani_phy_error_report(struct ath5k_hw *ah, } -/*** INIT ***/ +/****************\ +* Initialization * +\****************/ /** * ath5k_enable_phy_err_counters() - Enable PHY error counters +* @ah: The &struct ath5k_hw * * Enable PHY error counters for OFDM and CCK timing errors. */
@@ -596,9 +614,9 @@ ath5k_enable_phy_err_counters(struct ath5k_hw *ah)ath5k_hw_reg_write (ah,0 ,AR5K_CCK_FIL_CNT ); } -/** * ath5k_disable_phy_err_counters() - Disable PHY error counters +* @ah: The &struct ath5k_hw * * Disable PHY error counters for OFDM and CCK timing errors. */
@@ -615,10 +633,10 @@ ath5k_disable_phy_err_counters(struct ath5k_hw *ah)ath5k_hw_reg_write (ah,0 ,AR5K_CCK_FIL_CNT ); } -/** * ath5k_ani_init() - Initialize ANI -* @mode: Which mode to use (auto, manual high, manual low, off) +* @ah: The &struct ath5k_hw +* @mode: One of enum ath5k_ani_mode * * Initialize ANI according to mode. */
@@ -695,10 +713,18 @@ ath5k_ani_init(struct ath5k_hw *ah, enum ath5k_ani_mode mode) } -/*** DEBUG ***/ +/**************\ +* Debug output * +\**************/ #ifdef CONFIG_ATH5K_DEBUG +/** +* ath5k_ani_print_counters() - Print ANI counters +* @ah: The &struct ath5k_hw +* +* Used for debugging ANI +*/ void ath5k_ani_print_counters (struct ath5k_hw *ah) {
drivers/net/wireless/ath/ath5k/ani.h +23 -9
@@ -40,13 +40,13 @@ enum ath5k_phy_error_code;* enum ath5k_ani_mode - mode for ANI / noise sensitivity * * @ATH5K_ANI_MODE_OFF: Turn ANI off. This can be useful to just stop the ANI -* algorithm after it has been on auto mode. -* ATH5K_ANI_MODE_MANUAL_LOW: Manually set all immunity parameters to low, -* maximizing sensitivity. ANI will not run. -* ATH5K_ANI_MODE_MANUAL_HIGH: Manually set all immunity parameters to high, -* minimizing sensitivity. ANI will not run. -* ATH5K_ANI_MODE_AUTO: Automatically control immunity parameters based on the -* amount of OFDM and CCK frame errors (default). +* algorithm after it has been on auto mode. +* @ATH5K_ANI_MODE_MANUAL_LOW: Manually set all immunity parameters to low, +* maximizing sensitivity. ANI will not run. +* @ATH5K_ANI_MODE_MANUAL_HIGH: Manually set all immunity parameters to high, +* minimizing sensitivity. ANI will not run. +* @ATH5K_ANI_MODE_AUTO: Automatically control immunity parameters based on the +* amount of OFDM and CCK frame errors (default). */ enum ath5k_ani_mode {ATH5K_ANI_MODE_OFF =0 ,
@@ -58,8 +58,22 @@ enum ath5k_ani_mode {/** * struct ath5k_ani_state - ANI state and associated counters -* -* @max_spur_level: the maximum spur level is chip dependent +* @ani_mode: One of enum ath5k_ani_mode +* @noise_imm_level: Noise immunity level +* @spur_level: Spur immunity level +* @firstep_level: FIRstep level +* @ofdm_weak_sig: OFDM weak signal detection state (on/off) +* @cck_weak_sig: CCK weak signal detection state (on/off) +* @max_spur_level: Max spur immunity level (chip specific) +* @listen_time: Listen time +* @ofdm_errors: OFDM timing error count +* @cck_errors: CCK timing error count +* @last_cc: The &struct ath_cycle_counters (for stats) +* @last_listen: Listen time from previous run (for stats) +* @last_ofdm_errors: OFDM timing error count from previous run (for tats) +* @last_cck_errors: CCK timing error count from previous run (for stats) +* @sum_ofdm_errors: Sum of OFDM timing errors (for stats) +* @sum_cck_errors: Sum of all CCK timing errors (for stats) */ struct ath5k_ani_state {enum ath5k_ani_mode ani_mode;
drivers/net/wireless/ath/ath5k/ath5k.h +366 -165
767 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/attach.c +3 -6
@@ -27,8 +27,7 @@#include "debug.h" /** -* ath5k_hw_post - Power On Self Test helper function -* +* ath5k_hw_post() - Power On Self Test helper function * @ah: The &struct ath5k_hw */ static int ath5k_hw_post (struct ath5k_hw *ah)
@@ -92,8 +91,7 @@ static int ath5k_hw_post(struct ath5k_hw *ah) }/** -* ath5k_hw_init - Check if hw is supported and init the needed structs -* +* ath5k_hw_init() - Check if hw is supported and init the needed structs * @ah: The &struct ath5k_hw associated with the device * * Check if the device is supported, perform a POST and initialize the needed
@@ -349,8 +347,7 @@ err: }/** -* ath5k_hw_deinit - Free the ath5k_hw struct -* +* ath5k_hw_deinit() - Free the &struct ath5k_hw * @ah: The &struct ath5k_hw */ void ath5k_hw_deinit (struct ath5k_hw *ah)
drivers/net/wireless/ath/ath5k/base.c +1 -2
@@ -183,7 +183,6 @@ static const struct ieee80211_rate ath5k_rates[] = { { .bitrate = 540, .hw_value = ATH5K_RATE_CODE_54M, .flags = 0 }, -/* XR missing */ };static inline u64 ath5k_extend_tsf (struct ath5k_hw *ah,u32 rstamp)
@@ -2005,7 +2004,7 @@ ath5k_beacon_update_timers(struct ath5k_hw *ah, u64 bc_tsf) ah->nexttbtt = nexttbtt; intval |=AR5K_BEACON_ENA ; -ath5k_hw_init_beacon (ah, nexttbtt, intval); +ath5k_hw_init_beacon_timers (ah, nexttbtt, intval);/* * debugging output last in order to preserve the time critical aspect
drivers/net/wireless/ath/ath5k/desc.c +170 -47
286 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/desc.h +83 -41
200 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/dma.c +54 -66
314 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/gpio.c +63 -18
123 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/initvals.c +54 -21
161 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/pcu.c +147 -75
463 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/phy.c +606 -142
359 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/qcu.c +92 -32
124 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/reset.c +164 -52
216 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/rfbuffer.h +42 -17
59 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/rfgain.h +20 -2
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.8.rc3
Part of the diff is not shown here. View the raw message.
Nick Kossifidis
maintainerPATCH v2 7/12 ath5k: We always do full calibration on AR5210
In reply to Nick KossifidisThere is no short calibration on AR5210, make sure we treat it always as full calibration.
--- drivers/net/wireless/ath/ath5k/phy.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath5k/phy.c +3 -0
@@ -1674,6 +1674,9 @@ ath5k_hw_rf5110_calibrate(struct ath5k_hw *ah,u32 phy_sig, phy_agc, phy_sat, beacon;int ret; +if (!(ah->ah_cal_mask &AR5K_CALIBRATION_FULL )) +return 0 ; +/* * Disable beacons and RX/TX queues, wait */
Signature · 1 line
1.7.8.rc3
Nick Kossifidis
maintainerPATCH v2 8/12 ath5k: Add a module parameter to disable hw rf kill switch
In reply to Nick KossifidisAdd a module parameter to disable hw rf kill switch (GPIO interrupt) because in some cases when the card doesn't come with the laptop, EEPROM configuration doesn't match laptop's configuration and rf kill interrupt always fires up and disables hw. I thought of moving this to debugfs and make it per-card but this way it's easier for users and distros to handle.
--- drivers/net/wireless/ath/ath5k/base.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +9 -2
@@ -80,6 +80,11 @@ static int modparam_fastchanswitch;module_param_named (fastchanswitch, modparam_fastchanswitch, bool,S_IRUGO );MODULE_PARM_DESC (fastchanswitch,"Enable fast channel switching for AR2413/AR5413 radios." ); +static int ath5k_modparam_no_hw_rfkill_switch; +module_param_named (no_hw_rfkill_switch, ath5k_modparam_no_hw_rfkill_switch, + bool,S_IRUGO ); +MODULE_PARM_DESC (no_hw_rfkill_switch,"Ignore the GPIO RFKill switch state" ); +/* Module info */ MODULE_AUTHOR ("Jiri Slaby" );
@@ -2635,7 +2640,8 @@ int ath5k_start(struct ieee80211_hw *hw)if (ret) goto done; -ath5k_rfkill_hw_start (ah); +if (!ath5k_modparam_no_hw_rfkill_switch) +ath5k_rfkill_hw_start (ah);/* * Reset the key cache since some parts do not reset the
@@ -2719,7 +2725,8 @@ void ath5k_stop(struct ieee80211_hw *hw)cancel_delayed_work_sync (&ah->tx_complete_work); -ath5k_rfkill_hw_stop (ah); +if (!ath5k_modparam_no_hw_rfkill_switch) +ath5k_rfkill_hw_stop (ah); }/*
Signature · 1 line
1.7.8.rc3
Nick Kossifidis
maintainerPATCH v2 9/12 ath5k: MRR support and 2GHz radio override belong in ah_capabilities
In reply to Nick KossifidisMRR support and 2GHz radio override belong in ah_capabilities and we should use them (e.g. so far we used to set mrr descriptor without checking if MRR support is enabled + we checked for MRR support 2 times, one by trying to set up an MRR descriptor and another one based on MAC version).
--- drivers/net/wireless/ath/ath5k/ahb.c | 4 ++- drivers/net/wireless/ath/ath5k/ath5k.h | 12 ++++---- drivers/net/wireless/ath/ath5k/attach.c | 5 --- drivers/net/wireless/ath/ath5k/base.c | 47 ++++++++++++------------------- drivers/net/wireless/ath/ath5k/caps.c | 27 +++++++++++++---- 5 files changed, 47 insertions(+), 48 deletions(-)
drivers/net/wireless/ath/ath5k/ahb.c +3 -1
@@ -166,7 +166,9 @@ static int ath_ahb_probe(struct platform_device *pdev)if (to_platform_device (ah->dev)->id ==0 && (bcfg->config->flags & (BD_WLAN0 |BD_WLAN1 )) == (BD_WLAN1 |BD_WLAN0 )) -__set_bit (ATH_STAT_2G_DISABLED , ah->status); + ah->ah_capabilities.cap_needs_2GHz_ovr = true; +else + ah->ah_capabilities.cap_needs_2GHz_ovr = false; } ret =ath5k_init_ah (ah, &ath_ahb_bus_ops);
drivers/net/wireless/ath/ath5k/ath5k.h +6 -6
@@ -1159,6 +1159,8 @@ struct ath5k_capabilities { } cap_queues;bool cap_has_phyerr_counters; +bool cap_has_mrr_support; +bool cap_needs_2GHz_ovr; };/* size of noise floor history (keep it a power of two) */
@@ -1274,13 +1276,11 @@ struct ath5k_hw {dma_addr_t desc_daddr;/* DMA (physical) address */ size_t desc_len;/* size of TX/RX descriptors */ -DECLARE_BITMAP (status,6 ); +DECLARE_BITMAP (status,4 );#define ATH_STAT_INVALID 0/* disable hardware accesses */ -#define ATH_STAT_MRRETRY 1/* multi-rate retry support */ -#define ATH_STAT_PROMISC 2 -#define ATH_STAT_LEDSOFT 3/* enable LED gpio status */ -#define ATH_STAT_STARTED 4/* opened & irqs enabled */ -#define ATH_STAT_2G_DISABLED 5/* multiband radio without 2G */ +#define ATH_STAT_PROMISC 1 +#define ATH_STAT_LEDSOFT 2/* enable LED gpio status */ +#define ATH_STAT_STARTED 3/* opened & irqs enabled */ unsigned int filter_flags;/* HW flags, AR5K_RX_FILTER_* */ struct ieee80211_channel *curchan;/* current h/w channel */
drivers/net/wireless/ath/ath5k/attach.c +0 -5
@@ -306,11 +306,6 @@ int ath5k_hw_init(struct ath5k_hw *ah) goto err; } -if (test_bit (ATH_STAT_2G_DISABLED , ah->status)) { -__clear_bit (AR5K_MODE_11B , ah->ah_capabilities.cap_mode); -__clear_bit (AR5K_MODE_11G , ah->ah_capabilities.cap_mode); - } -/* Crypto settings */ common->keymax = (ah->ah_version ==AR5K_AR5210 ?AR5K_KEYTABLE_SIZE_5210 :AR5K_KEYTABLE_SIZE_5211 );
drivers/net/wireless/ath/ath5k/base.c +18 -29
67 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/caps.c +20 -7
@@ -85,12 +85,19 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah) caps->cap_range.range_2ghz_min =2412 ; caps->cap_range.range_2ghz_max =2732 ; -if (AR5K_EEPROM_HDR_11B (ee_header)) -__set_bit (AR5K_MODE_11B , caps->cap_mode); - -if (AR5K_EEPROM_HDR_11G (ee_header) && - ah->ah_version !=AR5K_AR5211 ) -__set_bit (AR5K_MODE_11G , caps->cap_mode); +/* Override 2GHz modes on SoCs that need it +* NOTE: cap_needs_2GHz_ovr gets set from +* ath_ahb_probe */ +if (!caps->cap_needs_2GHz_ovr) { +if (AR5K_EEPROM_HDR_11B (ee_header)) +__set_bit (AR5K_MODE_11B , + caps->cap_mode); + +if (AR5K_EEPROM_HDR_11G (ee_header) && + ah->ah_version !=AR5K_AR5211 ) +__set_bit (AR5K_MODE_11G , + caps->cap_mode); + } } }
@@ -103,12 +110,18 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah)else caps->cap_queues.q_tx_num =AR5K_NUM_TX_QUEUES ; -/* newer hardware has PHY error counters */ +/* Newer hardware has PHY error counters */ if (ah->ah_mac_srev >=AR5K_SREV_AR5213A ) caps->cap_has_phyerr_counters = true;else caps->cap_has_phyerr_counters = false; +/* MACs since AR5212 have MRR support */ +if (ah->ah_version ==AR5K_AR5212 ) + caps->cap_has_mrr_support = true; +else + caps->cap_has_mrr_support = false; +return 0 ; }
Signature · 1 line
1.7.8.rc3
Nick Kossifidis
maintainerPATCH v2 10/12 ath5k: ath5k_ani_period_restart only touches struct ath5k_ani_state
In reply to Nick KossifidisNo need to take ath5k_hw as an argument.
--- drivers/net/wireless/ath/ath5k/ani.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath5k/ani.c +3 -4
@@ -440,13 +440,12 @@ ath5k_ani_save_and_clear_phy_errors(struct ath5k_hw *ah,/** * ath5k_ani_period_restart() - Restart ANI period -* @ah: The &struct ath5k_hw * @as: The &struct ath5k_ani_state * * Just reset counters, so they are clear for the next "ani period". */ static void -ath5k_ani_period_restart (struct ath5k_hw *ah,struct ath5k_ani_state *as) +ath5k_ani_period_restart (struct ath5k_ani_state *as) {/* keep last values for debugging */ as->last_ofdm_errors = as->ofdm_errors;
@@ -502,7 +501,7 @@ ath5k_ani_calibration(struct ath5k_hw *ah)/* too many PHY errors - we have to raise immunity */ bool ofdm_flag = as->ofdm_errors > ofdm_high ? true : false;ath5k_ani_raise_immunity (ah, as, ofdm_flag); -ath5k_ani_period_restart (ah, as); +ath5k_ani_period_restart (as); }else if (as->listen_time >5 *ATH5K_ANI_LISTEN_PERIOD ) {/* If more than 5 (TODO: why 5?) periods have passed and we got
@@ -514,7 +513,7 @@ ath5k_ani_calibration(struct ath5k_hw *ah)if (as->ofdm_errors <= ofdm_low && as->cck_errors <= cck_low)ath5k_ani_lower_immunity (ah, as); -ath5k_ani_period_restart (ah, as); +ath5k_ani_period_restart (as); } }
Signature · 1 line
1.7.8.rc3
Nick Kossifidis
maintainerPATCH v2 11/12 ath5k: Renumber hw queue ids
In reply to Nick KossifidisAccording to documentation higher DCUs have higher priority and should be used for beacons and CAB traffic. More specifically DCU 9 should be used for beacons and DCU 8 for CAB traffic, I assumed DCU 7 should be OK for UAPSD traffic.
Note that DCU 8 and 9 are special because they can only be mapped to a single QCU each but since we use a 1:1 mapping between QCUs and DCUs anyway we don't have to change much.
P.S. I also did a few related cleanups on qcu.c and ath5k.h
--- drivers/net/wireless/ath/ath5k/ath5k.h | 10 ++++------ drivers/net/wireless/ath/ath5k/qcu.c | 14 +++++++------- 2 files changed, 11 insertions(+), 13 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +4 -6
@@ -571,20 +571,18 @@ enum ath5k_tx_queue_subtype {* @AR5K_TX_QUEUE_ID_CAB: Content after beacon queue * @AR5K_TX_QUEUE_ID_BEACON: Beacon queue * @AR5K_TX_QUEUE_ID_UAPSD: Urgent Automatic Power Save Delivery, -* @AR5K_TX_QUEUE_ID_XR_DATA: XR Data queue * * Each number represents a hw queue. If hw does not support hw queues -* (eg 5210) all data goes in one queue. These match -* mac80211 definitions. +* (eg 5210) all data goes in one queue. */ enum ath5k_tx_queue_id {AR5K_TX_QUEUE_ID_NOQCU_DATA =0 ,AR5K_TX_QUEUE_ID_NOQCU_BEACON =1 ,AR5K_TX_QUEUE_ID_DATA_MIN =0 ,AR5K_TX_QUEUE_ID_DATA_MAX =3 , -AR5K_TX_QUEUE_ID_CAB =6 , -AR5K_TX_QUEUE_ID_BEACON =7 , -AR5K_TX_QUEUE_ID_UAPSD =8 , +AR5K_TX_QUEUE_ID_UAPSD =7 , +AR5K_TX_QUEUE_ID_CAB =8 , +AR5K_TX_QUEUE_ID_BEACON =9 , };/*
drivers/net/wireless/ath/ath5k/qcu.c +7 -7
@@ -54,7 +54,7 @@ Queue Control Unit, DCF Control Unit Functions/** * ath5k_hw_num_tx_pending() - Get number of pending frames for a given queue * @ah: The &struct ath5k_hw -* @queue: The hw queue number +* @queue: One of enum ath5k_tx_queue_id */ u32 ath5k_hw_num_tx_pending (struct ath5k_hw *ah,unsigned int queue)
@@ -85,7 +85,7 @@ ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue)/** * ath5k_hw_release_tx_queue() - Set a transmit queue inactive * @ah: The &struct ath5k_hw -* @queue: The hw queue number +* @queue: One of enum ath5k_tx_queue_id */ void ath5k_hw_release_tx_queue (struct ath5k_hw *ah,unsigned int queue)
@@ -120,7 +120,7 @@ ath5k_cw_validate(u16 cw_req)/** * ath5k_hw_get_tx_queueprops() - Get properties for a transmit queue * @ah: The &struct ath5k_hw -* @queue: The hw queue number +* @queue: One of enum ath5k_tx_queue_id * @queue_info: The &struct ath5k_txq_info to fill */ int
@@ -134,7 +134,7 @@ ath5k_hw_get_tx_queueprops(struct ath5k_hw *ah, int queue,/** * ath5k_hw_set_tx_queueprops() - Set properties for a transmit queue * @ah: The &struct ath5k_hw -* @queue: The hw queue number +* @queue: One of enum ath5k_tx_queue_id * @qinfo: The &struct ath5k_txq_info to use * * Returns 0 on success or -EIO if queue is inactive
@@ -267,7 +267,7 @@ ath5k_hw_setup_tx_queue(struct ath5k_hw *ah, enum ath5k_tx_queue queue_type,/** * ath5k_hw_set_tx_retry_limits() - Set tx retry limits on DCU * @ah: The &struct ath5k_hw -* @queue: The hw queue number +* @queue: One of enum ath5k_tx_queue_id * * This function is used when initializing a queue, to set * retry limits based on ah->ah_retry_* and the chipset used.
@@ -310,9 +310,9 @@ ath5k_hw_set_tx_retry_limits(struct ath5k_hw *ah,/** * ath5k_hw_reset_tx_queue() - Initialize a single hw queue * @ah: The &struct ath5k_hw -* @queue: The hw queue number +* @queue: One of enum ath5k_tx_queue_id * -* Set DFS properties for the given transmit queue on DCU +* Set DCF properties for the given transmit queue on DCU * and configures all queue-specific parameters. */ int
Signature · 1 line
1.7.8.rc3
Nick Kossifidis
maintainerPATCH v2 12/12 ath5k: Optimize ath5k_cw_validate
In reply to Nick KossifidisOptimize ath5k_cw_validate by using the classic (X & (X - 1)) == 0 check to see if a number is power of 2.
v2: Use functions from log2.h instead
--- drivers/net/wireless/ath/ath5k/qcu.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath5k/qcu.c +13 -4
@@ -23,6 +23,7 @@ Queue Control Unit, DCF Control Unit Functions#include "ath5k.h" #include "reg.h" #include "debug.h" +#include <linux/log2.h> /** * DOC: Queue Control Unit (QCU)/DCF Control Unit (DCU) functions
@@ -108,13 +109,21 @@ ath5k_hw_release_tx_queue(struct ath5k_hw *ah, unsigned int queue)static u16 ath5k_cw_validate (u16 cw_req) { -u32 cw =1 ; cw_req =min (cw_req, (u16 )1023 ); -while (cw < cw_req) - cw = (cw <<1 ) |1 ; +/* Check if cw_req + 1 a power of 2 */ +if (is_power_of_2 (cw_req +1 )) +return cw_req; -return cw; +/* Check if cw_req is a power of 2 */ +if (is_power_of_2 (cw_req)) +return cw_req -1 ; + +/* If none of the above is correct +* find the closest power of 2 */ + cw_req = (u16 )roundup_pow_of_two (cw_req) -1 ; + +return cw_req; }/**
Signature · 1 line
1.7.8.rc3
Re: [PATCH v2 01/12] ath5k: Switch from read-and-clear to write-to-clear method when handling PISR/SISR registers
In reply to Nick KossifidisHi,
Review #2:
One thing that I discovered whilst debugging some silly races in FreeBSD was that the update of the txq active mask wasn't done atomically.
Ie, when you check this:
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1689,7 +1689,7 @@ ath5k_tasklet_tx(unsigned long data)
struct ath5k_hw *ah = (void *)data;
for (i = 0; i < AR5K_NUM_TX_QUEUES; i++)
- if (ah->txqs[i].setup && (ah->ah_txq_isr & BIT(i)))
+ if (ah->txqs[i].setup && (ah->ah_txq_isr_txok_all & BIT(i)))
ath5k_tx_processq(ah, &ah->txqs[i]);The way that the original code did it was:
* update the HAL TX mask bits inside the HAL getisr routine, so it would just update the HAL idea of txqactive;
* Then, ath_hal_gettxintrtxqs() would pass back to the driver the set of txq bits currently active, and reset those that are active (with a mask, so you can read only a few)
* the ath_intr() routine would simply schedule a tasklet call when a TX interrupt came in;
* .. and then the TX completion tasklet would call ath_hal_gettxintrtxqs() for each task bit to see if it needed servicing.
Now, in previous generations of hardware/kernel, this may not have raced - ath_intr() may have been a "fast" interrupt handler and thus would occur atomically on a single CPU - so you don't have any races. But these days, ath_intr() is just a software interrupt and can occur in parallel with another CPU executing the completion handler.
So since there was no locking around the TXQ bit updates and clear, it was very possible that a very busy TX device would "miss" TX queue notifications, as the CPU running the TX completion would read-and-clear the TXQ active bits in the HAL, whilst another CPU was running ath_intr() which was trying to do a read/modify/write of those same bits.
I _think_ felix fixed this in ath9k by hiding this stuff behind the PCU lock. I've also fixed it in FreeBSD. I think it's worth re-evaluating what is going on in ath5k and maybe add some similar locking.
Oh wait. Where are you clearing these bits? It doesn't look like you're even clearing the ah_txq_isr bits in the most recent ath5k tree I have here. This means you're likely not missing events; but you're likely always scanning those queues. Making this code a bit pointless. :)
Anyway, I'd tidy this all up in a subsequent patchset. Get the interrupt changes in, then figure out how to properly lock the interrupt TXQ bit set path (the isr) and the clear path (once you've tested whether the TXQ needed servicing and then cleared the bit.)
HTH,
adrian
Quoted 49 lines · Nick Kossifidis
This series of patches includes some stability fixes related to interrupt handling, an updated version of a calibration-related patch I posted some time ago but never submited here and a new module parameter to disable GPIO based rfkill switch (we had a few bug reports on that recently).
It also adds kernel doc on all ath5k_hw_* functions and structs (needs some more work but it should be fine, I reviewed the output, spell-ckecked it etc) and a few minor fixes and optimizations.
v2: Adress comments from Adrian, Felix, Jiri and Bob. Thanks a lot for the review !
Nick Kossifidis (12):
ath5k: Switch from read-and-clear to write-to-clear method when handling PISR/SISR registers
ath5k: Add TXNOFRM toINT_TX_ALL
ath5k: Cleanups v1
ath5k: Calibration re-work
ath5k: Useusleep_rangewhere possible
ath5k: Cleanups v2 + add kerneldoc on all hw functions
ath5k: We always do full calibration on AR5210
ath5k: Add a module parameter to disable hw rf kill switch
ath5k: MRR support and 2GHz radio override belong inah_capabilities
ath5k:ath5k_ani_period_restartonly touches structath5k_ani_state
ath5k: Renumber hw queue ids
ath5k: Optimizeath5k_cw_validatedrivers/net/wireless/ath/ath5k/ahb.c | 4 +- drivers/net/wireless/ath/ath5k/ani.c | 91 ++-- drivers/net/wireless/ath/ath5k/ani.h | 32 +- drivers/net/wireless/ath/ath5k/ath5k.h | 569 +++++++++++++------ drivers/net/wireless/ath/ath5k/attach.c | 16 +- drivers/net/wireless/ath/ath5k/base.c | 287 +++++++---- drivers/net/wireless/ath/ath5k/caps.c | 27 +- drivers/net/wireless/ath/ath5k/desc.c | 217 ++++++-- drivers/net/wireless/ath/ath5k/desc.h | 124 +++-- drivers/net/wireless/ath/ath5k/dma.c | 370 ++++++++----- drivers/net/wireless/ath/ath5k/gpio.c | 81 +++- drivers/net/wireless/ath/ath5k/initvals.c | 75 ++- drivers/net/wireless/ath/ath5k/pci.c | 2 +- drivers/net/wireless/ath/ath5k/pcu.c | 222 +++++--- drivers/net/wireless/ath/ath5k/phy.c | 853 +++++++++++++++++++++++------ drivers/net/wireless/ath/ath5k/qcu.c | 143 ++++-- drivers/net/wireless/ath/ath5k/reg.h | 27 +- drivers/net/wireless/ath/ath5k/reset.c | 230 ++++++-- drivers/net/wireless/ath/ath5k/rfbuffer.h | 59 ++- drivers/net/wireless/ath/ath5k/rfgain.h | 22 +- 20 files changed, 2465 insertions(+), 986 deletions(-)
Quoted 3 lines
--
1.7.8.rc3
Unfortunately, <patchwork.kernel.org> is still down, thus I have extracted your patchset from your emails.
I have git-am-ed them in my local linux-next (next-20111125) GIT. ( Patchset attached ).
I have only seen this little typo by having a quick view on the single patch:
[ drivers/net/wireless/ath/ath5k/pcu.c ]
+ * -Different operating modes: AP, STA, IBSS <--- Space before "Different"
Any special thing you want to be tested?
How can I easily generate the (kernel) docs for ath5k (I mean I don't want to generate a complete kernel-doc)?
- Sedat -
[1] https://patchwork.kernel.org/project/linux-wireless/list/
Quoted 64 lines · Sedat Dilek
Quoted 49 lines · Nick Kossifidis
This series of patches includes some stability fixes related to interrupt handling, an updated version of a calibration-related patch I posted some time ago but never submited here and a new module parameter to disable GPIO based rfkill switch (we had a few bug reports on that recently).
It also adds kernel doc on all ath5k_hw_* functions and structs (needs some more work but it should be fine, I reviewed the output, spell-ckecked it etc) and a few minor fixes and optimizations.
v2: Adress comments from Adrian, Felix, Jiri and Bob. Thanks a lot for the review !
Nick Kossifidis (12):
ath5k: Switch from read-and-clear to write-to-clear method when handling PISR/SISR registers
ath5k: Add TXNOFRM toINT_TX_ALL
ath5k: Cleanups v1
ath5k: Calibration re-work
ath5k: Useusleep_rangewhere possible
ath5k: Cleanups v2 + add kerneldoc on all hw functions
ath5k: We always do full calibration on AR5210
ath5k: Add a module parameter to disable hw rf kill switch
ath5k: MRR support and 2GHz radio override belong inah_capabilities
ath5k:ath5k_ani_period_restartonly touches structath5k_ani_state
ath5k: Renumber hw queue ids
ath5k: Optimizeath5k_cw_validatedrivers/net/wireless/ath/ath5k/ahb.c | 4 +- drivers/net/wireless/ath/ath5k/ani.c | 91 ++-- drivers/net/wireless/ath/ath5k/ani.h | 32 +- drivers/net/wireless/ath/ath5k/ath5k.h | 569 +++++++++++++------ drivers/net/wireless/ath/ath5k/attach.c | 16 +- drivers/net/wireless/ath/ath5k/base.c | 287 +++++++---- drivers/net/wireless/ath/ath5k/caps.c | 27 +- drivers/net/wireless/ath/ath5k/desc.c | 217 ++++++-- drivers/net/wireless/ath/ath5k/desc.h | 124 +++-- drivers/net/wireless/ath/ath5k/dma.c | 370 ++++++++----- drivers/net/wireless/ath/ath5k/gpio.c | 81 +++- drivers/net/wireless/ath/ath5k/initvals.c | 75 ++- drivers/net/wireless/ath/ath5k/pci.c | 2 +- drivers/net/wireless/ath/ath5k/pcu.c | 222 +++++--- drivers/net/wireless/ath/ath5k/phy.c | 853 +++++++++++++++++++++++------ drivers/net/wireless/ath/ath5k/qcu.c | 143 ++++-- drivers/net/wireless/ath/ath5k/reg.h | 27 +- drivers/net/wireless/ath/ath5k/reset.c | 230 ++++++-- drivers/net/wireless/ath/ath5k/rfbuffer.h | 59 ++- drivers/net/wireless/ath/ath5k/rfgain.h | 22 +- 20 files changed, 2465 insertions(+), 986 deletions(-)Quoted 3 lines
--
1.7.8.rc3Unfortunately, <patchwork.kernel.org> is still down, thus I have extracted your patchset from your emails.
I have git-am-ed them in my local linux-next (next-20111125) GIT. ( Patchset attached ).I have only seen this little typo by having a quick view on the single patch:
[
drivers/net/wireless/ath/ath5k/pcu.c]+ * -Different operating modes: AP, STA, IBSS <--- Space before "Different"
Quoted 9 lines
Any special thing you want to be tested?
How can I easily generate the (kernel) docs for ath5k (I mean I don't want to generate a complete kernel-doc)?
- Sedat -
[1] https://patchwork.kernel.org/project/linux-wireless/list/
Grrr, missing file attachments.
- Sedat -
Nick Kossifidis
maintainerRe: [PATCH v2 01/12] ath5k: Switch from read-and-clear to write-to-clear method when handling PISR/SISR registers
In reply to Adrian Chadd2011/11/26 Adrian Chadd <[email protected]>:
Quoted 21 lines
Hi,
Review #2:
One thing that I discovered whilst debugging some silly races in FreeBSD was that the update of the txq active mask wasn't done atomically.
Ie, when you check this:
+++
b/drivers/net/wireless/ath/ath5k/base.cdrivers/net/wireless/ath/ath5k/base.c +1
-1@@ -1689,7 +1689,7 @@ ath5k_tasklet_tx(unsigned long data) struct ath5k_hw *ah = (void *)data; for (i = 0; i < AR5K_NUM_TX_QUEUES; i++) - if (ah->txqs[i].setup && (ah->ah_txq_isr & BIT(i))) + if (ah->txqs[i].setup && (ah->ah_txq_isr_txok_all & BIT(i))) ath5k_tx_processq(ah, &ah->txqs[i]);The way that the original code did it was:
Quoted 10 lines
* update the HAL TX mask bits inside the HAL getisr routine, so it would just update the HAL idea of txqactive;
* Then,ath_hal_gettxintrtxqs()would pass back to the driver the set of txq bits currently active, and reset those that are active (with a mask, so you can read only a few)
* theath_intr()routine would simply schedule a tasklet call when a TX interrupt came in;
* .. and then the TX completion tasklet would callath_hal_gettxintrtxqs()for each task bit to see if it needed servicing.
I'm not aware of ath_hal_gettxintrqs etc, this was the patch I wrote on this...
http://www.mail-archive.com/[email protected]/msg01312.html
Quoted 18 lines
Now, in previous generations of hardware/kernel, this may not have raced -
ath_intr()may have been a "fast" interrupt handler and thus would occur atomically on a single CPU - so you don't have any races. But these days,ath_intr()is just a software interrupt and can occur in parallel with another CPU executing the completion handler.So since there was no locking around the TXQ bit updates and clear, it was very possible that a very busy TX device would "miss" TX queue notifications, as the CPU running the TX completion would read-and-clear the TXQ active bits in the HAL, whilst another CPU was running
ath_intr()which was trying to do a read/modify/write of those same bits.I _think_ felix fixed this in ath9k by hiding this stuff behind the PCU lock. I've also fixed it in FreeBSD. I think it's worth re-evaluating what is going on in ath5k and maybe add some similar locking.
Quoted 5 lines
Oh wait. Where are you clearing these bits? It doesn't look like you're even clearing the
ah_txq_isrbits in the most recent ath5k tree I have here. This means you're likely not missing events; but you're likely always scanning those queues. Making this code a bit pointless. :)
Yup we don't clean them but that's not a bug, we still only check active queues that produced interrupts, not everything. Anyway we have txq->lock already so it's not a big deal to implement this I'll post a patch on top of this patchset.
Quoted 10 lines
Anyway, I'd tidy this all up in a subsequent patchset. Get the interrupt changes in, then figure out how to properly lock the interrupt TXQ bit set path (the isr) and the clear path (once you've tested whether the TXQ needed servicing and then cleared the bit.)
HTH,
adrian
Thanks again for your comments ;-)
Signature · 3 lines
GPG ID: 0xEE878588 As you read this post global entropy rises. Have Fun ;-) Nick
Re: [PATCH v2 01/12] ath5k: Switch from read-and-clear to write-to-clear method when handling PISR/SISR registers
Quoted 10 lines · Nick Kossifidis
Quoted 5 lines
Oh wait. Where are you clearing these bits? It doesn't look like you're even clearing the
ah_txq_isrbits in the most recent ath5k tree I have here. This means you're likely not missing events; but you're likely always scanning those queues. Making this code a bit pointless. :)Yup we don't clean them but that's not a bug, we still only check active queues that produced interrupts, not everything. Anyway we have
txq->lockalready so it's not a big deal to implement this I'll post a patch on top of this patchset.
Right. but you're likely only using one active TXQ (and then CAB and beacon queues, which you may not be actually checking the completion status of) it won't matter. It just means if people start using >1 hardware TXQ, you're going to check the completion status on all of them. That's not a big deal, it just means you'll spend some CPU cycles and memory accesses checking queues you don't need to.
You can't protect that interrupt field behind the TXQ lock either, since you'll have multiple reader/writers from outside the TXQ. Hence why I put it behind my PCU lock (which I use to protect shared PCU state, rather than PCU access like how felix did with ath9k.)
Adrian
Nick Kossifidis
maintainer2011/11/27 Sedat Dilek <[email protected]>:
Quoted 6 lines
Unfortunately, <patchwork.kernel.org> is still down, thus I have extracted your patchset from your emails.
I have git-am-ed them in my local linux-next (next-20111125) GIT. ( Patchset attached ).
Quoted 6 lines
I have only seen this little typo by having a quick view on the single patch:
[
drivers/net/wireless/ath/ath5k/pcu.c]+ * -Different operating modes: AP, STA, IBSS <--- Space before "Different"
I reviewed this and it looks better in html and text output + checkpatch said it was O.K.
Quoted 1 line
Any special thing you want to be tested?
AP mode maybe but I think they are fine
Quoted 2 lines
How can I easily generate the (kernel) docs for ath5k (I mean I don't want to generate a complete kernel-doc)?
Use the kernel-doc script (inside scripts/) per-file or for the whole directory
Quoted 4 lines
- Sedat -
[1] https://patchwork.kernel.org/project/linux-wireless/list/
Signature · 3 lines
GPG ID: 0xEE878588 As you read this post global entropy rises. Have Fun ;-) Nick