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;
7 +s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan)
9 + s8 noise = ATH_DEFAULT_NOISE_FLOOR;
11 + if (chan && chan->noisefloor) {
12 + s8 delta = chan->noisefloor -
13 + ath9k_hw_get_default_nf(ah, chan);
19 +EXPORT_SYMBOL(ath9k_hw_getchan_noise);
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
26 chan->noisefloor = nf;
27 + ah->noise = ath9k_hw_getchan_noise(ah, chan);
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);
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);
45 + ah->noise = ath9k_hw_getchan_noise(ah, chan);
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;
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
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);
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,
76 + struct ath_hw *ah = common->ah;
78 memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
81 @@ -1006,7 +1008,7 @@ static int ath9k_rx_skb_preprocess(struc
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;
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);