| 1 | --- a/drivers/net/wireless/ath/ath9k/calib.c |
| 2 | +++ b/drivers/net/wireless/ath/ath9k/calib.c |
| 3 | @@ -63,6 +63,19 @@ static s16 ath9k_hw_get_default_nf(struc |
| 4 | return ath9k_hw_get_nf_limits(ah, chan)->nominal; |
| 5 | } |
| 6 | |
| 7 | +s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan) |
| 8 | +{ |
| 9 | + s8 noise = ATH_DEFAULT_NOISE_FLOOR; |
| 10 | + |
| 11 | + if (chan && chan->noisefloor) { |
| 12 | + s8 delta = chan->noisefloor - |
| 13 | + ath9k_hw_get_default_nf(ah, chan); |
| 14 | + if (delta > 0) |
| 15 | + noise += delta; |
| 16 | + } |
| 17 | + return noise; |
| 18 | +} |
| 19 | +EXPORT_SYMBOL(ath9k_hw_getchan_noise); |
| 20 | |
| 21 | static void ath9k_hw_update_nfcal_hist_buffer(struct ath_hw *ah, |
| 22 | struct ath9k_hw_cal_data *cal, |
| 23 | @@ -378,6 +391,7 @@ bool ath9k_hw_getnf(struct ath_hw *ah, s |
| 24 | |
| 25 | if (!caldata) { |
| 26 | chan->noisefloor = nf; |
| 27 | + ah->noise = ath9k_hw_getchan_noise(ah, chan); |
| 28 | return false; |
| 29 | } |
| 30 | |
| 31 | @@ -385,6 +399,7 @@ bool ath9k_hw_getnf(struct ath_hw *ah, s |
| 32 | caldata->nfcal_pending = false; |
| 33 | ath9k_hw_update_nfcal_hist_buffer(ah, caldata, nfarray); |
| 34 | chan->noisefloor = h[0].privNF; |
| 35 | + ah->noise = ath9k_hw_getchan_noise(ah, chan); |
| 36 | return true; |
| 37 | } |
| 38 | |
| 39 | --- a/drivers/net/wireless/ath/ath9k/hw.c |
| 40 | +++ b/drivers/net/wireless/ath/ath9k/hw.c |
| 41 | @@ -1427,6 +1427,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st |
| 42 | memset(caldata, 0, sizeof(*caldata)); |
| 43 | ath9k_init_nfcal_hist_buffer(ah, chan); |
| 44 | } |
| 45 | + ah->noise = ath9k_hw_getchan_noise(ah, chan); |
| 46 | |
| 47 | if (bChannelChange && |
| 48 | (ah->chip_fullsleep != true) && |
| 49 | --- a/drivers/net/wireless/ath/ath9k/hw.h |
| 50 | +++ b/drivers/net/wireless/ath/ath9k/hw.h |
| 51 | @@ -688,6 +688,7 @@ struct ath_hw { |
| 52 | enum nl80211_iftype opmode; |
| 53 | enum ath9k_power_mode power_mode; |
| 54 | |
| 55 | + s8 noise; |
| 56 | struct ath9k_hw_cal_data *caldata; |
| 57 | struct ath9k_pacal_info pacal_info; |
| 58 | struct ar5416Stats stats; |
| 59 | --- a/drivers/net/wireless/ath/ath9k/main.c |
| 60 | +++ b/drivers/net/wireless/ath/ath9k/main.c |
| 61 | @@ -163,7 +163,7 @@ static void ath_update_survey_nf(struct |
| 62 | |
| 63 | if (chan->noisefloor) { |
| 64 | survey->filled |= SURVEY_INFO_NOISE_DBM; |
| 65 | - survey->noise = chan->noisefloor; |
| 66 | + survey->noise = ath9k_hw_getchan_noise(ah, chan); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | --- a/drivers/net/wireless/ath/ath9k/recv.c |
| 71 | +++ b/drivers/net/wireless/ath/ath9k/recv.c |
| 72 | @@ -986,6 +986,8 @@ static int ath9k_rx_skb_preprocess(struc |
| 73 | struct ieee80211_rx_status *rx_status, |
| 74 | bool *decrypt_error) |
| 75 | { |
| 76 | + struct ath_hw *ah = common->ah; |
| 77 | + |
| 78 | memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); |
| 79 | |
| 80 | /* |
| 81 | @@ -1006,7 +1008,7 @@ static int ath9k_rx_skb_preprocess(struc |
| 82 | |
| 83 | rx_status->band = hw->conf.channel->band; |
| 84 | rx_status->freq = hw->conf.channel->center_freq; |
| 85 | - rx_status->signal = ATH_DEFAULT_NOISE_FLOOR + rx_stats->rs_rssi; |
| 86 | + rx_status->signal = ah->noise + rx_stats->rs_rssi; |
| 87 | rx_status->antenna = rx_stats->rs_antenna; |
| 88 | rx_status->flag |= RX_FLAG_MACTIME_MPDU; |
| 89 | |
| 90 | --- a/drivers/net/wireless/ath/ath9k/calib.h |
| 91 | +++ b/drivers/net/wireless/ath/ath9k/calib.h |
| 92 | @@ -108,6 +108,7 @@ void ath9k_init_nfcal_hist_buffer(struct |
| 93 | void ath9k_hw_bstuck_nfcal(struct ath_hw *ah); |
| 94 | void ath9k_hw_reset_calibration(struct ath_hw *ah, |
| 95 | struct ath9k_cal_list *currCal); |
| 96 | +s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan); |
| 97 | |
| 98 | |
| 99 | #endif /* CALIB_H */ |
| 100 | |