Merge branch 'bugfix/some_wifi_fixes_v5.1' into 'release/v5.1'

fix(esp_wifi): Some Wi-Fi bug fixes

See merge request espressif/esp-idf!26084
This commit is contained in:
Jiang Jiang Jian
2023-09-21 18:46:02 +08:00
20 changed files with 201 additions and 65 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -161,6 +161,35 @@ void esp_pm_register_light_sleep_default_params_config_callback(update_light_sle
*/
void esp_pm_unregister_light_sleep_default_params_config_callback(void);
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
/**
* @brief Init Wi-Fi modem state.
*
* This function init wifi modem state.
* @return
* - ESP_OK on success
* - ESP_ERR_NO_MEM if no memory for link
*/
esp_err_t sleep_modem_wifi_modem_state_init(void);
/**
* @brief Deinit Wi-Fi modem state.
*
* This function deinit wifi modem state.
*/
void sleep_modem_wifi_modem_state_deinit(void);
/**
* @brief Function to check Wi-Fi modem state to skip light sleep.
*
* This function is to check if light sleep should skip by Wi-Fi modem state .
* @return
* - true skip light sleep
* - false not skip light sleep
*/
bool sleep_modem_wifi_modem_state_skip_light_sleep(void);
#endif
#ifdef __cplusplus
}
#endif

View File

@@ -167,7 +167,7 @@ typedef struct sleep_modem_config {
static sleep_modem_config_t s_sleep_modem = { .wifi.phy_link = NULL, .wifi.flags = 0 };
static __attribute__((unused)) esp_err_t sleep_modem_wifi_modem_state_init(void)
esp_err_t sleep_modem_wifi_modem_state_init(void)
{
esp_err_t err = ESP_OK;
phy_i2c_master_command_attribute_t cmd;
@@ -244,7 +244,7 @@ static __attribute__((unused)) esp_err_t sleep_modem_wifi_modem_state_init(void)
return err;
}
static __attribute__((unused)) void sleep_modem_wifi_modem_state_deinit(void)
__attribute__((unused)) void sleep_modem_wifi_modem_state_deinit(void)
{
if (s_sleep_modem.wifi.phy_link) {
regdma_link_destroy(s_sleep_modem.wifi.phy_link, 0);
@@ -302,7 +302,7 @@ uint32_t IRAM_ATTR sleep_modem_reject_triggers(void)
return reject_triggers;
}
static __attribute__((unused)) bool IRAM_ATTR sleep_modem_wifi_modem_state_skip_light_sleep(void)
bool IRAM_ATTR sleep_modem_wifi_modem_state_skip_light_sleep(void)
{
bool skip = false;
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
@@ -317,17 +317,8 @@ static __attribute__((unused)) bool IRAM_ATTR sleep_modem_wifi_modem_state_skip_
esp_err_t sleep_modem_configure(int max_freq_mhz, int min_freq_mhz, bool light_sleep_enable)
{
#if CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
extern int esp_wifi_internal_mac_sleep_configure(bool, bool);
if (light_sleep_enable) {
if (sleep_modem_wifi_modem_state_init() == ESP_OK) {
esp_pm_register_skip_light_sleep_callback(sleep_modem_wifi_modem_state_skip_light_sleep);
esp_wifi_internal_mac_sleep_configure(light_sleep_enable, true); /* require WiFi to enable automatically receives the beacon */
}
} else {
esp_wifi_internal_mac_sleep_configure(light_sleep_enable, false); /* require WiFi to disable automatically receives the beacon */
esp_pm_unregister_skip_light_sleep_callback(sleep_modem_wifi_modem_state_skip_light_sleep);
sleep_modem_wifi_modem_state_deinit();
}
extern int esp_wifi_internal_light_sleep_configure(bool);
esp_wifi_internal_light_sleep_configure(light_sleep_enable);
#endif
#if CONFIG_PM_SLP_DEFAULT_PARAMS_OPT
if (light_sleep_enable) {

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -85,8 +85,10 @@ static bool s_is_phy_calibrated = false;
static bool s_is_phy_reg_stored = false;
/* Memory to store PHY digital registers */
static uint32_t* s_phy_digital_regs_mem = NULL;
static uint8_t s_phy_modem_init_ref = 0;
#endif // SOC_PM_MODEM_RETENTION_BY_BACKUPDMA
#if SOC_PM_MODEM_RETENTION_BY_BACKUPDMA || CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
static uint8_t s_phy_modem_init_ref = 0;
#endif
#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN
@@ -349,23 +351,29 @@ void esp_wifi_bt_power_domain_off(void)
void esp_phy_modem_init(void)
{
#if SOC_PM_MODEM_RETENTION_BY_BACKUPDMA
#if SOC_PM_MODEM_RETENTION_BY_BACKUPDMA || CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
_lock_acquire(&s_phy_access_lock);
s_phy_modem_init_ref++;
#if SOC_PM_MODEM_RETENTION_BY_BACKUPDMA
if (s_phy_digital_regs_mem == NULL) {
s_phy_digital_regs_mem = (uint32_t *)heap_caps_malloc(SOC_PHY_DIG_REGS_MEM_SIZE, MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
}
_lock_release(&s_phy_access_lock);
#endif // SOC_PM_MODEM_RETENTION_BY_BACKUPDMA
#if CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
sleep_modem_wifi_modem_state_init();
#endif // CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
_lock_release(&s_phy_access_lock);
#endif // SOC_PM_MODEM_RETENTION_BY_BACKUPDMA || CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
}
void esp_phy_modem_deinit(void)
{
#if SOC_PM_MODEM_RETENTION_BY_BACKUPDMA
#if SOC_PM_MODEM_RETENTION_BY_BACKUPDMA || CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
_lock_acquire(&s_phy_access_lock);
s_phy_modem_init_ref--;
if (s_phy_modem_init_ref == 0) {
#if SOC_PM_MODEM_RETENTION_BY_BACKUPDMA
s_is_phy_reg_stored = false;
free(s_phy_digital_regs_mem);
s_phy_digital_regs_mem = NULL;
@@ -374,11 +382,14 @@ void esp_phy_modem_deinit(void)
*/
#if CONFIG_IDF_TARGET_ESP32C3
phy_init_flag();
#endif
}
_lock_release(&s_phy_access_lock);
#endif // CONFIG_IDF_TARGET_ESP32C3
#endif // SOC_PM_MODEM_RETENTION_BY_BACKUPDMA
#if CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
sleep_modem_wifi_modem_state_deinit();
#endif // CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
}
_lock_release(&s_phy_access_lock);
#endif // SOC_PM_MODEM_RETENTION_BY_BACKUPDMA || CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
}
#if CONFIG_MAC_BB_PD

View File

@@ -121,6 +121,8 @@ static bool s_skipped_light_sleep[portNUM_PROCESSORS];
*/
static bool s_skip_light_sleep[portNUM_PROCESSORS];
#endif // portNUM_PROCESSORS == 2
static _lock_t s_skip_light_sleep_lock;
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
/* A flag indicating that Idle hook has run on a given CPU;
@@ -546,25 +548,32 @@ static void IRAM_ATTR leave_idle(void)
esp_err_t esp_pm_register_skip_light_sleep_callback(skip_light_sleep_cb_t cb)
{
_lock_acquire(&s_skip_light_sleep_lock);
for (int i = 0; i < PERIPH_SKIP_LIGHT_SLEEP_NO; i++) {
if (s_periph_skip_light_sleep_cb[i] == cb) {
_lock_release(&s_skip_light_sleep_lock);
return ESP_OK;
} else if (s_periph_skip_light_sleep_cb[i] == NULL) {
s_periph_skip_light_sleep_cb[i] = cb;
_lock_release(&s_skip_light_sleep_lock);
return ESP_OK;
}
}
_lock_release(&s_skip_light_sleep_lock);
return ESP_ERR_NO_MEM;
}
esp_err_t esp_pm_unregister_skip_light_sleep_callback(skip_light_sleep_cb_t cb)
{
_lock_acquire(&s_skip_light_sleep_lock);
for (int i = 0; i < PERIPH_SKIP_LIGHT_SLEEP_NO; i++) {
if (s_periph_skip_light_sleep_cb[i] == cb) {
s_periph_skip_light_sleep_cb[i] = NULL;
_lock_release(&s_skip_light_sleep_lock);
return ESP_OK;
}
}
_lock_release(&s_skip_light_sleep_lock);
return ESP_ERR_INVALID_STATE;
}

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -1494,9 +1494,9 @@ g_os_mempool_list = 0x3fcdfdf0;
esp_pp_rom_version_get = 0x40001ad4;
RC_GetBlockAckTime = 0x40001ad8;
ebuf_list_remove = 0x40001adc;
esf_buf_alloc = 0x40001ae0;
esf_buf_alloc_dynamic = 0x40001ae4;
esf_buf_recycle = 0x40001ae8;
/*esf_buf_alloc = 0x40001ae0;*/
/*esf_buf_alloc_dynamic = 0x40001ae4;*/
/*esf_buf_recycle = 0x40001ae8;*/
GetAccess = 0x40001aec;
hal_mac_is_low_rate_enabled = 0x40001af0;
hal_mac_tx_get_blockack = 0x40001af4;
@@ -1625,7 +1625,7 @@ wDev_AppendRxBlocks = 0x40001cdc;
wDev_DiscardFrame = 0x40001ce0;
wDev_GetNoiseFloor = 0x40001ce4;
wDev_IndicateAmpdu = 0x40001ce8;
wDev_IndicateFrame = 0x40001cec;
/*wDev_IndicateFrame = 0x40001cec;*/
wdev_mac_reg_load = 0x40001cf0;
wdev_mac_reg_store = 0x40001cf4;
wdev_mac_special_reg_load = 0x40001cf8;
@@ -1633,7 +1633,7 @@ wdev_mac_special_reg_store = 0x40001cfc;
wdev_mac_wakeup = 0x40001d00;
wdev_mac_sleep = 0x40001d04;
/* wDev_ProcessFiq = 0x40001d08; */
wDev_ProcessRxSucData = 0x40001d0c;
/*wDev_ProcessRxSucData = 0x40001d0c;*/
wdevProcessRxSucDataAll = 0x40001d10;
wdev_csi_len_align = 0x40001d14;
ppDequeueTxDone_Locked = 0x40001d18;
@@ -1934,7 +1934,7 @@ ieee80211_vnd_lora_ie_set = 0x400020bc;
ieee80211_add_wme_param = 0x400020c0;
ieee80211_add_dsparams = 0x400020c4;
ieee80211_add_csa = 0x400020c8;
ieee80211_add_extcap = 0x400020cc;
/*ieee80211_add_extcap = 0x400020cc;*/
ieee80211_regdomain_get_country = 0x400020d0;
ieee80211_add_countryie = 0x400020d4;
ieee80211_amsdu_adjust_head = 0x400020dc;

View File

@@ -3,8 +3,8 @@ ESP32C3 ECO3 ROM address table
Version 3 API's imported from the ROM
*/
esf_buf_alloc_dynamic = 0x400015c0;
esf_buf_recycle = 0x400015c4;
/*esf_buf_alloc_dynamic = 0x400015c0;*/
/*esf_buf_recycle = 0x400015c4;*/
/*lmacTxDone = 0x4000162c;*/
/*ppMapTxQueue = 0x400016d8;*/
/*rcGetSched = 0x40001764;*/

View File

@@ -1583,7 +1583,7 @@ r_sch_plan_offset_req_hook = 0x40001ce4;
esp_pp_rom_version_get = 0x400015b0;
RC_GetBlockAckTime = 0x400015b4;
ebuf_list_remove = 0x400015b8;
esf_buf_alloc = 0x400015bc;
/*esf_buf_alloc = 0x400015bc;*/
GetAccess = 0x400015c8;
hal_mac_is_low_rate_enabled = 0x400015cc;
hal_mac_tx_get_blockack = 0x400015d0;
@@ -1707,7 +1707,7 @@ wDev_AppendRxBlocks = 0x400017b8;
wDev_DiscardFrame = 0x400017bc;
wDev_GetNoiseFloor = 0x400017c0;
wDev_IndicateAmpdu = 0x400017c4;
wDev_IndicateFrame = 0x400017c8;
/*wDev_IndicateFrame = 0x400017c8;*/
wdev_bank_store = 0x400017cc;
wdev_bank_load = 0x400017d0;
wdev_mac_reg_load = 0x400017d4;
@@ -1718,7 +1718,7 @@ wdev_mac_wakeup = 0x400017e4;
wdev_mac_sleep = 0x400017e8;
hal_mac_is_dma_enable = 0x400017ec;
/*wDev_ProcessFiq = 0x400017f0;*/
wDev_ProcessRxSucData = 0x400017f4;
/*wDev_ProcessRxSucData = 0x400017f4;*/
wdevProcessRxSucDataAll = 0x400017f8;
wdev_csi_len_align = 0x400017fc;
ppDequeueTxDone_Locked = 0x40001800;

View File

@@ -22,7 +22,7 @@ esp_pp_rom_version_get = 0x40000bd8;
ppCalTxopRTSThreshold = 0x40000bdc;
RC_GetBlockAckTime = 0x40000be0;
ebuf_list_remove = 0x40000be4;
esf_buf_alloc = 0x40000be8;
//esf_buf_alloc = 0x40000be8;
//esf_buf_alloc_dynamic = 0x40000bec;
//esf_buf_recycle = 0x40000bf0;
GetAccess = 0x40000bf4;
@@ -149,7 +149,7 @@ wDev_AppendRxBlocks = 0x40000dd4;
wDev_DiscardFrame = 0x40000dd8;
wDev_GetNoiseFloor = 0x40000ddc;
wDev_IndicateAmpdu = 0x40000de0;
wDev_IndicateFrame = 0x40000de4;
//wDev_IndicateFrame = 0x40000de4;
wdev_mac_reg_load = 0x40000de8;
wdev_mac_reg_store = 0x40000dec;
wdev_mac_special_reg_load = 0x40000df0;

View File

@@ -1891,8 +1891,8 @@ r_sch_plan_offset_req_hook = 0x40001ce4;
esp_pp_rom_version_get = 0x40005250;
RC_GetBlockAckTime = 0x4000525c;
ebuf_list_remove = 0x40005268;
esf_buf_alloc = 0x40005274;
esf_buf_alloc_dynamic = 0x40005280;
/*esf_buf_alloc = 0x40005274;*/
/*esf_buf_alloc_dynamic = 0x40005280;*/
/*esf_buf_recycle = 0x4000528c;*/
GetAccess = 0x40005298;
hal_mac_is_low_rate_enabled = 0x400052a4;
@@ -2021,7 +2021,7 @@ wDev_AppendRxBlocks = 0x40005868;
wDev_DiscardFrame = 0x40005874;
wDev_GetNoiseFloor = 0x40005880;
wDev_IndicateAmpdu = 0x4000588c;
wDev_IndicateFrame = 0x40005898;
/*wDev_IndicateFrame = 0x40005898;*/
wdev_bank_store = 0x400058a4;
wdev_bank_load = 0x400058b0;
wdev_mac_reg_load = 0x400058bc;
@@ -2032,7 +2032,7 @@ wdev_mac_wakeup = 0x400058ec;
wdev_mac_sleep = 0x400058f8;
hal_mac_is_dma_enable = 0x40005904;
/* wDev_ProcessFiq = 0x40005910; */
wDev_ProcessRxSucData = 0x4000591c;
/*wDev_ProcessRxSucData = 0x4000591c;*/
wdevProcessRxSucDataAll = 0x40005928;
wdev_csi_len_align = 0x40005934;
ppDequeueTxDone_Locked = 0x40005940;

View File

@@ -113,6 +113,40 @@ menu "Wi-Fi"
can deliver frames faster than WiFi layer can transmit. In these cases, we may run out of TX
buffers.
choice ESP_WIFI_MGMT_RX_BUFFER
prompt "Type of WiFi RX MGMT buffers"
default ESP_WIFI_STATIC_RX_MGMT_BUFFER
help
Select type of WiFi RX MGMT buffers:
If "Static" is selected, WiFi RX MGMT buffers are allocated when WiFi is initialized and released
when WiFi is de-initialized. The size of each static RX MGMT buffer is fixed to about 500 Bytes.
If "Dynamic" is selected, each WiFi RX MGMT buffer is allocated as needed when a MGMT data frame is
received. The MGMT buffer is freed after the MGMT data frame has been processed by the WiFi driver.
config ESP_WIFI_STATIC_RX_MGMT_BUFFER
bool "Static"
config ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER
bool "Dynamic"
endchoice
config ESP_WIFI_DYNAMIC_RX_MGMT_BUF
int
default 0 if ESP_WIFI_STATIC_RX_MGMT_BUFFER
default 1 if ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER
config ESP_WIFI_RX_MGMT_BUF_NUM_DEF
int "Max number of WiFi RX MGMT buffers"
range 1 10
default 5
help
Set the number of WiFi RX_MGMT buffers.
For Management buffers, the number of dynamic and static management buffers is the same.
In order to prevent memory fragmentation, the management buffer type should be set to static first.
config ESP_WIFI_CSI_ENABLED
bool "WiFi CSI(Channel State Information)"
depends on SOC_WIFI_CSI_SUPPORT

View File

@@ -264,7 +264,9 @@ esp_err_t esp_now_mod_peer(const esp_now_peer_info_t *peer);
* - ESP_OK: succeed
* - others: failed
*/
esp_err_t esp_wifi_config_espnow_rate(wifi_interface_t ifx, wifi_phy_rate_t rate);
esp_err_t esp_wifi_config_espnow_rate(wifi_interface_t ifx, wifi_phy_rate_t rate)
__attribute__((deprecated("This API can be only used when rate is non-HE rate, \
please use esp_now_set_peer_rate_config if you want full support of the rate.")));
/**
* @brief Set ESPNOW rate config for each peer

View File

@@ -235,10 +235,10 @@ typedef struct {
int64_t tx_start_time;
int64_t tx_seqno_time;
int64_t tx_muedca_time;
int64_t tx_max_muedca_time;
int64_t tx_min_muedca_time;
int64_t tx_tot_muedca_time;
int64_t muedca_times;
uint32_t tx_max_muedca_time;
uint32_t tx_min_muedca_time;
uint32_t tx_tot_muedca_time;
uint32_t muedca_times;
uint32_t tx_muedca_enable; /* count TX times within mu-timer working */
uint32_t collision;
uint32_t timeout;

View File

@@ -629,15 +629,23 @@ void esp_wifi_set_keep_alive_time(uint32_t keep_alive_time);
void esp_wifi_beacon_monitor_configure(wifi_beacon_monitor_config_t *config);
/**
* @brief Require WiFi to enable or disable Advanced DTIM sleep function
* @brief Set modem state mode to require WiFi to enable or disable Advanced DTIM sleep function
*
* @param light_sleep_enable: true for light sleep mode is enabled, false for light sleep mode is disabled.
* @param modem_state_enable: true for require WiFi to enable Advanced DTIM sleep function,
* @param require_modem_state: true for require WiFi to enable Advanced DTIM sleep function,
* false for require WiFi to disable Advanced DTIM sleep function.
* @return
* - ESP_OK: succeed
*/
void esp_wifi_internal_mac_sleep_configure(bool light_sleep_enable, bool modem_state_enable);
void esp_wifi_internal_modem_state_configure(bool require_modem_state);
/**
* @brief Set light sleep mode to require WiFi to enable or disable Advanced DTIM sleep function
*
* @param light_sleep_enable: true for light sleep mode is enabled, false for light sleep mode is disabled.
* @return
* - ESP_OK: succeed
*/
void esp_wifi_internal_light_sleep_configure(bool light_sleep_enable);
/**
* @brief Start Publishing a service in the NAN cluster

View File

@@ -100,6 +100,8 @@ typedef struct {
int tx_buf_type; /**< WiFi TX buffer type */
int static_tx_buf_num; /**< WiFi static TX buffer number */
int dynamic_tx_buf_num; /**< WiFi dynamic TX buffer number */
int rx_mgmt_buf_type; /**< WiFi RX MGMT buffer type */
int rx_mgmt_buf_num; /**< WiFi RX MGMT buffer number */
int cache_tx_buf_num; /**< WiFi TX cache buffer number */
int csi_enable; /**< WiFi channel state information enable flag */
int ampdu_rx_enable; /**< WiFi AMPDU RX feature enable flag */
@@ -135,6 +137,12 @@ typedef struct {
#define WIFI_DYNAMIC_TX_BUFFER_NUM 0
#endif
#ifdef CONFIG_ESP_WIFI_RX_MGMT_BUF_NUM_DEF
#define WIFI_RX_MGMT_BUF_NUM_DEF CONFIG_ESP_WIFI_RX_MGMT_BUF_NUM_DEF
#else
#define WIFI_RX_MGMT_BUF_NUM_DEF 0
#endif
#if CONFIG_ESP_WIFI_CSI_ENABLED
#define WIFI_CSI_ENABLED 1
#else
@@ -219,6 +227,8 @@ extern uint64_t g_wifi_feature_caps;
.tx_buf_type = CONFIG_ESP_WIFI_TX_BUFFER_TYPE,\
.static_tx_buf_num = WIFI_STATIC_TX_BUFFER_NUM,\
.dynamic_tx_buf_num = WIFI_DYNAMIC_TX_BUFFER_NUM,\
.rx_mgmt_buf_type = CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUF,\
.rx_mgmt_buf_num = WIFI_RX_MGMT_BUF_NUM_DEF,\
.cache_tx_buf_num = WIFI_CACHE_TX_BUFFER_NUM,\
.csi_enable = WIFI_CSI_ENABLED,\
.ampdu_rx_enable = WIFI_AMPDU_RX_ENABLED,\
@@ -1261,6 +1271,32 @@ esp_err_t esp_wifi_config_11b_rate(wifi_interface_t ifx, bool disable);
*/
esp_err_t esp_wifi_connectionless_module_set_wake_interval(uint16_t wake_interval);
/**
* @brief Request extra reference of Wi-Fi radio.
* Wi-Fi keep active state(RF opened) to be able to receive packets.
*
* @attention Please pair the use of `esp_wifi_force_wakeup_acquire` with `esp_wifi_force_wakeup_release`.
*
* @return
* - 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_t esp_wifi_force_wakeup_acquire(void);
/**
* @brief Release extra reference of Wi-Fi radio.
* Wi-Fi go to sleep state(RF closed) if no more use of radio.
*
* @attention Please pair the use of `esp_wifi_force_wakeup_acquire` with `esp_wifi_force_wakeup_release`.
*
* @return
* - 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_t esp_wifi_force_wakeup_release(void);
/**
* @brief configure country
*

View File

@@ -158,12 +158,11 @@ typedef struct {
unsigned : 15; /**< reserved */
unsigned : 2; /**< reserved */
unsigned noise_floor : 8; /**< the noise floor of the reception frame */
signed data_rssi : 8; /**< the RSSI of the DATA field */
unsigned : 8; /**< reserved */
unsigned : 8; /**< reserved */
unsigned channel : 4; /**< the primary channel */
unsigned second : 4; /**< the second channel if in HT40 */
unsigned : 24; /**< reserved */
unsigned : 8; /**< reserved */
unsigned : 8; /**< reserved */
unsigned : 32; /**< reserved */
unsigned : 32; /**< reserved */
unsigned : 2; /**< reserved */
unsigned : 4; /**< reserved */

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -167,6 +167,10 @@ esp_err_t esp_wifi_deinit(void)
#if CONFIG_MAC_BB_PD
esp_wifi_internal_set_mac_sleep(false);
esp_mac_bb_pd_mem_deinit();
#endif
#if CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
esp_wifi_internal_modem_state_configure(false);
esp_pm_unregister_skip_light_sleep_callback(sleep_modem_wifi_modem_state_skip_light_sleep);
#endif
esp_phy_modem_deinit();
@@ -231,12 +235,12 @@ esp_err_t esp_wifi_init(const wifi_init_config_t *config)
#endif
#if CONFIG_ESP_WIFI_SLP_IRAM_OPT
esp_pm_register_light_sleep_default_params_config_callback(esp_wifi_internal_update_light_sleep_default_params);
int min_freq_mhz = esp_pm_impl_get_cpu_freq(PM_MODE_LIGHT_SLEEP);
int max_freq_mhz = esp_pm_impl_get_cpu_freq(PM_MODE_CPU_MAX);
esp_wifi_internal_update_light_sleep_default_params(min_freq_mhz, max_freq_mhz);
esp_pm_register_light_sleep_default_params_config_callback(esp_wifi_internal_update_light_sleep_default_params);
uint32_t sleep_delay_us = CONFIG_ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME * 1000;
esp_wifi_set_sleep_delay_time(sleep_delay_us);
@@ -291,6 +295,12 @@ esp_err_t esp_wifi_init(const wifi_init_config_t *config)
esp_wifi_internal_set_mac_sleep(true);
#endif
esp_phy_modem_init();
#if CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
if (sleep_modem_wifi_modem_state_enabled()) {
esp_pm_register_skip_light_sleep_callback(sleep_modem_wifi_modem_state_skip_light_sleep);
esp_wifi_internal_modem_state_configure(true); /* require WiFi to enable automatically receives the beacon */
}
#endif
#if CONFIG_IDF_TARGET_ESP32
s_wifi_mac_time_update_cb = esp_wifi_internal_update_mac_time;
#endif

View File

@@ -22,6 +22,7 @@
#include "esp_wnm.h"
#include "rsn_supp/wpa_i.h"
#include "rsn_supp/wpa.h"
#include "esp_private/wifi.h"
/* Utility Functions */
esp_err_t esp_supplicant_str_to_mac(const char *str, uint8_t dest[6])
@@ -652,6 +653,8 @@ static uint8_t get_extended_caps_ie(uint8_t *ie, size_t len)
uint8_t ext_caps_ie[5] = {0};
uint8_t ext_caps_ie_len = 3;
uint8_t *pos = ext_caps_ie;
wifi_ioctl_config_t cfg = {0};
esp_err_t err = 0;
if (!esp_wifi_is_btm_enabled_internal(WIFI_IF_STA)) {
return 0;
@@ -659,8 +662,14 @@ static uint8_t get_extended_caps_ie(uint8_t *ie, size_t len)
*pos++ = WLAN_EID_EXT_CAPAB;
*pos++ = ext_caps_ie_len;
*pos++ = 0;
*pos++ = 0;
err = esp_wifi_internal_ioctl(WIFI_IOCTL_GET_STA_HT2040_COEX, &cfg);
if (err == ESP_OK && cfg.data.ht2040_coex.enable) {
*pos++ |= BIT(WLAN_EXT_CAPAB_20_40_COEX);
} else {
*pos++ = 0;
}
*pos ++ = 0;
#define CAPAB_BSS_TRANSITION BIT(3)
*pos |= CAPAB_BSS_TRANSITION;
#undef CAPAB_BSS_TRANSITION
@@ -872,9 +881,6 @@ void esp_set_assoc_ie(uint8_t *bssid, const u8 *ies, size_t ies_len, bool mdie)
}
pos = ie;
#ifdef CONFIG_IEEE80211KV
ie_len = get_extended_caps_ie(pos, len);
pos += ie_len;
len -= ie_len;
ie_len = get_rm_enabled_ie(pos, len);
pos += ie_len;
len -= ie_len;

View File

@@ -261,6 +261,7 @@
#define WLAN_RSNX_CAPAB_SAE_H2E 5
#define WLAN_RSNX_CAPAB_SAE_PK 6
#define WLAN_EXT_CAPAB_20_40_COEX 0
#define WLAN_EXT_CAPAB_BSS_TRANSITION 19
/* Action frame categories (IEEE Std 802.11-2016, 9.4.1.11, Table 9-76) */

View File

@@ -210,7 +210,7 @@ int wifi_cmd_get_tx_statistics(int argc, char **argv)
tx_stats.collision, tx_stats.timeout);
float tot_rtt_ms = (float) tx_stats.tx_tot_rtt / (float) 1000;
printf("(test)aci:%" PRIu8 ", seqno_rtt[%" PRIu32 ",%" PRIu32 "], hw_rtt[%" PRIu32 ", %" PRIu32 "], muedca[enable:%" PRIu32 ", times:%" PRIi64 ", %.2f, %.2f, tot:%.2f], avg:%.3f ms, tot:%.3f secs\n",
printf("(test)aci:%" PRIu8 ", seqno_rtt[%" PRIu32 ",%" PRIu32 "], hw_rtt[%" PRIu32 ", %" PRIu32 "], muedca[enable:%" PRIu32 ", times:%" PRIu32 ", %.2f, %.2f, tot:%.2f], avg:%.3f ms, tot:%.3f secs\n",
i,
tx_stats.tx_seq_min_rtt,
tx_stats.tx_seq_max_rtt,