mac80211: stop Rx during HW reconfig
authorArik Nemtsov <arik@wizery.com>
Wed, 6 Jun 2012 08:25:02 +0000 (11:25 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 18 Jun 2012 17:18:53 +0000 (19:18 +0200)
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>
net/mac80211/ieee80211_i.h
net/mac80211/main.c
net/mac80211/rx.c
net/mac80211/util.c

index e6cbf5b68c89105d5b86bec1bcba8162233d3876..ddf768f6350eecb91e70df6c630254dd0076ffa3 100644 (file)
@@ -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;
 
index d81c178c77122116db696de865dc69169dfb3888..976e41365c258d78c274f0a516eec0398bb5be44 100644 (file)
@@ -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);
index 6fd2cb0838c475003c59e7e3eb406f5030596a38..072e8f3afa2bd330e36608778878832f0fa2d2e9 100644 (file)
@@ -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.
index 1df4019f294b6206f45222160be1e4c193e76e30..242ecde381f605429f05d427b32f6f54ab9983d1 100644 (file)
@@ -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