ath6kl: Configure probed SSID list consistently

Set max_scan_ssids and max_sched_scan_ssids to same value. These use the
same probed SSID list, so there is no point in using different maximum
number of SSIDs.

Clear probed SSID entries that are not used. This was already done for
sched_scan, but not for scan. Be consistent and clear the table for both
cases to avoid leaving bogus entries.

In addition, share the same function for setting the probed SSIDs for
scan and sched_scan paths. This fixes setting of wildcard SSID flag
(ANY_SSID_FLAG) and changes the scan path to use probed SSID index
consistently (i.e., start with 0 similarly to sched_scan; firmware
will handle the needed internal mapping).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2012-04-16 19:28:03 +03:00 committed by Kalle Valo
parent a432e7cc4f
commit 3b8ffc6a22

View File

@ -882,6 +882,32 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl_vif *vif, u8 reason,
vif->sme_state = SME_DISCONNECTED; vif->sme_state = SME_DISCONNECTED;
} }
static int ath6kl_set_probed_ssids(struct ath6kl *ar,
struct ath6kl_vif *vif,
struct cfg80211_ssid *ssids, int n_ssids)
{
u8 i;
if (n_ssids > MAX_PROBED_SSID_INDEX)
return -EINVAL;
for (i = 0; i < n_ssids; i++) {
ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx, i,
ssids[i].ssid_len ?
SPECIFIC_SSID_FLAG : ANY_SSID_FLAG,
ssids[i].ssid_len,
ssids[i].ssid);
}
/* Make sure no old entries are left behind */
for (i = n_ssids; i < MAX_PROBED_SSID_INDEX; i++) {
ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx, i,
DISABLE_SSID_FLAG, 0, NULL);
}
return 0;
}
static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_scan_request *request) struct cfg80211_scan_request *request)
{ {
@ -909,18 +935,10 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
} }
} }
if (request->n_ssids && request->ssids[0].ssid_len) { ret = ath6kl_set_probed_ssids(ar, vif, request->ssids,
u8 i; request->n_ssids);
if (ret < 0)
if (request->n_ssids > (MAX_PROBED_SSID_INDEX - 1)) return ret;
request->n_ssids = MAX_PROBED_SSID_INDEX - 1;
for (i = 0; i < request->n_ssids; i++)
ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx,
i + 1, SPECIFIC_SSID_FLAG,
request->ssids[i].ssid_len,
request->ssids[i].ssid);
}
/* this also clears IE in fw if it's not set */ /* this also clears IE in fw if it's not set */
ret = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx, ret = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx,
@ -3100,7 +3118,6 @@ static int ath6kl_cfg80211_sscan_start(struct wiphy *wiphy,
struct ath6kl_vif *vif = netdev_priv(dev); struct ath6kl_vif *vif = netdev_priv(dev);
u16 interval; u16 interval;
int ret; int ret;
u8 i;
if (ar->state != ATH6KL_STATE_ON) if (ar->state != ATH6KL_STATE_ON)
return -EIO; return -EIO;
@ -3110,11 +3127,10 @@ static int ath6kl_cfg80211_sscan_start(struct wiphy *wiphy,
ath6kl_cfg80211_scan_complete_event(vif, true); ath6kl_cfg80211_scan_complete_event(vif, true);
for (i = 0; i < ar->wiphy->max_sched_scan_ssids; i++) { ret = ath6kl_set_probed_ssids(ar, vif, request->ssids,
ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx, request->n_ssids);
i, DISABLE_SSID_FLAG, if (ret < 0)
0, NULL); return ret;
}
/* fw uses seconds, also make sure that it's >0 */ /* fw uses seconds, also make sure that it's >0 */
interval = max_t(u16, 1, request->interval / 1000); interval = max_t(u16, 1, request->interval / 1000);
@ -3123,15 +3139,6 @@ static int ath6kl_cfg80211_sscan_start(struct wiphy *wiphy,
interval, interval, interval, interval,
vif->bg_scan_period, 0, 0, 0, 3, 0, 0, 0); vif->bg_scan_period, 0, 0, 0, 3, 0, 0, 0);
if (request->n_ssids && request->ssids[0].ssid_len) {
for (i = 0; i < request->n_ssids; i++) {
ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx,
i, SPECIFIC_SSID_FLAG,
request->ssids[i].ssid_len,
request->ssids[i].ssid);
}
}
ret = ath6kl_wmi_set_wow_mode_cmd(ar->wmi, vif->fw_vif_idx, ret = ath6kl_wmi_set_wow_mode_cmd(ar->wmi, vif->fw_vif_idx,
ATH6KL_WOW_MODE_ENABLE, ATH6KL_WOW_MODE_ENABLE,
WOW_FILTER_SSID, WOW_FILTER_SSID,
@ -3449,7 +3456,7 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
wiphy->wowlan.pattern_min_len = 1; wiphy->wowlan.pattern_min_len = 1;
wiphy->wowlan.pattern_max_len = WOW_PATTERN_SIZE; wiphy->wowlan.pattern_max_len = WOW_PATTERN_SIZE;
wiphy->max_sched_scan_ssids = 10; wiphy->max_sched_scan_ssids = MAX_PROBED_SSID_INDEX;
ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM | ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM |
WIPHY_FLAG_HAVE_AP_SME | WIPHY_FLAG_HAVE_AP_SME |