Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does ESP32 support seamless Wi-Fi roaming (IEEE 802.11v , r, k) in the STA mode? (IDFGH-1392) #3671

Open
flyoo opened this issue Jun 21, 2019 · 58 comments

Comments

@flyoo
Copy link

flyoo commented Jun 21, 2019

No description provided.

@github-actions github-actions bot changed the title Does ESP32 support seamless Wi-Fi roaming (IEEE 802.11v , r, k) in the STA mode? Does ESP32 support seamless Wi-Fi roaming (IEEE 802.11v , r, k) in the STA mode? (IDFGH-1392) Jun 21, 2019
@sagb2015
Copy link
Contributor

Currently ESP32 does not support these features. We will keep these requirements in mind, but it is unlikely that they will be available anytime soon. Among the three, we may prioritise 11r though.

@flyoo flyoo closed this as completed Jun 22, 2019
@MoffKalast
Copy link

MoffKalast commented Apr 8, 2020

It's been almost a year, any progress on this front?

@sagb2015
Copy link
Contributor

sagb2015 commented Apr 8, 2020

We have started working on 11r. However, it is still at preliminary stage.

@g8ecj
Copy link

g8ecj commented Jun 22, 2020

Is the 11r going to be available to resellers/packagers such as u-blox?

@AxelLin
Copy link
Contributor

AxelLin commented Dec 16, 2020

@sagb2015

I have noticed that 27101f9 added initial roaming support.
How about 802.11r support?

Also note, the comment of esp_wifi_set_rssi_threshold() says
This API needs to be called every time after WIFI_EVENT_STA_BSS_RSSI_LOW event is received.

But in the example code, it actually calls it when got WIFI_EVENT_STA_CONNECTED?

@kapilkedawat
Copy link
Collaborator

Hi @AxelLin ,

11r support will be added in future.

'This API needs to be called every time after WIFI_EVENT_STA_BSS_RSSI_LOW event is received.'
This comment is to indicate that only one event will come after calling esp_wifi_set_rssi_threshold(), for getting a second event esp_wifi_set_rssi_threshold() needs to be called again.

@policeman0077
Copy link

any updates?

@sagb2015
Copy link
Contributor

Hi @policeman0077, we had to put 11r in the backlog because of other higher priority action items. We will keep you updated when we restart 11r activity. We are targeting 2nd quarter of 2021.

@policeman0077
Copy link

Hi @policeman0077, we had to put 11r in the backlog because of other higher priority action items. We will keep you updated when we restart 11r activity. We are targeting 2nd quarter of 2021.

thank you :)

@AxelLin
Copy link
Contributor

AxelLin commented Feb 18, 2021

Hi @kapilkedawat

After checking the roaming_example.c code, it looks like esp_bss_rssi_low_handler can be a common implementation to me.
Why not provide a common implementation instead of adding the implementation in application (example) code?
Or do you expect people to implement different behavior in esp_bss_rssi_low_handler?

@kapilkedawat
Copy link
Collaborator

Hi @AxelLin ,

esp_bss_rssi_low_handler can indeed be a common implementation, however it shouldn't be part of supplicant. People may want to do different kind of roaming/disconnection(normal AP switch, 11r based roam, 11kv based roam) based on this trigger.

This will only be added in a common implementation if we decide to have a separate roaming component, in that case it will act as one of the triggers to initiate roaming.

Currently, we are delaying these tasks in favor of other high-priority features.

@AxelLin
Copy link
Contributor

AxelLin commented Jul 5, 2021

Hi @AxelLin ,

11r support will be added in future.

'This API needs to be called every time after WIFI_EVENT_STA_BSS_RSSI_LOW event is received.'

Hi @kapilkedawat

If I have CONFIG_WPA_11KV_SUPPORT=y but didn't call esp_wifi_set_rssi_threshold() at all,
will this cuase some bad sid-effect (compare to CONFIG_WPA_11KV_SUPPORT=n)?
i.e. Is it safe to set CONFIG_WPA_11KV_SUPPORT=y but disable the romaing at by not calling esp_wifi_set_rssi_threshold() in application side?
I want to allow user to enable/disable roaming.

@kapilkedawat
Copy link
Collaborator

Hi @AxelLin , Yes it's safe to enable only CONFIG_WPA_11KV_SUPPORT=y and not calling esp_wifi_set_rssi_threshold().

esp_wifi_set_rssi_threshold() allows users to write an algorithm for station-initiated roaming based on RSSI. Only enabling CONFIG_WPA_11KV_SUPPORT will enable the device to support network-initiated roaming which is sufficient in most cases.

@AxelLin
Copy link
Contributor

AxelLin commented Jul 5, 2021

Only enabling CONFIG_WPA_11KV_SUPPORT will enable the device to support network-initiated roaming which is sufficient in most cases.

I don't quite understand this..
Do you mean only enable CONFIG_WPA_11KV_SUPPORT=y will enable the device to support network-initiated roaming?
It seems nothing happen when I test such case, what is the condition to trigger roaming in such case (without calling esp_wifi_set_rssi_threshold)?

@negativekelvin
Copy link
Contributor

what is the condition to trigger roaming in such case

Triggered from AP side

802.11v BSS Transition Management allows an AP to request a station to transition to a specific AP, or suggest a set of preferred AP

@AxelLin
Copy link
Contributor

AxelLin commented Jul 5, 2021

what is the condition to trigger roaming in such case

Triggered from AP side

802.11v BSS Transition Management allows an AP to request a station to transition to a specific AP, or suggest a set of preferred AP

Hi @kapilkedawat
In my test, seems nothing happen if I didn't call esp_wifi_set_rssi_threshold().
However, it works if I call esp_wifi_set_rssi_threshold().

How to debug (just want to make sure roaming is triggered, etc) for the case without calling esp_wifi_set_rssi_threshold()?

@kapilkedawat Does it work for you with the wifi roaming example code if CONFIG_EXAMPLE_WIFI_RSSI_THRESHOLD=0?

BTW,
What is the purpose of CONFIG_WPA_SCAN_CACHE?
The help text does not really tell people the real meaning..
e.g. how much memory will be used if enabled? Any functionality impact if disabled?

But since it's an optional setting, I suppose it can be disabled.
I have CONFIG_WPA_SCAN_CACHE=n set, no idea if it has impact or not.

@kapilkedawat
Copy link
Collaborator

kapilkedawat commented Jul 5, 2021

Hi @AxelLin,

'In my test, seems nothing happen if I didn't call esp_wifi_set_rssi_threshold().'
Please make sure that your AP network support client steering(most of the mesh home routers does support it, you need to check in the router specification).

When 11KV is enabled, client essentially tells the AP that it support 11k and 11v. AP may use those features to steer client to a suitable AP in the network(how AP decides whether it needs to steer the client and on which AP will entirely depend on access point and client has no control over it).

We have verified it TP link Deco routers and some other mesh wifi systems and it works fine.

Enabling CONFIG_WPA_SCAN_CACHE adds the support of table scan capability. AP may request scan table using 11K and therefore the support was added. Max memory impact due to this is around 10KB heap memory(scan table cache size * assuming max beacon/probe size of 1KB). It normally has no impact on roaming since we have seen generally AP request for active scan during the steering but as I explained earlier its entirely depends on AP.

@AxelLin
Copy link
Contributor

AxelLin commented Jul 6, 2021

Hi @kapilkedawat

I don't quite understand the logic in below code block:
https://github.com/espressif/esp-idf/blob/master/examples/wifi/roaming/main/roaming_example.c#L286-#L298

My questions:

  1. So it doesn't need to set any setting in params for esp_wifi_scan_start?
    e.g. WIFI_ALL_CHANNEL_SCAN / WIFI_CONNECT_AP_BY_SIGNAL / pmf_cfg setting are not required?
  2. it calls esp_wifi_scan_get_ap_records but actually never use the ap_records at all
    What is the purpose of such code?

BTW, some of my device hitting OOM while testing.
My esp_alloc_failed_hook_t callback shows the size=1696, caps=0x1800.

@AxelLin
Copy link
Contributor

AxelLin commented Jul 6, 2021

Hi @kapilkedawat

I think there are some problem with CONFIG_WPA_11KV_SUPPORT=y.
I didn't call net_utils_set_wifi_roam_trigger() in my test devices.
So the configuration is simple, my application just enable CONFIG_WPA_11KV_SUPPORT=y
and set below flags in wifi_config.
.rm_enabled =1,
.btm_enabled =1,

I test with TP link Deco (mesh with 4 deco).
After running for a few hours, several esp32 devices hit OOM.
So I think there is memory leak somewhere in the roaming code.

The symptom is the same, the request size=1696, caps=0x1800.
I observe the symptom on both v4.3 and master branch.

@kapilkedawat
Copy link
Collaborator

kapilkedawat commented Jul 6, 2021

Hi @AxelLin,

Can you please provide sniffer capture and wifi + supplicant logs? We will take a look.

@AxelLin
Copy link
Contributor

AxelLin commented Jul 6, 2021

Hi @kapilkedawat
I cannot capture the log at the moment due to work from home.
(I just update my test devices in office but it's difficult to debug remotely).
I think it's easy to reproduce since there is basically not application code involved (you should be able to reproduce it).

@AxelLin
Copy link
Contributor

AxelLin commented Jul 7, 2021

Hi @kapilkedawat

In my device's debug log I found when the device run into OOM:
I didn't find any log about roaming happen on the devie.
But the device has got WIFI_REASON_BEACON_TIMEOUT then STA disconnected and then reconnect for 12 times.

Note, if I re-compile the firmware with CONFIG_WPA_11KV_SUPPORT=n, the issue never happen. (Just a hint)

@AxelLin
Copy link
Contributor

AxelLin commented Jul 8, 2021

'This API needs to be called every time after WIFI_EVENT_STA_BSS_RSSI_LOW event is received.'
This comment is to indicate that only one event will come after calling esp_wifi_set_rssi_threshold(), for getting a second event esp_wifi_set_rssi_threshold() needs to be called again.

Hi @kapilkedawat

In my test, the device will receive WIFI_EVENT_STA_BSS_RSSI_LOW event only 1 time after the device connected to AP.

In roaming_example.c, it calls esp_wifi_set_rssi_threshold() when got WIFI_EVENT_STA_CONNECTED.
But this seems problematic because roaming may fail for some reason.
Which means if the device does not roam to a new AP, it will not receive WIFI_EVENT_STA_CONNECTED.
(i.e. the esp_wifi_set_rssi_threshold() is not called.)
After that the device no longer receive WIFI_EVENT_STA_BSS_RSSI_LOW event anymore.

However, if I call esp_wifi_set_rssi_threshold() after got WIFI_EVENT_STA_BSS_RSSI_LOW event.
It may receive too many WIFI_EVENT_STA_BSS_RSSI_LOW event.
I'm not sure if it's correct to do so because it will call esp_rrm_send_neighbor_rep_request() many times.

@negativekelvin
Copy link
Contributor

Example may be too simplistic, but roaming algorithm can be as complex as you want, implement timers and dynamic rssi thresholds etc...

@AxelLin
Copy link
Contributor

AxelLin commented Jul 9, 2021

Example may be too simplistic, but roaming algorithm can be as complex as you want, implement timers and dynamic rssi thresholds etc...

The roaming_example.c is the only reference code for wifi roaming in esp-idf.
It's important to make it correct.
What I pointed out in my previous reply is not a special case.
It's very common use case that people running the example code could hit and
notice roaming no longer happen any more.

What I want to do is just with fixed rssi threshold so actually I want the code
as simple as possible. I even mentioned that such simple case should be implemented
in esp-idf as common code (#3671 (comment)).
And it's easier to test and verify wifi roaming with common code.

@kapilkedawat
Copy link
Collaborator

Hi @AxelLin,
When 11KV is enabled, client essentially tells the AP that it support 11k and 11v. AP may use those features to steer client to a suitable AP in the network(how AP decides whether it needs to steer the client and on which AP will entirely depend on access point and client has no control over it).

@kapilkedawat

What if setting rm_enabled = 0 && btm_enabled = 0 with CONFIG_WPA_11KV_SUPPORT=y?
Does that mean disallow trigger from AP side?

Station has no control whatsoever on AP trigger, how and when AP decides to roam a station is completely in AP's control. AP can even try to roam a station using legacy methods.

I ask this because the CONFIG_WPA_11KV_SUPPORT=y is compile time determinated.
I'm wondering if setting rm_enabled = 0 && btm_enabled = 0 allows to disable roaming at runtime.

rm_enabled = 0 && btm_enabled = 0 disables station's rm and wnm capabilities and the corresponding caps won't show during association. Also station won't honour those specific packets.

@AxelLin
Copy link
Contributor

AxelLin commented Oct 21, 2021

Hi @policeman0077, we had to put 11r in the backlog because of other higher priority action items. We will keep you updated when we restart 11r activity. We are targeting 2nd quarter of 2021.

@sagb2015

(I don't see any progress regarding 11r)
Will esp-idf v4.4 release include 11r support?

@AxelLin
Copy link
Contributor

AxelLin commented Dec 17, 2021

@sagb2015 @kapilkedawat

Could you help to explain a bit about below roaming example code?
I don't understand why such check can tell if the request was initiated by us.
https://github.com/espressif/esp-idf/blob/master/examples/wifi/roaming/main/roaming_example.c#L276-L279

It seems make more sense if the checking is "if (val != &rrm_ctx) {" instead. (By compare the address rather than the dereference value)

@kapilkedawat
Copy link
Collaborator

@AxelLin Idea was here to send some magic number and compare them. However, yes you can use pointer validation or use to context to pass some data to handler if needed.

How we want to use it completely depend on the user implementation.

@AxelLin
Copy link
Contributor

AxelLin commented Dec 22, 2021

@AxelLin Idea was here to send some magic number and compare them. However, yes you can use pointer validation or use

That example code looks wrong to me.
Even with val != &rrm_ctx (different addresses), in theory it still has chance *val == rrm_ctx.

BTW, below comment says "send AP btm query, this will cause STA to roam as well"
https://github.com/espressif/esp-idf/blob/master/examples/wifi/roaming/main/roaming_example.c#L301-L302

But when I test it, it does not cause STA to roam.
i.e. Not every esp_wnm_send_bss_transition_mgmt_query call will cause STA to roam.
There must be some internal condition to decide if STA should roam.
Can you share the details?
I'm wondering how to know if STA roams to new AP because low RSSI rather than requested by AP.

I can observe many of below log when rssi is log, but it does not roaming:
I (291121) app_test: Roaming due to low rssi cand_list=0
I (291130) wpa: scan issued at time=13138566514883
I (291250) wpa: scan done received
I (291252) wpa: action frame sent
I (320869) wpa: action frame sent
I (320912) app_test: rrm: neighbor report len=181
I (320913) app_test: 0x3ffe131e 06 34 12 d8 47 32 7c 34 ba 87 18 00 00 00 05 07 |.4..G2|4........|
I (320920) app_test: 0x3ffe132e 06 03 01 00 00 34 12 ac 84 c6 32 35 b5 87 18 00 |.....4....25....|
I (320928) app_test: 0x3ffe133e 00 00 05 07 06 03 01 00 00 34 12 ac 84 c6 32 14 |.........4....2.|
I (320938) app_test: 0x3ffe134e 77 87 18 00 00 00 05 07 06 03 01 00 00 34 12 d8 |w............4..|
I (320948) app_test: 0x3ffe135e 47 32 7c 37 ae 87 18 00 00 00 05 07 06 03 01 00 |G2|7............|
I (320958) app_test: 0x3ffe136e 00 34 12 ac 84 c6 32 14 78 97 18 00 00 00 2c 09 |.4....2.x.....,.|
I (320968) app_test: 0x3ffe137e 06 03 02 2a 00 34 12 d8 47 32 7c 34 bb 97 18 00 |....4..G2|4....|
I (320978) app_test: 0x3ffe138e 00 00 2c 09 06 03 02 2a 00 34 12 ac 84 c6 32 35 |..,....
.4....25|
I (320988) app_test: 0x3ffe139e b6 97 18 00 00 00 2c 09 06 03 02 2a 00 34 12 d8 |......,.....4..|
I (320998) app_test: 0x3ffe13ae 47 32 7c 37 af 97 18 00 00 00 2c 09 06 03 02 2a |G2|7......,....
|
I (321008) app_test: 0x3ffe13be 00 34 12 ac 84 c6 32 1a 27 97 18 00 00 00 2c 09 |.4....2.'.....,.|
I (321018) app_test: 0x3ffe13ce 06 03 02 2a 00 |....|
I (321027) app_test: RMM neigbor report bssid=d8:47:32:7c:34:ba info=0x1887 op_class=0 chan=5 phy_type=7
I (321038) app_test: RMM neigbor report bssid=ac:84:c6:32:35:b5 info=0x1887 op_class=0 chan=5 phy_type=7
I (321050) app_test: RMM neigbor report bssid=ac:84:c6:32:14:77 info=0x1887 op_class=0 chan=5 phy_type=7
I (321058) app_test: RMM neigbor report bssid=d8:47:32:7c:37:ae info=0x1887 op_class=0 chan=5 phy_type=7
I (321069) app_test: RMM neigbor report bssid=ac:84:c6:32:14:78 info=0x1897 op_class=0 chan=44 phy_type=9
I (321079) app_test: RMM neigbor report bssid=d8:47:32:7c:34:bb info=0x1897 op_class=0 chan=44 phy_type=9
I (321089) app_test: RMM neigbor report bssid=ac:84:c6:32:35:b6 info=0x1897 op_class=0 chan=44 phy_type=9
I (321100) app_test: RMM neigbor report bssid=d8:47:32:7c:37:af info=0x1897 op_class=0 chan=44 phy_type=9
I (321110) app_test: RMM neigbor report bssid=ac:84:c6:32:1a:27 info=0x1897 op_class=0 chan=44 phy_type=9
I (321121) wpa: action frame sent
I (321124) app_test: Roaming due to low rssi cand_list=0
I (321135) wpa: scan issued at time=13138596518863
I (321255) wpa: scan done received
I (321256) wpa: action frame sent
I (351078) wpa: action frame sent
I (351119) app_test: rrm: neighbor report len=181
I (351121) app_test: 0x3ffe13ee 07 34 12 d8 47 32 7c 34 ba 87 18 00 00 00 05 07 |.4..G2|4........|
I (351126) app_test: 0x3ffe13fe 06 03 01 00 00 34 12 ac 84 c6 32 35 b5 87 18 00 |.....4....25....|
I (351135) app_test: 0x3ffe140e 00 00 05 07 06 03 01 00 00 34 12 ac 84 c6 32 14 |.........4....2.|
I (351145) app_test: 0x3ffe141e 77 87 18 00 00 00 05 07 06 03 01 00 00 34 12 d8 |w............4..|
I (351154) app_test: 0x3ffe142e 47 32 7c 37 ae 87 18 00 00 00 05 07 06 03 01 00 |G2|7............|
I (351165) app_test: 0x3ffe143e 00 34 12 ac 84 c6 32 14 78 97 18 00 00 00 2c 09 |.4....2.x.....,.|
I (351178) app_test: 0x3ffe144e 06 03 02 2a 00 34 12 d8 47 32 7c 34 bb 97 18 00 |...
.4..G2|4....|
I (351185) app_test: 0x3ffe145e 00 00 2c 09 06 03 02 2a 00 34 12 ac 84 c6 32 35 |..,.....4....25|
I (351195) app_test: 0x3ffe146e b6 97 18 00 00 00 2c 09 06 03 02 2a 00 34 12 d8 |......,....
.4..|
I (351207) app_test: 0x3ffe147e 47 32 7c 37 af 97 18 00 00 00 2c 09 06 03 02 2a |G2|7......,....|
I (351215) app_test: 0x3ffe148e 00 34 12 ac 84 c6 32 1a 27 97 18 00 00 00 2c 09 |.4....2.'.....,.|
I (351225) app_test: 0x3ffe149e 06 03 02 2a 00 |...
.|
I (351234) app_test: RMM neigbor report bssid=d8:47:32:7c:34:ba info=0x1887 op_class=0 chan=5 phy_type=7
I (351245) app_test: RMM neigbor report bssid=ac:84:c6:32:35:b5 info=0x1887 op_class=0 chan=5 phy_type=7
I (351255) app_test: RMM neigbor report bssid=ac:84:c6:32:14:77 info=0x1887 op_class=0 chan=5 phy_type=7
I (351265) app_test: RMM neigbor report bssid=d8:47:32:7c:37:ae info=0x1887 op_class=0 chan=5 phy_type=7
I (351275) app_test: RMM neigbor report bssid=ac:84:c6:32:14:78 info=0x1897 op_class=0 chan=44 phy_type=9
I (351285) app_test: RMM neigbor report bssid=d8:47:32:7c:34:bb info=0x1897 op_class=0 chan=44 phy_type=9
I (351296) app_test: RMM neigbor report bssid=ac:84:c6:32:35:b6 info=0x1897 op_class=0 chan=44 phy_type=9
I (351307) app_test: RMM neigbor report bssid=d8:47:32:7c:37:af info=0x1897 op_class=0 chan=44 phy_type=9
I (351317) app_test: RMM neigbor report bssid=ac:84:c6:32:1a:27 info=0x1897 op_class=0 chan=44 phy_type=9
I (351328) wpa: action frame sent
I (351331) app_test: Roaming due to low rssi cand_list=0
I (351365) wpa: scan issued at time=13138626749568
I (351485) wpa: scan done received
I (351487) wpa: action frame sent
I (381082) wpa: action frame sent
I (381125) app_test: rrm: neighbor report len=181
I (381126) app_test: 0x3ffe13ee 08 34 12 d8 47 32 7c 34 ba 87 18 00 00 00 05 07 |.4..G2|4........|
I (381130) app_test: 0x3ffe13fe 06 03 01 00 00 34 12 ac 84 c6 32 35 b5 87 18 00 |.....4....25....|
I (381140) app_test: 0x3ffe140e 00 00 05 07 06 03 01 00 00 34 12 ac 84 c6 32 14 |.........4....2.|
I (381150) app_test: 0x3ffe141e 77 87 18 00 00 00 05 07 06 03 01 00 00 34 12 d8 |w............4..|
I (381160) app_test: 0x3ffe142e 47 32 7c 37 ae 87 18 00 00 00 05 07 06 03 01 00 |G2|7............|
I (381170) app_test: 0x3ffe143e 00 34 12 ac 84 c6 32 14 78 97 18 00 00 00 2c 09 |.4....2.x.....,.|
I (381180) app_test: 0x3ffe144e 06 03 02 2a 00 34 12 d8 47 32 7c 34 bb 97 18 00 |....4..G2|4....|
I (381190) app_test: 0x3ffe145e 00 00 2c 09 06 03 02 2a 00 34 12 ac 84 c6 32 35 |..,....
.4....25|
I (381202) app_test: 0x3ffe146e b6 97 18 00 00 00 2c 09 06 03 02 2a 00 34 12 d8 |......,.....4..|
I (381211) app_test: 0x3ffe147e 47 32 7c 37 af 97 18 00 00 00 2c 09 06 03 02 2a |G2|7......,....
|
I (381221) app_test: 0x3ffe148e 00 34 12 ac 84 c6 32 1a 27 97 18 00 00 00 2c 09 |.4....2.'.....,.|
I (381230) app_test: 0x3ffe149e 06 03 02 2a 00 |....|
I (381239) app_test: RMM neigbor report bssid=d8:47:32:7c:34:ba info=0x1887 op_class=0 chan=5 phy_type=7
I (381250) app_test: RMM neigbor report bssid=ac:84:c6:32:35:b5 info=0x1887 op_class=0 chan=5 phy_type=7
I (381260) app_test: RMM neigbor report bssid=ac:84:c6:32:14:77 info=0x1887 op_class=0 chan=5 phy_type=7
I (381270) app_test: RMM neigbor report bssid=d8:47:32:7c:37:ae info=0x1887 op_class=0 chan=5 phy_type=7
I (381284) app_test: RMM neigbor report bssid=ac:84:c6:32:14:78 info=0x1897 op_class=0 chan=44 phy_type=9
I (381291) app_test: RMM neigbor report bssid=d8:47:32:7c:34:bb info=0x1897 op_class=0 chan=44 phy_type=9
I (381302) app_test: RMM neigbor report bssid=ac:84:c6:32:35:b6 info=0x1897 op_class=0 chan=44 phy_type=9
I (381312) app_test: RMM neigbor report bssid=d8:47:32:7c:37:af info=0x1897 op_class=0 chan=44 phy_type=9
I (381322) app_test: RMM neigbor report bssid=ac:84:c6:32:1a:27 info=0x1897 op_class=0 chan=44 phy_type=9
I (381333) wpa: action frame sent
I (381336) app_test: Roaming due to low rssi cand_list=0
I (381346) wpa: scan issued at time=13138656730313
I (381466) wpa: scan done received
I (381468) wpa: action frame sent
I (411083) wpa: action frame sent
I (411129) app_test: rrm: neighbor report len=181
I (411130) app_test: 0x3ffe131e 09 34 12 d8 47 32 7c 34 ba 87 18 00 00 00 05 07 |.4..G2|4........|
I (411134) app_test: 0x3ffe132e 06 03 01 00 00 34 12 ac 84 c6 32 35 b5 87 18 00 |.....4....25....|
I (411144) app_test: 0x3ffe133e 00 00 05 07 06 03 01 00 00 34 12 ac 84 c6 32 14 |.........4....2.|
I (411154) app_test: 0x3ffe134e 77 87 18 00 00 00 05 07 06 03 01 00 00 34 12 d8 |w............4..|
I (411165) app_test: 0x3ffe135e 47 32 7c 37 ae 87 18 00 00 00 05 07 06 03 01 00 |G2|7............|
I (411174) app_test: 0x3ffe136e 00 34 12 ac 84 c6 32 14 78 97 18 00 00 00 2c 09 |.4....2.x.....,.|
I (411184) app_test: 0x3ffe137e 06 03 02 2a 00 34 12 d8 47 32 7c 34 bb 97 18 00 |...
.4..G2|4....|
I (411196) app_test: 0x3ffe138e 00 00 2c 09 06 03 02 2a 00 34 12 ac 84 c6 32 35 |..,.....4....25|
I (411204) app_test: 0x3ffe139e b6 97 18 00 00 00 2c 09 06 03 02 2a 00 34 12 d8 |......,....
.4..|
I (411215) app_test: 0x3ffe13ae 47 32 7c 37 af 97 18 00 00 00 2c 09 06 03 02 2a |G2|7......,....|
I (411224) app_test: 0x3ffe13be 00 34 12 ac 84 c6 32 1a 27 97 18 00 00 00 2c 09 |.4....2.'.....,.|
I (411234) app_test: 0x3ffe13ce 06 03 02 2a 00 |...
.|
I (411243) app_test: RMM neigbor report bssid=d8:47:32:7c:34:ba info=0x1887 op_class=0 chan=5 phy_type=7
I (411254) app_test: RMM neigbor report bssid=ac:84:c6:32:35:b5 info=0x1887 op_class=0 chan=5 phy_type=7
I (411264) app_test: RMM neigbor report bssid=ac:84:c6:32:14:77 info=0x1887 op_class=0 chan=5 phy_type=7
I (411275) app_test: RMM neigbor report bssid=d8:47:32:7c:37:ae info=0x1887 op_class=0 chan=5 phy_type=7
I (411287) app_test: RMM neigbor report bssid=ac:84:c6:32:14:78 info=0x1897 op_class=0 chan=44 phy_type=9
I (411295) app_test: RMM neigbor report bssid=d8:47:32:7c:34:bb info=0x1897 op_class=0 chan=44 phy_type=9
I (411305) app_test: RMM neigbor report bssid=ac:84:c6:32:35:b6 info=0x1897 op_class=0 chan=44 phy_type=9
I (411316) app_test: RMM neigbor report bssid=d8:47:32:7c:37:af info=0x1897 op_class=0 chan=44 phy_type=9
I (411326) app_test: RMM neigbor report bssid=ac:84:c6:32:1a:27 info=0x1897 op_class=0 chan=44 phy_type=9
I (411337) wpa: action frame sent
I (411340) app_test: Roaming due to low rssi cand_list=0
I (411350) wpa: scan issued at time=13138686734620
I (411471) wpa: scan done received
I (411472) wpa: action frame sent

@kapilkedawat
Copy link
Collaborator

That example code looks wrong to me. Even with val != &rrm_ctx (different addresses), in theory it still has chance *val == rrm_ctx.

As I said, we need to replace value to a cookie value. Example is just how we can do it.

BTW, below comment says "send AP btm query, this will cause STA to roam as well" https://github.com/espressif/esp-idf/blob/master/examples/wifi/roaming/main/roaming_example.c#L301-L302
It's a network assisted roaming example, Station will roam given that it gets a valid BTM request in response of BTM query. AP needs to provide next candidate in the BTM request for station to roam. If AP doesn't provide next candidate, station will assume it is still connected to best candidate.

@AxelLin
Copy link
Contributor

AxelLin commented Dec 22, 2021

BTW, below comment says "send AP btm query, this will cause STA to roam as well" https://github.com/espressif/esp-idf/blob/master/examples/wifi/roaming/main/roaming_example.c#L301-L302

It's a network assisted roaming example, Station will roam given that it gets a valid BTM request in response of BTM query. AP needs to provide next candidate in the BTM request for station to roam. If AP doesn't provide next candidate, station will assume it is still connected to best candidate.

Figure out the reason why my device does not roam when rssi is low:

In compare_scan_neighbor_results, the wpa_s->wnm_num_neighbor_report is always 1
and the target bssid is always my current connected AP.
As you see in #3671 (comment) ,
there are multiple APs around my STA. so I have no idea why compare_scan_neighbor_results always
return my current AP only.

Do you have any idea what could be wrong?

Note:
If I move the device far away from the AP, in the end I got disconnect from AP (not roaming)
and then it joins a different AP when reconnect.

@kapilkedawat
Copy link
Collaborator

Please share the sniffer capture and app_test code logic to debug this faster.

One thing you can check by yourself whether AP is providing any candidate besides itself in the BTM req. If it's not, station will not move.

@AxelLin
Copy link
Contributor

AxelLin commented Dec 26, 2021

Please share the sniffer capture and app_test code logic to debug this faster.

One thing you can check by yourself whether AP is providing any candidate besides itself in the BTM req. If it's not, station will not move.

well, I got it working now.
Just in some case (maybe environment related) the AP keeps report itself as best candidate, but this is probably not STA (esp32)'s issue.

@AxelLin
Copy link
Contributor

AxelLin commented Dec 26, 2021

@kapilkedawat

After STA (esp32) joined an AP, is there any API to know if the AP has 802.11kv support?
I'm wondering if it is possible to avoid repeating below errors when AP does not support 802.11kv.
https://github.com/espressif/esp-idf/blob/master/examples/wifi/roaming/main/roaming_example.c#L318-L324

BTW, Having API to tell if AP has 802.11kv support is helpful for debug issues.
(Especially when the customer who report issues does not know if the AP used has 802.11kv capability or not).

@3DES
Copy link

3DES commented Dec 30, 2021

@AxelLin: it would be great if you could share your solution! There are so many people out there (me included) that have the same problem.

@AxelLin
Copy link
Contributor

AxelLin commented Feb 13, 2022

@AxelLin: it would be great if you could share your solution! There are so many people out there (me included) that have the same problem.

I'm not allowed to post my code since I don't work for espressif.
If you have any issue you can ask it on esp32 forum or report issues here.

@jack0c
Copy link
Collaborator

jack0c commented May 17, 2022

Just update 11r support is merged to master, you can get it since 805b5c9

@AxelLin
Copy link
Contributor

AxelLin commented May 25, 2022

Just update 11r support is merged to master, you can get it since 805b5c9

A question about testing 802.11r: What's the user visible changes with 802.11r enabled v.s. disabled?

I got below messages with 802.11r enabled, is this normal behavior? (The message/behavior seems the same as 802.11r disabled)

I (125300) networking: RMM neigbor report bssid=ac:84:c6:32:1a:27 info=0x1897 op_class=0 chan=44 phy_type=9
I (125310) networking: RMM neigbor report bssid=ac:84:c6:32:35:b6 info=0x1897 op_class=0 chan=44 phy_type=9
I (125320) networking: RMM neigbor report bssid=ac:84:c6:32:14:78 info=0x1897 op_class=0 chan=44 phy_type=9
I (125331) networking: RMM neigbor report bssid=d8:47:32:7c:34:bb info=0x1897 op_class=0 chan=44 phy_type=14
I (125341) networking: RMM neigbor report bssid=d8:47:32:7c:37:af info=0x97 op_class=0 chan=44 phy_type=14
I (125351) networking: RMM neigbor report bssid=ac:84:c6:32:1a:26 info=0x1887 op_class=0 chan=7 phy_type=7
I (125362) networking: RMM neigbor report bssid=ac:84:c6:32:35:b5 info=0x1887 op_class=0 chan=7 phy_type=7
I (125372) networking: RMM neigbor report bssid=ac:84:c6:32:14:77 info=0x1887 op_class=0 chan=7 phy_type=7
I (125382) networking: RMM neigbor report bssid=d8:47:32:7c:34:ba info=0x1887 op_class=0 chan=7 phy_type=14
I (125393) networking: Low RSSI, Send BTM query cand_list=0
I (135396) wifi:state: run -> init (cc0)
I (135397) wifi:pm stop, total sleep time: 63717216 us / 130269526 us

W (135397) wifi:idx
W (135398) wifi:idx
I (135401) wifi:new:<7,0>, old:<7,1>, ap:<255,255>, sta:<7,1>, prof:1
I (135411) networking: Disconnect reason: 207
I (137820) wifi:new:<7,1>, old:<7,0>, ap:<255,255>, sta:<7,1>, prof:1
I (138323) wifi:state: init -> auth (b0)
I (138328) wifi:state: auth -> assoc (0)
I (138338) wifi:state: assoc -> run (30)
I (138382) wifi:connected with IGS-MESH, aid = 8, channel 7, 40U, bssid = ac:84:c6:32:1a:26
I (138382) wifi:security: WPA2-PSK, phy: bgn, rssi: -14
I (138385) wifi:pm start, type: 1

@chegewara
Copy link
Contributor

Hi,
can this be considered as working feature?
What i mean, its working to me more or less, esp32 is roaming between APs in wifi mesh:

03:33:51.437 > 36:de:4b:68:3a:ee => rssi: -83
03:33:51.559 > station got disconnected reason=207
03:33:51.559 > station roaming, do nothing
03:33:52.187 > setting rssi threshold as -70
03:33:52.438 > 36:de:4b:68:1c:72 => rssi: -58
03:33:53.201 > got ip: 192.168.68.112
03:33:53.201 > RRM supported
03:33:53.201 > BTM supported
03:33:53.440 > 36:de:4b:68:1c:72 => rssi: -52

Thanks

@kapilkedawat
Copy link
Collaborator

@chegewara do you see any issues?

@chegewara
Copy link
Contributor

@chegewara do you see any issues?

Im not sure, as it was a quick test so far. I dont know how fast this event should be triggered when threshold is detected:
WIFI_EVENT_STA_BSS_RSSI_LOW
It also takes about 2 seconds to get IP from new AP, but its probably normal.
Other than that it seems to be working to me. Of course i did not test it fully, just basic functionality.

@chegewara
Copy link
Contributor

Hi,
is there any reason for this parameter not being REASON_RSSI?
https://github.com/espressif/esp-idf/blob/master/examples/wifi/roaming/main/roaming_example.c#L314

Thanks

@kapilkedawat
Copy link
Collaborator

kapilkedawat commented Mar 13, 2023

There is no specific reason, feel free to use reason code most suitable for your case.

@chegewara
Copy link
Contributor

chegewara commented Mar 20, 2023

Hi,
is it expected that esp32 can detect all wifi APs withing mesh in 2.4 and 5GHz, which prevents it to roam?

01:03:40.913 > [ 55040][I][WiFi_Task.cpp:199] neighbor_report_recv_cb(): [] rrm: neighbor report len=70
01:03:40.913 > [ 55041][I][WiFi_Task.cpp:155] get_btm_neighbor_list(): [] RMM neigbor report bssid=30:de:xx:xx:1c:72 info=0x2887 op_class=0 chan=1 phy_type=7
01:03:40.913 > [ 55050][I][WiFi_Task.cpp:155] get_btm_neighbor_list(): [] RMM neigbor report bssid=36:de:xx:xx:1c:73 info=0x1897 op_class=0 chan=44 phy_type=9
01:03:40.913 > [ 55062][I][WiFi_Task.cpp:155] get_btm_neighbor_list(): [] RMM neigbor report bssid=36:de:xx:xx:3a:ef info=0x1897 op_class=0 chan=44 phy_type=9
01:03:42.992 > wifi_event_handler:bss rssi is=-74
01:03:42.992 > 
01:03:42.992 > 
01:03:43.024 > [ 57190][I][WiFi_Task.cpp:199] neighbor_report_recv_cb(): [] rrm: neighbor report len=70
01:03:43.077 > [ 57191][I][WiFi_Task.cpp:155] get_btm_neighbor_list(): [] RMM neigbor report bssid=30:de:xx:xx:1c:72 info=0x2887 op_class=0 chan=1 phy_type=7
01:03:43.077 > [ 57200][I][WiFi_Task.cpp:155] get_btm_neighbor_list(): [] RMM neigbor report bssid=36:de:xx:xx:1c:73 info=0x1897 op_class=0 chan=44 phy_type=9
01:03:43.077 > [ 57212][I][WiFi_Task.cpp:155] get_btm_neighbor_list(): [] RMM neigbor report bssid=36:de:xx:xx:3a:ef info=0x1897 op_class=0 chan=44 phy_type=9
01:03:45.045 > wifi_event_handler:bss rssi is=-74

When i enable only 2.4Ghz on that wifi mesh then esp32 can easy roam.

02:03:34.927 > [  6718][I][WiFi_Task.cpp:201] neighbor_report_recv_cb(): [] rrm: neighbor report len=24
02:03:34.927 > roam query: 0
02:03:34.927 > 
02:03:34.927 >  neighbor=30:de:xx:xx:1c:72,0x2887,0,1,7
02:03:34.927 > 
02:03:34.927 > 
02:03:36.915 > [  8700][E][WiFi_Task.cpp:248] wifi_event_handler(): [] station disconnected reason: 207
02:03:36.915 > station got disconnected reason=207
02:03:36.915 > station roaming, do nothing

Thanks

@jack0c
Copy link
Collaborator

jack0c commented Apr 12, 2023

@chegewara ESP32 do not support 5GHz, can't scan 5GHz Wi-Fi. @kapilkedawat is MBO necessary in this case?

@chegewara
Copy link
Contributor

Hi @jack0c
I know that esp32 does not support 5GHz, but this is what i have observed with deco mesh:

  • when i enable only 2.4GHz on deco mesh, then roaming works perfectly fine
  • when i enable 2.4 and 5GHz, then esp32 no longer roam, and as you can see from above logs, some APs with roaming found by esp32 are reporting channels 44, which are 5GHz channels (which does not mean they are reported on 5Ghz, its just means that base is reporting them as roaming capable in that mesh)
RMM neigbor report bssid=30:de:xx:xx:1c:72 info=0x2887 op_class=0 chan=1 phy_type=7
RMM neigbor report bssid=36:de:xx:xx:1c:73 info=0x1897 op_class=0 chan=44 phy_type=9
RMM neigbor report bssid=36:de:xx:xx:3a:ef info=0x1897 op_class=0 chan=44 phy_type=9

I have no idea what is preventing esp32 to roam, maybe its somehow related to other issues reported when esp32 cant connect wifi when 2.4 and 5GHz SSIDs are the same (i tried this option and got no issues here).
For now i only can say that 2.4GHz alone works to me and 2.4 + 5GHz combined on AP prevents esp32 to roam.

Thanks

@kapilkedawat
Copy link
Collaborator

@jack0c MBO is not necessary for the roaming. the example only demonstrate network assisted roaming and probably getting confused by the candidate list btm query.

@chegewara I somehow missed the comment posted by you. Please try the attached patch and see if that helps when 5ghz APs are also enabled.
discard_5ghz_bss.patch

@chegewara
Copy link
Contributor

@kapilkedawat I believe ive been trying it by myself already and i think it didnt help.

Thanks

@kapilkedawat
Copy link
Collaborator

If possible, can you share the sniffer capture so that we can take a look?

@chegewara
Copy link
Contributor

I have many different tools, but ididnt learn to use wireshark with external packets sniffing yet, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests