zephyr/doc/reference/networking
Peter Bigot acd43cbaac net: timeout: refactor to fix multiple problems
The net_timeout structure is documented to exist because of behavior
that is no longer true, i.e. that `k_delayed_work_submit()` supports
only delays up to INT32_MAX milliseconds.  Nonetheless, use of 32-bit
timestamps within the work handlers mean the restriction is still
present.

This infrastructure is currently used for two timers with long
durations:
* address for IPv6 addresses
* prefix for IPv6 prefixes

The handling of rollover was subtly different between these: address
wraps reset the start time while prefix wraps did not.

The calculation of remaining time in ipv6_nbr was incorrect when the
original requested time in seconds was a multiple of
NET_TIMEOUT_MAX_VALUE: the remainder value would be zero while the
wrap counter was positive, causing the calculation to indicate no time
remained.

The maximum value was set to allow a 100 ms latency between elapse of
the deadline and assessment of a given timer, but detection of
rollover assumed that the captured time in the work handler was
precisely the expected deadline, which is unlikely to be true.  Use of
the shared system work queue also risks observed latency exceeding 100
ms.  These calculations could produce delays to next event that
exceeded the maximum delay, which introduced special cases.

Refactor so all operations that use this structure are encapsulated
into API that is documented and has a full-coverage unit test.  Switch
to the standard mechanism of detecting completed deadlines by
calculating the signed difference between the deadline and the current
time, which eliminates some special cases.

Uniformly rely on the scanning the set of timers to determine the next
deadline, rather than assuming that the most recent update is always
next.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-07 11:14:38 +02:00
..
8021Qav.rst doc: Apply constant qualifier on device instance where relevant 2020-09-02 13:48:13 +02:00
apis.rst
buf_mgmt.rst
can_api.rst doc: Apply constant qualifier on device instance where relevant 2020-09-02 13:48:13 +02:00
can_isotp_sequence.svg
can_isotp.rst
can_timing.svg
can_transceiver.svg
can.rst
coap.rst net: coap: Use MQTT style wildcard in path description: 2020-08-26 12:31:00 +02:00
dhcpv4.rst
dns_resolve.rst
ethernet_mgmt.rst
ethernet.rst
gptp.rst doc: update function references to use :c:func: 2020-08-31 09:57:33 -04:00
gsm_modem.rst
ieee802154.rst
index.rst
ip_4_6.rst
lldp.rst
lwm2m.rst net: lwm2m: Added execute arguments support 2020-12-13 15:39:08 -05:00
mqtt.rst
net_buf.rst doc: net_buf: document remove functions 2021-01-05 14:31:13 +02:00
net_config.rst
net_context.rst
net_core.rst
net_hostname.rst
net_if.rst
net_l2.rst doc: add :c:macro to some symbols 2020-08-31 09:57:33 -04:00
net_linkaddr.rst
net_mgmt.rst net: mgmt: Clarify the net_mgmt API documentation 2020-09-30 16:31:38 +03:00
net_offload.rst
net_pkt.rst doc: update struct references to use :c:struct: 2020-08-31 09:57:33 -04:00
net_shell.rst net: shell: Add network mgmt events monitor support 2020-10-13 13:42:50 +03:00
net_stats.rst
net_tech.rst
net_timeout.rst net: timeout: refactor to fix multiple problems 2021-01-07 11:14:38 +02:00
ppp.rst
promiscuous.rst
protocols.rst
ptp_time.rst
sntp.rst
sockets.rst doc: net: Add note about socket API thread safe status 2020-09-17 09:30:52 +02:00
socks5.rst
system_mgmt.rst
thread.rst
traffic-class.rst
trickle.rst
tsn.rst
vlan.rst doc: update function references to use :c:func: 2020-08-31 09:57:33 -04:00
websocket.rst