diff --git a/core/rtw_ap.c b/core/rtw_ap.c index 2f548eb..cda5d41 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -533,7 +533,7 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) } } -static void update_bmc_sta(struct adapter *padapter) +void update_bmc_sta(struct adapter *padapter) { unsigned long irqL; u32 init_rate = 0; @@ -602,7 +602,7 @@ static void update_bmc_sta(struct adapter *padapter) psta->raid = raid; psta->init_rate = init_rate; - rtw_stassoc_hw_rpt(padapter, psta); + rtw_sta_media_status_rpt(padapter, psta, 1); _enter_critical_bh(&psta->lock, &irqL); psta->state = _FW_LINKED; diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index 27369e4..c07ec1d 100644 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -36,6 +36,18 @@ extern unsigned char MCS_rate_2R[16]; extern unsigned char MCS_rate_1R[16]; +void rtw_set_roaming(struct adapter *adapter, u8 to_roaming) +{ + if (to_roaming == 0) + adapter->mlmepriv.to_join = false; + adapter->mlmepriv.to_roaming = to_roaming; +} + +u8 rtw_to_roaming(struct adapter *adapter) +{ + return adapter->mlmepriv.to_roaming; +} + int _rtw_init_mlme_priv (struct adapter *padapter) { int i; @@ -564,8 +576,11 @@ _func_enter_; // rssi_final = dst->Rssi; // } } - if (update_ie) + if (update_ie) { + dst->Reserved[0] = src->Reserved[0]; + dst->Reserved[1] = src->Reserved[1]; memcpy((u8 *)dst, (u8 *)src, get_wlan_bssid_ex_sz(src)); + } dst->PhyInfo.SignalStrength = ss_final; dst->PhyInfo.SignalQuality = sq_final; dst->Rssi = rssi_final; @@ -672,9 +687,12 @@ _func_enter_; pnetwork->last_scanned = rtw_get_current_time(); /* target.Reserved[0]== 1, means that scanned network is a bcn frame. */ - if ((pnetwork->network.IELength > target->IELength) && (target->Reserved[0] == 1)) + /* probe resp(3) > beacon(1) > probe req(2) */ + if ((target->Reserved[0] != 2) && + (target->Reserved[0] >= pnetwork->network.Reserved[0])) + update_ie = true; + else update_ie = false; - update_network(&(pnetwork->network), target, adapter, update_ie); } @@ -1309,6 +1327,7 @@ _func_enter_; /* s4. indicate connect */ if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { + pmlmepriv->cur_network_scanned = ptarget_wlan; rtw_indicate_connect(adapter); } else { /* adhoc mode will rtw_indicate_connect when rtw_stassoc_event_callback */ @@ -1390,9 +1409,10 @@ static u8 search_max_mac_id(struct adapter *padapter) } /* FOR AP , AD-HOC mode */ -void rtw_stassoc_hw_rpt(struct adapter *adapter, struct sta_info *psta) +void rtw_sta_media_status_rpt(struct adapter *adapter,struct sta_info *psta, + u32 mstatus) { - u16 media_status; + u16 media_status_rpt; u8 macid; if (psta == NULL) @@ -1400,8 +1420,10 @@ void rtw_stassoc_hw_rpt(struct adapter *adapter, struct sta_info *psta) macid = search_max_mac_id(adapter); rtw_hal_set_hwreg(adapter, HW_VAR_TX_RPT_MAX_MACID, (u8 *)&macid); - media_status = (psta->mac_id<<8)|1; /* MACID|OPMODE:1 connect */ - rtw_hal_set_hwreg(adapter, HW_VAR_H2C_MEDIA_STATUS_RPT, (u8 *)&media_status); + /* MACID|OPMODE:1 connect */ + media_status_rpt = (u16)((psta->mac_id<<8) | mstatus); + rtw_hal_set_hwreg(adapter,HW_VAR_H2C_MEDIA_STATUS_RPT, + (u8 *)&media_status_rpt); } void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf) @@ -1421,10 +1443,8 @@ _func_enter_; #if defined (CONFIG_88EU_AP_MODE) if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { psta = rtw_get_stainfo(&adapter->stapriv, pstassoc->macaddr); - if (psta) { - ap_sta_info_defer_update(adapter, psta); - rtw_stassoc_hw_rpt(adapter, psta); - } + if (psta) + rtw_indicate_sta_assoc_event(adapter, psta); goto exit; } #endif @@ -1446,7 +1466,7 @@ _func_enter_; DBG_88E("%s\n", __func__); /* for ad-hoc mode */ rtw_hal_set_odm_var(adapter, HAL_ODM_STA_INFO, psta, true); - rtw_stassoc_hw_rpt(adapter, psta); + rtw_sta_media_status_rpt(adapter, psta, 1); if (adapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) psta->dot118021XPrivacy = adapter->securitypriv.dot11PrivacyAlgrthm; psta->ieee8021x_blocked = false; @@ -1456,6 +1476,7 @@ _func_enter_; if (adapter->stapriv.asoc_sta_count == 2) { _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, cur_network->network.MacAddress); + pmlmepriv->cur_network_scanned = ptarget_wlan; if (ptarget_wlan) ptarget_wlan->fixed = true; _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); @@ -1507,13 +1528,16 @@ _func_enter_; _enter_critical_bh(&pmlmepriv->lock, &irql2); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { - if (pmlmepriv->to_roaming > 0) - pmlmepriv->to_roaming--; /* this stadel_event is caused by roaming, decrease to_roaming */ - else if (pmlmepriv->to_roaming == 0) - pmlmepriv->to_roaming = adapter->registrypriv.max_roaming_times; + if(adapter->registrypriv.wifi_spec == 1) + rtw_set_roaming(adapter, 0); /* don't roam */ + else if (rtw_to_roaming(adapter) > 0) + pmlmepriv->to_roaming--; /* this stadel_event is caused by roaming, decrease to_roaming */ + else if (rtw_to_roaming(adapter) == 0) + rtw_set_roaming(adapter, + adapter->registrypriv.max_roaming_times); if (*((unsigned short *)(pstadel->rsvd)) != WLAN_REASON_EXPIRATION_CHK) - pmlmepriv->to_roaming = 0; /* don't roam */ + rtw_set_roaming(adapter, 0); /* don't roam */ rtw_free_uc_swdec_pending_queue(adapter); @@ -1597,10 +1621,10 @@ _func_enter_; _enter_critical_bh(&pmlmepriv->lock, &irql); - if (pmlmepriv->to_roaming > 0) { /* join timeout caused by roaming */ + if (rtw_to_roaming(adapter) > 0) { /* join timeout caused by roaming */ while (1) { pmlmepriv->to_roaming--; - if (pmlmepriv->to_roaming != 0) { /* try another , */ + if (rtw_to_roaming(adapter) != 0) { /* try another */ DBG_88E("%s try another roaming\n", __func__); do_join_r = rtw_do_join(adapter); if (_SUCCESS != do_join_r) { @@ -1733,7 +1757,7 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv if (rtw_is_desired_network(adapter, competitor) == false) goto exit; - if (pmlmepriv->to_roaming) { + if(rtw_to_roaming(adapter) > 0) { if (rtw_get_passing_time_ms((u32)competitor->last_scanned) >= RTW_SCAN_RESULT_EXPIRE || is_same_ess(&competitor->network, &pmlmepriv->cur_network.network) == false) goto exit; @@ -1750,7 +1774,7 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv (*candidate)->network.Ssid.Ssid, (*candidate)->network.MacAddress, (int)(*candidate)->network.Rssi); - DBG_88E("[to_roaming:%u]\n", pmlmepriv->to_roaming); + DBG_88E("[to_roaming:%u]\n",rtw_to_roaming(adapter)); } exit: @@ -2418,7 +2442,7 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network) else pnetwork = &pmlmepriv->cur_network; - if (0 < pmlmepriv->to_roaming) { + if (0 < rtw_to_roaming(padapter)) { DBG_88E("roaming from %s(%pM length:%d\n", pnetwork->network.Ssid.Ssid, pnetwork->network.MacAddress, pnetwork->network.Ssid.SsidLength); diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index 7ab5ff0..a807e69 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -6656,14 +6656,6 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str } } - if (subtype == WIFI_PROBEREQ) { - /* FIXME */ - bssid->InfrastructureMode = Ndis802_11Infrastructure; - memcpy(bssid->MacAddress, GetAddr2Ptr(pframe), ETH_ALEN); - bssid->Privacy = 1; - return _SUCCESS; - } - memcpy(&le32_tmp, rtw_get_beacon_interval_from_ie(bssid->IEs), 2); bssid->Configuration.BeaconPeriod = le32_to_cpu(le32_tmp); @@ -6749,11 +6741,14 @@ void start_create_ibss(struct adapter *padapter) report_join_res(padapter, 1); pmlmeinfo->state |= WIFI_FW_ASSOC_SUCCESS; + rtw_indicate_connect(padapter); } } else { DBG_88E("start_create_ibss, invalid cap:%x\n", caps); return; } + /* update bc/mc sta_info */ + update_bmc_sta(padapter); } void start_clnt_join(struct adapter *padapter) diff --git a/include/rtw_ap.h b/include/rtw_ap.h index 9233401..bf3c9fb 100644 --- a/include/rtw_ap.h +++ b/include/rtw_ap.h @@ -43,6 +43,7 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, void expire_timeout_chk(struct adapter *padapter); void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta); int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len); +void rtw_ap_restore_network(struct adapter *padapter); void rtw_set_macaddr_acl(struct adapter *padapter, int mode); int rtw_acl_add_sta(struct adapter *padapter, u8 *addr); int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr); @@ -61,5 +62,6 @@ void start_ap_mode(struct adapter *padapter); void stop_ap_mode(struct adapter *padapter); #endif #endif /* end of CONFIG_88EU_AP_MODE */ +void update_bmc_sta(struct adapter *padapter); #endif diff --git a/include/rtw_mlme.h b/include/rtw_mlme.h index 4a7143e..b7c3b4d 100644 --- a/include/rtw_mlme.h +++ b/include/rtw_mlme.h @@ -349,6 +349,7 @@ struct mlme_priv { u8 assoc_bssid[6]; struct wlan_network cur_network; + struct wlan_network *cur_network_scanned; u32 scan_interval; @@ -649,7 +650,10 @@ int is_same_network(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst); void rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network); void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network); +void rtw_set_roaming(struct adapter *adapter, u8 to_roaming); +u8 rtw_to_roaming(struct adapter *adapter); -void rtw_stassoc_hw_rpt(struct adapter *adapter,struct sta_info *psta); +void rtw_sta_media_status_rpt(struct adapter *adapter, struct sta_info *psta, + u32 mstatus); #endif /* __RTL871X_MLME_H_ */