From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: Michael Wu <flamingice@sourmilk.net>,
linux-wireless <linux-wireless@vger.kernel.org>
Subject: [PATCH] mac80211: make ieee80211_iterate_active_interfaces not need rtnl
Date: Wed, 28 Nov 2007 10:55:32 +0100 [thread overview]
Message-ID: <1196243733.6058.117.camel@johannes.berg> (raw)
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>
---
include/net/mac80211.h | 3 +--
net/mac80211/util.c | 7 ++++---
2 files changed, 5 insertions(+), 5 deletions(-)
--- everything.orig/include/net/mac80211.h 2007-11-28 01:24:04.030767632 +0100
+++ everything/include/net/mac80211.h 2007-11-28 10:51:18.718922797 +0100
@@ -1408,10 +1408,9 @@ void ieee80211_scan_completed(struct iee
*
* 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,
--- everything.orig/net/mac80211/util.c 2007-11-28 01:24:24.310766384 +0100
+++ everything/net/mac80211/util.c 2007-11-28 01:26:40.510763509 +0100
@@ -482,10 +482,9 @@ void ieee80211_iterate_active_interfaces
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:
@@ -504,5 +503,7 @@ void ieee80211_iterate_active_interfaces
iterator(data, sdata->dev->dev_addr,
sdata->dev->ifindex);
}
+
+ rcu_read_unlock();
}
EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces);
reply other threads:[~2007-11-28 13:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1196243733.6058.117.camel@johannes.berg \
--to=johannes@sipsolutions.net \
--cc=flamingice@sourmilk.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox