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

staging: rtl8723au: rtw_mlme.c: Clean up mess

Clean up spaghetti formatting and avoid NULL initializing variables
where it isn't needed.
Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 684ad6ee
...@@ -53,8 +53,11 @@ int _rtw_init_mlme_priv23a(struct rtw_adapter *padapter) ...@@ -53,8 +53,11 @@ int _rtw_init_mlme_priv23a(struct rtw_adapter *padapter)
pmlmepriv->nic_hdl = padapter; pmlmepriv->nic_hdl = padapter;
pmlmepriv->fw_state = 0; pmlmepriv->fw_state = 0;
pmlmepriv->cur_network.network.InfrastructureMode = Ndis802_11AutoUnknown; pmlmepriv->cur_network.network.InfrastructureMode =
pmlmepriv->scan_mode=SCAN_ACTIVE;/* 1: active, 0: pasive. Maybe someday we should rename this varable to "active_mode" (Jeff) */ Ndis802_11AutoUnknown;
/* 1: active, 0: pasive. Maybe someday we should rename this
varable to "active_mode" (Jeff) */
pmlmepriv->scan_mode = SCAN_ACTIVE;
spin_lock_init(&pmlmepriv->lock); spin_lock_init(&pmlmepriv->lock);
_rtw_init_queue23a(&pmlmepriv->scanned_queue); _rtw_init_queue23a(&pmlmepriv->scanned_queue);
...@@ -72,11 +75,10 @@ int _rtw_init_mlme_priv23a(struct rtw_adapter *padapter) ...@@ -72,11 +75,10 @@ int _rtw_init_mlme_priv23a(struct rtw_adapter *padapter)
#ifdef CONFIG_8723AU_AP_MODE #ifdef CONFIG_8723AU_AP_MODE
static void rtw_free_mlme_ie_data(u8 **ppie, u32 *plen) static void rtw_free_mlme_ie_data(u8 **ppie, u32 *plen)
{ {
if(*ppie) if (*ppie) {
{
kfree(*ppie); kfree(*ppie);
*plen = 0; *plen = 0;
*ppie=NULL; *ppie = NULL;
} }
} }
#endif #endif
...@@ -86,30 +88,42 @@ void rtw23a_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv) ...@@ -86,30 +88,42 @@ void rtw23a_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv)
#ifdef CONFIG_8723AU_AP_MODE #ifdef CONFIG_8723AU_AP_MODE
kfree(pmlmepriv->assoc_req); kfree(pmlmepriv->assoc_req);
kfree(pmlmepriv->assoc_rsp); kfree(pmlmepriv->assoc_rsp);
rtw_free_mlme_ie_data(&pmlmepriv->wps_beacon_ie, &pmlmepriv->wps_beacon_ie_len); rtw_free_mlme_ie_data(&pmlmepriv->wps_beacon_ie,
rtw_free_mlme_ie_data(&pmlmepriv->wps_probe_req_ie, &pmlmepriv->wps_probe_req_ie_len); &pmlmepriv->wps_beacon_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->wps_probe_resp_ie, &pmlmepriv->wps_probe_resp_ie_len); rtw_free_mlme_ie_data(&pmlmepriv->wps_probe_req_ie,
rtw_free_mlme_ie_data(&pmlmepriv->wps_assoc_resp_ie, &pmlmepriv->wps_assoc_resp_ie_len); &pmlmepriv->wps_probe_req_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->wps_probe_resp_ie,
rtw_free_mlme_ie_data(&pmlmepriv->p2p_beacon_ie, &pmlmepriv->p2p_beacon_ie_len); &pmlmepriv->wps_probe_resp_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->p2p_probe_req_ie, &pmlmepriv->p2p_probe_req_ie_len); rtw_free_mlme_ie_data(&pmlmepriv->wps_assoc_resp_ie,
rtw_free_mlme_ie_data(&pmlmepriv->p2p_probe_resp_ie, &pmlmepriv->p2p_probe_resp_ie_len); &pmlmepriv->wps_assoc_resp_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->p2p_go_probe_resp_ie, &pmlmepriv->p2p_go_probe_resp_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->p2p_assoc_req_ie, &pmlmepriv->p2p_assoc_req_ie_len); rtw_free_mlme_ie_data(&pmlmepriv->p2p_beacon_ie,
&pmlmepriv->p2p_beacon_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->wfd_beacon_ie, &pmlmepriv->wfd_beacon_ie_len); rtw_free_mlme_ie_data(&pmlmepriv->p2p_probe_req_ie,
rtw_free_mlme_ie_data(&pmlmepriv->wfd_probe_req_ie, &pmlmepriv->wfd_probe_req_ie_len); &pmlmepriv->p2p_probe_req_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->wfd_probe_resp_ie, &pmlmepriv->wfd_probe_resp_ie_len); rtw_free_mlme_ie_data(&pmlmepriv->p2p_probe_resp_ie,
rtw_free_mlme_ie_data(&pmlmepriv->wfd_go_probe_resp_ie, &pmlmepriv->wfd_go_probe_resp_ie_len); &pmlmepriv->p2p_probe_resp_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->wfd_assoc_req_ie, &pmlmepriv->wfd_assoc_req_ie_len); rtw_free_mlme_ie_data(&pmlmepriv->p2p_go_probe_resp_ie,
&pmlmepriv->p2p_go_probe_resp_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->p2p_assoc_req_ie,
&pmlmepriv->p2p_assoc_req_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->wfd_beacon_ie,
&pmlmepriv->wfd_beacon_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->wfd_probe_req_ie,
&pmlmepriv->wfd_probe_req_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->wfd_probe_resp_ie,
&pmlmepriv->wfd_probe_resp_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->wfd_go_probe_resp_ie,
&pmlmepriv->wfd_go_probe_resp_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->wfd_assoc_req_ie,
&pmlmepriv->wfd_assoc_req_ie_len);
#endif #endif
} }
void _rtw_free_mlme_priv23a(struct mlme_priv *pmlmepriv) void _rtw_free_mlme_priv23a(struct mlme_priv *pmlmepriv)
{ {
rtw23a_free_mlme_priv_ie_data(pmlmepriv); rtw23a_free_mlme_priv_ie_data(pmlmepriv);
} }
struct wlan_network *rtw_alloc_network(struct mlme_priv *pmlmepriv) struct wlan_network *rtw_alloc_network(struct mlme_priv *pmlmepriv)
...@@ -152,8 +166,7 @@ void _rtw_free_network23a(struct mlme_priv *pmlmepriv, ...@@ -152,8 +166,7 @@ void _rtw_free_network23a(struct mlme_priv *pmlmepriv,
void _rtw_free_network23a_nolock23a(struct mlme_priv *pmlmepriv, void _rtw_free_network23a_nolock23a(struct mlme_priv *pmlmepriv,
struct wlan_network *pnetwork) struct wlan_network *pnetwork)
{ {
if (!pnetwork)
if (pnetwork == NULL)
return; return;
if (pnetwork->fixed == true) if (pnetwork->fixed == true)
...@@ -194,7 +207,7 @@ _rtw_find_network23a(struct rtw_queue *scanned_queue, u8 *addr) ...@@ -194,7 +207,7 @@ _rtw_find_network23a(struct rtw_queue *scanned_queue, u8 *addr)
plist = plist->next; plist = plist->next;
} }
if(plist == phead) if (plist == phead)
pnetwork = NULL; pnetwork = NULL;
/* spin_unlock_bh(&scanned_queue->lock); */ /* spin_unlock_bh(&scanned_queue->lock); */
...@@ -208,7 +221,7 @@ void _rtw_free_network23a_queue23a(struct rtw_adapter *padapter, u8 isfreeall) ...@@ -208,7 +221,7 @@ void _rtw_free_network23a_queue23a(struct rtw_adapter *padapter, u8 isfreeall)
{ {
struct list_head *phead, *plist, *ptmp; struct list_head *phead, *plist, *ptmp;
struct wlan_network *pnetwork; struct wlan_network *pnetwork;
struct mlme_priv* pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct rtw_queue *scanned_queue = &pmlmepriv->scanned_queue; struct rtw_queue *scanned_queue = &pmlmepriv->scanned_queue;
spin_lock_bh(&scanned_queue->lock); spin_lock_bh(&scanned_queue->lock);
...@@ -222,20 +235,21 @@ void _rtw_free_network23a_queue23a(struct rtw_adapter *padapter, u8 isfreeall) ...@@ -222,20 +235,21 @@ void _rtw_free_network23a_queue23a(struct rtw_adapter *padapter, u8 isfreeall)
} }
spin_unlock_bh(&scanned_queue->lock); spin_unlock_bh(&scanned_queue->lock);
} }
int rtw_if_up23a(struct rtw_adapter *padapter) { int rtw_if_up23a(struct rtw_adapter *padapter)
{
int res; int res;
if(padapter->bDriverStopped || padapter->bSurpriseRemoved || if (padapter->bDriverStopped || padapter->bSurpriseRemoved ||
(check_fwstate(&padapter->mlmepriv, _FW_LINKED)== false)) { check_fwstate(&padapter->mlmepriv, _FW_LINKED) == false) {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("rtw_if_up23a:bDriverStopped(%d) OR bSurpriseRemoved(%d)", padapter->bDriverStopped, padapter->bSurpriseRemoved)); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
res=false; ("rtw_if_up23a:bDriverStopped(%d) OR "
} "bSurpriseRemoved(%d)", padapter->bDriverStopped,
else padapter->bSurpriseRemoved));
res= true; res = false;
} else
res = true;
return res; return res;
} }
...@@ -247,9 +261,9 @@ void rtw_generate_random_ibss23a(u8* pibss) ...@@ -247,9 +261,9 @@ void rtw_generate_random_ibss23a(u8* pibss)
pibss[0] = 0x02; /* in ad-hoc mode bit1 must set to 1 */ pibss[0] = 0x02; /* in ad-hoc mode bit1 must set to 1 */
pibss[1] = 0x11; pibss[1] = 0x11;
pibss[2] = 0x87; pibss[2] = 0x87;
pibss[3] = (u8)(curtime & 0xff) ;/* p[0]; */ pibss[3] = curtime & 0xff;/* p[0]; */
pibss[4] = (u8)((curtime>>8) & 0xff) ;/* p[1]; */ pibss[4] = (curtime >> 8) & 0xff;/* p[1]; */
pibss[5] = (u8)((curtime>>16) & 0xff) ;/* p[2]; */ pibss[5] = (curtime >> 16) & 0xff;/* p[2]; */
return; return;
} }
...@@ -263,7 +277,7 @@ u16 rtw_get_capability23a(struct wlan_bssid_ex *bss) ...@@ -263,7 +277,7 @@ u16 rtw_get_capability23a(struct wlan_bssid_ex *bss)
{ {
u16 val; u16 val;
memcpy((u8 *)&val, rtw_get_capability23a_from_ie(bss->IEs), 2); memcpy(&val, rtw_get_capability23a_from_ie(bss->IEs), 2);
return le16_to_cpu(val); return le16_to_cpu(val);
} }
...@@ -278,41 +292,35 @@ u8 *rtw_get_beacon_interval23a_from_ie(u8 *ie) ...@@ -278,41 +292,35 @@ u8 *rtw_get_beacon_interval23a_from_ie(u8 *ie)
return ie + 8; return ie + 8;
} }
int rtw_init_mlme_priv23a (struct rtw_adapter *padapter)/* struct mlme_priv *pmlmepriv) */ int rtw_init_mlme_priv23a (struct rtw_adapter *padapter)
{ {
int res; int res;
res = _rtw_init_mlme_priv23a(padapter);/* (pmlmepriv); */ res = _rtw_init_mlme_priv23a(padapter);
return res; return res;
} }
void rtw_free_mlme_priv23a (struct mlme_priv *pmlmepriv) void rtw_free_mlme_priv23a (struct mlme_priv *pmlmepriv)
{ {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("rtw_free_mlme_priv23a\n")); ("rtw_free_mlme_priv23a\n"));
_rtw_free_mlme_priv23a(pmlmepriv); _rtw_free_mlme_priv23a(pmlmepriv);
} }
void rtw_free_network(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork, u8 is_freeall); void rtw_free_network(struct mlme_priv *pmlmepriv,
void rtw_free_network(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork, u8 is_freeall)/* struct wlan_network *pnetwork, _queue *free_queue) */ struct wlan_network *pnetwork, u8 is_freeall)
{ {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
("rtw_free_network ==> ssid = %s\n\n" , ("rtw_free_network ==> ssid = %s\n\n" ,
pnetwork->network.Ssid.ssid)); pnetwork->network.Ssid.ssid));
_rtw_free_network23a(pmlmepriv, pnetwork, is_freeall); _rtw_free_network23a(pmlmepriv, pnetwork, is_freeall);
} }
void rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork); void rtw_free_network_nolock(struct mlme_priv *pmlmepriv,
void rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork) struct wlan_network *pnetwork)
{ {
/* RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("rtw_free_network ==> ssid = %s\n\n" , pnetwork->network.Ssid.ssid)); */
_rtw_free_network23a_nolock23a(pmlmepriv, pnetwork); _rtw_free_network23a_nolock23a(pmlmepriv, pnetwork);
} }
void rtw_free_network_queue23a(struct rtw_adapter* dev, u8 isfreeall) void rtw_free_network_queue23a(struct rtw_adapter* dev, u8 isfreeall)
...@@ -337,25 +345,20 @@ rtw_find_network23a(struct rtw_queue *scanned_queue, u8 *addr) ...@@ -337,25 +345,20 @@ rtw_find_network23a(struct rtw_queue *scanned_queue, u8 *addr)
return pnetwork; return pnetwork;
} }
int rtw_is_same_ibss23a(struct rtw_adapter *adapter, struct wlan_network *pnetwork) int rtw_is_same_ibss23a(struct rtw_adapter *adapter,
struct wlan_network *pnetwork)
{ {
int ret = true; int ret = true;
struct security_priv *psecuritypriv = &adapter->securitypriv; struct security_priv *psecuritypriv = &adapter->securitypriv;
if ((psecuritypriv->dot11PrivacyAlgrthm != _NO_PRIVACY_) && if (psecuritypriv->dot11PrivacyAlgrthm != _NO_PRIVACY_ &&
(pnetwork->network.Privacy == 0)) pnetwork->network.Privacy == 0)
{
ret = false; ret = false;
} else if (psecuritypriv->dot11PrivacyAlgrthm == _NO_PRIVACY_ &&
else if ((psecuritypriv->dot11PrivacyAlgrthm == _NO_PRIVACY_) && pnetwork->network.Privacy == 1)
(pnetwork->network.Privacy == 1))
{
ret = false; ret = false;
}
else else
{
ret = true; ret = true;
}
return ret; return ret;
} }
...@@ -363,8 +366,6 @@ int rtw_is_same_ibss23a(struct rtw_adapter *adapter, struct wlan_network *pnetwo ...@@ -363,8 +366,6 @@ int rtw_is_same_ibss23a(struct rtw_adapter *adapter, struct wlan_network *pnetwo
inline int is_same_ess(struct wlan_bssid_ex *a, struct wlan_bssid_ex *b); inline int is_same_ess(struct wlan_bssid_ex *a, struct wlan_bssid_ex *b);
inline int is_same_ess(struct wlan_bssid_ex *a, struct wlan_bssid_ex *b) inline int is_same_ess(struct wlan_bssid_ex *a, struct wlan_bssid_ex *b)
{ {
/* RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("(%s,%d)(%s,%d)\n", */
/* a->Ssid.Ssid, a->Ssid.SsidLength, b->Ssid.Ssid, b->Ssid.SsidLength)); */
return (a->Ssid.ssid_len == b->Ssid.ssid_len) && return (a->Ssid.ssid_len == b->Ssid.ssid_len) &&
!memcmp(a->Ssid.ssid, b->Ssid.ssid, a->Ssid.ssid_len); !memcmp(a->Ssid.ssid, b->Ssid.ssid, a->Ssid.ssid_len);
} }
...@@ -373,8 +374,8 @@ int is_same_network23a(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst) ...@@ -373,8 +374,8 @@ int is_same_network23a(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst)
{ {
u16 s_cap, d_cap; u16 s_cap, d_cap;
memcpy((u8 *)&s_cap, rtw_get_capability23a_from_ie(src->IEs), 2); memcpy(&s_cap, rtw_get_capability23a_from_ie(src->IEs), 2);
memcpy((u8 *)&d_cap, rtw_get_capability23a_from_ie(dst->IEs), 2); memcpy(&d_cap, rtw_get_capability23a_from_ie(dst->IEs), 2);
s_cap = le16_to_cpu(s_cap); s_cap = le16_to_cpu(s_cap);
d_cap = le16_to_cpu(d_cap); d_cap = le16_to_cpu(d_cap);
...@@ -389,10 +390,10 @@ int is_same_network23a(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst) ...@@ -389,10 +390,10 @@ int is_same_network23a(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst)
(d_cap & WLAN_CAPABILITY_ESS))); (d_cap & WLAN_CAPABILITY_ESS)));
} }
struct wlan_network *rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_queue) struct wlan_network *
rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_queue)
{ {
struct list_head *plist, *phead; struct list_head *plist, *phead;
struct wlan_network *pwlan; struct wlan_network *pwlan;
struct wlan_network *oldest = NULL; struct wlan_network *oldest = NULL;
...@@ -412,7 +413,7 @@ struct wlan_network *rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_qu ...@@ -412,7 +413,7 @@ struct wlan_network *rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_qu
} }
void update_network23a(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src, void update_network23a(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src,
struct rtw_adapter * padapter, bool update_ie) struct rtw_adapter *padapter, bool update_ie)
{ {
u8 ss_ori = dst->PhyInfo.SignalStrength; u8 ss_ori = dst->PhyInfo.SignalStrength;
u8 sq_ori = dst->PhyInfo.SignalQuality; u8 sq_ori = dst->PhyInfo.SignalQuality;
...@@ -426,30 +427,35 @@ void update_network23a(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src, ...@@ -426,30 +427,35 @@ void update_network23a(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src,
u8 sq_final; u8 sq_final;
long rssi_final; long rssi_final;
DBG_8723A("%s %s(%pM, ch%u) ss_ori:%3u, sq_ori:%3u, rssi_ori:%3ld, ss_smp:%3u, sq_smp:%3u, rssi_smp:%3ld\n", DBG_8723A("%s %s(%pM, ch%u) ss_ori:%3u, sq_ori:%3u, rssi_ori:%3ld, "
"ss_smp:%3u, sq_smp:%3u, rssi_smp:%3ld\n",
__func__, src->Ssid.ssid, src->MacAddress, __func__, src->Ssid.ssid, src->MacAddress,
src->Configuration.DSConfig, ss_ori, sq_ori, rssi_ori, src->Configuration.DSConfig, ss_ori, sq_ori, rssi_ori,
ss_smp, sq_smp, rssi_smp ss_smp, sq_smp, rssi_smp
); );
/* The rule below is 1/5 for sample value, 4/5 for history value */ /* The rule below is 1/5 for sample value, 4/5 for history value */
if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) && is_same_network23a(&padapter->mlmepriv.cur_network.network, src)) { if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) &&
is_same_network23a(&padapter->mlmepriv.cur_network.network, src)) {
/* Take the recvpriv's value for the connected AP*/ /* Take the recvpriv's value for the connected AP*/
ss_final = padapter->recvpriv.signal_strength; ss_final = padapter->recvpriv.signal_strength;
sq_final = padapter->recvpriv.signal_qual; sq_final = padapter->recvpriv.signal_qual;
/* the rssi value here is undecorated, and will be used for antenna diversity */ /* the rssi value here is undecorated, and will be
used for antenna diversity */
if (sq_smp != 101) /* from the right channel */ if (sq_smp != 101) /* from the right channel */
rssi_final = (src->Rssi+dst->Rssi*4)/5; rssi_final = (src->Rssi+dst->Rssi*4)/5;
else else
rssi_final = rssi_ori; rssi_final = rssi_ori;
} } else {
else {
if (sq_smp != 101) { /* from the right channel */ if (sq_smp != 101) { /* from the right channel */
ss_final = ((u32)(src->PhyInfo.SignalStrength)+(u32)(dst->PhyInfo.SignalStrength)*4)/5; ss_final = ((u32)src->PhyInfo.SignalStrength +
sq_final = ((u32)(src->PhyInfo.SignalQuality)+(u32)(dst->PhyInfo.SignalQuality)*4)/5; (u32)dst->PhyInfo.SignalStrength * 4) / 5;
rssi_final = (src->Rssi+dst->Rssi*4)/5; sq_final = ((u32)src->PhyInfo.SignalQuality +
(u32)dst->PhyInfo.SignalQuality * 4) / 5;
rssi_final = src->Rssi+dst->Rssi * 4 / 5;
} else { } else {
/* bss info not receving from the right channel, use the original RX signal infos */ /* bss info not receving from the right channel, use
the original RX signal infos */
ss_final = dst->PhyInfo.SignalStrength; ss_final = dst->PhyInfo.SignalStrength;
sq_final = dst->PhyInfo.SignalQuality; sq_final = dst->PhyInfo.SignalQuality;
rssi_final = dst->Rssi; rssi_final = dst->Rssi;
...@@ -458,35 +464,32 @@ void update_network23a(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src, ...@@ -458,35 +464,32 @@ void update_network23a(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src,
} }
if (update_ie) if (update_ie)
memcpy((u8 *)dst, (u8 *)src, get_wlan_bssid_ex_sz(src)); memcpy(dst, src, get_wlan_bssid_ex_sz(src));
dst->PhyInfo.SignalStrength = ss_final; dst->PhyInfo.SignalStrength = ss_final;
dst->PhyInfo.SignalQuality = sq_final; dst->PhyInfo.SignalQuality = sq_final;
dst->Rssi = rssi_final; dst->Rssi = rssi_final;
DBG_8723A("%s %s(%pM), SignalStrength:%u, SignalQuality:%u, RawRSSI:%ld\n", DBG_8723A("%s %s(%pM), SignalStrength:%u, SignalQuality:%u, "
__func__, dst->Ssid.ssid, dst->MacAddress, "RawRSSI:%ld\n", __func__, dst->Ssid.ssid, dst->MacAddress,
dst->PhyInfo.SignalStrength, dst->PhyInfo.SignalStrength,
dst->PhyInfo.SignalQuality, dst->Rssi); dst->PhyInfo.SignalQuality, dst->Rssi);
} }
static void update_current_network(struct rtw_adapter *adapter, struct wlan_bssid_ex *pnetwork) static void update_current_network(struct rtw_adapter *adapter,
struct wlan_bssid_ex *pnetwork)
{ {
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
if ((check_fwstate(pmlmepriv, _FW_LINKED)== true) && (is_same_network23a(&pmlmepriv->cur_network.network, pnetwork))) if (check_fwstate(pmlmepriv, _FW_LINKED) &&
{ is_same_network23a(&pmlmepriv->cur_network.network, pnetwork)) {
/* RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,"Same Network\n"); */ update_network23a(&pmlmepriv->cur_network.network,
pnetwork,adapter, true);
/* if(pmlmepriv->cur_network.network.IELength<= pnetwork->IELength) */ rtw_update_protection23a(adapter,
{ pmlmepriv->cur_network.network.IEs +
update_network23a(&pmlmepriv->cur_network.network, pnetwork,adapter, true); sizeof (struct ndis_802_11_fixed_ies),
rtw_update_protection23a(adapter, (pmlmepriv->cur_network.network.IEs) + sizeof (struct ndis_802_11_fixed_ies),
pmlmepriv->cur_network.network.IELength); pmlmepriv->cur_network.network.IELength);
} }
}
} }
/* /*
...@@ -494,7 +497,8 @@ static void update_current_network(struct rtw_adapter *adapter, struct wlan_bssi ...@@ -494,7 +497,8 @@ static void update_current_network(struct rtw_adapter *adapter, struct wlan_bssi
Caller must hold pmlmepriv->lock first. Caller must hold pmlmepriv->lock first.
*/ */
void rtw_update_scanned_network23a(struct rtw_adapter *adapter, struct wlan_bssid_ex *target) void rtw_update_scanned_network23a(struct rtw_adapter *adapter,
struct wlan_bssid_ex *target)
{ {
struct list_head *plist, *phead; struct list_head *plist, *phead;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
...@@ -561,19 +565,20 @@ void rtw_update_scanned_network23a(struct rtw_adapter *adapter, struct wlan_bssi ...@@ -561,19 +565,20 @@ void rtw_update_scanned_network23a(struct rtw_adapter *adapter, struct wlan_bssi
/* target.reserved == 1, means that scanned network is /* target.reserved == 1, means that scanned network is
* a bcn frame. */ * a bcn frame. */
if ((pnetwork->network.IELength>target->IELength) && if (pnetwork->network.IELength > target->IELength &&
(target->reserved == 1)) target->reserved == 1)
update_ie = false; update_ie = false;
update_network23a(&pnetwork->network, target,adapter, update_ie); update_network23a(&pnetwork->network, target,adapter,
update_ie);
} }
exit: exit:
spin_unlock_bh(&queue->lock); spin_unlock_bh(&queue->lock);
} }
void rtw_add_network(struct rtw_adapter *adapter, struct wlan_bssid_ex *pnetwork) void rtw_add_network(struct rtw_adapter *adapter,
struct wlan_bssid_ex *pnetwork)
{ {
update_current_network(adapter, pnetwork); update_current_network(adapter, pnetwork);
rtw_update_scanned_network23a(adapter, pnetwork); rtw_update_scanned_network23a(adapter, pnetwork);
...@@ -585,7 +590,8 @@ void rtw_add_network(struct rtw_adapter *adapter, struct wlan_bssid_ex *pnetwork ...@@ -585,7 +590,8 @@ void rtw_add_network(struct rtw_adapter *adapter, struct wlan_bssid_ex *pnetwork
/* (3) WMM */ /* (3) WMM */
/* (4) HT */ /* (4) HT */
/* (5) others */ /* (5) others */
int rtw_is_desired_network(struct rtw_adapter *adapter, struct wlan_network *pnetwork) int rtw_is_desired_network(struct rtw_adapter *adapter,
struct wlan_network *pnetwork)
{ {
struct security_priv *psecuritypriv = &adapter->securitypriv; struct security_priv *psecuritypriv = &adapter->securitypriv;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
...@@ -600,31 +606,31 @@ int rtw_is_desired_network(struct rtw_adapter *adapter, struct wlan_network *pne ...@@ -600,31 +606,31 @@ int rtw_is_desired_network(struct rtw_adapter *adapter, struct wlan_network *pne
desired_encmode = psecuritypriv->ndisencryptstatus; desired_encmode = psecuritypriv->ndisencryptstatus;
privacy = pnetwork->network.Privacy; privacy = pnetwork->network.Privacy;
if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) {
{ if (rtw_get_wps_ie23a(pnetwork->network.IEs + _FIXED_IE_LENGTH_,
if (rtw_get_wps_ie23a(pnetwork->network.IEs+_FIXED_IE_LENGTH_, pnetwork->network.IELength-_FIXED_IE_LENGTH_, NULL, &wps_ielen)!= NULL) pnetwork->network.IELength -
{ _FIXED_IE_LENGTH_, NULL, &wps_ielen))
return true; return true;
}
else else
{
return false; return false;
} }
} if (adapter->registrypriv.wifi_spec == 1) {
if (adapter->registrypriv.wifi_spec == 1) /* for correct flow of 8021X to do.... */ /* for correct flow of 8021X to do.... */
{ if (desired_encmode == Ndis802_11EncryptionDisabled &&
if ((desired_encmode == Ndis802_11EncryptionDisabled) && (privacy != 0)) privacy != 0)
bselected = false; bselected = false;
} }
if ((desired_encmode != Ndis802_11EncryptionDisabled) && (privacy == 0)) { if (desired_encmode != Ndis802_11EncryptionDisabled &&
DBG_8723A("desired_encmode: %d, privacy: %d\n", desired_encmode, privacy); privacy == 0) {
DBG_8723A("desired_encmode: %d, privacy: %d\n",
desired_encmode, privacy);
bselected = false; bselected = false;
} }
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
{ if (pnetwork->network.InfrastructureMode !=
if (pnetwork->network.InfrastructureMode != pmlmepriv->cur_network.network.InfrastructureMode) pmlmepriv->cur_network.network.InfrastructureMode)
bselected = false; bselected = false;
} }
...@@ -632,9 +638,8 @@ int rtw_is_desired_network(struct rtw_adapter *adapter, struct wlan_network *pne ...@@ -632,9 +638,8 @@ int rtw_is_desired_network(struct rtw_adapter *adapter, struct wlan_network *pne
} }
/* TODO: Perry : For Power Management */ /* TODO: Perry : For Power Management */
void rtw_atimdone_event_callback23a(struct rtw_adapter *adapter , u8 *pbuf) void rtw_atimdone_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf)
{ {
RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("receive atimdone_evet\n")); RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("receive atimdone_evet\n"));
return; return;
...@@ -648,31 +653,36 @@ void rtw_survey_event_cb23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -648,31 +653,36 @@ void rtw_survey_event_cb23a(struct rtw_adapter *adapter, u8 *pbuf)
pnetwork = (struct wlan_bssid_ex *)pbuf; pnetwork = (struct wlan_bssid_ex *)pbuf;
RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("rtw_survey_event_cb23a, ssid=%s\n", pnetwork->Ssid.ssid)); RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,
("rtw_survey_event_cb23a, ssid=%s\n", pnetwork->Ssid.ssid));
len = get_wlan_bssid_ex_sz(pnetwork); len = get_wlan_bssid_ex_sz(pnetwork);
if(len > (sizeof(struct wlan_bssid_ex))) if (len > (sizeof(struct wlan_bssid_ex))) {
{ RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,
RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("\n ****rtw_survey_event_cb23a: return a wrong bss ***\n")); ("\n ****rtw_survey_event_cb23a: return a wrong "
"bss ***\n"));
return; return;
} }
spin_lock_bh(&pmlmepriv->lock); spin_lock_bh(&pmlmepriv->lock);
/* update IBSS_network 's timestamp */ /* update IBSS_network 's timestamp */
if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) == true) if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
{ /* RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
/* RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,"rtw_survey_event_cb23a : WIFI_ADHOC_MASTER_STATE\n\n"); */ "rtw_survey_event_cb23a : WIFI_ADHOC_MASTER_STATE\n\n"); */
if (ether_addr_equal(pmlmepriv->cur_network.network.MacAddress, if (ether_addr_equal(pmlmepriv->cur_network.network.MacAddress,
pnetwork->MacAddress)) { pnetwork->MacAddress)) {
struct wlan_network* ibss_wlan = NULL; struct wlan_network* ibss_wlan;
memcpy(pmlmepriv->cur_network.network.IEs, pnetwork->IEs, 8); memcpy(pmlmepriv->cur_network.network.IEs,
pnetwork->IEs, 8);
spin_lock_bh(&pmlmepriv->scanned_queue.lock); spin_lock_bh(&pmlmepriv->scanned_queue.lock);
ibss_wlan = rtw_find_network23a(&pmlmepriv->scanned_queue, pnetwork->MacAddress); ibss_wlan = rtw_find_network23a(
if (ibss_wlan) &pmlmepriv->scanned_queue,
{ pnetwork->MacAddress);
memcpy(ibss_wlan->network.IEs , pnetwork->IEs, 8); if (ibss_wlan) {
memcpy(ibss_wlan->network.IEs,
pnetwork->IEs, 8);
spin_unlock_bh(&pmlmepriv->scanned_queue.lock); spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
goto exit; goto exit;
} }
...@@ -681,8 +691,7 @@ void rtw_survey_event_cb23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -681,8 +691,7 @@ void rtw_survey_event_cb23a(struct rtw_adapter *adapter, u8 *pbuf)
} }
/* lock pmlmepriv->lock when you accessing network_q */ /* lock pmlmepriv->lock when you accessing network_q */
if ((check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) == false) if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == false) {
{
if (pnetwork->Ssid.ssid[0] == 0) if (pnetwork->Ssid.ssid[0] == 0)
pnetwork->Ssid.ssid_len = 0; pnetwork->Ssid.ssid_len = 0;
...@@ -700,6 +709,8 @@ void rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -700,6 +709,8 @@ void rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, 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);
...@@ -709,7 +720,9 @@ void rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -709,7 +720,9 @@ void rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf)
pmlmepriv->wps_probe_req_ie = NULL; pmlmepriv->wps_probe_req_ie = NULL;
} }
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("rtw_surveydone_event_callback23a: fw_state:%x\n\n", get_fwstate(pmlmepriv))); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
("rtw_surveydone_event_callback23a: fw_state:%x\n\n",
get_fwstate(pmlmepriv)));
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) { if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) {
del_timer_sync(&pmlmepriv->scan_to_timer); del_timer_sync(&pmlmepriv->scan_to_timer);
...@@ -717,39 +730,53 @@ void rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -717,39 +730,53 @@ void rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf)
_clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY);
} else { } else {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("nic status =%x, survey done event comes too late!\n", get_fwstate(pmlmepriv))); RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
("nic status =%x, survey done event comes too late!\n",
get_fwstate(pmlmepriv)));
} }
rtw_set_signal_stat_timer(&adapter->recvpriv); rtw_set_signal_stat_timer(&adapter->recvpriv);
if (pmlmepriv->to_join == true) { if (pmlmepriv->to_join == true) {
if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) { if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
if (check_fwstate(pmlmepriv, _FW_LINKED) == false) { if (check_fwstate(pmlmepriv, _FW_LINKED) == false) {
set_fwstate(pmlmepriv, _FW_UNDER_LINKING); set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
if (rtw_select_and_join_from_scanned_queue23a(pmlmepriv) == _SUCCESS) { if (rtw_select_and_join_from_scanned_queue23a(
pmlmepriv) == _SUCCESS) {
mod_timer(&pmlmepriv->assoc_timer, mod_timer(&pmlmepriv->assoc_timer,
jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT)); jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
} else { } else {
struct wlan_bssid_ex *pdev_network = &adapter->registrypriv.dev_network; pdev_network = &adapter->registrypriv.dev_network;
u8 *pibss = adapter->registrypriv.dev_network.MacAddress; pibss = adapter->registrypriv.dev_network.MacAddress;
_clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); _clr_fwstate_(pmlmepriv,
_FW_UNDER_SURVEY);
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("switching to adhoc master\n")); RT_TRACE(_module_rtl871x_mlme_c_,
_drv_err_,
("switching to adhoc "
"master\n"));
memset(&pdev_network->Ssid, 0, sizeof(struct cfg80211_ssid)); memset(&pdev_network->Ssid, 0,
memcpy(&pdev_network->Ssid, &pmlmepriv->assoc_ssid, sizeof(struct cfg80211_ssid)); sizeof(struct cfg80211_ssid));
memcpy(&pdev_network->Ssid,
&pmlmepriv->assoc_ssid,
sizeof(struct cfg80211_ssid));
rtw_update_registrypriv_dev_network23a(adapter); rtw_update_registrypriv_dev_network23a(
adapter);
rtw_generate_random_ibss23a(pibss); rtw_generate_random_ibss23a(pibss);
pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE; pmlmepriv->fw_state =
WIFI_ADHOC_MASTER_STATE;
if (rtw_createbss_cmd23a(adapter)!= _SUCCESS) if (rtw_createbss_cmd23a(adapter) !=
{ _SUCCESS)
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("Error =>rtw_createbss_cmd23a status FAIL\n")); RT_TRACE(_module_rtl871x_mlme_c_,
} _drv_err_,
("Error =>rtw_createbss_cmd23a"
" status FAIL\n"));
pmlmepriv->to_join = false; pmlmepriv->to_join = false;
} }
...@@ -758,28 +785,33 @@ void rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -758,28 +785,33 @@ void rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf)
int ret; int ret;
set_fwstate(pmlmepriv, _FW_UNDER_LINKING); set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
pmlmepriv->to_join = false; pmlmepriv->to_join = false;
ret = rtw_select_and_join_from_scanned_queue23a(pmlmepriv); ret = rtw_select_and_join_from_scanned_queue23a(
pmlmepriv);
if (ret == _SUCCESS) { if (ret == _SUCCESS) {
unsigned long e; unsigned long e;
e = msecs_to_jiffies(MAX_JOIN_TIMEOUT); e = msecs_to_jiffies(MAX_JOIN_TIMEOUT);
mod_timer(&pmlmepriv->assoc_timer, jiffies + e); mod_timer(&pmlmepriv->assoc_timer, jiffies + e);
} else if (ret == 2)/* there is no need to wait for join */ } else if (ret == 2) {/* there is no need to wait */
{
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
rtw_indicate_connect23a(adapter); rtw_indicate_connect23a(adapter);
} else { } else {
DBG_8723A("try_to_join, but select scanning queue fail, to_roaming:%d\n", rtw_to_roaming(adapter)); DBG_8723A("try_to_join, but select scanning "
"queue fail, to_roaming:%d\n",
rtw_to_roaming(adapter));
if (rtw_to_roaming(adapter) != 0) { if (rtw_to_roaming(adapter) != 0) {
if (--pmlmepriv->to_roaming == 0 if (--pmlmepriv->to_roaming == 0 ||
|| _SUCCESS != rtw_sitesurvey_cmd23a(adapter, &pmlmepriv->assoc_ssid, 1, NULL, 0) rtw_sitesurvey_cmd23a(
) { adapter,
&pmlmepriv->assoc_ssid, 1,
NULL, 0) != _SUCCESS) {
rtw_set_roaming(adapter, 0); rtw_set_roaming(adapter, 0);
rtw_free_assoc_resources23a(adapter, 1); rtw_free_assoc_resources23a(
rtw_indicate_disconnect23a(adapter); adapter, 1);
} else { rtw_indicate_disconnect23a(
adapter);
} else
pmlmepriv->to_join = true; pmlmepriv->to_join = true;
} }
}
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
} }
} }
...@@ -789,11 +821,10 @@ void rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -789,11 +821,10 @@ void rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf)
rtw_os_xmit_schedule23a(adapter); rtw_os_xmit_schedule23a(adapter);
if(pmlmeext->sitesurvey_res.bss_cnt == 0) if (pmlmeext->sitesurvey_res.bss_cnt == 0)
rtw_hal_sreset_reset23a(adapter); rtw_hal_sreset_reset23a(adapter);
rtw_cfg80211_surveydone_event_callback(adapter); rtw_cfg80211_surveydone_event_callback(adapter);
} }
void rtw_dummy_event_callback23a(struct rtw_adapter *adapter , u8 *pbuf) void rtw_dummy_event_callback23a(struct rtw_adapter *adapter , u8 *pbuf)
...@@ -822,42 +853,38 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv) ...@@ -822,42 +853,38 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv)
} }
spin_unlock_bh(&scan_queue->lock); spin_unlock_bh(&scan_queue->lock);
} }
/* /*
*rtw_free_assoc_resources23a: the caller has to lock pmlmepriv->lock *rtw_free_assoc_resources23a: the caller has to lock pmlmepriv->lock
*/ */
void rtw_free_assoc_resources23a(struct rtw_adapter *adapter, int lock_scanned_queue) void rtw_free_assoc_resources23a(struct rtw_adapter *adapter,
int lock_scanned_queue)
{ {
struct wlan_network* pwlan = NULL; struct wlan_network* pwlan;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
struct sta_priv *pstapriv = &adapter->stapriv; struct sta_priv *pstapriv = &adapter->stapriv;
struct wlan_network *tgt_network = &pmlmepriv->cur_network; struct wlan_network *tgt_network = &pmlmepriv->cur_network;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, ("+rtw_free_assoc_resources23a\n"));
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("tgt_network->network.MacAddress="MAC_FMT" ssid=%s\n",
MAC_ARG(tgt_network->network.MacAddress), tgt_network->network.Ssid.ssid));
if(check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_AP_STATE))
{
struct sta_info* psta; struct sta_info* psta;
psta = rtw_get_stainfo23a(&adapter->stapriv, tgt_network->network.MacAddress); RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_,
("+rtw_free_assoc_resources23a\n"));
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
("tgt_network->network.MacAddress="MAC_FMT" ssid=%s\n",
MAC_ARG(tgt_network->network.MacAddress),
tgt_network->network.Ssid.ssid));
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_AP_STATE)) {
psta = rtw_get_stainfo23a(&adapter->stapriv,
tgt_network->network.MacAddress);
{
spin_lock_bh(&pstapriv->sta_hash_lock); spin_lock_bh(&pstapriv->sta_hash_lock);
rtw_free_stainfo23a(adapter, psta); rtw_free_stainfo23a(adapter, psta);
}
spin_unlock_bh(&pstapriv->sta_hash_lock); spin_unlock_bh(&pstapriv->sta_hash_lock);
} }
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE|WIFI_AP_STATE)) if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE |
{ WIFI_ADHOC_MASTER_STATE|WIFI_AP_STATE)) {
struct sta_info* psta;
rtw_free_all_stainfo23a(adapter); rtw_free_all_stainfo23a(adapter);
psta = rtw_get_bcmc_stainfo23a(adapter); psta = rtw_get_bcmc_stainfo23a(adapter);
...@@ -868,23 +895,25 @@ void rtw_free_assoc_resources23a(struct rtw_adapter *adapter, int lock_scanned_q ...@@ -868,23 +895,25 @@ void rtw_free_assoc_resources23a(struct rtw_adapter *adapter, int lock_scanned_q
rtw_init_bcmc_stainfo23a(adapter); rtw_init_bcmc_stainfo23a(adapter);
} }
if(lock_scanned_queue) if (lock_scanned_queue)
spin_lock_bh(&pmlmepriv->scanned_queue.lock); spin_lock_bh(&pmlmepriv->scanned_queue.lock);
pwlan = rtw_find_network23a(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress); pwlan = rtw_find_network23a(&pmlmepriv->scanned_queue,
if(pwlan) tgt_network->network.MacAddress);
if (pwlan)
pwlan->fixed = false; pwlan->fixed = false;
else else
RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("rtw_free_assoc_resources23a : pwlan== NULL\n\n")); RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,
("rtw_free_assoc_resources23a : pwlan== NULL\n"));
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) && (adapter->stapriv.asoc_sta_count == 1)) if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) &&
adapter->stapriv.asoc_sta_count == 1)
rtw_free_network_nolock(pmlmepriv, pwlan); rtw_free_network_nolock(pmlmepriv, pwlan);
if(lock_scanned_queue) if (lock_scanned_queue)
spin_unlock_bh(&pmlmepriv->scanned_queue.lock); spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
pmlmepriv->key_mask = 0; pmlmepriv->key_mask = 0;
} }
/* /*
...@@ -894,11 +923,12 @@ void rtw_indicate_connect23a(struct rtw_adapter *padapter) ...@@ -894,11 +923,12 @@ void rtw_indicate_connect23a(struct rtw_adapter *padapter)
{ {
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("+rtw_indicate_connect23a\n")); RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
("+rtw_indicate_connect23a\n"));
pmlmepriv->to_join = false; pmlmepriv->to_join = false;
if(!check_fwstate(&padapter->mlmepriv, _FW_LINKED)) { if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED)) {
set_fwstate(pmlmepriv, _FW_LINKED); set_fwstate(pmlmepriv, _FW_LINKED);
rtw_led_control(padapter, LED_CTL_LINK); rtw_led_control(padapter, LED_CTL_LINK);
...@@ -915,18 +945,20 @@ void rtw_indicate_connect23a(struct rtw_adapter *padapter) ...@@ -915,18 +945,20 @@ void rtw_indicate_connect23a(struct rtw_adapter *padapter)
rtw_set_scan_deny(padapter, 3000); rtw_set_scan_deny(padapter, 3000);
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("-rtw_indicate_connect23a: fw_state=0x%08x\n", get_fwstate(pmlmepriv))); RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
("-rtw_indicate_connect23a: fw_state=0x%08x\n",
get_fwstate(pmlmepriv)));
} }
/* /*
*rtw_indicate_disconnect23a: the caller has to lock pmlmepriv->lock *rtw_indicate_disconnect23a: the caller has to lock pmlmepriv->lock
*/ */
void rtw_indicate_disconnect23a(struct rtw_adapter *padapter) void rtw_indicate_disconnect23a(struct rtw_adapter *padapter)
{ {
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("+rtw_indicate_disconnect23a\n")); RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
("+rtw_indicate_disconnect23a\n"));
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING|WIFI_UNDER_WPS); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING|WIFI_UNDER_WPS);
...@@ -936,7 +968,7 @@ void rtw_indicate_disconnect23a(struct rtw_adapter *padapter) ...@@ -936,7 +968,7 @@ void rtw_indicate_disconnect23a(struct rtw_adapter *padapter)
_clr_fwstate_(pmlmepriv, _FW_LINKED); _clr_fwstate_(pmlmepriv, _FW_LINKED);
if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) || if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) ||
(rtw_to_roaming(padapter) <= 0)) { rtw_to_roaming(padapter) <= 0) {
rtw_os_indicate_disconnect23a(padapter); rtw_os_indicate_disconnect23a(padapter);
/* set ips_deny_time to avoid enter IPS before LPS leave */ /* set ips_deny_time to avoid enter IPS before LPS leave */
...@@ -952,7 +984,6 @@ void rtw_indicate_disconnect23a(struct rtw_adapter *padapter) ...@@ -952,7 +984,6 @@ void rtw_indicate_disconnect23a(struct rtw_adapter *padapter)
} }
rtw_lps_ctrl_wk_cmd23a(padapter, LPS_CTRL_DISCONNECT, 1); rtw_lps_ctrl_wk_cmd23a(padapter, LPS_CTRL_DISCONNECT, 1);
} }
void rtw_scan_abort23a(struct rtw_adapter *adapter) void rtw_scan_abort23a(struct rtw_adapter *adapter)
...@@ -965,37 +996,39 @@ void rtw_scan_abort23a(struct rtw_adapter *adapter) ...@@ -965,37 +996,39 @@ void rtw_scan_abort23a(struct rtw_adapter *adapter)
pmlmeext->scan_abort = true; pmlmeext->scan_abort = true;
while (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) && while (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) &&
jiffies_to_msecs(jiffies - start) <= 200) { jiffies_to_msecs(jiffies - start) <= 200) {
if (adapter->bDriverStopped || adapter->bSurpriseRemoved) if (adapter->bDriverStopped || adapter->bSurpriseRemoved)
break; break;
DBG_8723A(FUNC_NDEV_FMT"fw_state = _FW_UNDER_SURVEY!\n", FUNC_NDEV_ARG(adapter->pnetdev)); DBG_8723A(FUNC_NDEV_FMT "fw_state = _FW_UNDER_SURVEY!\n",
FUNC_NDEV_ARG(adapter->pnetdev));
msleep(20); msleep(20);
} }
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) { if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) {
if (!adapter->bDriverStopped && !adapter->bSurpriseRemoved) if (!adapter->bDriverStopped && !adapter->bSurpriseRemoved)
DBG_8723A(FUNC_NDEV_FMT"waiting for scan_abort time out!\n", FUNC_NDEV_ARG(adapter->pnetdev)); DBG_8723A(FUNC_NDEV_FMT "waiting for scan_abort time "
"out!\n", FUNC_NDEV_ARG(adapter->pnetdev));
rtw_cfg80211_indicate_scan_done(wdev_to_priv(adapter->rtw_wdev), rtw_cfg80211_indicate_scan_done(wdev_to_priv(adapter->rtw_wdev),
true); true);
} }
pmlmeext->scan_abort = false; pmlmeext->scan_abort = false;
} }
static struct sta_info *rtw_joinbss_update_stainfo(struct rtw_adapter *padapter, struct wlan_network *pnetwork) static struct sta_info *
rtw_joinbss_update_stainfo(struct rtw_adapter *padapter,
struct wlan_network *pnetwork)
{ {
int i; int i;
struct sta_info *bmc_sta, *psta = NULL; struct sta_info *bmc_sta, *psta;
struct recv_reorder_ctrl *preorder_ctrl; struct recv_reorder_ctrl *preorder_ctrl;
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
psta = rtw_get_stainfo23a(pstapriv, pnetwork->network.MacAddress); psta = rtw_get_stainfo23a(pstapriv, pnetwork->network.MacAddress);
if (psta == NULL) { if (!psta)
psta = rtw_alloc_stainfo23a(pstapriv, pnetwork->network.MacAddress); psta = rtw_alloc_stainfo23a(pstapriv,
} pnetwork->network.MacAddress);
if (psta) /* update ptarget_sta */ if (psta) { /* update ptarget_sta */
{
DBG_8723A("%s\n", __func__); DBG_8723A("%s\n", __func__);
psta->aid = pnetwork->join_res; psta->aid = pnetwork->join_res;
...@@ -1005,57 +1038,63 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct rtw_adapter *padapter, ...@@ -1005,57 +1038,63 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct rtw_adapter *padapter,
rtw_hal_set_odm_var23a(padapter, HAL_ODM_STA_INFO, psta, true); rtw_hal_set_odm_var23a(padapter, HAL_ODM_STA_INFO, psta, true);
/* security related */ /* security related */
if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) if (padapter->securitypriv.dot11AuthAlgrthm ==
{ dot11AuthAlgrthm_8021X) {
padapter->securitypriv.binstallGrpkey = false; padapter->securitypriv.binstallGrpkey = false;
padapter->securitypriv.busetkipkey = false; padapter->securitypriv.busetkipkey = false;
padapter->securitypriv.bgrpkey_handshake = false; padapter->securitypriv.bgrpkey_handshake = false;
psta->ieee8021x_blocked = true; psta->ieee8021x_blocked = true;
psta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; psta->dot118021XPrivacy =
padapter->securitypriv.dot11PrivacyAlgrthm;
memset((u8 *)&psta->dot118021x_UncstKey, 0, sizeof (union Keytype)); memset(&psta->dot118021x_UncstKey, 0,
sizeof (union Keytype));
memset((u8 *)&psta->dot11tkiprxmickey, 0, sizeof (union Keytype)); memset(&psta->dot11tkiprxmickey, 0,
memset((u8 *)&psta->dot11tkiptxmickey, 0, sizeof (union Keytype)); sizeof (union Keytype));
memset(&psta->dot11tkiptxmickey, 0,
sizeof (union Keytype));
memset((u8 *)&psta->dot11txpn, 0, sizeof (union pn48)); memset(&psta->dot11txpn, 0, sizeof (union pn48));
memset((u8 *)&psta->dot11rxpn, 0, sizeof (union pn48)); memset(&psta->dot11rxpn, 0, sizeof (union pn48));
} }
/* Commented by Albert 2012/07/21 */ /* Commented by Albert 2012/07/21 */
/* When doing the WPS, the wps_ie_len won't equal to 0 */ /* When doing the WPS, the wps_ie_len won't equal to 0 */
/* And the Wi-Fi driver shouldn't allow the data packet to be tramsmitted. */ /* And the Wi-Fi driver shouldn't allow the data packet
if (padapter->securitypriv.wps_ie_len != 0) to be tramsmitted. */
{ if (padapter->securitypriv.wps_ie_len != 0) {
psta->ieee8021x_blocked = true; psta->ieee8021x_blocked = true;
padapter->securitypriv.wps_ie_len = 0; padapter->securitypriv.wps_ie_len = 0;
} }
/* for A-MPDU Rx reordering buffer control for bmc_sta & sta_info */ /* for A-MPDU Rx reordering buffer control for bmc_sta &
/* if A-MPDU Rx is enabled, reseting rx_ordering_ctrl wstart_b(indicate_seq) to default value = 0xffff */ * sta_info */
/* if A-MPDU Rx is enabled, reseting
rx_ordering_ctrl wstart_b(indicate_seq) to default
value = 0xffff */
/* todo: check if AP can send A-MPDU packets */ /* todo: check if AP can send A-MPDU packets */
for (i = 0; i < 16 ; i++) for (i = 0; i < 16 ; i++) {
{
/* preorder_ctrl = &precvpriv->recvreorder_ctrl[i]; */ /* preorder_ctrl = &precvpriv->recvreorder_ctrl[i]; */
preorder_ctrl = &psta->recvreorder_ctrl[i]; preorder_ctrl = &psta->recvreorder_ctrl[i];
preorder_ctrl->enable = false; preorder_ctrl->enable = false;
preorder_ctrl->indicate_seq = 0xffff; preorder_ctrl->indicate_seq = 0xffff;
preorder_ctrl->wend_b = 0xffff; preorder_ctrl->wend_b = 0xffff;
preorder_ctrl->wsize_b = 64;/* max_ampdu_sz; ex. 32(kbytes) -> wsize_b = 32 */ /* max_ampdu_sz; ex. 32(kbytes) -> wsize_b = 32 */
preorder_ctrl->wsize_b = 64;
} }
bmc_sta = rtw_get_bcmc_stainfo23a(padapter); bmc_sta = rtw_get_bcmc_stainfo23a(padapter);
if (bmc_sta) if (bmc_sta) {
{ for (i = 0; i < 16 ; i++) {
for (i = 0; i < 16 ; i++)
{
/* preorder_ctrl = &precvpriv->recvreorder_ctrl[i]; */
preorder_ctrl = &bmc_sta->recvreorder_ctrl[i]; preorder_ctrl = &bmc_sta->recvreorder_ctrl[i];
preorder_ctrl->enable = false; preorder_ctrl->enable = false;
preorder_ctrl->indicate_seq = 0xffff; preorder_ctrl->indicate_seq = 0xffff;
preorder_ctrl->wend_b = 0xffff; preorder_ctrl->wend_b = 0xffff;
preorder_ctrl->wsize_b = 64;/* max_ampdu_sz; ex. 32(kbytes) -> wsize_b = 32 */ /* max_ampdu_sz; ex. 32(kbytes) ->
wsize_b = 32 */
preorder_ctrl->wsize_b = 64;
} }
} }
...@@ -1069,29 +1108,41 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct rtw_adapter *padapter, ...@@ -1069,29 +1108,41 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct rtw_adapter *padapter,
/* pnetwork : returns from rtw23a_joinbss_event_cb */ /* pnetwork : returns from rtw23a_joinbss_event_cb */
/* ptarget_wlan: found from scanned_queue */ /* ptarget_wlan: found from scanned_queue */
static void rtw_joinbss_update_network23a(struct rtw_adapter *padapter, struct wlan_network *ptarget_wlan, struct wlan_network *pnetwork) static void
rtw_joinbss_update_network23a(struct rtw_adapter *padapter,
struct wlan_network *ptarget_wlan,
struct wlan_network *pnetwork)
{ {
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_network *cur_network = &pmlmepriv->cur_network; struct wlan_network *cur_network = &pmlmepriv->cur_network;
DBG_8723A("%s\n", __func__); DBG_8723A("%s\n", __func__);
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("\nfw_state:%x, BSSID:"MAC_FMT"\n" RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
, get_fwstate(pmlmepriv), MAC_ARG(pnetwork->network.MacAddress))); ("\nfw_state:%x, BSSID:"MAC_FMT"\n", get_fwstate(pmlmepriv),
MAC_ARG(pnetwork->network.MacAddress)));
/* why not use ptarget_wlan?? */ /* why not use ptarget_wlan?? */
memcpy(&cur_network->network, &pnetwork->network, pnetwork->network.Length); memcpy(&cur_network->network, &pnetwork->network,
pnetwork->network.Length);
/* some IEs in pnetwork is wrong, so we should use ptarget_wlan IEs */ /* some IEs in pnetwork is wrong, so we should use ptarget_wlan IEs */
cur_network->network.IELength = ptarget_wlan->network.IELength; cur_network->network.IELength = ptarget_wlan->network.IELength;
memcpy(&cur_network->network.IEs[0], &ptarget_wlan->network.IEs[0], MAX_IE_SZ); memcpy(&cur_network->network.IEs[0], &ptarget_wlan->network.IEs[0],
MAX_IE_SZ);
cur_network->aid = pnetwork->join_res; cur_network->aid = pnetwork->join_res;
rtw_set_signal_stat_timer(&padapter->recvpriv); rtw_set_signal_stat_timer(&padapter->recvpriv);
padapter->recvpriv.signal_strength = ptarget_wlan->network.PhyInfo.SignalStrength; padapter->recvpriv.signal_strength =
padapter->recvpriv.signal_qual = ptarget_wlan->network.PhyInfo.SignalQuality; ptarget_wlan->network.PhyInfo.SignalStrength;
/* the ptarget_wlan->network.Rssi is raw data, we use ptarget_wlan->network.PhyInfo.SignalStrength instead (has scaled) */ padapter->recvpriv.signal_qual =
padapter->recvpriv.rssi = translate_percentage_to_dbm(ptarget_wlan->network.PhyInfo.SignalStrength); ptarget_wlan->network.PhyInfo.SignalQuality;
/*
* the ptarget_wlan->network.Rssi is raw data, we use
* ptarget_wlan->network.PhyInfo.SignalStrength instead (has scaled)
*/
padapter->recvpriv.rssi = translate_percentage_to_dbm(
ptarget_wlan->network.PhyInfo.SignalStrength);
DBG_8723A("%s signal_strength:%3u, rssi:%3d, signal_qual:%3u\n", DBG_8723A("%s signal_strength:%3u, rssi:%3d, signal_qual:%3u\n",
__func__, padapter->recvpriv.signal_strength, __func__, padapter->recvpriv.signal_strength,
padapter->recvpriv.rssi, padapter->recvpriv.signal_qual); padapter->recvpriv.rssi, padapter->recvpriv.signal_qual);
...@@ -1110,40 +1161,51 @@ static void rtw_joinbss_update_network23a(struct rtw_adapter *padapter, struct w ...@@ -1110,40 +1161,51 @@ static void rtw_joinbss_update_network23a(struct rtw_adapter *padapter, struct w
break; break;
default: default:
pmlmepriv->fw_state = WIFI_NULL_STATE; pmlmepriv->fw_state = WIFI_NULL_STATE;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("Invalid network_mode\n")); RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
("Invalid network_mode\n"));
break; break;
} }
rtw_update_protection23a(padapter, (cur_network->network.IEs) + sizeof (struct ndis_802_11_fixed_ies), rtw_update_protection23a(padapter, cur_network->network.IEs +
(cur_network->network.IELength)); sizeof (struct ndis_802_11_fixed_ies),
cur_network->network.IELength);
rtw_update_ht_cap23a(padapter, cur_network->network.IEs, cur_network->network.IELength); rtw_update_ht_cap23a(padapter, cur_network->network.IEs,
cur_network->network.IELength);
} }
/* Notes: the fucntion could be > passive_level (the same context as Rx tasklet) */ /*
/* pnetwork : returns from rtw23a_joinbss_event_cb */ * Notes:
/* ptarget_wlan: found from scanned_queue */ * the fucntion could be > passive_level (the same context as Rx tasklet)
/* if join_res > 0, for (fw_state==WIFI_STATION_STATE), we check if "ptarget_sta" & "ptarget_wlan" exist. */ * pnetwork : returns from rtw23a_joinbss_event_cb
/* if join_res > 0, for (fw_state==WIFI_ADHOC_STATE), we only check if "ptarget_wlan" exist. */ * ptarget_wlan: found from scanned_queue
/* if join_res > 0, update "cur_network->network" from "pnetwork->network" if (ptarget_wlan !=NULL). */ * if join_res > 0, for (fw_state==WIFI_STATION_STATE),
* we check if "ptarget_sta" & "ptarget_wlan" exist.
* if join_res > 0, for (fw_state==WIFI_ADHOC_STATE),
* we only check if "ptarget_wlan" exist.
* if join_res > 0, update "cur_network->network" from "pnetwork->network"
* if (ptarget_wlan !=NULL).
*/
void rtw_joinbss_event_prehandle23a(struct rtw_adapter *adapter, u8 *pbuf) void rtw_joinbss_event_prehandle23a(struct rtw_adapter *adapter, u8 *pbuf)
{ {
static u8 retry=0; struct sta_info *ptarget_sta, *pcur_sta;
struct sta_info *ptarget_sta= NULL, *pcur_sta = NULL;
struct sta_priv *pstapriv = &adapter->stapriv; struct sta_priv *pstapriv = &adapter->stapriv;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
struct wlan_network *pnetwork = (struct wlan_network *)pbuf; struct wlan_network *pnetwork = (struct wlan_network *)pbuf;
struct wlan_network *cur_network = &pmlmepriv->cur_network; struct wlan_network *cur_network = &pmlmepriv->cur_network;
struct wlan_network *pcur_wlan = NULL, *ptarget_wlan = NULL; struct wlan_network *pcur_wlan, *ptarget_wlan = NULL;
unsigned int the_same_macaddr = false; bool the_same_macaddr;
RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("joinbss event call back received with res=%d\n", pnetwork->join_res)); RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,
("joinbss event call back received with res=%d\n",
pnetwork->join_res));
rtw_get_encrypt_decrypt_from_registrypriv23a(adapter); rtw_get_encrypt_decrypt_from_registrypriv23a(adapter);
if (pmlmepriv->assoc_ssid.ssid_len == 0) { if (pmlmepriv->assoc_ssid.ssid_len == 0) {
RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("@@@@@ joinbss event call back for Any SSid\n")); RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,
("@@@@@ joinbss event call back for Any SSid\n"));
} else { } else {
RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_, RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,
("@@@@@ rtw23a_joinbss_event_cb for SSid:%s\n", ("@@@@@ rtw23a_joinbss_event_cb for SSid:%s\n",
...@@ -1157,93 +1219,102 @@ void rtw_joinbss_event_prehandle23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -1157,93 +1219,102 @@ void rtw_joinbss_event_prehandle23a(struct rtw_adapter *adapter, u8 *pbuf)
the_same_macaddr = false; the_same_macaddr = false;
pnetwork->network.Length = get_wlan_bssid_ex_sz(&pnetwork->network); pnetwork->network.Length = get_wlan_bssid_ex_sz(&pnetwork->network);
if(pnetwork->network.Length > sizeof(struct wlan_bssid_ex)) if (pnetwork->network.Length > sizeof(struct wlan_bssid_ex)) {
{ RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,
RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("\n\n ***joinbss_evt_callback return a wrong bss ***\n\n")); ("\n\n ***joinbss_evt_callback return a wrong bss "
"***\n\n"));
return; return;
} }
spin_lock_bh(&pmlmepriv->lock); spin_lock_bh(&pmlmepriv->lock);
RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("\n rtw23a_joinbss_event_cb !! _enter_critical\n")); RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,
("\n rtw23a_joinbss_event_cb !! _enter_critical\n"));
if(pnetwork->join_res > 0) if (pnetwork->join_res > 0) {
{
spin_lock_bh(&pmlmepriv->scanned_queue.lock); spin_lock_bh(&pmlmepriv->scanned_queue.lock);
retry = 0; if (check_fwstate(pmlmepriv,_FW_UNDER_LINKING)) {
if (check_fwstate(pmlmepriv,_FW_UNDER_LINKING))
{
/* s1. find ptarget_wlan */ /* s1. find ptarget_wlan */
if(check_fwstate(pmlmepriv, _FW_LINKED)) if (check_fwstate(pmlmepriv, _FW_LINKED)) {
{ if (the_same_macaddr == true) {
if(the_same_macaddr == true)
{
ptarget_wlan = rtw_find_network23a(&pmlmepriv->scanned_queue, cur_network->network.MacAddress); ptarget_wlan = rtw_find_network23a(&pmlmepriv->scanned_queue, cur_network->network.MacAddress);
} } else {
else
{
pcur_wlan = rtw_find_network23a(&pmlmepriv->scanned_queue, cur_network->network.MacAddress); pcur_wlan = rtw_find_network23a(&pmlmepriv->scanned_queue, cur_network->network.MacAddress);
if(pcur_wlan) pcur_wlan->fixed = false; if (pcur_wlan)
pcur_wlan->fixed = false;
pcur_sta = rtw_get_stainfo23a(pstapriv, cur_network->network.MacAddress); pcur_sta = rtw_get_stainfo23a(pstapriv, cur_network->network.MacAddress);
if(pcur_sta) { if (pcur_sta) {
spin_lock_bh(&pstapriv->sta_hash_lock); spin_lock_bh(&pstapriv->sta_hash_lock);
rtw_free_stainfo23a(adapter, pcur_sta); rtw_free_stainfo23a(adapter,
pcur_sta);
spin_unlock_bh(&pstapriv->sta_hash_lock); spin_unlock_bh(&pstapriv->sta_hash_lock);
} }
ptarget_wlan = rtw_find_network23a(&pmlmepriv->scanned_queue, pnetwork->network.MacAddress); ptarget_wlan = rtw_find_network23a(&pmlmepriv->scanned_queue, pnetwork->network.MacAddress);
if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { if (check_fwstate(pmlmepriv,
if(ptarget_wlan) ptarget_wlan->fixed = true; WIFI_STATION_STATE)) {
if (ptarget_wlan)
ptarget_wlan->fixed =
true;
} }
} }
} } else {
else ptarget_wlan = rtw_find_network23a(
{ &pmlmepriv->scanned_queue,
ptarget_wlan = rtw_find_network23a(&pmlmepriv->scanned_queue, pnetwork->network.MacAddress); pnetwork->network.MacAddress);
if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { if (check_fwstate(pmlmepriv,
if(ptarget_wlan) ptarget_wlan->fixed = true; WIFI_STATION_STATE)) {
if (ptarget_wlan)
ptarget_wlan->fixed = true;
} }
} }
/* s2. update cur_network */ /* s2. update cur_network */
if(ptarget_wlan) if (ptarget_wlan)
{ rtw_joinbss_update_network23a(adapter,
rtw_joinbss_update_network23a(adapter, ptarget_wlan, pnetwork); ptarget_wlan,
} pnetwork);
else else {
{ RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,
RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("Can't find ptarget_wlan when joinbss_event callback\n")); ("Can't find ptarget_wlan when "
"joinbss_event callback\n"));
spin_unlock_bh(&pmlmepriv->scanned_queue.lock); spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
goto ignore_joinbss_callback; goto ignore_joinbss_callback;
} }
/* s3. find ptarget_sta & update ptarget_sta after update cur_network only for station mode */ /* s3. find ptarget_sta & update ptarget_sta after
if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) update cur_network only for station mode */
{ if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
ptarget_sta = rtw_joinbss_update_stainfo(adapter, pnetwork); ptarget_sta = rtw_joinbss_update_stainfo(
if(ptarget_sta==NULL) adapter, pnetwork);
{ if (!ptarget_sta) {
RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("Can't update stainfo when joinbss_event callback\n")); RT_TRACE(_module_rtl871x_mlme_c_,
_drv_err_,
("Can't update stainfo when "
"joinbss_event callback\n"));
spin_unlock_bh(&pmlmepriv->scanned_queue.lock); spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
goto ignore_joinbss_callback; goto ignore_joinbss_callback;
} }
} }
/* s4. indicate connect */ /* s4. indicate connect */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE))
{
rtw_indicate_connect23a(adapter); rtw_indicate_connect23a(adapter);
} else { else {
/* adhoc mode will rtw_indicate_connect23a when rtw_stassoc_event_callback23a */ /* adhoc mode will rtw_indicate_connect23a
RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("adhoc mode, fw_state:%x", get_fwstate(pmlmepriv))); when rtw_stassoc_event_callback23a */
RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,
("adhoc mode, fw_state:%x",
get_fwstate(pmlmepriv)));
} }
/* s5. Cancle assoc_timer */ /* s5. Cancle assoc_timer */
del_timer_sync(&pmlmepriv->assoc_timer); del_timer_sync(&pmlmepriv->assoc_timer);
RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("Cancle assoc_timer\n")); RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,
("Cancle assoc_timer\n"));
} else { } else {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
("rtw23a_joinbss_event_cb err: fw_state:%x", ("rtw23a_joinbss_event_cb err: fw_state:%x",
...@@ -1252,20 +1323,19 @@ void rtw_joinbss_event_prehandle23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -1252,20 +1323,19 @@ void rtw_joinbss_event_prehandle23a(struct rtw_adapter *adapter, u8 *pbuf)
goto ignore_joinbss_callback; goto ignore_joinbss_callback;
} }
spin_unlock_bh(&pmlmepriv->scanned_queue.lock); spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
} else if(pnetwork->join_res == -4) { } else if (pnetwork->join_res == -4) {
rtw_reset_securitypriv23a(adapter); rtw_reset_securitypriv23a(adapter);
mod_timer(&pmlmepriv->assoc_timer, mod_timer(&pmlmepriv->assoc_timer,
jiffies + msecs_to_jiffies(1)); jiffies + msecs_to_jiffies(1));
/* rtw_free_assoc_resources23a(adapter, 1); */ /* rtw_free_assoc_resources23a(adapter, 1); */
if((check_fwstate(pmlmepriv, _FW_UNDER_LINKING))) { if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
("fail! clear _FW_UNDER_LINKING ^^^fw_state=%x\n", ("fail! clear _FW_UNDER_LINKING ^^^fw_state="
get_fwstate(pmlmepriv))); "%x\n", get_fwstate(pmlmepriv)));
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
} }
} else { } else {
/* if join_res < 0 (join fails), then try again */ /* if join_res < 0 (join fails), then try again */
mod_timer(&pmlmepriv->assoc_timer, mod_timer(&pmlmepriv->assoc_timer,
...@@ -1285,7 +1355,6 @@ void rtw23a_joinbss_event_cb(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -1285,7 +1355,6 @@ void rtw23a_joinbss_event_cb(struct rtw_adapter *adapter, u8 *pbuf)
mlmeext_joinbss_event_callback23a(adapter, pnetwork->join_res); mlmeext_joinbss_event_callback23a(adapter, pnetwork->join_res);
rtw_os_xmit_schedule23a(adapter); rtw_os_xmit_schedule23a(adapter);
} }
void rtw_stassoc_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf) void rtw_stassoc_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf)
...@@ -1294,14 +1363,13 @@ void rtw_stassoc_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -1294,14 +1363,13 @@ void rtw_stassoc_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf)
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
struct stassoc_event *pstassoc = (struct stassoc_event*)pbuf; struct stassoc_event *pstassoc = (struct stassoc_event*)pbuf;
struct wlan_network *cur_network = &pmlmepriv->cur_network; struct wlan_network *cur_network = &pmlmepriv->cur_network;
struct wlan_network *ptarget_wlan = NULL; struct wlan_network *ptarget_wlan;
if(rtw_access_ctrl23a(adapter, pstassoc->macaddr) == false) if (rtw_access_ctrl23a(adapter, pstassoc->macaddr) == false)
return; return;
#ifdef CONFIG_8723AU_AP_MODE #ifdef CONFIG_8723AU_AP_MODE
if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
{
psta = rtw_get_stainfo23a(&adapter->stapriv, pstassoc->macaddr); psta = rtw_get_stainfo23a(&adapter->stapriv, pstassoc->macaddr);
if (psta) { if (psta) {
/* bss_cap_update_on_sta_join23a(adapter, psta); */ /* bss_cap_update_on_sta_join23a(adapter, psta); */
...@@ -1315,13 +1383,19 @@ void rtw_stassoc_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -1315,13 +1383,19 @@ void rtw_stassoc_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf)
psta = rtw_get_stainfo23a(&adapter->stapriv, pstassoc->macaddr); psta = rtw_get_stainfo23a(&adapter->stapriv, pstassoc->macaddr);
if (psta != NULL) { if (psta != NULL) {
/* the sta have been in sta_info_queue => do nothing */ /* the sta have been in sta_info_queue => do nothing */
RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("Error: rtw_stassoc_event_callback23a: sta has been in sta_hash_queue\n")); RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,
return; /* between drv has received this event before and fw have not yet to set key to CAM_ENTRY) */ ("Error: rtw_stassoc_event_callback23a: sta has "
"been in sta_hash_queue\n"));
/* between drv has received this event before and
fw have not yet to set key to CAM_ENTRY) */
return;
} }
psta = rtw_alloc_stainfo23a(&adapter->stapriv, pstassoc->macaddr); psta = rtw_alloc_stainfo23a(&adapter->stapriv, pstassoc->macaddr);
if (psta == NULL) { if (!psta) {
RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("Can't alloc sta_info when rtw_stassoc_event_callback23a\n")); RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,
("Can't alloc sta_info when "
"rtw_stassoc_event_callback23a\n"));
return; return;
} }
...@@ -1331,23 +1405,25 @@ void rtw_stassoc_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -1331,23 +1405,25 @@ void rtw_stassoc_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf)
/* psta->aid = (uint)pstassoc->cam_id; */ /* psta->aid = (uint)pstassoc->cam_id; */
DBG_8723A("%s\n",__func__); DBG_8723A("%s\n",__func__);
/* for ad-hoc mode */ /* for ad-hoc mode */
rtw_hal_set_odm_var23a(adapter,HAL_ODM_STA_INFO,psta,true); rtw_hal_set_odm_var23a(adapter, HAL_ODM_STA_INFO, psta, true);
if(adapter->securitypriv.dot11AuthAlgrthm==dot11AuthAlgrthm_8021X) if (adapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)
psta->dot118021XPrivacy = adapter->securitypriv.dot11PrivacyAlgrthm; psta->dot118021XPrivacy =
adapter->securitypriv.dot11PrivacyAlgrthm;
psta->ieee8021x_blocked = false; psta->ieee8021x_blocked = false;
spin_lock_bh(&pmlmepriv->lock); spin_lock_bh(&pmlmepriv->lock);
if ( (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==true ) || if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) ||
(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)==true ) ) check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
{ if (adapter->stapriv.asoc_sta_count == 2) {
if(adapter->stapriv.asoc_sta_count== 2)
{
spin_lock_bh(&pmlmepriv->scanned_queue.lock); spin_lock_bh(&pmlmepriv->scanned_queue.lock);
ptarget_wlan = rtw_find_network23a(&pmlmepriv->scanned_queue, cur_network->network.MacAddress); ptarget_wlan =
if(ptarget_wlan) ptarget_wlan->fixed = true; rtw_find_network23a(&pmlmepriv->scanned_queue,
cur_network->network.MacAddress);
if (ptarget_wlan)
ptarget_wlan->fixed = true;
spin_unlock_bh(&pmlmepriv->scanned_queue.lock); spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
/* a sta + bc/mc_stainfo (not Ibss_stainfo) */ /* a sta + bc/mc_stainfo (not Ibss_stainfo) */
rtw_indicate_connect23a(adapter); rtw_indicate_connect23a(adapter);
...@@ -1361,40 +1437,40 @@ void rtw_stassoc_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -1361,40 +1437,40 @@ void rtw_stassoc_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf)
void rtw_stadel_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf) void rtw_stadel_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf)
{ {
int mac_id=-1; int mac_id;
struct sta_info *psta; struct sta_info *psta;
struct wlan_network* pwlan = NULL; struct wlan_network* pwlan;
struct wlan_bssid_ex *pdev_network=NULL; struct wlan_bssid_ex *pdev_network;
u8* pibss = NULL; 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;
struct wlan_network *tgt_network = &pmlmepriv->cur_network; struct wlan_network *tgt_network = &pmlmepriv->cur_network;
psta = rtw_get_stainfo23a(&adapter->stapriv, pstadel->macaddr); psta = rtw_get_stainfo23a(&adapter->stapriv, pstadel->macaddr);
if(psta) if (psta)
mac_id = psta->mac_id; mac_id = psta->mac_id;
else else
mac_id = pstadel->mac_id; mac_id = pstadel->mac_id;
DBG_8723A("%s(mac_id=%d)=" MAC_FMT "\n", __func__, mac_id, MAC_ARG(pstadel->macaddr)); DBG_8723A("%s(mac_id=%d)=" MAC_FMT "\n", __func__, mac_id,
MAC_ARG(pstadel->macaddr));
if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) if (check_fwstate(pmlmepriv, WIFI_AP_STATE))
{
return; return;
}
mlmeext_sta_del_event_callback23a(adapter); mlmeext_sta_del_event_callback23a(adapter);
spin_lock_bh(&pmlmepriv->lock); spin_lock_bh(&pmlmepriv->lock);
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
{ if (rtw_to_roaming(adapter) > 0) {
if (rtw_to_roaming(adapter) > 0) /* this stadel_event is caused by roaming,
pmlmepriv->to_roaming--; /* this stadel_event is caused by roaming, decrease to_roaming */ decrease to_roaming */
else if (rtw_to_roaming(adapter) == 0) pmlmepriv->to_roaming--;
} else if (rtw_to_roaming(adapter) == 0)
rtw_set_roaming(adapter, adapter->registrypriv.max_roaming_times); rtw_set_roaming(adapter, adapter->registrypriv.max_roaming_times);
if (*((unsigned short *)(pstadel->rsvd)) != WLAN_REASON_EXPIRATION_CHK) if (*((u16 *)pstadel->rsvd) != WLAN_REASON_EXPIRATION_CHK)
rtw_set_roaming(adapter, 0); /* don't roam */ rtw_set_roaming(adapter, 0); /* don't roam */
rtw_free_uc_swdec_pending_queue23a(adapter); rtw_free_uc_swdec_pending_queue23a(adapter);
...@@ -1403,7 +1479,8 @@ void rtw_stadel_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -1403,7 +1479,8 @@ void rtw_stadel_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf)
rtw_indicate_disconnect23a(adapter); rtw_indicate_disconnect23a(adapter);
spin_lock_bh(&pmlmepriv->scanned_queue.lock); spin_lock_bh(&pmlmepriv->scanned_queue.lock);
/* remove the network entry in scanned_queue */ /* remove the network entry in scanned_queue */
pwlan = rtw_find_network23a(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress); pwlan = rtw_find_network23a(&pmlmepriv->scanned_queue,
tgt_network->network.MacAddress);
if (pwlan) { if (pwlan) {
pwlan->fixed = false; pwlan->fixed = false;
rtw_free_network_nolock(pmlmepriv, pwlan); rtw_free_network_nolock(pmlmepriv, pwlan);
...@@ -1414,21 +1491,21 @@ void rtw_stadel_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -1414,21 +1491,21 @@ void rtw_stadel_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf)
} }
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) || if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) ||
check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
{
spin_lock_bh(&pstapriv->sta_hash_lock); spin_lock_bh(&pstapriv->sta_hash_lock);
rtw_free_stainfo23a(adapter, psta); rtw_free_stainfo23a(adapter, psta);
spin_unlock_bh(&pstapriv->sta_hash_lock); spin_unlock_bh(&pstapriv->sta_hash_lock);
if (adapter->stapriv.asoc_sta_count == 1) /* a sta + bc/mc_stainfo (not Ibss_stainfo) */ /* a sta + bc/mc_stainfo (not Ibss_stainfo) */
{ if (adapter->stapriv.asoc_sta_count == 1) {
spin_lock_bh(&pmlmepriv->scanned_queue.lock); spin_lock_bh(&pmlmepriv->scanned_queue.lock);
/* free old ibss network */ /* free old ibss network */
/* pwlan = rtw_find_network23a(&pmlmepriv->scanned_queue, pstadel->macaddr); */ /* pwlan = rtw_find_network23a(
pwlan = rtw_find_network23a(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress); &pmlmepriv->scanned_queue, pstadel->macaddr); */
if (pwlan) pwlan = rtw_find_network23a(&pmlmepriv->scanned_queue,
{ tgt_network->network.MacAddress);
if (pwlan) {
pwlan->fixed = false; pwlan->fixed = false;
rtw_free_network_nolock(pmlmepriv, pwlan); rtw_free_network_nolock(pmlmepriv, pwlan);
} }
...@@ -1437,7 +1514,8 @@ void rtw_stadel_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -1437,7 +1514,8 @@ void rtw_stadel_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf)
pdev_network = &adapter->registrypriv.dev_network; pdev_network = &adapter->registrypriv.dev_network;
pibss = adapter->registrypriv.dev_network.MacAddress; pibss = adapter->registrypriv.dev_network.MacAddress;
memcpy(pdev_network, &tgt_network->network, get_wlan_bssid_ex_sz(&tgt_network->network)); memcpy(pdev_network, &tgt_network->network,
get_wlan_bssid_ex_sz(&tgt_network->network));
memset(&pdev_network->Ssid, 0, memset(&pdev_network->Ssid, 0,
sizeof(struct cfg80211_ssid)); sizeof(struct cfg80211_ssid));
...@@ -1448,32 +1526,28 @@ void rtw_stadel_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf) ...@@ -1448,32 +1526,28 @@ void rtw_stadel_event_callback23a(struct rtw_adapter *adapter, u8 *pbuf)
rtw_generate_random_ibss23a(pibss); rtw_generate_random_ibss23a(pibss);
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
{
set_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE); set_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
_clr_fwstate_(pmlmepriv, WIFI_ADHOC_STATE); _clr_fwstate_(pmlmepriv, WIFI_ADHOC_STATE);
} }
if (rtw_createbss_cmd23a(adapter)!= _SUCCESS) if (rtw_createbss_cmd23a(adapter) != _SUCCESS) {
{ RT_TRACE(_module_rtl871x_ioctl_set_c_,
_drv_err_,
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("***Error =>stadel_event_callback: rtw_createbss_cmd23a status FAIL***\n ")); ("***Error =>stadel_event_callback: "
"rtw_createbss_cmd23a status "
"FAIL***\n"));
} }
} }
} }
spin_unlock_bh(&pmlmepriv->lock); spin_unlock_bh(&pmlmepriv->lock);
} }
void rtw_cpwm_event_callback23a(struct rtw_adapter *padapter, u8 *pbuf) void rtw_cpwm_event_callback23a(struct rtw_adapter *padapter, u8 *pbuf)
{ {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("+rtw_cpwm_event_callback23a !!!\n")); ("+rtw_cpwm_event_callback23a !!!\n"));
} }
/* /*
...@@ -1488,23 +1562,26 @@ void rtw23a_join_to_handler (unsigned long data) ...@@ -1488,23 +1562,26 @@ void rtw23a_join_to_handler (unsigned long data)
DBG_8723A("%s, fw_state=%x\n", __func__, get_fwstate(pmlmepriv)); DBG_8723A("%s, fw_state=%x\n", __func__, get_fwstate(pmlmepriv));
if(adapter->bDriverStopped ||adapter->bSurpriseRemoved) if (adapter->bDriverStopped ||adapter->bSurpriseRemoved)
return; return;
spin_lock_bh(&pmlmepriv->lock); spin_lock_bh(&pmlmepriv->lock);
if (rtw_to_roaming(adapter) > 0) { /* join timeout caused by roaming */ if (rtw_to_roaming(adapter) > 0) { /* join timeout caused by roaming */
while(1) { while (1) {
pmlmepriv->to_roaming--; pmlmepriv->to_roaming--;
if (rtw_to_roaming(adapter) != 0) { /* try another */ if (rtw_to_roaming(adapter) != 0) { /* try another */
DBG_8723A("%s try another roaming\n", __func__); DBG_8723A("%s try another roaming\n", __func__);
if (_SUCCESS!= (do_join_r = rtw_do_join23a(adapter))) { do_join_r = rtw_do_join23a(adapter);
DBG_8723A("%s roaming do_join return %d\n", __func__ , do_join_r); if (do_join_r != _SUCCESS) {
DBG_8723A("%s roaming do_join return "
"%d\n", __func__ , do_join_r);
continue; continue;
} }
break; break;
} else { } else {
DBG_8723A("%s We've try roaming but fail\n", __func__); DBG_8723A("%s We've try roaming but fail\n",
__func__);
rtw_indicate_disconnect23a(adapter); rtw_indicate_disconnect23a(adapter);
break; break;
} }
...@@ -1513,7 +1590,8 @@ void rtw23a_join_to_handler (unsigned long data) ...@@ -1513,7 +1590,8 @@ void rtw23a_join_to_handler (unsigned long data)
rtw_indicate_disconnect23a(adapter); rtw_indicate_disconnect23a(adapter);
free_scanqueue(pmlmepriv);/* */ free_scanqueue(pmlmepriv);/* */
/* indicate disconnect for the case that join_timeout and check_fwstate != FW_LINKED */ /* indicate disconnect for the case that join_timeout and
check_fwstate != FW_LINKED */
rtw_cfg80211_indicate_disconnect(adapter); rtw_cfg80211_indicate_disconnect(adapter);
} }
...@@ -1530,7 +1608,8 @@ void rtw_scan_timeout_handler23a(unsigned long data) ...@@ -1530,7 +1608,8 @@ void rtw_scan_timeout_handler23a(unsigned long data)
struct rtw_adapter *adapter = (struct rtw_adapter *)data; struct rtw_adapter *adapter = (struct rtw_adapter *)data;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
DBG_8723A(FUNC_ADPT_FMT" fw_state =%x\n", FUNC_ADPT_ARG(adapter), get_fwstate(pmlmepriv)); DBG_8723A(FUNC_ADPT_FMT" fw_state =%x\n", FUNC_ADPT_ARG(adapter),
get_fwstate(pmlmepriv));
spin_lock_bh(&pmlmepriv->lock); spin_lock_bh(&pmlmepriv->lock);
...@@ -1551,7 +1630,8 @@ static void rtw_auto_scan_handler(struct rtw_adapter *padapter) ...@@ -1551,7 +1630,8 @@ static void rtw_auto_scan_handler(struct rtw_adapter *padapter)
if (pmlmepriv->scan_interval == 0) { if (pmlmepriv->scan_interval == 0) {
DBG_8723A("%s\n", __func__); DBG_8723A("%s\n", __func__);
rtw_set_802_11_bssid23a_list_scan(padapter, NULL, 0); rtw_set_802_11_bssid23a_list_scan(padapter, NULL, 0);
pmlmepriv->scan_interval = SCAN_INTERVAL;/* 30*2 sec = 60sec */ /* 30*2 sec = 60sec */
pmlmepriv->scan_interval = SCAN_INTERVAL;
} }
} }
} }
...@@ -1564,7 +1644,8 @@ void rtw_dynamic_check_timer_handler(unsigned long data) ...@@ -1564,7 +1644,8 @@ void rtw_dynamic_check_timer_handler(unsigned long data)
if (adapter->hw_init_completed == false) if (adapter->hw_init_completed == false)
goto out; goto out;
if ((adapter->bDriverStopped == true)||(adapter->bSurpriseRemoved == true)) if (adapter->bDriverStopped == true ||
adapter->bSurpriseRemoved == true)
goto out; goto out;
if (adapter->net_closed == true) if (adapter->net_closed == true)
...@@ -1615,15 +1696,19 @@ void rtw_set_scan_deny(struct rtw_adapter *adapter, u32 ms) ...@@ -1615,15 +1696,19 @@ void rtw_set_scan_deny(struct rtw_adapter *adapter, u32 ms)
#endif #endif
/* /*
* Select a new join candidate from the original @param candidate and @param competitor * Select a new join candidate from the original @param candidate and
* @param competitor
* @return true: candidate is updated * @return true: candidate is updated
* @return false: candidate is not updated * @return false: candidate is not updated
*/ */
static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv,
, struct wlan_network **candidate, struct wlan_network *competitor) struct wlan_network **candidate,
struct wlan_network *competitor)
{ {
int updated = false; int updated = false;
struct rtw_adapter *adapter = container_of(pmlmepriv, struct rtw_adapter, mlmepriv); struct rtw_adapter *adapter;
adapter = container_of(pmlmepriv, struct rtw_adapter, mlmepriv);
/* check bssid, if needed */ /* check bssid, if needed */
if (pmlmepriv->assoc_by_bssid == true) { if (pmlmepriv->assoc_by_bssid == true) {
...@@ -1655,13 +1740,15 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv ...@@ -1655,13 +1740,15 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv
goto exit; goto exit;
} }
if (*candidate == NULL ||(*candidate)->network.Rssi<competitor->network.Rssi) { if (!*candidate ||
(*candidate)->network.Rssi<competitor->network.Rssi) {
*candidate = competitor; *candidate = competitor;
updated = true; updated = true;
} }
if (updated) { if (updated) {
DBG_8723A("[by_bssid:%u][assoc_ssid:%s][to_roaming:%u] new candidate: %s("MAC_FMT") rssi:%d\n", DBG_8723A("[by_bssid:%u][assoc_ssid:%s][to_roaming:%u] "
"new candidate: %s("MAC_FMT") rssi:%d\n",
pmlmepriv->assoc_by_bssid, pmlmepriv->assoc_by_bssid,
pmlmepriv->assoc_ssid.ssid, pmlmepriv->assoc_ssid.ssid,
rtw_to_roaming(adapter), rtw_to_roaming(adapter),
...@@ -1690,7 +1777,7 @@ int rtw_select_and_join_from_scanned_queue23a(struct mlme_priv *pmlmepriv) ...@@ -1690,7 +1777,7 @@ int rtw_select_and_join_from_scanned_queue23a(struct mlme_priv *pmlmepriv)
struct list_head *phead, *plist, *ptmp; struct list_head *phead, *plist, *ptmp;
struct rtw_adapter *adapter; struct rtw_adapter *adapter;
struct rtw_queue *queue = &pmlmepriv->scanned_queue; struct rtw_queue *queue = &pmlmepriv->scanned_queue;
struct wlan_network *pnetwork = NULL; struct wlan_network *pnetwork;
struct wlan_network *candidate = NULL; struct wlan_network *candidate = NULL;
spin_lock_bh(&pmlmepriv->scanned_queue.lock); spin_lock_bh(&pmlmepriv->scanned_queue.lock);
...@@ -1722,7 +1809,7 @@ int rtw_select_and_join_from_scanned_queue23a(struct mlme_priv *pmlmepriv) ...@@ -1722,7 +1809,7 @@ int rtw_select_and_join_from_scanned_queue23a(struct mlme_priv *pmlmepriv)
} }
/* check for situation of _FW_LINKED */ /* check for situation of _FW_LINKED */
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { if (check_fwstate(pmlmepriv, _FW_LINKED)) {
DBG_8723A("%s: _FW_LINKED while ask_for_joinbss!!!\n", DBG_8723A("%s: _FW_LINKED while ask_for_joinbss!!!\n",
__func__); __func__);
...@@ -1808,9 +1895,9 @@ int rtw_set_key23a(struct rtw_adapter *adapter, ...@@ -1808,9 +1895,9 @@ int rtw_set_key23a(struct rtw_adapter *adapter,
psetkeyparm->algorithm = (unsigned char) psetkeyparm->algorithm = (unsigned char)
psecuritypriv->dot118021XGrpPrivacy; psecuritypriv->dot118021XGrpPrivacy;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
("\n rtw_set_key23a: psetkeyparm->algorithm = (unsigned " ("\n rtw_set_key23a: psetkeyparm->algorithm = "
"char)psecuritypriv->dot118021XGrpPrivacy =%d\n", "(unsigned char)psecuritypriv->dot118021XGrpPrivacy "
psetkeyparm->algorithm)); "=%d\n", psetkeyparm->algorithm));
} else { } else {
psetkeyparm->algorithm = (u8)psecuritypriv->dot11PrivacyAlgrthm; psetkeyparm->algorithm = (u8)psecuritypriv->dot11PrivacyAlgrthm;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
...@@ -1855,8 +1942,8 @@ int rtw_set_key23a(struct rtw_adapter *adapter, ...@@ -1855,8 +1942,8 @@ int rtw_set_key23a(struct rtw_adapter *adapter,
break; break;
default: default:
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
("\n rtw_set_key23a:psecuritypriv->dot11PrivacyAlgrthm = " ("\n rtw_set_key23a:psecuritypriv->dot11PrivacyAlgrthm"
"%x (must be 1 or 2 or 4 or 5)\n", " = %x (must be 1 or 2 or 4 or 5)\n",
psecuritypriv->dot11PrivacyAlgrthm)); psecuritypriv->dot11PrivacyAlgrthm));
res = _FAIL; res = _FAIL;
kfree(pcmd); kfree(pcmd);
...@@ -1889,7 +1976,7 @@ int rtw_restruct_wmm_ie23a(struct rtw_adapter *adapter, u8 *in_ie, ...@@ -1889,7 +1976,7 @@ int rtw_restruct_wmm_ie23a(struct rtw_adapter *adapter, u8 *in_ie,
unsigned int i, j; unsigned int i, j;
i = 12; /* after the fixed IE */ i = 12; /* after the fixed IE */
while(i < in_len) { while (i < in_len) {
ielength = initial_out_len; ielength = initial_out_len;
/* WMM element ID and OUI */ /* WMM element ID and OUI */
...@@ -1940,11 +2027,11 @@ static int SecIsInPMKIDList(struct rtw_adapter *Adapter, u8 *bssid) ...@@ -1940,11 +2027,11 @@ static int SecIsInPMKIDList(struct rtw_adapter *Adapter, u8 *bssid)
i++; i++;
/* continue; */ /* continue; */
} }
} while(i < NUM_PMKID_CACHE); } while (i < NUM_PMKID_CACHE);
if (i == NUM_PMKID_CACHE) { if (i == NUM_PMKID_CACHE)
i = -1;/* Could not find. */ i = -1;/* Could not find. */
} else { else {
/* There is one Pre-Authentication Key for /* There is one Pre-Authentication Key for
the specific BSSID. */ the specific BSSID. */
} }
...@@ -1994,26 +2081,26 @@ int rtw_restruct_sec_ie23a(struct rtw_adapter *adapter, u8 *in_ie, u8 *out_ie, ...@@ -1994,26 +2081,26 @@ int rtw_restruct_sec_ie23a(struct rtw_adapter *adapter, u8 *in_ie, u8 *out_ie,
uint ndissecuritytype = psecuritypriv->ndisencryptstatus; uint ndissecuritytype = psecuritypriv->ndisencryptstatus;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_,
("+rtw_restruct_sec_ie23a: ndisauthmode=%d ndissecuritytype=%d\n", ("+rtw_restruct_sec_ie23a: ndisauthmode=%d "
ndisauthmode, ndissecuritytype)); "ndissecuritytype=%d\n", ndisauthmode, ndissecuritytype));
/* copy fixed ie only */ /* copy fixed ie only */
memcpy(out_ie, in_ie, 12); memcpy(out_ie, in_ie, 12);
ielength = 12; ielength = 12;
if ((ndisauthmode==Ndis802_11AuthModeWPA) || if (ndisauthmode == Ndis802_11AuthModeWPA ||
(ndisauthmode==Ndis802_11AuthModeWPAPSK)) ndisauthmode == Ndis802_11AuthModeWPAPSK)
authmode = WLAN_EID_VENDOR_SPECIFIC; authmode = WLAN_EID_VENDOR_SPECIFIC;
if ((ndisauthmode==Ndis802_11AuthModeWPA2) || if (ndisauthmode == Ndis802_11AuthModeWPA2 ||
(ndisauthmode==Ndis802_11AuthModeWPA2PSK)) ndisauthmode == Ndis802_11AuthModeWPA2PSK)
authmode=_WPA2_IE_ID_; authmode = _WPA2_IE_ID_;
if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) { if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) {
memcpy(out_ie + ielength, psecuritypriv->wps_ie, memcpy(out_ie + ielength, psecuritypriv->wps_ie,
psecuritypriv->wps_ie_len); psecuritypriv->wps_ie_len);
ielength += psecuritypriv->wps_ie_len; ielength += psecuritypriv->wps_ie_len;
} else if ((authmode == WLAN_EID_VENDOR_SPECIFIC) || } else if (authmode == WLAN_EID_VENDOR_SPECIFIC ||
(authmode==_WPA2_IE_ID_)) { authmode == _WPA2_IE_ID_) {
/* copy RSN or SSN */ /* copy RSN or SSN */
memcpy(&out_ie[ielength], &psecuritypriv->supplicant_ie[0], memcpy(&out_ie[ielength], &psecuritypriv->supplicant_ie[0],
psecuritypriv->supplicant_ie[1] + 2); psecuritypriv->supplicant_ie[1] + 2);
...@@ -2021,14 +2108,13 @@ int rtw_restruct_sec_ie23a(struct rtw_adapter *adapter, u8 *in_ie, u8 *out_ie, ...@@ -2021,14 +2108,13 @@ int rtw_restruct_sec_ie23a(struct rtw_adapter *adapter, u8 *in_ie, u8 *out_ie,
} }
iEntry = SecIsInPMKIDList(adapter, pmlmepriv->assoc_bssid); iEntry = SecIsInPMKIDList(adapter, pmlmepriv->assoc_bssid);
if (iEntry < 0) { if (iEntry < 0)
return ielength; return ielength;
} else { else {
if (authmode == _WPA2_IE_ID_) { if (authmode == _WPA2_IE_ID_)
ielength=rtw_append_pmkid(adapter, iEntry, ielength = rtw_append_pmkid(adapter, iEntry,
out_ie, ielength); out_ie, ielength);
} }
}
return ielength; return ielength;
} }
...@@ -2120,7 +2206,6 @@ void rtw_update_registrypriv_dev_network23a(struct rtw_adapter* adapter) ...@@ -2120,7 +2206,6 @@ void rtw_update_registrypriv_dev_network23a(struct rtw_adapter* adapter)
/* notes: translate IELength & Length after assign the /* notes: translate IELength & Length after assign the
Length to cmdsz in createbss_cmd(); */ Length to cmdsz in createbss_cmd(); */
/* pdev_network->IELength = cpu_to_le32(sz); */ /* pdev_network->IELength = cpu_to_le32(sz); */
} }
void rtw_get_encrypt_decrypt_from_registrypriv23a(struct rtw_adapter* adapter) void rtw_get_encrypt_decrypt_from_registrypriv23a(struct rtw_adapter* adapter)
...@@ -2285,8 +2370,8 @@ void rtw_update_ht_cap23a(struct rtw_adapter *padapter, u8 *pie, uint ie_len) ...@@ -2285,8 +2370,8 @@ void rtw_update_ht_cap23a(struct rtw_adapter *padapter, u8 *pie, uint ie_len)
/* update cur_bwmode & cur_ch_offset */ /* update cur_bwmode & cur_ch_offset */
if (pregistrypriv->cbw40_enable && if (pregistrypriv->cbw40_enable &&
(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & BIT(1)) && pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & BIT(1) &&
(pmlmeinfo->HT_info.infos[0] & BIT(2))) { pmlmeinfo->HT_info.infos[0] & BIT(2)) {
int i; int i;
u8 rf_type; u8 rf_type;
...@@ -2294,7 +2379,7 @@ void rtw_update_ht_cap23a(struct rtw_adapter *padapter, u8 *pie, uint ie_len) ...@@ -2294,7 +2379,7 @@ void rtw_update_ht_cap23a(struct rtw_adapter *padapter, u8 *pie, uint ie_len)
/* update the MCS rates */ /* update the MCS rates */
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if ((rf_type == RF_1T1R) || (rf_type == RF_1T2R)) if (rf_type == RF_1T1R || rf_type == RF_1T2R)
pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_1R23A[i]; pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_1R23A[i];
else else
pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R23A[i]; pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R23A[i];
...@@ -2332,52 +2417,52 @@ void rtw_update_ht_cap23a(struct rtw_adapter *padapter, u8 *pie, uint ie_len) ...@@ -2332,52 +2417,52 @@ void rtw_update_ht_cap23a(struct rtw_adapter *padapter, u8 *pie, uint ie_len)
pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3; pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3;
} }
void rtw_issue_addbareq_cmd23a(struct rtw_adapter *padapter, struct xmit_frame *pxmitframe) void rtw_issue_addbareq_cmd23a(struct rtw_adapter *padapter,
struct xmit_frame *pxmitframe)
{ {
u8 issued; u8 issued;
int priority; int priority;
struct sta_info *psta = NULL; struct sta_info *psta;
struct ht_priv *phtpriv; struct ht_priv *phtpriv;
struct pkt_attrib *pattrib = &pxmitframe->attrib; struct pkt_attrib *pattrib = &pxmitframe->attrib;
s32 bmcst = is_multicast_ether_addr(pattrib->ra); s32 bmcst = is_multicast_ether_addr(pattrib->ra);
if (bmcst || (padapter->mlmepriv.LinkDetectInfo.NumTxOkInPeriod<100)) if (bmcst || padapter->mlmepriv.LinkDetectInfo.NumTxOkInPeriod < 100)
return; return;
priority = pattrib->priority; priority = pattrib->priority;
if (pattrib->psta) if (pattrib->psta)
psta = pattrib->psta; psta = pattrib->psta;
else else {
{
DBG_8723A("%s, call rtw_get_stainfo23a()\n", __func__); DBG_8723A("%s, call rtw_get_stainfo23a()\n", __func__);
psta = rtw_get_stainfo23a(&padapter->stapriv, pattrib->ra); psta = rtw_get_stainfo23a(&padapter->stapriv, pattrib->ra);
} }
if (psta == NULL) if (!psta) {
{
DBG_8723A("%s, psta == NUL\n", __func__); DBG_8723A("%s, psta == NUL\n", __func__);
return; return;
} }
if (!(psta->state &_FW_LINKED)) if (!(psta->state &_FW_LINKED)) {
{ DBG_8723A("%s, psta->state(0x%x) != _FW_LINKED\n",
DBG_8723A("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state); __func__, psta->state);
return; return;
} }
phtpriv = &psta->htpriv; phtpriv = &psta->htpriv;
if ((phtpriv->ht_option == true) && (phtpriv->ampdu_enable == true)) if (phtpriv->ht_option == true && phtpriv->ampdu_enable == true) {
{
issued = (phtpriv->agg_enable_bitmap>>priority)&0x1; issued = (phtpriv->agg_enable_bitmap>>priority)&0x1;
issued |= (phtpriv->candidate_tid_bitmap>>priority)&0x1; issued |= (phtpriv->candidate_tid_bitmap>>priority)&0x1;
if (0 == issued) if (issued == 0) {
{ DBG_8723A("rtw_issue_addbareq_cmd23a, p =%d\n",
DBG_8723A("rtw_issue_addbareq_cmd23a, p =%d\n", priority); priority);
psta->htpriv.candidate_tid_bitmap |= CHKBIT((u8)priority); psta->htpriv.candidate_tid_bitmap |=
rtw_addbareq_cmd23a(padapter, (u8) priority, pattrib->ra); CHKBIT((u8)priority);
rtw_addbareq_cmd23a(padapter, (u8) priority,
pattrib->ra);
} }
} }
} }
...@@ -2394,7 +2479,8 @@ inline u8 rtw_to_roaming(struct rtw_adapter *adapter) ...@@ -2394,7 +2479,8 @@ inline u8 rtw_to_roaming(struct rtw_adapter *adapter)
return adapter->mlmepriv.to_roaming; return adapter->mlmepriv.to_roaming;
} }
void rtw23a_roaming(struct rtw_adapter *padapter, struct wlan_network *tgt_network) void rtw23a_roaming(struct rtw_adapter *padapter,
struct wlan_network *tgt_network)
{ {
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
...@@ -2402,13 +2488,14 @@ void rtw23a_roaming(struct rtw_adapter *padapter, struct wlan_network *tgt_netwo ...@@ -2402,13 +2488,14 @@ void rtw23a_roaming(struct rtw_adapter *padapter, struct wlan_network *tgt_netwo
_rtw23a_roaming(padapter, tgt_network); _rtw23a_roaming(padapter, tgt_network);
spin_unlock_bh(&pmlmepriv->lock); spin_unlock_bh(&pmlmepriv->lock);
} }
void _rtw23a_roaming(struct rtw_adapter *padapter, struct wlan_network *tgt_network) void _rtw23a_roaming(struct rtw_adapter *padapter,
struct wlan_network *tgt_network)
{ {
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_network *pnetwork; struct wlan_network *pnetwork;
int do_join_r; int do_join_r;
if (tgt_network != NULL) if (tgt_network)
pnetwork = tgt_network; pnetwork = tgt_network;
else else
pnetwork = &pmlmepriv->cur_network; pnetwork = &pmlmepriv->cur_network;
...@@ -2423,17 +2510,21 @@ void _rtw23a_roaming(struct rtw_adapter *padapter, struct wlan_network *tgt_netw ...@@ -2423,17 +2510,21 @@ void _rtw23a_roaming(struct rtw_adapter *padapter, struct wlan_network *tgt_netw
pmlmepriv->assoc_by_bssid = false; pmlmepriv->assoc_by_bssid = false;
while(1) { while (1) {
if (_SUCCESS == (do_join_r = rtw_do_join23a(padapter))) { do_join_r = rtw_do_join23a(padapter);
if (do_join_r == _SUCCESS)
break; break;
} else { else {
DBG_8723A("roaming do_join return %d\n", do_join_r); DBG_8723A("roaming do_join return %d\n",
do_join_r);
pmlmepriv->to_roaming--; pmlmepriv->to_roaming--;
if (0 < rtw_to_roaming(padapter)) { if (0 < rtw_to_roaming(padapter))
continue; continue;
} else { else {
DBG_8723A("%s(%d) -to roaming fail, indicate_disconnect\n", __func__, __LINE__); DBG_8723A("%s(%d) -to roaming fail, "
"indicate_disconnect\n",
__func__, __LINE__);
rtw_indicate_disconnect23a(padapter); rtw_indicate_disconnect23a(padapter);
break; break;
} }
......
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