Commit graph zephyr/subsys
Author SHA1 Message Date
Johann Fischer
37dd670aa6 usb: host: add helper to check if any drivers are bound
A successful usbh_class_*probe() is the only reliable signal that a
driver supports a function. Add helper to check if any drivers are bound
to a device interface.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-09-16 16:42:36 +01:00
Johann Fischer
c5c1fa1e18 usb: host: probe and unbind drivers upon configuration change
Class driver can only decide whether they support an interface or
function once the device is in configured state. Move
usbh_class_probe_device() into usbh_device_set_configuration(), so
binding alsway happens agains an configured device.

It also fixes the assumption that usbh_class_probe_function() is called
with the device mutex locked.

When the configuration changes, any drivers using it should be unbound.
Keep the device in the addressed state, even if there is an error during
configuration set.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-09-16 16:42:36 +01:00
Johann Fischer
78cdbf2b91 usb: host: fix possible memory leak in usbh_device_set_configuration()
The user or application should be able to set a specific USB device
configuration. This is, therefore, a required function that a host stack
must provide and it needs to be safe to call again on an already
configured device.
usbh_device_set_configuration() is not yet ready to be a public
interface. It leaks memory buffers when called in the configured state.
Note that this is not reachable in the current state of the host stack.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-09-16 16:42:36 +01:00
Johann Fischer
2a050a5749 usb: host: move usbh_device_connect()/disconnect() to right place
Align with the usual style and move usbh_device_connect() and
usbh_device_disconnect() behind their dependencies.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-09-16 16:42:36 +01:00
Vinayak Kariappa Chettimada
c91fb6ead2 Bluetooth: Controller: Fix flash sync unsigned underflow
Fix flash sync implementation unsigned underflow that caused
timeout with Bluetooth and settings enabled.

Fixed by using the Controller's EVENT_OVERHEAD_START_US CPU
overhead timing as the minimum interval between flash
operation in co-operation with Bluetooth tickers.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-09-16 16:26:01 +01:00
Emil Gydesen
bcb44b68f8 Bluetooth: CAP: Move subproc_initiated assignment under lock
Modifications to `active_proc` shall be done while it is
locked.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-09-16 16:20:40 +01:00
Benjamin Cabé
587cadd1ff net: midi2: zero-initialize the peer address storage
netmidi2_service_handler() takes the address of peer_addr before
zsock_recvfrom() fills it in, which GCC flags as a maybe-uninitialized
use on some target and optimisation combinations and, with -Werror,
breaks the build. Zero-initialize the storage at declaration, as other
zsock_recvfrom() callers in subsys/net already do.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
2026-09-16 16:19:59 +01:00
Pavel Vasilyev
479ff4b391 net: ipv6: support RFC7527 DAD nonce
Attach nonce option to DAD NS probes and ignore reflected probes whose
nonce matches the tentative address state.

From RFC 7527 (Enhanced DAD):

- Section 1 (Introduction):
```
If hardware cannot suppress looped back DAD messages, a software
solution is required.
```

- Section 4.1 (Sender rules):
```
...the sender MUST generate a random nonce..., MUST store the nonce
internally, and MUST include the nonce in the Nonce option included in
the NS(DAD).  ```

- Section 4.2 (Receiver rules):
```
...the receiver compares the nonce included in the message, with any
stored nonce... If a match is found... [it] MUST drop the received
message.  ```

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2026-09-16 09:24:55 +02:00
Kai Cheng
e81355223f bluetooth: classic: shell: include the Report ID in Boot Protocol reports
The mouse report the hid_device shell sends on the Interrupt channel left
the Report ID out in Boot Protocol Mode, while the GET_REPORT response of
the same shell always included it. HID spec v1.1.2 Section 3.3.2 puts both
under one rule: every report a Device sends in Boot Protocol Mode, either
asynchronously on the Interrupt channel or in answer to GET_REPORT, has to
include the Report ID. A Host that follows this strips the first byte, so
what it read as the button bits was the Report ID and the whole report was
off by one.

Send it in both modes, which leaves the wheel byte as the only difference
between them and gives the two paths the same shape. The value does not
change: Boot Protocol Mode fixes the mouse Report ID to 2, and the
descriptor this shell registers declares 2 as well.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-09-16 09:23:53 +02:00
Cheng Yueh
73c6a4ed95 mgmt: ec_host_cmd: shi_ite: defer interrupt enable until backend init
The shi_ite driver unmasks the SPI peripheral interrupt while
initializing the device at POST_KERNEL priority 40, but the rx
context is only assigned later, when ec_host_cmd_init() calls
shi_ite_backend_init() at priority 80.

If the host AP starts a transaction within that window, for instance
right after a warm jump from RO to RW, the interrupt fires before
data->rx_ctx is assigned. shi_ite_parse_header() then dereferences
the NULL pointer, which triggers a fatal store access fault
(mcause 7) when PMP null pointer detection is enabled.

Leave the interrupt masked and the state at SHI_STATE_DISABLED
during device init, then set both in shi_ite_backend_init() once
the buffers are known good.

Also check rx_ctx in the interrupt handler, so that the invariant
holds even if the interrupt is unmasked from another path. Reaching
the handler without a rx context is not expected, so log it, and
write clear the status before returning to avoid an interrupt storm.

Signed-off-by: Cheng Yueh <fenzhangs@gmail.com>
2026-09-16 09:23:24 +02:00
Vilhelm Engström
226e821d85 net: virtual: Drop packets received on non-virtual interfaces
ethernet_recv() calls the VLAN interface's L2 recv with the Ethernet
interface as argument to allow the packet to be dispatched through the
list of attached VLAN interfaces. If none of said interfaces handles the
packet, for example due to the matching VLAN interface being down,
virtual_recv() falls through to the path that handles a virtual
interface with nothing attached and calls dev->api->recv. For the
Ethernet interface, dev->api is a struct ethernet_api rather than a
struct virtual_interface_api. This results in the aforementioned call
invoking an unrelated driver callback - get_capabilities or get_config
depending on whether or not CONFIG_NET_STATISTICS_ETHERNET is set -
with the net_if pointer as device argument, the net_pkt as the interface
ditto and potential remaining parameters omitted.

Signed-off-by: Vilhelm Engström <vilhelm.engstrom@tuta.io>
2026-09-16 07:41:45 +02:00
Emil Gydesen
503e06521b Bluetooth: BAP: SD: Re-request broadcast code after bad code
When a broadcast sink fails to decrypt a BIG due to a bad broadcast
code, the BASS receive state is left at Bad_Code. If the broadcast
assistant subsequently sends a Modify Source operation requesting BIS
sync again before providing a new broadcast code, the scan delegator
did not notify Broadcast_Code_Required again, leaving the assistant
with no indication that a new code is expected.

Reset the receive state back to Broadcast_Code_Required as soon as the
Modify Source operation requesting a BIS sync is received, matching
the BASS requirement to request a Broadcast_Code whenever the server
does not have a key to decrypt a BIS it is trying to sync to. This is
done directly in the scan delegator when the request is received,
rather than depending on the application calling
bt_bap_broadcast_sink_sync() again.

Extend the bsim BAP broadcast sink/assistant tests to cover the
retry-after-bad-code scenario: the assistant requests BIS sync again
before sending the correct code, and the test verifies the receive
state changes back to Broadcast_Code_Required instead of staying at
Bad_Code.

Tested by running the extended
bap_broadcast_audio_assistant_incorrect_code bsim test, which fails
without the fix (times out waiting for the repeated Broadcast_Code
notification) and passes with it. Also ran
bap_broadcast_audio_assistant, bap_broadcast_audio_encrypted and
bap_broadcast_audio_encrypted_incorrect_code to confirm no
regressions. Not built or tested on hardware.

Fixes #111790

Assisted-by: Copilot:claude-opus-5
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-09-16 07:39:34 +02:00
Emil Gydesen
81e9d94d00 Bluetooth: ISO: Add send_failed callback
Add callback to handle cases where an accepted send fails due to a
disconnect or a call to bt_disable.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-09-16 07:31:55 +02:00
Johan Hedberg
7e9d9d41ee Bluetooth: Host: Reject RPA-directed advertising the peer cannot receive
A directed advertisement with an RPA target address can only be
received by a peer that supports address resolution: an initiator
responds only to a directed advertisement that carries its own device
address (Core 6.3, Vol 6, Part B, 4.4.4.1), and an RPA target address
is only recognized as its own if the initiator resolves it with its
local IRK (Vol 6, Part B, 4.7 and 6.4). Starting such advertising
towards a peer known not to support address resolution can therefore
never lead to a connection.

Fail bt_le_adv_start(), bt_le_ext_adv_create() and
bt_le_ext_adv_update_param() with -ENOTSUP when
BT_LE_ADV_OPT_DIR_ADDR_RPA is used towards a bonded peer whose stored
Central Address Resolution value says address resolution is not
supported. An unknown value keeps the previous behaviour, as
recommended by Core 6.3, Vol 3, Part C, 12.4. This also aligns with
GAP, which allows a privacy-enabled Peripheral to use directed
connectable mode only when the peer supports address resolution in
the Controller (Vol 3, Part C, 10.7.1.1).

Fixes: #101955

Assisted-by: Claude:claude-fable-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-09-16 07:29:35 +02:00
Johan Hedberg
aa0bad8767 Bluetooth: GATT: Track the peer's Central Address Resolution support
The GAP section of the Core specification recommends that a Peripheral
checks whether its peer supports address resolution, by reading the
Central Address Resolution characteristic, before using directed
advertising with an RPA target address. The host has so far left both
the read and the conclusion entirely to the application.

Read the characteristic once when a bond is created, following the
same pattern as the other automatic GATT client operations, and store
the result in the bond. An absent characteristic means address
resolution is not supported (Core 6.3, Vol 3, Part C, 12.4). The read
is also triggered on an encrypted reconnection when the answer is
missing, which covers bonds created before this option existed. Errors
other than Attribute Not Found leave the answer unknown, to be read
again on the next connection.

The stored answer is available to the application through the new
bt_le_bond_addr_res_support(), so that it can take the peer's ability
into account when choosing how to advertise. The completion of the
read is reported through a new bt_conn_auth_info_cb callback, so that
the application knows when the answer is available.

The stored keys format is unchanged: the answer lives in two
previously unused bits of the flags field, so existing bonds load as
having an unknown value.

Part of fixing #101955

Assisted-by: Claude:claude-fable-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-09-16 07:29:35 +02:00
Måns Ansgariusson
0bde5ccbeb lib: ring_buffer: drop select/depends on RING_BUFFER
The slim ring buffer API is now header-only and always available and the
tree has already migrated from the _claim/_finish API, so the RING_BUFFER
symbol no longer gates any code.
Remove the now-redundant "select RING_BUFFER" and CONFIG_RING_BUFFER=y
entries across drivers, subsystems, samples and tests.

Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
2026-09-16 07:29:22 +02:00
Måns Ansgariusson
6411514b9f lib: ring_buffer: new header-only implementation
The new implementation provides a full SPSC ring buffer API, reducing the
size of the ring_buffer struct to 12 bytes(on a 32-bit arch), and increases
the throughput of the ring buffers hot path by ~30% (measured on nRF5340).

The default variant drops the claim/finish and item APIs functionality to
reduce the struct size. During the deprecation period, the old APIs are
still reachable through the CONFIG_RING_BUFFER Kconfig option.

Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
2026-09-16 07:29:22 +02:00
Fin Maaß
33d713d3da net: lldp: join the LLDP multicast group while a receiver is registered
A device that filters multicast frames in hardware drops the LLDP
frames, which are sent to the nearest bridge group address
01:80:C2:00:00:0E, unless it is told to listen to that address. Received
frames are only useful when a callback is registered, so join the group
with net_eth_mcast_addr_add() when net_lldp_register_callback() sets the
first callback, and leave it again when the callback is unregistered
with NULL.

State with NET_L2_ETHERNET_MCAST_FILTER_ADD_COUNT_LLDP that LLDP needs
one address per interface, so that the L2 reserves an entry for it.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-09-16 05:58:57 +02:00
Fin Maaß
7ca8a03331 net: gptp: join the gPTP multicast group on every port
A device that filters multicast frames in hardware drops the gPTP
messages, which are all sent to the nearest bridge group address
01:80:C2:00:00:0E, unless it is told to listen to that address. Join
the group with net_eth_mcast_addr_add() when a port is added, so that
the receive filter of the device is programmed. The group is never left
as gPTP ports are never removed.

State with NET_L2_ETHERNET_MCAST_FILTER_ADD_COUNT_GPTP that gPTP needs
one address per interface, so that the L2 reserves an entry for it.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-09-16 05:58:57 +02:00
Fin Maaß
d72a81e84c net: lldp: depend on NET_NATIVE
for LLDP we use use parts of the network subsystem,
that only work without offloading, so add a dependency for
it.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-09-16 05:58:57 +02:00
Fin Maaß
496bea206f net: gptp: depend on NET_NATIVE
for gPTP we use use parts of the network subsystem,
that only work without offloading, so add a dependency for
it.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-09-16 05:58:57 +02:00
Fin Maaß
d3fdf5a872 net: ethernet: mcast: track addresses whenever something asked for one
Define NET_ETH_MCAST_FILTER_SUPPORTED from the number of L2 multicast
addresses that the build system summed up instead of listing the
subsystems that join the groups. The IP level and the packet sockets each
state how many addresses they need through their own
NET_L2_ETHERNET_MCAST_FILTER_ADD_COUNT_ option, so the count is non-zero
exactly when one of them is enabled, and any other user of the groups
only has to add such an option to get the tracking compiled in.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-09-16 05:58:57 +02:00
Lyle Zhu
54f07618dc bluetooth: classic: sdp: remove K_FOREVER from service buf allocation
Add a new function `sdp_svc_create_pdu()` that uses `K_NO_WAIT`
timeout to allocate the net buffer for SDP service role.

Add response buffer management to struct bt_sdp with `rsp_buf` field
to hold pre-allocated response buffers.

Call the function `sdp_svc_create_pdu()` to allocate response buffer
and save to `sdp->rsp_buf` in the function `bt_sdp_recv()`. And use
function `net_buf_take()` to take the pre-allocated buffer in the
functions `sdp_svc_search_req()`, `sdp_svc_att_req()`,
`sdp_svc_search_att_req()`, and `send_err_rsp()`.

Add receive buffer tracking with `recv_pending` and `recv_state` fields
to save incoming requests when response buffers are unavailable.

Implement `sdp_svc_work_handler()` to retry processing pending SDP
requests when net buffers become available.

Update `sdp_destroy()` callback to trigger retry of SDP service
processing by submitting sdp_svc_worker when buffers are freed.

Add cleanup of response and pending buffers in `bt_sdp_disconnected()`
to prevent memory leaks.

The changes prevent the `bt_workq` from blocking when there are no
available net buffers in `sdp_pool` for SDP service role.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-09-16 05:53:25 +02:00
Lyle Zhu
c43dcb2656 bluetooth: classic: sdp: remove K_FOREVER from client buf allocation
Add a new function sdp_client_create_pdu() that uses `K_NO_WAIT`
timeout to allocate the net buffer for SDP Client role.

Add error handling for buffer allocation failures in service search,
attribute search, and service attribute search functions.

Introduce a flag `SDP_CLIENT_FLAG_WAIT_FOR_TX_BUF` to track when client
is waiting for TX buffer availability.

Add retry logic in `sdp_client_work_handler()` to resume SDP record
discovery if the flag `SDP_CLIENT_FLAG_WAIT_FOR_TX_BUF` of the client
has been set.

Implement sdp_destroy() callback for the net pool `sdp_pool` to
trigger retry of SDP discovery when any net buffers become available.

Also, clear client flags during request cleanup.

The changes prevent the `bt_workq` from blocking when there are no
available net buffers in `sdp_pool`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-09-16 05:53:25 +02:00
Kai Cheng
8c398ec652 bluetooth: classic: shell: add HID Host commands
Add hid_host shell commands to exercise the HID Host profile:

- register / unregister
- sdp_discover
- connect / disconnect / select <address>
- get_report <type> <id> <buf_size>
- set_report <type> <hex...>
- get_protocol / set_protocol <boot|report>
- send <hex...> (output report on the interrupt channel)
- suspend / exit_suspend
- vcu (virtual cable unplug)

The profile does not read the HID service record, so sdp_discover does it
here: it reads the report descriptor and the device attributes and walks
the descriptor for a Report ID Global item. The Report ID is then split off
incoming reports and added to GET_REPORT requests, which is the work an
application has to do (HID spec v1.1.2 Section 3.1.2.3 and Section 3.3.1).
Only the descriptor is required; the remaining attributes are optional in
the record, so a missing one is reported and the rest is still read.

The profile associates with one HID Device per ACL connection, so the state
the shell keeps for a peer is indexed by connection index as well: the
report descriptor outcome, the protocol mode, the pending unplug and the
SDP discovery parameters. Sharing one set would mix up a keyboard that
declares Report IDs with a mouse that does not, destroy the bonding of the
wrong peer, or put the same SDP request node on two lists. The connected
callback points the selected instance at whatever associated last, so
select reaches the other one while both are up.

A Virtual Cable Unplug destroys the bonding as required by Section
3.1.2.2.3, deferred until the channels have closed so that the ACL is not
dropped from under them.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-09-16 05:50:36 +02:00
Kai Cheng
f7858e15e0 bluetooth: HID: add HID Host profile support
Add the HID Host side of the Bluetooth Classic HID profile, letting a
Zephyr device drive HID peripherals such as keyboards, mice and gamepads,
as defined in HID spec v1.1.2.

The profile owns the HIDP framing and the association:

- host-initiated connection, opening the control channel first and the
  interrupt channel once it is up (Section 5.2.2)
- device-initiated connection through L2CAP servers on both PSMs
- GET_REPORT / SET_REPORT and GET_PROTOCOL / SET_PROTOCOL on the control
  channel, with a single outstanding transaction (Section 3.2.1)
- output reports sent and input reports received on the interrupt channel
- SUSPEND / EXIT_SUSPEND and Virtual Cable Unplug in both directions
- connection pool indexed by ACL connection index

Reading the HID service record is left to the application. Both PSMs are
fixed, so the profile needs nothing from the record to open the channels,
and report payloads are handed over as received: whether one starts with a
Report ID follows from the report descriptor and from the protocol mode,
which only the application knows (Section 3.1.2.3 and Section 3.3.1).
This matches the HID Device side, which does not store a descriptor
either, and follows MAP and PBAP, where SDP discovery lives in the
application.

Both channels request an MTU of BT_L2CAP_RX_MTU as required by Section
5.2.3.1, the interrupt channel is closed before the control channel per
Section 5.2.2, and a control transaction that is never answered is bounded
by a timer so the association cannot stay blocked (Section 5.2.6).

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-09-16 05:50:36 +02:00
Kai Cheng
77c2c27df2 bluetooth: classic: HID: share the protocol values between both roles
Move the HID protocol values an application needs into a new
<zephyr/bluetooth/classic/hid.h> and include it from hid_device.h, so a
second role can reuse them instead of defining its own copy.

Protocol mode, report type and HANDSHAKE result codes are carried by the
same HIDP messages in both directions, so they belong to neither role.
Keeping a copy per role means two public headers cannot be included in the
same translation unit unless every replacement list stays textually
identical, which is not something a compiler warns about until it breaks.

The internal copies go away with it: hid_internal.h loses the HANDSHAKE
result codes it repeated from the public header and BT_HID_PAR_REP_TYPE_*,
which named the same report types a second time. Message types, HID_CONTROL
operations and the header field masks stay internal since they are HIDP
framing that no application has to know about.

This follows the layout other stacks use for the same reason: BTstack keeps
btstack_hid.h next to hid_host.h and hid_device.h, and Fluoride keeps
hiddefs.h next to hidh_api.h and hidd_api.h.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-09-16 05:50:36 +02:00
Pisit Sawangvonganan
09189f9ccd logging: syst: avoid recomputing strlen() in write_d32ts
Optimize `write_d32ts()` where `strlen(pattern)` was
unnecessarily recomputed on every loop iteration even though the
string argument never changed within the loop.

Assisted-by: Claude:Haiku 4.5
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-09-16 05:43:25 +02:00
Pisit Sawangvonganan
d6b66f1a62 net: wifi: utils: avoid recomputing strlen() in channel validation
wifi_utils_validate_chan_str() called strlen(chan_str) on every
iteration of its validation loop, even though the string does not
change during the loop. Compute the length once and reuse it.

Its only caller passes a fixed-size local array, which is never
NULL, so drop the NULL check and keep only the empty-string check.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-09-16 05:43:25 +02:00
Pisit Sawangvonganan
5febb0aa90 Bluetooth: classic: shell: avoid recomputing strlen() in loops
Optimize HFP command handlers where strlen(action) was unnecessarily
recomputed on every loop iteration even though the string argument
never changed within the loop.

The affected functions:
- cmd_ag_vre_state(): strlen(action) recomputed in action parsing
- cmd_ag_vre_text(): strlen(action) recomputed in action parsing

Store the string length in a local variable before the loop and reuse it
throughout, eliminating redundant strlen() calls.

Assisted-by: Claude:Haiku 4.5
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-09-16 05:43:25 +02:00
Pisit Sawangvonganan
f3176492ea shell: utils: avoid recomputing strlen() for loop-invariant strings
Optimize shell device enumeration functions where strlen() was
unnecessarily recomputed on every loop iteration even though the
string argument never changed within the loop.

The affected functions:
- shell_device_internal(): strlen(prefix) recomputed in device enumeration
- shell_device_get_binding_all(): strlen(name) recomputed in device lookup
- device_has_nodelabel(): strlen(name) recomputed in nodelabel comparison

Store the string length in a local variable before the loop and reuse it
throughout, eliminating redundant strlen() calls in hot paths.

Assisted-by: Claude:Haiku 4.5
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-09-16 05:43:25 +02:00
Muhammad Waleed Badar
578eb04698 net: shell: http_client: zero-copy payload and headers
Point ctx->payload and headers[] directly at state->optarg/HTTP_CRLF
instead of copying into fixed buffers, since both outlive the
synchronous http_client_req() call. Drop payload[], header_data[],
and HTTP_HEADER_SIZE. Bump HTTP_HEADERS_LEN 2 -> 3 for value+CRLF+NULL.

Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
2026-09-16 05:41:54 +02:00
Phi Bang Nguyen
31f7c68c1c mpipe: Introduce the Multimedia Pipeline (mpipe) subsystem
Embedded devices increasingly combine video, audio, networking, graphics
and AI inference in one application, but multimedia code on a
microcontroller is still usually written per use case: each application
handles the specifics of every domain it touches, manages the buffers of
every component, and synchronises them by hand. That does not scale - a
new use case means a new application rather than a new arrangement of
the parts.

Introduce mpipe, which builds a media stream out of self-contained
processing elements. An application declares the elements it needs,
links them into a graph, and drives that graph through a state machine;
mpipe negotiates the data format between neighboring elements, settles
which buffer pool provides the buffers, and moves those buffers from one
element to the next.

mpipe provides the pieces and the rules by which they fit together
rather than finished solutions, so a developer assembles a pipeline much
like building with interlocking bricks. The same graph runs on another
board by binding its elements to different devices, and a new
requirement is usually one more element rather than a rewrite.

The elements live in plugins, decentralised from the framework: a plugin
brings its own directory, its own Kconfig and its own headers, and the
build picks it up without an edit to the core. A silicon vendor or a
middleware provider can therefore ship elements without altering the
framework.

The framework allocates nothing at runtime. Buffers come from pools
sized while the pipeline starts, and everything on the negotiation path
is fixed-size and held by value, so a stream that runs for hours cannot
fragment a heap it never touches and a negotiation cannot fail for
memory.

This commit adds the framework only. Plugins, the pipeline dump, the
player and the samples follow in their own patches.

Trung Hieu Le contributed the message bus, which is built on zbus, and
the first heap-based implementation of the mpipe_value and
mpipe_structure type system. That type system was later re-implemented
into the fixed-size, heap-free form described above.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
Signed-off-by: Trung Hieu Le <trunghieu.le@nxp.com>
2026-09-16 05:37:59 +02:00
Krzysztof Chruściński
884c03a2f3 ipc: ipc_service: icbmsg: Fix lack of K_SPINLOCK_BREAK
Normal break was used within K_SPINLOCK(){} block and it causes
assert as K_SPINLOCK_BREAK need to be used instead.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-09-15 14:39:41 +02:00
Aleksandr Senin
0f4fe859d2 modem: ppp: bulk-write received frame payload in spans
The RX path wrote every payload byte with net_pkt_write_u8 (cursor write
plus checks per byte), which dominates CPU at multi-Mbit modem rates
(~90% of one Cortex-M33 core at ~2.4 Mbit/s, measured). Scan the receive
buffer for runs free of HDLC delimiter/escape codes while in the frame
body and write each run with a single net_pkt_write; delimiters, escapes
and headers still go through the per-byte state machine. Fragment
allocation mirrors the per-byte path's keep-two-bytes-available
invariant.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Aleksandr Senin <al@meshium.net>
2026-09-15 14:32:29 +02:00
Johan Hedberg
36374b133d Bluetooth: Host: Drop the forward declaration of get_pending_per_adv_sync()
The function is defined before its first use, so the declaration
serves no purpose. No functional change.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-09-15 07:15:07 -04:00
Johan Hedberg
a6ef755158 Bluetooth: Host: CS: Order clear_on_disconnect() before its use
clear_on_disconnect() is only referenced by the connection callback
table: define the table after the function and drop the forward
declaration. No functional change.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-09-15 07:14:57 -04:00
Johan Hedberg
61e0fc777a Bluetooth: Host: Order the ECC work handlers before their work items
generate_pub_key() and generate_dh_key() are only referenced by the
work items defined with K_WORK_DEFINE(): define the work items after
the handlers and drop the forward declarations. No functional change.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-09-15 07:14:49 -04:00
Johan Hedberg
dc7d7634af Bluetooth: Host: Drop redundant forward declarations in direction.c
The six declared functions are all defined before their first use, so
the declarations serve no purpose. No functional change.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-09-15 07:14:37 -04:00
Vidar Berg
416429948f mgmt: mcumgr: img_mgmt_client: rename digest validation function
Rename image_digest_len_valid() to image_digest_len_is_valid()
to improve readability.

Signed-off-by: Vidar Berg <vidar.berg@nordicsemi.no>
2026-09-15 07:14:26 -04:00
Benjamin Jurewicz
b8b94a69e5 usb: host: Support low-speed devices
Handle low-speed connection events and record the device speed before
enumeration. Accept low-speed devices with the eight-byte endpoint zero
maximum packet size required by the USB specification.

Continue to reject unsupported SuperSpeed devices and reject low-speed
devices that report an invalid endpoint zero maximum packet size.

Signed-off-by: Benjamin Jurewicz <bjurewicz@internships.antmicro.com>
2026-09-14 15:42:12 -04:00
Robert Lubos
46aaa7473c net: ip: ipv6: Fix integer underflow in ext hdr option check
The option length bounds check computed exthdr_len - length - 2U with
unsigned operands, which underflows when length + 2 exceeds exthdr_len
and lets a crafted extension header option bypass the check. Rework the
check to use addition so no underflow is possible.

Assisted-by: Cursor:claude-opus-4.8
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-09-14 15:41:41 -04:00
Johan Hedberg
c8c2438f05 Bluetooth: Classic: AVRCP: Do not wait for browsing RX buffers
The buffer callback of the browsing channel allocates with K_FOREVER.
L2CAP calls it from the Bluetooth RX workqueue, both for a new SDU and
for every further fragment appended to it, and releases the buffers on
that same workqueue once the SDU has been delivered. The pool is
shared by all browsing channels and one SDU can take several buffers,
so once it runs dry the wait can never be satisfied and stops all HCI
receive processing instead.

Allocate without waiting. L2CAP handles a failed allocation on this
channel by disconnecting it, which the application can recover from,
unlike a blocked host.

Compile-tested only; there is no AVRCP browsing test coverage in the
tree.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-09-14 08:42:57 -04:00
Johan Hedberg
8529242080 Bluetooth: AVCTP: Do not block the workqueue on reassembly allocation
The reassembly buffer for a fragmented AVCTP message is allocated with
K_FOREVER from the receive path, which runs in the Bluetooth RX
workqueue. That workqueue is also the only context that releases
reassembly buffers, once the reassembled message has been dispatched,
so a wait there can never be satisfied and would stop all HCI receive
processing instead. The in-tree pool sizing, one buffer per session,
keeps the wait from triggering today, and the failure path behind it
returned -ENOMEM, which makes L2CAP tear down the channel, unlike
every other failure in this function, which drops the fragment and
keeps the channel up.

Allocate without waiting and treat a failed allocation like the other
reassembly failures: drop the fragment and let the peer time out.

Compile-tested only; there is no AVCTP test coverage in the tree.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-09-14 08:42:57 -04:00
Jasen Liu
d0e3e07de4 bluetooth: audio: guard PA sync FILTER_DUPLICATE with ADI feature
The bap_broadcast_sink sample was previously fixed to only set
BT_LE_PER_ADV_SYNC_OPT_FILTER_DUPLICATE when the controller supports
the Periodic Advertising ADI Support feature. Several other broadcast
sink/assistant code paths still set this option unconditionally.

BT_LE_PER_ADV_SYNC_OPT_FILTER_DUPLICATE requires the controller to
support the Periodic Advertising ADI Support feature. On controllers
that do not support it (e.g. external HCI controllers such as NXP
IW612), bt_le_per_adv_sync_create() rejects the option and returns
-ENOTSUP, so the periodic advertising sync is never created.

Apply the same fix as bap_broadcast_sink to the remaining paths:
check BT_FEAT_LE_PER_ADV_ADI_SUPP via bt_le_get_local_features() and
fall back to BT_LE_PER_ADV_SYNC_OPT_NONE when the feature is not
supported.

Updated PA sync creation paths:
- cap_acceptor: pa_sync_without_past() - PA sync when PAST is not used
- cap_acceptor: scan_check_and_sync_broadcast() - PA sync from scan
- shell/bap: pa_sync_broadcast_sink() - PA sync from scan results
- shell/bap_scan_delegator: pa_sync_no_past() - PA sync without PAST

Signed-off-by: Jasen Liu <jasen.liu@nxp.com>
2026-09-14 08:42:48 -04:00
Joel Guittet
0e30c59851 secure storage: its: fix spelling of chosen node
The name of the chosen partition doesn't follow standard zephyr
convention. Fixing the spelling so that the name is now
"zephyr,secure-storage-its-partition".

Signed-off-by: Joel Guittet <joelguittet@gmail.com>
2026-09-14 08:42:29 -04:00
Emil Gydesen
1254bf165a Bluetooth: CAP: add subprocedure callbacks for unicast start and stop
The CAP unicast audio start and stop procedures consist of several
subprocedures, and applications may need to know when each of these have
completed, e.g. to reconfigure the unicast group after the streams have
been codec configured but before they are QoS configured.

Add new callbacks to bt_cap_initiator_cb for each subprocedure of the
unicast audio start and unicast audio stop procedures. The callbacks are
only called if at least one request was sent to a CAP acceptor as part of
the subprocedure, so that subprocedures that are skipped because all
streams are already in the requested state do not trigger a callback. To
support this a new subproc_initiated field has been added to the common
procedure struct, which is reset whenever a new subprocedure is set.

The unit tests have been extended to verify both that the callbacks are
called when the subprocedures are performed, and that they are not called
when the subprocedures are skipped, and the BSIM CAP initiator unicast
test now waits for the new callbacks as part of the start and stop
procedures.

Assisted-by: Copilot:claude-opus-4.5

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-09-14 08:42:10 -04:00
Krzysztof Chruściński
aa3cc6b7c7 shell: Use dedicated function for printing prompt
So far shell was calling state_set(sh, SHELL_STATE_ACTIVE) when
prompt was supposed to be printed. It was relying on a fact that
when ACTIVE state was set then state_set function was also printing
a prompt. However, state_set() was also changing the state to ACTIVE
and it might not be expected, for example, after shell_stop() was
called in the shell command.

Remove prompt printing from state_set function and call prompt
printing function explicitly to no change shell state.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-09-13 18:02:54 -04:00
Krzysztof Chruściński
4dada29034 logging: multidomain: Use domain prefix in log output
When multi-domain logging is enabled, imply use of domain prefix. It is
needed to get core name prefix to the log message.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-09-13 18:02:22 -04:00
Krzysztof Chruściński
4cdd1aa960 logging: ipc_service: Detect presence of a single IPC node
If there is only a single IPC node, use it. In that case it is not
needed to declare chosen zephyr,log-ipc.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-09-13 18:02:22 -04:00