diff options
author | James Ketrenos <jketreno@linux.intel.com> | 2005-09-13 18:27:19 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-16 03:06:32 -0400 |
commit | b1b508e1b13529b3cc5b59c352f49b9b58a302b6 (patch) | |
tree | 6321572a9bca16928b57e936376af616a1868dc0 | |
parent | fd27817ce941c7134adefd2852f8a5f274315ff4 (diff) |
[PATCH] ieee80211 quality scaling algorithm extension handler
Incorporated Bill Moss' quality scaling algorithm into default wireless
extension handler.
Signed-off-by: James Ketrenos <jketreno@linux.intel.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r-- | include/net/ieee80211.h | 3 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_wx.c | 40 |
2 files changed, 33 insertions, 10 deletions
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index dc36b1be6745..ce966b7ff563 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -719,6 +719,9 @@ struct ieee80211_device { | |||
719 | int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ | 719 | int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ |
720 | int abg_ture; /* ABG flag */ | 720 | int abg_ture; /* ABG flag */ |
721 | 721 | ||
722 | int perfect_rssi; | ||
723 | int worst_rssi; | ||
724 | |||
722 | /* Callback functions */ | 725 | /* Callback functions */ |
723 | void (*set_security)(struct net_device *dev, | 726 | void (*set_security)(struct net_device *dev, |
724 | struct ieee80211_security *sec); | 727 | struct ieee80211_security *sec); |
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 | ||