Commit graph

19201 commits

Author SHA1 Message Date
Seppo Takalo
e3100c6f3a net: lwm2m: Allow SenML-CBOR floats decoded as int
SenML is technically a JSON based format which can
be encoded as a CBOR. SenML-CBOR specification in
RFC 8428 section 6 states that numbers can be decoded
as an integer.

Also RFC 7049 section 4.2 states that JSON numbers
without fractional part can be decoded as an integer.

I have seen with one commercial LwM2M platform that
the decoder  they use, sends floating point values as
integers, if there is no fractional part.

So LwM2M engine cannot assume from the path that
the incomming number is either float or int. Accept both.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-08-08 15:37:56 +02:00
Konrad Derda
5e4e63ba8f net: ipv6: route: get nexthop's LL address only if relevant
This commit moves reading nexthop's LL address only if it's supported
by a given neighbor and can be used for routing between interfaces.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-08-08 15:37:32 +02:00
Jonathan Rico
58ec51616d Bluetooth: host: fix incorrect ISO HCI fragmentation logic
Don't push the TS flag on `buf` itself.

This messes up the MTU calculations: a packet that would exactly fit the
MTU and has a timestamp would be unnecessarily fragmented.

The MTU check is done on `buf` as a whole. At the point where the
fragmentation length is decided, `buf` includes one extra byte to pass the
TS bit around. That byte shouldn't count towards the MTU.

Instead, infer the presence of the timestamp by inspecting the amount of
headroom that the buffer has. This works because we always reserve
enough memory to push the timestamp, but not always push a timestamp on
the buffer. #tightlycoupled

This method is slightly uglier IMO, but eases MTU confusion and doesn't
rely on user_data.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-08-08 06:07:08 -04:00
Krzysztof Chruściński
5bd6050241 testsuite: busy_sim: Add alarm cancelation to stop function
Without cancelation next start may return error.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-08-07 19:04:04 -04:00
Krzysztof Chruściński
42f003cebd testsuite: busy_sim: Allow running with timer random generator
Allow to run with timer random generator which does not need any
entropy device.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-08-07 19:04:04 -04:00
Kapil Bhatt
2f088fabc2 net: wifi: Add Current PHY rate
Current PHY rate
It represents the current PHY rate of transfer
of data in bits per second. It will a TX data rate.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-07 19:02:32 -04:00
Kapil Bhatt
459a63b137 net: wifi: Add over run count statistics
Over run count
It represents the number of packets dropped either at
received and sent due to lack of buffer memory to retain
all packets on the network interface.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-07 19:02:32 -04:00
Łukasz Duda
fb71ca2237 net: openthread: Handle deprecated IPv6 addresses correctly
This commit fixes an issue where deprecated IPv6 addresses were not
being correctly marked. In some cases, deprecated addresses might have
been used as source addresses.

Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
2024-08-07 07:13:54 -04:00
Johann Fischer
5ddaa3b1a1 drivers: udc: add opaque pointer to store upper layer private data
Add an opaque pointer to store upper layer private data and initialize
it with the USB device context during controller initialization. Use the
pointer in event processing to get the correct context.

Fixes commit 48f2a4bc1a
("usb: device_next: remove initialized state checks in event processing")

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-08-06 17:17:41 -04:00
Seppo Takalo
b68477b372 net: lwm2m: Reset retry counter on update
On a successful update we should reset the retry counter, similarly
like we do on successful registration.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-08-06 17:16:46 -04:00
Seppo Takalo
e7b06e1c86 net: lwm2m: send REGISTRATION_TIMEOUT event on error
When socket errors call sm_handle_timeout_state() we might be
in a state where application assumes we are in registered state
but we are dropping it.
Therefore we must ensure that all registration states emit either
REGISTRATION_TIMEOUT event for application to indicate that
we have lost the connection to server.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-08-06 17:16:46 -04:00
Pisit Sawangvonganan
253d216589 net: ip: utils: revise data type declarations in z_impl_net_addr_ntop
Revise data type declarations to avoid implicit/explicit casts:
- Changed `unsigned char` to `uint8_t` for `zeros` array
  to match with `longest`.
- Declared variables `i`, `j`, and `pos` as `int` to use the same type.
- Cast `value` to `uint16_t` instead of `uint32_t` since
  `value` is `uint16_t`.
- Moved `bh` and `bl` declarations to narrow the scope of variables.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-06 17:15:50 -04:00
Pisit Sawangvonganan
71877efe27 net: ip: utils: simplify logic in z_impl_net_addr_ntop
Simplify high and low byte conversion by removing redundant checks,
since `net_byte_to_hex` already takes care of zero padding.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-06 17:15:50 -04:00
Pisit Sawangvonganan
dd864dbda0 net: ip: utils: simplify logic in net_byte_to_hex
Replace the loop with direct high and low nibble extraction,
and ensure the padding and zero suppression logic is simplified.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-06 17:15:50 -04:00
Roman Studenikin
edf09ca7f9 testsuite: coverage: Correct value of GCOV_COUNTERS for gcc 14
number of counters have changed in gcc 14 by commit
08a5233180

Specifically, a new counter was added in gcc/gcov-counter.def:
```
/* Conditions.  The counter is interpreted as a bit-set.  */
DEF_GCOV_COUNTER(GCOV_COUNTER_CONDS, "conditions", _ior)
```

which in turn updates the value of GCOV_COUNTERS that is defined in
gcov-io.h like this:
```
enum {
GCOV_COUNTERS
};
```

Signed-off-by: Roman Studenikin <srv@meta.com>
2024-08-06 17:15:22 -04:00
Nicolas Pitre
be119d7d8c demand_paging: LRU eviction: avoid ping pong deadlock loop
If only 2 page frames are queued and code executing in one frame is
making an access to memory in the second frame then the access will trap
and k_mem_paging_eviction_accessed() will be called to move that frame
to the end of the queue ... marking the new head frame unaccessible.
But that newly unaccessible frame contains the code that has yet to be
resumed to perform its memory access. Since it is now unaccessible, a
trap is triggered, the frame is moved to the end of the queue and the
new head frame (the one we trapped for initially) is marked unaccessible.
Execution is resumed with the memory access which is unaccessible again
and the cycle repeats infinitely.

Fix this by not marking the new head unaccessible if there is only one
queued frame left in the queue.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-08-06 17:15:15 -04:00
Georges Oates_Larsen
1c79445059 net: net_if: fix net_if_send_data for offloaded ifaces
Some offloaded ifaces have an L2, but lack support for
net_l2->send. This edge case is not handled by
net_if_send_data, resulting in a NULL dereference under
rare circumstances.

This patch expands the offloaded iface guard in
net_if_send_data to handle this edge case.

Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
2024-08-06 09:19:36 +01:00
Benjamin Cabé
43b948f9a8 net: ptp: Properly handle second overflow/underflow
Fixes issues with net_ptp_time arithmetic where second
overflow/underflow would not be handled properly.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2024-08-06 09:17:26 +01:00
Benjamin Cabé
dff19c3ac6 net: ptp: Adjust clock using correct offset
Offset should be *subtracted* from current clock value, not added.
This was causing clock to accumulate error instead of actually
"converging".

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-08-06 09:17:26 +01:00
Fengming Ye
86b5b59928 net: wifi: shell: add DPP commands
DPP shell command handler will parse user args to params in enum
and send l2 mgmt DPP requests.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-08-05 18:40:17 -04:00
Fengming Ye
1640826fc5 net: wifi_mgmt: add hostap DPP support
Add wifi l2 mgmt dpp handlers.
Add wifi subcommand dpp to call l2 mgmt dpp handlers.

DPP l2 handlers will parse params to hostap wpa_cli format args
and send wpa_cli commands to hostap.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-08-05 18:40:17 -04:00
Ravi Dondaputi
37491cb0f7 wifi: utils: Get correct channel count
For 2.4GHz and 6GHz bands, while counting the channels in configured
range, start of the range is being counted twice. Correct this
by advancing the index by 1 while counting channels in range.

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
2024-08-05 18:39:58 -04:00
frei tycho
3603d831fd Bluetooth: Controller: change condition in while to Boolean
Use `do { ... } while (false)` instead of `do { ... } while (0)`.

Signed-off-by: frei tycho <tfrei@baumer.com>
2024-08-05 16:30:13 +02:00
Kapil Bhatt
cd14be6073 net: wifi: Add reset command for Wi-Fi statistics
Add "reset" as a subcommand of wifi statistics.
Also add help option in statistics command.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-05 16:29:21 +02:00
Kapil Bhatt
3d38b5e094 wifi_mgmt: Add new API to reset Wi-Fi statistics
Add a new offload API to reset Wi-Fi statistics from
the Wi-Fi driver.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-05 16:29:21 +02:00
Morten Priess
ca1ceeffa4 Bluetooth: controller: Notify when BIG create fails due to timeout
When periodic scanning reaches timeout and BIGinfo has not yet been
received, notify with BT_HCI_ERR_CONN_FAIL_TO_ESTAB for sync receiver.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-08-05 16:28:58 +02:00
Morten Priess
64faceea72 Bluetooth: controller: Stop Sync ISO ticker when establishment fails
When an ISO stream fails to sync to a broadcaster within the first 6
events, the establishment fails (as expected). However, it did not stop
the ticker, and subsequently it was impossible to establish a new sync
after this.

Make asynchronous call to ticker_stop when establishment fails, and exit
done handling. Cleanup is handled via ll_rx_dequeue().

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-08-05 16:28:58 +02:00
Morten Priess
0e6bb8aa96 Bluetooth: controller: Fix number of handles in le_big_sync_established
Use lll->stream_count instead of lll->num_bis for returning the correct
number of handles.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-08-05 16:28:58 +02:00
Morten Priess
3b14cd4891 Bluetooth: controller: Add lll_sync_iso_flush interface to LLL
When the ISO sync receiver has been disabled (terminted), ULL now calls
lll_sync_iso_flush in lower link layer, to allow cleanup and releasing
of resources.

Make sure ISO sync LLL flush is also called when terminating a stream
from local side (app). Add blocking mayfly call to lll_sync_iso_flush in
ll_big_sync_terminate.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-08-05 16:28:44 +02:00
Morten Priess
a0e108d56b Bluetooth: controller: Send TX PDU release with no DP to vendor function
If a race condition occurs between stopping CIS stream and tearing down
data path, releasing TX PDUs was not possible for vendor data path, as
the DP configuration is gone.

In that case, call a new vendor specific function for cleaning up and
returning PDUs to correct pool.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-08-05 16:28:35 +02:00
Morten Priess
056387b5aa bluetooth: controller: Add LLCP TX to tx_ack FIFO size
The MFIFO holding TX nodes on the ack path back to the host was only
sized to hold the possible number of ACL TX nodes. However, additional
TX nodes are allocated for LLCP and use the same FIFO.

By adding LLCP_TX_CTRL_BUF_COUNT to the size, the FIFO will be able to
hold the worst-case number of TX nodes.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-08-05 16:28:27 +02:00
Vinayak Kariappa Chettimada
404ed809ed Bluetooth: Controller: BT_TICKER_REMAINDER_SUPPORT conditional
Added BT_TICKER_REMAINDER_SUPPORT conditional compilation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-05 16:28:18 +02:00
Vinayak Kariappa Chettimada
134251bb11 Bluetooth: Controller: Rename to BT_TICKER_START_REMAINDER
Rename to BT_TICKER_START_REMAINDER better reflect what it
means in terms of providing remainder parameter to ticker
start interface.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-05 16:28:18 +02:00
Troels Nilsson
a9f80e2c12 Bluetooth: Controller: Fix scoring for scan_aux events
Score was never increased for scan_aux events since they are
one-shot events; Fixed by keeping the scan_aux score as part
of the scan structure

Signed-off-by: Troels Nilsson <trnn@demant.com>
2024-08-05 16:27:50 +02:00
Vinayak Kariappa Chettimada
313fe30be4 Bluetooth: Controller: Rework related to separate SDU interval support
Review rework related to separate SDU interval for C_to_P
and P_to_C support.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-05 16:27:43 +02:00
Vinayak Kariappa Chettimada
fe556f5cd6 Bluetooth: Controller: Separate SDU interval for C_to_P and P_to_C
Support for separate SDU interval for C_to_P and P_to_C
directions when setting CIG parameters.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-05 16:27:43 +02:00
Fin Maaß
8f9148eff8 mgmt: hawkbit: move to zephyr kernel heap
switch to kernel heap from the libc, as there
is now a `k_realloc()` available.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-08-05 11:32:49 +02:00
Tom Finet
c1235bb4fb net: http: fix %d format string to %zu
Fixes logging of size_t variable to work on both 32
and 64 bit platforms.

Signed-off-by: Tom Finet <tomfinet@outlook.com>
2024-08-05 11:32:08 +02:00
Aleksandar Stanoev
52ffbd85c8 bluetooth: shell: Add shell commands for LE Connection Subrating
Add commands to allow requesting a subrate change via the BT shell.
A new build configuration has been added to ensure this is tested in CI.

Signed-off-by: Aleksandar Stanoev <aleksandar.stanoev@nordicsemi.no>
2024-08-05 10:16:27 +02:00
Aleksandar Stanoev
db9bcdc05e bluetooth: host: Add support for LE Connection Subrating
Adds support for LE Connection Subrating as defined in Core 5.4
Vol 6, Part B, Section 5.1.19.
As this is primarily a controller feature, the host support is mostly
a wrapper around the relevant HCI commands.

Note that subrating provides a new method to update the connection's
peripheral latency and supervision timeout alongside subrating parameters.

Signed-off-by: Aleksandar Stanoev <aleksandar.stanoev@nordicsemi.no>
2024-08-05 10:16:27 +02:00
Aleksandar Stanoev
c417bd224e bluetooth: Add Kconfig for LE Connection Subrating
Add separate Kconfig to be used by the host LE Subrating implementation.

Signed-off-by: Aleksandar Stanoev <aleksandar.stanoev@nordicsemi.no>
2024-08-05 10:16:27 +02:00
Tom Burdick
71bf36387c rtio: Enable submit/consume semaphores by default
The default behavior for thread pending of completions should use
semaphores rather than yield/wait looping when multithreading is
available.

Disable by default only when multithreading isn't available.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2024-08-05 10:16:12 +02:00
Robert Lubos
5f43388308 net: coap: Parse more flag in coap_get_block2_option()
Parse the more flag in coap_get_block2_option(), so that the function
can be used not only with requests but also with replies (where the more
flag should not be ignored).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-08-02 22:12:47 -05:00
Robert Lubos
3902a990e5 net: coap: Fix underlying type for block number
The block number in block1/2 options can be encoded on up to 20 bits
according to RFC 7959, therefore the underlying type used in helper
functions to retrieve the block number should be large enough to hold
the result. Therefore, replace the container for block number with
uint32_t instead of uint8_t.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-08-02 22:12:47 -05:00
Thales Bacelar
d6429431d6 logging: Trigger logging thread when we start to drop messages
Wake up logging thread when we start to drop messages.

Signed-off-by: Thales Bacelar <thalesbacelar@duck.com>
2024-08-02 18:45:59 -05:00
Armin Brauns
d7da085948 bluetooth: make monitor timestamps roll over less
With e.g. a 216MHz core clock, the 32-bit cycle counter overflows after
just 20 seconds. The 32-bit monitor timestamp (100us resolution) overflows
after around five days regardless of what we do, but we should try our best
to reach that.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2024-08-02 13:41:32 +02:00
Mark Holden
e6b683d310 coredump: Guard new kconfig for only supported arch
Add new config, ARCH_SUPPORTS_COREDUMP_THREADS, and
only enable it for ARM CORTEX M where the gdb server
can support it.

Signed-off-by: Mark Holden <mholden@meta.com>
2024-08-02 03:32:09 -04:00
Mark Holden
c35f6d1cac coredump: Add test for threads core dump config
Add z_test which uses new configs to capture multiple
threads in a core dump and with all of the context
necessary to debug the threads.

Signed-off-by: Mark Holden <mholden@meta.com>
2024-08-02 03:32:09 -04:00
Mark Holden
45684a598d coredump: Add config for capturing thread data in core dump
Update core dump file format to support a new section which contains
metadata about threads necessary for debugging.

Define configs to capture that metadata and include it in the dumps
when enabled.

Update documentation to reflect the changes.

Signed-off-by: Mark Holden <mholden@meta.com>
2024-08-02 03:32:09 -04:00
Fabio Baltieri
f3a6454f93 pm: refactor pm_device_driver_init
Refactor pm_device_driver_init code to keep the normal execution path
inline and the early exit branches at a single indentation, this is
commonly done throughout the code base.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-08-02 03:31:17 -04:00