Commit d2c2bb9f authored by Luciano Coelho's avatar Luciano Coelho

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: default avatarLuciano Coelho <coelho@ti.com>
parent d192d268
...@@ -326,7 +326,7 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl, ...@@ -326,7 +326,7 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl,
struct cfg80211_sched_scan_request *req, struct cfg80211_sched_scan_request *req,
struct conn_scan_ch_params *channels, struct conn_scan_ch_params *channels,
u32 band, bool radar, bool passive, u32 band, bool radar, bool passive,
int start) int start, int max_channels)
{ {
struct conf_sched_scan_settings *c = &wl->conf.sched_scan; struct conf_sched_scan_settings *c = &wl->conf.sched_scan;
int i, j; int i, j;
...@@ -334,7 +334,7 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl, ...@@ -334,7 +334,7 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl,
bool force_passive = !req->n_ssids; bool force_passive = !req->n_ssids;
for (i = 0, j = start; for (i = 0, j = start;
i < req->n_channels && j < MAX_CHANNELS_ALL_BANDS; i < req->n_channels && j < max_channels;
i++) { i++) {
flags = req->channels[i]->flags; flags = req->channels[i]->flags;
...@@ -380,46 +380,42 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl, ...@@ -380,46 +380,42 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl,
return j - start; return j - start;
} }
static int static bool
wl1271_scan_sched_scan_channels(struct wl1271 *wl, wl1271_scan_sched_scan_channels(struct wl1271 *wl,
struct cfg80211_sched_scan_request *req, struct cfg80211_sched_scan_request *req,
struct wl1271_cmd_sched_scan_config *cfg) struct wl1271_cmd_sched_scan_config *cfg)
{ {
int idx = 0;
cfg->passive[0] = cfg->passive[0] =
wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels_2,
IEEE80211_BAND_2GHZ, IEEE80211_BAND_2GHZ,
false, true, idx); false, true, 0,
idx += cfg->passive[0]; MAX_CHANNELS_2GHZ);
cfg->active[0] = cfg->active[0] =
wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels_2,
IEEE80211_BAND_2GHZ, IEEE80211_BAND_2GHZ,
false, false, idx); false, false,
/* cfg->passive[0],
* 5GHz channels always start at position 14, not immediately MAX_CHANNELS_2GHZ);
* after the last 2.4GHz channel
*/
idx = 14;
cfg->passive[1] = cfg->passive[1] =
wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels_5,
IEEE80211_BAND_5GHZ, IEEE80211_BAND_5GHZ,
false, true, idx); false, true, 0,
idx += cfg->passive[1]; MAX_CHANNELS_5GHZ);
cfg->dfs = cfg->dfs =
wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels_5,
IEEE80211_BAND_5GHZ, IEEE80211_BAND_5GHZ,
true, true, idx); true, true,
idx += cfg->dfs; cfg->passive[1],
MAX_CHANNELS_5GHZ);
cfg->active[1] = cfg->active[1] =
wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels_5,
IEEE80211_BAND_5GHZ, IEEE80211_BAND_5GHZ,
false, false, idx); false, false,
idx += cfg->active[1]; cfg->passive[1] + cfg->dfs,
MAX_CHANNELS_5GHZ);
/* 802.11j channels are not supported yet */
cfg->passive[2] = 0;
cfg->active[2] = 0;
wl1271_debug(DEBUG_SCAN, " 2.4GHz: active %d passive %d", wl1271_debug(DEBUG_SCAN, " 2.4GHz: active %d passive %d",
cfg->active[0], cfg->passive[0]); cfg->active[0], cfg->passive[0]);
...@@ -427,7 +423,9 @@ wl1271_scan_sched_scan_channels(struct wl1271 *wl, ...@@ -427,7 +423,9 @@ wl1271_scan_sched_scan_channels(struct wl1271 *wl,
cfg->active[1], cfg->passive[1]); cfg->active[1], cfg->passive[1]);
wl1271_debug(DEBUG_SCAN, " DFS: %d", cfg->dfs); wl1271_debug(DEBUG_SCAN, " DFS: %d", cfg->dfs);
return idx; return cfg->passive[0] || cfg->active[0] ||
cfg->passive[1] || cfg->active[1] || cfg->dfs ||
cfg->passive[2] || cfg->active[2];
} }
int wl1271_scan_sched_scan_config(struct wl1271 *wl, int wl1271_scan_sched_scan_config(struct wl1271 *wl,
...@@ -436,7 +434,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl, ...@@ -436,7 +434,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl,
{ {
struct wl1271_cmd_sched_scan_config *cfg = NULL; struct wl1271_cmd_sched_scan_config *cfg = NULL;
struct conf_sched_scan_settings *c = &wl->conf.sched_scan; struct conf_sched_scan_settings *c = &wl->conf.sched_scan;
int i, total_channels, ret; int i, ret;
bool force_passive = !req->n_ssids; bool force_passive = !req->n_ssids;
wl1271_debug(DEBUG_CMD, "cmd sched_scan scan config"); wl1271_debug(DEBUG_CMD, "cmd sched_scan scan config");
...@@ -471,8 +469,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl, ...@@ -471,8 +469,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl,
cfg->ssid_len = 0; cfg->ssid_len = 0;
} }
total_channels = wl1271_scan_sched_scan_channels(wl, req, cfg); if (!wl1271_scan_sched_scan_channels(wl, req, cfg)) {
if (total_channels == 0) {
wl1271_error("scan channel list is empty"); wl1271_error("scan channel list is empty");
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
......
...@@ -112,18 +112,13 @@ struct wl1271_cmd_trigger_scan_to { ...@@ -112,18 +112,13 @@ struct wl1271_cmd_trigger_scan_to {
__le32 timeout; __le32 timeout;
} __packed; } __packed;
#define MAX_CHANNELS_ALL_BANDS 41 #define MAX_CHANNELS_2GHZ 14
#define MAX_CHANNELS_5GHZ 23
#define MAX_CHANNELS_4GHZ 4
#define SCAN_MAX_CYCLE_INTERVALS 16 #define SCAN_MAX_CYCLE_INTERVALS 16
#define SCAN_MAX_BANDS 3 #define SCAN_MAX_BANDS 3
enum {
SCAN_CHANNEL_TYPE_2GHZ_PASSIVE,
SCAN_CHANNEL_TYPE_2GHZ_ACTIVE,
SCAN_CHANNEL_TYPE_5GHZ_PASSIVE,
SCAN_CHANNEL_TYPE_5GHZ_ACTIVE,
SCAN_CHANNEL_TYPE_5GHZ_DFS,
};
enum { enum {
SCAN_SSID_FILTER_ANY = 0, SCAN_SSID_FILTER_ANY = 0,
SCAN_SSID_FILTER_SPECIFIC = 1, SCAN_SSID_FILTER_SPECIFIC = 1,
...@@ -182,7 +177,9 @@ struct wl1271_cmd_sched_scan_config { ...@@ -182,7 +177,9 @@ struct wl1271_cmd_sched_scan_config {
u8 padding[3]; u8 padding[3];
struct conn_scan_ch_params channels[MAX_CHANNELS_ALL_BANDS]; struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ];
struct conn_scan_ch_params channels_5[MAX_CHANNELS_5GHZ];
struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ];
} __packed; } __packed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment