ath9k: Pause other virtual wiphys on channel change
authorJouni Malinen <jouni.malinen@atheros.com>
Tue, 3 Mar 2009 17:23:35 +0000 (19:23 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 5 Mar 2009 19:39:46 +0000 (14:39 -0500)
For now, allow channel changes immediately and just force the other
virtual wiphys to paused state. This is needed to allow
mac80211-controlled scan to control channel changes.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath9k/ath9k.h
drivers/net/wireless/ath9k/main.c
drivers/net/wireless/ath9k/virtual.c

index cb9cb7232489b9f30cd7013b05b7605a8793362d..24373d395e4909d15febd0b6a9eae3311eac95bf 100644 (file)
@@ -710,5 +710,7 @@ int ath9k_wiphy_unpause(struct ath_wiphy *aphy);
 int ath9k_wiphy_select(struct ath_wiphy *aphy);
 void ath9k_wiphy_chan_work(struct work_struct *work);
 bool ath9k_wiphy_started(struct ath_softc *sc);
+void ath9k_wiphy_pause_all_forced(struct ath_softc *sc,
+                                 struct ath_wiphy *selected);
 
 #endif /* ATH9K_H */
index 7c20da3862a66a5f27f099532a50a9bd48cdabeb..9b5f214936508c373362f1f123619c1ecf135cd8 100644 (file)
@@ -2343,7 +2343,13 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
                aphy->chan_is_ht = conf_is_ht(conf);
 
                /* TODO: do not change operation channel immediately if there
-                * are other virtual wiphys that use another channel */
+                * are other virtual wiphys that use another channel. For now,
+                * we do the change immediately to allow mac80211-operated scan
+                * to work. Once the scan operation is moved into ath9k, we can
+                * just move the current aphy in PAUSED state if the channel is
+                * changed into something different from the current operation
+                * channel. */
+               ath9k_wiphy_pause_all_forced(sc, aphy);
 
                DPRINTF(sc, ATH_DBG_CONFIG, "Set channel: %d MHz\n",
                        curchan->center_freq);
index b66aa24d3186254d76c33a127ccb0e05d77b3e3d..6122f48f25fb47a9543aa75d719641a2eb2c81ef 100644 (file)
@@ -496,3 +496,27 @@ bool ath9k_wiphy_started(struct ath_softc *sc)
        spin_unlock_bh(&sc->wiphy_lock);
        return false;
 }
+
+static void ath9k_wiphy_pause_chan(struct ath_wiphy *aphy,
+                                  struct ath_wiphy *selected)
+{
+       if (aphy->chan_idx == selected->chan_idx)
+               return;
+       aphy->state = ATH_WIPHY_PAUSED;
+       ieee80211_stop_queues(aphy->hw);
+}
+
+void ath9k_wiphy_pause_all_forced(struct ath_softc *sc,
+                                 struct ath_wiphy *selected)
+{
+       int i;
+       spin_lock_bh(&sc->wiphy_lock);
+       if (sc->pri_wiphy->state == ATH_WIPHY_ACTIVE)
+               ath9k_wiphy_pause_chan(sc->pri_wiphy, selected);
+       for (i = 0; i < sc->num_sec_wiphy; i++) {
+               if (sc->sec_wiphy[i] &&
+                   sc->sec_wiphy[i]->state == ATH_WIPHY_ACTIVE)
+                       ath9k_wiphy_pause_chan(sc->sec_wiphy[i], selected);
+       }
+       spin_unlock_bh(&sc->wiphy_lock);
+}