aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-11-28 04:55:32 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:55:28 -0500
commite38bad4766a110b61fa6038f10be16ced8c6cc38 (patch)
tree8a1b3920dd5383c4a8312597c6d4570b22eae148
parent76ee65bfaa1435320a72989a6413467ce446ae23 (diff)
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 <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/mac80211.h3
-rw-r--r--net/mac80211/util.c7
2 files changed, 5 insertions, 5 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 1470e1b886f0..4cc5b1c8a4f1 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1411,10 +1411,9 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw);
1411 * 1411 *
1412 * This function iterates over the interfaces associated with a given 1412 * This function iterates over the interfaces associated with a given
1413 * hardware that are currently active and calls the callback for them. 1413 * hardware that are currently active and calls the callback for them.
1414 * Must be called under RTNL.
1415 * 1414 *
1416 * @hw: the hardware struct of which the interfaces should be iterated over 1415 * @hw: the hardware struct of which the interfaces should be iterated over
1417 * @iterator: the iterator function to call 1416 * @iterator: the iterator function to call, cannot sleep
1418 * @data: first argument of the iterator function 1417 * @data: first argument of the iterator function
1419 */ 1418 */
1420void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, 1419void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 5227c16f113e..7b278e9aa1a4 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -482,10 +482,9 @@ void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
482 struct ieee80211_local *local = hw_to_local(hw); 482 struct ieee80211_local *local = hw_to_local(hw);
483 struct ieee80211_sub_if_data *sdata; 483 struct ieee80211_sub_if_data *sdata;
484 484
485 ASSERT_RTNL(); 485 rcu_read_lock();
486 486
487 /* we hold the RTNL here so can safely walk the list */ 487 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
488 list_for_each_entry(sdata, &local->interfaces, list) {
489 switch (sdata->type) { 488 switch (sdata->type) {
490 case IEEE80211_IF_TYPE_INVALID: 489 case IEEE80211_IF_TYPE_INVALID:
491 case IEEE80211_IF_TYPE_MNTR: 490 case IEEE80211_IF_TYPE_MNTR:
@@ -503,5 +502,7 @@ void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
503 iterator(data, sdata->dev->dev_addr, 502 iterator(data, sdata->dev->dev_addr,
504 sdata->dev->ifindex); 503 sdata->dev->ifindex);
505 } 504 }
505
506 rcu_read_unlock();
506} 507}
507EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces); 508EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces);