ath9k_hw: fall back to OTP ROM when platform data has no valid eeprom data
PATCH v2 1/12 ath9k_hw: fall back to OTP ROM when platform data has no valid eeprom data
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +12 -2
@@ -3260,10 +3260,20 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah,int it;u16 checksum, mchecksum;struct ath_common *common =ath9k_hw_common (ah); +struct ar9300_eeprom *eep;eeprom_read_op read; -if (ath9k_hw_use_flash (ah)) -return ar9300_eeprom_restore_flash (ah, mptr, mdata_size); +if (ath9k_hw_use_flash (ah)) { +u8 txrx; + +ar9300_eeprom_restore_flash (ah, mptr, mdata_size); + +/* check if eeprom contains valid data */ + eep = (struct ar9300_eeprom *) mptr; + txrx = eep->baseEepHeader.txrxMask; +if (txrx !=0 && txrx !=0xff ) +return 0 ; + } word =kzalloc (2048 ,GFP_KERNEL );if (!word)
Signature · 1 line
1.7.3.2
PATCH v2 2/12 ath9k: validate rx antenna settings
Many chips are not able to deal with non-consecutive rx antenna selections and respond with calibration errors, reset errors, etc.
When an antenna is selected as a tx antenna, also flag it for rx to avoid chip issues.
--- drivers/net/wireless/ath/ath9k/main.c | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +18 -1
@@ -1912,12 +1912,29 @@ static u32 fill_chainmask(u32 cap, u32 new)return filled; } +static bool validate_antenna_mask (struct ath_hw *ah,u32 val) +{ +switch (val &0x7 ) { +case 0x1 : +case 0x3 : +case 0x7 : +return true; +case 0x2 : +return (ah->caps.rx_chainmask ==1 ); +default : +return false; + } +} +static int ath9k_set_antenna (struct ieee80211_hw *hw,u32 tx_ant,u32 rx_ant) {struct ath_softc *sc = hw->priv;struct ath_hw *ah = sc->sc_ah; -if (!rx_ant || !tx_ant) +if (ah->caps.rx_chainmask !=1 ) + rx_ant |= tx_ant; + +if (!validate_antenna_mask (ah, rx_ant) || !tx_ant)return -EINVAL ; sc->ant_rx = rx_ant;
Signature · 1 line
1.7.3.2
PATCH v2 3/12 ath9k_hw: enable ANI on AR934x
It has been tested and works properly
--- drivers/net/wireless/ath/ath9k/hw.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +0 -4
@@ -671,10 +671,6 @@ static int __ath9k_hw_init(struct ath_hw *ah)if (!AR_SREV_9300_20_OR_LATER (ah)) ah->ani_function &= ~ATH9K_ANI_MRC_CCK ; -/* disable ANI for 9340 */ -if (AR_SREV_9340 (ah)) - ah->config.enable_ani = false; -ath9k_hw_init_mode_regs (ah);if (!ah->is_pciexpress)
Signature · 1 line
1.7.3.2
PATCH v2 4/12 ath9k_hw: fix tx gain tables for AR934x
Use the EEPROM information to choose the right tx gain table
--- drivers/net/wireless/ath/ath9k/ar9003_hw.c | 29 ++++++++++++++++++++++----- 1 files changed, 23 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_hw.c +23 -6
@@ -561,8 +561,8 @@ static void ar9003_tx_gain_table_mode1(struct ath_hw *ah) 5); else if (AR_SREV_9340(ah)) INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9340Modes_lowest_ob_db_tx_gain_table_1p0, - ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0), + ar9340Modes_high_ob_db_tx_gain_table_1p0, + ARRAY_SIZE(ar9340Modes_high_ob_db_tx_gain_table_1p0), 5); else if (AR_SREV_9485_11(ah)) INIT_INI_ARRAY(&ah->iniModesTxGain,
@@ -605,8 +605,8 @@ static void ar9003_tx_gain_table_mode2(struct ath_hw *ah) 5); else if (AR_SREV_9340(ah)) INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9340Modes_lowest_ob_db_tx_gain_table_1p0, - ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0), + ar9340Modes_low_ob_db_tx_gain_table_1p0, + ARRAY_SIZE(ar9340Modes_low_ob_db_tx_gain_table_1p0), 5); else if (AR_SREV_9485_11(ah)) INIT_INI_ARRAY(&ah->iniModesTxGain,
@@ -639,8 +639,8 @@ static void ar9003_tx_gain_table_mode3(struct ath_hw *ah) 5); else if (AR_SREV_9340(ah)) INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9340Modes_lowest_ob_db_tx_gain_table_1p0, - ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0), + ar9340Modes_high_power_tx_gain_table_1p0, + ARRAY_SIZE(ar9340Modes_high_power_tx_gain_table_1p0), 5); else if (AR_SREV_9485_11(ah)) INIT_INI_ARRAY(&ah->iniModesTxGain,
@@ -659,6 +659,20 @@ static void ar9003_tx_gain_table_mode3(struct ath_hw *ah) 5); } +static void ar9003_tx_gain_table_mode4 (struct ath_hw *ah) +{ +if (AR_SREV_9340 (ah)) +INIT_INI_ARRAY (&ah->iniModesTxGain, + ar9340Modes_mixed_ob_db_tx_gain_table_1p0, +ARRAY_SIZE (ar9340Modes_mixed_ob_db_tx_gain_table_1p0), +5 ); +else if (AR_SREV_9580 (ah)) +INIT_INI_ARRAY (&ah->iniModesTxGain, + ar9580_1p0_mixed_ob_db_tx_gain_table, +ARRAY_SIZE (ar9580_1p0_mixed_ob_db_tx_gain_table), +5 ); +} +static void ar9003_tx_gain_table_apply (struct ath_hw *ah) {switch (ar9003_hw_get_tx_gain_idx (ah)) {
@@ -675,6 +689,9 @@ static void ar9003_tx_gain_table_apply(struct ath_hw *ah)case 3 :ar9003_tx_gain_table_mode3 (ah);break ; +case 4 : +ar9003_tx_gain_table_mode4 (ah); +break ; } }
Signature · 1 line
1.7.3.2
PATCH v2 5/12 ath9k_hw: remove redundant arguments to INIT_INI_ARRAY
The row/column sizes can be derived from the array argument within the macro itself, which is less error prone. In a few cases the supplied column size was actually wrong.
--- drivers/net/wireless/ath/ath9k/ar9002_hw.c | 154 +++------ drivers/net/wireless/ath/ath9k/ar9003_hw.c | 541 ++++++++-------------------- drivers/net/wireless/ath/ath9k/calib.h | 6 +- 3 files changed, 199 insertions(+), 502 deletions(-)
drivers/net/wireless/ath/ath9k/ar9002_hw.c +51 -105
@@ -26,101 +26,70 @@static void ar9002_hw_init_mode_regs (struct ath_hw *ah) {if (AR_SREV_9271 (ah)) { -INIT_INI_ARRAY (&ah->iniModes, ar9271Modes_9271, -ARRAY_SIZE (ar9271Modes_9271),5 ); -INIT_INI_ARRAY (&ah->iniCommon, ar9271Common_9271, -ARRAY_SIZE (ar9271Common_9271),2 ); -INIT_INI_ARRAY (&ah->iniModes_9271_ANI_reg, ar9271Modes_9271_ANI_reg, -ARRAY_SIZE (ar9271Modes_9271_ANI_reg),5 ); +INIT_INI_ARRAY (&ah->iniModes, ar9271Modes_9271); +INIT_INI_ARRAY (&ah->iniCommon, ar9271Common_9271); +INIT_INI_ARRAY (&ah->iniModes_9271_ANI_reg, ar9271Modes_9271_ANI_reg);return ; }if (ah->config.pcie_clock_req)INIT_INI_ARRAY (&ah->iniPcieSerdes, - ar9280PciePhy_clkreq_off_L1_9280, -ARRAY_SIZE (ar9280PciePhy_clkreq_off_L1_9280),2 ); + ar9280PciePhy_clkreq_off_L1_9280);else INIT_INI_ARRAY (&ah->iniPcieSerdes, - ar9280PciePhy_clkreq_always_on_L1_9280, -ARRAY_SIZE (ar9280PciePhy_clkreq_always_on_L1_9280),2 ); + ar9280PciePhy_clkreq_always_on_L1_9280);if (AR_SREV_9287_11_OR_LATER (ah)) { -INIT_INI_ARRAY (&ah->iniModes, ar9287Modes_9287_1_1, -ARRAY_SIZE (ar9287Modes_9287_1_1),5 ); -INIT_INI_ARRAY (&ah->iniCommon, ar9287Common_9287_1_1, -ARRAY_SIZE (ar9287Common_9287_1_1),2 ); +INIT_INI_ARRAY (&ah->iniModes, ar9287Modes_9287_1_1); +INIT_INI_ARRAY (&ah->iniCommon, ar9287Common_9287_1_1); }else if (AR_SREV_9285_12_OR_LATER (ah)) { -INIT_INI_ARRAY (&ah->iniModes, ar9285Modes_9285_1_2, -ARRAY_SIZE (ar9285Modes_9285_1_2),5 ); -INIT_INI_ARRAY (&ah->iniCommon, ar9285Common_9285_1_2, -ARRAY_SIZE (ar9285Common_9285_1_2),2 ); +INIT_INI_ARRAY (&ah->iniModes, ar9285Modes_9285_1_2); +INIT_INI_ARRAY (&ah->iniCommon, ar9285Common_9285_1_2); }else if (AR_SREV_9280_20_OR_LATER (ah)) { -INIT_INI_ARRAY (&ah->iniModes, ar9280Modes_9280_2, -ARRAY_SIZE (ar9280Modes_9280_2),5 ); -INIT_INI_ARRAY (&ah->iniCommon, ar9280Common_9280_2, -ARRAY_SIZE (ar9280Common_9280_2),2 ); +INIT_INI_ARRAY (&ah->iniModes, ar9280Modes_9280_2); +INIT_INI_ARRAY (&ah->iniCommon, ar9280Common_9280_2);INIT_INI_ARRAY (&ah->iniModesFastClock, - ar9280Modes_fast_clock_9280_2, -ARRAY_SIZE (ar9280Modes_fast_clock_9280_2),3 ); + ar9280Modes_fast_clock_9280_2); }else if (AR_SREV_9160_10_OR_LATER (ah)) { -INIT_INI_ARRAY (&ah->iniModes, ar5416Modes_9160, -ARRAY_SIZE (ar5416Modes_9160),5 ); -INIT_INI_ARRAY (&ah->iniCommon, ar5416Common_9160, -ARRAY_SIZE (ar5416Common_9160),2 ); +INIT_INI_ARRAY (&ah->iniModes, ar5416Modes_9160); +INIT_INI_ARRAY (&ah->iniCommon, ar5416Common_9160);if (AR_SREV_9160_11 (ah)) {INIT_INI_ARRAY (&ah->iniAddac, - ar5416Addac_9160_1_1, -ARRAY_SIZE (ar5416Addac_9160_1_1),2 ); + ar5416Addac_9160_1_1); }else { -INIT_INI_ARRAY (&ah->iniAddac, ar5416Addac_9160, -ARRAY_SIZE (ar5416Addac_9160),2 ); +INIT_INI_ARRAY (&ah->iniAddac, ar5416Addac_9160); } }else if (AR_SREV_9100_OR_LATER (ah)) { -INIT_INI_ARRAY (&ah->iniModes, ar5416Modes_9100, -ARRAY_SIZE (ar5416Modes_9100),5 ); -INIT_INI_ARRAY (&ah->iniCommon, ar5416Common_9100, -ARRAY_SIZE (ar5416Common_9100),2 ); -INIT_INI_ARRAY (&ah->iniBank6, ar5416Bank6_9100, -ARRAY_SIZE (ar5416Bank6_9100),3 ); -INIT_INI_ARRAY (&ah->iniAddac, ar5416Addac_9100, -ARRAY_SIZE (ar5416Addac_9100),2 ); +INIT_INI_ARRAY (&ah->iniModes, ar5416Modes_9100); +INIT_INI_ARRAY (&ah->iniCommon, ar5416Common_9100); +INIT_INI_ARRAY (&ah->iniBank6, ar5416Bank6_9100); +INIT_INI_ARRAY (&ah->iniAddac, ar5416Addac_9100); }else { -INIT_INI_ARRAY (&ah->iniModes, ar5416Modes, -ARRAY_SIZE (ar5416Modes),5 ); -INIT_INI_ARRAY (&ah->iniCommon, ar5416Common, -ARRAY_SIZE (ar5416Common),2 ); -INIT_INI_ARRAY (&ah->iniBank6TPC, ar5416Bank6TPC, -ARRAY_SIZE (ar5416Bank6TPC),3 ); -INIT_INI_ARRAY (&ah->iniAddac, ar5416Addac, -ARRAY_SIZE (ar5416Addac),2 ); +INIT_INI_ARRAY (&ah->iniModes, ar5416Modes); +INIT_INI_ARRAY (&ah->iniCommon, ar5416Common); +INIT_INI_ARRAY (&ah->iniBank6TPC, ar5416Bank6TPC); +INIT_INI_ARRAY (&ah->iniAddac, ar5416Addac); }if (!AR_SREV_9280_20_OR_LATER (ah)) {/* Common for AR5416, AR913x, AR9160 */ -INIT_INI_ARRAY (&ah->iniBB_RfGain, ar5416BB_RfGain, -ARRAY_SIZE (ar5416BB_RfGain),3 ); - -INIT_INI_ARRAY (&ah->iniBank0, ar5416Bank0, -ARRAY_SIZE (ar5416Bank0),2 ); -INIT_INI_ARRAY (&ah->iniBank1, ar5416Bank1, -ARRAY_SIZE (ar5416Bank1),2 ); -INIT_INI_ARRAY (&ah->iniBank2, ar5416Bank2, -ARRAY_SIZE (ar5416Bank2),2 ); -INIT_INI_ARRAY (&ah->iniBank3, ar5416Bank3, -ARRAY_SIZE (ar5416Bank3),3 ); -INIT_INI_ARRAY (&ah->iniBank7, ar5416Bank7, -ARRAY_SIZE (ar5416Bank7),2 ); +INIT_INI_ARRAY (&ah->iniBB_RfGain, ar5416BB_RfGain); + +INIT_INI_ARRAY (&ah->iniBank0, ar5416Bank0); +INIT_INI_ARRAY (&ah->iniBank1, ar5416Bank1); +INIT_INI_ARRAY (&ah->iniBank2, ar5416Bank2); +INIT_INI_ARRAY (&ah->iniBank3, ar5416Bank3); +INIT_INI_ARRAY (&ah->iniBank7, ar5416Bank7);/* Common for AR5416, AR9160 */ if (!AR_SREV_9100 (ah)) -INIT_INI_ARRAY (&ah->iniBank6, ar5416Bank6, -ARRAY_SIZE (ar5416Bank6),3 ); +INIT_INI_ARRAY (&ah->iniBank6, ar5416Bank6);/* Common for AR913x, AR9160 */ if (!AR_SREV_5416 (ah)) -INIT_INI_ARRAY (&ah->iniBank6TPC, ar5416Bank6TPC_9100, -ARRAY_SIZE (ar5416Bank6TPC_9100),3 ); +INIT_INI_ARRAY (&ah->iniBank6TPC, + ar5416Bank6TPC_9100); }/* iniAddac needs to be modified for these chips */
@@ -143,13 +112,9 @@ static void ar9002_hw_init_mode_regs(struct ath_hw *ah) }if (AR_SREV_9287_11_OR_LATER (ah)) {INIT_INI_ARRAY (&ah->iniCckfirNormal, - ar9287Common_normal_cck_fir_coeff_9287_1_1, -ARRAY_SIZE (ar9287Common_normal_cck_fir_coeff_9287_1_1), -2 ); + ar9287Common_normal_cck_fir_coeff_9287_1_1);INIT_INI_ARRAY (&ah->iniCckfirJapan2484, - ar9287Common_japan_2484_cck_fir_coeff_9287_1_1, -ARRAY_SIZE (ar9287Common_japan_2484_cck_fir_coeff_9287_1_1), -2 ); + ar9287Common_japan_2484_cck_fir_coeff_9287_1_1); } }
@@ -163,20 +128,16 @@ static void ar9280_20_hw_init_rxgain_ini(struct ath_hw *ah)if (rxgain_type ==AR5416_EEP_RXGAIN_13DB_BACKOFF )INIT_INI_ARRAY (&ah->iniModesRxGain, - ar9280Modes_backoff_13db_rxgain_9280_2, -ARRAY_SIZE (ar9280Modes_backoff_13db_rxgain_9280_2),5 ); + ar9280Modes_backoff_13db_rxgain_9280_2);else if (rxgain_type ==AR5416_EEP_RXGAIN_23DB_BACKOFF )INIT_INI_ARRAY (&ah->iniModesRxGain, - ar9280Modes_backoff_23db_rxgain_9280_2, -ARRAY_SIZE (ar9280Modes_backoff_23db_rxgain_9280_2),5 ); + ar9280Modes_backoff_23db_rxgain_9280_2);else INIT_INI_ARRAY (&ah->iniModesRxGain, - ar9280Modes_original_rxgain_9280_2, -ARRAY_SIZE (ar9280Modes_original_rxgain_9280_2),5 ); + ar9280Modes_original_rxgain_9280_2); }else {INIT_INI_ARRAY (&ah->iniModesRxGain, - ar9280Modes_original_rxgain_9280_2, -ARRAY_SIZE (ar9280Modes_original_rxgain_9280_2),5 ); + ar9280Modes_original_rxgain_9280_2); } }
@@ -186,16 +147,13 @@ static void ar9280_20_hw_init_txgain_ini(struct ath_hw *ah, u32 txgain_type) AR5416_EEP_MINOR_VER_19) {if (txgain_type ==AR5416_EEP_TXGAIN_HIGH_POWER )INIT_INI_ARRAY (&ah->iniModesTxGain, - ar9280Modes_high_power_tx_gain_9280_2, -ARRAY_SIZE (ar9280Modes_high_power_tx_gain_9280_2),5 ); + ar9280Modes_high_power_tx_gain_9280_2);else INIT_INI_ARRAY (&ah->iniModesTxGain, - ar9280Modes_original_tx_gain_9280_2, -ARRAY_SIZE (ar9280Modes_original_tx_gain_9280_2),5 ); + ar9280Modes_original_tx_gain_9280_2); } else {INIT_INI_ARRAY (&ah->iniModesTxGain, - ar9280Modes_original_tx_gain_9280_2, -ARRAY_SIZE (ar9280Modes_original_tx_gain_9280_2),5 ); + ar9280Modes_original_tx_gain_9280_2); } }
@@ -203,12 +161,10 @@ static void ar9271_hw_init_txgain_ini(struct ath_hw *ah, u32 txgain_type) {if (txgain_type ==AR5416_EEP_TXGAIN_HIGH_POWER )INIT_INI_ARRAY (&ah->iniModesTxGain, - ar9271Modes_high_power_tx_gain_9271, -ARRAY_SIZE (ar9271Modes_high_power_tx_gain_9271),5 ); + ar9271Modes_high_power_tx_gain_9271);else INIT_INI_ARRAY (&ah->iniModesTxGain, - ar9271Modes_normal_power_tx_gain_9271, -ARRAY_SIZE (ar9271Modes_normal_power_tx_gain_9271),5 ); + ar9271Modes_normal_power_tx_gain_9271); }static void ar9002_hw_init_mode_gain_regs (struct ath_hw *ah)
@@ -217,8 +173,7 @@ static void ar9002_hw_init_mode_gain_regs(struct ath_hw *ah)if (AR_SREV_9287_11_OR_LATER (ah))INIT_INI_ARRAY (&ah->iniModesRxGain, - ar9287Modes_rx_gain_9287_1_1, -ARRAY_SIZE (ar9287Modes_rx_gain_9287_1_1),5 ); + ar9287Modes_rx_gain_9287_1_1);else if (AR_SREV_9280_20 (ah))ar9280_20_hw_init_rxgain_ini (ah);
@@ -226,8 +181,7 @@ static void ar9002_hw_init_mode_gain_regs(struct ath_hw *ah)ar9271_hw_init_txgain_ini (ah, txgain_type); }else if (AR_SREV_9287_11_OR_LATER (ah)) {INIT_INI_ARRAY (&ah->iniModesTxGain, - ar9287Modes_tx_gain_9287_1_1, -ARRAY_SIZE (ar9287Modes_tx_gain_9287_1_1),5 ); + ar9287Modes_tx_gain_9287_1_1); }else if (AR_SREV_9280_20 (ah)) {ar9280_20_hw_init_txgain_ini (ah, txgain_type); }else if (AR_SREV_9285_12_OR_LATER (ah)) {
@@ -235,26 +189,18 @@ static void ar9002_hw_init_mode_gain_regs(struct ath_hw *ah)if (txgain_type ==AR5416_EEP_TXGAIN_HIGH_POWER ) {if (AR_SREV_9285E_20 (ah)) {INIT_INI_ARRAY (&ah->iniModesTxGain, - ar9285Modes_XE2_0_high_power, -ARRAY_SIZE ( - ar9285Modes_XE2_0_high_power),5 ); + ar9285Modes_XE2_0_high_power); }else {INIT_INI_ARRAY (&ah->iniModesTxGain, - ar9285Modes_high_power_tx_gain_9285_1_2, -ARRAY_SIZE ( - ar9285Modes_high_power_tx_gain_9285_1_2),5 ); + ar9285Modes_high_power_tx_gain_9285_1_2); } }else {if (AR_SREV_9285E_20 (ah)) {INIT_INI_ARRAY (&ah->iniModesTxGain, - ar9285Modes_XE2_0_normal_power, -ARRAY_SIZE ( - ar9285Modes_XE2_0_normal_power),5 ); + ar9285Modes_XE2_0_normal_power); }else {INIT_INI_ARRAY (&ah->iniModesTxGain, - ar9285Modes_original_tx_gain_9285_1_2, -ARRAY_SIZE ( - ar9285Modes_original_tx_gain_9285_1_2),5 ); + ar9285Modes_original_tx_gain_9285_1_2); } } }
drivers/net/wireless/ath/ath9k/ar9003_hw.c +146 -395
882 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/calib.h +3 -3
@@ -30,10 +30,10 @@ struct ar5416IniArray {u32 ia_columns; }; -#define INIT_INI_ARRAY (iniarray, array, rows, columns) do { \ +#define INIT_INI_ARRAY (iniarray, array) do { \ (iniarray)->ia_array = (u32 *)(array); \ - (iniarray)->ia_rows = (rows); \ - (iniarray)->ia_columns = (columns); \ + (iniarray)->ia_rows = ARRAY_SIZE(array); \ + (iniarray)->ia_columns = ARRAY_SIZE(array[0]); \ } while (0)#define INI_RA (iniarray, row, column) \
Signature · 1 line
1.7.3.2
PATCH v2 6/12 ath9k/ath9k_htc: fix txop limit handling
In all those years apparently nobody noticed that the txop limit programmed into the chip was off by a factor of 32 (!), probably because the VI and VO queues aren't used that much aside from mgmt frames on VO.
--- drivers/net/wireless/ath/ath9k/htc_drv_main.c | 2 +- drivers/net/wireless/ath/ath9k/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/htc_drv_main.c +1 -1
@@ -1351,7 +1351,7 @@ static int ath9k_htc_conf_tx(struct ieee80211_hw *hw, qi.tqi_aifs = params->aifs; qi.tqi_cwmin = params->cw_min; qi.tqi_cwmax = params->cw_max; - qi.tqi_burstTime = params->txop; + qi.tqi_burstTime = params->txop *32 ; qnum =get_hw_qnum (queue, priv->hwq_map);
drivers/net/wireless/ath/ath9k/main.c +1 -1
@@ -1377,7 +1377,7 @@ static int ath9k_conf_tx(struct ieee80211_hw *hw, qi.tqi_aifs = params->aifs; qi.tqi_cwmin = params->cw_min; qi.tqi_cwmax = params->cw_max; - qi.tqi_burstTime = params->txop; + qi.tqi_burstTime = params->txop *32 ; ath_dbg(common, CONFIG, "Configure tx [queue/halq] [%d/%d], aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n",
Signature · 1 line
1.7.3.2
PATCH v2 7/12 ath9k: make per-WMM-AC queue sizes configurable via debugfs
Prepare for using different queue size defaults for each AC.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 1 + drivers/net/wireless/ath/ath9k/debug.c | 8 ++++++++ drivers/net/wireless/ath/ath9k/init.c | 1 + drivers/net/wireless/ath/ath9k/xmit.c | 6 ++++-- 4 files changed, 14 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -0
@@ -297,6 +297,7 @@ struct ath_tx {struct ath_txq txq[ATH9K_NUM_TX_QUEUES ];struct ath_descdma txdma;struct ath_txq *txq_map[WME_NUM_AC ]; +u32 txq_max_pending[WME_NUM_AC ]; };struct ath_rx_edma {
drivers/net/wireless/ath/ath9k/debug.c +8 -0
@@ -1556,6 +1556,14 @@ int ath9k_init_debug(struct ath_hw *ah) &fops_interrupt);debugfs_create_file ("xmit" ,S_IRUSR , sc->debug.debugfs_phy, sc, &fops_xmit); +debugfs_create_u32 ("qlen_bk" ,S_IRUSR |S_IWUSR , sc->debug.debugfs_phy, + &sc->tx.txq_max_pending[WME_AC_BK ]); +debugfs_create_u32 ("qlen_be" ,S_IRUSR |S_IWUSR , sc->debug.debugfs_phy, + &sc->tx.txq_max_pending[WME_AC_BE ]); +debugfs_create_u32 ("qlen_vi" ,S_IRUSR |S_IWUSR , sc->debug.debugfs_phy, + &sc->tx.txq_max_pending[WME_AC_VI ]); +debugfs_create_u32 ("qlen_vo" ,S_IRUSR |S_IWUSR , sc->debug.debugfs_phy, + &sc->tx.txq_max_pending[WME_AC_VO ]);debugfs_create_file ("stations" ,S_IRUSR , sc->debug.debugfs_phy, sc, &fops_stations); debugfs_create_file("misc", S_IRUSR, sc->debug.debugfs_phy, sc,
drivers/net/wireless/ath/ath9k/init.c +1 -0
@@ -434,6 +434,7 @@ static int ath9k_init_queues(struct ath_softc *sc)for (i =0 ; i <WME_NUM_AC ; i++) { sc->tx.txq_map[i] =ath_txq_setup (sc,ATH9K_TX_QUEUE_DATA , i); sc->tx.txq_map[i]->mac80211_qnum = i; + sc->tx.txq_max_pending[i] =ATH_MAX_QDEPTH ; }return 0 ; }
drivers/net/wireless/ath/ath9k/xmit.c +4 -2
@@ -1988,7 +1988,8 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,ath_txq_lock (sc, txq);if (txq == sc->tx.txq_map[q] && - ++txq->pending_frames >ATH_MAX_QDEPTH && !txq->stopped) { + ++txq->pending_frames > sc->tx.txq_max_pending[q] && + !txq->stopped) {ieee80211_stop_queue (sc->hw, q); txq->stopped = true; }
@@ -2047,7 +2048,8 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,if (WARN_ON (--txq->pending_frames <0 )) txq->pending_frames =0 ; -if (txq->stopped && txq->pending_frames <ATH_MAX_QDEPTH ) { +if (txq->stopped && + txq->pending_frames < sc->tx.txq_max_pending[q]) {ieee80211_wake_queue (sc->hw, q); txq->stopped = false; }
Signature · 1 line
1.7.3.2
PATCH v2 8/12 ath9k: fix aggregate size limit based on queue TXOP limit
If the aggregate size exceeds the TXOP limit, it leads to lots of unnecessary hardware and software retries.
The previous 4ms frame limit table was completely undocumented, the commit that updated it only vaguely referenced and equation from the standard, but I've been unable to replicate its results.
Fix this by using a formula based on the code in ath_pkt_duration, which is more likely to be correct for this case.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 + drivers/net/wireless/ath/ath9k/main.c | 1 + drivers/net/wireless/ath/ath9k/xmit.c | 73 +++++++++++++++++++------------- 3 files changed, 46 insertions(+), 30 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +2 -0
@@ -298,6 +298,7 @@ struct ath_tx {struct ath_descdma txdma;struct ath_txq *txq_map[WME_NUM_AC ];u32 txq_max_pending[WME_NUM_AC ]; +u16 max_aggr_framelen[WME_NUM_AC ][4 ][32 ]; };struct ath_rx_edma {
@@ -342,6 +343,7 @@ int ath_tx_init(struct ath_softc *sc, int nbufs);void ath_tx_cleanup (struct ath_softc *sc);int ath_txq_update (struct ath_softc *sc,int qnum,struct ath9k_tx_queue_info *q); +void ath_update_max_aggr_framelen (struct ath_softc *sc,int queue,int txop);int ath_tx_start (struct ieee80211_hw *hw,struct sk_buff *skb,struct ath_tx_control *txctl);void ath_tx_tasklet (struct ath_softc *sc);
drivers/net/wireless/ath/ath9k/main.c +1 -0
@@ -1384,6 +1384,7 @@ static int ath9k_conf_tx(struct ieee80211_hw *hw, queue, txq->axq_qnum, params->aifs, params->cw_min, params->cw_max, params->txop); +ath_update_max_aggr_framelen (sc, queue, qi.tqi_burstTime); ret =ath_txq_update (sc, txq->axq_qnum, &qi);if (ret)ath_err (common,"TXQ Update failed\n" );
drivers/net/wireless/ath/ath9k/xmit.c +43 -30
109 lines not on this page · raw message
Signature · 1 line
1.7.3.2
PATCH v2 9/12 ath9k_hw: apply XPA timing control values from EEPROM
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +23 -0
@@ -3962,9 +3962,32 @@ static void ar9003_hw_txend_to_xpa_off_apply(struct ath_hw *ah, u16 freq) AR_PHY_XPA_TIMING_CTL_TX_END_XPAA_OFF, value); } +static void ar9003_hw_xpa_timing_control_apply (struct ath_hw *ah,bool is_2ghz) +{ +struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; +u8 xpa_ctl; + +if (!(eep->baseEepHeader.featureEnable &0x80 )) +return ; + +if (!AR_SREV_9300 (ah) && !AR_SREV_9340 (ah) && !AR_SREV_9580 (ah)) +return ; + +if (is_2ghz) { + xpa_ctl = eep->modalHeader2G.txFrameToXpaOn; +REG_RMW_FIELD (ah,AR_PHY_XPA_TIMING_CTL , +AR_PHY_XPA_TIMING_CTL_FRAME_XPAB_ON , xpa_ctl); + }else { + xpa_ctl = eep->modalHeader5G.txFrameToXpaOn; +REG_RMW_FIELD (ah,AR_PHY_XPA_TIMING_CTL , +AR_PHY_XPA_TIMING_CTL_FRAME_XPAA_ON , xpa_ctl); + } +} +static void ath9k_hw_ar9300_set_board_values (struct ath_hw *ah,struct ath9k_channel *chan) { +ar9003_hw_xpa_timing_control_apply (ah,IS_CHAN_2GHZ (chan));ar9003_hw_xpa_bias_level_apply (ah,IS_CHAN_2GHZ (chan));ar9003_hw_ant_ctrl_apply (ah,IS_CHAN_2GHZ (chan));ar9003_hw_drive_strength_apply (ah);
Signature · 1 line
1.7.3.2
PATCH v2 10/12 ath9k_hw: clean up AR9003 EEPROM code
- add an inline function for getting the correct modal EEPROM struct
- remove unnecessary indirection through ath9k_hw_ar9300_get_eeprom access the relevant fields directly
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 116 +++++++----------------- drivers/net/wireless/ath/ath9k/eeprom.h | 4 - 2 files changed, 35 insertions(+), 85 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +35 -81
@@ -2971,14 +2971,6 @@ static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah,return (pBase->txrxMask >>4 ) &0xf ;case EEP_RX_MASK :return pBase->txrxMask &0xf ; -case EEP_DRIVE_STRENGTH : -#define AR9300_EEP_BASE_DRIV_STRENGTH 0x1 -return pBase->miscConfiguration &AR9300_EEP_BASE_DRIV_STRENGTH ; -case EEP_INTERNAL_REGULATOR : -/* Bit 4 is internal regulator flag */ -return (pBase->featureEnable &0x10 ) >>4 ; -case EEP_SWREG : -return le32_to_cpu (pBase->swreg);case EEP_PAPRD :return !!(pBase->featureEnable &BIT (5 ));case EEP_CHAIN_MASK_REDUCE :
@@ -2989,8 +2981,6 @@ static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah,return eep->modalHeader5G.antennaGain;case EEP_ANTENNA_GAIN_2G :return eep->modalHeader2G.antennaGain; -case EEP_QUICK_DROP : -return pBase->miscConfiguration &BIT (1 );default :return 0 ; }
@@ -3503,19 +3493,20 @@ static int ath9k_hw_ar9300_get_eeprom_rev(struct ath_hw *ah)return 0 ; } -static s32 ar9003_hw_xpa_bias_level_get (struct ath_hw *ah,bool is2ghz) +static struct ar9300_modal_eep_header *ar9003_modal_header (struct ath_hw *ah, +bool is2ghz) {struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;if (is2ghz) -return eep->modalHeader2G.xpaBiasLvl; +return &eep->modalHeader2G;else -return eep->modalHeader5G.xpaBiasLvl; +return &eep->modalHeader5G; }static void ar9003_hw_xpa_bias_level_apply (struct ath_hw *ah,bool is2ghz) { -int bias =ar9003_hw_xpa_bias_level_get (ah, is2ghz); +int bias =ar9003_modal_header (ah, is2ghz)->xpaBiasLvl;if (AR_SREV_9485 (ah) ||AR_SREV_9330 (ah) ||AR_SREV_9340 (ah))REG_RMW_FIELD (ah,AR_CH0_TOP2 ,AR_CH0_TOP2_XPABIASLVL , bias);
@@ -3531,57 +3522,26 @@ static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz) } } -static u16 ar9003_switch_com_spdt_get (struct ath_hw *ah,bool is_2ghz) +static u16 ar9003_switch_com_spdt_get (struct ath_hw *ah,bool is2ghz) { -struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; -__le16 val; - -if (is_2ghz) - val = eep->modalHeader2G.switchcomspdt; -else - val = eep->modalHeader5G.switchcomspdt; -return le16_to_cpu (val); +return le16_to_cpu (ar9003_modal_header (ah, is2ghz)->switchcomspdt); }static u32 ar9003_hw_ant_ctrl_common_get (struct ath_hw *ah,bool is2ghz) { -struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; -__le32 val; - -if (is2ghz) - val = eep->modalHeader2G.antCtrlCommon; -else - val = eep->modalHeader5G.antCtrlCommon; -return le32_to_cpu (val); +return le32_to_cpu (ar9003_modal_header (ah, is2ghz)->antCtrlCommon); }static u32 ar9003_hw_ant_ctrl_common_2_get (struct ath_hw *ah,bool is2ghz) { -struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; -__le32 val; - -if (is2ghz) - val = eep->modalHeader2G.antCtrlCommon2; -else - val = eep->modalHeader5G.antCtrlCommon2; -return le32_to_cpu (val); +return le32_to_cpu (ar9003_modal_header (ah, is2ghz)->antCtrlCommon2); } -static u16 ar9003_hw_ant_ctrl_chain_get (struct ath_hw *ah, -int chain, +static u16 ar9003_hw_ant_ctrl_chain_get (struct ath_hw *ah,int chain,bool is2ghz) { -struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; -__le16 val =0 ; - -if (chain >=0 && chain <AR9300_MAX_CHAINS ) { -if (is2ghz) - val = eep->modalHeader2G.antCtrlChain[chain]; -else - val = eep->modalHeader5G.antCtrlChain[chain]; - } - +__le16 val =ar9003_modal_header (ah, is2ghz)->antCtrlChain[chain];return le16_to_cpu (val); }
@@ -3691,11 +3651,12 @@ static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz)static void ar9003_hw_drive_strength_apply (struct ath_hw *ah) { +struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; +struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader;int drive_strength;unsigned long reg; - drive_strength =ath9k_hw_ar9300_get_eeprom (ah,EEP_DRIVE_STRENGTH ); - + drive_strength = pBase->miscConfiguration &BIT (0 );if (!drive_strength)return ;
@@ -3825,11 +3786,11 @@ static bool is_pmu_set(struct ath_hw *ah, u32 pmu_reg, int pmu_set)void ar9003_hw_internal_regulator_apply (struct ath_hw *ah) { -int internal_regulator = -ath9k_hw_ar9300_get_eeprom (ah,EEP_INTERNAL_REGULATOR ); +struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; +struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader;u32 reg_val; -if (internal_regulator) { +if (pBase->featureEnable &BIT (4 )) {if (AR_SREV_9330 (ah) ||AR_SREV_9485 (ah)) {int reg_pmu_set;
@@ -3873,11 +3834,11 @@ void ar9003_hw_internal_regulator_apply(struct ath_hw *ah)if (!is_pmu_set (ah,AR_PHY_PMU2 , reg_pmu_set))return ; }else if (AR_SREV_9462 (ah)) { - reg_val =ath9k_hw_ar9300_get_eeprom (ah,EEP_SWREG ); + reg_val =le32_to_cpu (pBase->swreg);REG_WRITE (ah,AR_PHY_PMU1 , reg_val); }else {/* Internal regulator is ON. Write swreg register. */ - reg_val =ath9k_hw_ar9300_get_eeprom (ah,EEP_SWREG ); + reg_val =le32_to_cpu (pBase->swreg);REG_WRITE (ah,AR_RTC_REG_CONTROL1 ,REG_READ (ah,AR_RTC_REG_CONTROL1 ) & (~AR_RTC_REG_CONTROL1_SWREG_PROGRAM ));
@@ -3931,10 +3892,11 @@ static void ar9003_hw_apply_tuning_caps(struct ath_hw *ah)static void ar9003_hw_quick_drop_apply (struct ath_hw *ah,u16 freq) {struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; -int quick_drop =ath9k_hw_ar9300_get_eeprom (ah,EEP_QUICK_DROP ); +struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader; +int quick_drop;s32 t[3 ], f[3 ] = {5180 ,5500 ,5785 }; -if (!quick_drop) +if (!(pBase->miscConfiguration &BIT (1 )))return ;if (freq <4000 )
@@ -3948,13 +3910,11 @@ static void ar9003_hw_quick_drop_apply(struct ath_hw *ah, u16 freq)REG_RMW_FIELD (ah,AR_PHY_AGC ,AR_PHY_AGC_QUICK_DROP , quick_drop); } -static void ar9003_hw_txend_to_xpa_off_apply (struct ath_hw *ah,u16 freq) +static void ar9003_hw_txend_to_xpa_off_apply (struct ath_hw *ah,bool is2ghz) { -struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;u32 value; - value = (freq <4000 ) ? eep->modalHeader2G.txEndToXpaOff : - eep->modalHeader5G.txEndToXpaOff; + value =ar9003_modal_header (ah, is2ghz)->txEndToXpaOff;REG_RMW_FIELD (ah,AR_PHY_XPA_TIMING_CTL ,AR_PHY_XPA_TIMING_CTL_TX_END_XPAB_OFF , value);
@@ -3962,7 +3922,7 @@ static void ar9003_hw_txend_to_xpa_off_apply(struct ath_hw *ah, u16 freq) AR_PHY_XPA_TIMING_CTL_TX_END_XPAA_OFF, value); } -static void ar9003_hw_xpa_timing_control_apply (struct ath_hw *ah,bool is_2ghz) +static void ar9003_hw_xpa_timing_control_apply (struct ath_hw *ah,bool is2ghz) {struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;u8 xpa_ctl;
@@ -3973,23 +3933,22 @@ static void ar9003_hw_xpa_timing_control_apply(struct ath_hw *ah, bool is_2ghz)if (!AR_SREV_9300 (ah) && !AR_SREV_9340 (ah) && !AR_SREV_9580 (ah))return ; -if (is_2ghz) { - xpa_ctl = eep->modalHeader2G.txFrameToXpaOn; + xpa_ctl =ar9003_modal_header (ah, is2ghz)->txFrameToXpaOn; +if (is2ghz)REG_RMW_FIELD (ah,AR_PHY_XPA_TIMING_CTL ,AR_PHY_XPA_TIMING_CTL_FRAME_XPAB_ON , xpa_ctl); - }else { - xpa_ctl = eep->modalHeader5G.txFrameToXpaOn; +else REG_RMW_FIELD (ah,AR_PHY_XPA_TIMING_CTL ,AR_PHY_XPA_TIMING_CTL_FRAME_XPAA_ON , xpa_ctl); - } }static void ath9k_hw_ar9300_set_board_values (struct ath_hw *ah,struct ath9k_channel *chan) { -ar9003_hw_xpa_timing_control_apply (ah,IS_CHAN_2GHZ (chan)); -ar9003_hw_xpa_bias_level_apply (ah,IS_CHAN_2GHZ (chan)); -ar9003_hw_ant_ctrl_apply (ah,IS_CHAN_2GHZ (chan)); +bool is2ghz =IS_CHAN_2GHZ (chan); +ar9003_hw_xpa_timing_control_apply (ah, is2ghz); +ar9003_hw_xpa_bias_level_apply (ah, is2ghz); +ar9003_hw_ant_ctrl_apply (ah, is2ghz);ar9003_hw_drive_strength_apply (ah);ar9003_hw_atten_apply (ah, chan);ar9003_hw_quick_drop_apply (ah, chan->channel);
@@ -3997,7 +3956,7 @@ static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah,ar9003_hw_internal_regulator_apply (ah);if (AR_SREV_9485 (ah) ||AR_SREV_9330 (ah) ||AR_SREV_9340 (ah))ar9003_hw_apply_tuning_caps (ah); -ar9003_hw_txend_to_xpa_off_apply (ah, chan->channel); +ar9003_hw_txend_to_xpa_off_apply (ah, is2ghz); } static void ath9k_hw_ar9300_set_addac(struct ath_hw *ah,
@@ -5133,14 +5092,9 @@ s32 ar9003_hw_get_rx_gain_idx(struct ath_hw *ah)return (eep->baseEepHeader.txrxgain) &0xf ;/* bits 3:0 */ } -u8 *ar9003_get_spur_chan_ptr (struct ath_hw *ah,bool is_2ghz) +u8 *ar9003_get_spur_chan_ptr (struct ath_hw *ah,bool is2ghz) { -struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - -if (is_2ghz) -return eep->modalHeader2G.spurChans; -else -return eep->modalHeader5G.spurChans; +return ar9003_modal_header (ah, is2ghz)->spurChans; } unsigned int ar9003_get_paprd_scale_factor(struct ath_hw *ah,
drivers/net/wireless/ath/ath9k/eeprom.h +0 -4
@@ -241,16 +241,12 @@ enum eeprom_param {EEP_TEMPSENSE_SLOPE ,EEP_TEMPSENSE_SLOPE_PAL_ON ,EEP_PWR_TABLE_OFFSET , -EEP_DRIVE_STRENGTH , -EEP_INTERNAL_REGULATOR , -EEP_SWREG ,EEP_PAPRD ,EEP_MODAL_VER ,EEP_ANT_DIV_CTL1 ,EEP_CHAIN_MASK_REDUCE ,EEP_ANTENNA_GAIN_2G , EEP_ANTENNA_GAIN_5G, -EEP_QUICK_DROP }; enum ar5416_rates {
Signature · 1 line
1.7.3.2
PATCH v2 11/12 ath9k_hw: apply XLNA bias settings from EEPROM
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 53 +++++++++++++++++++---- drivers/net/wireless/ath/ath9k/ar9003_eeprom.h | 3 +- drivers/net/wireless/ath/ath9k/ar9003_phy.h | 5 ++ 3 files changed, 50 insertions(+), 11 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +43 -10
@@ -131,8 +131,9 @@ static const struct ar9300_eeprom ar9300_default = { .thresh62 = 28, .papdRateMaskHt20 = LE32(0x0cf0e0e0), .papdRateMaskHt40 = LE32(0x6cf0e0e0), + .xlna_bias_strength = 0, .futureModal = { -0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 ,0 ,0 ,0 , }, }, .base_ext1 = {
@@ -331,8 +332,9 @@ static const struct ar9300_eeprom ar9300_default = { .thresh62 = 28, .papdRateMaskHt20 = LE32(0x0c80c080), .papdRateMaskHt40 = LE32(0x0080c080), + .xlna_bias_strength = 0, .futureModal = { -0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 ,0 ,0 ,0 , }, }, .base_ext2 = {
@@ -704,8 +706,9 @@ static const struct ar9300_eeprom ar9300_x113 = { .thresh62 = 28, .papdRateMaskHt20 = LE32(0x0c80c080), .papdRateMaskHt40 = LE32(0x0080c080), + .xlna_bias_strength = 0, .futureModal = { - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, }, }, .base_ext1 = {
@@ -904,8 +907,9 @@ static const struct ar9300_eeprom ar9300_x113 = { .thresh62 = 28, .papdRateMaskHt20 = LE32(0x0cf0e0e0), .papdRateMaskHt40 = LE32(0x6cf0e0e0), + .xlna_bias_strength = 0, .futureModal = { -0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 ,0 ,0 ,0 , }, }, .base_ext2 = {
@@ -1278,8 +1282,9 @@ static const struct ar9300_eeprom ar9300_h112 = { .thresh62 = 28, .papdRateMaskHt20 = LE32(0x0c80c080), .papdRateMaskHt40 = LE32(0x0080c080), + .xlna_bias_strength = 0, .futureModal = { -0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 ,0 ,0 ,0 , }, }, .base_ext1 = {
@@ -1478,8 +1483,9 @@ static const struct ar9300_eeprom ar9300_h112 = { .thresh62 = 28, .papdRateMaskHt20 = LE32(0x0cf0e0e0), .papdRateMaskHt40 = LE32(0x6cf0e0e0), + .xlna_bias_strength = 0, .futureModal = { -0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 ,0 ,0 ,0 , }, }, .base_ext2 = {
@@ -1852,8 +1858,9 @@ static const struct ar9300_eeprom ar9300_x112 = { .thresh62 = 28, .papdRateMaskHt20 = LE32(0x0c80c080), .papdRateMaskHt40 = LE32(0x0080c080), + .xlna_bias_strength = 0, .futureModal = { -0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 ,0 ,0 ,0 , }, }, .base_ext1 = {
@@ -2052,8 +2059,9 @@ static const struct ar9300_eeprom ar9300_x112 = { .thresh62 = 28, .papdRateMaskHt20 = LE32(0x0cf0e0e0), .papdRateMaskHt40 = LE32(0x6cf0e0e0), + .xlna_bias_strength = 0, .futureModal = { -0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 ,0 ,0 ,0 , }, }, .base_ext2 = {
@@ -2425,8 +2433,9 @@ static const struct ar9300_eeprom ar9300_h116 = { .thresh62 = 28, .papdRateMaskHt20 = LE32(0x0c80C080), .papdRateMaskHt40 = LE32(0x0080C080), + .xlna_bias_strength = 0, .futureModal = { - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, }, }, .base_ext1 = {
@@ -2625,8 +2634,9 @@ static const struct ar9300_eeprom ar9300_h116 = { .thresh62 = 28, .papdRateMaskHt20 = LE32(0x0cf0e0e0), .papdRateMaskHt40 = LE32(0x6cf0e0e0), + .xlna_bias_strength = 0, .futureModal = { -0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 ,0 ,0 ,0 , }, }, .base_ext2 = {
@@ -3942,6 +3952,28 @@ static void ar9003_hw_xpa_timing_control_apply(struct ath_hw *ah, bool is2ghz) AR_PHY_XPA_TIMING_CTL_FRAME_XPAA_ON, xpa_ctl); } +static void ar9003_hw_xlna_bias_strength_apply (struct ath_hw *ah,bool is2ghz) +{ +struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; +u8 bias; + +if (!(eep->baseEepHeader.featureEnable &0x40 )) +return ; + +if (!AR_SREV_9300 (ah)) +return ; + + bias =ar9003_modal_header (ah, is2ghz)->xlna_bias_strength; +REG_RMW_FIELD (ah,AR_PHY_65NM_CH0_RXTX4 ,AR_PHY_65NM_RXTX4_XLNA_BIAS , + bias &0x3 ); + bias >>=2 ; +REG_RMW_FIELD (ah,AR_PHY_65NM_CH1_RXTX4 ,AR_PHY_65NM_RXTX4_XLNA_BIAS , + bias &0x3 ); + bias >>=2 ; +REG_RMW_FIELD (ah,AR_PHY_65NM_CH2_RXTX4 ,AR_PHY_65NM_RXTX4_XLNA_BIAS , + bias &0x3 ); +} +static void ath9k_hw_ar9300_set_board_values (struct ath_hw *ah,struct ath9k_channel *chan) {
@@ -3950,6 +3982,7 @@ static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah,ar9003_hw_xpa_bias_level_apply (ah, is2ghz);ar9003_hw_ant_ctrl_apply (ah, is2ghz);ar9003_hw_drive_strength_apply (ah); +ar9003_hw_xlna_bias_strength_apply (ah, is2ghz);ar9003_hw_atten_apply (ah, chan);ar9003_hw_quick_drop_apply (ah, chan->channel);if (!AR_SREV_9330 (ah) && !AR_SREV_9340 (ah) && !AR_SREV_9550 (ah))
drivers/net/wireless/ath/ath9k/ar9003_eeprom.h +2 -1
@@ -231,7 +231,8 @@ struct ar9300_modal_eep_header {__le32 papdRateMaskHt20;__le32 papdRateMaskHt40;__le16 switchcomspdt; -u8 futureModal[8 ]; +u8 xlna_bias_strength; +u8 futureModal[7 ]; } __packed;struct ar9300_cal_data_per_freq_op_loop {
drivers/net/wireless/ath/ath9k/ar9003_phy.h +5 -0
@@ -633,6 +633,8 @@#define AR_PHY_65NM_CH0_BIAS2 0x160c4#define AR_PHY_65NM_CH0_BIAS4 0x160cc#define AR_PHY_65NM_CH0_RXTX4 0x1610c +#define AR_PHY_65NM_CH1_RXTX4 0x1650c +#define AR_PHY_65NM_CH2_RXTX4 0x1690c#define AR_CH0_TOP (AR_SREV_9300(ah) ? 0x16288 : \ ((AR_SREV_9462(ah) ? 0x1628c : 0x16280)))
@@ -876,6 +878,9 @@#define AR_PHY_65NM_CH0_RXTX4_THERM_ON 0x10000000#define AR_PHY_65NM_CH0_RXTX4_THERM_ON_S 28 +#define AR_PHY_65NM_RXTX4_XLNA_BIAS 0xC0000000 +#define AR_PHY_65NM_RXTX4_XLNA_BIAS_S 30 +/* * Channel 1 Register Map */
Signature · 1 line
1.7.3.2
PATCH v2 12/12 ath9k_hw: fix SREV checks for applying tuning caps from EEPROM
AR9485, AR9330 and AR9340 are the chips that this is *NOT* supposed to be applied on.
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +4 -2
@@ -3890,6 +3890,9 @@ static void ar9003_hw_apply_tuning_caps(struct ath_hw *ah)struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;u8 tuning_caps_param = eep->baseEepHeader.params_for_tuning_caps[0 ]; +if (AR_SREV_9485 (ah) ||AR_SREV_9330 (ah) ||AR_SREV_9340 (ah)) +return ; +if (eep->baseEepHeader.featureEnable &0x40 ) { tuning_caps_param &=0x7f ; REG_RMW_FIELD(ah, AR_CH0_XTAL, AR_CH0_XTAL_CAPINDAC,
@@ -3987,8 +3990,7 @@ static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah,ar9003_hw_quick_drop_apply (ah, chan->channel);if (!AR_SREV_9330 (ah) && !AR_SREV_9340 (ah) && !AR_SREV_9550 (ah))ar9003_hw_internal_regulator_apply (ah); -if (AR_SREV_9485 (ah) ||AR_SREV_9330 (ah) ||AR_SREV_9340 (ah)) -ar9003_hw_apply_tuning_caps (ah); +ar9003_hw_apply_tuning_caps (ah);ar9003_hw_txend_to_xpa_off_apply (ah, is2ghz); }
Signature · 1 line
1.7.3.2
PATCH v2 8/12 ath9k: fix aggregate size limit based on queue TXOP limit
In reply to Felix Fietkaudrivers/net/wireless/ath/ath9k/main.c static int ath9k_conf_tx(struct ieee80211_hw *hw, · line 1390
Quoted 8 lines · Felix Fietkau
drivers/net/wireless/ath/ath9k/main.c +1
-0@@ -1384,6 +1384,7 @@ static int ath9k_conf_tx(struct ieee80211_hw *hw, queue, txq->axq_qnum, params->aifs, params->cw_min, params->cw_max, params->txop); +ath_update_max_aggr_framelen (sc, queue, qi.tqi_burstTime); ret =ath_txq_update (sc, txq->axq_qnum, &qi);if (ret)ath_err (common,"TXQ Update failed\n" );
Wouldn't this break multi-interface operation ? This unconditionally updates the aggr. limits of an existing interface when a new one is added.
Sujith
Re: [PATCH v2 08/12] ath9k: fix aggregate size limit based on queue TXOP limit
Quoted 5 lines · Sujith Manoharan
Quoted 4 lines · Felix Fietkau
drivers/net/wireless/ath/ath9k/main.c +0
-0@@ -1384,6 +1384,7 @@ static int ath9k_conf_tx(struct ieee80211_hw *hw, queue, txq->axq_qnum, params->aifs, params->cw_min, params->cw_max, params->txop);
Quoted 7 lines
drivers/net/wireless/ath/ath9k/main.c static int ath9k_conf_tx(struct ieee80211_hw *hw, · line 1390
Quoted 4 lines
drivers/net/wireless/ath/ath9k/main.c +1
-0+ath_update_max_aggr_framelen (sc, queue, qi.tqi_burstTime); ret =ath_txq_update (sc, txq->axq_qnum, &qi);if (ret)ath_err (common,"TXQ Update failed\n" );Wouldn't this break multi-interface operation ? This unconditionally updates the aggr. limits of an existing interface when a new one is added.
No, this doesn't break multi-interface. TXOP limit (like other WMM settings) can only be configured per-wiphy, so the max. aggregation lengths are per-wiphy as well.
- Felix
RE: [PATCH v2 08/12] ath9k: fix aggregate size limit based on queue TXOP limit
I believe mac80211 has a per-VIF idea of queue parameters (tx_conf in struct ieee80211_sub_if_data). And we end up overwriting the parameters of the main interface. For example,
* Bringing up an AP interface:
ath: phy0: Configure tx [queue/halq] [0/0], aifs: 1, cw_min: 3, cw_max: 7, txop: 47
ath: phy0: Configure tx [queue/halq] [1/1], aifs: 1, cw_min: 7, cw_max: 15, txop: 94
ath: phy0: Configure tx [queue/halq] [2/2], aifs: 3, cw_min: 15, cw_max: 63, txop: 0
ath: phy0: Configure tx [queue/halq] [3/3], aifs: 7, cw_min: 15, cw_max: 1023, txop: 0
* Adding a new station interface (but not associated yet):
ath: phy0: Attach a VIF of type: 2
ath: phy0: Configure tx [queue/halq] [0/0], aifs: 2, cw_min: 31, cw_max: 1023, txop: 0
ath: phy0: Configure tx [queue/halq] [1/1], aifs: 2, cw_min: 31, cw_max: 1023, txop: 0
ath: phy0: Configure tx [queue/halq] [2/2], aifs: 2, cw_min: 31, cw_max: 1023, txop: 0
ath: phy0: Configure tx [queue/halq] [3/3], aifs: 2, cw_min: 31, cw_max: 1023, txop: 0
Sujith
________________________________________
From: Felix Fietkau [[email protected]]
Sent: Saturday, July 14, 2012 3:32 PM
To: Manoharan, Sujith
Cc: [email protected]; [email protected]; Rodriguez, Luis
Subject: Re: [PATCH v2 08/12] ath9k: fix aggregate size limit based on queue TXOP limit
Quoted 5 lines · Sujith Manoharan
Quoted 4 lines · Felix Fietkau
drivers/net/wireless/ath/ath9k/main.c +0
-0@@ -1384,6 +1384,7 @@ static int ath9k_conf_tx(struct ieee80211_hw *hw, queue, txq->axq_qnum, params->aifs, params->cw_min, params->cw_max, params->txop);
Quoted 7 lines
drivers/net/wireless/ath/ath9k/main.c static int ath9k_conf_tx(struct ieee80211_hw *hw, · line 1390
Quoted 4 lines
drivers/net/wireless/ath/ath9k/main.c +1
-0+ath_update_max_aggr_framelen (sc, queue, qi.tqi_burstTime); ret =ath_txq_update (sc, txq->axq_qnum, &qi);if (ret)ath_err (common,"TXQ Update failed\n" );Wouldn't this break multi-interface operation ? This unconditionally updates the aggr. limits of an existing interface when a new one is added.
No, this doesn't break multi-interface. TXOP limit (like other WMM settings) can only be configured per-wiphy, so the max. aggregation lengths are per-wiphy as well.
- Felix
Re: [PATCH v2 08/12] ath9k: fix aggregate size limit based on queue TXOP limit
Quoted 10 lines · Sujith
I believe mac80211 has a per-VIF idea of queue parameters (
tx_confin structieee80211_sub_if_data). And we end up overwriting the parameters of the main interface. For example,* Bringing up an AP interface:
ath: phy0: Configure tx [queue/halq] [0/0], aifs: 1,
cw_min: 3,cw_max: 7, txop: 47
ath: phy0: Configure tx [queue/halq] [1/1], aifs: 1,cw_min: 7,cw_max: 15, txop: 94
ath: phy0: Configure tx [queue/halq] [2/2], aifs: 3,cw_min: 15,cw_max: 63, txop: 0
ath: phy0: Configure tx [queue/halq] [3/3], aifs: 7,cw_min: 15,cw_max: 1023, txop: 0
Quoted 8 lines
* Adding a new station interface (but not associated yet):
ath: phy0: Attach a VIF of type: 2
ath: phy0: Configure tx [queue/halq] [0/0], aifs: 2,
cw_min: 31,cw_max: 1023, txop: 0
ath: phy0: Configure tx [queue/halq] [1/1], aifs: 2,cw_min: 31,cw_max: 1023, txop: 0
ath: phy0: Configure tx [queue/halq] [2/2], aifs: 2,cw_min: 31,cw_max: 1023, txop: 0
ath: phy0: Configure tx [queue/halq] [3/3], aifs: 2,cw_min: 31,cw_max: 1023, txop: 0
Yes, but ath9k only has global queue settings, not per-vif ones, so I'm not sure what can be done about the issue of overwriting queue settings.
Either way, it's important for the aggregation limit to be in sync with the hardware queue TXOP limit, so I believe this patch is correct.
- Felix
Re: [PATCH v2 08/12] ath9k: fix aggregate size limit based on queue TXOP limit
Quoted 2 lines · Felix Fietkau
Yes, but ath9k only has global queue settings, not per-vif ones, so I'm not sure what can be done about the issue of overwriting queue settings.
Yeah, me neither.
Quoted 2 lines
Either way, it's important for the aggregation limit to be in sync with the hardware queue TXOP limit, so I believe this patch is correct.
Except that earlier it was a global, static table. I am curious, which part of the standard deals with limiting AMPDU size based on txop ? I searched a bit and got lost.
Sujith
Re: [PATCH v2 08/12] ath9k: fix aggregate size limit based on queue TXOP limit
Quoted 4 lines · Sujith Manoharan
Quoted 2 lines · Felix Fietkau
Yes, but ath9k only has global queue settings, not per-vif ones, so I'm not sure what can be done about the issue of overwriting queue settings.
Quoted 8 lines
Yeah, me neither.
Quoted 2 lines
Either way, it's important for the aggregation limit to be in sync with the hardware queue TXOP limit, so I believe this patch is correct.
Except that earlier it was a global, static table. I am curious, which part of the standard deals with limiting AMPDU size based on txop ? I searched a bit and got lost.
The standard does not say anything specifically about A-MPDU, but it does say this:
When the TXOP limit is nonzero, a STA shall fragment an individually addressed MSDU so that the transmission of the first MPDU of the TXOP does not cause the TXOP limit to be exceeded at the PHY rate selected for the initial transmission attempt of that MPDU. The TXOP limit may be exceeded, when using a lower PHY rate than selected for the initial transmission attempt of the first MPDU, for a retransmission of an MPDU, for the initial transmission of an MPDU if any previous MPDU in the current MSDU has been retransmitted, or for group addressed MSDUs. When the TXOP limit is exceeded due to the retransmission of an MPDU at a reduced PHY rate, the STA shall not transmit more than one MPDU in the TXOP.
Since 3 ms for VI (default) is still a lot and this queue is meant to have lower latency compared to BE/BK, I decided to not add any special rules to treat retransmissions differently.
I'm not sure if it's absolutely required to reduce the A-MPDU transmission duration here, but even if it isn't, it's still a good idea for reducing latency, and it does look like it reduces the amount of retransmissions under load.
The only other queue that has a TXOP limit set by default is the VO queue, but that one can be ignored since it doesn't do aggregation.
- Felix
Re: [PATCH v2 08/12] ath9k: fix aggregate size limit based on queue TXOP limit
Quoted 13 lines · Felix Fietkau
The standard does not say anything specifically about A-MPDU, but it does say this:
When the TXOP limit is nonzero, a STA shall fragment an individually addressed MSDU so that the transmission of the first MPDU of the TXOP does not cause the TXOP limit to be exceeded at the PHY rate selected for the initial transmission attempt of that MPDU. The TXOP limit may be exceeded, when using a lower PHY rate than selected for the initial transmission attempt of the first MPDU, for a retransmission of an MPDU, for the initial transmission of an MPDU if any previous MPDU in the current MSDU has been retransmitted, or for group addressed MSDUs. When the TXOP limit is exceeded due to the retransmission of an MPDU at a reduced PHY rate, the STA shall not transmit more than one MPDU in the TXOP.
Um, am not sure how this passage relates to number of subframe calculation in an aggregate ?
Sujith
Re: [PATCH v2 08/12] ath9k: fix aggregate size limit based on queue TXOP limit
Quoted 15 lines · Sujith Manoharan
Quoted 13 lines · Felix Fietkau
The standard does not say anything specifically about A-MPDU, but it does say this:
When the TXOP limit is nonzero, a STA shall fragment an individually addressed MSDU so that the transmission of the first MPDU of the TXOP does not cause the TXOP limit to be exceeded at the PHY rate selected for the initial transmission attempt of that MPDU. The TXOP limit may be exceeded, when using a lower PHY rate than selected for the initial transmission attempt of the first MPDU, for a retransmission of an MPDU, for the initial transmission of an MPDU if any previous MPDU in the current MSDU has been retransmitted, or for group addressed MSDUs. When the TXOP limit is exceeded due to the retransmission of an MPDU at a reduced PHY rate, the STA shall not transmit more than one MPDU in the TXOP.
Quoted 2 lines
Um, am not sure how this passage relates to number of subframe calculation in an aggregate ?
The way I understand this, the TXOP limit is meant to limit the duration of a single transmission on the channel. An aggregate is transmitted in one go, there's no SIFS or extra PHY headers inbetween, just short delimiters. So an A-MPDU should be treated pretty much like an MPDU here, its transmission duration should not exceed the TXOP limit.
- Felix
Re: [PATCH v2 08/12] ath9k: fix aggregate size limit based on queue TXOP limit
Quoted 5 lines · Felix Fietkau
The way I understand this, the TXOP limit is meant to limit the duration of a single transmission on the channel. An aggregate is transmitted in one go, there's no SIFS or extra PHY headers inbetween, just short delimiters. So an A-MPDU should be treated pretty much like an MPDU here, its transmission duration should not exceed the TXOP limit.
Yeah, makes sense.
But we need to handle multiple interfaces, otherwise this would break modes like P2P. For example, bring up a P2P-GO and setup a HT20 network, and then bring up a new station interface - this would unconditionally update the aggr. limits of the existing network. This wasn't the case earlier since the limits were being maintained globally and were common to all interfaces and addition/removal of new interfaces would not change the aggr. limits.
Sujith
Re: [PATCH v2 08/12] ath9k: fix aggregate size limit based on queue TXOP limit
Quoted 7 lines · Sujith Manoharan
Quoted 5 lines · Felix Fietkau
The way I understand this, the TXOP limit is meant to limit the duration of a single transmission on the channel. An aggregate is transmitted in one go, there's no SIFS or extra PHY headers inbetween, just short delimiters. So an A-MPDU should be treated pretty much like an MPDU here, its transmission duration should not exceed the TXOP limit.
Quoted 8 lines
Yeah, makes sense.
But we need to handle multiple interfaces, otherwise this would break modes like P2P. For example, bring up a P2P-GO and setup a HT20 network, and then bring up a new station interface - this would unconditionally update the aggr. limits of the existing network. This wasn't the case earlier since the limits were being maintained globally and were common to all interfaces and addition/removal of new interfaces would not change the aggr. limits.
Before my patch, the aggr limits were always broken for the VI queue. Now they're just sometimes broken :)
- Felix
Re: [PATCH v2 05/12] ath9k_hw: remove redundant arguments to INIT_INI_ARRAY
In reply to Felix FietkauQuoted 3 lines · Felix Fietkau
The row/column sizes can be derived from the array argument within the macro itself, which is less error prone. In a few cases the supplied column size was actually wrong.
This patch no longer applies since Mohammed Shafi's WoW work was merged. I'll send a v3.
- Felix