diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-11-08 19:57:29 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:54:37 -0500 |
commit | dabeb344f54ab780d152714c18f1cb6b21c471a1 (patch) | |
tree | b93be2a461b00882491bc8b7d3780476ca71bf7e /net/mac80211/util.c | |
parent | 9859a79023d71dd4e56c195a345abc4112abfd02 (diff) |
mac80211: provide interface iterator for drivers
Sometimes drivers need to know which interfaces are associated with
their hardware. Rather than forcing those drivers to keep track of
the interfaces that were added, this adds an iteration function to
mac80211.
As it is intended to be used from the interface add/remove callbacks,
the iteration function may currently only be called under RTNL.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r-- | net/mac80211/util.c | 33 |
1 files changed, 33 insertions, 0 deletions
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 | } |
486 | EXPORT_SYMBOL(ieee80211_wake_queues); | 487 | EXPORT_SYMBOL(ieee80211_wake_queues); |
488 | |||
489 | void 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 | } | ||
519 | EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces); | ||