*** SUBJECT HERE ***
cover *** SUBJECT HERE ***
John,
I have updated the commit logs as requested by you and also rebased & reorganized my earlier series on the TIP of wireless-testing.
It would be great if the following patches can make it for 2.6.31.
ath9k: Manipulate and report the correct RSSI
ath9k: RX stucks during heavy traffic in HT40 mode.
ath9k: Fix TX hang issue with Atheros chipsets
Senthil
Senthil Balasubramanian (7):
ath9k: Manipulate and report the correct RSSI
ath9k: RX stucks during heavy traffic in HT40 mode.
ath9k: Fix TX hang issue with Atheros chipsets
ath9k: remove unnecessary STATION mode check.
ath9k: stop ani when the STA gets disconnected.
ath9k: race condition in SCANNING state check during ANI calibration
ath9k: Handle different TX and RX streams properly.
drivers/net/wireless/ath/ath9k/ath9k.h | 21 +++++++++ drivers/net/wireless/ath/ath9k/calib.c | 13 ++++- drivers/net/wireless/ath/ath9k/calib.h | 4 +- drivers/net/wireless/ath/ath9k/eeprom.c | 20 ++++++++- drivers/net/wireless/ath/ath9k/initvals.h | 47 +++++++++++---------- drivers/net/wireless/ath/ath9k/mac.c | 30 ++++++++++--- drivers/net/wireless/ath/ath9k/main.c | 66 ++++++++++++++++------------ drivers/net/wireless/ath/ath9k/recv.c | 25 ++++++++++- drivers/net/wireless/ath/ath9k/xmit.c | 57 +++++++++++++++++++------ 9 files changed, 206 insertions(+), 77 deletions(-)
PATCH 1/7 ath9k: Manipulate and report the correct RSSI
RSSI reported by the RX descriptor requires little manipulation. Manipulate and report the correct RSSI to the stack. This will fix the improper signal levels reported by iwconfig iw dev wlanX station dump. Also the Link Quality reported seems to be varying (falls to zero also sometimes) when iperf is run from STA to AP.
Also use the default noise floor for now as the one reported during the caliberation seems to be wrong.
The Signal and Link Quality before this patch (taken while TX is in progress from STA to AP)
09:59:13.285428037 Link Quality=29/70 Signal level=-81 dBm 09:59:13.410660084 Link Quality=20/70 Signal level=-90 dBm 09:59:13.586864392 Link Quality=21/70 Signal level=-89 dBm 09:59:13.710296281 Link Quality=21/70 Signal level=-89 dBm 09:59:13.821683064 Link Quality=25/70 Signal level=-85 dBm 09:59:13.933402989 Link Quality=24/70 Signal level=-86 dBm 09:59:14.045839276 Link Quality=26/70 Signal level=-84 dBm 09:59:14.193926673 Link Quality=23/70 Signal level=-87 dBm 09:59:14.306230262 Link Quality=31/70 Signal level=-79 dBm 09:59:14.419459667 Link Quality=26/70 Signal level=-84 dBm 09:59:14.530711167 Link Quality=37/70 Signal level=-73 dBm 09:59:14.642593962 Link Quality=29/70 Signal level=-81 dBm 09:59:14.754361169 Link Quality=21/70 Signal level=-89 dBm 09:59:14.866217355 Link Quality=21/70 Signal level=-89 dBm 09:59:14.976963623 Link Quality=28/70 Signal level=-82 dBm 09:59:15.089149809 Link Quality=26/70 Signal level=-84 dBm 09:59:15.205039887 Link Quality=27/70 Signal level=-83 dBm 09:59:15.316368003 Link Quality=23/70 Signal level=-87 dBm 09:59:15.427684036 Link Quality=36/70 Signal level=-74 dBm 09:59:15.539756380 Link Quality=21/70 Signal level=-89 dBm 09:59:15.650549093 Link Quality=22/70 Signal level=-88 dBm 09:59:15.761171672 Link Quality=32/70 Signal level=-78 dBm 09:59:15.872793750 Link Quality=23/70 Signal level=-87 dBm 09:59:15.984421694 Link Quality=22/70 Signal level=-88 dBm 09:59:16.097315093 Link Quality=21/70 Signal level=-89 dBm
The link quality and signal level after this patch (take while TX is in progress from STA to AP)
17:21:25.627848091 Link Quality=65/70 Signal level=-45 dBm 17:21:25.762805607 Link Quality=65/70 Signal level=-45 dBm 17:21:25.875521888 Link Quality=66/70 Signal level=-44 dBm 17:21:25.987468448 Link Quality=66/70 Signal level=-44 dBm 17:21:26.100628151 Link Quality=66/70 Signal level=-44 dBm 17:21:26.213129671 Link Quality=66/70 Signal level=-44 dBm 17:21:26.324923070 Link Quality=65/70 Signal level=-45 dBm 17:21:26.436831357 Link Quality=65/70 Signal level=-45 dBm 17:21:26.610356973 Link Quality=65/70 Signal level=-45 dBm 17:21:26.723340047 Link Quality=65/70 Signal level=-45 dBm 17:21:26.835715293 Link Quality=64/70 Signal level=-46 dBm 17:21:26.949542748 Link Quality=64/70 Signal level=-46 dBm 17:21:27.062261613 Link Quality=65/70 Signal level=-45 dBm 17:21:27.174511563 Link Quality=64/70 Signal level=-46 dBm 17:21:27.287616232 Link Quality=64/70 Signal level=-46 dBm 17:21:27.400598119 Link Quality=64/70 Signal level=-46 dBm 17:21:27.511381404 Link Quality=64/70 Signal level=-46 dBm 17:21:27.624530421 Link Quality=65/70 Signal level=-45 dBm 17:21:27.737807109 Link Quality=64/70 Signal level=-46 dBm 17:21:27.850861352 Link Quality=65/70 Signal level=-45 dBm 17:21:27.963369436 Link Quality=64/70 Signal level=-46 dBm 17:21:28.076582289 Link Quality=64/70 Signal level=-46 dBm
--- drivers/net/wireless/ath/ath9k/ath9k.h | 16 ++++++++++++++++ drivers/net/wireless/ath/ath9k/calib.c | 13 ++++++++++--- drivers/net/wireless/ath/ath9k/calib.h | 4 +++- drivers/net/wireless/ath/ath9k/main.c | 1 + drivers/net/wireless/ath/ath9k/recv.c | 25 ++++++++++++++++++++++++- 5 files changed, 54 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +16 -0
@@ -295,12 +295,28 @@ struct ath_tx_control {#define ATH_TX_XRETRY 0x02#define ATH_TX_BAR 0x04 +#define ATH_RSSI_LPF_LEN 10 +#define RSSI_LPF_THRESHOLD -20 +#define ATH9K_RSSI_BAD 0x80 +#define ATH_RSSI_EP_MULTIPLIER (1<<7) +#define ATH_EP_MUL (x, mul) ((x) * (mul)) +#define ATH_RSSI_IN (x) (ATH_EP_MUL((x), ATH_RSSI_EP_MULTIPLIER)) +#define ATH_LPF_RSSI (x, y, len) \ + ((x != ATH_RSSI_DUMMY_MARKER) ? (((x) * ((len) - 1) + (y)) / (len)) : (y)) +#define ATH_RSSI_LPF (x, y) do { \ + if ((y) >= RSSI_LPF_THRESHOLD) \ + x = ATH_LPF_RSSI((x), ATH_RSSI_IN((y)), ATH_RSSI_LPF_LEN); \ +} while (0) +#define ATH_EP_RND (x, mul) \ + ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul)) +struct ath_node {struct ath_softc *an_sc;struct ath_atx_tid tid[WME_NUM_TID ];struct ath_atx_ac ac[WME_NUM_AC ];u16 maxampdu;u8 mpdudensity; +int last_rssi; };struct ath_tx {
drivers/net/wireless/ath/ath9k/calib.c +10 -3
@@ -691,15 +691,22 @@ int16_t ath9k_hw_getnf(struct ath_hw *ah,void ath9k_init_nfcal_hist_buffer (struct ath_hw *ah) {int i, j; +s16 noise_floor; + +if (AR_SREV_9280 (ah)) + noise_floor =AR_PHY_CCA_MAX_AR9280_GOOD_VALUE ; +else if (AR_SREV_9285 (ah)) + noise_floor =AR_PHY_CCA_MAX_AR9285_GOOD_VALUE ; +else + noise_floor =AR_PHY_CCA_MAX_AR5416_GOOD_VALUE ;for (i =0 ; i <NUM_NF_READINGS ; i++) { ah->nfCalHist[i].currIndex =0 ; - ah->nfCalHist[i].privNF =AR_PHY_CCA_MAX_GOOD_VALUE ; + ah->nfCalHist[i].privNF = noise_floor; ah->nfCalHist[i].invalidNFcount =AR_PHY_CCA_FILTERWINDOW_LENGTH ;for (j =0 ; j <ATH9K_NF_CAL_HIST_MAX ; j++) { - ah->nfCalHist[i].nfCalBuffer[j] = -AR_PHY_CCA_MAX_GOOD_VALUE ; + ah->nfCalHist[i].nfCalBuffer[j] = noise_floor; } } }
drivers/net/wireless/ath/ath9k/calib.h +3 -1
@@ -25,7 +25,9 @@ extern const struct ath9k_percal_data adc_dc_cal_multi_sample;extern const struct ath9k_percal_data adc_dc_cal_single_sample;extern const struct ath9k_percal_data adc_init_dc_cal; -#define AR_PHY_CCA_MAX_GOOD_VALUE -85 +#define AR_PHY_CCA_MAX_AR5416_GOOD_VALUE -85 +#define AR_PHY_CCA_MAX_AR9280_GOOD_VALUE -112 +#define AR_PHY_CCA_MAX_AR9285_GOOD_VALUE -118#define AR_PHY_CCA_MAX_HIGH_VALUE -62#define AR_PHY_CCA_MIN_BAD_VALUE -140#define AR_PHY_CCA_FILTERWINDOW_LENGTH_INIT 3
drivers/net/wireless/ath/ath9k/main.c +1 -0
@@ -463,6 +463,7 @@ static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta) an->maxampdu =1 << (IEEE80211_HTCAP_MAXRXAMPDU_FACTOR + sta->ht_cap.ampdu_factor); an->mpdudensity =parse_mpdudensity (sta->ht_cap.ampdu_density); + an->last_rssi =ATH_RSSI_DUMMY_MARKER ; } }
drivers/net/wireless/ath/ath9k/recv.c +24 -1
@@ -145,6 +145,10 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,u8 ratecode;__le16 fc;struct ieee80211_hw *hw; +struct ieee80211_sta *sta; +struct ath_node *an; +int last_rssi =ATH_RSSI_DUMMY_MARKER ; + hdr = (struct ieee80211_hdr *)skb->data; fc = hdr->frame_control;
@@ -229,11 +233,30 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds, } } +rcu_read_lock (); + sta =ieee80211_find_sta (sc->hw, hdr->addr2); +if (sta) { + an = (struct ath_node *) sta->drv_priv; +if (ds->ds_rxstat.rs_rssi !=ATH9K_RSSI_BAD && + !ds->ds_rxstat.rs_moreaggr) +ATH_RSSI_LPF (an->last_rssi, ds->ds_rxstat.rs_rssi); + last_rssi = an->last_rssi; + } +rcu_read_unlock (); + +if (likely (last_rssi !=ATH_RSSI_DUMMY_MARKER )) + ds->ds_rxstat.rs_rssi =ATH_EP_RND (last_rssi, +ATH_RSSI_EP_MULTIPLIER ); +if (ds->ds_rxstat.rs_rssi <0 ) + ds->ds_rxstat.rs_rssi =0 ; +else if (ds->ds_rxstat.rs_rssi >127 ) + ds->ds_rxstat.rs_rssi =127 ; + rx_status->mactime =ath_extend_tsf (sc, ds->ds_rxstat.rs_tstamp); rx_status->band = hw->conf.channel->band; rx_status->freq = hw->conf.channel->center_freq; rx_status->noise = sc->ani.noise_floor; - rx_status->signal = rx_status->noise + ds->ds_rxstat.rs_rssi; + rx_status->signal =ATH_DEFAULT_NOISE_FLOOR + ds->ds_rxstat.rs_rssi; rx_status->antenna = ds->ds_rxstat.rs_antenna;/* at 45 you will be able to use MCS 15 reliably. A more elaborate
Signature · 1 line
1.6.0.4
PATCH 2/7 ath9k: RX stucks during heavy traffic in HT40 mode.
Running iperf along with p2p traffic on both TX and RX side then stop one side, then stop the other side, then start it up again, eventually the STA gets into a mode that it can not pass data at all.
A hardware workaround for invalid RSSI can make FIFO write pointer to jump over read pointer, causing RX data corruption and repeated DMA. Both TX and RX works fine when the workaround is disabled.
To replace the original hardware work around, software looks for frames with post delimiter CRC error and mark the RSSI invalid so that the upperlayer will not use the RSSI associated with this frame. So disable the hardware workaround by updating the appropriate registers.
--- drivers/net/wireless/ath/ath9k/eeprom.c | 20 +++++++++++- drivers/net/wireless/ath/ath9k/initvals.h | 47 +++++++++++++++------------- drivers/net/wireless/ath/ath9k/mac.c | 30 ++++++++++++++---- 3 files changed, 67 insertions(+), 30 deletions(-)
drivers/net/wireless/ath/ath9k/eeprom.c +19 -1
@@ -1208,6 +1208,19 @@ static void ath9k_hw_4k_set_gain(struct ath_hw *ah, pModal->xatten2Margin[0]);REG_RMW_FIELD (ah,AR_PHY_GAIN_2GHZ + regChainOffset,AR_PHY_GAIN_2GHZ_XATTEN2_DB , pModal->xatten2Db[0 ]); + +/* Set the block 1 value to block 0 value */ +REG_RMW_FIELD (ah,AR_PHY_GAIN_2GHZ +0x1000 , +AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN , + pModal->bswMargin[0 ]); +REG_RMW_FIELD (ah,AR_PHY_GAIN_2GHZ +0x1000 , +AR_PHY_GAIN_2GHZ_XATTEN1_DB , pModal->bswAtten[0 ]); +REG_RMW_FIELD (ah,AR_PHY_GAIN_2GHZ +0x1000 , +AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN , + pModal->xatten2Margin[0 ]); +REG_RMW_FIELD (ah,AR_PHY_GAIN_2GHZ +0x1000 , +AR_PHY_GAIN_2GHZ_XATTEN2_DB , + pModal->xatten2Db[0 ]); } REG_RMW_FIELD(ah, AR_PHY_RXGAIN + regChainOffset,
@@ -1215,6 +1228,11 @@ static void ath9k_hw_4k_set_gain(struct ath_hw *ah,REG_RMW_FIELD (ah,AR_PHY_RXGAIN + regChainOffset,AR9280_PHY_RXGAIN_TXRX_MARGIN , pModal->rxTxMarginCh[0 ]); +REG_RMW_FIELD (ah,AR_PHY_RXGAIN +0x1000 , +AR9280_PHY_RXGAIN_TXRX_ATTEN , txRxAttenLocal); +REG_RMW_FIELD (ah,AR_PHY_RXGAIN +0x1000 , +AR9280_PHY_RXGAIN_TXRX_MARGIN , pModal->rxTxMarginCh[0 ]); +if (AR_SREV_9285_11 (ah))REG_WRITE (ah,AR9285_AN_TOP4 , (AR9285_AN_TOP4_DEFAULT |0x14 )); }
@@ -1239,7 +1257,7 @@ static void ath9k_hw_4k_set_board_values(struct ath_hw *ah,ath9k_hw_4k_set_gain (ah, pModal, eep, txRxAttenLocal,0 );/* Initialize Ant Diversity settings from EEPROM */ -if (pModal->version ==3 ) { +if (pModal->version >=3 ) { ant_div_control1 = ((pModal->ob_234 >>12 ) &0xf ); ant_div_control2 = ((pModal->db1_234 >>12 ) &0xf ); regVal =REG_READ (ah,0x99ac );
drivers/net/wireless/ath/ath9k/initvals.h +25 -22
104 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/mac.c +23 -7
@@ -825,13 +825,29 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, ds->ds_rxstat.rs_datalen = ads.ds_rxstatus1 & AR_DataLen; ds->ds_rxstat.rs_tstamp = ads.AR_RcvTimestamp; - ds->ds_rxstat.rs_rssi =MS (ads.ds_rxstatus4, AR_RxRSSICombined); - ds->ds_rxstat.rs_rssi_ctl0 =MS (ads.ds_rxstatus0, AR_RxRSSIAnt00); - ds->ds_rxstat.rs_rssi_ctl1 =MS (ads.ds_rxstatus0, AR_RxRSSIAnt01); - ds->ds_rxstat.rs_rssi_ctl2 =MS (ads.ds_rxstatus0, AR_RxRSSIAnt02); - ds->ds_rxstat.rs_rssi_ext0 =MS (ads.ds_rxstatus4, AR_RxRSSIAnt10); - ds->ds_rxstat.rs_rssi_ext1 =MS (ads.ds_rxstatus4, AR_RxRSSIAnt11); - ds->ds_rxstat.rs_rssi_ext2 =MS (ads.ds_rxstatus4, AR_RxRSSIAnt12); +if (ads.ds_rxstatus8 & AR_PostDelimCRCErr) { + ds->ds_rxstat.rs_rssi =ATH9K_RSSI_BAD ; + ds->ds_rxstat.rs_rssi_ctl0 =ATH9K_RSSI_BAD ; + ds->ds_rxstat.rs_rssi_ctl1 =ATH9K_RSSI_BAD ; + ds->ds_rxstat.rs_rssi_ctl2 =ATH9K_RSSI_BAD ; + ds->ds_rxstat.rs_rssi_ext0 =ATH9K_RSSI_BAD ; + ds->ds_rxstat.rs_rssi_ext1 =ATH9K_RSSI_BAD ; + ds->ds_rxstat.rs_rssi_ext2 =ATH9K_RSSI_BAD ; + }else { + ds->ds_rxstat.rs_rssi =MS (ads.ds_rxstatus4, AR_RxRSSICombined); + ds->ds_rxstat.rs_rssi_ctl0 =MS (ads.ds_rxstatus0, + AR_RxRSSIAnt00); + ds->ds_rxstat.rs_rssi_ctl1 =MS (ads.ds_rxstatus0, + AR_RxRSSIAnt01); + ds->ds_rxstat.rs_rssi_ctl2 =MS (ads.ds_rxstatus0, + AR_RxRSSIAnt02); + ds->ds_rxstat.rs_rssi_ext0 =MS (ads.ds_rxstatus4, + AR_RxRSSIAnt10); + ds->ds_rxstat.rs_rssi_ext1 =MS (ads.ds_rxstatus4, + AR_RxRSSIAnt11); + ds->ds_rxstat.rs_rssi_ext2 =MS (ads.ds_rxstatus4, + AR_RxRSSIAnt12); + }if (ads.ds_rxstatus8 & AR_RxKeyIdxValid) ds->ds_rxstat.rs_keyix =MS (ads.ds_rxstatus8, AR_KeyIdx);else
Signature · 1 line
1.6.0.4
PATCH 3/7 ath9k: Fix TX hang issue with Atheros chipsets
The hardware doesn't generate interrupts in some cases and so work around this by monitoring the TX status periodically and reset the chip if required.
This behavior of the hardware not generating the TX interrupts can be noticed through ath9k debugfs interrupt statistics when heavy traffic is being sent from STA to AP. One can easily see this behavior when the STA is transmitting at a higher rates. The interrupt statistics in the debugfs interface clearly shows that only RX interrupts alone being generated and TX being stuck.
TX should be monitored through a timer and reset the chip only when frames are queued to the hardware but TX interrupts are not generated for the same even after one second. Also, we shouldn't remove holding descriptor from AC queue if it happens to be the only descriptor and schedule TX aggregation regarless of queue depth as it improves scheduling of AMPDUs from software to hardware queue.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 4 ++ drivers/net/wireless/ath/ath9k/main.c | 3 ++ drivers/net/wireless/ath/ath9k/xmit.c | 57 ++++++++++++++++++++++++-------- 3 files changed, 50 insertions(+), 14 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +4 -0
@@ -230,6 +230,8 @@ void ath_descdma_cleanup(struct ath_softc *sc, struct ath_descdma *dd,#define ATH_DS_TX_BA (_ds) ((_ds)->ds_us.tx.ts_flags & ATH9K_TX_BA)#define ATH_AN_2_TID (_an, _tidno) (&(_an)->tid[(_tidno)]) +#define ATH_TX_COMPLETE_POLL_INT 1000 +enum ATH_AGGR_STATUS {ATH_AGGR_DONE ,ATH_AGGR_BAW_CLOSED ,
@@ -245,6 +247,7 @@ struct ath_txq {u8 axq_aggr_depth;u32 axq_totalqueued;bool stopped; +bool axq_tx_inprogress;struct ath_buf *axq_linkbuf;/* first desc of the last descriptor that contains CTS */
@@ -609,6 +612,7 @@ struct ath_softc {#endif struct ath_bus_ops *bus_ops;struct ath_beacon_config cur_beacon_conf; +struct delayed_work tx_complete_work; };struct ath_wiphy {
drivers/net/wireless/ath/ath9k/main.c +3 -0
@@ -1256,6 +1256,7 @@ void ath_detach(struct ath_softc *sc)ath_deinit_leds (sc);cancel_work_sync (&sc->chan_work);cancel_delayed_work_sync (&sc->wiphy_work); +cancel_delayed_work_sync (&sc->tx_complete_work);for (i =0 ; i < sc->num_sec_wiphy; i++) {struct ath_wiphy *aphy = sc->sec_wiphy[i];
@@ -1974,6 +1975,8 @@ static int ath9k_start(struct ieee80211_hw *hw)ieee80211_wake_queues (hw); +queue_delayed_work (sc->hw->workqueue, &sc->tx_complete_work,0 ); + mutex_unlock:mutex_unlock (&sc->mutex);
drivers/net/wireless/ath/ath9k/xmit.c +43 -14
100 lines not on this page · raw message
Signature · 1 line
1.6.0.4
PATCH 4/7 ath9k: remove unnecessary STATION mode check.
Remove unncessary STATION mode check in ath9k_bss_assoc_info() as it is called only for STATION mode.
--- drivers/net/wireless/ath/ath9k/main.c | 21 +++++++++------------ 1 files changed, 9 insertions(+), 12 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +8 -11
@@ -921,24 +921,21 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc, struct ieee80211_vif *vif, struct ieee80211_bss_conf *bss_conf) { - struct ath_vif *avp = (void *)vif->drv_priv;if (bss_conf->assoc) {DPRINTF (sc,ATH_DBG_CONFIG ,"Bss Info ASSOC %d, bssid: %pM\n" , bss_conf->aid, sc->curbssid);/* New association, store aid */ -if (avp->av_opmode ==NL80211_IFTYPE_STATION ) { - sc->curaid = bss_conf->aid; -ath9k_hw_write_associd (sc); + sc->curaid = bss_conf->aid; +ath9k_hw_write_associd (sc); -/* -* Request a re-configuration of Beacon related timers -* on the receipt of the first Beacon frame (i.e., -* after time sync with the AP). -*/ - sc->sc_flags |=SC_OP_BEACON_SYNC ; - } +/* +* Request a re-configuration of Beacon related timers +* on the receipt of the first Beacon frame (i.e., +* after time sync with the AP). +*/ + sc->sc_flags |=SC_OP_BEACON_SYNC ;/* Configure the beacon */ ath_beacon_config (sc, vif);
Signature · 1 line
1.6.0.4
PATCH 5/7 ath9k: stop ani when the STA gets disconnected.
ANI is not required when the STA is disconnected. So stop it and enable ANI for adhoc and monitor mode.
--- drivers/net/wireless/ath/ath9k/main.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +5 -1
@@ -950,6 +950,8 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc, }else {DPRINTF (sc,ATH_DBG_CONFIG ,"Bss Info DISASSOC\n" ); sc->curaid =0 ; +/* Stop ANI */ +del_timer_sync (&sc->ani.timer); } }
@@ -2197,7 +2199,9 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,ath9k_hw_set_interrupts (sc->sc_ah, sc->imask); -if (conf->type ==NL80211_IFTYPE_AP ) +if (conf->type ==NL80211_IFTYPE_AP || + conf->type ==NL80211_IFTYPE_ADHOC || + conf->type ==NL80211_IFTYPE_MONITOR )ath_start_ani (sc); out:
Signature · 1 line
1.6.0.4
PATCH 6/7 ath9k: race condition in SCANNING state check during ANI calibration
ANI calibration shouldn't be done when we are not on our home channel. This is already verified. However, it is racy. Fix this by proper spin locks.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 1 + drivers/net/wireless/ath/ath9k/main.c | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -0
@@ -563,6 +563,7 @@ struct ath_softc {int irq;spinlock_t sc_resetlock;spinlock_t sc_serial_rw; +spinlock_t ani_lock;struct mutex mutex;u8 curbssid[ETH_ALEN ];
drivers/net/wireless/ath/ath9k/main.c +7 -4
@@ -342,6 +342,7 @@ static void ath_ani_calibrate(unsigned long data)* don't calibrate when we're scanning. * we are most likely not on our home channel. */ +spin_lock (&sc->ani_lock);if (sc->sc_flags &SC_OP_SCANNING ) goto set_timer;
@@ -405,6 +406,7 @@ static void ath_ani_calibrate(unsigned long data)ath9k_ps_restore (sc); set_timer: +spin_unlock (&sc->ani_lock);/* * Set timer interval based on previous results. * The interval must be the shortest necessary to satisfy ANI,
@@ -1312,6 +1314,7 @@ static int ath_init(u16 devid, struct ath_softc *sc)spin_lock_init (&sc->wiphy_lock);spin_lock_init (&sc->sc_resetlock);spin_lock_init (&sc->sc_serial_rw); +spin_lock_init (&sc->ani_lock);mutex_init (&sc->mutex);tasklet_init (&sc->intr_tq, ath9k_tasklet, (unsigned long )sc); tasklet_init(&sc->bcon_tasklet, ath_beacon_tasklet,
@@ -2686,9 +2689,9 @@ static void ath9k_sw_scan_start(struct ieee80211_hw *hw) aphy->state =ATH_WIPHY_SCAN ;ath9k_wiphy_pause_all_forced (sc, aphy); -mutex_lock (&sc->mutex); +spin_lock_bh (&sc->ani_lock); sc->sc_flags |=SC_OP_SCANNING ; -mutex_unlock (&sc->mutex); +spin_unlock_bh (&sc->ani_lock); }static void ath9k_sw_scan_complete (struct ieee80211_hw *hw)
@@ -2696,11 +2699,11 @@ static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)struct ath_wiphy *aphy = hw->priv;struct ath_softc *sc = aphy->sc; -mutex_lock (&sc->mutex); +spin_lock_bh (&sc->ani_lock); aphy->state =ATH_WIPHY_ACTIVE ; sc->sc_flags &= ~SC_OP_SCANNING ; sc->sc_flags |=SC_OP_FULL_RESET ; -mutex_unlock (&sc->mutex); +spin_unlock_bh (&sc->ani_lock); }struct ieee80211_ops ath9k_ops = {
Signature · 1 line
1.6.0.4
PATCH 7/7 ath9k: Handle different TX and RX streams properly.
This patch fixes an issue when the TX and RX streams are different.
--- drivers/net/wireless/ath/ath9k/main.c | 26 ++++++++++++++------------ 1 files changed, 14 insertions(+), 12 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +14 -12
@@ -890,6 +890,7 @@ static void setup_ht_cap(struct ath_softc *sc, {#define ATH9K_HT_CAP_MAXRXAMPDU_65536 0x3/* 2 ^ 16 */ #define ATH9K_HT_CAP_MPDUDENSITY_8 0x6/* 8 usec */ +u8 tx_streams, rx_streams; ht_info->ht_supported = true; ht_info->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
@@ -902,21 +903,22 @@ static void setup_ht_cap(struct ath_softc *sc,/* set up supported mcs set */ memset (&ht_info->mcs,0 ,sizeof (ht_info->mcs)); + tx_streams = !(sc->tx_chainmask & (sc->tx_chainmask -1 )) ?1 :2 ; + rx_streams = !(sc->rx_chainmask & (sc->rx_chainmask -1 )) ?1 :2 ; -switch (sc->rx_chainmask) { -case 1 : - ht_info->mcs.rx_mask[0 ] =0xff ; -break ; -case 3 : -case 5 : -case 7 : -default : - ht_info->mcs.rx_mask[0 ] =0xff ; - ht_info->mcs.rx_mask[1 ] =0xff ; -break ; +if (tx_streams != rx_streams) { +DPRINTF (sc,ATH_DBG_CONFIG ,"TX streams %d, RX streams: %d\n" , + tx_streams, rx_streams); + ht_info->mcs.tx_params |=IEEE80211_HT_MCS_TX_RX_DIFF ; + ht_info->mcs.tx_params |= ((tx_streams -1 ) << +IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT ); } - ht_info->mcs.tx_params =IEEE80211_HT_MCS_TX_DEFINED ; + ht_info->mcs.rx_mask[0 ] =0xff ; +if (rx_streams >=2 ) + ht_info->mcs.rx_mask[1 ] =0xff ; + + ht_info->mcs.tx_params |=IEEE80211_HT_MCS_TX_DEFINED ; } static void ath9k_bss_assoc_info(struct ath_softc *sc,
Signature · 1 line
1.6.0.4