ath9k: initialize tx chainmask before testing channel tx power values
PATCH 1/4 ath9k: initialize tx chainmask before testing channel tx power values
With an uninitialized chainmask, the per-channel power will only contain the power limits for a single chain instead of the combined tx power.
--- drivers/net/wireless/ath/ath9k/init.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/init.c +2 -0
@@ -669,8 +669,10 @@ static void ath9k_init_band_txpower(struct ath_softc *sc, int band)static void ath9k_init_txpower_limits (struct ath_softc *sc) {struct ath_hw *ah = sc->sc_ah; +struct ath_common *common =ath9k_hw_common (sc->sc_ah);struct ath9k_channel *curchan = ah->curchan; + ah->txchainmask = common->tx_chainmask;if (ah->caps.hw_caps &ATH9K_HW_CAP_2GHZ )ath9k_init_band_txpower (sc,IEEE80211_BAND_2GHZ );if (ah->caps.hw_caps &ATH9K_HW_CAP_5GHZ )
Signature · 1 line
1.7.3.2
PATCH 2/4 ath9k_hw: remove the tx power index offset
It is always 0
--- drivers/net/wireless/ath/ath9k/eeprom_4k.c | 9 ++------- drivers/net/wireless/ath/ath9k/eeprom_9287.c | 9 ++------- drivers/net/wireless/ath/ath9k/eeprom_def.c | 8 ++------ 3 files changed, 6 insertions(+), 20 deletions(-)
drivers/net/wireless/ath/ath9k/eeprom_4k.c +2 -7
@@ -248,8 +248,7 @@ static u32 ath9k_hw_4k_get_eeprom(struct ath_hw *ah, }static void ath9k_hw_set_4k_power_cal_table (struct ath_hw *ah, -struct ath9k_channel *chan, -int16_t *pTxPowerIndexOffset) +struct ath9k_channel *chan) {struct ath_common *common =ath9k_hw_common (ah);struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k;
@@ -356,8 +355,6 @@ static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah,REGWRITE_BUFFER_FLUSH (ah); } } - - *pTxPowerIndexOffset =0 ; } static void ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah,
@@ -580,7 +577,6 @@ static void ath9k_hw_4k_set_txpower(struct ath_hw *ah,struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k;struct modal_eep_4k_header *pModal = &pEepData->modalHeader;int16_t ratesArray[Ar5416RateSize]; -int16_t txPowerIndexOffset =0 ;u8 ht40PowerIncForPdadc =2 ;int i;
@@ -597,11 +593,10 @@ static void ath9k_hw_4k_set_txpower(struct ath_hw *ah, twiceMaxRegulatoryPower, powerLimit); -ath9k_hw_set_4k_power_cal_table (ah, chan, &txPowerIndexOffset); +ath9k_hw_set_4k_power_cal_table (ah, chan); regulatory->max_power_level =0 ;for (i =0 ; i <ARRAY_SIZE (ratesArray); i++) { - ratesArray[i] = (int16_t )(txPowerIndexOffset + ratesArray[i]);if (ratesArray[i] >MAX_RATE_POWER ) ratesArray[i] =MAX_RATE_POWER ;
drivers/net/wireless/ath/ath9k/eeprom_9287.c +2 -7
@@ -307,8 +307,7 @@ static void ar9287_eeprom_olpc_set_pdadcs(struct ath_hw *ah, }static void ath9k_hw_set_ar9287_power_cal_table (struct ath_hw *ah, -struct ath9k_channel *chan, -int16_t *pTxPowerIndexOffset) +struct ath9k_channel *chan) {struct cal_data_per_freq_ar9287 *pRawDataset;struct cal_data_op_loop_ar9287 *pRawDatasetOpenLoop;
@@ -444,8 +443,6 @@ static void ath9k_hw_set_ar9287_power_cal_table(struct ath_hw *ah,REGWRITE_BUFFER_FLUSH (ah); } } - - *pTxPowerIndexOffset =0 ; } static void ath9k_hw_set_ar9287_power_per_rate_table(struct ath_hw *ah,
@@ -720,7 +717,6 @@ static void ath9k_hw_ar9287_set_txpower(struct ath_hw *ah,struct ar9287_eeprom *pEepData = &ah->eeprom.map9287;struct modal_eep_ar9287_header *pModal = &pEepData->modalHeader;int16_t ratesArray[Ar5416RateSize]; -int16_t txPowerIndexOffset =0 ;u8 ht40PowerIncForPdadc =2 ;int i;
@@ -736,11 +732,10 @@ static void ath9k_hw_ar9287_set_txpower(struct ath_hw *ah, twiceMaxRegulatoryPower, powerLimit); -ath9k_hw_set_ar9287_power_cal_table (ah, chan, &txPowerIndexOffset); +ath9k_hw_set_ar9287_power_cal_table (ah, chan); regulatory->max_power_level =0 ;for (i =0 ; i <ARRAY_SIZE (ratesArray); i++) { - ratesArray[i] = (int16_t )(txPowerIndexOffset + ratesArray[i]);if (ratesArray[i] >MAX_RATE_POWER ) ratesArray[i] =MAX_RATE_POWER ;
drivers/net/wireless/ath/ath9k/eeprom_def.c +2 -6
@@ -693,8 +693,7 @@ static void ath9k_adjust_pdadc_values(struct ath_hw *ah, }static void ath9k_hw_set_def_power_cal_table (struct ath_hw *ah, -struct ath9k_channel *chan, -int16_t *pTxPowerIndexOffset) +struct ath9k_channel *chan) {#define SM_PD_GAIN (x) SM(0x38, AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_##x)#define SM_PDGAIN_B (x, y) \
@@ -855,7 +854,6 @@ static void ath9k_hw_set_def_power_cal_table(struct ath_hw *ah, } } - *pTxPowerIndexOffset =0 ;#undef SM_PD_GAIN#undef SM_PDGAIN_B }
@@ -1143,7 +1141,6 @@ static void ath9k_hw_def_set_txpower(struct ath_hw *ah,struct modal_eep_header *pModal = &(pEepData->modalHeader[IS_CHAN_2GHZ (chan)]);int16_t ratesArray[Ar5416RateSize]; -int16_t txPowerIndexOffset =0 ;u8 ht40PowerIncForPdadc =2 ;int i, cck_ofdm_delta =0 ;
@@ -1160,11 +1157,10 @@ static void ath9k_hw_def_set_txpower(struct ath_hw *ah, twiceMaxRegulatoryPower, powerLimit); -ath9k_hw_set_def_power_cal_table (ah, chan, &txPowerIndexOffset); +ath9k_hw_set_def_power_cal_table (ah, chan); regulatory->max_power_level =0 ;for (i =0 ; i <ARRAY_SIZE (ratesArray); i++) { - ratesArray[i] = (int16_t )(txPowerIndexOffset + ratesArray[i]);if (ratesArray[i] >MAX_RATE_POWER ) ratesArray[i] =MAX_RATE_POWER ;if (ratesArray[i] > regulatory->max_power_level)
Signature · 1 line
1.7.3.2
PATCH 3/4 ath9k_hw: fix calculated runtime tx power limit
Use the previously calculated maximum of all rates instead of just the one from the lowest rate of the selected PHY mode.
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 20 +------------------- drivers/net/wireless/ath/ath9k/eeprom_4k.c | 9 --------- drivers/net/wireless/ath/ath9k/eeprom_9287.c | 7 ------- drivers/net/wireless/ath/ath9k/eeprom_def.c | 11 ----------- 4 files changed, 1 insertions(+), 46 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +1 -19
@@ -4922,25 +4922,7 @@ static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah, "TPC[%02d] 0x%08x\n", i, targetPowerValT2[i]); } -/* -* This is the TX power we send back to driver core, -* and it can use to pass to userspace to display our -* currently configured TX power setting. -* -* Since power is rate dependent, use one of the indices -* from the AR9300_Rates enum to select an entry from -* targetPowerValT2[] to report. Currently returns the -* power for HT40 MCS 0, HT20 MCS 0, or OFDM 6 Mbps -* as CCK power is less interesting (?). -*/ - i =ALL_TARGET_LEGACY_6_24 ;/* legacy */ -if (IS_CHAN_HT40 (chan)) - i =ALL_TARGET_HT40_0_8_16 ;/* ht40 */ -else if (IS_CHAN_HT20 (chan)) - i =ALL_TARGET_HT20_0_8_16 ;/* ht20 */ - - ah->txpower_limit = targetPowerValT2[i]; - regulatory->max_power_level = targetPowerValT2[i]; + ah->txpower_limit = regulatory->max_power_level;/* Write target power array to registers */ ar9003_hw_tx_power_regwrite (ah, targetPowerValT2);
drivers/net/wireless/ath/ath9k/eeprom_4k.c +0 -9
@@ -607,15 +607,6 @@ static void ath9k_hw_4k_set_txpower(struct ath_hw *ah,if (test)return ; -/* Update regulatory */ - i = rate6mb; -if (IS_CHAN_HT40 (chan)) - i = rateHt40_0; -else if (IS_CHAN_HT20 (chan)) - i = rateHt20_0; - - regulatory->max_power_level = ratesArray[i]; -if (AR_SREV_9280_20_OR_LATER (ah)) {for (i =0 ; i < Ar5416RateSize; i++) ratesArray[i] -=AR5416_PWR_TABLE_OFFSET_DB *2 ;
drivers/net/wireless/ath/ath9k/eeprom_9287.c +0 -7
@@ -746,13 +746,6 @@ static void ath9k_hw_ar9287_set_txpower(struct ath_hw *ah,if (test)return ; -if (IS_CHAN_2GHZ (chan)) - i = rate1l; -else - i = rate6mb; - - regulatory->max_power_level = ratesArray[i]; -if (AR_SREV_9280_20_OR_LATER (ah)) {for (i =0 ; i < Ar5416RateSize; i++) ratesArray[i] -=AR9287_PWR_TABLE_OFFSET_DB *2 ;
drivers/net/wireless/ath/ath9k/eeprom_def.c +0 -11
@@ -1167,17 +1167,6 @@ static void ath9k_hw_def_set_txpower(struct ath_hw *ah, regulatory->max_power_level = ratesArray[i]; } -if (!test) { - i = rate6mb; - -if (IS_CHAN_HT40 (chan)) - i = rateHt40_0; -else if (IS_CHAN_HT20 (chan)) - i = rateHt20_0; - - regulatory->max_power_level = ratesArray[i]; - } -switch (ar5416_get_ntxchains (ah->txchainmask)) {case 1 :break ;
Signature · 1 line
1.7.3.2
PATCH 4/4 ath9k_hw: do not limit initial tx power to 20 dbm
When testing for tx power, bypass the default limits.
--- drivers/net/wireless/ath/ath9k/hw.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +6 -3
@@ -2432,15 +2432,18 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)struct ath_regulatory *regulatory =ath9k_hw_regulatory (ah);struct ath9k_channel *chan = ah->curchan;struct ieee80211_channel *channel = chan->chan; +int reg_pwr =min_t (int,MAX_RATE_POWER , regulatory->power_limit); +int chan_pwr = channel->max_power *2 ; + +if (test) + reg_pwr = chan_pwr =MAX_RATE_POWER ; regulatory->power_limit =min (limit, (u32 )MAX_RATE_POWER ); ah->eep_ops->set_txpower (ah, chan,ath9k_regd_get_ctl (regulatory, chan), channel->max_antenna_gain *2 , - channel->max_power *2 , -min ((u32 )MAX_RATE_POWER , - (u32 ) regulatory->power_limit), test); + chan_pwr, reg_pwr, test); }EXPORT_SYMBOL (ath9k_hw_set_txpowerlimit);
Signature · 1 line
1.7.3.2
Re: [PATCH 4/4] ath9k_hw: do not limit initial tx power to 20 dbm
Review
Quoted 9 lines · Felix Fietkau
When testing for tx power, bypass the default limits.
Signed-off-by Felix Fietkau <nbd@...>--- drivers/net/wireless/ath/ath9k/hw.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/net/wireless/ath/ath9k/hw.c
drivers/net/wireless/ath/ath9k/hw.c void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32
Quoted 4 lines
index 8006ce0..a2e5763 100644
drivers/net/wireless/ath/ath9k/hw.c +0
-0@@ -2432,15 +2432,18 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32
limit, bool test)
Quoted 11 lines
drivers/net/wireless/ath/ath9k/hw.c +5
-0struct ath_regulatory *regulatory =ath9k_hw_regulatory (ah);struct ath9k_channel *chan = ah->curchan;struct ieee80211_channel *channel = chan->chan; +int reg_pwr =min_t (int,MAX_RATE_POWER , regulatory->power_limit); +int chan_pwr = channel->max_power *2 ; + +if (test) + reg_pwr = chan_pwr =MAX_RATE_POWER ; regulatory->power_limit =min (limit, (u32 )MAX_RATE_POWER );
drivers/net/wireless/ath/ath9k/hw.c void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) · line 2449
Quoted 10 lines
drivers/net/wireless/ath/ath9k/hw.c +1
-3ah->eep_ops->set_txpower (ah, chan,ath9k_regd_get_ctl (regulatory, chan), channel->max_antenna_gain *2 , - channel->max_power *2 , -min ((u32 )MAX_RATE_POWER , - (u32 ) regulatory->power_limit), test); + chan_pwr, reg_pwr, test); }EXPORT_SYMBOL (ath9k_hw_set_txpowerlimit);
Dear Mr. Fietkau,
I have tried to apply your patch on
http://www.orbit-lab.org/kernel/compat-wireless-3-stable/v3.3/compat-wireless-3.3-2-n.tar.bz2
I get the following error:
patch -p1 < ath9k_txpower.patch
patching file drivers/net/wireless/ath/ath9k/hw.c
Hunk #1 FAILED at 2432.
patch unexpectedly ends in middle of line
1 out of 1 hunk FAILED -- saving rejects to filedrivers/net/wireless/ath/ath9k/hw.c.rej
patch unexpectedly ends in middle of line
Could you support me with a patch tuned to the above compat-wireless?
Yours sincerelly,
Ambrus Oláh
Re: [PATCH 4/4] ath9k_hw: do not limit initial tx power to 20 dbm
Quoted 55 lines · Ambrus Oláh
Review
Quoted 9 lines · Felix Fietkau
When testing for tx power, bypass the default limits.
Signed-off-by Felix Fietkau <nbd@...>--- drivers/net/wireless/ath/ath9k/hw.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/net/wireless/ath/ath9k/hw.cdrivers/net/wireless/ath/ath9k/hw.c void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32
Quoted 4 lines
index 8006ce0..a2e5763 100644
drivers/net/wireless/ath/ath9k/hw.c +0
-0@@ -2432,15 +2432,18 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32limit, bool test)
Quoted 11 lines
drivers/net/wireless/ath/ath9k/hw.c +5
-0struct ath_regulatory *regulatory =ath9k_hw_regulatory (ah);struct ath9k_channel *chan = ah->curchan;struct ieee80211_channel *channel = chan->chan; +int reg_pwr =min_t (int,MAX_RATE_POWER , regulatory->power_limit); +int chan_pwr = channel->max_power *2 ; + +if (test) + reg_pwr = chan_pwr =MAX_RATE_POWER ; regulatory->power_limit =min (limit, (u32 )MAX_RATE_POWER );drivers/net/wireless/ath/ath9k/hw.c void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) · line 2449
Quoted 10 lines
drivers/net/wireless/ath/ath9k/hw.c +1
-3ah->eep_ops->set_txpower (ah, chan,ath9k_regd_get_ctl (regulatory, chan), channel->max_antenna_gain *2 , - channel->max_power *2 , -min ((u32 )MAX_RATE_POWER , - (u32 ) regulatory->power_limit), test); + chan_pwr, reg_pwr, test); }EXPORT_SYMBOL (ath9k_hw_set_txpowerlimit);Dear Mr. Fietkau,
I have tried to apply your patch on
http://www.orbit-lab.org/kernel/compat-wireless-3-stable/v3.3/compat-wireless-3.3-2-n.tar.bz2I get the following error:
patch -p1 < ath9k_txpower.patch
patching filedrivers/net/wireless/ath/ath9k/hw.c
Hunk #1 FAILED at 2432.
patch unexpectedly ends in middle of line
1 out of 1 hunk FAILED -- saving rejects to filedrivers/net/wireless/ath/ath9k/hw.c.rej
patch unexpectedly ends in middle of line
Quoted 1 line
Could you support me with a patch tuned to the above compat-wireless?
try applying over the latest
http://linuxwireless.org/download/compat-wireless-2.6/compat-wireless-2012-10-03.tar.bz2
ideally these patches are based on wireless-testing tree and you goto apply into it, and do kerenel/module compilation.
http://wireless.kernel.org/en/developers/Documentation/git-guide#Cloning_latest_wireless-testing
Quoted 9 lines
Yours sincerelly,
Ambrus Oláh
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
thanks, shafi
RE: [PATCH 4/4] ath9k_hw: do not limit initial tx power to 20 dbm
-----Original Message-----
From: Mohammed Shafi [mailto:[email protected]]
Sent: Friday, October 19, 2012 7:21 AM
To: Ambrus Oláh
Cc: [email protected]
Subject: Re: [PATCH 4/4] ath9k_hw: do not limit initial tx power to 20 dbm
Quoted 57 lines · Ambrus Oláh
Review
Quoted 9 lines · Felix Fietkau
When testing for tx power, bypass the default limits.
Signed-off-by Felix Fietkau <nbd@...>--- drivers/net/wireless/ath/ath9k/hw.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/net/wireless/ath/ath9k/hw.cdrivers/net/wireless/ath/ath9k/hw.c void ath9k_hw_set_txpowerlimit(struct ath_hw · line 2432
Quoted 5 lines
index 8006ce0..a2e5763 100644
drivers/net/wireless/ath/ath9k/hw.c +0
-0@@ -2432,15 +2432,18 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32limit, bool test)
Quoted 11 lines
drivers/net/wireless/ath/ath9k/hw.c +5
-0struct ath_regulatory *regulatory =ath9k_hw_regulatory (ah);struct ath9k_channel *chan = ah->curchan;struct ieee80211_channel *channel = chan->chan; +int reg_pwr =min_t (int,MAX_RATE_POWER , regulatory->power_limit); +int chan_pwr = channel->max_power *2 ; + +if (test) + reg_pwr = chan_pwr =MAX_RATE_POWER ; regulatory->power_limit =min (limit, (u32 )MAX_RATE_POWER );drivers/net/wireless/ath/ath9k/hw.c void ath9k_hw_set_txpowerlimit(struct ath_hw · line 2449
Quoted 10 lines
drivers/net/wireless/ath/ath9k/hw.c +1
-3ah->eep_ops->set_txpower (ah, chan,ath9k_regd_get_ctl (regulatory, chan), channel->max_antenna_gain *2 , - channel->max_power *2 , -min ((u32 )MAX_RATE_POWER , - (u32 ) regulatory->power_limit), test); + chan_pwr, reg_pwr, test); }EXPORT_SYMBOL (ath9k_hw_set_txpowerlimit);Dear Mr. Fietkau,
I have tried to apply your patch on
http://www.orbit-lab.org/kernel/compat-wireless-3-stable/v3.3/compat-w
ireless-3.3-2-n.tar.bz2I get the following error:
patch -p1 < ath9k_txpower.patch
patching filedrivers/net/wireless/ath/ath9k/hw.c
Hunk #1 FAILED at 2432.
patch unexpectedly ends in middle of line
1 out of 1 hunk FAILED -- saving rejects to filedrivers/net/wireless/ath/ath9k/hw.c.rej
patch unexpectedly ends in middle of line
Quoted 1 line
Could you support me with a patch tuned to the above compat-wireless?
try applying over the latest
http://linuxwireless.org/download/compat-wireless-2.6/compat-wireless-2012-1
0-03.tar.bz2
ideally these patches are based on wireless-testing tree and you goto apply into it, and do kerenel/module compilation.
http://wireless.kernel.org/en/developers/Documentation/git-guide#Cloning_lat
est_wireless-testing
Quoted 9 lines
Yours sincerelly,
Ambrus Oláh
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
thanks,
Shafi
Dear Mr. Shafi,
I have tested the patch above on
http://linuxwireless.org/download/compat-wireless-2.6/compat-wireless-2012-1
0-03.tar.bz2 with the following results:
~/compat-wireless-2012-10-03# patch -p1 < ath9k_txpower.patch patching file drivers/net/wireless/ath/ath9k/hw.c Hunk #1 FAILED at 2432.
patch unexpectedly ends in middle of line
1 out of 1 hunk FAILED -- saving rejects to file drivers/net/wireless/ath/ath9k/hw.c.rej
patch unexpectedly ends in middle of line
I have also tried to test the patch with the latest compat-wireless source found at:
http://linuxwireless.org/download/compat-wireless-2.6/compat-wireless-2012-1
0-20.tar.bz2
I get the same error:
~/compat-wireless-2012-10-20# patch -p1 < ath9k_txpower.patch patching file drivers/net/wireless/ath/ath9k/hw.c Hunk #1 FAILED at 2432.
patch unexpectedly ends in middle of line
1 out of 1 hunk FAILED -- saving rejects to file drivers/net/wireless/ath/ath9k/hw.c.rej
patch unexpectedly ends in middle of line
Could you examine the attached patch file why it is comlaining twice about "patch unexpectedly ends in middle of line" ?
Yours sincerelly,
Ambrus Oláh
drivers/net/wireless/ath/ath9k/hw.c +6 -3
@@ -2432,15 +2432,18 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)struct ath_regulatory *regulatory =ath9k_hw_regulatory (ah);struct ath9k_channel *chan = ah->curchan;struct ieee80211_channel *channel = chan->chan; +int reg_pwr =min_t (int,MAX_RATE_POWER , regulatory->power_limit); +int chan_pwr = channel->max_power *2 ; + +if (test) + reg_pwr = chan_pwr =MAX_RATE_POWER ; regulatory->power_limit =min (limit, (u32 )MAX_RATE_POWER ); ah->eep_ops->set_txpower (ah, chan,ath9k_regd_get_ctl (regulatory, chan), channel->max_antenna_gain *2 , - channel->max_power *2 , -min ((u32 )MAX_RATE_POWER , - (u32 ) regulatory->power_limit), test); + chan_pwr, reg_pwr, test); }EXPORT_SYMBOL (ath9k_hw_set_txpowerlimit);
--