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 d8599406a8
commit da39fcebc4
5 changed files with 19 additions and 23 deletions

View File

@ -17,16 +17,12 @@ config SPIRAM_IGNORE_NOTFOUND
help help
Normally, if psram initialization is enabled during compile time but not found at runtime, it 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 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 but no PSRAM will be available. In particular, it is important to note that when SPIRAM_IGNORE_NOTFOUND
and may need to be corrected manually. SPIRAM_TRY_ALLOCATE_WIFI_LWIP will affect some LWIP and WiFi buffer is enabled, some WIFI related configs will be set to the default value used when SPIRAM is disabled.
default values and range values. Enable SPIRAM_TRY_ALLOCATE_WIFI_LWIP, ESP_WIFI_AMSDU_TX_ENABLED, It can be assumed that by enabling this config, WIFI and LWIP will assume that the current chip does not
ESP_WIFI_CACHE_TX_BUFFER_NUM and use static WiFi Tx buffer may cause potential memory exhaustion issues. have SPIRAM. SPIRAM_TRY_ALLOCATE_WIFI_LWIP will not work, buffers in WIFI and LWIP will be set to smaller
Suggest disable SPIRAM_TRY_ALLOCATE_WIFI_LWIP. ranges and default values. WIFI_CACHE_TX_BUFFER_NUM and ESP_WIFI_AMSDU_TX_ENABLED will be disabled,
Suggest disable ESP_WIFI_AMSDU_TX_ENABLED. ESP_WIFI_TX_BUFFER will be set to ESP_WIFI_DYNAMIC_TX_BUFFER.
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 choice SPIRAM_USE
prompt "SPI RAM access method" prompt "SPI RAM access method"

View File

@ -28,8 +28,8 @@ menu "Wi-Fi"
int "Max number of WiFi static RX buffers" int "Max number of WiFi static RX buffers"
range 2 25 if !SOC_WIFI_HE_SUPPORT range 2 25 if !SOC_WIFI_HE_SUPPORT
range 2 128 if SOC_WIFI_HE_SUPPORT range 2 128 if SOC_WIFI_HE_SUPPORT
default 10 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 default 16 if (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
help help
Set the number of WiFi static RX buffers. Each buffer takes approximately 1.6KB of RAM. 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 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" bool "Static"
config ESP_WIFI_DYNAMIC_TX_BUFFER config ESP_WIFI_DYNAMIC_TX_BUFFER
bool "Dynamic" bool "Dynamic"
depends on !SPIRAM_USE_MALLOC depends on !(SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
endchoice endchoice
config ESP_WIFI_TX_BUFFER_TYPE config ESP_WIFI_TX_BUFFER_TYPE
@ -105,8 +105,8 @@ menu "Wi-Fi"
config ESP_WIFI_CACHE_TX_BUFFER_NUM config ESP_WIFI_CACHE_TX_BUFFER_NUM
int "Max number of WiFi cache TX buffers" int "Max number of WiFi cache TX buffers"
depends on SPIRAM depends on (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
range 16 128 range 0 128
default 32 default 32
help help
Set the number of WiFi cache TX buffer number. Set the number of WiFi cache TX buffer number.
@ -203,8 +203,8 @@ menu "Wi-Fi"
depends on ESP_WIFI_AMPDU_RX_ENABLED depends on ESP_WIFI_AMPDU_RX_ENABLED
range 2 32 if !SOC_WIFI_HE_SUPPORT range 2 32 if !SOC_WIFI_HE_SUPPORT
range 2 64 if SOC_WIFI_HE_SUPPORT range 2 64 if SOC_WIFI_HE_SUPPORT
default 6 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 default 16 if (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
help help
Set the size of WiFi Block Ack RX window. Generally a bigger value means higher throughput and better 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 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 config ESP_WIFI_AMSDU_TX_ENABLED
bool "WiFi AMSDU TX" bool "WiFi AMSDU TX"
depends on SPIRAM depends on (ESP_WIFI_CACHE_TX_BUFFER_NUM >= 2)
default n default n
help help
Select this option to enable AMSDU TX feature Select this option to enable AMSDU TX feature

View File

@ -129,7 +129,7 @@ typedef struct {
#define WIFI_STATIC_TX_BUFFER_NUM 0 #define WIFI_STATIC_TX_BUFFER_NUM 0
#endif #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 #define WIFI_CACHE_TX_BUFFER_NUM CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM
#else #else
#define WIFI_CACHE_TX_BUFFER_NUM 0 #define WIFI_CACHE_TX_BUFFER_NUM 0

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) static esp_err_t wifi_transmit_wrap(void *h, void *buffer, size_t len, void *netstack_buf)
{ {
wifi_netif_driver_t driver = h; 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); return esp_wifi_internal_tx_by_ref(driver->wifi_if, buffer, len, netstack_buf);
#else #else
return esp_wifi_internal_tx(driver->wifi_if, buffer, len); return esp_wifi_internal_tx(driver->wifi_if, buffer, len);

View File

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