Skip to content

Commit

Permalink
Merge branch 'bugfix/backport_wifi_fix_1026_v5.0' into 'release/v5.0'
Browse files Browse the repository at this point in the history
fix(wifi): fix some wifi issues(v5.0)

See merge request espressif/esp-idf!26691
  • Loading branch information
jack0c committed Oct 30, 2023
2 parents 4bd203b + bde852d commit a6afbb3
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 23 deletions.
18 changes: 9 additions & 9 deletions components/esp_rom/esp32c2/ld/esp32c2.rom.ld
Original file line number Diff line number Diff line change
Expand Up @@ -1485,9 +1485,9 @@ g_os_mempool_list = 0x3fcdfdf0;
esp_pp_rom_version_get = 0x40001ad4;
RC_GetBlockAckTime = 0x40001ad8;
ebuf_list_remove = 0x40001adc;
esf_buf_alloc = 0x40001ae0;
esf_buf_alloc_dynamic = 0x40001ae4;
esf_buf_recycle = 0x40001ae8;
/*esf_buf_alloc = 0x40001ae0;*/
/*esf_buf_alloc_dynamic = 0x40001ae4;*/
/*esf_buf_recycle = 0x40001ae8;*/
GetAccess = 0x40001aec;
hal_mac_is_low_rate_enabled = 0x40001af0;
hal_mac_tx_get_blockack = 0x40001af4;
Expand Down Expand Up @@ -1616,15 +1616,15 @@ wDev_AppendRxBlocks = 0x40001cdc;
wDev_DiscardFrame = 0x40001ce0;
wDev_GetNoiseFloor = 0x40001ce4;
wDev_IndicateAmpdu = 0x40001ce8;
wDev_IndicateFrame = 0x40001cec;
/*wDev_IndicateFrame = 0x40001cec;*/
wdev_mac_reg_load = 0x40001cf0;
wdev_mac_reg_store = 0x40001cf4;
wdev_mac_special_reg_load = 0x40001cf8;
wdev_mac_special_reg_store = 0x40001cfc;
wdev_mac_wakeup = 0x40001d00;
wdev_mac_sleep = 0x40001d04;
/*wDev_ProcessFiq = 0x40001d08;*/
wDev_ProcessRxSucData = 0x40001d0c;
/* wDev_ProcessFiq = 0x40001d08; */
/*wDev_ProcessRxSucData = 0x40001d0c;*/
wdevProcessRxSucDataAll = 0x40001d10;
wdev_csi_len_align = 0x40001d14;
ppDequeueTxDone_Locked = 0x40001d18;
Expand Down Expand Up @@ -1673,7 +1673,7 @@ lmacProcessCollisions_task = 0x40001dbc;
lmacInitAc = 0x40001dc4;
lmacInit = 0x40001dc8;
mac_tx_set_txop_q = 0x40001dcc;
hal_init = 0x40001dd0;
/*hal_init = 0x40001dd0;*/
hal_mac_rx_set_policy = 0x40001dd4;
hal_mac_set_bssid = 0x40001dd8;
mac_rx_policy_init = 0x40001ddc;
Expand Down Expand Up @@ -1867,7 +1867,7 @@ ieee80211_ampdu_start_age_timer = 0x40001fb4;
ieee80211_encap_esfbuf = 0x40001fb8;
ieee80211_is_tx_allowed = 0x40001fbc;
ieee80211_output_pending_eb = 0x40001fc0;
ieee80211_output_process = 0x40001fc4;
/* ieee80211_output_process = 0x40001fc4; */
ieee80211_set_tx_desc = 0x40001fc8;
/*sta_input = 0x40001fcc;*/
wifi_get_macaddr = 0x40001fd0;
Expand Down Expand Up @@ -1938,7 +1938,7 @@ ieee80211_output_raw_process = 0x400020f4;
ieee80211_raw_frame_sanity_check = 0x400020fc;
ieee80211_crypto_aes_128_cmac_encrypt = 0x40002100;
ieee80211_alloc_tx_buf = 0x40002108;
ieee80211_output_do = 0x4000210c;
/* ieee80211_output_do = 0x4000210c; */
/* ieee80211_send_nulldata = 0x40002110; */
ieee80211_setup_robust_mgmtframe = 0x40002114;
ieee80211_encap_null_data = 0x4000211c;
Expand Down
4 changes: 2 additions & 2 deletions components/esp_rom/esp32c3/ld/esp32c3.rom.eco3.ld
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ ESP32C3 ECO3 ROM address table
Version 3 API's imported from the ROM
*/

esf_buf_alloc_dynamic = 0x400015c0;
esf_buf_recycle = 0x400015c4;
/*esf_buf_alloc_dynamic = 0x400015c0;*/
/*esf_buf_recycle = 0x400015c4;*/
/*lmacTxDone = 0x4000162c;*/
/*ppMapTxQueue = 0x400016d8;*/
/*rcGetSched = 0x40001764;*/
Expand Down
8 changes: 4 additions & 4 deletions components/esp_rom/esp32c3/ld/esp32c3.rom.ld
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,7 @@ r_sch_plan_offset_req_hook = 0x40001ce4;
esp_pp_rom_version_get = 0x400015b0;
RC_GetBlockAckTime = 0x400015b4;
ebuf_list_remove = 0x400015b8;
esf_buf_alloc = 0x400015bc;
/*esf_buf_alloc = 0x400015bc;*/
GetAccess = 0x400015c8;
hal_mac_is_low_rate_enabled = 0x400015cc;
hal_mac_tx_get_blockack = 0x400015d0;
Expand Down Expand Up @@ -1713,7 +1713,7 @@ wDev_AppendRxBlocks = 0x400017b8;
wDev_DiscardFrame = 0x400017bc;
wDev_GetNoiseFloor = 0x400017c0;
wDev_IndicateAmpdu = 0x400017c4;
wDev_IndicateFrame = 0x400017c8;
/*wDev_IndicateFrame = 0x400017c8;*/
wdev_bank_store = 0x400017cc;
wdev_bank_load = 0x400017d0;
wdev_mac_reg_load = 0x400017d4;
Expand All @@ -1724,7 +1724,7 @@ wdev_mac_wakeup = 0x400017e4;
wdev_mac_sleep = 0x400017e8;
hal_mac_is_dma_enable = 0x400017ec;
/*wDev_ProcessFiq = 0x400017f0;*/
wDev_ProcessRxSucData = 0x400017f4;
/*wDev_ProcessRxSucData = 0x400017f4;*/
wdevProcessRxSucDataAll = 0x400017f8;
wdev_csi_len_align = 0x400017fc;
ppDequeueTxDone_Locked = 0x40001800;
Expand Down Expand Up @@ -1808,7 +1808,7 @@ ieee80211_ampdu_start_age_timer = 0x40001858;
/*ieee80211_encap_esfbuf = 0x4000185c;*/
ieee80211_is_tx_allowed = 0x40001860;
ieee80211_output_pending_eb = 0x40001864;
ieee80211_output_process = 0x40001868;
/*ieee80211_output_process = 0x40001868;*/
ieee80211_set_tx_desc = 0x4000186c;
rom_sta_input = 0x40001870;
wifi_get_macaddr = 0x40001874;
Expand Down
10 changes: 5 additions & 5 deletions components/esp_rom/esp32s3/ld/esp32s3.rom.ld
Original file line number Diff line number Diff line change
Expand Up @@ -1897,8 +1897,8 @@ r_sch_plan_offset_req_hook = 0x40001ce4;
esp_pp_rom_version_get = 0x40005250;
RC_GetBlockAckTime = 0x4000525c;
ebuf_list_remove = 0x40005268;
esf_buf_alloc = 0x40005274;
esf_buf_alloc_dynamic = 0x40005280;
/*esf_buf_alloc = 0x40005274;*/
/*esf_buf_alloc_dynamic = 0x40005280;*/
/*esf_buf_recycle = 0x4000528c;*/
GetAccess = 0x40005298;
hal_mac_is_low_rate_enabled = 0x400052a4;
Expand Down Expand Up @@ -2027,7 +2027,7 @@ wDev_AppendRxBlocks = 0x40005868;
wDev_DiscardFrame = 0x40005874;
wDev_GetNoiseFloor = 0x40005880;
wDev_IndicateAmpdu = 0x4000588c;
wDev_IndicateFrame = 0x40005898;
/*wDev_IndicateFrame = 0x40005898;*/
wdev_bank_store = 0x400058a4;
wdev_bank_load = 0x400058b0;
wdev_mac_reg_load = 0x400058bc;
Expand All @@ -2038,7 +2038,7 @@ wdev_mac_wakeup = 0x400058ec;
wdev_mac_sleep = 0x400058f8;
hal_mac_is_dma_enable = 0x40005904;
/* wDev_ProcessFiq = 0x40005910; */
wDev_ProcessRxSucData = 0x4000591c;
/*wDev_ProcessRxSucData = 0x4000591c;*/
wdevProcessRxSucDataAll = 0x40005928;
wdev_csi_len_align = 0x40005934;
ppDequeueTxDone_Locked = 0x40005940;
Expand Down Expand Up @@ -2125,7 +2125,7 @@ ieee80211_ampdu_start_age_timer = 0x40005a60;
/* ieee80211_encap_esfbuf = 0x40005a6c; */
ieee80211_is_tx_allowed = 0x40005a78;
ieee80211_output_pending_eb = 0x40005a84;
ieee80211_output_process = 0x40005a90;
/*ieee80211_output_process = 0x40005a90;*/
ieee80211_set_tx_desc = 0x40005a9c;
/*sta_input = 0x40005aa8;*/
wifi_get_macaddr = 0x40005ab4;
Expand Down
34 changes: 34 additions & 0 deletions components/esp_wifi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,40 @@ menu "Wi-Fi"
can deliver frames faster than WiFi layer can transmit. In these cases, we may run out of TX
buffers.

choice ESP_WIFI_MGMT_RX_BUFFER
prompt "Type of WiFi RX MGMT buffers"
default ESP_WIFI_STATIC_RX_MGMT_BUFFER
help
Select type of WiFi RX MGMT buffers:

If "Static" is selected, WiFi RX MGMT buffers are allocated when WiFi is initialized and released
when WiFi is de-initialized. The size of each static RX MGMT buffer is fixed to about 500 Bytes.

If "Dynamic" is selected, each WiFi RX MGMT buffer is allocated as needed when a MGMT data frame is
received. The MGMT buffer is freed after the MGMT data frame has been processed by the WiFi driver.


config ESP_WIFI_STATIC_RX_MGMT_BUFFER
bool "Static"
config ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER
bool "Dynamic"
endchoice

config ESP_WIFI_DYNAMIC_RX_MGMT_BUF
int
default 0 if ESP_WIFI_STATIC_RX_MGMT_BUFFER
default 1 if ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER

config ESP_WIFI_RX_MGMT_BUF_NUM_DEF
int "Max number of WiFi RX MGMT buffers"
range 1 10
default 5
help
Set the number of WiFi RX_MGMT buffers.

For Management buffers, the number of dynamic and static management buffers is the same.
In order to prevent memory fragmentation, the management buffer type should be set to static first.

config ESP32_WIFI_CSI_ENABLED
bool "WiFi CSI(Channel State Information)"
depends on SOC_WIFI_CSI_SUPPORT
Expand Down
14 changes: 12 additions & 2 deletions components/esp_wifi/include/esp_wifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ typedef struct {
int tx_buf_type; /**< WiFi TX buffer type */
int static_tx_buf_num; /**< WiFi static TX buffer number */
int dynamic_tx_buf_num; /**< WiFi dynamic TX buffer number */
int rx_mgmt_buf_type; /**< WiFi RX MGMT buffer type */
int rx_mgmt_buf_num; /**< WiFi RX MGMT buffer number */
int cache_tx_buf_num; /**< WiFi TX cache buffer number */
int csi_enable; /**< WiFi channel state information enable flag */
int ampdu_rx_enable; /**< WiFi AMPDU RX feature enable flag */
Expand Down Expand Up @@ -129,6 +131,12 @@ typedef struct {
#define WIFI_DYNAMIC_TX_BUFFER_NUM 0
#endif

#ifdef CONFIG_ESP_WIFI_RX_MGMT_BUF_NUM_DEF
#define WIFI_RX_MGMT_BUF_NUM_DEF CONFIG_ESP_WIFI_RX_MGMT_BUF_NUM_DEF
#else
#define WIFI_RX_MGMT_BUF_NUM_DEF 0
#endif

#if CONFIG_ESP32_WIFI_CSI_ENABLED
#define WIFI_CSI_ENABLED 1
#else
Expand Down Expand Up @@ -213,6 +221,8 @@ extern uint64_t g_wifi_feature_caps;
.tx_buf_type = CONFIG_ESP32_WIFI_TX_BUFFER_TYPE,\
.static_tx_buf_num = WIFI_STATIC_TX_BUFFER_NUM,\
.dynamic_tx_buf_num = WIFI_DYNAMIC_TX_BUFFER_NUM,\
.rx_mgmt_buf_type = CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUF,\
.rx_mgmt_buf_num = WIFI_RX_MGMT_BUF_NUM_DEF,\
.cache_tx_buf_num = WIFI_CACHE_TX_BUFFER_NUM,\
.csi_enable = WIFI_CSI_ENABLED,\
.ampdu_rx_enable = WIFI_AMPDU_RX_ENABLED,\
Expand Down Expand Up @@ -429,7 +439,7 @@ esp_err_t esp_wifi_scan_stop(void);
/**
* @brief Get number of APs found in last scan
*
* @param[out] number store number of APIs found in last scan
* @param[out] number store number of APs found in last scan
*
* @attention This API can only be called when the scan is completed, otherwise it may get wrong value.
*
Expand Down Expand Up @@ -810,7 +820,7 @@ esp_err_t esp_wifi_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter
* - ESP_ERR_WIFI_MODE: invalid mode
* - ESP_ERR_WIFI_PASSWORD: invalid password
* - ESP_ERR_WIFI_NVS: WiFi internal NVS error
* - others: refer to the erro code in esp_err.h
* - others: refer to the error code in esp_err.h
*/
esp_err_t esp_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf);

Expand Down

0 comments on commit a6afbb3

Please sign in to comment.