Message ID | 1459440430-7676-1-git-send-email-zefir.kurtisi@neratec.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Kalle Valo |
Headers | show |
Hi Zefir,
[auto build test WARNING on wireless-drivers/master]
[also build test WARNING on v4.6-rc1 next-20160401]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Zefir-Kurtisi/ath9k-interpret-requested-txpower-in-EIRP-domain/20160401-001612
base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git master
config: i386-allmodconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
drivers/net/wireless/ath/ath9k/hw.c: In function 'ath9k_hw_apply_txpower':
>> drivers/net/wireless/ath/ath9k/hw.c:2836:25: warning: unused variable 'max_gain' [-Wunused-variable]
int chan_pwr, new_pwr, max_gain;
^
vim +/max_gain +2836 drivers/net/wireless/ath/ath9k/hw.c
ca2c68cc Felix Fietkau 2011-10-08 2820 {
ca2c68cc Felix Fietkau 2011-10-08 2821 enum eeprom_param gain_param;
ca2c68cc Felix Fietkau 2011-10-08 2822
ca2c68cc Felix Fietkau 2011-10-08 2823 if (IS_CHAN_2GHZ(chan))
ca2c68cc Felix Fietkau 2011-10-08 2824 gain_param = EEP_ANTENNA_GAIN_2G;
ca2c68cc Felix Fietkau 2011-10-08 2825 else
ca2c68cc Felix Fietkau 2011-10-08 2826 gain_param = EEP_ANTENNA_GAIN_5G;
ca2c68cc Felix Fietkau 2011-10-08 2827
ca2c68cc Felix Fietkau 2011-10-08 2828 return ah->eep_ops->get_eeprom(ah, gain_param);
ca2c68cc Felix Fietkau 2011-10-08 2829 }
ca2c68cc Felix Fietkau 2011-10-08 2830
64ea57d0 Gabor Juhos 2012-04-15 2831 void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan,
64ea57d0 Gabor Juhos 2012-04-15 2832 bool test)
ca2c68cc Felix Fietkau 2011-10-08 2833 {
ca2c68cc Felix Fietkau 2011-10-08 2834 struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
ca2c68cc Felix Fietkau 2011-10-08 2835 struct ieee80211_channel *channel;
ca2c68cc Felix Fietkau 2011-10-08 @2836 int chan_pwr, new_pwr, max_gain;
ca2c68cc Felix Fietkau 2011-10-08 2837
ca2c68cc Felix Fietkau 2011-10-08 2838 if (!chan)
ca2c68cc Felix Fietkau 2011-10-08 2839 return;
ca2c68cc Felix Fietkau 2011-10-08 2840
ca2c68cc Felix Fietkau 2011-10-08 2841 channel = chan->chan;
ca2c68cc Felix Fietkau 2011-10-08 2842 chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
ca2c68cc Felix Fietkau 2011-10-08 2843 new_pwr = min_t(int, chan_pwr, reg->power_limit);
ca2c68cc Felix Fietkau 2011-10-08 2844
:::::: The code at line 2836 was first introduced by commit
:::::: ca2c68cc7bc80fc4504fb420df04cce99c9ee6ec ath9k_hw: clean up tx power handling
:::::: TO: Felix Fietkau <nbd@openwrt.org>
:::::: CC: John W. Linville <linville@tuxdriver.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index e7a3101..30be8a5 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -2834,7 +2834,6 @@ void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, struct ath_regulatory *reg = ath9k_hw_regulatory(ah); struct ieee80211_channel *channel; int chan_pwr, new_pwr, max_gain; - int ant_gain, ant_reduction = 0; if (!chan) return; @@ -2842,15 +2841,10 @@ void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, channel = chan->chan; chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER); new_pwr = min_t(int, chan_pwr, reg->power_limit); - max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2; - - ant_gain = get_antenna_gain(ah, chan); - if (ant_gain > max_gain) - ant_reduction = ant_gain - max_gain; ah->eep_ops->set_txpower(ah, chan, ath9k_regd_get_ctl(reg, chan), - ant_reduction, new_pwr, test); + get_antenna_gain(ah, chan), new_pwr, test); } void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)
Tx power limitations at upper layers are interpreted in the EIRP domain. When the user requests a given maximum txpower, e.g. with: 'iw phy0 set txpower fixed 1500', he expects the EIRP to be at or below 15dBm. In ath9k_hw_apply_txpower(), the interpretation is different: the antenna-gain is capped against the current txpower limit in the regulatory, but not against the user set value. It ensures that the resulting EIRP is below the limit defined by the active countrycode, but not below the value the user requested. In a scenario like e.g. a) antenna_gain=6 b) countrycode limits to eirp=18 c) user set txpower=15 this will cause a setting for AR_PHY_POWER_TX_RATE regs resulting in an EIRP > 15. This patch ensures that antenna-gain is considered whenever the txpower limit is adjusted and with that the user set limits are kept. Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com> --- drivers/net/wireless/ath/ath9k/hw.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)