mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
lwip:optimization dhcp coarse timer
This commit is contained in:
@@ -275,6 +275,14 @@ menu "LWIP"
|
|||||||
help
|
help
|
||||||
Number of clients that may store data in client_data member array of struct netif.
|
Number of clients that may store data in client_data member array of struct netif.
|
||||||
|
|
||||||
|
config LWIP_DHCP_COARSE_TIMER_SECS
|
||||||
|
int "DHCP coarse timer interval(s)"
|
||||||
|
default 1
|
||||||
|
range 1 10
|
||||||
|
help
|
||||||
|
Set DHCP coarse interval in seconds.
|
||||||
|
A higher value will be less precise but cost less power consumption.
|
||||||
|
|
||||||
menu "DHCP server"
|
menu "DHCP server"
|
||||||
|
|
||||||
config LWIP_DHCPS
|
config LWIP_DHCPS
|
||||||
|
@@ -339,7 +339,7 @@ extern "C" {
|
|||||||
#define ESP_DHCP_DISABLE_VENDOR_CLASS_IDENTIFIER CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID
|
#define ESP_DHCP_DISABLE_VENDOR_CLASS_IDENTIFIER CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID
|
||||||
|
|
||||||
#define DHCP_DEFINE_CUSTOM_TIMEOUTS 1
|
#define DHCP_DEFINE_CUSTOM_TIMEOUTS 1
|
||||||
#define DHCP_COARSE_TIMER_SECS (1)
|
#define DHCP_COARSE_TIMER_SECS CONFIG_LWIP_DHCP_COARSE_TIMER_SECS
|
||||||
#define DHCP_NEXT_TIMEOUT_THRESHOLD (3)
|
#define DHCP_NEXT_TIMEOUT_THRESHOLD (3)
|
||||||
/* Since for embedded devices it's not that hard to miss a discover packet, so lower
|
/* 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 retry backoff time from (2,4,8,16,32,60,60)s to (500m,1,2,4,8,15,15)s.
|
||||||
@@ -354,6 +354,7 @@ static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min)
|
|||||||
if (timeout == 0) {
|
if (timeout == 0) {
|
||||||
timeout = min;
|
timeout = min;
|
||||||
}
|
}
|
||||||
|
timeout = (timeout + DHCP_COARSE_TIMER_SECS - 1) / DHCP_COARSE_TIMER_SECS;
|
||||||
return timeout;
|
return timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user