Commit graph

91465 commits

Author SHA1 Message Date
Christopher Friedt
1a3bb3fd5c posix: mqmeue: do not return NULL after pthread_exit()
pthread_exit() does not return and therefore it does not make
sense to return NULL after it in mq_notify_thread(), and that
would constitute dead code.

Rather than explicitly exiting the thread, simply return
gracefully from the thread function, and allow the pthread to
terminate in the usual way.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-02-26 08:12:29 -05:00
Benjamin Cabé
9d1df132b1 script: gen_isr_tables: remove unnecessary warning log
Remove a message that had a typo in it but, more importantly that was
not needed.
The CONFIG_ISR_TABLES_LOCAL_DECLARATION already selects EXPERIMENTAL so
a user is properly alerted about the consequences just like any other
EXPERIMENTAL features if they enable WARN_EXPERIMENTAL.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-02-26 11:55:59 +00:00
Pavel Vasilyev
a35bb6608d settings: nvs: Fix first write issue with cache
Issue:

When the setting nvs cache is disabled and `settings_nvs_save` is
called, the function reads all stored setting name entries from NVS
until either finds the desired setting name entry or reaches the last
stored setting name entry.

With the settings nvs cache enabled, `settings_nvs_save` runs through
the cached setting name entries first. If the cached entry matches with
the desired one, it immediately writes the new setting value to NVS
that corresponds to the cached setting name entry.

However, if the setting name entry is not found in the cache (which is
the case for a new entry), `settings_nvs_save` reads all stored setting
name entries from NVS again. This means that even if the number of
stored entries in the settings is less than the cache size, for each
new setting entry to be stored `settings_nvs_save` will first run
through the cache, then read all stored setting name entries from NVS
and only then will pick the next free name id for this new setting name
entry and will finally store the new setting entry.

This makes the cache ineffiсient for every new entry to be stored even
when the cache size is always able to keep all setting entries that will
be stored in NVS.

Use-case:

In the Bluetooth mesh there is a Replay Protection List which keeps
sequence numbers of all nodes it received messages from. The RPL is
stored persistently in NVS. The setting name entry is the source
address of the node and the setting value entry is the sequence number.
The common use case is when RPL is quite big (for example, 255 entries).

With the current settings nvs cache implementation, every time the node
stores a new RPL entry in settings (which is the first received message
from a particular source address), `settings_nvs_save` will always check
the cache first, then also read all stored entries in NVS and only then
will figure out that this is a new entry. With every new RPL entry to be
stored this search time increases. This behavior results in much worse
performance in comparison with when the corresponding entry was already
stored. E.g. on nRF52840, with bare minimal mesh stack configuration,
when the cache is bigger than number of stored entries or close to it,
storing of 255 RPL entries takes ~25 seconds. The time of subsequent
store of 255 RPL entires is ~2 seconds with the cache.

Solution:

This commit improves the behavior of the first write by bypassing the
reading from NVS if the following conditions are met:
1. `settings_nvs_load` was called,
2. the cache was not overflowed (bigger than the number of stored
entries).

As long as these 2 conditiones are met, it is safe to skip reading from
NVS, pick the next free name id and write the value immediately.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-02-26 11:55:33 +00:00
Adam Kondraciuk
fd20639c08 modules: hal_nordic: nrfx: Fix DPPI support for nRF54L15
Add required DPPIC interconnect files for nRF54L15 SoC.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
2024-02-26 11:55:10 +00:00
Emil Gydesen
4298b0a267 Bluetooth: BAP: Shell: BA fix add_pa_sync command
The command would attempt to parse the BASE and enter the
subgroup information in a NULL pointer.

The BASE copy was also done incorrectly, as it did not
properly take the UUID into account (which should be
moved to a helper function if we expect users to do this).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-26 11:54:56 +00:00
Dino Li
6b0b63b3a7 ITE: drivers/i2c target mode: Fix racing condition
The finish interrupt after the previous transaction is completed may
occur in the next transaction. To do hardware reset at this time could
potentially lead to the failure of the transaction.
Therefore, removing the hardware reset upon completing the transaction
helps to avoid a race condition.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2024-02-26 11:54:13 +00:00
Brian Moran
b411094b85 shell: Add a configuration for not printing shell messages
The shell currently prints out `: command not found` and
`Please specify a subcommand.` when invalid commands are
sent.

This can cause issues in certain situations, such as if a U-Boot
console in interactive mode is on the other end of the shell's
UART, where the U-Boot console will stop booting the device
if it receives any characters, and it will print out strings that
the shell then sees as commands. This causes the shell to send
out the messages above, preventing the device running
U-Boot on the other end from booting up.

I added the configurations
`CONFIG_SHELL_MSG_SPECIFY_SUBCOMMAND` and
`CONFIG_SHELL_MSG_CMD_NOT_FOUND` to allow disabling
these messages.

Signed-off-by: Brian Moran <brian.moran@sabantoag.com>
2024-02-26 11:53:58 +00:00
Peter Mitsis
ebec1500ff tests: latency_measure: Add condition variables
Adds condition variables to the latency measure benchmark.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-02-26 11:53:44 +00:00
Juha Ylinen
5a9a221687 doc: release-notes: Add lwm2m change
Add new API function lwm2m_set_bulk.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2024-02-26 11:53:29 +00:00
Juha Ylinen
514fb3f245 tests: lwm2m: Add test case
Add test case for lwm2m_set_bulk() function.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2024-02-26 11:53:29 +00:00
Juha Ylinen
884291e533 samples: lwm2m: Set temperature sensor resource values
Add an example how to set multiple resource values using
lwm2m_set_bulk() function.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2024-02-26 11:53:29 +00:00
Juha Ylinen
f38ecb7a09 net: lwm2m: Add API to set multiple resource values
Add new API lwm2m_set_bulk() to set multiple resource values in
one function call.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2024-02-26 11:53:29 +00:00
Emil Gydesen
849dbf40d9 Bluetooth: ISO: Replace UNICAST | BROADCAST with CONN_TX
Replaced checks for
CONFIG_BT_ISO_UNICAST || CONFIG_BT_ISO_BROADCASTER with
CONFIG_BT_CONN_TX, as they are effectively the same.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-26 11:52:37 +00:00
Łukasz Duda
6e31820f4c net: ipv6: nbr: Expose API for reporting neighbor reachability
This commit extends Zephyr's networking API to allow higher layers to
report on neighbor reachability.

Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
2024-02-26 11:51:42 +00:00
Gerard Marull-Paretas
2dbb4a013b twister: drop riscv32/64 support
riscv32/64 are no longer supported, as both are the same arch: riscv.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-02-26 12:49:06 +01:00
Gerard Marull-Paretas
6810a53297 twister: s/riscv(32|64)/riscv
Only riscv is supported now, any 32/64-bit requirements need to use
CONFIG_64BIT now.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-02-26 12:49:06 +01:00
Gerard Marull-Paretas
6c0a5cac06 twister: add support for riscv arch
So that we can stop using the artificial riscv32/64 dual naming. This
patch temporarily allows using both, riscv or riscv32/64.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-02-26 12:49:06 +01:00
Gerard Marull-Paretas
6884e10fae arch: riscv: always use 'riscv' for CONFIG_ARCH
Because the riscv32/riscv64 is redundant, one can get the same
information combining CONFIG_ARCH + CONFIG_64BIT.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-02-26 12:49:06 +01:00
Jukka Rissanen
1899c0c5c7 tests: net: ip-addr: Check IPv6 private addresses
Add a test that checks that the private address checker works
as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-26 11:41:55 +00:00
Jukka Rissanen
c1731c7740 net: ipv6: Add function to check private address
Add an utility function to check if the supplied IPv6 address
is one of the possible private IPv6 address range.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-26 11:41:55 +00:00
Jukka Rissanen
5723676770 tests: net: ip-addr: Check IPv4 private addresses
Add a test that checks that the private address checker works
as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-26 11:41:55 +00:00
Jukka Rissanen
fce7497269 net: ipv4: Add function to check private address
Add an utility function to check if the supplied IPv4 address
is one of the possible private IPv4 address range.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-26 11:41:55 +00:00
Robert Lubos
9cb21e695f net: dhcpv4_server: Apply range limits for Kconfig options
Apply ranges to DHCPv4 server timeout Kconfig options, so that it cannot
be set to a negative value by mistake.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-02-26 11:41:35 +00:00
Robert Lubos
3ea05cc958 tests: net: dhcpv4_server: Add tests for declined address expiry/reuse
Verify that declined addresses are not permanently blocked - i. e.
expire after configured timeout and in case of free address shortage,
can be reused.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-02-26 11:41:35 +00:00
Robert Lubos
e28428caae net: dhcpv4_server: Improve declined addresses management
In case conflict is detected (either due to receiving Decline message or
due to ICMP probe getting reply), the conflicting address becomes
blocked for further use.

Although the RFC is not specific about how long should the address be
blocked, it make sense to implement some fallback mechanisms to reuse
blocked addresses in the server, otherwise, after longer period of
operation, it may run out of usable address.

This commit adds a timeout for declined addresses, so that by default
the address is marked back as "free" after 24 hrs (default lease time).
It also implements a mechanism, which allows to re-use the oldest
declined entry in case the server runs out of fresh addresses to assign.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-02-26 11:41:35 +00:00
Fabio Baltieri
9e1eec9ced test: add a test for sign extend
Add tests for the sign extend functions.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-02-26 11:41:20 +00:00
Fabio Baltieri
5bb9b129de sys: util: add a sign_extend and sign_extend_64 functions
Add a sign_extend and sign_extend_64 functions, same as the Linux
sign_extend32 and sign_extend64 one. This is useful for sign extending
values smaller than 32 bits.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-02-26 11:41:20 +00:00
Fabio Baltieri
cbad8eff46 drivers: display: drop a bunch of redundant placeholder API functions
Drop a bunch of display functions that only return "not supported", the
display API already handles these by checking for NULL API function
pointer.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-02-26 11:41:11 +00:00
Pisit Sawangvonganan
b6f51edd6c wifi: shell: removed NULL check to net_mgmt callback
Since PR, PR_SHELL, PR_ERROR, PR_INFO, and PR_WARNING already have
an embedded `sh` NULL check, we can remove the change from PR #68809.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-02-26 11:41:03 +00:00
Pisit Sawangvonganan
7b8a9e1818 net: shell: ensure the shell sh is valid before call shell_printf
It is possible that the `sh` was not set before use.
This change adds a NULL check for `sh` in the following macros:
PR, PR_SHELL, PR_ERROR, PR_INFO, and PR_WARNING.
In case `sh` is NULL, the above macros will call `printk` instead.

Fixes #68793

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-02-26 11:41:03 +00:00
Emil Gydesen
f4c8020d45 Bluetooth: BAP: Shell: Minor refactor of LC3 encoder
This commit renames a few variables and changes the
type and adds some additional checks.

It moves stream specific data to the shell stream
struct, but still keeps the global values that were used
to initialize the LC3 encoder

The purpose of this is to better allow for a future LC3 decoder
without any clashes in names or the like.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-26 11:40:50 +00:00
Peter Ujfalusi
11f69be9fd drivers: dma: dma_dw_common: Log start and stop in info level
The start and stop of the DMA channel provides useful information in
default logs and they are not too frequent to cause bandwidth issues.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2024-02-26 11:40:39 +00:00
Peter Ujfalusi
f918aea733 drivers: dma: dma_intel_adsp_gpdma: Improve context information in logging
The LOG_* macros already print the module name and the function, printting
again the __func__ have no additional benefit.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2024-02-26 11:40:39 +00:00
Peter Ujfalusi
852f2ed1d4 drivers: dma: dma_dw_common: Improve context information in log prints
The LOG_* macros already print the module name and the function, printting
again the __func__ have no additional benefit.

The debug prints lack context which can be used to identify the channel
which the message was printed for.
For example:
<inf> dma_dw_common: dw_dma_stop: dw_dma_stop: dma 0 channel drain time out

when multiple channels from multiple controllers are used we don't know
the exact channel that has been stopped:
<inf> dma_dw_common: dw_dma_stop: dma@7c000: channel 0 drain time out
<inf> dma_dw_common: dw_dma_stop: dma@7d000: channel 0 drain time out

Convert all LOG prints to add usable context to them and use the following
pattern wherever it is possible:
dma_dw_common: <function name>: <DMA device name>: message
for example:
<inf> dma_dw_common: dw_dma_stop: dma@7c000: channel 0 config

The parameter list of dw_dma_avail_data_size() and dw_dma_free_data_size()
extended to pass the dev pointer.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2024-02-26 11:40:39 +00:00
Kyra Lengfeld
83926830cf Bluetooth: Controller: Add nRF54x Tx Power Kconfig
This commit adds tx power config options for nRF54Hx and nrf54Lx
SoCs, as well as the new radio defines.

Signed-off-by: Kyra Lengfeld <kyra.lengfeld@nordicsemi.no>
2024-02-26 11:40:29 +00:00
Agata Figiel
4302cd1e4d Bluetooth: TMAP: Move role definitions from shell/tmap.c to tmap.h
These role definition are also used in bttester, so it could be globally
available.

Signed-off-by: Agata Figiel <agata.figiel@codecoup.pl>
2024-02-26 11:39:41 +00:00
Celina Sophie Kalus
19c8fa2441 ipc: rpmsg_service: Support IPM without data transfer
RPMsg currently sends four dummy bytes over the IPM when sending a
notification/interrupt to another CPU. However, most IPM drivers
support sending messages with no data transfer, and for some IPM
drivers, like the STM32 HSEM IPM driver, data transfer is not
possible at all, thus breaking compatibility. To fix this, send an
empty message with size 0 instead of a dummy message if the STM32
HSEM IPM driver is active.

Signed-off-by: Celina Sophie Kalus <hello@celinakalus.de>
2024-02-26 11:39:29 +00:00
Celina Sophie Kalus
83192c71e4 drivers: ipm: esp32: Allow doorbell without data transfer
IPM drivers are commonly used to send notifications/cause interrupts
without any transfer of data. To add this use case in the ESP32 IPM
driver, the guard statement is appended so that the pointer to the
data buffer is allowed to be zero only if the size of the data to be
transferred is zero. If size is given as 0 and data is equal to NULL,
we are thus only using the IPM as a doorbell, not to transfer data.

Signed-off-by: Celina Sophie Kalus <hello@celinakalus.de>
2024-02-26 11:39:29 +00:00
Emil Gydesen
a7ca6e5c17 Bluetooth: Audio: Shell: Add support for setting runtime config data
Using the `bap preset` command it is now possible to set all the
codec configuration data and metadata value at runtime. This will
allow to set specific values for each stream in each direction.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-26 11:39:13 +00:00
Emil Gydesen
bfe93a3164 Bluetooth: Audio: Shell: Make the default presets non-pointers
Instead of the default presets being pointers, they are changed to
allocated structs so that they can be modified.

This will allow us to modify the config and metadata in a later patch.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-02-26 11:39:13 +00:00
Vinayak Kariappa Chettimada
c8dbb97170 tests: bsim: hci_uart: Fix execution timeout
Fix execution timeout to be atleast the simulation
length of the tests.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-02-26 11:38:30 +00:00
Vinayak Kariappa Chettimada
ff91408385 tests: bsim: hci_uart: Rename to hci_uart test name
Rename uart and uart_async bsim test to reflect
testing of hci_uart sample using UART driver
variants under bsim simulations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-02-26 11:38:30 +00:00
Peter Ujfalusi
6423bc3bc8 drivers: dai: intel: ssp: Improve logging output
The printed logs lack usable information curerntly, for example:
arecord -Dhw:0,0 -fdat | aplay -Dhw:0,0 -fdat

results:
...
[13110.111051] <inf> dai_intel_ssp: dai_ssp_pre_start: dai_ssp_pre_start
[13110.111070] <inf> dai_intel_ssp: dai_ssp_start: dai_ssp_start
[13110.455085] <inf> dai_intel_ssp: dai_ssp_pre_start: dai_ssp_pre_start
[13110.455103] <inf> dai_intel_ssp: dai_ssp_start: dai_ssp_start
[13229.817080] <inf> dai_intel_ssp: dai_ssp_pause: dai_ssp_pause TX
[13229.819111] <inf> dai_intel_ssp: dai_ssp_stop: dai_ssp_stopTX stop
[13229.858060] <inf> dai_intel_ssp: dai_ssp_pause: dai_ssp_pause RX
[13229.858556] <inf> dai_intel_ssp: dai_ssp_stop: dai_ssp_stop RX stop
...

If we use multiple SSPs this gets even harder to understand. Which SSP is
starting exactly?

This patch improves the prints to prefix it with SSP instance and drops the
printing of __func__, resulting:
...
[13444.974460] <inf> dai_intel_ssp: dai_ssp_early_start: SSP0 RX
[13444.974486] <inf> dai_intel_ssp: dai_ssp_start: SSP0 RX
[13445.318453] <inf> dai_intel_ssp: dai_ssp_early_start: SSP0 TX
[13445.318478] <inf> dai_intel_ssp: dai_ssp_start: SSP0 TX
[13446.323438] <inf> dai_intel_ssp: dai_ssp_pause: SSP0 TX
[13446.324141] <inf> dai_intel_ssp: dai_ssp_stop: SSP0 TX
[13446.329403] <inf> dai_intel_ssp: dai_ssp_pause: SSP0 RX
[13446.330931] <inf> dai_intel_ssp: dai_ssp_stop: SSP0 RX
...

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2024-02-26 11:38:16 +00:00
Aleksander Wasaznik
060dc9ef6d Bluetooth: tests: Switch to default BT_RECV_CONTEXT
The tests `hci_prop_evt` and `host_long_adv_recv` used `bt_recv_prio`,
and so relied on an extra config option `CONFIG_BT_RECV_BLOCKING`. This
patch replaces the use of `bt_recv_prio` with `bt_recv` and restores the
use of the default option for `BT_RECV_CONTEXT`.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-02-26 11:37:14 +00:00
Pavel Vasilyev
c601c15863 Bluetooth: Mesh: Remove extra rescheduling and ADV_FLAG_SCHEDULED in adv
This commit removes extra rescheduling in the extended advertiser after
the last advertising has been finished. This commit also removes the
`ADV_FLAG_SCHEDULED` flag as not needed anymore.

This extra rescheduling and the flag were needed to delay the next
advertisement by 20ms. Now, when the delay is removed the advertiser can
pick the next advertisement from the pool and push to the host right
away.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-02-26 11:37:00 +00:00
Aleksander Wasaznik
6f077be959 Bluetooth: tests: init: CONFIG_BT_RECV_WORKQ_BT=y
Add a test case to the init test to cover `CONFIG_BT_RECV_WORKQ_BT=y`.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-02-26 11:36:48 +00:00
Aleksander Wasaznik
433833d9ef Bluetooth: Support BT_RECV_WORKQ_BT with Zephyr LL
This patch allows selecting the combination of `CONFIG_BT_RECV_WORKQ_BT`
and `BT_LL_SW_SPLIT`. The implementation of `bt_recv_prio` is copied
from `hci_raw.c`. This ensures the order of packets is the same as when
the controller's `hci_driver.c` is off-chip and sends HCI over UART.

Without this patch, the Zephyr LL driver will duplicate some events on
behalf of `hci_core`. This duplication is not wanted when
`CONFIG_BT_RECV_WORKQ_BT=y`.

The above mentioned duplication is not sound and is evidenced in logged
warnings, e.g. in `tests/bsim/bluetooth/host/l2cap/stress` with
`CONFIG_BT_RECV_WORKQ_BT=y` logging "no transition".

This patch is a step towards the deprecation of
`CONFIG_BT_RECV_BLOCKING`. `CONFIG_BT_RECV_BLOCKING` is complicated and
tightly coupled to `hci_core`. In the future, removing
`CONFIG_BT_RECV_BLOCKING` will give a cleaner separation between
`hci_core` and the drivers and allow `hci_core` to evolve without
changes spilling out into the drivers.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-02-26 11:36:48 +00:00
Gaetan Perrot
a4ea4e294f posix: Implement test for fdetach and fattach
Add tests for `fdetach()` and `fattach()`

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2024-02-26 11:36:04 +00:00
Gaetan Perrot
6a5af7b5e1 doc: posix: mark fdetach and fattach as supported
`fdetach()` and `fattach()` are now implemented, mark it so.

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2024-02-26 11:36:04 +00:00
Gaetan Perrot
cd060f6cd3 posix: Implement fdetach and fattach
`fdetach()` and `fattach()` are required
as part of _XOPEN_STREAMS Option Group.

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2024-02-26 11:36:04 +00:00