diff --git a/components/lwip/api/sockets.c b/components/lwip/api/sockets.c index 851915877..91a5222e6 100755 --- a/components/lwip/api/sockets.c +++ b/components/lwip/api/sockets.c @@ -388,8 +388,18 @@ static void lwip_socket_drop_registered_memberships(int s); #endif /* LWIP_IGMP */ #ifdef LWIP_ESP8266 -//extern size_t system_get_free_heap_size(void); -//extern bool esp_wifi_tx_is_stop(void); + +/* Since esp_wifi_tx_is_stop/system_get_free_heap_size are not an public wifi API, so extern them here*/ +extern size_t system_get_free_heap_size(void); +extern bool esp_wifi_tx_is_stop(void); + +/* Please be notified that this flow control is just a workaround for fixing wifi Q full issue. + * Under UDP/TCP pressure test, we found that the sockets may cause wifi tx queue full if the socket + * sending speed is faster than the wifi sending speed, it will finally cause the packet to be dropped + * in wifi layer, it's not acceptable in some application. That's why we introdue the tx flow control here. + * However, current solution is just a workaround, we need to consider the return value of wifi tx interface, + * and feedback the return value to lwip and let lwip do the flow control itself. + */ static inline void esp32_tx_flow_ctrl(void) { uint8_t _wait_delay = 0; diff --git a/components/lwip/include/lwip/port/arch/sys_arch.h b/components/lwip/include/lwip/port/arch/sys_arch.h index 3895f23b3..be8ff7226 100644 --- a/components/lwip/include/lwip/port/arch/sys_arch.h +++ b/components/lwip/include/lwip/port/arch/sys_arch.h @@ -68,9 +68,5 @@ void sys_delay_ms(uint32_t ms); sys_sem_t* sys_thread_sem_init(void); void sys_thread_sem_deinit(void); sys_sem_t* sys_thread_sem_get(void); - -size_t system_get_free_heap_size(void); -bool esp_wifi_tx_is_stop(void); - #endif /* __SYS_ARCH_H__ */