[issue #7] roaming in mesh networks

Further comment:
We suspect that the issue may happen because wpa_supplicant does not receive updates regarding the rssi level of the connected AP from the driver. So if we connected when the rssi level was low (close to AP) and then went away from this AP, wpa_supplicant still thinks that the rssi level is good enough and does not roam.

Now this functionality does not work at all. The device always stays connected to the current AP (BSSID) until the connection loss due to very bad rssi level.

Query:
How can we enable fast roaming from the driver?

Regards,
Parth Y Shah

Any update @loic?

Regards,
Parth Y Shah

Well, The RSSI is normally updated each time a packet is received, and you can see that the level may change with iw wlan0 link command.

The driver does not support offloaded roaming/background-scan.

One solution might be to enable software roaming via background scan technique. If you’re running Linaro release 20.02, it’s supposed to be automatically configured via NetworkManager, which, by default, will trigger background scan every 30 seconds if RSSI is below -70dBm (or -80dBm for oldest versions, so in your case background scan threshold is never reached), if you want to change the threshold or interval values you’ll need to recompile NM.

If you’re using a raw wpa_supplicant setup (without NetworkManager frontend), this can be configured with the bgscan variable:

ctrl_interface=/var/run/wpa_supplicant
update_config=1

network={
        ssid="MyNetwork"
        scan_ssid=1
        bgscan="simple:30:-70:3600"
        psk="mypassword"
        priority=9
}

Which means that background scan will be performed, every hour if RSSI is above -70 and every 30s if RSSI is lower than -70.

Hi @Loic,

Just to clarify: In log that Parth shared you can see that active scan was performed but RSSI in wpa_cli scan_results still show RSSI that was on connecting to network. At the same time iwconfig update Signal level as expected.

So, the question is: If even after active scan wpa_supplicant still show wrong RSSI level (and so don’t connect to another AP as signal good enough) - won’t it be the same on background scans?..

Regards,
Natalia

That’s not something I observe with db410c/20.07 release. Is this issue related to 5Ghz AP only? is it reproducible with latest release?

Is the (connected) AP reported when running iw wlan0 scan

You can also run wpa_supplicant with -dd option to get information about scanned AP

Hi @Loic,
thanks for your answer.
I rechecked - it’s not reproduced on Linaro 20. It’s reproduced on Linaro 18.01 with enabled 5Ghz Wifi (as described here [issue #5] Hidden SSID connection in Linaro - 18.01) . Reproduced for both 2.4 and 5 - data about network that device connected to - is not updated in wpa_cli

Running iw wlan0 scan I see updated signal level, as well as in iwconfig

Tried to run wpa_supplicant with -dd option - don’t see there smth that can help.

Hi @Loic,

If the RSSI value is being updated in the iwconfig and iw wlan0 scan and it is not getting updated in wpa_supplicant, can we upgrade wpa_supplicant’s version?

If the wcn36xx driver is not providing connected AP’s RSSI value to the application, then it should not get updated to iwconfig and iw wlan0 also. But they are getting updated, so the suspect is on wpa_supplicant.

I observed that the version of wpa_supplicant is v2.9 in Linaro-20.02 rootfs whilst it is v2.6 in the Linaro-18.01 rootfs.

Regards,
Parth Y Shah

When running wpa_supplicant with -dd it should print additional debug info,and you should see something like that during background scan:

 bgscan simple: Request a background scan
 wlan0: nl80211: scan request
 wlan0: New scan results available (own=1 ext=0)
 wlan0: Scan results matching the currently selected network
 wlan0: 1: 50:c8:bf:a1:67:92 freq=2462 level=-51 snr=38 est_throughput=65000
 wlan0: 2: 8c:79:ea:02:3b:64 freq=2437 level=-63 snr=26 est_throughput=65000

Showing the discovered BSSIDs with same SSID, if you don’t get that maybe background scan is not working (though it does not explain why RSSI is not updated with manual scanning).

Id low-level scanning is working then yes it could be related to wpa_supplicant, though I don’t see any related issue in the wpa_supplicant log. To confirm that try to build/install the latest wpa_supplicant version, or use backport package (Instructions).

I added bgscan to wpa_supplicant conf (set every 30 sec for any signal strength) but still no bgscans…

Update: sorry, There ARE bgscans, information about other AP getting updated in wpa_cli but info about AP that used - still with no changes.

Hi @Loic

To enable 5GHz scan for WCN3660B, we have done below change in our driver.

--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -652,7 +652,7 @@ static int wcn36xx_hw_scan(struct ieee80211_hw *hw,
 
        mutex_unlock(&wcn->scan_lock);
 
-       if (!get_feat_caps(wcn->fw_feat_caps, SCAN_OFFLOAD)) {
+       if (get_feat_caps(wcn->fw_feat_caps, SCAN_OFFLOAD)) {
                /* legacy manual/sw scan */
                schedule_work(&wcn->scan_work);
                return 0;

With this change we are facing above issue.

If we revert this change (Which enables HW offload scan), we are able to see that above issue is getting resolved. We have also checked in Linaro-20.02 (5.7 kernel) and found that this issue does not exist there also.

To debug further, I have tried to apply below patch in Linaro-18.01, related to mac80211, but it did not help,
https://git.linaro.org/people/loic.poulain/linux.git/commit/net/mac80211?h=qcomlt-5.7-wifi&id=ecbc12ad6b682680ae26a429225d7c295f7f0e77

Can you please suggest any other mac80211/wcn36xx related change between Linaro-18.01 to Linaro-20.02 that can help us here?

Regards,
Parth Y Shah

please share the output of wpa_supplicant with dd option when issue happens.

Hi @Loic

root@linaro-alip:~# wpa_supplicant -dd -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
wpa_supplicant v2.6
random: Trying to read entropy from /dev/random
Successfully initialized wpa_supplicant
Initializing interface 'wlan0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'default' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant/wpa_supplicant.conf' -> '/etc/wpa_supplicant/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'
ctrl_interface='/run/wpa_supplicant'
update_config=1
Line: 4 - start of a new network block
ssid - hexdump_ascii(len=3):
     53 41 50                                          SAP             
scan_ssid=1 (0x1)
PSK (ASCII passphrase) - hexdump_ascii(len=8): [REMOVED]
PSK (from passphrase) - hexdump(len=32): [REMOVED]
Line: 10 - start of a new network block
ssid - hexdump_ascii(len=12):
     54 50 2d 4c 69 6e 6b 5f 38 41 36 44               TP-Link_8A6D    
scan_ssid=1 (0x1)
PSK (ASCII passphrase) - hexdump_ascii(len=8): [REMOVED]
PSK (from passphrase) - hexdump(len=32): [REMOVED]
Priority group 0
   id=0 ssid='SAP'
   id=1 ssid='TP-Link_8A6D'
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supports Probe Response offload in AP mode
nl80211: Using driver-based off-channel TX
nl80211: Driver-advertised extended capabilities (default) - hexdump(len=8): 00 00 00 00 00 00 00 40
nl80211: Driver-advertised extended capabilities mask (default) - hexdump(len=8): 00 00 00 00 00 00 00 40
nl80211: interface wlan0 in phy phy0
nl80211: Set mode ifindex 2 iftype 2 (STATION)
nl80211: Subscribe to mgmt frames with non-AP handle 0xaaab167c20f0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=040a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=040b
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=040c
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=040d
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=090a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=090b
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=090c
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=090d
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=0409506f9a09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=7f506f9a09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=0801
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=06
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=0a07
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=0a11
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=1101
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=1102
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=0505
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xaaab167c20f0 match=0500
rfkill: initial event: idx=1 type=1 op=0 soft=0 hard=0
netlink: Operstate: ifindex=2 linkmode=1 (userspace-control), operstate=5 (IF_OPER_DORMANT)
Add interface wlan0 to a new radio phy0
nl80211: Regulatory information - country=00
nl80211: 2402-2472 @ 40 MHz 20 mBm
nl80211: 2457-2482 @ 20 MHz 20 mBm (no IR)
nl80211: 2474-2494 @ 20 MHz 20 mBm (no OFDM) (no IR)
nl80211: 5170-5250 @ 80 MHz 20 mBm (no IR)
nl80211: 5250-5330 @ 80 MHz 20 mBm (DFS) (no IR)
nl80211: 5490-5730 @ 160 MHz 20 mBm (DFS) (no IR)
nl80211: 5735-5835 @ 80 MHz 20 mBm (no IR)
nl80211: 57240-63720 @ 2160 MHz 0 mBm
nl80211: Added 802.11b mode based on 802.11g information
wlan0: Own MAC address: 02:00:8a:09:62:13
wpa_driver_nl80211_set_key: ifindex=2 (wlan0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=2 (wlan0) alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=2 (wlan0) alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=2 (wlan0) alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=2 (wlan0) alg=0 addr=(nil) key_idx=4 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=2 (wlan0) alg=0 addr=(nil) key_idx=5 set_tx=0 seq_len=0 key_len=0
wlan0: RSN: flushing PMKID list in the driver
nl80211: Flush PMKIDs
wlan0: Setting scan request: 0.100000 sec
TDLS: TDLS operation not supported by driver
TDLS: Driver uses internal link setup
TDLS: Driver does not support TDLS channel switching
wlan0: WPS: UUID based on MAC address: bc7da6eb-c600-5d99-b36f-12568355f79d
ENGINE: Loading dynamic engine
ENGINE: Loading dynamic engine
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
nl80211: Skip set_supp_port(unauthorized) while not associated
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
Using existing control interface directory.
ctrl_iface bind(PF_UNIX) failed: Address already in use
ctrl_iface exists, but does not allow connections - assuming it was leftover from forced program termination
Successfully replaced leftover ctrl_iface socket '/run/wpa_supplicant/wlan0'
wlan0: Added interface wlan0
wlan0: State: DISCONNECTED -> DISCONNECTED
nl80211: Set wlan0 operstate 0->0 (DORMANT)
netlink: Operstate: ifindex=2 linkmode=-1 (no change), operstate=5 (IF_OPER_DORMANT)
Daemonize..
root@linaro-alip:~# [18577.016100] wlan0: deauthenticating from b0:4e:26:0b:8a:6d by local choice (Reason: 2=PREV_AUTH_NOT_VALID)
[18577.110500] wlan0: authenticate with b0:4e:26:0b:8a:6d
[18577.147135] wlan0: send auth to b0:4e:26:0b:8a:6d (try 1/3)
[18577.149597] wlan0: authenticated
[18577.155115] wlan0: associate with b0:4e:26:0b:8a:6d (try 1/3)
[18577.159876] wlan0: RX AssocResp from b0:4e:26:0b:8a:6d (capab=0x431 status=0 aid=1)
[18577.193584] wlan0: associated

This is wpa_supplicant dd output when initializing.

The issue is when we do wpa_cli scan, connected APs RSSI is not getting updated so for that we do not have any wpa_supplicant dd logs.

You can see below like in wpa_cli the value is not getting updated while in iwconfig it does.

root@linaro-alip:~# wpa_cli -iwlan0 scan_results
bssid / frequency / signal level / flags / ssid
84:18:3a:0c:91:ec 5300 -57 [WPA2-PSK+FT/PSK-CCMP][ESS] ei-SecureWiFi
84:18:3a:4c:91:ec 5300 -56 [WPA2-PSK-CCMP][ESS] ei-GuestWiFi
b0:4e:26:0b:8a:6d 2437 -40 [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][WPS][ESS] TP-Link_8A6D

root@linaro-alip:~# iwconfig 
wlan0     IEEE 802.11  ESSID:"TP-Link_8A6D"  
          Mode:Managed  Frequency:2.437 GHz  Access Point: B0:4E:26:0B:8A:6D   
              Bit Rate=1 Mb/s   Tx-Power=20 dBm   
              Retry short limit:7   RTS thr:off   Fragment thr:off
              Encryption key:off
              Power Management:on
              Link Quality=67/70  Signal level=-43 dBm  
              Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
              Tx excessive retries:0  Invalid misc:0   Missed beacon:0

    lo        no wireless extensions.

If background scan enable you should see some output in wpa_supplicant output. if you don’t see anything, then this is a problem in wpa_supplicant.

Note that wpa_cli -iwlan0 scan_results does not trigger a scan but only retrieves the latest scan values.

Yes, @loic we do scan and then use scan_results command.

Not able to see any prints related to bgscan.

Can you please guide us here?

Have you tried the backported version of wpa_supplicant. Normally, if bgscan is specified in the AP config, it should be triggered according the defined timings.

Hi @Loic,

We have not tried the backporting version of wpa_supplicant. As we mentioned, it is working when HW offload scan is enabled and not working when software scan is configured from the driver. So we think that issue is not in the wpa_supplicant.

The point is that I would like to understand if bgscan is actually performed or not by wpa_supplicant. From your input it’s not showed up in the wpa_supplicant debug output, so you have no chance to roam. Check that it at least output something when you perform scan manually with wpa_cli scan.

That’s work on my side with software scan (connected to CISCO):

$ wpa_cli scan_results
Selected interface 'wlan0'
bssid / frequency / signal level / flags / ssid
8c:79:ea:02:3b:64	2437	-52	[WPA2-PSK-CCMP][WPS][ESS]	CISCO
50:7c:bf:a1:67:92	2462	-58	[WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][WPS][ESS]	CISCO_VPN

$ wpa_cli scan && sleep 20 && wpa_cli scan_results
Selected interface 'wlan0'
OK
Selected interface 'wlan0'
bssid / frequency / signal level / flags / ssid
8c:79:ea:02:3b:64	2437	-54	[WPA2-PSK-CCMP][WPS][ESS]	CISCO
50:7c:bf:a1:67:92	2462	-63	[WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][WPS][ESS]	CISCO_VPN

RSSI is correctly updated on my side once the scan has been completed (it takes several seconds). please check on your side.

Thanks @Loic, this you are talking about SW scan in Linaro-20.02. right? For Linaro-20.02 we also do not have any issues with.

yes

ok, please add dd option and share the wpa_supplicant output when performing scan

Hi @loic,

Tried to use dd command for wpa_spplicant (Linaro-18.01) but it is now showing additional output when we do scan and rssi for connected AP TP-Link_8A6D remains same -49.

root@linaro-alip:~# wpa_cli -iwlan0 scan && sleep 20 && wpa_cli -iwlan0 scan_results
OK

bssid / frequency / signal level / flags / ssid
b0:4e:26:0b:8a:6c       5200    -38     [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][WPS][ESS]       TP-Link_8A6C_5G
a4:50:46:be:16:69       5785    -48     [WPA2-PSK-CCMP][ESS]    Tal
8c:3b:ad:ab:87:b1       5785    -59     [WPA2-PSK-CCMP][ESS]
84:18:3a:0c:91:ec       5300    -55     [WPA2-PSK+FT/PSK-CCMP][ESS]     ei-SecureWiFi
84:18:3a:4c:91:ec       5300    -55     [WPA2-PSK-CCMP][ESS]    ei-GuestWiFi
6c:aa:b3:3c:89:ec       5220    -62     [WPA2-PSK+FT/PSK-CCMP][ESS]     ei-SecureWiFi
6c:aa:b3:7c:89:ec       5220    -62     [WPA2-PSK-CCMP][ESS]    ei-GuestWiFi
6c:aa:b3:bc:89:e7       5220    -62     [WPA2-PSK-CCMP][ESS]
b0:4e:26:0b:8a:6d       2437    -49     [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][WPS][ESS]       TP-Link_8A6D