wl1271: rewritten scanning code

This patch is a complete rewrite of the scanning code.  It now includes a
state machine to scan all four possible sets of channels independently:
2.4GHz active, 2.4GHz passive, 5GHz active and 5GHz passive.  The wl1271
firmware doesn't allow these sets to be mixed, so up to several scan commands
have to be issued.  This patch also allows scanning more than 24 channels per
set, by breaking the sets into smaller parts if needed (the firmware can scan
a maximum of 24 channels at a time).

Previously, the scanning code was erroneously scanning all channels possible
actively, not complying with the CRDA values.  This is also fixed with this
patch.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Reviewed-by: Saravanan Dhanabal <ext-saravanan.dhanabal@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Luciano Coelho
2010-07-08 17:50:07 +03:00
committed by John W. Linville
parent 34dd2aaac4
commit 08688d6b1a
5 changed files with 212 additions and 142 deletions

View File

@@ -942,10 +942,13 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw,
if (wl->bss_type == BSS_TYPE_STA_BSS)
ieee80211_enable_dyn_ps(wl->vif);
if (test_and_clear_bit(WL1271_FLAG_SCANNING, &wl->flags)) {
if (wl->scan.state != WL1271_SCAN_STATE_IDLE) {
mutex_unlock(&wl->mutex);
ieee80211_scan_completed(wl->hw, true);
mutex_lock(&wl->mutex);
wl->scan.state = WL1271_SCAN_STATE_IDLE;
kfree(wl->scan.scanned_ch);
wl->scan.scanned_ch = NULL;
}
wl->state = WL1271_STATE_OFF;
@@ -1551,11 +1554,9 @@ static int wl1271_op_hw_scan(struct ieee80211_hw *hw,
goto out;
if (wl1271_11a_enabled())
ret = wl1271_scan(hw->priv, ssid, len, req,
1, 0, WL1271_SCAN_BAND_DUAL, 3);
ret = wl1271_scan(hw->priv, ssid, len, req);
else
ret = wl1271_scan(hw->priv, ssid, len, req,
1, 0, WL1271_SCAN_BAND_2_4_GHZ, 3);
ret = wl1271_scan(hw->priv, ssid, len, req);
wl1271_ps_elp_sleep(wl);