aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/wl12xx/scan.c')
-rw-r--r--drivers/net/wireless/wl12xx/scan.c49
1 files changed, 33 insertions, 16 deletions
diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c
index f37e5a391976..56f76abc754d 100644
--- a/drivers/net/wireless/wl12xx/scan.c
+++ b/drivers/net/wireless/wl12xx/scan.c
@@ -331,16 +331,22 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl,
331 struct conf_sched_scan_settings *c = &wl->conf.sched_scan; 331 struct conf_sched_scan_settings *c = &wl->conf.sched_scan;
332 int i, j; 332 int i, j;
333 u32 flags; 333 u32 flags;
334 bool force_passive = !req->n_ssids;
334 335
335 for (i = 0, j = start; 336 for (i = 0, j = start;
336 i < req->n_channels && j < MAX_CHANNELS_ALL_BANDS; 337 i < req->n_channels && j < MAX_CHANNELS_ALL_BANDS;
337 i++) { 338 i++) {
338 flags = req->channels[i]->flags; 339 flags = req->channels[i]->flags;
339 340
340 if (!(flags & IEEE80211_CHAN_DISABLED) && 341 if (force_passive)
341 ((flags & IEEE80211_CHAN_PASSIVE_SCAN) == passive) && 342 flags |= IEEE80211_CHAN_PASSIVE_SCAN;
342 ((flags & IEEE80211_CHAN_RADAR) == radar) && 343
343 (req->channels[i]->band == band)) { 344 if ((req->channels[i]->band == band) &&
345 !(flags & IEEE80211_CHAN_DISABLED) &&
346 (!!(flags & IEEE80211_CHAN_RADAR) == radar) &&
347 /* if radar is set, we ignore the passive flag */
348 (radar ||
349 !!(flags & IEEE80211_CHAN_PASSIVE_SCAN) == passive)) {
344 wl1271_debug(DEBUG_SCAN, "band %d, center_freq %d ", 350 wl1271_debug(DEBUG_SCAN, "band %d, center_freq %d ",
345 req->channels[i]->band, 351 req->channels[i]->band,
346 req->channels[i]->center_freq); 352 req->channels[i]->center_freq);
@@ -350,7 +356,12 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl,
350 wl1271_debug(DEBUG_SCAN, "max_power %d", 356 wl1271_debug(DEBUG_SCAN, "max_power %d",
351 req->channels[i]->max_power); 357 req->channels[i]->max_power);
352 358
353 if (flags & IEEE80211_CHAN_PASSIVE_SCAN) { 359 if (flags & IEEE80211_CHAN_RADAR) {
360 channels[j].flags |= SCAN_CHANNEL_FLAGS_DFS;
361 channels[j].passive_duration =
362 cpu_to_le16(c->dwell_time_dfs);
363 }
364 else if (flags & IEEE80211_CHAN_PASSIVE_SCAN) {
354 channels[j].passive_duration = 365 channels[j].passive_duration =
355 cpu_to_le16(c->dwell_time_passive); 366 cpu_to_le16(c->dwell_time_passive);
356 } else { 367 } else {
@@ -359,7 +370,7 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl,
359 channels[j].max_duration = 370 channels[j].max_duration =
360 cpu_to_le16(c->max_dwell_time_active); 371 cpu_to_le16(c->max_dwell_time_active);
361 } 372 }
362 channels[j].tx_power_att = req->channels[j]->max_power; 373 channels[j].tx_power_att = req->channels[i]->max_power;
363 channels[j].channel = req->channels[i]->hw_value; 374 channels[j].channel = req->channels[i]->hw_value;
364 375
365 j++; 376 j++;
@@ -386,7 +397,11 @@ wl1271_scan_sched_scan_channels(struct wl1271 *wl,
386 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, 397 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels,
387 IEEE80211_BAND_2GHZ, 398 IEEE80211_BAND_2GHZ,
388 false, false, idx); 399 false, false, idx);
389 idx += cfg->active[0]; 400 /*
401 * 5GHz channels always start at position 14, not immediately
402 * after the last 2.4GHz channel
403 */
404 idx = 14;
390 405
391 cfg->passive[1] = 406 cfg->passive[1] =
392 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, 407 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels,
@@ -394,22 +409,23 @@ wl1271_scan_sched_scan_channels(struct wl1271 *wl,
394 false, true, idx); 409 false, true, idx);
395 idx += cfg->passive[1]; 410 idx += cfg->passive[1];
396 411
397 cfg->active[1] = 412 cfg->dfs =
398 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, 413 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels,
399 IEEE80211_BAND_5GHZ, 414 IEEE80211_BAND_5GHZ,
400 false, false, 14); 415 true, true, idx);
401 idx += cfg->active[1]; 416 idx += cfg->dfs;
402 417
403 cfg->dfs = 418 cfg->active[1] =
404 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, 419 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels,
405 IEEE80211_BAND_5GHZ, 420 IEEE80211_BAND_5GHZ,
406 true, false, idx); 421 false, false, idx);
407 idx += cfg->dfs; 422 idx += cfg->active[1];
408 423
409 wl1271_debug(DEBUG_SCAN, " 2.4GHz: active %d passive %d", 424 wl1271_debug(DEBUG_SCAN, " 2.4GHz: active %d passive %d",
410 cfg->active[0], cfg->passive[0]); 425 cfg->active[0], cfg->passive[0]);
411 wl1271_debug(DEBUG_SCAN, " 5GHz: active %d passive %d", 426 wl1271_debug(DEBUG_SCAN, " 5GHz: active %d passive %d",
412 cfg->active[1], cfg->passive[1]); 427 cfg->active[1], cfg->passive[1]);
428 wl1271_debug(DEBUG_SCAN, " DFS: %d", cfg->dfs);
413 429
414 return idx; 430 return idx;
415} 431}
@@ -421,6 +437,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl,
421 struct wl1271_cmd_sched_scan_config *cfg = NULL; 437 struct wl1271_cmd_sched_scan_config *cfg = NULL;
422 struct conf_sched_scan_settings *c = &wl->conf.sched_scan; 438 struct conf_sched_scan_settings *c = &wl->conf.sched_scan;
423 int i, total_channels, ret; 439 int i, total_channels, ret;
440 bool force_passive = !req->n_ssids;
424 441
425 wl1271_debug(DEBUG_CMD, "cmd sched_scan scan config"); 442 wl1271_debug(DEBUG_CMD, "cmd sched_scan scan config");
426 443
@@ -444,7 +461,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl,
444 for (i = 0; i < SCAN_MAX_CYCLE_INTERVALS; i++) 461 for (i = 0; i < SCAN_MAX_CYCLE_INTERVALS; i++)
445 cfg->intervals[i] = cpu_to_le32(req->interval); 462 cfg->intervals[i] = cpu_to_le32(req->interval);
446 463
447 if (req->ssids[0].ssid_len && req->ssids[0].ssid) { 464 if (!force_passive && req->ssids[0].ssid_len && req->ssids[0].ssid) {
448 cfg->filter_type = SCAN_SSID_FILTER_SPECIFIC; 465 cfg->filter_type = SCAN_SSID_FILTER_SPECIFIC;
449 cfg->ssid_len = req->ssids[0].ssid_len; 466 cfg->ssid_len = req->ssids[0].ssid_len;
450 memcpy(cfg->ssid, req->ssids[0].ssid, 467 memcpy(cfg->ssid, req->ssids[0].ssid,
@@ -461,7 +478,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl,
461 goto out; 478 goto out;
462 } 479 }
463 480
464 if (cfg->active[0]) { 481 if (!force_passive && cfg->active[0]) {
465 ret = wl1271_cmd_build_probe_req(wl, req->ssids[0].ssid, 482 ret = wl1271_cmd_build_probe_req(wl, req->ssids[0].ssid,
466 req->ssids[0].ssid_len, 483 req->ssids[0].ssid_len,
467 ies->ie[IEEE80211_BAND_2GHZ], 484 ies->ie[IEEE80211_BAND_2GHZ],
@@ -473,7 +490,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl,
473 } 490 }
474 } 491 }
475 492
476 if (cfg->active[1]) { 493 if (!force_passive && cfg->active[1]) {
477 ret = wl1271_cmd_build_probe_req(wl, req->ssids[0].ssid, 494 ret = wl1271_cmd_build_probe_req(wl, req->ssids[0].ssid,
478 req->ssids[0].ssid_len, 495 req->ssids[0].ssid_len,
479 ies->ie[IEEE80211_BAND_5GHZ], 496 ies->ie[IEEE80211_BAND_5GHZ],