mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(wifi): fix some wifi bugs
1. support dump ACK frame for CSI 2. fix psram enabled but initialized fail issue
This commit is contained in:
parent
93d1c3125e
commit
be1be3c64a
@ -13,11 +13,20 @@ config SPIRAM_BOOT_INIT
|
||||
config SPIRAM_IGNORE_NOTFOUND
|
||||
bool "Ignore PSRAM when not found"
|
||||
default "n"
|
||||
depends on SPIRAM_BOOT_INIT && !SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
|
||||
depends on SPIRAM_BOOT_INIT && !SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY && !SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY
|
||||
help
|
||||
Normally, if psram initialization is enabled during compile time but not found at runtime, it
|
||||
is seen as an error making the CPU panic. If this is enabled, booting will complete
|
||||
but no PSRAM will be available.
|
||||
but no PSRAM will be available. If PSRAM failed to initialize, the following configs may be affected
|
||||
and may need to be corrected manually. SPIRAM_TRY_ALLOCATE_WIFI_LWIP will affect some LWIP and WiFi buffer
|
||||
default values and range values. Enable SPIRAM_TRY_ALLOCATE_WIFI_LWIP, ESP_WIFI_AMSDU_TX_ENABLED,
|
||||
ESP_WIFI_CACHE_TX_BUFFER_NUM and use static WiFi Tx buffer may cause potential memory exhaustion issues.
|
||||
Suggest disable SPIRAM_TRY_ALLOCATE_WIFI_LWIP.
|
||||
Suggest disable ESP_WIFI_AMSDU_TX_ENABLED.
|
||||
Suggest disable ESP_WIFI_CACHE_TX_BUFFER_NUM, need clear CONFIG_FEATURE_CACHE_TX_BUF_BIT of
|
||||
config->feature_caps.
|
||||
Suggest change ESP_WIFI_TX_BUFFER from static to dynamic. Also suggest to adjust some buffer numbers to the
|
||||
values used without PSRAM case. Such as, ESP_WIFI_STATIC_TX_BUFFER_NUM, ESP_WIFI_DYNAMIC_TX_BUFFER_NUM.
|
||||
|
||||
choice SPIRAM_USE
|
||||
prompt "SPI RAM access method"
|
||||
|
@ -58,4 +58,8 @@ if(CONFIG_ESP32_WIFI_ENABLED)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(CONFIG_SPIRAM)
|
||||
idf_component_optional_requires(PRIVATE esp_psram)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -176,7 +176,6 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
|
||||
extern uint64_t g_wifi_feature_caps;
|
||||
|
||||
#define WIFI_INIT_CONFIG_MAGIC 0x1F2F3F4F
|
||||
|
||||
@ -210,11 +209,41 @@ extern uint64_t g_wifi_feature_caps;
|
||||
#define WIFI_STA_DISCONNECTED_PM_ENABLED false
|
||||
#endif
|
||||
|
||||
#define CONFIG_FEATURE_WPA3_SAE_BIT (1<<0)
|
||||
#if CONFIG_ESP_WIFI_ENABLE_WPA3_SAE
|
||||
#define WIFI_ENABLE_WPA3_SAE (1<<0)
|
||||
#else
|
||||
#define WIFI_ENABLE_WPA3_SAE 0
|
||||
#endif
|
||||
|
||||
#if CONFIG_SPIRAM
|
||||
#define WIFI_ENABLE_SPIRAM (1<<1)
|
||||
#else
|
||||
#define WIFI_ENABLE_SPIRAM 0
|
||||
#endif
|
||||
|
||||
#if CONFIG_ESP_WIFI_FTM_INITIATOR_SUPPORT
|
||||
#define WIFI_FTM_INITIATOR (1<<2)
|
||||
#else
|
||||
#define WIFI_FTM_INITIATOR 0
|
||||
#endif
|
||||
|
||||
#if CONFIG_ESP_WIFI_FTM_RESPONDER_SUPPORT
|
||||
#define WIFI_FTM_RESPONDER (1<<3)
|
||||
#else
|
||||
#define WIFI_FTM_RESPONDER 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)
|
||||
#define CONFIG_FEATURE_FTM_RESPONDER_BIT (1<<3)
|
||||
|
||||
/* Set additional WiFi features and capabilities */
|
||||
#define WIFI_FEATURE_CAPS (WIFI_ENABLE_WPA3_SAE | \
|
||||
WIFI_ENABLE_SPIRAM | \
|
||||
WIFI_FTM_INITIATOR | \
|
||||
WIFI_FTM_RESPONDER)
|
||||
|
||||
#define WIFI_INIT_CONFIG_DEFAULT() { \
|
||||
.osi_funcs = &g_wifi_osi_funcs, \
|
||||
.wpa_crypto_funcs = g_wifi_default_wpa_crypto_funcs, \
|
||||
@ -236,7 +265,7 @@ extern uint64_t g_wifi_feature_caps;
|
||||
.wifi_task_core_id = WIFI_TASK_CORE_ID,\
|
||||
.beacon_max_len = WIFI_SOFTAP_BEACON_MAX_LEN, \
|
||||
.mgmt_sbuf_num = WIFI_MGMT_SBUF_NUM, \
|
||||
.feature_caps = g_wifi_feature_caps, \
|
||||
.feature_caps = WIFI_FEATURE_CAPS, \
|
||||
.sta_disconnected_pm = WIFI_STA_DISCONNECTED_PM_ENABLED, \
|
||||
.espnow_max_encrypt_num = CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM, \
|
||||
.magic = WIFI_INIT_CONFIG_MAGIC\
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit c85bf2a39e9591533766be0f7409c02cd662946c
|
||||
Subproject commit afef70fff271361f8d0aef3c54b4515e2f314e1c
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -18,6 +18,9 @@
|
||||
#include "esp_coexist_internal.h"
|
||||
#include "esp_phy_init.h"
|
||||
#include "phy.h"
|
||||
#if __has_include("esp_psram.h")
|
||||
#include "esp_psram.h"
|
||||
#endif
|
||||
|
||||
static bool s_wifi_inited = false;
|
||||
|
||||
@ -41,23 +44,6 @@ static esp_pm_lock_handle_t s_wifi_modem_sleep_lock;
|
||||
wifi_mac_time_update_cb_t s_wifi_mac_time_update_cb = NULL;
|
||||
#endif
|
||||
|
||||
/* Set additional WiFi features and capabilities */
|
||||
uint64_t g_wifi_feature_caps =
|
||||
#if CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE
|
||||
CONFIG_FEATURE_WPA3_SAE_BIT |
|
||||
#endif
|
||||
#if CONFIG_SPIRAM
|
||||
CONFIG_FEATURE_CACHE_TX_BUF_BIT |
|
||||
#endif
|
||||
#if CONFIG_ESP_WIFI_FTM_INITIATOR_SUPPORT
|
||||
CONFIG_FEATURE_FTM_INITIATOR_BIT |
|
||||
#endif
|
||||
#if CONFIG_ESP_WIFI_FTM_RESPONDER_SUPPORT
|
||||
CONFIG_FEATURE_FTM_RESPONDER_BIT |
|
||||
#endif
|
||||
0;
|
||||
|
||||
|
||||
static const char* TAG = "wifi_init";
|
||||
|
||||
static void __attribute__((constructor)) s_set_default_wifi_log_level(void)
|
||||
@ -197,17 +183,46 @@ static void esp_wifi_config_info(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_SPIRAM
|
||||
static esp_err_t esp_wifi_psram_check(const wifi_init_config_t *config)
|
||||
{
|
||||
#if CONFIG_SPIRAM_IGNORE_NOTFOUND
|
||||
if (!esp_psram_is_initialized()) {
|
||||
if (config->feature_caps & CONFIG_FEATURE_CACHE_TX_BUF_BIT) {
|
||||
ESP_LOGW(TAG, "WiFi cache TX buffers should be disabled when initialize SPIRAM failed");
|
||||
}
|
||||
if (config->tx_buf_type == 0) {
|
||||
ESP_LOGW(TAG, "TX buffers type should be changed from static to dynamic when initialize SPIRAM failed");
|
||||
}
|
||||
#ifdef CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP
|
||||
ESP_LOGW(TAG, "WiFi/LWIP prefer SPIRAM should be disabled when initialize SPIRAM failed");
|
||||
#endif
|
||||
if (config->amsdu_tx_enable) {
|
||||
ESP_LOGW(TAG, "WiFi AMSDU TX should be disabled when initialize SPIRAM failed");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if ((config->feature_caps & CONFIG_FEATURE_CACHE_TX_BUF_BIT) && (WIFI_CACHE_TX_BUFFER_NUM == 0)) {
|
||||
ESP_LOGE(TAG, "Number of WiFi cache TX buffers should not equal 0 when enable SPIRAM");
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
esp_err_t esp_wifi_init(const wifi_init_config_t *config)
|
||||
{
|
||||
if (s_wifi_inited) {
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
if ((config->feature_caps & CONFIG_FEATURE_CACHE_TX_BUF_BIT) && (WIFI_CACHE_TX_BUFFER_NUM == 0))
|
||||
{
|
||||
ESP_LOGE(TAG, "Number of WiFi cache TX buffers should not equal 0 when enable SPIRAM");
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
esp_err_t result = ESP_OK;
|
||||
#ifdef CONFIG_SPIRAM
|
||||
result = esp_wifi_psram_check(config);
|
||||
if (result != ESP_OK) {
|
||||
return result;
|
||||
}
|
||||
#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);
|
||||
@ -261,7 +276,7 @@ esp_err_t esp_wifi_init(const wifi_init_config_t *config)
|
||||
#endif
|
||||
esp_wifi_set_log_level();
|
||||
esp_wifi_power_domain_on();
|
||||
esp_err_t result = esp_wifi_init_internal(config);
|
||||
result = esp_wifi_init_internal(config);
|
||||
if (result == ESP_OK) {
|
||||
#if CONFIG_MAC_BB_PD
|
||||
esp_mac_bb_pd_mem_init();
|
||||
|
Loading…
Reference in New Issue
Block a user