From 6ed4dd65a4d53d69d32c970af29b017ee0d6be04 Mon Sep 17 00:00:00 2001 From: liu zhifu Date: Fri, 14 Aug 2020 23:42:57 +0800 Subject: [PATCH] esp_wifi: optimize WiFi debug log 1. Add esp_wifi_statis_dump() 2. Optimize WiFi related debug log --- components/esp_system/port/cpu_start.c | 7 ++++- components/esp_wifi/include/esp_wifi.h | 11 +++++++ components/esp_wifi/include/esp_wifi_types.h | 6 ++++ components/esp_wifi/lib | 2 +- components/esp_wifi/src/wifi_init.c | 30 ++++++++++++++++++++ 5 files changed, 54 insertions(+), 2 deletions(-) diff --git a/components/esp_system/port/cpu_start.c b/components/esp_system/port/cpu_start.c index d06c747ca3..90aa978d92 100644 --- a/components/esp_system/port/cpu_start.c +++ b/components/esp_system/port/cpu_start.c @@ -277,6 +277,11 @@ void IRAM_ATTR call_start_cpu0(void) #if !CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE s_cpu_up[0] = true; +#endif +#ifdef CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ + ESP_EARLY_LOGI(TAG, "cpu freq: %d", CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ); +#else + ESP_EARLY_LOGI(TAG, "cpu freq: %d", CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ); #endif ESP_EARLY_LOGI(TAG, "Pro cpu up."); @@ -413,4 +418,4 @@ void IRAM_ATTR call_start_cpu0(void) #endif SYS_STARTUP_FN(); -} \ No newline at end of file +} diff --git a/components/esp_wifi/include/esp_wifi.h b/components/esp_wifi/include/esp_wifi.h index ba38b737be..4dad75b9a8 100644 --- a/components/esp_wifi/include/esp_wifi.h +++ b/components/esp_wifi/include/esp_wifi.h @@ -1142,6 +1142,17 @@ esp_err_t esp_wifi_set_inactive_time(wifi_interface_t ifx, uint16_t sec); */ esp_err_t esp_wifi_get_inactive_time(wifi_interface_t ifx, uint16_t *sec); +/** + * @brief Dump WiFi statistics + * + * @param modules statistic modules to be dumped + * + * @return + * - ESP_OK: succeed + * - others: failed + */ +esp_err_t esp_wifi_statis_dump(uint32_t modules); + #ifdef __cplusplus } #endif diff --git a/components/esp_wifi/include/esp_wifi_types.h b/components/esp_wifi/include/esp_wifi_types.h index c1d73d0632..af3c856934 100644 --- a/components/esp_wifi/include/esp_wifi_types.h +++ b/components/esp_wifi/include/esp_wifi_types.h @@ -612,6 +612,12 @@ typedef struct { uint8_t mac[6]; /**< MAC address of the station which send probe request */ } wifi_event_ap_probe_req_rx_t; +#define WIFI_STATIS_BUFFER (1<<0) +#define WIFI_STATIS_RXTX (1<<1) +#define WIFI_STATIS_HW (1<<2) +#define WIFI_STATIS_DIAG (1<<3) +#define WIFI_STATIS_ALL (-1) + #ifdef __cplusplus } #endif diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 0848a01774..9b1c723417 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 0848a017746bd66be29999515cba20e0fd530819 +Subproject commit 9b1c723417805409f17490931128b12c5521ddd0 diff --git a/components/esp_wifi/src/wifi_init.c b/components/esp_wifi/src/wifi_init.c index 898e462aae..3229e3d8c4 100644 --- a/components/esp_wifi/src/wifi_init.c +++ b/components/esp_wifi/src/wifi_init.c @@ -142,6 +142,35 @@ esp_err_t esp_wifi_deinit(void) return err; } +static void esp_wifi_config_info(void) +{ +#ifdef CONFIG_ESP32_WIFI_RX_BA_WIN + ESP_LOGI(TAG, "rx ba win: %d", CONFIG_ESP32_WIFI_RX_BA_WIN); +#endif + ESP_LOGI(TAG, "tcpip mbox: %d", CONFIG_LWIP_TCPIP_RECVMBOX_SIZE); + ESP_LOGI(TAG, "udp mbox: %d", CONFIG_LWIP_UDP_RECVMBOX_SIZE); + ESP_LOGI(TAG, "tcp mbox: %d", CONFIG_LWIP_TCP_RECVMBOX_SIZE); + ESP_LOGI(TAG, "tcp tx win: %d", CONFIG_LWIP_TCP_SND_BUF_DEFAULT); + ESP_LOGI(TAG, "tcp rx win: %d", CONFIG_LWIP_TCP_WND_DEFAULT); + ESP_LOGI(TAG, "tcp mss: %d", CONFIG_LWIP_TCP_MSS); + +#ifdef CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP + ESP_LOGI(TAG, "WiFi/LWIP prefer SPIRAM"); +#endif + +#ifdef CONFIG_ESP32_WIFI_IRAM_OPT + ESP_LOGI(TAG, "WiFi IRAM OP enabled"); +#endif + +#ifdef CONFIG_ESP32_WIFI_RX_IRAM_OPT + ESP_LOGI(TAG, "WiFi RX IRAM OP enabled"); +#endif + +#ifdef CONFIG_LWIP_IRAM_OPTIMIZATION + ESP_LOGI(TAG, "LWIP IRAM OP enabled"); +#endif +} + esp_err_t esp_wifi_init(const wifi_init_config_t *config) { #ifdef CONFIG_PM_ENABLE @@ -190,6 +219,7 @@ esp_err_t esp_wifi_init(const wifi_init_config_t *config) #if CONFIG_IDF_TARGET_ESP32S2 adc2_cal_include(); //This enables the ADC2 calibration constructor at start up. #endif + esp_wifi_config_info(); return result; }