1
0
mirror of https://github.com/morrownr/8821cu-20210916.git synced 2024-12-26 08:08:37 +00:00

Bugfix: fix active roaming capability.

According to the makefile, it should be possible to keep roaming active:
Set #bit2 of CONFIG_ROAMING_FLAG, like this:
CONFIG_ROAMING_FLAG = 0x7

But, when trying out this option, it appears that active roaming is not
working as expected. It only changes if the old AP is expired.

This patch fixes this behaviour, but does NOT set BIT2.

Reason for failure:
The linked_status_chk function runs every 2 seconds.
There is an internal roaming flag (need_to_roam) that is set when the
current signal is below a threshold AND if it hasn't been set during a
predefined time. Setting the flag also updates the last_time_roaming timestamp.
If either of these fails, then the flag (need_to_roam) is cleared.

This causes a race condition:
1) Threshold is too low + long last_time_roaming
   -> flag is set + last_time_roaming is updated.
2) Chipset starts scanning / surveying (this takes > 3 sec)
3) Conditions are rechecked: threshold is still to low, but last_time_roaming
is now too recent -> flag is cleared.
4) Survey finishes, but since the flag is cleared, roaming will be ignored.

The solution in this patch:
Once the flag (need_to_roam) has been set, it should only be cleared if the
signal strength is above the threshold. It should not be cleared based on the
last_time_roaming timestamp.
This commit is contained in:
Theo Debrouwere 2023-04-24 13:26:32 +02:00
parent 963666429f
commit 154cdb82e3

View File

@ -12799,14 +12799,15 @@ void linked_status_chk(_adapter *padapter, u8 from_timer)
#elif defined(CONFIG_LAYER2_ROAMING)
if (rtw_chk_roam_flags(padapter, RTW_ROAM_ACTIVE)) {
RTW_INFO("signal_strength_data.avg_val = %d\n", precvpriv->signal_strength_data.avg_val);
if ((precvpriv->signal_strength_data.avg_val < pmlmepriv->roam_rssi_threshold)
&& (rtw_get_passing_time_ms(pmlmepriv->last_roaming) >= pmlmepriv->roam_scan_int*2000)) {
if (precvpriv->signal_strength_data.avg_val < pmlmepriv->roam_rssi_threshold) {
if (rtw_get_passing_time_ms(pmlmepriv->last_roaming) >= pmlmepriv->roam_scan_int*2000) {
#ifdef CONFIG_RTW_80211K
rtw_roam_nb_discover(padapter, _FALSE);
rtw_roam_nb_discover(padapter, _FALSE);
#endif
pmlmepriv->need_to_roam = _TRUE;
rtw_drv_scan_by_self(padapter, RTW_AUTO_SCAN_REASON_ROAM);
pmlmepriv->last_roaming = rtw_get_current_time();
pmlmepriv->need_to_roam = _TRUE;
rtw_drv_scan_by_self(padapter, RTW_AUTO_SCAN_REASON_ROAM);
pmlmepriv->last_roaming = rtw_get_current_time();
}
} else
pmlmepriv->need_to_roam = _FALSE;
}