aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEyal Shapira <eyal@wizery.com>2012-03-19 06:06:28 -0400
committerLuciano Coelho <coelho@ti.com>2012-04-10 05:47:24 -0400
commit6f407e5bc7af4e125e20e4f9c893f3df8fadb202 (patch)
tree5180a881af3ad918e9989176b1bf4d8a1cd20aa3
parent3eba4a0e6db9ca225bc0f3042d60fcfc86a30bc8 (diff)
wl12xx: adaptive sched scan dwell times
Set the dwell times for sched scan according to the number of probe requests which are going to be transmitted. This should fix the too short dwell time problem which prevented some of the probe requests from being transmitted in cases of high number of SSIDs (10+) to be actively sched scanned. However, in the common case of having up to 1-2 SSIDs that require active scan, the dwell time would be kept to a minimum which should conserve power. This is important as sched scan also runs periodically while the host is suspended and there's great importance to keep power consumption as low as possible. Signed-off-by: Eyal Shapira <eyal@wizery.com> [fixed a couple of new strict checkpatch warnings] Signed-off-by: Luciano Coelho <coelho@ti.com>
-rw-r--r--drivers/net/wireless/wl12xx/conf.h27
-rw-r--r--drivers/net/wireless/wl12xx/main.c23
-rw-r--r--drivers/net/wireless/wl12xx/scan.c28
3 files changed, 60 insertions, 18 deletions
diff --git a/drivers/net/wireless/wl12xx/conf.h b/drivers/net/wireless/wl12xx/conf.h
index 3e581e19424c..5d2a9e004c72 100644
--- a/drivers/net/wireless/wl12xx/conf.h
+++ b/drivers/net/wireless/wl12xx/conf.h
@@ -1096,16 +1096,31 @@ struct conf_scan_settings {
1096}; 1096};
1097 1097
1098struct conf_sched_scan_settings { 1098struct conf_sched_scan_settings {
1099 /* minimum time to wait on the channel for active scans (in TUs) */ 1099 /*
1100 u16 min_dwell_time_active; 1100 * The base time to wait on the channel for active scans (in TU/1000).
1101 * The minimum dwell time is calculated according to this:
1102 * min_dwell_time = base + num_of_probes_to_be_sent * delta_per_probe
1103 * The maximum dwell time is calculated according to this:
1104 * max_dwell_time = min_dwell_time + max_dwell_time_delta
1105 */
1106 u32 base_dwell_time;
1107
1108 /* The delta between the min dwell time and max dwell time for
1109 * active scans (in TU/1000s). The max dwell time is used by the FW once
1110 * traffic is detected on the channel.
1111 */
1112 u32 max_dwell_time_delta;
1113
1114 /* Delta added to min dwell time per each probe in 2.4 GHz (TU/1000) */
1115 u32 dwell_time_delta_per_probe;
1101 1116
1102 /* maximum time to wait on the channel for active scans (in TUs) */ 1117 /* Delta added to min dwell time per each probe in 5 GHz (TU/1000) */
1103 u16 max_dwell_time_active; 1118 u32 dwell_time_delta_per_probe_5;
1104 1119
1105 /* time to wait on the channel for passive scans (in TUs) */ 1120 /* time to wait on the channel for passive scans (in TU/1000) */
1106 u32 dwell_time_passive; 1121 u32 dwell_time_passive;
1107 1122
1108 /* time to wait on the channel for DFS scans (in TUs) */ 1123 /* time to wait on the channel for DFS scans (in TU/1000) */
1109 u32 dwell_time_dfs; 1124 u32 dwell_time_dfs;
1110 1125
1111 /* number of probe requests to send on each channel in active scans */ 1126 /* number of probe requests to send on each channel in active scans */
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index b560f2d2837b..96ca25a92b76 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -276,14 +276,21 @@ static struct conf_drv_settings default_conf = {
276 .split_scan_timeout = 50000, 276 .split_scan_timeout = 50000,
277 }, 277 },
278 .sched_scan = { 278 .sched_scan = {
279 /* sched_scan requires dwell times in TU instead of TU/1000 */ 279 /*
280 .min_dwell_time_active = 30, 280 * Values are in TU/1000 but since sched scan FW command
281 .max_dwell_time_active = 60, 281 * params are in TUs rounding up may occur.
282 .dwell_time_passive = 100, 282 */
283 .dwell_time_dfs = 150, 283 .base_dwell_time = 7500,
284 .num_probe_reqs = 2, 284 .max_dwell_time_delta = 22500,
285 .rssi_threshold = -90, 285 /* based on 250bits per probe @1Mbps */
286 .snr_threshold = 0, 286 .dwell_time_delta_per_probe = 2000,
287 /* based on 250bits per probe @6Mbps (plus a bit more) */
288 .dwell_time_delta_per_probe_5 = 350,
289 .dwell_time_passive = 100000,
290 .dwell_time_dfs = 150000,
291 .num_probe_reqs = 2,
292 .rssi_threshold = -90,
293 .snr_threshold = 0,
287 }, 294 },
288 .rf = { 295 .rf = {
289 .tx_per_channel_power_compensation_2 = { 296 .tx_per_channel_power_compensation_2 = {
diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c
index fcba055ef196..a57f333d07f5 100644
--- a/drivers/net/wireless/wl12xx/scan.c
+++ b/drivers/net/wireless/wl12xx/scan.c
@@ -417,6 +417,23 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl,
417 int i, j; 417 int i, j;
418 u32 flags; 418 u32 flags;
419 bool force_passive = !req->n_ssids; 419 bool force_passive = !req->n_ssids;
420 u32 min_dwell_time_active, max_dwell_time_active, delta_per_probe;
421 u32 dwell_time_passive, dwell_time_dfs;
422
423 if (band == IEEE80211_BAND_5GHZ)
424 delta_per_probe = c->dwell_time_delta_per_probe_5;
425 else
426 delta_per_probe = c->dwell_time_delta_per_probe;
427
428 min_dwell_time_active = c->base_dwell_time +
429 req->n_ssids * c->num_probe_reqs * delta_per_probe;
430
431 max_dwell_time_active = min_dwell_time_active + c->max_dwell_time_delta;
432
433 min_dwell_time_active = DIV_ROUND_UP(min_dwell_time_active, 1000);
434 max_dwell_time_active = DIV_ROUND_UP(max_dwell_time_active, 1000);
435 dwell_time_passive = DIV_ROUND_UP(c->dwell_time_passive, 1000);
436 dwell_time_dfs = DIV_ROUND_UP(c->dwell_time_dfs, 1000);
420 437
421 for (i = 0, j = start; 438 for (i = 0, j = start;
422 i < req->n_channels && j < max_channels; 439 i < req->n_channels && j < max_channels;
@@ -440,21 +457,24 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl,
440 req->channels[i]->flags); 457 req->channels[i]->flags);
441 wl1271_debug(DEBUG_SCAN, "max_power %d", 458 wl1271_debug(DEBUG_SCAN, "max_power %d",
442 req->channels[i]->max_power); 459 req->channels[i]->max_power);
460 wl1271_debug(DEBUG_SCAN, "min_dwell_time %d max dwell time %d",
461 min_dwell_time_active,
462 max_dwell_time_active);
443 463
444 if (flags & IEEE80211_CHAN_RADAR) { 464 if (flags & IEEE80211_CHAN_RADAR) {
445 channels[j].flags |= SCAN_CHANNEL_FLAGS_DFS; 465 channels[j].flags |= SCAN_CHANNEL_FLAGS_DFS;
446 466
447 channels[j].passive_duration = 467 channels[j].passive_duration =
448 cpu_to_le16(c->dwell_time_dfs); 468 cpu_to_le16(dwell_time_dfs);
449 } else { 469 } else {
450 channels[j].passive_duration = 470 channels[j].passive_duration =
451 cpu_to_le16(c->dwell_time_passive); 471 cpu_to_le16(dwell_time_passive);
452 } 472 }
453 473
454 channels[j].min_duration = 474 channels[j].min_duration =
455 cpu_to_le16(c->min_dwell_time_active); 475 cpu_to_le16(min_dwell_time_active);
456 channels[j].max_duration = 476 channels[j].max_duration =
457 cpu_to_le16(c->max_dwell_time_active); 477 cpu_to_le16(max_dwell_time_active);
458 478
459 channels[j].tx_power_att = req->channels[i]->max_power; 479 channels[j].tx_power_att = req->channels[i]->max_power;
460 channels[j].channel = req->channels[i]->hw_value; 480 channels[j].channel = req->channels[i]->hw_value;