aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/hw.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2008-10-03 18:45:27 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-06 18:14:56 -0400
commit6f255425ac3b10c3352c926e7b53e5ea1c364ca4 (patch)
tree529cf0d1d1e9d9fdd8e9d6da67f5d99072872dc4 /drivers/net/wireless/ath9k/hw.c
parenta477e4e6d48d3ac7c7a75bad40585cb391e5c237 (diff)
ath9k: enable ANI to help with noisy environments
This enables Adaptive Noise Immunity (ANI) on ath9k. ANI is as algorithm designed to minimize the detrimental effects of time-varying interferences. This should help with throughput in noisy environments. To use ANI we re-enable the MIB interrupt. Since ANI works on a timer and updates the noise floor we take advantage of this and also report a non-static noise floor now to mac80211. Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com> Signed-off-by: Jouni Malinen <Jouni.Malinen@Atheros.com> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/hw.c')
-rw-r--r--drivers/net/wireless/ath9k/hw.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index 272c75816609..62e44a0ef996 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -329,7 +329,7 @@ static void ath9k_hw_set_defaults(struct ath_hal *ah)
329 ah->ah_config.ofdm_trig_high = 500; 329 ah->ah_config.ofdm_trig_high = 500;
330 ah->ah_config.cck_trig_high = 200; 330 ah->ah_config.cck_trig_high = 200;
331 ah->ah_config.cck_trig_low = 100; 331 ah->ah_config.cck_trig_low = 100;
332 ah->ah_config.enable_ani = 0; 332 ah->ah_config.enable_ani = 1;
333 ah->ah_config.noise_immunity_level = 4; 333 ah->ah_config.noise_immunity_level = 4;
334 ah->ah_config.ofdm_weaksignal_det = 1; 334 ah->ah_config.ofdm_weaksignal_det = 1;
335 ah->ah_config.cck_weaksignal_thr = 0; 335 ah->ah_config.cck_weaksignal_thr = 0;
@@ -8405,23 +8405,48 @@ u32 ath9k_hw_mhz2ieee(struct ath_hal *ah, u32 freq, u32 flags)
8405 } 8405 }
8406} 8406}
8407 8407
8408int16_t 8408/* We can tune this as we go by monitoring really low values */
8409#define ATH9K_NF_TOO_LOW -60
8410
8411/* AR5416 may return very high value (like -31 dBm), in those cases the nf
8412 * is incorrect and we should use the static NF value. Later we can try to
8413 * find out why they are reporting these values */
8414static bool ath9k_hw_nf_in_range(struct ath_hal *ah, s16 nf)
8415{
8416 if (nf > ATH9K_NF_TOO_LOW) {
8417 DPRINTF(ah->ah_sc, ATH_DBG_NF_CAL,
8418 "%s: noise floor value detected (%d) is "
8419 "lower than what we think is a "
8420 "reasonable value (%d)\n",
8421 __func__, nf, ATH9K_NF_TOO_LOW);
8422 return false;
8423 }
8424 return true;
8425}
8426
8427s16
8409ath9k_hw_getchan_noise(struct ath_hal *ah, struct ath9k_channel *chan) 8428ath9k_hw_getchan_noise(struct ath_hal *ah, struct ath9k_channel *chan)
8410{ 8429{
8411 struct ath9k_channel *ichan; 8430 struct ath9k_channel *ichan;
8431 s16 nf;
8412 8432
8413 ichan = ath9k_regd_check_channel(ah, chan); 8433 ichan = ath9k_regd_check_channel(ah, chan);
8414 if (ichan == NULL) { 8434 if (ichan == NULL) {
8415 DPRINTF(ah->ah_sc, ATH_DBG_NF_CAL, 8435 DPRINTF(ah->ah_sc, ATH_DBG_NF_CAL,
8416 "%s: invalid channel %u/0x%x; no mapping\n", 8436 "%s: invalid channel %u/0x%x; no mapping\n",
8417 __func__, chan->channel, chan->channelFlags); 8437 __func__, chan->channel, chan->channelFlags);
8418 return 0; 8438 return ATH_DEFAULT_NOISE_FLOOR;
8419 } 8439 }
8420 if (ichan->rawNoiseFloor == 0) { 8440 if (ichan->rawNoiseFloor == 0) {
8421 enum wireless_mode mode = ath9k_hw_chan2wmode(ah, chan); 8441 enum wireless_mode mode = ath9k_hw_chan2wmode(ah, chan);
8422 return NOISE_FLOOR[mode]; 8442 nf = NOISE_FLOOR[mode];
8423 } else 8443 } else
8424 return ichan->rawNoiseFloor; 8444 nf = ichan->rawNoiseFloor;
8445
8446 if (!ath9k_hw_nf_in_range(ah, nf))
8447 nf = ATH_DEFAULT_NOISE_FLOOR;
8448
8449 return nf;
8425} 8450}
8426 8451
8427bool ath9k_hw_set_tsfadjust(struct ath_hal *ah, u32 setting) 8452bool ath9k_hw_set_tsfadjust(struct ath_hal *ah, u32 setting)