From d4bb163e322c223c834faa83d6b7080b0363a952 Mon Sep 17 00:00:00 2001 From: muhaidong Date: Tue, 13 Jun 2023 21:02:42 +0800 Subject: [PATCH] lower the dhcp discover and request retry backoff time --- components/lwip/lwip | 2 +- components/lwip/port/include/lwipopts.h | 8 +++----- docs/en/api-guides/wifi.rst | 4 ++-- docs/zh_CN/api-guides/wifi.rst | 4 ++-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/components/lwip/lwip b/components/lwip/lwip index 57c29648ff..269a58f185 160000 --- a/components/lwip/lwip +++ b/components/lwip/lwip @@ -1 +1 @@ -Subproject commit 57c29648ff40e2a19a51683717928aaf766a0495 +Subproject commit 269a58f18597aedec31c439e34cdaea47229dda3 diff --git a/components/lwip/port/include/lwipopts.h b/components/lwip/port/include/lwipopts.h index 4ab388f7c7..552314fe8f 100644 --- a/components/lwip/port/include/lwipopts.h +++ b/components/lwip/port/include/lwipopts.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause * - * SPDX-FileContributor: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileContributor: 2015-2023 Espressif Systems (Shanghai) CO LTD */ #ifndef LWIP_HDR_ESP_LWIPOPTS_H #define LWIP_HDR_ESP_LWIPOPTS_H @@ -355,11 +355,9 @@ extern "C" { #define DHCP_COARSE_TIMER_SECS CONFIG_LWIP_DHCP_COARSE_TIMER_SECS #define DHCP_NEXT_TIMEOUT_THRESHOLD (3) /* Since for embedded devices it's not that hard to miss a discover packet, so lower - * the discover retry backoff time from (2,4,8,16,32,60,60)s to (500m,1,2,4,8,15,15)s. + * the discover and request retry backoff time from (2,4,8,16,32,60,60)s to (500m,1,2,4,4,4,4)s. */ -#define DHCP_REQUEST_TIMEOUT_SEQUENCE(state, tries) (state == DHCP_STATE_REQUESTING ? \ - (uint16_t)(1 * 1000) : \ - (uint16_t)(((tries) < 6 ? 1 << (tries) : 60) * 250)) +#define DHCP_REQUEST_TIMEOUT_SEQUENCE(tries) ((uint16_t)(((tries) < 5 ? 1 << (tries) : 16) * 250)) static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min) { diff --git a/docs/en/api-guides/wifi.rst b/docs/en/api-guides/wifi.rst index e94b0d6246..44a1913743 100644 --- a/docs/en/api-guides/wifi.rst +++ b/docs/en/api-guides/wifi.rst @@ -1333,7 +1333,7 @@ API :cpp:func:`esp_wifi_set_config()` can be used to configure the AP. And the c * - ssid_hidden - If ssid_hidden is 1, AP does not broadcast the SSID; otherwise, it does broadcast the SSID. * - max_connection - - The max number of stations allowed to connect in, the default value is 10. ESP Wi-Fi supports up to {IDF_TARGET_MAX_CONN_STA_NUM} (``ESP_WIFI_MAX_CONN_NUM``) Wi-Fi connections. Please note that ESP AP and ESP-NOW share the same encryption hardware keys, so the max_connection parameter will be affected by the :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM`. The total number of encryption hardware keys is 17, if :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM` <= {IDF_TARGET_SUB_MAX_NUM_FROM_KEYS}, the max_connection can be set up to {IDF_TARGET_MAX_CONN_STA_NUM}, otherwise the max_connection can be set up to (17 - :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM`). + - The max number of stations allowed to connect in, the default value is 10. ESP Wi-Fi supports up to 10 (``ESP_WIFI_MAX_CONN_NUM``) Wi-Fi connections. Please note that ESP AP and ESP-NOW share the same encryption hardware keys, so the max_connection parameter will be affected by the :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM`. The total number of encryption hardware keys is 17, if :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM` <= 7, the max_connection can be set up to 10, otherwise the max_connection can be set up to (17 - :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM`). * - beacon_interval - Beacon interval; the value is 100 ~ 60000 ms, with default value being 100 ms. If the value is out of range, AP defaults it to 100 ms. @@ -1359,7 +1359,7 @@ API :cpp:func:`esp_wifi_set_config()` can be used to configure the AP. And the c * - ssid_hidden - If ssid_hidden is 1, AP does not broadcast the SSID; otherwise, it does broadcast the SSID. * - max_connection - - The max number of stations allowed to connect in, the default value is 2. ESP Wi-Fi supports up to {IDF_TARGET_MAX_CONN_STA_NUM} (``ESP_WIFI_MAX_CONN_NUM``) Wi-Fi connections. Please note that ESP AP and ESP-NOW share the same encryption hardware keys, so the max_connection parameter will be affected by the :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM`. The total number of encryption hardware keys is {IDF_TARGET_MAX_CONN_STA_NUM}, the max_connection can be set up to ({IDF_TARGET_MAX_CONN_STA_NUM} - :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM`). + - The max number of stations allowed to connect in, the default value is 2. ESP Wi-Fi supports up to 4 (``ESP_WIFI_MAX_CONN_NUM``) Wi-Fi connections. Please note that ESP AP and ESP-NOW share the same encryption hardware keys, so the max_connection parameter will be affected by the :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM`. The total number of encryption hardware keys is 4, the max_connection can be set up to (4 - :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM`). * - beacon_interval - Beacon interval; the value is 100 ~ 60000 ms, with default value being 100 ms. If the value is out of range, AP defaults it to 100 ms. diff --git a/docs/zh_CN/api-guides/wifi.rst b/docs/zh_CN/api-guides/wifi.rst index bbfa068bae..cd0afb2abd 100644 --- a/docs/zh_CN/api-guides/wifi.rst +++ b/docs/zh_CN/api-guides/wifi.rst @@ -1303,7 +1303,7 @@ API :cpp:func:`esp_wifi_set_config()` 可用于配置 AP。配置的参数信息 * - ssid_hidden - 如果 ssid_hidden 为 1,AP 不广播 SSID。若为其他值,则广播。 * - max_connection - - 允许连接 station 的最大数目,默认值是 10。ESP Wi-Fi 支持 {IDF_TARGET_MAX_CONN_STA_NUM} (``ESP_WIFI_MAX_CONN_NUM``) 个 Wi-Fi 连接。请注意, ESP AP 和 ESP-NOW 共享同一块加密硬件 keys,因此 max_connection 参数将受到 :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM` 的影响。加密硬件 keys 的总数是 17,如果 :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM` 小于等于 {IDF_TARGET_SUB_MAX_NUM_FROM_KEYS},那么 max_connection 最大可以设置为 {IDF_TARGET_MAX_CONN_STA_NUM},否则 max_connection 最大可以设置为 (17 - :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM`)。 + - 允许连接 station 的最大数目,默认值是 10。ESP Wi-Fi 支持 15 (``ESP_WIFI_MAX_CONN_NUM``) 个 Wi-Fi 连接。请注意, ESP AP 和 ESP-NOW 共享同一块加密硬件 keys,因此 max_connection 参数将受到 :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM` 的影响。加密硬件 keys 的总数是 17,如果 :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM` 小于等于 2,那么 max_connection 最大可以设置为 15,否则 max_connection 最大可以设置为 (17 - :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM`)。 * - beacon_interval - beacon 间隔。值为 100 ~ 60000 ms,默认值为 100 ms。如果该值不在上述范围,AP 默认取 100 ms。 @@ -1329,7 +1329,7 @@ API :cpp:func:`esp_wifi_set_config()` 可用于配置 AP。配置的参数信息 * - ssid_hidden - 如果 ssid_hidden 为 1,AP 不广播 SSID。若为其他值,则广播。 * - max_connection - - 允许连接 station 的最大数目,默认值是 2。ESP Wi-Fi 支持 {IDF_TARGET_MAX_CONN_STA_NUM} (``ESP_WIFI_MAX_CONN_NUM``) 个 Wi-Fi 连接。请注意, ESP AP 和 ESP-NOW 共享同一块加密硬件 keys,因此 max_connection 参数将受到 :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM` 的影响。加密硬件 keys 的总数是 {IDF_TARGET_MAX_CONN_STA_NUM}, max_connection 最大可以设置为 ({IDF_TARGET_MAX_CONN_STA_NUM} - :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM`)。 + - 允许连接 station 的最大数目,默认值是 2。ESP Wi-Fi 支持 4 (``ESP_WIFI_MAX_CONN_NUM``) 个 Wi-Fi 连接。请注意, ESP AP 和 ESP-NOW 共享同一块加密硬件 keys,因此 max_connection 参数将受到 :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM` 的影响。加密硬件 keys 的总数是 4, max_connection 最大可以设置为 (4 - :ref:`CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM`)。 * - beacon_interval - beacon 间隔。值为 100 ~ 60000 ms,默认值为 100 ms。如果该值不在上述范围,AP 默认取 100 ms。