]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
wl12xx: fix forced passive scans
authorLuciano Coelho <coelho@ti.com>
Thu, 22 Sep 2011 07:06:10 +0000 (10:06 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Nov 2011 17:43:09 +0000 (09:43 -0800)
commit 6cd9d21a0c1e2648c07c32c66bb25795ad3208aa upstream.

We were using incorrect max and min dwell times during forced passive
scans because we were still using the active scan states to scan
(passively) the channels that were not marked as passive.

Instead of doing passive scans in active states, we now skip active
states and scan for all channels in passive states.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/net/wireless/wl12xx/scan.c

index edfe01c321cadd1f4cafd3bafa595043c5a3e5c9..afb7356bd48dc70e970c7b42eddfc1b85caeaa9c 100644 (file)
@@ -83,14 +83,18 @@ static int wl1271_get_scan_channels(struct wl1271 *wl,
        for (i = 0, j = 0;
             i < req->n_channels && j < WL1271_SCAN_MAX_CHANNELS;
             i++) {
-
                flags = req->channels[i]->flags;
 
                if (!test_bit(i, wl->scan.scanned_ch) &&
                    !(flags & IEEE80211_CHAN_DISABLED) &&
-                   ((!!(flags & IEEE80211_CHAN_PASSIVE_SCAN)) == passive) &&
-                   (req->channels[i]->band == band)) {
-
+                   (req->channels[i]->band == band) &&
+                   /*
+                    * In passive scans, we scan all remaining
+                    * channels, even if not marked as such.
+                    * In active scans, we only scan channels not
+                    * marked as passive.
+                    */
+                   (passive || !(flags & IEEE80211_CHAN_PASSIVE_SCAN))) {
                        wl1271_debug(DEBUG_SCAN, "band %d, center_freq %d ",
                                     req->channels[i]->band,
                                     req->channels[i]->center_freq);
@@ -142,6 +146,10 @@ static int wl1271_scan_send(struct wl1271 *wl, enum ieee80211_band band,
        int ret;
        u16 scan_options = 0;
 
+       /* skip active scans if we don't have SSIDs */
+       if (!passive && wl->scan.req->n_ssids == 0)
+               return WL1271_NOTHING_TO_SCAN;
+
        cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
        trigger = kzalloc(sizeof(*trigger), GFP_KERNEL);
        if (!cmd || !trigger) {
@@ -152,8 +160,7 @@ static int wl1271_scan_send(struct wl1271 *wl, enum ieee80211_band band,
        /* We always use high priority scans */
        scan_options = WL1271_SCAN_OPT_PRIORITY_HIGH;
 
-       /* No SSIDs means that we have a forced passive scan */
-       if (passive || wl->scan.req->n_ssids == 0)
+       if (passive)
                scan_options |= WL1271_SCAN_OPT_PASSIVE;
 
        cmd->params.scan_options = cpu_to_le16(scan_options);