aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211/ieee80211_wx.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ieee80211/ieee80211_wx.c')
-rw-r--r--net/ieee80211/ieee80211_wx.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c
index 94882f39b072..04f0897b0653 100644
--- a/net/ieee80211/ieee80211_wx.c
+++ b/net/ieee80211/ieee80211_wx.c
@@ -140,18 +140,38 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
140 start = iwe_stream_add_point(start, stop, &iwe, custom); 140 start = iwe_stream_add_point(start, stop, &iwe, custom);
141 141
142 /* Add quality statistics */ 142 /* Add quality statistics */
143 /* TODO: Fix these values... */
144 iwe.cmd = IWEVQUAL; 143 iwe.cmd = IWEVQUAL;
145 iwe.u.qual.qual = network->stats.signal; 144 iwe.u.qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED |
146 iwe.u.qual.level = network->stats.rssi; 145 IW_QUAL_NOISE_UPDATED;
147 iwe.u.qual.noise = network->stats.noise; 146
148 iwe.u.qual.updated = network->stats.mask & IEEE80211_STATMASK_WEMASK; 147 if (!(network->stats.mask & IEEE80211_STATMASK_RSSI)) {
149 if (!(network->stats.mask & IEEE80211_STATMASK_RSSI)) 148 iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID |
150 iwe.u.qual.updated |= IW_QUAL_LEVEL_INVALID; 149 IW_QUAL_LEVEL_INVALID;
151 if (!(network->stats.mask & IEEE80211_STATMASK_NOISE)) 150 iwe.u.qual.qual = 0;
151 iwe.u.qual.level = 0;
152 } else {
153 iwe.u.qual.level = network->stats.rssi;
154 iwe.u.qual.qual =
155 (100 *
156 (ieee->perfect_rssi - ieee->worst_rssi) *
157 (ieee->perfect_rssi - ieee->worst_rssi) -
158 (ieee->perfect_rssi - network->stats.rssi) *
159 (15 * (ieee->perfect_rssi - ieee->worst_rssi) +
160 62 * (ieee->perfect_rssi - network->stats.rssi))) /
161 ((ieee->perfect_rssi - ieee->worst_rssi) *
162 (ieee->perfect_rssi - ieee->worst_rssi));
163 if (iwe.u.qual.qual > 100)
164 iwe.u.qual.qual = 100;
165 else if (iwe.u.qual.qual < 1)
166 iwe.u.qual.qual = 0;
167 }
168
169 if (!(network->stats.mask & IEEE80211_STATMASK_NOISE)) {
152 iwe.u.qual.updated |= IW_QUAL_NOISE_INVALID; 170 iwe.u.qual.updated |= IW_QUAL_NOISE_INVALID;
153 if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL)) 171 iwe.u.qual.noise = 0;
154 iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID; 172 } else {
173 iwe.u.qual.noise = network->stats.noise;
174 }
155 175
156 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); 176 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN);
157 177