Skip to content

Commit 406dfc1

Browse files
author
Wang Tao
committed
Merge branch 'feat/wifi_support_dynamic_tx_when_psram_enable' into 'master'
feat(wifi): Fix configuration related to SPIRAM_IGNORE_NOTFOUND Closes WIFIBUG-701和WIFIBUG-718 See merge request espressif/esp-idf!33138
2 parents 190939e + e65acc9 commit 406dfc1

File tree

6 files changed

+20
-24
lines changed

6 files changed

+20
-24
lines changed

components/esp_psram/Kconfig.spiram.common

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@ config SPIRAM_IGNORE_NOTFOUND
1717
help
1818
Normally, if psram initialization is enabled during compile time but not found at runtime, it
1919
is seen as an error making the CPU panic. If this is enabled, booting will complete
20-
but no PSRAM will be available. If PSRAM failed to initialize, the following configs may be affected
21-
and may need to be corrected manually. SPIRAM_TRY_ALLOCATE_WIFI_LWIP will affect some LWIP and WiFi buffer
22-
default values and range values. Enable SPIRAM_TRY_ALLOCATE_WIFI_LWIP, ESP_WIFI_AMSDU_TX_ENABLED,
23-
ESP_WIFI_CACHE_TX_BUFFER_NUM and use static WiFi Tx buffer may cause potential memory exhaustion issues.
24-
Suggest disable SPIRAM_TRY_ALLOCATE_WIFI_LWIP.
25-
Suggest disable ESP_WIFI_AMSDU_TX_ENABLED.
26-
Suggest disable ESP_WIFI_CACHE_TX_BUFFER_NUM,
27-
need clear CONFIG_FEATURE_CACHE_TX_BUF_BIT of config->feature_caps.
28-
Suggest change ESP_WIFI_TX_BUFFER from static to dynamic. Also suggest to adjust some buffer numbers to the
29-
values used without PSRAM case. Such as, ESP_WIFI_STATIC_TX_BUFFER_NUM, ESP_WIFI_DYNAMIC_TX_BUFFER_NUM.
20+
but no PSRAM will be available. In particular, it is important to note that when SPIRAM_IGNORE_NOTFOUND
21+
is enabled, some WIFI related configs will be set to the default value used when SPIRAM is disabled.
22+
It can be assumed that by enabling this config, WIFI and LWIP will assume that the current chip does not
23+
have SPIRAM. SPIRAM_TRY_ALLOCATE_WIFI_LWIP will not work, buffers in WIFI and LWIP will be set to smaller
24+
ranges and default values. WIFI_CACHE_TX_BUFFER_NUM and ESP_WIFI_AMSDU_TX_ENABLED will be disabled,
25+
ESP_WIFI_TX_BUFFER will be set to ESP_WIFI_DYNAMIC_TX_BUFFER.
3026

3127
choice SPIRAM_USE
3228
prompt "SPI RAM access method"

components/esp_wifi/Kconfig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ menu "Wi-Fi"
2828
int "Max number of WiFi static RX buffers"
2929
range 2 25 if !SOC_WIFI_HE_SUPPORT
3030
range 2 128 if SOC_WIFI_HE_SUPPORT
31-
default 10 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP
32-
default 16 if SPIRAM_TRY_ALLOCATE_WIFI_LWIP
31+
default 10 if !(SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
32+
default 16 if (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
3333
help
3434
Set the number of WiFi static RX buffers. Each buffer takes approximately 1.6KB of RAM.
3535
The static rx buffers are allocated when esp_wifi_init is called, they are not freed
@@ -80,7 +80,7 @@ menu "Wi-Fi"
8080
bool "Static"
8181
config ESP_WIFI_DYNAMIC_TX_BUFFER
8282
bool "Dynamic"
83-
depends on !SPIRAM_USE_MALLOC
83+
depends on !(SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
8484
endchoice
8585

8686
config ESP_WIFI_TX_BUFFER_TYPE
@@ -105,8 +105,8 @@ menu "Wi-Fi"
105105

106106
config ESP_WIFI_CACHE_TX_BUFFER_NUM
107107
int "Max number of WiFi cache TX buffers"
108-
depends on SPIRAM
109-
range 16 128
108+
depends on (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
109+
range 0 128
110110
default 32
111111
help
112112
Set the number of WiFi cache TX buffer number.
@@ -203,8 +203,8 @@ menu "Wi-Fi"
203203
depends on ESP_WIFI_AMPDU_RX_ENABLED
204204
range 2 32 if !SOC_WIFI_HE_SUPPORT
205205
range 2 64 if SOC_WIFI_HE_SUPPORT
206-
default 6 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP
207-
default 16 if SPIRAM_TRY_ALLOCATE_WIFI_LWIP
206+
default 6 if !(SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
207+
default 16 if (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
208208
help
209209
Set the size of WiFi Block Ack RX window. Generally a bigger value means higher throughput and better
210210
compatibility but more memory. Most of time we should NOT change the default value unless special
@@ -215,7 +215,7 @@ menu "Wi-Fi"
215215

216216
config ESP_WIFI_AMSDU_TX_ENABLED
217217
bool "WiFi AMSDU TX"
218-
depends on SPIRAM
218+
depends on (ESP_WIFI_CACHE_TX_BUFFER_NUM >= 2)
219219
default n
220220
help
221221
Select this option to enable AMSDU TX feature

components/esp_wifi/include/esp_wifi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ typedef struct {
129129
#define WIFI_STATIC_TX_BUFFER_NUM 0
130130
#endif
131131

132-
#if CONFIG_SPIRAM
132+
#ifdef CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM
133133
#define WIFI_CACHE_TX_BUFFER_NUM CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM
134134
#else
135135
#define WIFI_CACHE_TX_BUFFER_NUM 0

components/esp_wifi/src/wifi_netif.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static esp_err_t wifi_transmit(void *h, void *buffer, size_t len)
6969
static esp_err_t wifi_transmit_wrap(void *h, void *buffer, size_t len, void *netstack_buf)
7070
{
7171
wifi_netif_driver_t driver = h;
72-
#if CONFIG_SPIRAM
72+
#if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !CONFIG_SPIRAM_IGNORE_NOTFOUND
7373
return esp_wifi_internal_tx_by_ref(driver->wifi_if, buffer, len, netstack_buf);
7474
#else
7575
return esp_wifi_internal_tx(driver->wifi_if, buffer, len);

components/lwip/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -744,8 +744,8 @@ menu "LWIP"
744744
int "The maximum number of pbufs queued on OOSEQ per pcb"
745745
depends on LWIP_TCP_QUEUE_OOSEQ
746746
range 0 12
747-
default 4 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP
748-
default 0 if SPIRAM_TRY_ALLOCATE_WIFI_LWIP
747+
default 4 if !(SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
748+
default 0 if (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
749749
help
750750
If LWIP_TCP_OOSEQ_MAX_PBUFS = 0, TCP will not control the number of OOSEQ pbufs.
751751

@@ -801,7 +801,7 @@ menu "LWIP"
801801

802802
config LWIP_WND_SCALE
803803
bool "Support TCP window scale"
804-
depends on SPIRAM_TRY_ALLOCATE_WIFI_LWIP
804+
depends on (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
805805
default n
806806
help
807807
Enable this feature to support TCP window scaling.

0 commit comments

Comments
 (0)