Merge branch 'fix/backport_some_wifi_fixes_v5.5' into 'release/v5.5'

fix(wifi): backport some wifi fixes to v5.5

See merge request espressif/esp-idf!39261
This commit is contained in:
Jiang Jiang Jian
2025-05-20 13:55:40 +08:00
16 changed files with 64 additions and 34 deletions

View File

@ -202,7 +202,7 @@ pm_beacon_offset_add_loss_counter = 0x400030a8;
pm_beacon_offset_deinit = 0x400030b4;
/*pm_get_tbtt_count = 0x400030b8;*/
pm_coex_schm_overall_period_get = 0x400030bc;
pm_coex_pwr_update = 0x400030c0;
//pm_coex_pwr_update = 0x400030c0;
/* Data (.data, .bss, .rodata) */
s_pm_beacon_offset_ptr = 0x3fcdfa64;
s_pm_beacon_offset_config_ptr = 0x3fcdfa60;

View File

@ -528,7 +528,7 @@ pm_mac_sleep = 0x40001b80;
pm_enable_active_timer = 0x40001b84;
pm_enable_sleep_delay_timer = 0x40001b88;
pm_local_tsf_process = 0x40001b8c;
pm_set_beacon_filter = 0x40001b90;
//pm_set_beacon_filter = 0x40001b90;
/*pm_is_in_wifi_slice_threshold = 0x40001b94;*/
pm_is_waked = 0x40001b98;
/*pm_keep_alive = 0x40001b9c;*/

View File

@ -717,7 +717,7 @@ pm_mac_sleep = 0x4000165c;
pm_enable_active_timer = 0x40001660;
pm_enable_sleep_delay_timer = 0x40001664;
pm_local_tsf_process = 0x40001668;
pm_set_beacon_filter = 0x4000166c;
//pm_set_beacon_filter = 0x4000166c;
/*pm_is_in_wifi_slice_threshold = 0x40001670;*/
pm_is_waked = 0x40001674;
/*pm_keep_alive = 0x40001678;*/

View File

@ -113,7 +113,7 @@ pm_mac_sleep = 0x40000d5c;
pm_enable_active_timer = 0x40000d60;
pm_enable_sleep_delay_timer = 0x40000d64;
pm_local_tsf_process = 0x40000d68;
pm_set_beacon_filter = 0x40000d6c;
//pm_set_beacon_filter = 0x40000d6c;
/*pm_is_in_wifi_slice_threshold = 0x40000d70;*/
pm_is_waked = 0x40000d74;
/*pm_keep_alive = 0x40000d78;*/
@ -156,9 +156,9 @@ pm_twt_disallow_tx = 0x40000e08;
pm_clear_wakeup_signal = 0x40000e0c;
/*pm_mac_disable_tsf_tbtt_soc_wakeup = 0x40000e10;
pm_mac_disable_tsf_tbtt_modem_wakeup = 0x40000e14;
pm_mac_enable_tsf_tbtt_soc_wakeup = 0x40000e18;
pm_mac_enable_tsf_tbtt_modem_wakeup = 0x40000e1c;
pm_mac_modem_params_rt_update = 0x40000e20;*/
//pm_mac_enable_tsf_tbtt_soc_wakeup = 0x40000e18;
//pm_mac_enable_tsf_tbtt_modem_wakeup = 0x40000e1c;
//pm_mac_modem_params_rt_update = 0x40000e20;*/
pm_update_at_next_beacon = 0x40000e24;
tbtt_adaptive_setup = 0x40000e28;
tbtt_adaptive_servo = 0x40000e2c;
@ -288,7 +288,7 @@ esp_test_clr_tx_statistics = 0x40001020;
esp_test_get_tx_statistics = 0x40001024;
esp_test_clr_tx_tb_statistics = 0x40001028;
esp_test_get_tx_tb_statistics = 0x4000102c;
esp_test_tx_process_complete = 0x40001030;
/*esp_test_tx_process_complete = 0x40001030;*/
esp_test_tx_process_txq_state = 0x40001034;
esp_test_tx_enab_statistics = 0x40001038;
esp_test_tx_tb_complete = 0x4000103c;
@ -459,7 +459,7 @@ g_he_max_apep_length_tab_ptr = 0x4085fc8c;
/* Functions */
pm_coex_schm_overall_period_get = 0x40001504;
pm_coex_pwr_update = 0x40001508;
//pm_coex_pwr_update = 0x40001508;
ppRemoveHEAMPDUflags = 0x4000150c;
tsf_hal_get_tbtt_interval = 0x40001510;
pm_beacon_monitor_tbtt_start = 0x40001514;

View File

@ -119,7 +119,7 @@ pm_mac_sleep = 0x40000cc8;
/*pm_enable_active_timer = 0x40000ccc;*/
pm_enable_sleep_delay_timer = 0x40000cd0;
pm_local_tsf_process = 0x40000cd4;
pm_set_beacon_filter = 0x40000cd8;
//pm_set_beacon_filter = 0x40000cd8;
/*pm_is_in_wifi_slice_threshold = 0x40000cdc;*/
pm_is_waked = 0x40000ce0;
//pm_keep_alive = 0x40000ce4;
@ -162,13 +162,13 @@ pm_twt_disallow_tx = 0x40000d74;
pm_clear_wakeup_signal = 0x40000d78;
/*pm_mac_disable_tsf_tbtt_soc_wakeup = 0x40000d7c;
pm_mac_disable_tsf_tbtt_modem_wakeup = 0x40000d80;
pm_mac_enable_tsf_tbtt_soc_wakeup = 0x40000d84;
pm_mac_enable_tsf_tbtt_modem_wakeup = 0x40000d88;
pm_mac_modem_params_rt_update = 0x40000d8c;*/
//pm_mac_enable_tsf_tbtt_soc_wakeup = 0x40000d84;
//pm_mac_enable_tsf_tbtt_modem_wakeup = 0x40000d88;
//pm_mac_modem_params_rt_update = 0x40000d8c;*/
pm_update_at_next_beacon = 0x40000d90;
pm_get_null_max_tx_time = 0x40000d94;
pm_coex_schm_overall_period_get = 0x40000d98;
pm_coex_pwr_update = 0x40000d9c;
//pm_coex_pwr_update = 0x40000d9c;
tbtt_adaptive_setup = 0x40000da0;
tbtt_adaptive_servo = 0x40000da4;
ppAMPDU2Normal = 0x40000da8;

View File

@ -971,7 +971,7 @@ pm_mac_sleep = 0x40005454;
pm_enable_active_timer = 0x40005460;
pm_enable_sleep_delay_timer = 0x4000546c;
pm_local_tsf_process = 0x40005478;
pm_set_beacon_filter = 0x40005484;
//pm_set_beacon_filter = 0x40005484;
/*pm_is_in_wifi_slice_threshold = 0x40005490;*/
pm_is_waked = 0x4000549c;
/*pm_keep_alive = 0x400054a8;*/

View File

@ -350,7 +350,8 @@ typedef struct {
uint32_t tx_muedca_enable; /* count TX times within mu-timer working */
uint32_t collision;
uint32_t timeout;
} esp_test_tx_statistics_t; //136 bytes
uint32_t tx_error_a0;
} esp_test_tx_statistics_t; //140 bytes
typedef struct {
uint32_t complete_suc_tb;

View File

@ -572,6 +572,7 @@ esp_err_t esp_wifi_get_scan_parameters(wifi_scan_default_params_t *config);
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
* - ESP_ERR_WIFI_STATE: WiFi is still connecting when esp_wifi_scan_stop() is invoked.
*/
esp_err_t esp_wifi_scan_stop(void);
@ -1528,7 +1529,7 @@ esp_err_t esp_wifi_force_wakeup_release(void);
/**
* @brief configure country
*
* @attention 1. When ieee80211d_enabled, the country info of the AP to which
* @attention 1. When ieee80211d_enabled is enabled, the country info of the AP to which
* the station is connected is used. E.g. if the configured country is US
* and the country info of the AP to which the station is connected is JP
* then the country info that will be used is JP. If the station disconnected

View File

@ -81,7 +81,7 @@ typedef struct {
* @brief Wi-Fi authmode type
* Strength of authmodes
* Personal Networks : OPEN < WEP < WPA_PSK < OWE < WPA2_PSK = WPA_WPA2_PSK < WAPI_PSK < WPA3_PSK = WPA2_WPA3_PSK = DPP
* Enterprise Networks : WIFI_AUTH_WPA2_ENTERPRISE < WIFI_AUTH_WPA3_ENTERPRISE = WIFI_AUTH_WPA2_WPA3_ENTERPRISE < WIFI_AUTH_WPA3_ENT_192
* Enterprise Networks : WIFI_AUTH_WPA_ENTERPRISE < WIFI_AUTH_WPA2_ENTERPRISE < WIFI_AUTH_WPA3_ENTERPRISE = WIFI_AUTH_WPA2_WPA3_ENTERPRISE < WIFI_AUTH_WPA3_ENT_192
*/
typedef enum {
WIFI_AUTH_OPEN = 0, /**< Authenticate mode : open */
@ -89,8 +89,8 @@ typedef enum {
WIFI_AUTH_WPA_PSK, /**< Authenticate mode : WPA_PSK */
WIFI_AUTH_WPA2_PSK, /**< Authenticate mode : WPA2_PSK */
WIFI_AUTH_WPA_WPA2_PSK, /**< Authenticate mode : WPA_WPA2_PSK */
WIFI_AUTH_ENTERPRISE, /**< Authenticate mode : Wi-Fi EAP security */
WIFI_AUTH_WPA2_ENTERPRISE = WIFI_AUTH_ENTERPRISE, /**< Authenticate mode : Wi-Fi EAP security */
WIFI_AUTH_ENTERPRISE, /**< Authenticate mode : Wi-Fi EAP security, treated the same as WIFI_AUTH_WPA2_ENTERPRISE */
WIFI_AUTH_WPA2_ENTERPRISE = WIFI_AUTH_ENTERPRISE, /**< Authenticate mode : WPA2-Enterprise security */
WIFI_AUTH_WPA3_PSK, /**< Authenticate mode : WPA3_PSK */
WIFI_AUTH_WPA2_WPA3_PSK, /**< Authenticate mode : WPA2_WPA3_PSK */
WIFI_AUTH_WAPI_PSK, /**< Authenticate mode : WAPI_PSK */
@ -101,6 +101,7 @@ typedef enum {
WIFI_AUTH_DPP, /**< Authenticate mode : DPP */
WIFI_AUTH_WPA3_ENTERPRISE, /**< Authenticate mode : WPA3-Enterprise Only Mode */
WIFI_AUTH_WPA2_WPA3_ENTERPRISE, /**< Authenticate mode : WPA3-Enterprise Transition Mode */
WIFI_AUTH_WPA_ENTERPRISE, /**< Authenticate mode : WPA-Enterprise security */
WIFI_AUTH_MAX
} wifi_auth_mode_t;

View File

@ -1693,7 +1693,7 @@ config SOC_WIFI_HW_TSF
config SOC_WIFI_FTM_SUPPORT
bool
default n
default y
config SOC_WIFI_GCMP_SUPPORT
bool

View File

@ -667,7 +667,7 @@
/*------------------------------------ WI-FI CAPS ------------------------------------*/
#define SOC_WIFI_HW_TSF (1) /*!< Support hardware TSF */
#define SOC_WIFI_FTM_SUPPORT (0) /*!< Support FTM */ // TODO: [ESP32C5] WIFI-6426
#define SOC_WIFI_FTM_SUPPORT (1) /*!< Support FTM */
#define SOC_WIFI_GCMP_SUPPORT (1) /*!< Support GCMP(GCMP128 and GCMP256) */
#define SOC_WIFI_WAPI_SUPPORT (1) /*!< Support WAPI */
#define SOC_WIFI_CSI_SUPPORT (1) /*!< Support CSI */

View File

@ -2261,7 +2261,7 @@ void wpa_set_profile(u32 wpa_proto, u8 auth_mode)
struct wpa_sm *sm = &gWpaSm;
sm->proto = wpa_proto;
if (auth_mode == WPA2_AUTH_ENT) {
if (auth_mode == WPA2_AUTH_ENT || (auth_mode == WPA_AUTH_UNSPEC)) {
sm->key_mgmt = WPA_KEY_MGMT_IEEE8021X; /* for wpa2 enterprise */
} else if (auth_mode == WPA2_AUTH_ENT_SHA256) {
sm->key_mgmt = WPA_KEY_MGMT_IEEE8021X_SHA256; /* for wpa2 enterprise sha256 */
@ -2386,7 +2386,7 @@ int wpa_set_bss(char *macddr, char * bssid, u8 pairwise_cipher, u8 group_cipher,
}
#ifdef CONFIG_SUITEB192
extern bool g_wpa_suiteb_certification;
if (g_wpa_suiteb_certification) {
if (is_wpa2_enterprise_connection() && g_wpa_suiteb_certification) {
if (sm->mgmt_group_cipher != WPA_CIPHER_BIP_GMAC_256) {
wpa_printf(MSG_ERROR, "suite-b 192bit certification, only GMAC256 is supported");
return -1;

View File

@ -2,5 +2,5 @@
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
nvs, data, nvs, 0x9000, 0x6000,
phy_init, data, phy, 0xf000, 0x1000,
factory, app, factory, 0x10000, 1M,
storage, data, spiffs, , 0xF0000,
factory, app, factory, 0x10000, 0x110000,
storage, data, spiffs, , 0xE0000,

1 # Name, Type, SubType, Offset, Size, Flags
2 # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
3 nvs, data, nvs, 0x9000, 0x6000,
4 phy_init, data, phy, 0xf000, 0x1000,
5 factory, app, factory, 0x10000, 1M, factory, app, factory, 0x10000, 0x110000,
6 storage, data, spiffs, , 0xF0000, storage, data, spiffs, , 0xE0000,

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 |
| ----------------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 |
| ----------------- | -------- | -------- | -------- | -------- | -------- | -------- |
# FTM Example

View File

@ -418,10 +418,12 @@ static bool wifi_cmd_ap_set(const char* ssid, const char* pass, uint8_t channel,
}
strlcpy((char*) g_ap_config.ap.password, pass, MAX_PASSPHRASE_LEN);
}
#if !CONFIG_SOC_WIFI_SUPPORT_5G
if (!(channel >=1 && channel <= 14)) {
ESP_LOGE(TAG_AP, "Channel cannot be %d!", channel);
return false;
}
#endif
if (bw != 20 && bw != 40) {
ESP_LOGE(TAG_AP, "Cannot set %d MHz bandwidth!", bw);
return false;
@ -430,16 +432,41 @@ static bool wifi_cmd_ap_set(const char* ssid, const char* pass, uint8_t channel,
if (ESP_OK != wifi_add_mode(WIFI_MODE_AP)) {
return false;
}
wifi_bandwidths_t bws = {0};
wifi_protocols_t proto = {0};
if (channel <= 14) {
if (bw == 40) {
proto.ghz_2g = WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N;
proto.ghz_5g = 0;
esp_wifi_set_protocols(ESP_IF_WIFI_AP, &proto);
bws.ghz_2g = WIFI_BW_HT40;
esp_wifi_set_bandwidths(ESP_IF_WIFI_AP, &bws);
} else {
bws.ghz_2g = WIFI_BW_HT20;
esp_wifi_set_bandwidths(ESP_IF_WIFI_AP, &bws);
}
} else {
#if CONFIG_SOC_WIFI_SUPPORT_5G
if (bw == 40) {
proto.ghz_2g = 0;
proto.ghz_5g = WIFI_PROTOCOL_11N | WIFI_PROTOCOL_11A;
esp_wifi_set_protocols(ESP_IF_WIFI_AP, &proto);
bws.ghz_5g=WIFI_BW_HT40;
esp_wifi_set_bandwidths(ESP_IF_WIFI_AP, &bws);
} else {
proto.ghz_2g = 0;
proto.ghz_5g = WIFI_PROTOCOL_11AC | WIFI_PROTOCOL_11A | WIFI_PROTOCOL_11AX;
esp_wifi_set_protocols(ESP_IF_WIFI_AP, &proto);
bws.ghz_5g = WIFI_BW_HT20;
esp_wifi_set_bandwidths(ESP_IF_WIFI_AP, &bws);
}
#endif
}
if (strlen(pass) == 0) {
g_ap_config.ap.authmode = WIFI_AUTH_OPEN;
}
g_ap_config.ap.channel = channel;
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &g_ap_config));
if (bw == 40) {
esp_wifi_set_bandwidth(ESP_IF_WIFI_AP, WIFI_BW_HT40);
} else {
esp_wifi_set_bandwidth(ESP_IF_WIFI_AP, WIFI_BW_HT20);
}
ESP_LOGI(TAG_AP, "Starting SoftAP with FTM Responder support, SSID - %s, Password - %s, Primary Channel - %d, Bandwidth - %dMHz",
ap_args.ssid->sval[0], ap_args.password->sval[0], channel, bw);