aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/main.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2009-03-03 12:23:38 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-03-05 14:39:47 -0500
commit8089cc47ed45df8f5a44f92f53140e6fd0958409 (patch)
treefca7ceab8f501e906d84e56a4560dd764b841637 /drivers/net/wireless/ath9k/main.c
parent7ec3e514d9361596cbd8aa71ce41d6e5b0220103 (diff)
ath9k: Special processing for channel changes during scan
Allow mac80211-controlled channel changes on an active wiphy and especially during a scan. We need this as long as the scan is controlled by mac80211. Moving this control into the driver could allow some optimizations on scanning while using multiple virtual interfaces, but for now, try to work as well as possible with the current scan mechanism. Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/main.c')
-rw-r--r--drivers/net/wireless/ath9k/main.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index bb6e1ddb4a57..626392241d43 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -2077,7 +2077,7 @@ static int ath9k_tx(struct ieee80211_hw *hw,
2077 struct ath_tx_control txctl; 2077 struct ath_tx_control txctl;
2078 int hdrlen, padsize; 2078 int hdrlen, padsize;
2079 2079
2080 if (aphy->state != ATH_WIPHY_ACTIVE) { 2080 if (aphy->state != ATH_WIPHY_ACTIVE && aphy->state != ATH_WIPHY_SCAN) {
2081 printk(KERN_DEBUG "ath9k: %s: TX in unexpected wiphy state " 2081 printk(KERN_DEBUG "ath9k: %s: TX in unexpected wiphy state "
2082 "%d\n", wiphy_name(hw->wiphy), aphy->state); 2082 "%d\n", wiphy_name(hw->wiphy), aphy->state);
2083 goto exit; 2083 goto exit;
@@ -2348,14 +2348,16 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
2348 aphy->chan_idx = pos; 2348 aphy->chan_idx = pos;
2349 aphy->chan_is_ht = conf_is_ht(conf); 2349 aphy->chan_is_ht = conf_is_ht(conf);
2350 2350
2351 /* TODO: do not change operation channel immediately if there 2351 if (aphy->state == ATH_WIPHY_SCAN ||
2352 * are other virtual wiphys that use another channel. For now, 2352 aphy->state == ATH_WIPHY_ACTIVE)
2353 * we do the change immediately to allow mac80211-operated scan 2353 ath9k_wiphy_pause_all_forced(sc, aphy);
2354 * to work. Once the scan operation is moved into ath9k, we can 2354 else {
2355 * just move the current aphy in PAUSED state if the channel is 2355 /*
2356 * changed into something different from the current operation 2356 * Do not change operational channel based on a paused
2357 * channel. */ 2357 * wiphy changes.
2358 ath9k_wiphy_pause_all_forced(sc, aphy); 2358 */
2359 goto skip_chan_change;
2360 }
2359 2361
2360 DPRINTF(sc, ATH_DBG_CONFIG, "Set channel: %d MHz\n", 2362 DPRINTF(sc, ATH_DBG_CONFIG, "Set channel: %d MHz\n",
2361 curchan->center_freq); 2363 curchan->center_freq);
@@ -2372,6 +2374,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
2372 } 2374 }
2373 } 2375 }
2374 2376
2377skip_chan_change:
2375 if (changed & IEEE80211_CONF_CHANGE_POWER) 2378 if (changed & IEEE80211_CONF_CHANGE_POWER)
2376 sc->config.txpowlimit = 2 * conf->power_level; 2379 sc->config.txpowlimit = 2 * conf->power_level;
2377 2380
@@ -2731,6 +2734,19 @@ static void ath9k_sw_scan_start(struct ieee80211_hw *hw)
2731 struct ath_wiphy *aphy = hw->priv; 2734 struct ath_wiphy *aphy = hw->priv;
2732 struct ath_softc *sc = aphy->sc; 2735 struct ath_softc *sc = aphy->sc;
2733 2736
2737 if (ath9k_wiphy_scanning(sc)) {
2738 printk(KERN_DEBUG "ath9k: Two wiphys trying to scan at the "
2739 "same time\n");
2740 /*
2741 * Do not allow the concurrent scanning state for now. This
2742 * could be improved with scanning control moved into ath9k.
2743 */
2744 return;
2745 }
2746
2747 aphy->state = ATH_WIPHY_SCAN;
2748 ath9k_wiphy_pause_all_forced(sc, aphy);
2749
2734 mutex_lock(&sc->mutex); 2750 mutex_lock(&sc->mutex);
2735 sc->sc_flags |= SC_OP_SCANNING; 2751 sc->sc_flags |= SC_OP_SCANNING;
2736 mutex_unlock(&sc->mutex); 2752 mutex_unlock(&sc->mutex);
@@ -2742,6 +2758,7 @@ static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)
2742 struct ath_softc *sc = aphy->sc; 2758 struct ath_softc *sc = aphy->sc;
2743 2759
2744 mutex_lock(&sc->mutex); 2760 mutex_lock(&sc->mutex);
2761 aphy->state = ATH_WIPHY_ACTIVE;
2745 sc->sc_flags &= ~SC_OP_SCANNING; 2762 sc->sc_flags &= ~SC_OP_SCANNING;
2746 mutex_unlock(&sc->mutex); 2763 mutex_unlock(&sc->mutex);
2747} 2764}