feat(wifi): fix SPIRAM_IGNORE_NOTFOUND releated config

This commit is contained in:
wangtao@espressif.com 2024-08-28 13:33:47 +08:00
parent dcc31f89f7
commit e65acc9510
6 changed files with 20 additions and 24 deletions

View File

@ -17,16 +17,12 @@ config SPIRAM_IGNORE_NOTFOUND
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. 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.
but no PSRAM will be available. In particular, it is important to note that when SPIRAM_IGNORE_NOTFOUND
is enabled, some WIFI related configs will be set to the default value used when SPIRAM is disabled.
It can be assumed that by enabling this config, WIFI and LWIP will assume that the current chip does not
have SPIRAM. SPIRAM_TRY_ALLOCATE_WIFI_LWIP will not work, buffers in WIFI and LWIP will be set to smaller
ranges and default values. WIFI_CACHE_TX_BUFFER_NUM and ESP_WIFI_AMSDU_TX_ENABLED will be disabled,
ESP_WIFI_TX_BUFFER will be set to ESP_WIFI_DYNAMIC_TX_BUFFER.
choice SPIRAM_USE
prompt "SPI RAM access method"

View File

@ -28,8 +28,8 @@ menu "Wi-Fi"
int "Max number of WiFi static RX buffers"
range 2 25 if !SOC_WIFI_HE_SUPPORT
range 2 128 if SOC_WIFI_HE_SUPPORT
default 10 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP
default 16 if SPIRAM_TRY_ALLOCATE_WIFI_LWIP
default 10 if !(SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
default 16 if (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
help
Set the number of WiFi static RX buffers. Each buffer takes approximately 1.6KB of RAM.
The static rx buffers are allocated when esp_wifi_init is called, they are not freed
@ -80,7 +80,7 @@ menu "Wi-Fi"
bool "Static"
config ESP_WIFI_DYNAMIC_TX_BUFFER
bool "Dynamic"
depends on !SPIRAM_USE_MALLOC
depends on !(SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
endchoice
config ESP_WIFI_TX_BUFFER_TYPE
@ -105,8 +105,8 @@ menu "Wi-Fi"
config ESP_WIFI_CACHE_TX_BUFFER_NUM
int "Max number of WiFi cache TX buffers"
depends on SPIRAM
range 16 128
depends on (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
range 0 128
default 32
help
Set the number of WiFi cache TX buffer number.
@ -203,8 +203,8 @@ menu "Wi-Fi"
depends on ESP_WIFI_AMPDU_RX_ENABLED
range 2 32 if !SOC_WIFI_HE_SUPPORT
range 2 64 if SOC_WIFI_HE_SUPPORT
default 6 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP
default 16 if SPIRAM_TRY_ALLOCATE_WIFI_LWIP
default 6 if !(SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
default 16 if (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
help
Set the size of WiFi Block Ack RX window. Generally a bigger value means higher throughput and better
compatibility but more memory. Most of time we should NOT change the default value unless special
@ -215,7 +215,7 @@ menu "Wi-Fi"
config ESP_WIFI_AMSDU_TX_ENABLED
bool "WiFi AMSDU TX"
depends on SPIRAM
depends on (ESP_WIFI_CACHE_TX_BUFFER_NUM >= 2)
default n
help
Select this option to enable AMSDU TX feature

View File

@ -129,7 +129,7 @@ typedef struct {
#define WIFI_STATIC_TX_BUFFER_NUM 0
#endif
#if CONFIG_SPIRAM
#ifdef CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM
#define WIFI_CACHE_TX_BUFFER_NUM CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM
#else
#define WIFI_CACHE_TX_BUFFER_NUM 0

@ -1 +1 @@
Subproject commit e9aa24f016bcab62a9454f8d69db85f949eacc57
Subproject commit 02217f5aed73e6296fbb12137a1c36b207b0dab5

View File

@ -69,7 +69,7 @@ static esp_err_t wifi_transmit(void *h, void *buffer, size_t len)
static esp_err_t wifi_transmit_wrap(void *h, void *buffer, size_t len, void *netstack_buf)
{
wifi_netif_driver_t driver = h;
#if CONFIG_SPIRAM
#if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !CONFIG_SPIRAM_IGNORE_NOTFOUND
return esp_wifi_internal_tx_by_ref(driver->wifi_if, buffer, len, netstack_buf);
#else
return esp_wifi_internal_tx(driver->wifi_if, buffer, len);

View File

@ -744,8 +744,8 @@ menu "LWIP"
int "The maximum number of pbufs queued on OOSEQ per pcb"
depends on LWIP_TCP_QUEUE_OOSEQ
range 0 12
default 4 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP
default 0 if SPIRAM_TRY_ALLOCATE_WIFI_LWIP
default 4 if !(SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
default 0 if (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
help
If LWIP_TCP_OOSEQ_MAX_PBUFS = 0, TCP will not control the number of OOSEQ pbufs.
@ -801,7 +801,7 @@ menu "LWIP"
config LWIP_WND_SCALE
bool "Support TCP window scale"
depends on SPIRAM_TRY_ALLOCATE_WIFI_LWIP
depends on (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
default n
help
Enable this feature to support TCP window scaling.