Skip to content

Commit 6ee30b3

Browse files
author
Jiang Jiang Jian
committed
Merge branch 'feat/backport_some_feature_and_bugfix_v51' into 'release/v5.1'
Feat/backport some feature and bugfix v51 See merge request espressif/esp-idf!36139
2 parents fa1004d + e2ed57d commit 6ee30b3

File tree

8 files changed

+28
-32
lines changed

8 files changed

+28
-32
lines changed

Diff for: components/esp_psram/Kconfig.spiram.common

+6-10
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, need clear CONFIG_FEATURE_CACHE_TX_BUF_BIT of
27-
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"

Diff for: components/esp_rom/esp32c2/ld/esp32c2.rom.eco4.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ ieee80211_send_nulldata = 0x40002110;
111111
//ieee80211_mgmt_output = 0x40002118;
112112
//ieee80211_send_deauth_no_bss = 0x40002120;
113113
//ieee80211_tx_mgt_cb = 0x4000212c;
114-
sta_rx_csa = 0x40002134;
114+
//sta_rx_csa = 0x40002134;
115115
sta_send_sa_query_req = 0x40002138;
116116
sta_send_sa_query_resp = 0x4000213c;
117117
sta_recv_sa_query_req = 0x40002140;

Diff for: components/esp_wifi/Kconfig

+9-9
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ menu "Wi-Fi"
1111
int "Max number of WiFi static RX buffers"
1212
range 2 25 if !SOC_WIFI_HE_SUPPORT
1313
range 2 128 if SOC_WIFI_HE_SUPPORT
14-
default 10 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP
15-
default 16 if SPIRAM_TRY_ALLOCATE_WIFI_LWIP
14+
default 10 if !(SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
15+
default 16 if (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
1616
help
1717
Set the number of WiFi static RX buffers. Each buffer takes approximately 1.6KB of RAM.
1818
The static rx buffers are allocated when esp_wifi_init is called, they are not freed
@@ -63,7 +63,7 @@ menu "Wi-Fi"
6363
bool "Static"
6464
config ESP_WIFI_DYNAMIC_TX_BUFFER
6565
bool "Dynamic"
66-
depends on !SPIRAM_USE_MALLOC
66+
depends on !(SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
6767
endchoice
6868

6969
config ESP_WIFI_TX_BUFFER_TYPE
@@ -88,8 +88,8 @@ menu "Wi-Fi"
8888

8989
config ESP_WIFI_CACHE_TX_BUFFER_NUM
9090
int "Max number of WiFi cache TX buffers"
91-
depends on SPIRAM
92-
range 16 128
91+
depends on (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
92+
range 0 128
9393
default 32
9494
help
9595
Set the number of WiFi cache TX buffer number.
@@ -186,19 +186,19 @@ menu "Wi-Fi"
186186
depends on ESP_WIFI_AMPDU_RX_ENABLED
187187
range 2 32 if !SOC_WIFI_HE_SUPPORT
188188
range 2 64 if SOC_WIFI_HE_SUPPORT
189-
default 6 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP
190-
default 16 if SPIRAM_TRY_ALLOCATE_WIFI_LWIP
189+
default 6 if !(SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
190+
default 16 if (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
191191
help
192192
Set the size of WiFi Block Ack RX window. Generally a bigger value means higher throughput and better
193193
compatibility but more memory. Most of time we should NOT change the default value unless special
194194
reason, e.g. test the maximum UDP RX throughput with iperf etc. For iperf test in shieldbox, the
195-
recommended value is 9~12. If PSRAM is used and WiFi memory is prefered to allocat in PSRAM first,
195+
recommended value is 9~12. If PSRAM is used and WiFi memory is preferred to allocate in PSRAM first,
196196
the default and minimum value should be 16 to achieve better throughput and compatibility with both
197197
stations and APs.
198198

199199
config ESP_WIFI_AMSDU_TX_ENABLED
200200
bool "WiFi AMSDU TX"
201-
depends on SPIRAM
201+
depends on (ESP_WIFI_CACHE_TX_BUFFER_NUM >= 2)
202202
default n
203203
help
204204
Select this option to enable AMSDU TX feature

Diff for: components/esp_wifi/include/esp_wifi.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ typedef struct {
125125
#define WIFI_STATIC_TX_BUFFER_NUM 0
126126
#endif
127127

128-
#if CONFIG_SPIRAM
128+
#ifdef CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM
129129
#define WIFI_CACHE_TX_BUFFER_NUM CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM
130130
#else
131131
#define WIFI_CACHE_TX_BUFFER_NUM 0
@@ -219,10 +219,10 @@ extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
219219
#define WIFI_ENABLE_WPA3_SAE 0
220220
#endif
221221

222-
#if CONFIG_SPIRAM
223-
#define WIFI_ENABLE_SPIRAM (1<<1)
222+
#if WIFI_CACHE_TX_BUFFER_NUM > 0
223+
#define WIFI_ENABLE_CACHE_TX_BUFFER (1<<1)
224224
#else
225-
#define WIFI_ENABLE_SPIRAM 0
225+
#define WIFI_ENABLE_CACHE_TX_BUFFER 0
226226
#endif
227227

228228
#if CONFIG_ESP_WIFI_FTM_INITIATOR_SUPPORT
@@ -272,7 +272,7 @@ extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
272272

273273
/* Set additional WiFi features and capabilities */
274274
#define WIFI_FEATURE_CAPS (WIFI_ENABLE_WPA3_SAE | \
275-
WIFI_ENABLE_SPIRAM | \
275+
WIFI_ENABLE_CACHE_TX_BUFFER | \
276276
WIFI_FTM_INITIATOR | \
277277
WIFI_FTM_RESPONDER | \
278278
WIFI_ENABLE_GCMP | \

Diff for: components/esp_wifi/include/esp_wifi_types.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ typedef struct {
296296
uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */
297297
uint8_t max_connection; /**< Max number of stations allowed to connect in */
298298
uint16_t beacon_interval; /**< Beacon interval which should be multiples of 100. Unit: TU(time unit, 1 TU = 1024 us). Range: 100 ~ 60000. Default value: 100 */
299-
uint8_t csa_count; /**< Channel Switch Announcement Count. Notify the station that the channel will switch after the csa_count beacon intervals. Default value: 3 */
300-
uint8_t dtim_period; /**< Dtim period of soft-AP. Default value: 2 */
299+
uint8_t csa_count; /**< Channel Switch Announcement Count. Notify the station that the channel will switch after the csa_count beacon intervals. Range: 1 ~ 30. Default value: 3 */
300+
uint8_t dtim_period; /**< Dtim period of soft-AP. Range: 1 ~ 10. Default value: 1 */
301301
wifi_cipher_type_t pairwise_cipher; /**< Pairwise cipher of SoftAP, group cipher will be derived using this. Cipher values are valid starting from WIFI_CIPHER_TYPE_TKIP, enum values before that will be considered as invalid and default cipher suites(TKIP+CCMP) will be used. Valid cipher suites in softAP mode are WIFI_CIPHER_TYPE_TKIP, WIFI_CIPHER_TYPE_CCMP and WIFI_CIPHER_TYPE_TKIP_CCMP. */
302302
bool ftm_responder; /**< Enable FTM Responder mode */
303303
wifi_pmf_config_t pmf_cfg; /**< Configuration for Protected Management Frame */

Diff for: components/esp_wifi/src/wifi_netif.c

+1-1
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);

Diff for: components/lwip/Kconfig

+3-3
Original file line numberDiff line numberDiff line change
@@ -668,8 +668,8 @@ menu "LWIP"
668668
int "The maximum number of pbufs queued on OOSEQ per pcb"
669669
depends on LWIP_TCP_QUEUE_OOSEQ
670670
range 0 12
671-
default 4 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP
672-
default 0 if SPIRAM_TRY_ALLOCATE_WIFI_LWIP
671+
default 4 if !(SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
672+
default 0 if (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
673673
help
674674
If LWIP_TCP_OOSEQ_MAX_PBUFS = 0, TCP will not control the number of OOSEQ pbufs.
675675

@@ -725,7 +725,7 @@ menu "LWIP"
725725

726726
config LWIP_WND_SCALE
727727
bool "Support TCP window scale"
728-
depends on SPIRAM_TRY_ALLOCATE_WIFI_LWIP
728+
depends on (SPIRAM_TRY_ALLOCATE_WIFI_LWIP && !SPIRAM_IGNORE_NOTFOUND)
729729
default n
730730
help
731731
Enable this feature to support TCP window scaling.

0 commit comments

Comments
 (0)