1 --- a/drivers/net/wireless/ath/ath9k/calib.c
2 +++ b/drivers/net/wireless/ath/ath9k/calib.c
3 @@ -365,6 +365,7 @@ bool ath9k_hw_getnf(struct ath_hw *ah, s
7 + ah->noise = ath9k_hw_getchan_noise(ah, chan);
11 @@ -372,6 +373,7 @@ bool ath9k_hw_getnf(struct ath_hw *ah, s
12 caldata->nfcal_pending = false;
13 ath9k_hw_update_nfcal_hist_buffer(ah, caldata, nfarray);
14 chan->noisefloor = h[0].privNF;
15 + ah->noise = ath9k_hw_getchan_noise(ah, chan);
19 @@ -398,10 +400,15 @@ void ath9k_init_nfcal_hist_buffer(struct
21 s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan)
23 - if (!ah->curchan || !ah->curchan->noisefloor)
24 - return ath9k_hw_get_default_nf(ah, chan);
25 + s8 noise = ATH_DEFAULT_NOISE_FLOOR;
27 - return ah->curchan->noisefloor;
28 + if (chan && chan->noisefloor) {
29 + s8 delta = chan->noisefloor -
30 + ath9k_hw_get_default_nf(ah, chan);
36 EXPORT_SYMBOL(ath9k_hw_getchan_noise);
38 --- a/drivers/net/wireless/ath/ath9k/hw.c
39 +++ b/drivers/net/wireless/ath/ath9k/hw.c
40 @@ -1286,6 +1286,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
41 memset(caldata, 0, sizeof(*caldata));
42 ath9k_init_nfcal_hist_buffer(ah, chan);
44 + ah->noise = ath9k_hw_getchan_noise(ah, chan);
47 (ah->chip_fullsleep != true) &&
48 --- a/drivers/net/wireless/ath/ath9k/hw.h
49 +++ b/drivers/net/wireless/ath/ath9k/hw.h
50 @@ -677,6 +677,7 @@ struct ath_hw {
51 enum nl80211_iftype opmode;
52 enum ath9k_power_mode power_mode;
55 struct ath9k_hw_cal_data *caldata;
56 struct ath9k_pacal_info pacal_info;
57 struct ar5416Stats stats;
58 --- a/drivers/net/wireless/ath/ath9k/main.c
59 +++ b/drivers/net/wireless/ath/ath9k/main.c
60 @@ -165,7 +165,7 @@ static void ath_update_survey_nf(struct
62 if (chan->noisefloor) {
63 survey->filled |= SURVEY_INFO_NOISE_DBM;
64 - survey->noise = chan->noisefloor;
65 + survey->noise = ath9k_hw_getchan_noise(ah, chan);
69 --- a/drivers/net/wireless/ath/ath9k/recv.c
70 +++ b/drivers/net/wireless/ath/ath9k/recv.c
71 @@ -956,6 +956,8 @@ static int ath9k_rx_skb_preprocess(struc
72 struct ieee80211_rx_status *rx_status,
75 + struct ath_hw *ah = common->ah;
77 memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
80 @@ -976,7 +978,7 @@ static int ath9k_rx_skb_preprocess(struc
82 rx_status->band = hw->conf.channel->band;
83 rx_status->freq = hw->conf.channel->center_freq;
84 - rx_status->signal = ATH_DEFAULT_NOISE_FLOOR + rx_stats->rs_rssi;
85 + rx_status->signal = ah->noise + rx_stats->rs_rssi;
86 rx_status->antenna = rx_stats->rs_antenna;
87 rx_status->flag |= RX_FLAG_MACTIME_MPDU;