Merge branch 'bugfix/backport_some_wifi_fixes_v6.0' into 'release/v6.0'

fix(wifi): backport some wifi fixes v6.0

See merge request espressif/esp-idf!46842
This commit is contained in:
Jiang Jiang Jian
2026-03-23 10:50:34 +08:00
12 changed files with 49 additions and 19 deletions
+7
View File
@@ -881,6 +881,13 @@ menu "Wi-Fi"
This option enables assert checks to verify that modem RF power state
is correctly cleared before pmu sleep.
config ESP_WIFI_PASSIVE_HIDDEN_AP_SUPPORT
bool "Support station connection to hidden APs using passive scan when country policy is auto"
default n
help
Select this option to enable/disable support for station connections
to hidden APs using passive scan when the country policy is set to auto.
endif # wifi enabled
endmenu # Wi-Fi
@@ -499,6 +499,9 @@ esp_err_t esp_wifi_internal_get_config_channel(wifi_interface_t ifx, uint8_t *pr
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_INVALID_ARG : invalid argument
* - ESP_ERR_WIFI_NOT_STARTED : WiFi is not started by esp_wifi_start
* - ESP_ERR_WIFI_NOT_CONNECT : No connection between STA and AP
*/
esp_err_t esp_wifi_internal_get_negotiated_channel(wifi_interface_t ifx, uint8_t aid, uint8_t *primary, uint8_t *second);
@@ -510,6 +513,9 @@ esp_err_t esp_wifi_internal_get_negotiated_channel(wifi_interface_t ifx, uint8_t
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_INVALID_ARG : invalid argument
* - ESP_ERR_WIFI_NOT_STARTED : WiFi is not started by esp_wifi_start
* - ESP_ERR_WIFI_NOT_CONNECT : No connection between STA and AP
*/
esp_err_t esp_wifi_internal_get_negotiated_bandwidth(wifi_interface_t ifx, uint8_t aid, uint8_t *bw);
+12 -2
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -284,6 +284,12 @@ extern wifi_osi_funcs_t g_wifi_osi_funcs;
#define WIFI_ENABLE_BSS_MAX_IDLE 0
#endif
#if CONFIG_ESP_WIFI_PASSIVE_HIDDEN_AP_SUPPORT
#define WIFI_ENABLE_PASSIVE_HIDDEN_AP (1<<9)
#else
#define WIFI_ENABLE_PASSIVE_HIDDEN_AP 0
#endif
#define CONFIG_FEATURE_WPA3_SAE_BIT (1<<0)
#define CONFIG_FEATURE_CACHE_TX_BUF_BIT (1<<1)
#define CONFIG_FEATURE_FTM_INITIATOR_BIT (1<<2)
@@ -293,6 +299,7 @@ extern wifi_osi_funcs_t g_wifi_osi_funcs;
#define CONFIG_FEATURE_11R_BIT (1<<6)
#define CONFIG_FEATURE_WIFI_ENT_BIT (1<<7)
#define CONFIG_FEATURE_BSS_MAX_IDLE_BIT (1<<8)
#define CONFIG_FEATURE_WIFI_PASSIVE_HIDDEN_AP_BIT (1<<9)
/* Set additional WiFi features and capabilities */
#define WIFI_FEATURE_CAPS (WIFI_ENABLE_WPA3_SAE | \
@@ -303,7 +310,8 @@ extern wifi_osi_funcs_t g_wifi_osi_funcs;
WIFI_ENABLE_GMAC | \
WIFI_ENABLE_11R | \
WIFI_ENABLE_ENTERPRISE | \
WIFI_ENABLE_BSS_MAX_IDLE)
WIFI_ENABLE_BSS_MAX_IDLE | \
WIFI_ENABLE_PASSIVE_HIDDEN_AP)
#define WIFI_INIT_CONFIG_DEFAULT() { \
.osi_funcs = &g_wifi_osi_funcs, \
@@ -1589,6 +1597,8 @@ esp_err_t esp_wifi_sta_get_aid(uint16_t *aid);
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
* - ESP_ERR_WIFI_NOT_CONNECT: No connection between STA and AP
*/
esp_err_t esp_wifi_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode);
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -224,8 +224,14 @@ typedef struct {
* @brief Channel bitmap for setting specific channels to be scanned
*/
typedef struct {
uint16_t ghz_2_channels; /**< Represents 2.4 GHz channels, that bits can be set as wifi_2g_channel_bit_t shown. */
uint32_t ghz_5_channels; /**< Represents 5 GHz channels, that bits can be set as wifi_5g_channel_bit_t shown. */
uint16_t ghz_2_channels; /**< Represents 2.4 GHz channels.
bit0: band bypass, 0: scan as bitmap, 1: bypass all channels of 2.4GHz.
bit1-bit14: represents channels can be set as wifi_2g_channel_bit_t shown.
bit15: reserved. */
uint32_t ghz_5_channels; /**< Represents 5 GHz channels.
bit0: band bypass, 0: scan as bitmap, 1: bypass all channels of 5GHz.
bit1-bit28: represents channels can be set as wifi_5g_channel_bit_t shown.
bit29-bit31: reserved. */
} wifi_scan_channel_bitmap_t;
/**
@@ -509,7 +515,7 @@ typedef enum {
* @brief Configuration structure for BSS max idle
*/
typedef struct {
uint16_t period; /**< Sets BSS Max idle period (1 Unit = 1000TUs OR 1.024 Seconds). If there are no frames for this period from a STA, SoftAP will disassociate due to inactivity. Setting it to 0 disables the feature */
uint16_t period; /**< Sets BSS Max idle period (1 Unit = 1000TUs OR 1.024 Seconds). If there are no frames for this period from a STA, SoftAP will disassociate due to inactivity. Setting it to 0 disables the feature. Minimum value will be 10 */
bool protected_keep_alive; /**< Requires clients to use protected keep alive frames for BSS Max Idle period */
} wifi_bss_max_idle_config_t;
@@ -520,7 +526,7 @@ typedef struct {
uint8_t ssid[32]; /**< SSID of soft-AP. If ssid_len field is 0, this must be a Null terminated string. Otherwise, length is set according to ssid_len. */
uint8_t password[64]; /**< Password of soft-AP. */
uint8_t ssid_len; /**< Optional length of SSID field. */
uint8_t channel; /**< Channel of soft-AP */
uint8_t channel; /**< Channel of soft-AP. Set to 0 for auto selection (min channel: typically 1 for 2.4G, 36 for 5G). Other invalid values return ESP_ERR_INVALID_ARG. */
wifi_auth_mode_t authmode; /**< Auth mode of soft-AP. Do not support AUTH_WEP, AUTH_WAPI_PSK and AUTH_OWE in soft-AP mode. When the auth mode is set to WPA2_PSK, WPA2_WPA3_PSK or WPA3_PSK, the pairwise cipher will be overwritten with WIFI_CIPHER_TYPE_CCMP by default, unless explicitly set. */
uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */
uint8_t max_connection; /**< Max number of stations allowed to connect in */
@@ -62,7 +62,8 @@ typedef u16 __bitwise be16;
#define WIFI_FAIL (1<<3)
#define EMPH_STR(s) "****** "s" ******"
#define MAX_IDLE_PERIOD (5)
//For station, max idle period is default 10 (1000TUs)
#define MAX_IDLE_PERIOD (10)
#define ETHTYPE_IP 0x0800
static const char* TAG = "test_bss_max_idle";