Commit:     e38bad4766a110b61fa6038f10be16ced8c6cc38
Parent:     76ee65bfaa1435320a72989a6413467ce446ae23
Author:     Johannes Berg <[EMAIL PROTECTED]>
AuthorDate: Wed Nov 28 10:55:32 2007 +0100
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 14:55:28 2008 -0800

    mac80211: make ieee80211_iterate_active_interfaces not need rtnl
    Interface iteration in mac80211 can be done without holding any
    locks because I converted it to RCU. Initially, I thought this
    wouldn't be needed for ieee80211_iterate_active_interfaces but
    it's turning out that multi-BSS AP support can be much simpler
    in a driver if ieee80211_iterate_active_interfaces can be called
    without holding locks. This converts it to use RCU, it adds a
    requirement that the callback it invokes cannot sleep.
    Signed-off-by: Johannes Berg <[EMAIL PROTECTED]>
    Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
 include/net/mac80211.h |    3 +--
 net/mac80211/util.c    |    7 ++++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 1470e1b..4cc5b1c 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1411,10 +1411,9 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw);
  * This function iterates over the interfaces associated with a given
  * hardware that are currently active and calls the callback for them.
- * Must be called under RTNL.
  * @hw: the hardware struct of which the interfaces should be iterated over
- * @iterator: the iterator function to call
+ * @iterator: the iterator function to call, cannot sleep
  * @data: first argument of the iterator function
 void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 5227c16..7b278e9 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -482,10 +482,9 @@ void ieee80211_iterate_active_interfaces(struct 
ieee80211_hw *hw,
        struct ieee80211_local *local = hw_to_local(hw);
        struct ieee80211_sub_if_data *sdata;
-       ASSERT_RTNL();
+       rcu_read_lock();
-       /* we hold the RTNL here so can safely walk the list */
-       list_for_each_entry(sdata, &local->interfaces, list) {
+       list_for_each_entry_rcu(sdata, &local->interfaces, list) {
                switch (sdata->type) {
                case IEEE80211_IF_TYPE_INVALID:
                case IEEE80211_IF_TYPE_MNTR:
@@ -503,5 +502,7 @@ void ieee80211_iterate_active_interfaces(struct 
ieee80211_hw *hw,
                        iterator(data, sdata->dev->dev_addr,
+       rcu_read_unlock();
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to