Commit 97c4361d authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman

staging: rtl8723au: Move rtw_set_802_11_ssid23a() to ioctl_cfg80211.c

Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 39dbc446
...@@ -151,141 +151,6 @@ int rtw_do_join23a(struct rtw_adapter *padapter) ...@@ -151,141 +151,6 @@ int rtw_do_join23a(struct rtw_adapter *padapter)
return ret; return ret;
} }
int rtw_set_802_11_ssid23a(struct rtw_adapter* padapter,
struct cfg80211_ssid *ssid)
{
int status = _SUCCESS;
u32 cur_time = 0;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_network *pnetwork = &pmlmepriv->cur_network;
DBG_8723A_LEVEL(_drv_always_, "set ssid [%s] fw_state = 0x%08x\n",
ssid->ssid, get_fwstate(pmlmepriv));
if (padapter->hw_init_completed == false) {
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
("set_ssid: hw_init_completed == false =>exit!!!\n"));
status = _FAIL;
goto exit;
}
spin_lock_bh(&pmlmepriv->lock);
DBG_8723A("Set SSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv));
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
goto handle_tkip_countermeasure;
else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
goto release_mlme_lock;
if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) {
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
("set_ssid: _FW_LINKED||WIFI_ADHOC_MASTER_STATE\n"));
if ((pmlmepriv->assoc_ssid.ssid_len == ssid->ssid_len) &&
!memcmp(&pmlmepriv->assoc_ssid.ssid, ssid->ssid,
ssid->ssid_len)) {
if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
RT_TRACE(_module_rtl871x_ioctl_set_c_,
_drv_err_, ("New SSID is same SSID, "
"fw_state = 0x%08x\n",
get_fwstate(pmlmepriv)));
if (rtw_is_same_ibss23a(padapter, pnetwork)) {
/*
* it means driver is in
* WIFI_ADHOC_MASTER_STATE, we needn't
* create bss again.
*/
goto release_mlme_lock;
}
/*
* if in WIFI_ADHOC_MASTER_STATE |
* WIFI_ADHOC_STATE, create bss or
* rejoin again
*/
rtw_disassoc_cmd23a(padapter, 0, true);
if (check_fwstate(pmlmepriv, _FW_LINKED))
rtw_indicate_disconnect23a(padapter);
rtw_free_assoc_resources23a(padapter, 1);
if (check_fwstate(pmlmepriv,
WIFI_ADHOC_MASTER_STATE)) {
_clr_fwstate_(pmlmepriv,
WIFI_ADHOC_MASTER_STATE);
set_fwstate(pmlmepriv,
WIFI_ADHOC_STATE);
}
} else {
rtw_lps_ctrl_wk_cmd23a(padapter, LPS_CTRL_JOINBSS, 1);
}
} else {
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
("Set SSID not the same ssid\n"));
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
("set_ssid =[%s] len = 0x%x\n", ssid->ssid,
(unsigned int)ssid->ssid_len));
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
("assoc_ssid =[%s] len = 0x%x\n",
pmlmepriv->assoc_ssid.ssid,
(unsigned int)pmlmepriv->assoc_ssid.ssid_len));
rtw_disassoc_cmd23a(padapter, 0, true);
if (check_fwstate(pmlmepriv, _FW_LINKED))
rtw_indicate_disconnect23a(padapter);
rtw_free_assoc_resources23a(padapter, 1);
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
}
}
}
handle_tkip_countermeasure:
if (padapter->securitypriv.btkip_countermeasure == true) {
cur_time = jiffies;
if ((cur_time - padapter->securitypriv.btkip_countermeasure_time) > 60 * HZ)
{
padapter->securitypriv.btkip_countermeasure = false;
padapter->securitypriv.btkip_countermeasure_time = 0;
}
else
{
status = _FAIL;
goto release_mlme_lock;
}
}
memcpy(&pmlmepriv->assoc_ssid, ssid, sizeof(struct cfg80211_ssid));
pmlmepriv->assoc_by_bssid = false;
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
pmlmepriv->to_join = true;
else
status = rtw_do_join23a(padapter);
release_mlme_lock:
spin_unlock_bh(&pmlmepriv->lock);
exit:
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
("-rtw_set_802_11_ssid23a: status =%d\n", status));
return status;
}
int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter, int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter,
struct cfg80211_ssid *pssid, struct cfg80211_ssid *pssid,
int ssid_max_num) int ssid_max_num)
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter, int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter,
struct cfg80211_ssid *pssid, struct cfg80211_ssid *pssid,
int ssid_max_num); int ssid_max_num);
int rtw_set_802_11_ssid23a(struct rtw_adapter * padapter,
struct cfg80211_ssid * ssid);
u16 rtw_get_cur_max_rate23a(struct rtw_adapter *adapter); u16 rtw_get_cur_max_rate23a(struct rtw_adapter *adapter);
s32 FillH2CCmd(struct rtw_adapter *padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer); s32 FillH2CCmd(struct rtw_adapter *padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer);
......
...@@ -1981,6 +1981,136 @@ static int rtw_cfg80211_add_wep(struct rtw_adapter *padapter, ...@@ -1981,6 +1981,136 @@ static int rtw_cfg80211_add_wep(struct rtw_adapter *padapter,
return res; return res;
} }
static int rtw_set_ssid(struct rtw_adapter* padapter,
struct cfg80211_ssid *ssid)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_network *pnetwork = &pmlmepriv->cur_network;
int status = _SUCCESS;
u32 cur_time = 0;
DBG_8723A_LEVEL(_drv_always_, "set ssid [%s] fw_state = 0x%08x\n",
ssid->ssid, get_fwstate(pmlmepriv));
if (padapter->hw_init_completed == false) {
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
("set_ssid: hw_init_completed == false =>exit!!!\n"));
status = _FAIL;
goto exit;
}
spin_lock_bh(&pmlmepriv->lock);
DBG_8723A("Set SSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv));
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
goto handle_tkip_countermeasure;
else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
goto release_mlme_lock;
if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) {
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
("set_ssid: _FW_LINKED||WIFI_ADHOC_MASTER_STATE\n"));
if (pmlmepriv->assoc_ssid.ssid_len == ssid->ssid_len &&
!memcmp(&pmlmepriv->assoc_ssid.ssid, ssid->ssid,
ssid->ssid_len)) {
if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
RT_TRACE(_module_rtl871x_ioctl_set_c_,
_drv_err_, ("New SSID is same SSID, "
"fw_state = 0x%08x\n",
get_fwstate(pmlmepriv)));
if (rtw_is_same_ibss23a(padapter, pnetwork)) {
/*
* it means driver is in
* WIFI_ADHOC_MASTER_STATE, we needn't
* create bss again.
*/
goto release_mlme_lock;
}
/*
* if in WIFI_ADHOC_MASTER_STATE |
* WIFI_ADHOC_STATE, create bss or
* rejoin again
*/
rtw_disassoc_cmd23a(padapter, 0, true);
if (check_fwstate(pmlmepriv, _FW_LINKED))
rtw_indicate_disconnect23a(padapter);
rtw_free_assoc_resources23a(padapter, 1);
if (check_fwstate(pmlmepriv,
WIFI_ADHOC_MASTER_STATE)) {
_clr_fwstate_(pmlmepriv,
WIFI_ADHOC_MASTER_STATE);
set_fwstate(pmlmepriv,
WIFI_ADHOC_STATE);
}
} else {
rtw_lps_ctrl_wk_cmd23a(padapter,
LPS_CTRL_JOINBSS, 1);
}
} else {
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
("Set SSID not the same ssid\n"));
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
("set_ssid =[%s] len = 0x%x\n", ssid->ssid,
ssid->ssid_len));
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
("assoc_ssid =[%s] len = 0x%x\n",
pmlmepriv->assoc_ssid.ssid,
pmlmepriv->assoc_ssid.ssid_len));
rtw_disassoc_cmd23a(padapter, 0, true);
if (check_fwstate(pmlmepriv, _FW_LINKED))
rtw_indicate_disconnect23a(padapter);
rtw_free_assoc_resources23a(padapter, 1);
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
}
}
}
handle_tkip_countermeasure:
if (padapter->securitypriv.btkip_countermeasure == true) {
cur_time = jiffies;
if ((cur_time -
padapter->securitypriv.btkip_countermeasure_time) >
60 * HZ) {
padapter->securitypriv.btkip_countermeasure = false;
padapter->securitypriv.btkip_countermeasure_time = 0;
} else {
status = _FAIL;
goto release_mlme_lock;
}
}
memcpy(&pmlmepriv->assoc_ssid, ssid, sizeof(struct cfg80211_ssid));
pmlmepriv->assoc_by_bssid = false;
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
pmlmepriv->to_join = true;
else
status = rtw_do_join23a(padapter);
release_mlme_lock:
spin_unlock_bh(&pmlmepriv->lock);
exit:
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
("-%s: status =%d\n", __func__, status));
return status;
}
static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_connect_params *sme) struct cfg80211_connect_params *sme)
{ {
...@@ -2208,8 +2338,8 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2208,8 +2338,8 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
/* rtw_set_802_11_encryption_mode(padapter, /* rtw_set_802_11_encryption_mode(padapter,
padapter->securitypriv.ndisencryptstatus); */ padapter->securitypriv.ndisencryptstatus); */
if (rtw_set_802_11_ssid23a(padapter, &ndis_ssid) != _SUCCESS) { if (rtw_set_ssid(padapter, &ndis_ssid) != _SUCCESS) {
ret = -1; ret = -EBUSY;
goto exit; goto exit;
} }
......
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