Skip to content

Commit

Permalink
wl1271: rewritten scanning code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Luciano Coelho authored and John W. Linville committed Jul 8, 2010
1 parent 34dd2aa commit 08688d6
Show file tree
Hide file tree
Showing 5 changed files with 211 additions and 141 deletions.
21 changes: 9 additions & 12 deletions drivers/net/wireless/wl12xx/wl1271.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,10 @@ struct wl1271_rx_mem_pool_addr {

struct wl1271_scan {
struct cfg80211_scan_request *req;
bool *scanned_ch;
u8 state;
u8 ssid[IW_ESSID_MAX_SIZE+1];
size_t ssid_len;
u8 active;
u8 high_prio;
u8 probe_requests;
};

struct wl1271_if_operations {
Expand Down Expand Up @@ -343,15 +341,14 @@ struct wl1271 {
#define WL1271_FLAG_JOINED (2)
#define WL1271_FLAG_GPIO_POWER (3)
#define WL1271_FLAG_TX_QUEUE_STOPPED (4)
#define WL1271_FLAG_SCANNING (5)
#define WL1271_FLAG_IN_ELP (6)
#define WL1271_FLAG_PSM (7)
#define WL1271_FLAG_PSM_REQUESTED (8)
#define WL1271_FLAG_IRQ_PENDING (9)
#define WL1271_FLAG_IRQ_RUNNING (10)
#define WL1271_FLAG_IDLE (11)
#define WL1271_FLAG_IDLE_REQUESTED (12)
#define WL1271_FLAG_PSPOLL_FAILURE (13)
#define WL1271_FLAG_IN_ELP (5)
#define WL1271_FLAG_PSM (6)
#define WL1271_FLAG_PSM_REQUESTED (7)
#define WL1271_FLAG_IRQ_PENDING (8)
#define WL1271_FLAG_IRQ_RUNNING (9)
#define WL1271_FLAG_IDLE (10)
#define WL1271_FLAG_IDLE_REQUESTED (11)
#define WL1271_FLAG_PSPOLL_FAILURE (12)
unsigned long flags;

struct wl1271_partition_set part;
Expand Down
4 changes: 1 addition & 3 deletions drivers/net/wireless/wl12xx/wl1271_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,7 @@ static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox)
wl1271_debug(DEBUG_EVENT, "status: 0x%x",
mbox->scheduled_scan_status);

ret = wl1271_scan_complete(wl);
if (ret < 0)
return ret;
wl1271_scan_stm(wl);
}

/* disable dynamic PS when requested by the firmware */
Expand Down
11 changes: 6 additions & 5 deletions drivers/net/wireless/wl12xx/wl1271_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
Loading

0 comments on commit 08688d6

Please sign in to comment.