zephyr/include/net
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
..
bt.h net: bt: fix C++ link errors 2020-08-17 10:45:03 +03:00
buf.h net: buf: convert #define to static inline 2021-01-07 10:40:48 +02:00
can.h device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
coap.h net: includes: Fix indentation in header files 2020-08-21 13:56:13 -04:00
coap_link_format.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
dhcpv4.h net: Move include files outside of extern "C" block 2019-08-06 14:46:36 +03:00
dns_resolve.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
dns_sd.h net: dns: dns-sd: support dns service discovery 2020-11-09 16:15:02 -08:00
dummy.h device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
ethernet.h net: ethernet: Introduce devicetree aware DEVICE define macros 2020-12-17 11:02:11 -06:00
ethernet_mgmt.h net: includes: Fix indentation in header files 2020-08-21 13:56:13 -04:00
ethernet_vlan.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
gptp.h doc: fix @param usage in callbacks 2020-12-18 12:18:28 +01:00
hostname.h net: hostname: define public macro representing maximum hostname length 2020-11-17 19:21:43 -05:00
http_client.h net: http_client: add missing kernel.h include statement 2020-07-07 16:00:42 -04:00
http_parser.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
http_parser_state.h headers: Fix headers across the project 2018-09-17 15:49:26 -04:00
http_parser_url.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
ieee802154.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
ieee802154_mgmt.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
ieee802154_radio.h drivers: ieee802154: cc13xx_cc26xx: sub-ghz support 2020-11-09 10:25:24 +02:00
ipv4_autoconf.h headers: Fix headers across the project 2018-09-17 15:49:26 -04:00
lldp.h net: includes: Fix indentation in header files 2020-08-21 13:56:13 -04:00
lwm2m.h net: lwm2m: Added execute arguments support 2020-12-13 15:39:08 -05:00
lwm2m_path.h net: lwm2m: Add path generation macro 2020-11-10 14:10:44 +02:00
mii.h net: ethernet: Place MII defines into separate doxygen group 2019-02-26 02:07:36 +01:00
mqtt.h net: mqtt: Return -1 if keepalive messages are disabled. 2020-12-08 14:08:36 -05:00
net_config.h device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
net_conn_mgr.h net: Add a connection manager preliminary logic 2019-07-12 12:33:19 +03:00
net_context.h doc: fix @param usage in callbacks 2020-12-18 12:18:28 +01:00
net_core.h net: Collect net_pkt RX detailed timing stats when passing IP stack 2020-08-07 10:12:51 +03:00
net_event.h net: event: Add start/bound/stop events for DHCPv4 2020-10-03 17:15:15 +03:00
net_if.h doc: fix @param usage in callbacks 2020-12-18 12:18:28 +01:00
net_ip.h net: ip: enforce alignment in struct cmsghdr 2020-11-17 11:44:16 +02:00
net_l2.h net: Use section foreach macros 2020-07-20 08:32:46 -07:00
net_linkaddr.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
net_mgmt.h doc: fix @param usage in callbacks 2020-12-18 12:18:28 +01:00
net_offload.h net: offload: fix k_timeout_t translation in net_offload 2020-10-28 09:30:53 +02:00
net_pkt.h net: pkt: Add net_pkt_is_empty() util function 2020-09-22 11:22:43 +02:00
net_stats.h net: stats: Separate dropped TCP data segments and TCP packets 2020-11-06 09:50:02 -06:00
net_timeout.h net: timeout: refactor to fix multiple problems 2021-01-07 11:14:38 +02:00
openthread.h openthread: add openthread_api_mutex_try_lock() 2020-10-20 16:39:22 +03:00
ppp.h device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
promiscuous.h net: promisc: Refactor because of timeout overhaul 2020-04-09 16:07:03 +03:00
ptp_time.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
sntp.h net: sntp: Remove deprecated API function 2020-10-01 07:14:08 -05:00
socket.h net: lib: sockets: added ALPN extension option to TLS 2020-10-22 11:35:43 +03:00
socket_can.h device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
socket_net_mgmt.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
socket_offload.h net: sockets: Remove socket offloading interface 2020-01-31 11:36:02 -05:00
socket_select.h include: net: Fix incorrect casting of timeval on zsock_timeval. 2020-11-19 15:08:33 +02:00
socketutils.h include: net: socketutils: Allow to build for CONFIG_POSIX_API 2019-09-12 17:30:29 +03:00
tftp.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
tls_credentials.h net: tls: Add credential type documentation 2019-03-26 07:30:57 -05:00
trickle.h net: includes: Fix indentation in header files 2020-08-21 13:56:13 -04:00
udp.h doc: net: Hide UDP API documentation 2019-02-21 16:37:43 -05:00
websocket.h doc: fix @param usage in callbacks 2020-12-18 12:18:28 +01:00
wifi.h headers: Fix headers across the project 2018-09-17 15:49:26 -04:00
wifi_mgmt.h device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00