Commit graph

21541 commits

Author SHA1 Message Date
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
Anders T. Akre
26cd98e483 modem: ubx: fix incoming byte processing
`ret` holds the amount of bytes received from the modem. However during
processing of the bytes its value is overwritten by the return value of
`modem_ubx_process_received_byte`, in practice discarding all but the
first byte read.

To prevent this, store the length in a separate variable.

Signed-off-by: Anders T. Akre <anders@akre.io>
2024-08-02 03:29:18 -04:00
Jonathan Rico
1c6510312d Bluetooth: L2CAP: Set NULL callback for PDUs
It was not being set, and thus if the user_data contained garbage from
before, then conn.c would attempt to call that garbage.

Static channels don't have this issue, as every "SDU" fits into one PDU.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Co-authored-by: Huajiang Zheng <nxf88597@lsv051208.swis.nl-cdc01.nxp.com>
2024-08-01 16:49:37 +01:00
Jonathan Rico
8d7c1bc7bc Bluetooth: remove forgotten TODO
It's already done.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-08-01 16:49:37 +01:00
Jonathan Rico
ea9449979b Bluetooth: L2CAP: Mark user_data as owned by the stack
Storing stuff in user_data? That's a paddlin'

We have been debugging issue after issue because ownership of this
"user" data is not clearly defined. Now it is. L2CAP owns the user_data
field entirely, as soon as `send()` is called.

Also add a warning and retval using CHECKIF.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-08-01 16:49:37 +01:00
Jonathan Rico
5c6cd27723 Bluetooth: allow compiling host with CONFIG_NO_RUNTIME_CHECKS
Werror fails the build on that function.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-08-01 16:49:37 +01:00
Jonathan Rico
d02a13d726 Bluetooth: host: add more info to conn.c log
Print user_data and callback pointers.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-08-01 16:49:37 +01:00
Fabio Baltieri
e466efaf74 libc, console: declare __stdout_hook_install in libc-hooks.h
Declare __stdout_hook_install in libc-hooks.h and use it in the console
drivers rather than redeclare it every time.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-08-01 16:49:08 +01:00
Armin Brauns
cd7a6a4d55 coredump: use memmove instead of memcpy
With CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_LINKER_RAM, buffer_output() is
called on the entire RAM memory area. This includes the stack for the
coredump thread, which is where tmp_buf is stored. Eventually, it will copy
(parts of) tmp_buf into tmp_buf itself, which invokes Undefined Behaviour
in memcpy():

> The memory areas must not overlap.  Use memmove(3) if the memory areas do
> overlap.
- memcpy(3)

With picolibc, this is detected in __memcpy_chk() and causes a fault in
__chk_fail().

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2024-08-01 16:43:41 +02:00
Armin Brauns
12435442d2 coredump: significantly increase efficiency for small write block sizes
With FLASH_WRITE_SIZE==1, this would do a separate flash write for every
single byte.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2024-08-01 16:40:26 +02:00
Jakub Zymelka
bb5b98f16c ipc: icmsg: Align to NO MULTITHREADING
Adapting icmsg to work without the MULTITHREADING functionality.
Dependencies for kernel work_queue, mutexes and other functions
related to running multithreaded applications have been 'ifdefed'.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2024-08-01 13:31:53 +02:00