ath9k: fetch survey data for all channels
[openwrt.git] / package / mac80211 / patches / 515-ath9k_multi_channel_nf.patch
1 --- a/drivers/net/wireless/ath/ath9k/main.c
2 +++ b/drivers/net/wireless/ath/ath9k/main.c
3 @@ -1995,16 +1995,31 @@ static int ath9k_get_survey(struct ieee8
4 struct ath_wiphy *aphy = hw->priv;
5 struct ath_softc *sc = aphy->sc;
6 struct ath_hw *ah = sc->sc_ah;
7 - struct ieee80211_conf *conf = &hw->conf;
8 + struct ieee80211_supported_band *sband;
9 + struct ath9k_channel *chan;
10
11 - if (idx != 0)
12 - return -ENOENT;
13 + sband = hw->wiphy->bands[IEEE80211_BAND_2GHZ];
14 + if (sband && idx >= sband->n_channels) {
15 + idx -= sband->n_channels;
16 + sband = NULL;
17 + }
18 +
19 + if (!sband)
20 + sband = hw->wiphy->bands[IEEE80211_BAND_5GHZ];
21 +
22 + if (idx >= sband->n_channels)
23 + return -ENOENT;
24
25 - survey->channel = conf->channel;
26 + survey->channel = &sband->channels[idx];
27 + chan = &ah->channels[survey->channel->hw_value];
28 survey->filled = 0;
29 - if (ah->curchan && ah->curchan->noisefloor) {
30 +
31 + if (chan == ah->curchan)
32 + survey->filled |= SURVEY_INFO_IN_USE;
33 +
34 + if (chan->noisefloor) {
35 survey->filled |= SURVEY_INFO_NOISE_DBM;
36 - survey->noise = ah->curchan->noisefloor;
37 + survey->noise = chan->noisefloor;
38 }
39
40 return 0;
This page took 0.041099 seconds and 5 git commands to generate.