From 555891bb540898e0f740870bbcab2dc68e15b917 Mon Sep 17 00:00:00 2001 From: alanmaxwell Date: Thu, 26 Oct 2023 17:30:49 +0800 Subject: [PATCH 1/5] fix(wifi): fix multi antenna issue --- components/esp_wifi/include/esp_wifi.h | 4 ++-- components/esp_wifi/lib | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/esp_wifi/include/esp_wifi.h b/components/esp_wifi/include/esp_wifi.h index 57324c8b761..13f65ab2726 100644 --- a/components/esp_wifi/include/esp_wifi.h +++ b/components/esp_wifi/include/esp_wifi.h @@ -429,7 +429,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. * @@ -810,7 +810,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); diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index c25c53f183d..fcfd486e347 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit c25c53f183daf2f914524b3d0dce0e47c993ec59 +Subproject commit fcfd486e3478e8a2afd4678e29bb4914418a5f0a From 1f5e7e33df16b4d1602023f03441de9a5abd150f Mon Sep 17 00:00:00 2001 From: xueyunfei Date: Wed, 26 Jul 2023 11:47:33 +0800 Subject: [PATCH 2/5] feat(esp_wifi):static buf for management,control,qos null,null data rx packet --- components/esp_rom/esp32c2/ld/esp32c2.rom.ld | 12 +++---- .../esp_rom/esp32c3/ld/esp32c3.rom.eco3.ld | 4 +-- components/esp_rom/esp32c3/ld/esp32c3.rom.ld | 6 ++-- components/esp_rom/esp32s3/ld/esp32s3.rom.ld | 8 ++--- components/esp_wifi/Kconfig | 34 +++++++++++++++++++ components/esp_wifi/include/esp_wifi.h | 10 ++++++ 6 files changed, 59 insertions(+), 15 deletions(-) diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.ld index fdb8e3b7601..de11ee83832 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.ld @@ -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; @@ -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; diff --git a/components/esp_rom/esp32c3/ld/esp32c3.rom.eco3.ld b/components/esp_rom/esp32c3/ld/esp32c3.rom.eco3.ld index 13940e252f5..8c3b31e9427 100644 --- a/components/esp_rom/esp32c3/ld/esp32c3.rom.eco3.ld +++ b/components/esp_rom/esp32c3/ld/esp32c3.rom.eco3.ld @@ -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;*/ diff --git a/components/esp_rom/esp32c3/ld/esp32c3.rom.ld b/components/esp_rom/esp32c3/ld/esp32c3.rom.ld index ee7b86ac1ad..30228b279de 100644 --- a/components/esp_rom/esp32c3/ld/esp32c3.rom.ld +++ b/components/esp_rom/esp32c3/ld/esp32c3.rom.ld @@ -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; @@ -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; @@ -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; diff --git a/components/esp_rom/esp32s3/ld/esp32s3.rom.ld b/components/esp_rom/esp32s3/ld/esp32s3.rom.ld index c7581749499..f4c28c60ca4 100644 --- a/components/esp_rom/esp32s3/ld/esp32s3.rom.ld +++ b/components/esp_rom/esp32s3/ld/esp32s3.rom.ld @@ -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; @@ -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; @@ -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; diff --git a/components/esp_wifi/Kconfig b/components/esp_wifi/Kconfig index 474dcfa457e..74efa2fba4b 100644 --- a/components/esp_wifi/Kconfig +++ b/components/esp_wifi/Kconfig @@ -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 diff --git a/components/esp_wifi/include/esp_wifi.h b/components/esp_wifi/include/esp_wifi.h index 13f65ab2726..be904af2832 100644 --- a/components/esp_wifi/include/esp_wifi.h +++ b/components/esp_wifi/include/esp_wifi.h @@ -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 */ @@ -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 @@ -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,\ From bcb6a2f38668c1a757d880ed490501943993cb73 Mon Sep 17 00:00:00 2001 From: muhaidong Date: Wed, 13 Sep 2023 11:16:22 +0800 Subject: [PATCH 3/5] fix(wifi): fix ccmp and gcmp PN became large issue --- components/esp_rom/esp32c2/ld/esp32c2.rom.ld | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.ld index de11ee83832..f866c706bb2 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.ld @@ -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; From 6bfac2a6e42d1ee9436c78431cbfe1c9fec15c8e Mon Sep 17 00:00:00 2001 From: muhaidong Date: Mon, 25 Sep 2023 15:12:44 +0800 Subject: [PATCH 4/5] fix(wifi): fix some wifi issues 1. fix enable psram wapi dhcp fail issue 2. fix tx power issue --- components/esp_rom/esp32c2/ld/esp32c2.rom.ld | 4 ++-- components/esp_rom/esp32c3/ld/esp32c3.rom.ld | 2 +- components/esp_rom/esp32s3/ld/esp32s3.rom.ld | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.ld index f866c706bb2..f22657ff35a 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.ld @@ -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; @@ -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; diff --git a/components/esp_rom/esp32c3/ld/esp32c3.rom.ld b/components/esp_rom/esp32c3/ld/esp32c3.rom.ld index 30228b279de..2bf57ef988e 100644 --- a/components/esp_rom/esp32c3/ld/esp32c3.rom.ld +++ b/components/esp_rom/esp32c3/ld/esp32c3.rom.ld @@ -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; diff --git a/components/esp_rom/esp32s3/ld/esp32s3.rom.ld b/components/esp_rom/esp32s3/ld/esp32s3.rom.ld index f4c28c60ca4..61a89461816 100644 --- a/components/esp_rom/esp32s3/ld/esp32s3.rom.ld +++ b/components/esp_rom/esp32s3/ld/esp32s3.rom.ld @@ -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; From bde852d40312c28572e7fa30b1a0de8993d97bda Mon Sep 17 00:00:00 2001 From: jgujarathi Date: Mon, 28 Aug 2023 11:52:20 +0530 Subject: [PATCH 5/5] fix(wifi): backport some wifi fix 1.Fix issue with frequent disconections when scanning for only a single channel. 2.Prints error message and returns ESP_ERR_NOT_SUPPORTED in case esp32c2 tries to set bandwidth to HT40. 3.Ensure that beacon timeout get trigged once.