aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/wext.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-02-10 15:26:01 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-13 13:45:59 -0500
commit9a03d6d7a8698f26f8ef02dd3c91f8f68c4edcc7 (patch)
treee146c165c361b208e8ba41452acff0c75b84d68a /net/mac80211/wext.c
parent00d3f14cf9f12c21428121026a5e1d5f65926447 (diff)
mac80211: calculate wstats_flags on the fly
Just to make wext.c more self-contained. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/wext.c')
-rw-r--r--net/mac80211/wext.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index b337d7d5edb3..2b023dce8b24 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -145,6 +145,21 @@ static int ieee80211_ioctl_siwgenie(struct net_device *dev,
145 return -EOPNOTSUPP; 145 return -EOPNOTSUPP;
146} 146}
147 147
148static u8 ieee80211_get_wstats_flags(struct ieee80211_local *local)
149{
150 u8 wstats_flags = 0;
151
152 wstats_flags |= local->hw.flags & (IEEE80211_HW_SIGNAL_UNSPEC |
153 IEEE80211_HW_SIGNAL_DBM) ?
154 IW_QUAL_QUAL_UPDATED : IW_QUAL_QUAL_INVALID;
155 wstats_flags |= local->hw.flags & IEEE80211_HW_NOISE_DBM ?
156 IW_QUAL_NOISE_UPDATED : IW_QUAL_NOISE_INVALID;
157 if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
158 wstats_flags |= IW_QUAL_DBM;
159
160 return wstats_flags;
161}
162
148static int ieee80211_ioctl_giwrange(struct net_device *dev, 163static int ieee80211_ioctl_giwrange(struct net_device *dev,
149 struct iw_request_info *info, 164 struct iw_request_info *info,
150 struct iw_point *data, char *extra) 165 struct iw_point *data, char *extra)
@@ -187,13 +202,13 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev,
187 range->max_qual.noise = 0; 202 range->max_qual.noise = 0;
188 203
189 range->max_qual.qual = 100; 204 range->max_qual.qual = 100;
190 range->max_qual.updated = local->wstats_flags; 205 range->max_qual.updated = ieee80211_get_wstats_flags(local);
191 206
192 range->avg_qual.qual = 50; 207 range->avg_qual.qual = 50;
193 /* not always true but better than nothing */ 208 /* not always true but better than nothing */
194 range->avg_qual.level = range->max_qual.level / 2; 209 range->avg_qual.level = range->max_qual.level / 2;
195 range->avg_qual.noise = range->max_qual.noise / 2; 210 range->avg_qual.noise = range->max_qual.noise / 2;
196 range->avg_qual.updated = local->wstats_flags; 211 range->avg_qual.updated = ieee80211_get_wstats_flags(local);
197 212
198 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | 213 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
199 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; 214 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
@@ -979,7 +994,7 @@ static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev
979 wstats->qual.level = sta->last_signal; 994 wstats->qual.level = sta->last_signal;
980 wstats->qual.qual = sta->last_qual; 995 wstats->qual.qual = sta->last_qual;
981 wstats->qual.noise = sta->last_noise; 996 wstats->qual.noise = sta->last_noise;
982 wstats->qual.updated = local->wstats_flags; 997 wstats->qual.updated = ieee80211_get_wstats_flags(local);
983 } 998 }
984 999
985 rcu_read_unlock(); 1000 rcu_read_unlock();