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

staging: rtl8723au: Consolidate duplicate adhoc joining code into rtw_do_join_adhoc()

Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ca3504be
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
int rtw_do_join23a(struct rtw_adapter *padapter) int rtw_do_join23a(struct rtw_adapter *padapter)
{ {
struct list_head *plist, *phead; struct list_head *plist, *phead;
u8* pibss = NULL;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct rtw_queue *queue = &pmlmepriv->scanned_queue; struct rtw_queue *queue = &pmlmepriv->scanned_queue;
int ret = _SUCCESS; int ret = _SUCCESS;
...@@ -80,43 +79,10 @@ int rtw_do_join23a(struct rtw_adapter *padapter) ...@@ -80,43 +79,10 @@ int rtw_do_join23a(struct rtw_adapter *padapter)
pmlmepriv->to_join = false; pmlmepriv->to_join = false;
} else { } else {
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
struct wlan_bssid_ex *pdev_network; /* switch to ADHOC_MASTER */
/* submit createbss_cmd to change to a ret = rtw_do_join_adhoc(padapter);
ADHOC_MASTER */ if (ret != _SUCCESS)
/* pmlmepriv->lock has been acquired by
caller... */
pdev_network =
&padapter->registrypriv.dev_network;
pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE;
pibss = padapter->registrypriv.dev_network.MacAddress;
memcpy(&pdev_network->Ssid,
&pmlmepriv->assoc_ssid,
sizeof(struct cfg80211_ssid));
rtw_update_registrypriv_dev_network23a(padapter);
rtw_generate_random_ibss23a(pibss);
if (rtw_createbss_cmd23a(padapter) != _SUCCESS) {
RT_TRACE(_module_rtl871x_ioctl_set_c_,
_drv_err_,
("***Error =>do_goin: rtw_creat"
"ebss_cmd status FAIL***\n"));
ret = _FAIL;
goto exit; goto exit;
}
pmlmepriv->to_join = false;
RT_TRACE(_module_rtl871x_ioctl_set_c_,
_drv_info_,
("***Error => rtw_select_and_join_from"
"_scanned_queue FAIL under STA_Mode"
"***\n "));
} else { } else {
/* can't associate ; reset under-linking */ /* can't associate ; reset under-linking */
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
......
...@@ -705,8 +705,6 @@ rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf) ...@@ -705,8 +705,6 @@ rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf)
{ {
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
struct wlan_bssid_ex *pdev_network;
u8 *pibss;
spin_lock_bh(&pmlmepriv->lock); spin_lock_bh(&pmlmepriv->lock);
...@@ -738,39 +736,8 @@ rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf) ...@@ -738,39 +736,8 @@ rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf)
set_fwstate(pmlmepriv, _FW_UNDER_LINKING); set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
if (rtw_select_and_join_from_scanned_queue23a( if (rtw_select_and_join_from_scanned_queue23a(
pmlmepriv) == _SUCCESS) { pmlmepriv) != _SUCCESS)
} else { rtw_do_join_adhoc(adapter);
pdev_network = &adapter->registrypriv.dev_network;
pibss = adapter->registrypriv.dev_network.MacAddress;
_clr_fwstate_(pmlmepriv,
_FW_UNDER_SURVEY);
RT_TRACE(_module_rtl871x_mlme_c_,
_drv_err_,
("switching to adhoc "
"master\n"));
memcpy(&pdev_network->Ssid,
&pmlmepriv->assoc_ssid,
sizeof(struct cfg80211_ssid));
rtw_update_registrypriv_dev_network23a(
adapter);
rtw_generate_random_ibss23a(pibss);
pmlmepriv->fw_state =
WIFI_ADHOC_MASTER_STATE;
if (rtw_createbss_cmd23a(adapter) !=
_SUCCESS)
RT_TRACE(_module_rtl871x_mlme_c_,
_drv_err_,
("Error =>rtw_createbss_cmd23a"
" status FAIL\n"));
pmlmepriv->to_join = false;
}
} }
} else { } else {
int ret; int ret;
...@@ -1425,7 +1392,6 @@ void rtw_stadel_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf) ...@@ -1425,7 +1392,6 @@ void rtw_stadel_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf)
struct sta_info *psta; struct sta_info *psta;
struct wlan_network* pwlan; struct wlan_network* pwlan;
struct wlan_bssid_ex *pdev_network; struct wlan_bssid_ex *pdev_network;
u8 *pibss;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
struct stadel_event *pstadel = (struct stadel_event *)pbuf; struct stadel_event *pstadel = (struct stadel_event *)pbuf;
struct sta_priv *pstapriv = &adapter->stapriv; struct sta_priv *pstapriv = &adapter->stapriv;
...@@ -1496,30 +1462,11 @@ void rtw_stadel_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf) ...@@ -1496,30 +1462,11 @@ void rtw_stadel_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf)
spin_unlock_bh(&pmlmepriv->scanned_queue.lock); spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
/* re-create ibss */ /* re-create ibss */
pdev_network = &adapter->registrypriv.dev_network; pdev_network = &adapter->registrypriv.dev_network;
pibss = adapter->registrypriv.dev_network.MacAddress;
memcpy(pdev_network, &tgt_network->network, memcpy(pdev_network, &tgt_network->network,
get_wlan_bssid_ex_sz(&tgt_network->network)); get_wlan_bssid_ex_sz(&tgt_network->network));
memcpy(&pdev_network->Ssid, &pmlmepriv->assoc_ssid, rtw_do_join_adhoc(adapter);
sizeof(struct cfg80211_ssid));
rtw_update_registrypriv_dev_network23a(adapter);
rtw_generate_random_ibss23a(pibss);
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
set_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
_clr_fwstate_(pmlmepriv, WIFI_ADHOC_STATE);
}
if (rtw_createbss_cmd23a(adapter) != _SUCCESS) {
RT_TRACE(_module_rtl871x_ioctl_set_c_,
_drv_err_,
("***Error =>stadel_event_callback: "
"rtw_createbss_cmd23a status "
"FAIL***\n"));
}
} }
} }
...@@ -1777,6 +1724,40 @@ rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv) ...@@ -1777,6 +1724,40 @@ rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv)
} }
int rtw_do_join_adhoc(struct rtw_adapter *adapter)
{
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
struct wlan_bssid_ex *pdev_network;
u8 *ibss;
int ret;
pdev_network = &adapter->registrypriv.dev_network;
ibss = adapter->registrypriv.dev_network.MacAddress;
_clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY);
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
("switching to adhoc master\n"));
memcpy(&pdev_network->Ssid, &pmlmepriv->assoc_ssid,
sizeof(struct cfg80211_ssid));
rtw_update_registrypriv_dev_network23a(adapter);
rtw_generate_random_ibss23a(ibss);
pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE;
ret = rtw_createbss_cmd23a(adapter);
if (ret != _SUCCESS) {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
("Error =>rtw_createbss_cmd23a status FAIL\n"));
} else {
pmlmepriv->to_join = false;
}
return ret;
}
int rtw_do_join_network(struct rtw_adapter *adapter, int rtw_do_join_network(struct rtw_adapter *adapter,
struct wlan_network *candidate) struct wlan_network *candidate)
{ {
......
...@@ -240,6 +240,7 @@ int rtw_init_mlme_priv23a(struct rtw_adapter *adapter); ...@@ -240,6 +240,7 @@ int rtw_init_mlme_priv23a(struct rtw_adapter *adapter);
void rtw_free_mlme_priv23a(struct mlme_priv *pmlmepriv); void rtw_free_mlme_priv23a(struct mlme_priv *pmlmepriv);
int rtw_do_join_adhoc(struct rtw_adapter *adapter);
int rtw_do_join_network(struct rtw_adapter *adapter, int rtw_do_join_network(struct rtw_adapter *adapter,
struct wlan_network *candidate); struct wlan_network *candidate);
int rtw_select_and_join_from_scanned_queue23a(struct mlme_priv *pmlmepriv); int rtw_select_and_join_from_scanned_queue23a(struct mlme_priv *pmlmepriv);
......
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