aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorVictor Goldenshtein <victorg@ti.com>2012-06-21 03:56:46 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-06-21 10:42:17 -0400
commit66572cfc30a4b764150c83ee5d842a3ce17991c9 (patch)
tree3b344b9c986b55f77b4652fd46ce2dad9138ea31 /net/mac80211/cfg.c
parent0f6b3f597daab2254614e2773e322e73fb1b6f4b (diff)
mac80211: add command to get current rssi
Get current rssi (in dBm) from the driver/FW. Instead of reporting the signal received in the last rx packet, which might be inaccurate if rx traffic is low and beacon filtering is enabled, get the signal from the driver/FW. Signed-off-by: Victor Goldenshtein <victorg@ti.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 03aff23c70fd..d0c8f78115cb 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -353,6 +353,7 @@ void sta_set_rate_info_tx(struct sta_info *sta,
353static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) 353static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
354{ 354{
355 struct ieee80211_sub_if_data *sdata = sta->sdata; 355 struct ieee80211_sub_if_data *sdata = sta->sdata;
356 struct ieee80211_local *local = sdata->local;
356 struct timespec uptime; 357 struct timespec uptime;
357 358
358 sinfo->generation = sdata->local->sta_generation; 359 sinfo->generation = sdata->local->sta_generation;
@@ -388,7 +389,9 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
388 if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) || 389 if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
389 (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) { 390 (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
390 sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG; 391 sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
391 sinfo->signal = (s8)sta->last_signal; 392 if (!local->ops->get_rssi ||
393 drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal))
394 sinfo->signal = (s8)sta->last_signal;
392 sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal); 395 sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
393 } 396 }
394 397
@@ -517,7 +520,7 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
517 * network device. 520 * network device.
518 */ 521 */
519 522
520 rcu_read_lock(); 523 mutex_lock(&local->sta_mtx);
521 524
522 if (sdata->vif.type == NL80211_IFTYPE_STATION) { 525 if (sdata->vif.type == NL80211_IFTYPE_STATION) {
523 sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid); 526 sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
@@ -546,7 +549,7 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
546 data[i] = (u8)sinfo.signal_avg; 549 data[i] = (u8)sinfo.signal_avg;
547 i++; 550 i++;
548 } else { 551 } else {
549 list_for_each_entry_rcu(sta, &local->sta_list, list) { 552 list_for_each_entry(sta, &local->sta_list, list) {
550 /* Make sure this station belongs to the proper dev */ 553 /* Make sure this station belongs to the proper dev */
551 if (sta->sdata->dev != dev) 554 if (sta->sdata->dev != dev)
552 continue; 555 continue;
@@ -603,7 +606,7 @@ do_survey:
603 else 606 else
604 data[i++] = -1LL; 607 data[i++] = -1LL;
605 608
606 rcu_read_unlock(); 609 mutex_unlock(&local->sta_mtx);
607 610
608 if (WARN_ON(i != STA_STATS_LEN)) 611 if (WARN_ON(i != STA_STATS_LEN))
609 return; 612 return;
@@ -629,10 +632,11 @@ static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
629 int idx, u8 *mac, struct station_info *sinfo) 632 int idx, u8 *mac, struct station_info *sinfo)
630{ 633{
631 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 634 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
635 struct ieee80211_local *local = sdata->local;
632 struct sta_info *sta; 636 struct sta_info *sta;
633 int ret = -ENOENT; 637 int ret = -ENOENT;
634 638
635 rcu_read_lock(); 639 mutex_lock(&local->sta_mtx);
636 640
637 sta = sta_info_get_by_idx(sdata, idx); 641 sta = sta_info_get_by_idx(sdata, idx);
638 if (sta) { 642 if (sta) {
@@ -641,7 +645,7 @@ static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
641 sta_set_sinfo(sta, sinfo); 645 sta_set_sinfo(sta, sinfo);
642 } 646 }
643 647
644 rcu_read_unlock(); 648 mutex_unlock(&local->sta_mtx);
645 649
646 return ret; 650 return ret;
647} 651}
@@ -658,10 +662,11 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
658 u8 *mac, struct station_info *sinfo) 662 u8 *mac, struct station_info *sinfo)
659{ 663{
660 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 664 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
665 struct ieee80211_local *local = sdata->local;
661 struct sta_info *sta; 666 struct sta_info *sta;
662 int ret = -ENOENT; 667 int ret = -ENOENT;
663 668
664 rcu_read_lock(); 669 mutex_lock(&local->sta_mtx);
665 670
666 sta = sta_info_get_bss(sdata, mac); 671 sta = sta_info_get_bss(sdata, mac);
667 if (sta) { 672 if (sta) {
@@ -669,7 +674,7 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
669 sta_set_sinfo(sta, sinfo); 674 sta_set_sinfo(sta, sinfo);
670 } 675 }
671 676
672 rcu_read_unlock(); 677 mutex_unlock(&local->sta_mtx);
673 678
674 return ret; 679 return ret;
675} 680}