Merge branch 'feat/netif_errcode_wifitxfail_2' into 'master'

change(esp_netif): Add Non-Fatal errtype to indicate lower layer medium failure

See merge request espressif/esp-idf!29835
This commit is contained in:
David Čermák
2024-06-11 22:02:49 +08:00
6 changed files with 41 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -595,6 +595,9 @@ static const esp_err_msg_t esp_err_msg_table[] = {
# endif # endif
# ifdef ESP_ERR_ESP_NETIF_DHCPS_START_FAILED # ifdef ESP_ERR_ESP_NETIF_DHCPS_START_FAILED
ERR_TBL_IT(ESP_ERR_ESP_NETIF_DHCPS_START_FAILED), /* 20493 0x500d */ ERR_TBL_IT(ESP_ERR_ESP_NETIF_DHCPS_START_FAILED), /* 20493 0x500d */
# endif
# ifdef ESP_ERR_ESP_NETIF_TX_FAILED
ERR_TBL_IT(ESP_ERR_ESP_NETIF_TX_FAILED), /* 20494 0x500e */
# endif # endif
// components/esp_common/include/esp_err.h // components/esp_common/include/esp_err.h
# ifdef ESP_ERR_FLASH_BASE # ifdef ESP_ERR_FLASH_BASE

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */

View File

@@ -1045,8 +1045,8 @@ esp_err_t httpd_req_get_cookie_val(httpd_req_t *req, const char *cookie_name, ch
/** /**
* @brief Test if a URI matches the given wildcard template. * @brief Test if a URI matches the given wildcard template.
* *
* Template may end with "?" to make the previous character optional (typically a slash), * Template may end with '?' to make the previous character optional (typically a slash),
* "*" for a wildcard match, and "?*" to make the previous character optional, and if present, * '*' for a wildcard match, and '?*' to make the previous character optional, and if present,
* allow anything to follow. * allow anything to follow.
* *
* Example: * Example:
@@ -1055,7 +1055,7 @@ esp_err_t httpd_req_get_cookie_val(httpd_req_t *req, const char *cookie_name, ch
* - /api/\* (sans the backslash) matches /api/ and /api/status, but not /api or /ap * - /api/\* (sans the backslash) matches /api/ and /api/status, but not /api or /ap
* - /api/?* or /api/\*? (sans the backslash) matches /api/, /api/status, and also /api, but not /apix or /ap * - /api/?* or /api/\*? (sans the backslash) matches /api/, /api/status, and also /api, but not /apix or /ap
* *
* The special characters "?" and "*" anywhere else in the template will be taken literally. * The special characters '?' and '*' anywhere else in the template will be taken literally.
* *
* @param[in] uri_template URI template (pattern) * @param[in] uri_template URI template (pattern)
* @param[in] uri_to_match URI to be matched * @param[in] uri_to_match URI to be matched

View File

@@ -34,6 +34,8 @@ extern "C" {
#define ESP_ERR_ESP_NETIF_MLD6_FAILED ESP_ERR_ESP_NETIF_BASE + 0x0B #define ESP_ERR_ESP_NETIF_MLD6_FAILED ESP_ERR_ESP_NETIF_BASE + 0x0B
#define ESP_ERR_ESP_NETIF_IP6_ADDR_FAILED ESP_ERR_ESP_NETIF_BASE + 0x0C #define ESP_ERR_ESP_NETIF_IP6_ADDR_FAILED ESP_ERR_ESP_NETIF_BASE + 0x0C
#define ESP_ERR_ESP_NETIF_DHCPS_START_FAILED ESP_ERR_ESP_NETIF_BASE + 0x0D #define ESP_ERR_ESP_NETIF_DHCPS_START_FAILED ESP_ERR_ESP_NETIF_BASE + 0x0D
#define ESP_ERR_ESP_NETIF_TX_FAILED ESP_ERR_ESP_NETIF_BASE + 0x0E
/** /**

View File

@@ -24,6 +24,7 @@
#include "lwip/esp_netif_net_stack.h" #include "lwip/esp_netif_net_stack.h"
#include "esp_compiler.h" #include "esp_compiler.h"
#include "lwip/esp_pbuf_ref.h" #include "lwip/esp_pbuf_ref.h"
#include "esp_netif_types.h"
/** /**
* In this function, the hardware should be initialized. * In this function, the hardware should be initialized.
@@ -84,10 +85,11 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p)
} }
struct pbuf *q = p; struct pbuf *q = p;
esp_err_t ret; esp_err_t netif_ret = ESP_FAIL;
err_t ret = ERR_IF;
if(q->next == NULL) { if(q->next == NULL) {
ret = esp_netif_transmit_wrap(esp_netif, q->payload, q->len, q); netif_ret = esp_netif_transmit_wrap(esp_netif, q->payload, q->len, q);
} else { } else {
LWIP_DEBUGF(PBUF_DEBUG, ("low_level_output: pbuf is a list, application may has bug")); LWIP_DEBUGF(PBUF_DEBUG, ("low_level_output: pbuf is a list, application may has bug"));
@@ -97,21 +99,36 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p)
} else { } else {
return ERR_MEM; return ERR_MEM;
} }
ret = esp_netif_transmit_wrap(esp_netif, q->payload, q->len, q); netif_ret = esp_netif_transmit_wrap(esp_netif, q->payload, q->len, q);
pbuf_free(q); pbuf_free(q);
} }
if (ret == ESP_OK) { /* translate netif_ret to lwip supported return value */
return ERR_OK; switch (netif_ret) {
case ESP_OK:
ret = ERR_OK;
break;
case ESP_ERR_NO_MEM:
ret = ERR_MEM;
break;
case ESP_ERR_ESP_NETIF_TX_FAILED:
ret = ERR_BUF;
break;
case ESP_ERR_INVALID_ARG:
ret = ERR_ARG;
break;
default:
ret = ERR_IF;
break;
} }
if (ret == ESP_ERR_NO_MEM) {
return ERR_MEM; return ret;
}
if (ret == ESP_ERR_INVALID_ARG) {
return ERR_ARG;
}
return ERR_IF;
} }
/** /**

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -79,7 +79,7 @@ esp_err_t esp_supp_dpp_deinit(void);
* @param chan_list List of channels device will be available on for listening * @param chan_list List of channels device will be available on for listening
* @param type Bootstrap method type, only QR Code method is supported for now. * @param type Bootstrap method type, only QR Code method is supported for now.
* @param key (Optional) 32 byte Raw Private Key for generating a Bootstrapping Public Key * @param key (Optional) 32 byte Raw Private Key for generating a Bootstrapping Public Key
* @param info (Optional) Ancilliary Device Information like Serial Number * @param info (Optional) Ancillary Device Information like Serial Number
* *
* @return * @return
* - ESP_OK: Success * - ESP_OK: Success