Skip to content

Commit

Permalink
mac80211: count started vifs
Browse files Browse the repository at this point in the history
count the started roles by simply counting the non-idle vifs.
(Based on Arik's patch from R5)

Signed-off-by: Eyal Shapira <eyal@wizery.com>
  • Loading branch information
Eyal Shapira authored and elp committed Nov 12, 2012
1 parent d3c5c1d commit 17c861e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/net/mac80211.h
Expand Up @@ -4035,4 +4035,5 @@ void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif);
*/
int ieee80211_ave_rssi(struct ieee80211_vif *vif);

int ieee80211_started_vifs_count(struct ieee80211_hw *hw);
#endif /* MAC80211_H */
25 changes: 25 additions & 0 deletions net/mac80211/util.c
Expand Up @@ -1990,3 +1990,28 @@ u8 ieee80211_mcs_to_chains(const struct ieee80211_mcs_info *mcs)
return 2;
return 1;
}

int ieee80211_started_vifs_count(struct ieee80211_hw *hw)
{
struct ieee80211_local *local = hw_to_local(hw);
struct ieee80211_sub_if_data *sdata;
int count = 0;

rcu_read_lock();

list_for_each_entry_rcu(sdata, &local->interfaces, list) {
if (!ieee80211_sdata_running(sdata))
continue;

if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
sdata->vif.type == NL80211_IFTYPE_MONITOR)
continue;

if (!sdata->vif.bss_conf.idle)
count++;
}

rcu_read_unlock();
return count;
}
EXPORT_SYMBOL(ieee80211_started_vifs_count);

0 comments on commit 17c861e

Please sign in to comment.