|
@@ -165,73 +165,6 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
|
|
|
}
|
|
|
|
|
|
|
|
|
-/* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
|
|
|
-static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev)
|
|
|
-{
|
|
|
- struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
|
|
|
- struct iw_statistics *wstats = &local->wstats;
|
|
|
- struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
|
|
- struct sta_info *sta = NULL;
|
|
|
-
|
|
|
- rcu_read_lock();
|
|
|
-
|
|
|
- if (sdata->vif.type == NL80211_IFTYPE_STATION)
|
|
|
- sta = sta_info_get(local, sdata->u.mgd.bssid);
|
|
|
-
|
|
|
- if (!sta) {
|
|
|
- wstats->discard.fragment = 0;
|
|
|
- wstats->discard.misc = 0;
|
|
|
- wstats->qual.qual = 0;
|
|
|
- wstats->qual.level = 0;
|
|
|
- wstats->qual.noise = 0;
|
|
|
- wstats->qual.updated = IW_QUAL_ALL_INVALID;
|
|
|
- } else {
|
|
|
- wstats->qual.updated = 0;
|
|
|
- /*
|
|
|
- * mirror what cfg80211 does for iwrange/scan results,
|
|
|
- * otherwise userspace gets confused.
|
|
|
- */
|
|
|
- if (local->hw.flags & (IEEE80211_HW_SIGNAL_UNSPEC |
|
|
|
- IEEE80211_HW_SIGNAL_DBM)) {
|
|
|
- wstats->qual.updated |= IW_QUAL_LEVEL_UPDATED;
|
|
|
- wstats->qual.updated |= IW_QUAL_QUAL_UPDATED;
|
|
|
- } else {
|
|
|
- wstats->qual.updated |= IW_QUAL_LEVEL_INVALID;
|
|
|
- wstats->qual.updated |= IW_QUAL_QUAL_INVALID;
|
|
|
- }
|
|
|
-
|
|
|
- if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) {
|
|
|
- wstats->qual.level = sta->last_signal;
|
|
|
- wstats->qual.qual = sta->last_signal;
|
|
|
- } else if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
|
|
|
- int sig = sta->last_signal;
|
|
|
-
|
|
|
- wstats->qual.updated |= IW_QUAL_DBM;
|
|
|
- wstats->qual.level = sig;
|
|
|
- if (sig < -110)
|
|
|
- sig = -110;
|
|
|
- else if (sig > -40)
|
|
|
- sig = -40;
|
|
|
- wstats->qual.qual = sig + 110;
|
|
|
- }
|
|
|
-
|
|
|
- if (local->hw.flags & IEEE80211_HW_NOISE_DBM) {
|
|
|
- /*
|
|
|
- * This assumes that if driver reports noise, it also
|
|
|
- * reports signal in dBm.
|
|
|
- */
|
|
|
- wstats->qual.noise = sta->last_noise;
|
|
|
- wstats->qual.updated |= IW_QUAL_NOISE_UPDATED;
|
|
|
- } else {
|
|
|
- wstats->qual.updated |= IW_QUAL_NOISE_INVALID;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- rcu_read_unlock();
|
|
|
-
|
|
|
- return wstats;
|
|
|
-}
|
|
|
-
|
|
|
/* Structures to export the Wireless Handlers */
|
|
|
|
|
|
static const iw_handler ieee80211_handler[] =
|
|
@@ -298,5 +231,5 @@ const struct iw_handler_def ieee80211_iw_handler_def =
|
|
|
{
|
|
|
.num_standard = ARRAY_SIZE(ieee80211_handler),
|
|
|
.standard = (iw_handler *) ieee80211_handler,
|
|
|
- .get_wireless_stats = ieee80211_get_wireless_stats,
|
|
|
+ .get_wireless_stats = cfg80211_wireless_stats,
|
|
|
};
|