Commit graph

24,075 commits

Author SHA1 Message Date
Måns Ansgariusson
bb515812d0 testsuite: ztest: benchmark: namespace generated linker symbols
Add identifier builders and route the ZTEST_BENCHMARK*() macros through
them. Suite, benchmark and wrapper-function symbols are now prefixed and
qualified by suite name, preventing collisions between identically-named
benchmarks in different suites and keeping user identifiers out of the
global symbol space.

Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
2026-05-12 17:12:50 +02:00
Liu Qian
c7f69b220f subsys/profiling: use ipicall to support perf smp
before perf use timer to call sample in one core.
and donot support smp.
after ipi support new feature k_ipi_work.so we
can use timer to send ipicalls to other cpus,then
active sample in other cores.

Signed-off-by: Liu Qian <liuqian.andy@picoheart.com>
2026-05-12 17:10:36 +02:00
Emil Gydesen
0cd61589ff Bluetooth: BAP: BA: Move att_buf to inst
Since the Broadcast Assistant implementation may have a
pending request _per_ instance, each instance needs its own
buffer to accomodate that, otherwise we may risk overwriting
data between instances. This follows the design used in the
BAP Unicast Client

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-05-12 11:17:40 +02:00
Petr Hlineny
4f33728ffe net: l2: ppp: misc: add missing net_log.h include
`subsys/net/l2/ppp/misc.c` uses NET_DBG() inside
`validate_phase_transition()`, which is compiled only when
CONFIG_NET_L2_PPP_LOG_LEVEL is at LOG_LEVEL_DBG. The macro is
declared in <zephyr/net/net_log.h>, which the file does not include.

At log level INF (default) the function body is a no-op stub
(ARG_UNUSED), so the missing macro goes unnoticed. At log level DBG
the file fails to build:

  misc.c: implicit declaration of function 'NET_DBG'
          [-Wimplicit-function-declaration]

Other files in the same directory (e.g. `link.c`) include
<zephyr/net/net_log.h> correctly; only `misc.c` is missing it.

Signed-off-by: Petr Hlineny <development@hlineny.cz>
2026-05-12 09:14:23 +02:00
Jukka Rissanen
a2ec996a55 net: ssh: Remove unused function
The ssh_mbedtls_rand() is not used so can be removed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-12 09:11:43 +02:00
Philipp Steiner
e38681e526 net: ptp: rename UDP IP Kconfig symbols
Rename the PTP UDP IPv4/IPv6 protocol Kconfig symbols to use
consistent all-uppercase IP version naming.

Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
2026-05-12 09:07:42 +02:00
Zhaoxiang Jin
a24c4e27d2 cpu_freq: pressure: use CPU_ID macro for current CPU id
Replace the broken `_kernel.cpus[cpu].current` reference (which used
an undefined `cpu` variable) and the open-coded `arch_curr_cpu()->id`
pattern with the standard `CPU_ID` macro from `<zephyr/kernel_structs.h>`.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-05-12 08:59:55 +02:00
Zhaoxiang Jin
c480a17642 cpu_freq: pressure: avoid divide-by-zero in pressure normalization
When no runnable threads contribute to the pressure accumulator,
max_pressure stays at zero and the subsequent division would trigger
undefined behavior. Return a normalized pressure of 0 in that case.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-05-12 08:59:55 +02:00
Jukka Rissanen
d3dfbfb3d3 shell: aliases: Do not enable by default
As the aliases support will increase stack usage, turn the
feature off by default in order to avoid surprises with
tests and samples.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-12 08:57:40 +02:00
Fin Maaß
e164455d68 net: net_if: don't zero the iface name
the name inside of struct net_if_config, that is
part of struct net_if does not need to be zeroed,
as that is already the initial value.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-11 15:32:47 +01:00
Kristoffer Skøien
a03b6d540a usb: uac2: Adjust log level
The ECONNABORTED occurs on host stop and start.
Lowered the log level.

Signed-off-by: Kristoffer Skøien <kristoffer.skoien@nordicsemi.no>
2026-05-11 15:32:34 +01:00
Jukka Rissanen
dd3fcffa1c shell: Add support for tab completion for aliased subcommands
Make sure user is able to tab complete aliased subcommands.

Assisted-by: Copilot:gpt-5.4
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 15:30:56 +01:00
Jukka Rissanen
363c8a1581 shell: Add aliases support
Allow user to specify a file containing command name aliases.
The format of the file is:

    # This is an example aliases file. The file can have
    # comments on it.
    stacks="kernel thread stacks"
    foo=bar

There is "aliases" shell command that can show the current
list of aliases specified in the system.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 15:30:56 +01:00
Sylvio Alves
e744858936 net: ssh: replace removed CONFIG_NET_SOCKETS_POLL_MAX
CONFIG_NET_SOCKETS_POLL_MAX was deprecated in v4.0 and removed in
v4.5 in favour of CONFIG_ZVFS_POLL_MAX. Update the SSH server
BUILD_ASSERT and the sample/test prj.conf files accordingly so the
symbol resolves and the assertion remains effective.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-05-11 15:28:42 +01:00
Jukka Rissanen
85dc4b4904 net: shell: ssh: Close client connection automatically
When the client connection to external peer is terminated,
close the client automatically so that user does not need
to do it manually by "net ssh stop"

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 13:40:07 +02:00
Jukka Rissanen
6e3c1b7255 net: shell: ssh: Add kill command to stop ssh server connection
Allow user to kill an active ssh connection. This is useful as
otherwise it is impossible to stop incoming connection without
affecting other incoming connections. It is always possible to
stop the ssh server but then that kills all incoming client
connections and that might not be desired.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 13:40:07 +02:00
Jukka Rissanen
ca561c7222 net: shell: ssh: Add list command
Add a list command that can show information about active
client and server ssh connections.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 13:40:07 +02:00
Jukka Rissanen
96a2dc957b net: ssh: Add functions to traverse client/server connections
This is used by shell to print client and server connections.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 13:40:07 +02:00
Jukka Rissanen
6a47844a18 net: dns: Avoid unused variable warning
If both CONFIG_NET_IPV6 and CONFIG_NET_IPV4 are disabled, then
the addr_len in resolve.c dns_resolve_init_locked() will be
unused which will cause a warning.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 13:40:07 +02:00
Jukka Rissanen
743132fe7e net: ssh: server: Print information banner after login
Print information how to exit the shell to remote client.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 13:40:07 +02:00
Jukka Rissanen
e22c29c8d4 net: ssh: server: Add multi instance support
Allow multiple incoming SSH connections if we are the server.
This is controlled by CONFIG_SSH_SERVER_SHELL_COUNT option, the
default value is 1 so only one simultaneous ssh connections by
default.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 13:40:07 +02:00
Grant Ramsay
18ae068890 net: ssh: connection: Fix incorrect local channel ID
The local channel ID was immediately memset to zero after being set.
This caused issues when allocating multiple channels

Signed-off-by: Grant Ramsay <grant.ramsay@hotmail.com>
2026-05-11 13:40:07 +02:00
Jukka Rissanen
c320e3712b net: config: Add starting of ssh server
If user application calls the new API, then SSH server is
automatically started when the device boots.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 13:40:07 +02:00
Jukka Rissanen
ca2871b847 net: shell: Add ssh shell support
Add support for starting a ssh server or connecting to peer using ssh
to net-shell

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 13:40:07 +02:00
Jukka Rissanen
2736baba9c shell: Add ssh backend
Add ssh backend for client and server.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 13:40:07 +02:00
Jukka Rissanen
610c94f57e net: ssh: Add SSH client and server support
Add support for SSH client and server connections.
Original code is from https://github.com/grantramsay/zephyr-ssh

Following modifications are done by this commit compared to original
one:
- Coding style issues, like converting // comments to /* */ ones
- Converting to use PSA APIs
- Add IPv6 support

Signed-off-by: Grant Ramsay <grant.ramsay@hotmail.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 13:40:07 +02:00
Aleksandr Khromykh
a9ad258c84 bluetooth: mesh: fix BLOB IO flash write alignment for non-erase devices
The wr_chunk function had a fast path for devices without explicit erase
(e.g. nRF54L RRAM) that wrote chunk data directly without aligning the
offset or size to the flash write block size. On RRAM with
write-block-size=16, this caused -EINVAL from the flash driver for every
chunk write since chunk_size (161) and most chunk offsets are not
16-byte aligned.

The failed writes caused the BLOB server to never mark chunks as
received, resulting in block_status_rsp always reporting all chunks
missing. This led to infinite retransmission of block 0 and eventual
DFU timeout.

Fix by using a read-modify-write approach for non-erase devices:
read existing data at the aligned boundaries, overlay the chunk data,
and write back the full aligned buffer. This satisfies the driver's
alignment requirements while preserving neighboring bytes.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2026-05-11 10:59:49 +02:00
Jordan Yates
4679c69889 modem: cmux: fix flow control for user pipes
Once `rx_full` has been set, the modem is instructed to no longer send
data on that DLCI channel until we notify the modem that the channel is
able to receive more data. This happens in the RX callback which drains
the pipe.

Currently the amount of free space required in the ring buffer to
release the flow control condition is hardcoded to
`CONFIG_MODEM_CMUX_MTU`. While this value is fine for the DLCI1 and
DLCI2 channels (which have buffers created as
`CONFIG_MODEM_CMUX_MTU + N` bytes large), the user pipes with size
`MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES` are typically much smaller. This
lead to the flow control condition never being released on the user
pipe DLCI channels once it was set.

Fix the issue by limiting the threshold to the capacity of the ring
buffer, so that if the buffer is completely empty we will always release
the flow control condition.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-05-11 08:49:18 +02:00
Jordan Yates
3eb2355dcb modem: chat: make work buffer size configurable
Switch out the hardcoded 32 byte buffer for a Kconfig option.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-05-11 08:48:59 +02:00
Jukka Rissanen
7b952f5cb2 net: utils: Add net_port_get/set helper functions
Add helpers for setting or getting a port number from net_sockaddr
struct.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 08:48:45 +02:00
Jukka Rissanen
6ee7df7c2b net: shell: quic: Use net_sockaddr and not net_sockaddr_storage struct
When calling other functions, pass "struct net_sockaddr" instead of
"struct net_sockaddr_storage" as the former is usually passed around
between functions. This is a style issue and there is no functionality
changes by this commit.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 08:48:45 +02:00
Jukka Rissanen
7e12084f0f net: quic: Remove unnecessary pointer checks for stats functions
Some of the statistical collector functions were checking null
pointers without a reason. The pointers cannot be null at this point
and the callers already have those checked.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 08:48:45 +02:00
Jose Sanchez
8e633d97f7 posix: mqueue: fix mq_unlink errno for non-existent queue
mq_unlink() was setting errno to EBADF when the named message queue
did not exist. POSIX IEEE 1003.1-2017 specifies ENOENT for this case,
as EBADF is reserved for invalid file descriptors.

Fixes #106002

Signed-off-by: Jose Sanchez <jsanchezrs828@gmail.com>
2026-05-11 08:46:28 +02:00
Krzysztof Chruściński
667c3184d6 logging: log_output: Fix formatting of function prefix
When function prefix is used then formatting is expected to be
<source_name>.<func_name> but it was as if function prefix was
not used <source_name>: <func_name>.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-05-11 04:01:49 +02:00
Emil Gydesen
756b16b643 Bluetooth: ISO: Add missing buf->len checks in bt_iso_recv
bt_iso_recv pulls the SDU header (with or without) timestamp,
but did not check the length of `buf` before doing so.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-05-08 16:04:41 -05:00
Luming Ou
e1434e141e logging: fix immediate clean output locking on SMP
Only same-CPU recursive logging should bypass the clean-output
process lock. The previous owner-tracking logic also skipped the
lock when another CPU already owned clean-output processing,
allowing concurrent backend processing on SMP.

Fix that by requiring the process lock whenever the owner differs
from the current CPU, by assigning the owner only after the
spinlock is acquired, and by keeping the lock-decision helper
local to log_core.c.

Tested with:
- west build -b native_sim/native/64 tests/subsys/logging/log_immediate \
  -d build-log-immediate-green --pristine -- \
  -DCONFIG_LOG_IMMEDIATE_CLEAN_OUTPUT=y \
  -DZEPHYR_TOOLCHAIN_VARIANT=host
- ./build-log-immediate-green/zephyr/zephyr.exe
- west build -b native_sim/native/64 tests/subsys/logging/log_immediate \
  -d build-log-immediate-default --pristine -- \
  -DZEPHYR_TOOLCHAIN_VARIANT=host
- ./build-log-immediate-default/zephyr/zephyr.exe

Signed-off-by: Luming Ou <olm_cse@hust.edu.cn>
2026-05-08 15:59:31 -05:00
Robert Lubos
fba8fb4070 net: openthread: Remove deprecated APIs
Remove OpenThread APIs that were deprecated in Zephyr 4.2.0.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-05-08 16:02:17 +01:00
Robert Lubos
3867c1f8d3 net: if: Remove deprecated APIs
Remove network interface APIs that were deprecated in Zephyr 4.1.0.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-05-08 16:02:17 +01:00
Robert Lubos
b3d4e29e08 net: sockets: Remove deprecated CONFIG_NET_SOCKETS_POLL_MAX
The CONFIG_NET_SOCKETS_POLL_MAX Kconfig option was deprecated in
Zephyr 4.0.0, remove it and any leftover in-tree option use.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-05-08 16:02:17 +01:00
Robert Lubos
6cdd2d36f4 net: tc: Remove deprecated CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO
The CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO Kconfig option was deprecated in
Zephyr 4.1.0, remove it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-05-08 16:02:17 +01:00
Riadh Ghaddab
64997e4447 tests: kvss: zms: fix tests for native_sim/native/64 board target
Fix number of writes to trigger a GC for native_sim/native/64 board
as it has a different sector size.
Fix the returned value for zms_free_space when ate_wra < data_wra.
Skip test_zms_gc_3sectors for targets that have a sector size different
than 1KB.

Signed-off-by: Riadh Ghaddab <riadh.ghaddab@nordicsemi.no>
2026-05-08 06:48:04 -05:00
Carlo Caione
68c95f8e8f lorawan: native: reject unsupported downlink FOpts
Downlink MAC commands are not parsed yet.

Reject frames that carry FOpts before advancing FCntDown so the stack
does not silently consume network commands it cannot handle.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2026-05-08 11:25:50 +02:00
Carlo Caione
de3d359c0f lorawan: native: bound confirmed retry count
LoRaWAN NbTrans is encoded in the 1..15 range.

Reject zero and out-of-range values so confirmed sends cannot block for
an unexpectedly large number of attempts.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2026-05-08 11:25:50 +02:00
Carlo Caione
c508df15c6 lorawan: native: serialize mutable API state
Several public APIs update or consume shared MAC state while the engine
thread is processing join and send requests.

Use a single API mutex for join, send, and mutable setters so only one
public operation can touch the native LoRaWAN state at a time. Also
reject region changes after the stack has started.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2026-05-08 11:25:50 +02:00
Carlo Caione
755784b934 lorawan: native: validate downlink FOpts length
Do not trust FCtrl.FOptsLen until it has been checked against the actual
frame length.

Reject frames whose FOpts area would overlap the MIC or extend past the
received buffer before verifying the MIC or updating FCntDown.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2026-05-08 11:25:50 +02:00
Carlo Caione
ea1e48121e lorawan: native: reuse confirmed frame for retries
Confirmed uplink retries must retransmit the same LoRaWAN frame.
Rebuilding each attempt advanced FCntUp and changed the MIC, allowing a
missed ACK to turn a retry into a second application uplink.

Build the frame once, reuse it for confirmed retry attempts, and consume
FCntUp once after transmission.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2026-05-08 11:25:50 +02:00
Carlo Caione
e4af8f1912 lorawan: require channel mask after stack start
Channel masks apply to the region channel plan initialized by
lorawan_start(). Accepting a mask before start leaves the backend without
a concrete channel table to update.

Document the ordering requirement in the public API and have the native
backend return -EPERM until the stack has been started.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2026-05-08 11:25:50 +02:00
alperen sener
67049acb23 bluetooth: host: gatt: add helper bt_gatt_is_db_hash_valid test function
Adding a helper test function to check if the DB hash is valid.

Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
2026-05-08 11:24:15 +02:00
alperen sener
78a53b541b bluetooth: host: gatt: destroy imported key in case psa mac sign fail
Imported key is not destroyed in case psa mac sign fails. This is a
potential memory leak.

Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
2026-05-08 11:24:15 +02:00
Tomasz Leman
60aaf222e5 llext: fix inverted loop bounds check in dependency iteration
Swap condition order in two for-loops in llext_experimental.c so the
bounds check (j < ARRAY_SIZE) is evaluated before the array access.
The previous order caused an off-by-one OOB read when all 8 dependency
slots were populated.

Aligns with the correct pattern already used in llext_link.c.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2026-05-08 08:06:03 +02:00