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>
This commit is contained in:
committed by
John W. Linville
parent
1ebec3d750
commit
311494c47f
@@ -515,12 +515,16 @@ int wl1271_cmd_scan(struct wl1271 *wl, u8 *ssid, size_t len,
|
|||||||
|
|
||||||
struct wl1271_cmd_trigger_scan_to *trigger = NULL;
|
struct wl1271_cmd_trigger_scan_to *trigger = NULL;
|
||||||
struct wl1271_cmd_scan *params = NULL;
|
struct wl1271_cmd_scan *params = NULL;
|
||||||
int i, ret;
|
struct ieee80211_channel *channels;
|
||||||
|
int i, j, n_ch, ret;
|
||||||
u16 scan_options = 0;
|
u16 scan_options = 0;
|
||||||
|
|
||||||
if (wl->scanning)
|
if (wl->scanning)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
channels = wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ]->channels;
|
||||||
|
n_ch = wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ]->n_channels;
|
||||||
|
|
||||||
params = kzalloc(sizeof(*params), GFP_KERNEL);
|
params = kzalloc(sizeof(*params), GFP_KERNEL);
|
||||||
if (!params)
|
if (!params)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@@ -535,24 +539,29 @@ int wl1271_cmd_scan(struct wl1271 *wl, u8 *ssid, size_t len,
|
|||||||
scan_options |= WL1271_SCAN_OPT_PRIORITY_HIGH;
|
scan_options |= WL1271_SCAN_OPT_PRIORITY_HIGH;
|
||||||
params->params.scan_options = scan_options;
|
params->params.scan_options = scan_options;
|
||||||
|
|
||||||
params->params.num_channels = num_channels;
|
|
||||||
params->params.num_probe_requests = probe_requests;
|
params->params.num_probe_requests = probe_requests;
|
||||||
params->params.tx_rate = cpu_to_le32(CONF_HW_BIT_RATE_2MBPS);
|
params->params.tx_rate = cpu_to_le32(CONF_HW_BIT_RATE_2MBPS);
|
||||||
params->params.tid_trigger = 0;
|
params->params.tid_trigger = 0;
|
||||||
params->params.scan_tag = WL1271_SCAN_DEFAULT_TAG;
|
params->params.scan_tag = WL1271_SCAN_DEFAULT_TAG;
|
||||||
|
|
||||||
for (i = 0; i < num_channels; i++) {
|
for (i = 0, j = 0; i < n_ch && i < WL1271_SCAN_MAX_CHANNELS; i++) {
|
||||||
params->channels[i].min_duration =
|
if (!(channels[i].flags & IEEE80211_CHAN_DISABLED)) {
|
||||||
cpu_to_le32(WL1271_SCAN_CHAN_MIN_DURATION);
|
params->channels[j].min_duration =
|
||||||
params->channels[i].max_duration =
|
cpu_to_le32(WL1271_SCAN_CHAN_MIN_DURATION);
|
||||||
cpu_to_le32(WL1271_SCAN_CHAN_MAX_DURATION);
|
params->channels[j].max_duration =
|
||||||
memset(¶ms->channels[i].bssid_lsb, 0xff, 4);
|
cpu_to_le32(WL1271_SCAN_CHAN_MAX_DURATION);
|
||||||
memset(¶ms->channels[i].bssid_msb, 0xff, 2);
|
memset(¶ms->channels[j].bssid_lsb, 0xff, 4);
|
||||||
params->channels[i].early_termination = 0;
|
memset(¶ms->channels[j].bssid_msb, 0xff, 2);
|
||||||
params->channels[i].tx_power_att = WL1271_SCAN_CURRENT_TX_PWR;
|
params->channels[j].early_termination = 0;
|
||||||
params->channels[i].channel = i + 1;
|
params->channels[j].tx_power_att =
|
||||||
|
WL1271_SCAN_CURRENT_TX_PWR;
|
||||||
|
params->channels[j].channel = channels[i].hw_value;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
params->params.num_channels = j;
|
||||||
|
|
||||||
if (len && ssid) {
|
if (len && ssid) {
|
||||||
params->params.ssid_len = len;
|
params->params.ssid_len = len;
|
||||||
memcpy(params->params.ssid, ssid, len);
|
memcpy(params->params.ssid, ssid, len);
|
||||||
|
Reference in New Issue
Block a user