lwip: optimize tx flow control

1. Remove tx flow control for TCP
2. Remove tx flow control for UDP temporary
3. Return the error code when call esp_wifi_internal_tx()
This commit is contained in:
Liu Zhi Fu 2016-10-31 21:26:33 +08:00
parent c7f8d206ed
commit 92b663d9f2
2 changed files with 5 additions and 7 deletions

View file

@ -395,12 +395,15 @@ static void lwip_socket_drop_registered_memberships(int s);
*/ */
static inline void esp32_tx_flow_ctrl(void) static inline void esp32_tx_flow_ctrl(void)
{ {
//TODO we need to do flow control for UDP
#if 0
uint8_t _wait_delay = 1; uint8_t _wait_delay = 1;
while ((system_get_free_heap_size() < HEAP_HIGHWAT) || esp_wifi_internal_tx_is_stop()){ while ((system_get_free_heap_size() < HEAP_HIGHWAT) || esp_wifi_internal_tx_is_stop()){
vTaskDelay(_wait_delay/portTICK_RATE_MS); vTaskDelay(_wait_delay/portTICK_RATE_MS);
if (_wait_delay < 64) _wait_delay *= 2; if (_wait_delay < 64) _wait_delay *= 2;
} }
#endif
} }
#else #else
@ -1208,8 +1211,6 @@ lwip_send(int s, const void *data, size_t size, int flags)
#endif /* (LWIP_UDP || LWIP_RAW) */ #endif /* (LWIP_UDP || LWIP_RAW) */
} }
esp32_tx_flow_ctrl();
write_flags = NETCONN_COPY | write_flags = NETCONN_COPY |
((flags & MSG_MORE) ? NETCONN_MORE : 0) | ((flags & MSG_MORE) ? NETCONN_MORE : 0) |
((flags & MSG_DONTWAIT) ? NETCONN_DONTBLOCK : 0); ((flags & MSG_DONTWAIT) ? NETCONN_DONTBLOCK : 0);

View file

@ -142,16 +142,13 @@ low_level_output(struct netif *netif, struct pbuf *p)
} }
} }
esp_wifi_internal_tx(wifi_if, q->payload, pbuf_x_len); return esp_wifi_internal_tx(wifi_if, q->payload, pbuf_x_len);
return ERR_OK;
#else #else
for(q = p; q != NULL; q = q->next) { for(q = p; q != NULL; q = q->next) {
esp_wifi_internal_tx(wifi_if, q->payload, q->len); esp_wifi_internal_tx(wifi_if, q->payload, q->len);
} }
#endif
return ERR_OK; return ERR_OK;
#endif
} }
/** /**