Commit 14ee6f6b authored by Vasanthakumar Thiagarajan's avatar Vasanthakumar Thiagarajan Committed by Kalle Valo

ath6kl: Move scan_req info and sme_state to vif

Signed-off-by: default avatarVasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent de3ad713
...@@ -311,7 +311,7 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, ...@@ -311,7 +311,7 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
struct ath6kl_vif *vif = netdev_priv(dev); struct ath6kl_vif *vif = netdev_priv(dev);
int status; int status;
ar->sme_state = SME_CONNECTING; vif->sme_state = SME_CONNECTING;
if (!ath6kl_cfg80211_ready(ar)) if (!ath6kl_cfg80211_ready(ar))
return -EIO; return -EIO;
...@@ -601,14 +601,14 @@ void ath6kl_cfg80211_connect_event(struct ath6kl *ar, u16 channel, ...@@ -601,14 +601,14 @@ void ath6kl_cfg80211_connect_event(struct ath6kl *ar, u16 channel,
return; return;
} }
if (ar->sme_state == SME_CONNECTING) { if (vif->sme_state == SME_CONNECTING) {
/* inform connect result to cfg80211 */ /* inform connect result to cfg80211 */
ar->sme_state = SME_CONNECTED; vif->sme_state = SME_CONNECTED;
cfg80211_connect_result(ar->net_dev, bssid, cfg80211_connect_result(ar->net_dev, bssid,
assoc_req_ie, assoc_req_len, assoc_req_ie, assoc_req_len,
assoc_resp_ie, assoc_resp_len, assoc_resp_ie, assoc_resp_len,
WLAN_STATUS_SUCCESS, GFP_KERNEL); WLAN_STATUS_SUCCESS, GFP_KERNEL);
} else if (ar->sme_state == SME_CONNECTED) { } else if (vif->sme_state == SME_CONNECTED) {
/* inform roam event to cfg80211 */ /* inform roam event to cfg80211 */
cfg80211_roamed(ar->net_dev, chan, bssid, cfg80211_roamed(ar->net_dev, chan, bssid,
assoc_req_ie, assoc_req_len, assoc_req_ie, assoc_req_len,
...@@ -648,7 +648,7 @@ static int ath6kl_cfg80211_disconnect(struct wiphy *wiphy, ...@@ -648,7 +648,7 @@ static int ath6kl_cfg80211_disconnect(struct wiphy *wiphy,
up(&ar->sem); up(&ar->sem);
ar->sme_state = SME_DISCONNECTED; vif->sme_state = SME_DISCONNECTED;
return 0; return 0;
} }
...@@ -660,9 +660,9 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl *ar, u8 reason, ...@@ -660,9 +660,9 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl *ar, u8 reason,
/* TODO: Findout vif */ /* TODO: Findout vif */
struct ath6kl_vif *vif = ar->vif; struct ath6kl_vif *vif = ar->vif;
if (ar->scan_req) { if (vif->scan_req) {
cfg80211_scan_done(ar->scan_req, true); cfg80211_scan_done(vif->scan_req, true);
ar->scan_req = NULL; vif->scan_req = NULL;
} }
if (vif->nw_type & ADHOC_NETWORK) { if (vif->nw_type & ADHOC_NETWORK) {
...@@ -701,18 +701,18 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl *ar, u8 reason, ...@@ -701,18 +701,18 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl *ar, u8 reason,
clear_bit(CONNECT_PEND, &vif->flags); clear_bit(CONNECT_PEND, &vif->flags);
if (ar->sme_state == SME_CONNECTING) { if (vif->sme_state == SME_CONNECTING) {
cfg80211_connect_result(ar->net_dev, cfg80211_connect_result(ar->net_dev,
bssid, NULL, 0, bssid, NULL, 0,
NULL, 0, NULL, 0,
WLAN_STATUS_UNSPECIFIED_FAILURE, WLAN_STATUS_UNSPECIFIED_FAILURE,
GFP_KERNEL); GFP_KERNEL);
} else if (ar->sme_state == SME_CONNECTED) { } else if (vif->sme_state == SME_CONNECTED) {
cfg80211_disconnected(ar->net_dev, reason, cfg80211_disconnected(ar->net_dev, reason,
NULL, 0, GFP_KERNEL); NULL, 0, GFP_KERNEL);
} }
ar->sme_state = SME_DISCONNECTED; vif->sme_state = SME_DISCONNECTED;
} }
static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
...@@ -793,7 +793,7 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, ...@@ -793,7 +793,7 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
if (ret) if (ret)
ath6kl_err("wmi_startscan_cmd failed\n"); ath6kl_err("wmi_startscan_cmd failed\n");
else else
ar->scan_req = request; vif->scan_req = request;
kfree(channels); kfree(channels);
...@@ -802,22 +802,24 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, ...@@ -802,22 +802,24 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
void ath6kl_cfg80211_scan_complete_event(struct ath6kl *ar, int status) void ath6kl_cfg80211_scan_complete_event(struct ath6kl *ar, int status)
{ {
/* TODO: Findout vif */
struct ath6kl_vif *vif = ar->vif;
int i; int i;
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: status %d\n", __func__, status); ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: status %d\n", __func__, status);
if (!ar->scan_req) if (!vif->scan_req)
return; return;
if ((status == -ECANCELED) || (status == -EBUSY)) { if ((status == -ECANCELED) || (status == -EBUSY)) {
cfg80211_scan_done(ar->scan_req, true); cfg80211_scan_done(vif->scan_req, true);
goto out; goto out;
} }
cfg80211_scan_done(ar->scan_req, false); cfg80211_scan_done(vif->scan_req, false);
if (ar->scan_req->n_ssids && ar->scan_req->ssids[0].ssid_len) { if (vif->scan_req->n_ssids && vif->scan_req->ssids[0].ssid_len) {
for (i = 0; i < ar->scan_req->n_ssids; i++) { for (i = 0; i < vif->scan_req->n_ssids; i++) {
ath6kl_wmi_probedssid_cmd(ar->wmi, i + 1, ath6kl_wmi_probedssid_cmd(ar->wmi, i + 1,
DISABLE_SSID_FLAG, DISABLE_SSID_FLAG,
0, NULL); 0, NULL);
...@@ -825,7 +827,7 @@ void ath6kl_cfg80211_scan_complete_event(struct ath6kl *ar, int status) ...@@ -825,7 +827,7 @@ void ath6kl_cfg80211_scan_complete_event(struct ath6kl *ar, int status)
} }
out: out:
ar->scan_req = NULL; vif->scan_req = NULL;
} }
static int ath6kl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, static int ath6kl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
...@@ -2122,7 +2124,7 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name, ...@@ -2122,7 +2124,7 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
if (register_netdev(ndev)) if (register_netdev(ndev))
goto err; goto err;
ar->sme_state = SME_DISCONNECTED; vif->sme_state = SME_DISCONNECTED;
set_bit(WLAN_ENABLED, &vif->flags); set_bit(WLAN_ENABLED, &vif->flags);
ar->wlan_pwr_state = WLAN_POWER_STATE_ON; ar->wlan_pwr_state = WLAN_POWER_STATE_ON;
set_bit(NETDEV_REGISTERED, &vif->flags); set_bit(NETDEV_REGISTERED, &vif->flags);
...@@ -2137,9 +2139,12 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name, ...@@ -2137,9 +2139,12 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
void ath6kl_deinit_ieee80211_hw(struct ath6kl *ar) void ath6kl_deinit_ieee80211_hw(struct ath6kl *ar)
{ {
if (ar->scan_req) { /* TODO: Findout vif */
cfg80211_scan_done(ar->scan_req, true); struct ath6kl_vif *vif = ar->vif;
ar->scan_req = NULL;
if (vif->scan_req) {
cfg80211_scan_done(vif->scan_req, true);
vif->scan_req = NULL;
} }
wiphy_unregister(ar->wiphy); wiphy_unregister(ar->wiphy);
......
...@@ -417,6 +417,8 @@ struct ath6kl_vif { ...@@ -417,6 +417,8 @@ struct ath6kl_vif {
struct ath6kl_key keys[WMI_MAX_KEY_INDEX + 1]; struct ath6kl_key keys[WMI_MAX_KEY_INDEX + 1];
struct aggr_info *aggr_cntxt; struct aggr_info *aggr_cntxt;
struct timer_list disconnect_timer; struct timer_list disconnect_timer;
struct cfg80211_scan_request *scan_req;
enum sme_state sme_state;
}; };
/* Flag info */ /* Flag info */
...@@ -480,8 +482,6 @@ struct ath6kl { ...@@ -480,8 +482,6 @@ struct ath6kl {
struct list_head amsdu_rx_buffer_queue; struct list_head amsdu_rx_buffer_queue;
u8 rx_meta_ver; u8 rx_meta_ver;
struct wireless_dev *wdev; struct wireless_dev *wdev;
struct cfg80211_scan_request *scan_req;
enum sme_state sme_state;
enum wlan_low_pwr_state wlan_pwr_state; enum wlan_low_pwr_state wlan_pwr_state;
struct wmi_scan_params_cmd sc_params; struct wmi_scan_params_cmd sc_params;
#define AR_MCAST_FILTER_MAC_ADDR_SIZE 4 #define AR_MCAST_FILTER_MAC_ADDR_SIZE 4
......
...@@ -941,7 +941,7 @@ void ath6kl_deep_sleep_enable(struct ath6kl *ar) ...@@ -941,7 +941,7 @@ void ath6kl_deep_sleep_enable(struct ath6kl *ar)
/* TODO: Pass vif instead of taking it from ar */ /* TODO: Pass vif instead of taking it from ar */
struct ath6kl_vif *vif = ar->vif; struct ath6kl_vif *vif = ar->vif;
switch (ar->sme_state) { switch (vif->sme_state) {
case SME_CONNECTING: case SME_CONNECTING:
cfg80211_connect_result(ar->net_dev, vif->bssid, NULL, 0, cfg80211_connect_result(ar->net_dev, vif->bssid, NULL, 0,
NULL, 0, NULL, 0,
...@@ -963,7 +963,7 @@ void ath6kl_deep_sleep_enable(struct ath6kl *ar) ...@@ -963,7 +963,7 @@ void ath6kl_deep_sleep_enable(struct ath6kl *ar)
test_bit(CONNECT_PEND, &vif->flags)) test_bit(CONNECT_PEND, &vif->flags))
ath6kl_wmi_disconnect_cmd(ar->wmi); ath6kl_wmi_disconnect_cmd(ar->wmi);
ar->sme_state = SME_DISCONNECTED; vif->sme_state = SME_DISCONNECTED;
/* disable scanning */ /* disable scanning */
if (ath6kl_wmi_scanparams_cmd(ar->wmi, 0xFFFF, 0, 0, 0, 0, 0, 0, 0, if (ath6kl_wmi_scanparams_cmd(ar->wmi, 0xFFFF, 0, 0, 0, 0, 0, 0, 0,
......
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