aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/mac80211.h16
-rw-r--r--net/mac80211/util.c33
2 files changed, 49 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 17b60391fcd6..1470e1b886f0 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1406,4 +1406,20 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw);
1406 */ 1406 */
1407void ieee80211_scan_completed(struct ieee80211_hw *hw); 1407void ieee80211_scan_completed(struct ieee80211_hw *hw);
1408 1408
1409/**
1410 * ieee80211_iterate_active_interfaces - iterate active interfaces
1411 *
1412 * This function iterates over the interfaces associated with a given
1413 * hardware that are currently active and calls the callback for them.
1414 * Must be called under RTNL.
1415 *
1416 * @hw: the hardware struct of which the interfaces should be iterated over
1417 * @iterator: the iterator function to call
1418 * @data: first argument of the iterator function
1419 */
1420void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
1421 void (*iterator)(void *data, u8 *mac,
1422 int if_id),
1423 void *data);
1424
1409#endif /* MAC80211_H */ 1425#endif /* MAC80211_H */
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 5a0564e1dbd6..88f262baaa5e 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -22,6 +22,7 @@
22#include <linux/bitmap.h> 22#include <linux/bitmap.h>
23#include <net/net_namespace.h> 23#include <net/net_namespace.h>
24#include <net/cfg80211.h> 24#include <net/cfg80211.h>
25#include <net/rtnetlink.h>
25 26
26#include "ieee80211_i.h" 27#include "ieee80211_i.h"
27#include "ieee80211_rate.h" 28#include "ieee80211_rate.h"
@@ -484,3 +485,35 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw)
484 ieee80211_wake_queue(hw, i); 485 ieee80211_wake_queue(hw, i);
485} 486}
486EXPORT_SYMBOL(ieee80211_wake_queues); 487EXPORT_SYMBOL(ieee80211_wake_queues);
488
489void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
490 void (*iterator)(void *data, u8 *mac,
491 int if_id),
492 void *data)
493{
494 struct ieee80211_local *local = hw_to_local(hw);
495 struct ieee80211_sub_if_data *sdata;
496
497 ASSERT_RTNL();
498
499 /* we hold the RTNL here so can safely walk the list */
500 list_for_each_entry(sdata, &local->interfaces, list) {
501 switch (sdata->type) {
502 case IEEE80211_IF_TYPE_INVALID:
503 case IEEE80211_IF_TYPE_MNTR:
504 case IEEE80211_IF_TYPE_VLAN:
505 continue;
506 case IEEE80211_IF_TYPE_AP:
507 case IEEE80211_IF_TYPE_STA:
508 case IEEE80211_IF_TYPE_IBSS:
509 case IEEE80211_IF_TYPE_WDS:
510 break;
511 }
512 if (sdata->dev == local->mdev)
513 continue;
514 if (netif_running(sdata->dev))
515 iterator(data, sdata->dev->dev_addr,
516 sdata->dev->ifindex);
517 }
518}
519EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces);