diff options
Diffstat (limited to 'drivers/staging/rtl8723bs/core/rtw_mlme.c')
-rw-r--r-- | drivers/staging/rtl8723bs/core/rtw_mlme.c | 70 |
1 files changed, 25 insertions, 45 deletions
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index 9202223ebc0c..6498fd17e1d3 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -24,7 +24,7 @@ int rtw_init_mlme_priv(struct adapter *padapter) pmlmepriv->fw_state = WIFI_STATION_STATE; /* Must sync with rtw_wdev_alloc() */ /* wdev->iftype = NL80211_IFTYPE_STATION */ pmlmepriv->cur_network.network.infrastructure_mode = Ndis802_11AutoUnknown; - pmlmepriv->scan_mode = SCAN_ACTIVE;/* 1: active, 0: pasive. Maybe someday we should rename this varable to "active_mode" (Jeff) */ + pmlmepriv->scan_mode = SCAN_ACTIVE;/* 1: active, 0: passive. Maybe someday we should rename this varable to "active_mode" (Jeff) */ spin_lock_init(&pmlmepriv->lock); INIT_LIST_HEAD(&pmlmepriv->free_bss_pool.queue); @@ -751,7 +751,9 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) } if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) { + spin_unlock_bh(&pmlmepriv->lock); del_timer_sync(&pmlmepriv->scan_to_timer); + spin_lock_bh(&pmlmepriv->lock); _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); } @@ -792,7 +794,7 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) set_fwstate(pmlmepriv, _FW_UNDER_LINKING); pmlmepriv->to_join = false; s_ret = rtw_select_and_join_from_scanned_queue(pmlmepriv); - if (_SUCCESS == s_ret) { + if (s_ret == _SUCCESS) { _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT); } else if (s_ret == 2) {/* there is no need to wait for join */ _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); @@ -1238,8 +1240,10 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf) spin_unlock_bh(&pmlmepriv->scanned_queue.lock); + spin_unlock_bh(&pmlmepriv->lock); /* s5. Cancel assoc_timer */ del_timer_sync(&pmlmepriv->assoc_timer); + spin_lock_bh(&pmlmepriv->lock); } else { spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); } @@ -1545,7 +1549,7 @@ void _rtw_join_timeout_handler(struct timer_list *t) if (adapter->bDriverStopped || adapter->bSurpriseRemoved) return; - spin_lock_bh(&pmlmepriv->lock); + spin_lock_irq(&pmlmepriv->lock); if (rtw_to_roam(adapter) > 0) { /* join timeout caused by roaming */ while (1) { @@ -1554,7 +1558,7 @@ void _rtw_join_timeout_handler(struct timer_list *t) int do_join_r; do_join_r = rtw_do_join(adapter); - if (_SUCCESS != do_join_r) { + if (do_join_r != _SUCCESS) { continue; } break; @@ -1573,7 +1577,7 @@ void _rtw_join_timeout_handler(struct timer_list *t) } - spin_unlock_bh(&pmlmepriv->lock); + spin_unlock_irq(&pmlmepriv->lock); } /* @@ -1586,11 +1590,11 @@ void rtw_scan_timeout_handler(struct timer_list *t) mlmepriv.scan_to_timer); struct mlme_priv *pmlmepriv = &adapter->mlmepriv; - spin_lock_bh(&pmlmepriv->lock); + spin_lock_irq(&pmlmepriv->lock); _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); - spin_unlock_bh(&pmlmepriv->lock); + spin_unlock_irq(&pmlmepriv->lock); rtw_indicate_scan_done(adapter, true); } @@ -2036,28 +2040,14 @@ int rtw_restruct_wmm_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_ static int SecIsInPMKIDList(struct adapter *Adapter, u8 *bssid) { - struct security_priv *psecuritypriv = &Adapter->securitypriv; - int i = 0; - - do { - if ((psecuritypriv->PMKIDList[i].bUsed) && - (!memcmp(psecuritypriv->PMKIDList[i].Bssid, bssid, ETH_ALEN))) { - break; - } else { - i++; - /* continue; */ - } - - } while (i < NUM_PMKID_CACHE); - - if (i == NUM_PMKID_CACHE) { - i = -1;/* Could not find. */ - } else { - /* There is one Pre-Authentication Key for the specific BSSID. */ - } - - return i; + struct security_priv *p = &Adapter->securitypriv; + int i; + for (i = 0; i < NUM_PMKID_CACHE; i++) + if ((p->PMKIDList[i].bUsed) && + (!memcmp(p->PMKIDList[i].Bssid, bssid, ETH_ALEN))) + return i; + return -1; } /* */ @@ -2531,7 +2521,7 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr { u8 issued; int priority; - struct sta_info *psta = NULL; + struct sta_info *psta; struct ht_priv *phtpriv; struct pkt_attrib *pattrib = &pxmitframe->attrib; s32 bmcst = IS_MCAST(pattrib->ra); @@ -2558,7 +2548,7 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr issued = (phtpriv->agg_enable_bitmap>>priority)&0x1; issued |= (phtpriv->candidate_tid_bitmap>>priority)&0x1; - if (0 == issued) { + if (issued == 0) { psta->htpriv.candidate_tid_bitmap |= BIT((u8)priority); rtw_addbareq_cmd(padapter, (u8) priority, pattrib->ra); } @@ -2608,30 +2598,20 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_network *cur_network = &pmlmepriv->cur_network; - int do_join_r; - if (0 < rtw_to_roam(padapter)) { + if (rtw_to_roam(padapter) > 0) { memcpy(&pmlmepriv->assoc_ssid, &cur_network->network.ssid, sizeof(struct ndis_802_11_ssid)); pmlmepriv->assoc_by_bssid = false; - while (1) { - do_join_r = rtw_do_join(padapter); - if (_SUCCESS == do_join_r) { + while (rtw_do_join(padapter) != _SUCCESS) { + rtw_dec_to_roam(padapter); + if (rtw_to_roam(padapter) <= 0) { + rtw_indicate_disconnect(padapter); break; - } else { - rtw_dec_to_roam(padapter); - - if (rtw_to_roam(padapter) > 0) { - continue; - } else { - rtw_indicate_disconnect(padapter); - break; - } } } } - } signed int rtw_linked_check(struct adapter *padapter) |