diff options
author | Arik Nemtsov <arik@wizery.com> | 2014-10-22 13:30:59 +0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-10-23 22:40:03 +0400 |
commit | 0fc1e0495fd6e261e75acdbe66b53e769e5ffb81 (patch) | |
tree | 01f0e5c9cb8b8c834224ca10161d152f4f5a8307 /net | |
parent | 2bad7748b332d7218377287248eb66c25de033b2 (diff) | |
download | linux-0fc1e0495fd6e261e75acdbe66b53e769e5ffb81.tar.xz |
mac80211: expose API allowing station iteration
Allow drivers to iterate all stations currently uploaded to them.
Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/util.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 9247a960ea59..666aa1306c45 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -693,6 +693,34 @@ void ieee80211_iterate_active_interfaces_rtnl( } EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces_rtnl); +static void __iterate_stations(struct ieee80211_local *local, + void (*iterator)(void *data, + struct ieee80211_sta *sta), + void *data) +{ + struct sta_info *sta; + + list_for_each_entry_rcu(sta, &local->sta_list, list) { + if (!sta->uploaded) + continue; + + iterator(data, &sta->sta); + } +} + +void ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw, + void (*iterator)(void *data, + struct ieee80211_sta *sta), + void *data) +{ + struct ieee80211_local *local = hw_to_local(hw); + + rcu_read_lock(); + __iterate_stations(local, iterator, data); + rcu_read_unlock(); +} +EXPORT_SYMBOL_GPL(ieee80211_iterate_stations_atomic); + struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev) { struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); |