aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLuciano Coelho <coelho@ti.com>2011-05-31 09:38:56 -0400
committerLuciano Coelho <coelho@ti.com>2011-06-27 05:01:20 -0400
commitd2c2bb9fccdfe3cb70b276ae69e53d4890b11871 (patch)
tree83d281c87d3522b2fbe1e4667e53267669b0276b /drivers/net
parentd192d268a1fb632148046b8efe9ab78e69890dd2 (diff)
wl12xx: split channel array per band in sched_scan
The firmware, in practice, treats the channels in three separate blocks, one for each band (bg, a and j). Instead of using a single array and doing some magic with indices, split the array in 3 to make it more readable. Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/wl12xx/scan.c61
-rw-r--r--drivers/net/wireless/wl12xx/scan.h17
2 files changed, 36 insertions, 42 deletions
diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c
index 56f76abc754d..cb84dd5edf4d 100644
--- a/drivers/net/wireless/wl12xx/scan.c
+++ b/drivers/net/wireless/wl12xx/scan.c
@@ -326,7 +326,7 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl,
326 struct cfg80211_sched_scan_request *req, 326 struct cfg80211_sched_scan_request *req,
327 struct conn_scan_ch_params *channels, 327 struct conn_scan_ch_params *channels,
328 u32 band, bool radar, bool passive, 328 u32 band, bool radar, bool passive,
329 int start) 329 int start, int max_channels)
330{ 330{
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;
@@ -334,7 +334,7 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl,
334 bool force_passive = !req->n_ssids; 334 bool force_passive = !req->n_ssids;
335 335
336 for (i = 0, j = start; 336 for (i = 0, j = start;
337 i < req->n_channels && j < MAX_CHANNELS_ALL_BANDS; 337 i < req->n_channels && j < max_channels;
338 i++) { 338 i++) {
339 flags = req->channels[i]->flags; 339 flags = req->channels[i]->flags;
340 340
@@ -380,46 +380,42 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl,
380 return j - start; 380 return j - start;
381} 381}
382 382
383static int 383static bool
384wl1271_scan_sched_scan_channels(struct wl1271 *wl, 384wl1271_scan_sched_scan_channels(struct wl1271 *wl,
385 struct cfg80211_sched_scan_request *req, 385 struct cfg80211_sched_scan_request *req,
386 struct wl1271_cmd_sched_scan_config *cfg) 386 struct wl1271_cmd_sched_scan_config *cfg)
387{ 387{
388 int idx = 0;
389
390 cfg->passive[0] = 388 cfg->passive[0] =
391 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, 389 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels_2,
392 IEEE80211_BAND_2GHZ, 390 IEEE80211_BAND_2GHZ,
393 false, true, idx); 391 false, true, 0,
394 idx += cfg->passive[0]; 392 MAX_CHANNELS_2GHZ);
395
396 cfg->active[0] = 393 cfg->active[0] =
397 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, 394 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels_2,
398 IEEE80211_BAND_2GHZ, 395 IEEE80211_BAND_2GHZ,
399 false, false, idx); 396 false, false,
400 /* 397 cfg->passive[0],
401 * 5GHz channels always start at position 14, not immediately 398 MAX_CHANNELS_2GHZ);
402 * after the last 2.4GHz channel
403 */
404 idx = 14;
405
406 cfg->passive[1] = 399 cfg->passive[1] =
407 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, 400 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels_5,
408 IEEE80211_BAND_5GHZ, 401 IEEE80211_BAND_5GHZ,
409 false, true, idx); 402 false, true, 0,
410 idx += cfg->passive[1]; 403 MAX_CHANNELS_5GHZ);
411
412 cfg->dfs = 404 cfg->dfs =
413 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, 405 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels_5,
414 IEEE80211_BAND_5GHZ, 406 IEEE80211_BAND_5GHZ,
415 true, true, idx); 407 true, true,
416 idx += cfg->dfs; 408 cfg->passive[1],
417 409 MAX_CHANNELS_5GHZ);
418 cfg->active[1] = 410 cfg->active[1] =
419 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, 411 wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels_5,
420 IEEE80211_BAND_5GHZ, 412 IEEE80211_BAND_5GHZ,
421 false, false, idx); 413 false, false,
422 idx += cfg->active[1]; 414 cfg->passive[1] + cfg->dfs,
415 MAX_CHANNELS_5GHZ);
416 /* 802.11j channels are not supported yet */
417 cfg->passive[2] = 0;
418 cfg->active[2] = 0;
423 419
424 wl1271_debug(DEBUG_SCAN, " 2.4GHz: active %d passive %d", 420 wl1271_debug(DEBUG_SCAN, " 2.4GHz: active %d passive %d",
425 cfg->active[0], cfg->passive[0]); 421 cfg->active[0], cfg->passive[0]);
@@ -427,7 +423,9 @@ wl1271_scan_sched_scan_channels(struct wl1271 *wl,
427 cfg->active[1], cfg->passive[1]); 423 cfg->active[1], cfg->passive[1]);
428 wl1271_debug(DEBUG_SCAN, " DFS: %d", cfg->dfs); 424 wl1271_debug(DEBUG_SCAN, " DFS: %d", cfg->dfs);
429 425
430 return idx; 426 return cfg->passive[0] || cfg->active[0] ||
427 cfg->passive[1] || cfg->active[1] || cfg->dfs ||
428 cfg->passive[2] || cfg->active[2];
431} 429}
432 430
433int wl1271_scan_sched_scan_config(struct wl1271 *wl, 431int wl1271_scan_sched_scan_config(struct wl1271 *wl,
@@ -436,7 +434,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl,
436{ 434{
437 struct wl1271_cmd_sched_scan_config *cfg = NULL; 435 struct wl1271_cmd_sched_scan_config *cfg = NULL;
438 struct conf_sched_scan_settings *c = &wl->conf.sched_scan; 436 struct conf_sched_scan_settings *c = &wl->conf.sched_scan;
439 int i, total_channels, ret; 437 int i, ret;
440 bool force_passive = !req->n_ssids; 438 bool force_passive = !req->n_ssids;
441 439
442 wl1271_debug(DEBUG_CMD, "cmd sched_scan scan config"); 440 wl1271_debug(DEBUG_CMD, "cmd sched_scan scan config");
@@ -471,8 +469,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl,
471 cfg->ssid_len = 0; 469 cfg->ssid_len = 0;
472 } 470 }
473 471
474 total_channels = wl1271_scan_sched_scan_channels(wl, req, cfg); 472 if (!wl1271_scan_sched_scan_channels(wl, req, cfg)) {
475 if (total_channels == 0) {
476 wl1271_error("scan channel list is empty"); 473 wl1271_error("scan channel list is empty");
477 ret = -EINVAL; 474 ret = -EINVAL;
478 goto out; 475 goto out;
diff --git a/drivers/net/wireless/wl12xx/scan.h b/drivers/net/wireless/wl12xx/scan.h
index a0b6c5d67b07..ca81de20ebef 100644
--- a/drivers/net/wireless/wl12xx/scan.h
+++ b/drivers/net/wireless/wl12xx/scan.h
@@ -112,19 +112,14 @@ struct wl1271_cmd_trigger_scan_to {
112 __le32 timeout; 112 __le32 timeout;
113} __packed; 113} __packed;
114 114
115#define MAX_CHANNELS_ALL_BANDS 41 115#define MAX_CHANNELS_2GHZ 14
116#define MAX_CHANNELS_5GHZ 23
117#define MAX_CHANNELS_4GHZ 4
118
116#define SCAN_MAX_CYCLE_INTERVALS 16 119#define SCAN_MAX_CYCLE_INTERVALS 16
117#define SCAN_MAX_BANDS 3 120#define SCAN_MAX_BANDS 3
118 121
119enum { 122enum {
120 SCAN_CHANNEL_TYPE_2GHZ_PASSIVE,
121 SCAN_CHANNEL_TYPE_2GHZ_ACTIVE,
122 SCAN_CHANNEL_TYPE_5GHZ_PASSIVE,
123 SCAN_CHANNEL_TYPE_5GHZ_ACTIVE,
124 SCAN_CHANNEL_TYPE_5GHZ_DFS,
125};
126
127enum {
128 SCAN_SSID_FILTER_ANY = 0, 123 SCAN_SSID_FILTER_ANY = 0,
129 SCAN_SSID_FILTER_SPECIFIC = 1, 124 SCAN_SSID_FILTER_SPECIFIC = 1,
130 SCAN_SSID_FILTER_LIST = 2, 125 SCAN_SSID_FILTER_LIST = 2,
@@ -182,7 +177,9 @@ struct wl1271_cmd_sched_scan_config {
182 177
183 u8 padding[3]; 178 u8 padding[3];
184 179
185 struct conn_scan_ch_params channels[MAX_CHANNELS_ALL_BANDS]; 180 struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ];
181 struct conn_scan_ch_params channels_5[MAX_CHANNELS_5GHZ];
182 struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ];
186} __packed; 183} __packed;
187 184
188 185