summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2012-06-06 08:25:02 (GMT)
committerJohannes Berg <johannes.berg@intel.com>2012-06-18 17:18:53 (GMT)
commit04800ada2acc3a9ffc754c1d73576cef326f3311 (patch)
treec3b298de7409ec82b19d206c66d84558c09637d6
parent58886a9011f8eae705b9f585ec6c80b34f3c4e6c (diff)
downloadlinux-fsl-qoriq-04800ada2acc3a9ffc754c1d73576cef326f3311.tar.xz
mac80211: stop Rx during HW reconfig
While HW reconfig is in progress, drop all incoming Rx. This prevents incoming packets from changing the internal state of the driver or calling callbacks of the low level driver while it is in inconsistent state. Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/mac80211/ieee80211_i.h3
-rw-r--r--net/mac80211/main.c7
-rw-r--r--net/mac80211/rx.c4
-rw-r--r--net/mac80211/util.c3
4 files changed, 17 insertions, 0 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index e6cbf5b..ddf768f 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -881,6 +881,9 @@ struct ieee80211_local {
/* device is started */
bool started;
+ /* device is during a HW reconfig */
+ bool in_reconfig;
+
/* wowlan is enabled -- don't reconfig on resume */
bool wowlan;
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index d81c178..976e413 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -345,6 +345,13 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw)
ieee80211_stop_queues_by_reason(hw,
IEEE80211_QUEUE_STOP_REASON_SUSPEND);
+ /*
+ * Stop all Rx during the reconfig. We don't want state changes
+ * or driver callbacks while this is in progress.
+ */
+ local->in_reconfig = true;
+ barrier();
+
schedule_work(&local->restart_work);
}
EXPORT_SYMBOL(ieee80211_restart_hw);
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 6fd2cb0..072e8f3 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3027,6 +3027,10 @@ void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
if (unlikely(local->quiescing || local->suspended))
goto drop;
+ /* We might be during a HW reconfig, prevent Rx for the same reason */
+ if (unlikely(local->in_reconfig))
+ goto drop;
+
/*
* The same happens when we're not even started,
* but that's worth a warning.
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 1df4019..242ecde 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1411,6 +1411,9 @@ int ieee80211_reconfig(struct ieee80211_local *local)
if (ieee80211_sdata_running(sdata))
ieee80211_enable_keys(sdata);
+ local->in_reconfig = false;
+ barrier();
+
wake_up:
/*
* Clear the WLAN_STA_BLOCK_BA flag so new aggregation