From 5e67f9578d35f2d167ac03e578fc8b66547ead74 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Wed, 27 Nov 2019 10:34:04 +0100 Subject: [PATCH] lwip: Adapted lwip port layer to use 2.1.2-esp in 4.0 --- components/lwip/lwip | 2 +- components/lwip/port/esp32/netif/ethernetif.c | 6 +++--- components/lwip/port/esp32/netif/wlanif.c | 14 +++++++++++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/components/lwip/lwip b/components/lwip/lwip index f2bd195eed..c483f30ba2 160000 --- a/components/lwip/lwip +++ b/components/lwip/lwip @@ -1 +1 @@ -Subproject commit f2bd195eed8f0d6e5cb784bccdba6c9b2e487e75 +Subproject commit c483f30ba22ac3c56c113f2466c39e7d6f60ab89 diff --git a/components/lwip/port/esp32/netif/ethernetif.c b/components/lwip/port/esp32/netif/ethernetif.c index fb758b902e..c102f6e8e9 100644 --- a/components/lwip/port/esp32/netif/ethernetif.c +++ b/components/lwip/port/esp32/netif/ethernetif.c @@ -61,7 +61,7 @@ * @param buf memory alloc in L2 layer * @note this function is also the callback when invoke pbuf_free */ -static void ethernet_free_rx_buf_l2(void *buf) +static void ethernet_free_rx_buf_l2(struct netif *netif, void *buf) { free(buf); } @@ -158,7 +158,7 @@ void ethernetif_input(struct netif *netif, void *buffer, uint16_t len) if (buffer == NULL || !netif_is_up(netif)) { if (buffer) { - ethernet_free_rx_buf_l2(buffer); + ethernet_free_rx_buf_l2(netif, buffer); } return; } @@ -166,7 +166,7 @@ void ethernetif_input(struct netif *netif, void *buffer, uint16_t len) /* acquire new pbuf, type: PBUF_REF */ p = pbuf_alloc(PBUF_RAW, len, PBUF_REF); if (p == NULL) { - ethernet_free_rx_buf_l2(buffer); + ethernet_free_rx_buf_l2(netif, buffer); return; } p->payload = buffer; diff --git a/components/lwip/port/esp32/netif/wlanif.c b/components/lwip/port/esp32/netif/wlanif.c index 11e1fc857f..2020a9a221 100644 --- a/components/lwip/port/esp32/netif/wlanif.c +++ b/components/lwip/port/esp32/netif/wlanif.c @@ -52,6 +52,18 @@ #include "tcpip_adapter.h" +/** + * @brief Free resources allocated in L2 layer + * + * This function translates the free_tx_buf to the prototype used on 2.1.2-esp branch + * + * @param buf memory alloc in L2 layer + * @note this function is also the callback when invoke pbuf_free + */ +static void wlanif_free_rx_buf_l2(struct netif *netif, void *buf) +{ + esp_wifi_internal_free_rx_buffer(buf); +} /** * In this function, the hardware should be initialized. @@ -82,7 +94,7 @@ low_level_init(struct netif *netif) #endif #if !ESP_L2_TO_L3_COPY - netif->l2_buffer_free_notify = esp_wifi_internal_free_rx_buffer; + netif->l2_buffer_free_notify = wlanif_free_rx_buf_l2; #endif }