mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
change(esp_netif): Add Non-Fatal errtype to indicate lower layer medium failure
UDP application sends packet using esp_netif, underlying transport such as Wi-Fi may drop the packet due to higher load. New error code represent transient, non-fatal packet drop error. udp application may use such errtype, for example to rate limit.
This commit is contained in:
parent
469c51bf2b
commit
586207207f
@ -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
|
||||
*/
|
||||
@ -595,6 +595,9 @@ static const esp_err_msg_t esp_err_msg_table[] = {
|
||||
# endif
|
||||
# ifdef ESP_ERR_ESP_NETIF_DHCPS_START_FAILED
|
||||
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
|
||||
// components/esp_common/include/esp_err.h
|
||||
# ifdef ESP_ERR_FLASH_BASE
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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.
|
||||
*
|
||||
* 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,
|
||||
* 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,
|
||||
* allow anything to follow.
|
||||
*
|
||||
* 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/?* 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_to_match URI to be matched
|
||||
|
@ -34,6 +34,8 @@ extern "C" {
|
||||
#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_DHCPS_START_FAILED ESP_ERR_ESP_NETIF_BASE + 0x0D
|
||||
#define ESP_ERR_ESP_NETIF_TX_FAILED ESP_ERR_ESP_NETIF_BASE + 0x0E
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "lwip/esp_netif_net_stack.h"
|
||||
#include "esp_compiler.h"
|
||||
#include "lwip/esp_pbuf_ref.h"
|
||||
#include "esp_netif_types.h"
|
||||
|
||||
/**
|
||||
* 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;
|
||||
esp_err_t ret;
|
||||
esp_err_t netif_ret = ESP_FAIL;
|
||||
err_t ret = ERR_IF;
|
||||
|
||||
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 {
|
||||
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 {
|
||||
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);
|
||||
}
|
||||
|
||||
if (ret == ESP_OK) {
|
||||
return ERR_OK;
|
||||
/* translate netif_ret to lwip supported return value */
|
||||
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;
|
||||
}
|
||||
if (ret == ESP_ERR_INVALID_ARG) {
|
||||
return ERR_ARG;
|
||||
}
|
||||
return ERR_IF;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
*/
|
||||
@ -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 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 info (Optional) Ancilliary Device Information like Serial Number
|
||||
* @param info (Optional) Ancillary Device Information like Serial Number
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: Success
|
||||
|
Loading…
Reference in New Issue
Block a user