From a92ae03b1e026af352a4d16ff1044c41c5f131a7 Mon Sep 17 00:00:00 2001 From: Rob Connolly Date: Wed, 30 Sep 2020 11:23:30 +1300 Subject: [PATCH] esp_netif: Fixed SLIP input to support size longer than 256 Implement batch processing of incoming slip data. Merges https://github.com/espressif/esp-idf/pull/5928 --- components/esp_netif/lwip/esp_netif_lwip_slip.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/esp_netif/lwip/esp_netif_lwip_slip.c b/components/esp_netif/lwip/esp_netif_lwip_slip.c index 769cbf12ae..9d2d56dc2f 100644 --- a/components/esp_netif/lwip/esp_netif_lwip_slip.c +++ b/components/esp_netif/lwip/esp_netif_lwip_slip.c @@ -166,7 +166,13 @@ void esp_netif_lwip_slip_input(void *h, void *buffer, unsigned int len, void *eb ESP_LOG_BUFFER_HEXDUMP(TAG, buffer, len, ESP_LOG_DEBUG); // Update slip netif with data - slipif_received_bytes(netif->lwip_netif, buffer, len); + const int max_batch = 255; + int sent = 0; + while(sent < len) { + int batch = (len - sent) > max_batch ? max_batch : (len - sent); + slipif_received_bytes(netif->lwip_netif, buffer+sent, batch); + sent += batch; + } // Process incoming bytes for (int i = 0; i < len; i++) {