diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-02-10 15:26:01 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-13 13:45:59 -0500 |
commit | 9a03d6d7a8698f26f8ef02dd3c91f8f68c4edcc7 (patch) | |
tree | e146c165c361b208e8ba41452acff0c75b84d68a /net | |
parent | 00d3f14cf9f12c21428121026a5e1d5f65926447 (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')
-rw-r--r-- | net/mac80211/ieee80211_i.h | 1 | ||||
-rw-r--r-- | net/mac80211/main.c | 8 | ||||
-rw-r--r-- | net/mac80211/wext.c | 21 |
3 files changed, 18 insertions, 12 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 678278344d79..2cb743ed9f9c 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -592,7 +592,6 @@ struct ieee80211_local { | |||
592 | int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss; | 592 | int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss; |
593 | unsigned int filter_flags; /* FIF_* */ | 593 | unsigned int filter_flags; /* FIF_* */ |
594 | struct iw_statistics wstats; | 594 | struct iw_statistics wstats; |
595 | u8 wstats_flags; | ||
596 | bool tim_in_locked_section; /* see ieee80211_beacon_get() */ | 595 | bool tim_in_locked_section; /* see ieee80211_beacon_get() */ |
597 | int tx_headroom; /* required headroom for hardware/radiotap */ | 596 | int tx_headroom; /* required headroom for hardware/radiotap */ |
598 | 597 | ||
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index b4973a1b6595..5667f4e8067f 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -905,14 +905,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
905 | 905 | ||
906 | local->hw.conf.listen_interval = local->hw.max_listen_interval; | 906 | local->hw.conf.listen_interval = local->hw.max_listen_interval; |
907 | 907 | ||
908 | local->wstats_flags |= local->hw.flags & (IEEE80211_HW_SIGNAL_UNSPEC | | ||
909 | IEEE80211_HW_SIGNAL_DBM) ? | ||
910 | IW_QUAL_QUAL_UPDATED : IW_QUAL_QUAL_INVALID; | ||
911 | local->wstats_flags |= local->hw.flags & IEEE80211_HW_NOISE_DBM ? | ||
912 | IW_QUAL_NOISE_UPDATED : IW_QUAL_NOISE_INVALID; | ||
913 | if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) | ||
914 | local->wstats_flags |= IW_QUAL_DBM; | ||
915 | |||
916 | result = sta_info_start(local); | 908 | result = sta_info_start(local); |
917 | if (result < 0) | 909 | if (result < 0) |
918 | goto fail_sta_info; | 910 | goto fail_sta_info; |
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 | ||
148 | static 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 | |||
148 | static int ieee80211_ioctl_giwrange(struct net_device *dev, | 163 | static 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(); |