rtl8188eu: Make updates from rtl8188EUS_rtl8189ES_linux_v4.1.8_9499.20131104

This patch is step 1 of many. This driver has much better sensitivity than
the previous version.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2014-11-19 14:32:12 -06:00
parent 18c80911a2
commit c8a380cd16
5 changed files with 58 additions and 33 deletions

View file

@ -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; unsigned long irqL;
u32 init_rate = 0; u32 init_rate = 0;
@ -602,7 +602,7 @@ static void update_bmc_sta(struct adapter *padapter)
psta->raid = raid; psta->raid = raid;
psta->init_rate = init_rate; 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); _enter_critical_bh(&psta->lock, &irqL);
psta->state = _FW_LINKED; psta->state = _FW_LINKED;

View file

@ -36,6 +36,18 @@
extern unsigned char MCS_rate_2R[16]; extern unsigned char MCS_rate_2R[16];
extern unsigned char MCS_rate_1R[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 _rtw_init_mlme_priv (struct adapter *padapter)
{ {
int i; int i;
@ -564,8 +576,11 @@ _func_enter_;
// rssi_final = dst->Rssi; // 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)); memcpy((u8 *)dst, (u8 *)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;
@ -672,9 +687,12 @@ _func_enter_;
pnetwork->last_scanned = rtw_get_current_time(); pnetwork->last_scanned = rtw_get_current_time();
/* target.Reserved[0]== 1, means that scanned network is a bcn frame. */ /* 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_ie = false;
update_network(&(pnetwork->network), target, adapter, update_ie); update_network(&(pnetwork->network), target, adapter, update_ie);
} }
@ -1309,6 +1327,7 @@ _func_enter_;
/* s4. indicate connect */ /* s4. indicate connect */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) {
pmlmepriv->cur_network_scanned = ptarget_wlan;
rtw_indicate_connect(adapter); rtw_indicate_connect(adapter);
} else { } else {
/* adhoc mode will rtw_indicate_connect when rtw_stassoc_event_callback */ /* 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 */ /* 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; u8 macid;
if (psta == NULL) 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); macid = search_max_mac_id(adapter);
rtw_hal_set_hwreg(adapter, HW_VAR_TX_RPT_MAX_MACID, (u8 *)&macid); rtw_hal_set_hwreg(adapter, HW_VAR_TX_RPT_MAX_MACID, (u8 *)&macid);
media_status = (psta->mac_id<<8)|1; /* MACID|OPMODE:1 connect */ /* MACID|OPMODE:1 connect */
rtw_hal_set_hwreg(adapter, HW_VAR_H2C_MEDIA_STATUS_RPT, (u8 *)&media_status); 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) void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf)
@ -1421,10 +1443,8 @@ _func_enter_;
#if defined (CONFIG_88EU_AP_MODE) #if defined (CONFIG_88EU_AP_MODE)
if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
psta = rtw_get_stainfo(&adapter->stapriv, pstassoc->macaddr); psta = rtw_get_stainfo(&adapter->stapriv, pstassoc->macaddr);
if (psta) { if (psta)
ap_sta_info_defer_update(adapter, psta); rtw_indicate_sta_assoc_event(adapter, psta);
rtw_stassoc_hw_rpt(adapter, psta);
}
goto exit; goto exit;
} }
#endif #endif
@ -1446,7 +1466,7 @@ _func_enter_;
DBG_88E("%s\n", __func__); DBG_88E("%s\n", __func__);
/* for ad-hoc mode */ /* for ad-hoc mode */
rtw_hal_set_odm_var(adapter, HAL_ODM_STA_INFO, psta, true); 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) if (adapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)
psta->dot118021XPrivacy = adapter->securitypriv.dot11PrivacyAlgrthm; psta->dot118021XPrivacy = adapter->securitypriv.dot11PrivacyAlgrthm;
psta->ieee8021x_blocked = false; psta->ieee8021x_blocked = false;
@ -1456,6 +1476,7 @@ _func_enter_;
if (adapter->stapriv.asoc_sta_count == 2) { if (adapter->stapriv.asoc_sta_count == 2) {
_enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql);
ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, cur_network->network.MacAddress); ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, cur_network->network.MacAddress);
pmlmepriv->cur_network_scanned = ptarget_wlan;
if (ptarget_wlan) if (ptarget_wlan)
ptarget_wlan->fixed = true; ptarget_wlan->fixed = true;
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql); _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irql);
@ -1507,13 +1528,16 @@ _func_enter_;
_enter_critical_bh(&pmlmepriv->lock, &irql2); _enter_critical_bh(&pmlmepriv->lock, &irql2);
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
if (pmlmepriv->to_roaming > 0) if(adapter->registrypriv.wifi_spec == 1)
pmlmepriv->to_roaming--; /* this stadel_event is caused by roaming, decrease to_roaming */ rtw_set_roaming(adapter, 0); /* don't roam */
else if (pmlmepriv->to_roaming == 0) else if (rtw_to_roaming(adapter) > 0)
pmlmepriv->to_roaming = adapter->registrypriv.max_roaming_times; 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) 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); rtw_free_uc_swdec_pending_queue(adapter);
@ -1597,10 +1621,10 @@ _func_enter_;
_enter_critical_bh(&pmlmepriv->lock, &irql); _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) { while (1) {
pmlmepriv->to_roaming--; 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__); DBG_88E("%s try another roaming\n", __func__);
do_join_r = rtw_do_join(adapter); do_join_r = rtw_do_join(adapter);
if (_SUCCESS != do_join_r) { 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) if (rtw_is_desired_network(adapter, competitor) == false)
goto exit; 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 || if (rtw_get_passing_time_ms((u32)competitor->last_scanned) >= RTW_SCAN_RESULT_EXPIRE ||
is_same_ess(&competitor->network, &pmlmepriv->cur_network.network) == false) is_same_ess(&competitor->network, &pmlmepriv->cur_network.network) == false)
goto exit; goto exit;
@ -1750,7 +1774,7 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv
(*candidate)->network.Ssid.Ssid, (*candidate)->network.Ssid.Ssid,
(*candidate)->network.MacAddress, (*candidate)->network.MacAddress,
(int)(*candidate)->network.Rssi); (int)(*candidate)->network.Rssi);
DBG_88E("[to_roaming:%u]\n", pmlmepriv->to_roaming); DBG_88E("[to_roaming:%u]\n",rtw_to_roaming(adapter));
} }
exit: exit:
@ -2418,7 +2442,7 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network)
else else
pnetwork = &pmlmepriv->cur_network; pnetwork = &pmlmepriv->cur_network;
if (0 < pmlmepriv->to_roaming) { if (0 < rtw_to_roaming(padapter)) {
DBG_88E("roaming from %s(%pM length:%d\n", DBG_88E("roaming from %s(%pM length:%d\n",
pnetwork->network.Ssid.Ssid, pnetwork->network.MacAddress, pnetwork->network.Ssid.Ssid, pnetwork->network.MacAddress,
pnetwork->network.Ssid.SsidLength); pnetwork->network.Ssid.SsidLength);

View file

@ -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); memcpy(&le32_tmp, rtw_get_beacon_interval_from_ie(bssid->IEs), 2);
bssid->Configuration.BeaconPeriod = le32_to_cpu(le32_tmp); bssid->Configuration.BeaconPeriod = le32_to_cpu(le32_tmp);
@ -6749,11 +6741,14 @@ void start_create_ibss(struct adapter *padapter)
report_join_res(padapter, 1); report_join_res(padapter, 1);
pmlmeinfo->state |= WIFI_FW_ASSOC_SUCCESS; pmlmeinfo->state |= WIFI_FW_ASSOC_SUCCESS;
rtw_indicate_connect(padapter);
} }
} else { } else {
DBG_88E("start_create_ibss, invalid cap:%x\n", caps); DBG_88E("start_create_ibss, invalid cap:%x\n", caps);
return; return;
} }
/* update bc/mc sta_info */
update_bmc_sta(padapter);
} }
void start_clnt_join(struct adapter *padapter) void start_clnt_join(struct adapter *padapter)

View file

@ -43,6 +43,7 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta,
void expire_timeout_chk(struct adapter *padapter); void expire_timeout_chk(struct adapter *padapter);
void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta); void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta);
int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len); 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); void rtw_set_macaddr_acl(struct adapter *padapter, int mode);
int rtw_acl_add_sta(struct adapter *padapter, u8 *addr); int rtw_acl_add_sta(struct adapter *padapter, u8 *addr);
int rtw_acl_remove_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); void stop_ap_mode(struct adapter *padapter);
#endif #endif
#endif /* end of CONFIG_88EU_AP_MODE */ #endif /* end of CONFIG_88EU_AP_MODE */
void update_bmc_sta(struct adapter *padapter);
#endif #endif

View file

@ -349,6 +349,7 @@ struct mlme_priv {
u8 assoc_bssid[6]; u8 assoc_bssid[6];
struct wlan_network cur_network; struct wlan_network cur_network;
struct wlan_network *cur_network_scanned;
u32 scan_interval; 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_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_ */ #endif /* __RTL871X_MLME_H_ */