fix(wifi): Provide a config option to skip IP renew during roam

This commit is contained in:
Kapil Gupta
2024-11-08 16:20:30 +05:30
parent 84ae3dc848
commit e296094b00
2 changed files with 27 additions and 0 deletions

View File

@@ -26,6 +26,9 @@ static esp_netif_t *s_wifi_netifs[MAX_WIFI_IFS] = { NULL };
static bool wifi_default_handlers_set = false;
static esp_err_t disconnect_and_destroy(esp_netif_t* esp_netif);
#ifdef ESP_WIFI_NETWORK_ASSISTED_ROAMING_IP_RENEW_SKIP
static bool roaming_ongoing = false;
#endif
//
// Default event handlers
@@ -84,6 +87,13 @@ static void wifi_default_action_sta_stop(void *arg, esp_event_base_t base, int32
static void wifi_default_action_sta_connected(void *arg, esp_event_base_t base, int32_t event_id, void *data)
{
#ifdef ESP_WIFI_NETWORK_ASSISTED_ROAMING_IP_RENEW_SKIP
if (roaming_ongoing) {
/* IP stack is already in ready state */
roaming_ongoing = false;
return;
}
#endif
if (s_wifi_netifs[WIFI_IF_STA] != NULL) {
esp_err_t ret;
esp_netif_t *esp_netif = s_wifi_netifs[WIFI_IF_STA];
@@ -103,6 +113,15 @@ static void wifi_default_action_sta_connected(void *arg, esp_event_base_t base,
static void wifi_default_action_sta_disconnected(void *arg, esp_event_base_t base, int32_t event_id, void *data)
{
wifi_event_sta_disconnected_t *disconn = data;
#ifdef ESP_WIFI_NETWORK_ASSISTED_ROAMING_IP_RENEW_SKIP
if (disconn->reason == WIFI_REASON_ROAMING) {
roaming_ongoing = true;
/* do nothing else */
return;
}
roaming_ongoing = false;
#endif
if (s_wifi_netifs[WIFI_IF_STA] != NULL) {
esp_netif_action_disconnected(s_wifi_netifs[WIFI_IF_STA], base, event_id, data);
}

View File

@@ -90,6 +90,14 @@ menu "Roaming Methods"
Retry threshold after which the station should stop using Network Assisted
roaming methods and start using legacy roaming instead.
config ESP_WIFI_NETWORK_ASSISTED_ROAMING_IP_RENEW_SKIP
bool "Skip IP renew during BTM based roaming"
depends on ESP_WIFI_ROAMING_NETWORK_ASSISTED_ROAM
default y
help
Station will not ask for IP renew after a BTM based roaming. Before enabling please
make sure your network supports this.
endmenu #"Roaming Methods"
menu "Scan Configuration"