aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTeemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>2009-10-13 05:47:49 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-27 16:48:10 -0400
commit311494c47fb670a1fd74eea54fa4d02a56fcc2ad (patch)
treee19d178c4a2cb7ea0f75a93e4af5c2286121e198 /drivers
parent1ebec3d750f2b5740e3c334dac06104d2f74a9b1 (diff)
wl1271: Scan only enabled channels
Added checking of whether channel is enabled or disabled by mac80211 stack to scan. Disabled channels are not scanned. Signed-off-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com> Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index f38e3e0e2d6..204e87218d8 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -515,12 +515,16 @@ int wl1271_cmd_scan(struct wl1271 *wl, u8 *ssid, size_t len,
515 515
516 struct wl1271_cmd_trigger_scan_to *trigger = NULL; 516 struct wl1271_cmd_trigger_scan_to *trigger = NULL;
517 struct wl1271_cmd_scan *params = NULL; 517 struct wl1271_cmd_scan *params = NULL;
518 int i, ret; 518 struct ieee80211_channel *channels;
519 int i, j, n_ch, ret;
519 u16 scan_options = 0; 520 u16 scan_options = 0;
520 521
521 if (wl->scanning) 522 if (wl->scanning)
522 return -EINVAL; 523 return -EINVAL;
523 524
525 channels = wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ]->channels;
526 n_ch = wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ]->n_channels;
527
524 params = kzalloc(sizeof(*params), GFP_KERNEL); 528 params = kzalloc(sizeof(*params), GFP_KERNEL);
525 if (!params) 529 if (!params)
526 return -ENOMEM; 530 return -ENOMEM;
@@ -535,24 +539,29 @@ int wl1271_cmd_scan(struct wl1271 *wl, u8 *ssid, size_t len,
535 scan_options |= WL1271_SCAN_OPT_PRIORITY_HIGH; 539 scan_options |= WL1271_SCAN_OPT_PRIORITY_HIGH;
536 params->params.scan_options = scan_options; 540 params->params.scan_options = scan_options;
537 541
538 params->params.num_channels = num_channels;
539 params->params.num_probe_requests = probe_requests; 542 params->params.num_probe_requests = probe_requests;
540 params->params.tx_rate = cpu_to_le32(CONF_HW_BIT_RATE_2MBPS); 543 params->params.tx_rate = cpu_to_le32(CONF_HW_BIT_RATE_2MBPS);
541 params->params.tid_trigger = 0; 544 params->params.tid_trigger = 0;
542 params->params.scan_tag = WL1271_SCAN_DEFAULT_TAG; 545 params->params.scan_tag = WL1271_SCAN_DEFAULT_TAG;
543 546
544 for (i = 0; i < num_channels; i++) { 547 for (i = 0, j = 0; i < n_ch && i < WL1271_SCAN_MAX_CHANNELS; i++) {
545 params->channels[i].min_duration = 548 if (!(channels[i].flags & IEEE80211_CHAN_DISABLED)) {
546 cpu_to_le32(WL1271_SCAN_CHAN_MIN_DURATION); 549 params->channels[j].min_duration =
547 params->channels[i].max_duration = 550 cpu_to_le32(WL1271_SCAN_CHAN_MIN_DURATION);
548 cpu_to_le32(WL1271_SCAN_CHAN_MAX_DURATION); 551 params->channels[j].max_duration =
549 memset(&params->channels[i].bssid_lsb, 0xff, 4); 552 cpu_to_le32(WL1271_SCAN_CHAN_MAX_DURATION);
550 memset(&params->channels[i].bssid_msb, 0xff, 2); 553 memset(&params->channels[j].bssid_lsb, 0xff, 4);
551 params->channels[i].early_termination = 0; 554 memset(&params->channels[j].bssid_msb, 0xff, 2);
552 params->channels[i].tx_power_att = WL1271_SCAN_CURRENT_TX_PWR; 555 params->channels[j].early_termination = 0;
553 params->channels[i].channel = i + 1; 556 params->channels[j].tx_power_att =
557 WL1271_SCAN_CURRENT_TX_PWR;
558 params->channels[j].channel = channels[i].hw_value;
559 j++;
560 }
554 } 561 }
555 562
563 params->params.num_channels = j;
564
556 if (len && ssid) { 565 if (len && ssid) {
557 params->params.ssid_len = len; 566 params->params.ssid_len = len;
558 memcpy(params->params.ssid, ssid, len); 567 memcpy(params->params.ssid, ssid, len);