zephyr/doc/reference
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
..
audio doc: api: sort the API overview alphabetically 2020-10-30 15:57:30 +01:00
bluetooth Bluetooth: Mesh: Encapsulate feature config 2020-11-09 11:23:34 +02:00
crypto doc: reference: Clean up and restructure a bit 2020-03-18 11:47:24 +01:00
devicetree doc: reference: add devicetree bindings content 2020-11-02 14:26:33 -05:00
display doc: reference: Clean up and restructure a bit 2020-03-18 11:47:24 +01:00
drivers drivers/pcie: Change pcie_get_mbar() to return size and flags 2020-11-20 09:36:22 +02:00
file_system fs: allow external file system implementations 2020-09-03 21:49:34 +02:00
kernel doc: End time comparison is wrong in my_wait_for_event sample code 2020-12-16 14:28:01 +01:00
logging doc: update function references to use :c:func: 2020-08-31 09:57:33 -04:00
misc lib: add cbprintf capability 2020-11-13 06:38:01 -05:00
networking net: timeout: refactor to fix multiple problems 2021-01-07 11:14:38 +02:00
peripherals Revert "drivers: move eeprom_slave driver to tests directory" 2020-12-16 16:39:49 -05:00
power_management power: remove SYS_ and sys_ prefixes 2020-12-09 15:18:29 -05:00
random doc: reference: Clean up and restructure a bit 2020-03-18 11:47:24 +01:00
resource_management sys: onoff: support clients using synchronous transitions 2020-08-14 17:53:39 +02:00
settings doc: provide guidance on recommended settings back end 2020-08-25 09:35:40 +02:00
shell shell: documentation update 2020-11-30 16:03:01 -06:00
storage doc/reference: Added clarification on flash offset relation 2020-10-27 12:52:07 +01:00
timing_functions doc: timing docs fix misprint 2020-11-19 16:59:47 -05:00
usb USB: Add driver and PID for Bluetooth H4 2020-04-20 21:59:47 +03:00
usermode lib: Remove sys_mem_pool implementation 2020-12-07 21:50:14 -05:00
util api: promote sys/util.h to experimental 2020-06-18 19:38:10 +02:00
virtualization doc: Adding ivshmem general and API documentation 2020-12-16 18:47:35 -05:00
index.rst doc: Adding ivshmem general and API documentation 2020-12-16 18:47:35 -05:00
overview.rst drivers: eeprom: mark the EEPROM API as stable 2021-01-05 18:02:54 +01:00
terminology.rst device: deprecate DEVICE_INIT 2020-11-10 08:38:09 -06:00