Commit graph zephyr/subsys
Author SHA1 Message Date
Emil Gydesen
a101a2fe15 Bluetooth: BAP: BSNK: Ratelimit some BASE related logging
Since we may receive a BASE often, some of the log statements
could end up flooding the log. Add RATELIMIT to those that either
directly discards the BASE or logs as WRN.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-08-10 07:07:04 -07:00
Emil Gydesen
5738f61f41 Bluetooth: BAP: BSNK: Fix copy of metadata for receive states
Adds checks for the number of subgroups as well as the size
of the metadata when we parse the BASE, in the case that the
bt_bap_scan_delegator_mod_src_param does not support the number
of subgroups or the metadata.

If the number of subgroups is the issue, then we discard the BASE
as we would otherwise write incorrect data to the receive state.
If the size of the metadata is the issue, then we just don't write
it to the receive state, as that is not mandatory as per BASS.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-08-10 07:07:04 -07:00
Emil Gydesen
577106c202 Bluetooth: BAP: SD: Remove option to keep metadata with len == 0
Remove the special handling of metadata_len == 0 to keep existing
metadata, as this prevents applications from actually setting the
metadata_len to 0.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-08-10 07:07:04 -07:00
Etienne Carriere
819f84eeaa bluetooth: host: classic: Diamond include for non-local headers
Use #include <> instead of #include "" to include a header file which path
is not relative to the directory path of the file emitting the #include
directive.

This change was made running scripts/check_quoted_includes.py script
proposed in https://github.com/zephyrproject-rtos/zephyr/pull/112135
with the Linux shell command below and manually selecting the applicable
changes:
$ ./scripts/check_quoted_includes.py -w subsys/bluetooth/host/classic/

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-08-10 07:05:59 -07:00
Sharon Lin
e96d5501f2 Bluetooth: Host: fix ext adv interval validation to use 24-bit range
The interval validation in valid_adv_ext_param() capped the maximum
interval at 0x4000 (the legacy advertising limit). Extended advertising
uses a 24-bit interval field with a permitted range of 0x000020–0xFFFFFF
per Core Spec Vol 4, Part E, 7.8.53. Use BT_HCI_LE_PRIM_ADV_INTERVAL_MAX
when BT_LE_ADV_OPT_EXT_ADV is set, and remove the now-unused
adv_interval_max_get() helper.

Assisted-by: Augment:claude-sonnet-4.6
Signed-off-by: Sharon Lin <slin@atmosic.com>
2026-08-09 17:45:53 -04:00
Emil Gydesen
14cc2422e2 Bluetooth: Shell: Modify how PA sync CBs are registered
Change the registration of the PA sync callbacks to be
more lazy (only do it when we are trying to do any PA
related activities).

This not only defers such operations until they are useful,
but also helps reduce noise when using the LE Audio shell.

This also reduces the scope of per_adv_sync_cb as well
as moving the related functions to a single guard.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-08-09 17:44:31 -04:00
Benjamin Cabé
2af4a0d5ad secure_storage: include: use kconfig_ref doxygen alias
properly cross reference the kconfig options using new doxygen alias

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-09 17:44:08 -04:00
Benjamin Cabé
75ea779011 Bluetooth: add help text to a few Kconfig options
Added help text for the BT_CONN, BT_AUDIO_RX, and BT_AUDIO_TX options.
While these are promptless, they are worth explaining and should show up
in Kconfig reference doc page.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-09 17:44:08 -04:00
Emil Gydesen
f675c899c8 Bluetooth: BAP: Shell: Rate limit printing of invalid len SDUs
Add additional check to avoid printing the same error
for each SDU. If the SDU length changes, then it is still
printed every time to notify the user about
such behavior from the remote (useful for debugging), so it
is only if the SDU size is wrong and does not change that
we rate limit it.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-08-09 17:43:41 -04:00
Emil Gydesen
7b6ef538da Bluetooth: BAP: Shell: Print qos_pref when stream configured
Add function to print the QoS preferences.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-08-09 17:43:30 -04:00
Emil Gydesen
2689a8fc39 Bluetooth: CAP: Commander: Shell: Make reception start params static
The member_params variable can be quite large, and scales with
CONFIG_BT_MAX_CONN. Make it static to avoid requiring a large
stack size.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-08-08 16:35:51 -04:00
Benjamin Cabé
2cfaa251d6 posix: mutex: remove global lock from the acquisition fast path
acquire_mutex() took a module-global semaphore on every lock, but that
lock is only needed to serialize the lazy auto-init of a statically
initialized mutex. Push it into to_posix_mutex() with a double-checked
re-test so an already-initialized handle is acquired with no global
serialization, reading owner/type/lock_count locklessly as
pthread_mutex_unlock() already does. This removes an SMP scalability
bottleneck and a single-core priority-inversion window.

On qemu_cortex_a53 (deterministic icount), 1M uncontended lock/unlock
pairs drop from 817 to 508 cycles/pair (~38%).

Add a regression test for locking a PTHREAD_MUTEX_INITIALIZER mutex.

Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-08 16:34:50 -04:00
Krzysztof Chruściński
edcaf73893 ipc: ipc_service: icbmsg: Rework backend
Major rework of the ICBMSG ipc service backend:

 1. User callback is called from the mbox interrupt context.
 Since RX holding functionality is supported it is possible to
 postpone data processing to the thread context and limit the
 time spent in the interrupt context to a minimum.

 2.Extracted buffer allocation into separate file (heap)
 Buffer can now be allocated from interrupt context as well.

 3.Changed control path.
 Instead of sending messages using icmsg, lightweight queue is used.
 Each direction has producer and consumer queue. Each queue has n
 (typically 16) byte slots. Producer is writing an index of the buffer
 where new message can be found into the next free slot. Receiver is
 reading from the producer queue and when buffer is processed then its
 index is written to the next free slot in the consumer queue.
 TX side, after each sending, is performing a garbage collection by
 reading slots from the consumer queue and freeing the buffer. With this
 approach producer queue is written only by the TX side and read by RX
 side and consumer queue is written by the RX side and read by the
 TX side. Additionally, queue supports 2 priority levels. Consumer is
 first reading high priority messages.

 Rework significantly reduces code size (2,5-4kB) and increases
 performance. It also allows to send messages from any context and
 reduced round trip time since receiver can respond directly from the
 receive callback.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Assisted-by: Cursor:auto
2026-08-08 16:31:53 -04:00
Daniel Leung
01939a0fe2 testsuite: ztest: cpuhold threads need to join
Since we are reusing the cpuhold thread objects, we must join
those threads to make sure the spawned threads have actually
stopped. The situation is further compliacted due to those
cpuhold threads are running with interrupt disabled inside
cpu_hold(). This means the IPI sent by k_thread_abort() is not
being processed to abort the thread. And there is no thread
swapping where the scheduler checks if a thread is going away.
Since k_thread_abort() is rather meaningless here and we must
do k_thread_join(), simply replace abort with join.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2026-08-08 15:22:20 -04:00
harshit kudhial
f66ca60b80 bluetooth: mesh: fix -Wpointer-sign warnings
This commit resolves -Wpointer-sign warnings in the Bluetooth Mesh
subsystem by updating comp_data_pages[] to store a const char *path and
updating bt_mesh_k5 to natively accept const char *p, avoiding the need
for pointer casts.

This is part of a larger effort to fix pointer-sign warnings across the
codebase in preparation for dropping -Wno-pointer-sign globally.

Related to #8921

Signed-off-by: harshit kudhial <harshitkudhial@gmail.com>
2026-08-08 15:21:28 -04:00
Fin Maaß
0076ca9244 net: if: mcast: remove lookup from rejoin
remove lookup from rejoin, as no longer needed
as we only use it then using addresses that are
already on the iface.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-08 15:21:20 -04:00
Fin Maaß
9656280c9e net: dns: remove rejoin
as mcast groups are no longer left on iface down,
we no longer need to recover them.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-08 15:21:20 -04:00
Fin Maaß
fed91f2088 net: if: preserve mcast groups on iface down
When I set the socket option
ZSOCK_IPV6_ADD_MEMBERSHIP or ZSOCK_IP_ADD_MEMBERSHIP
I expect that that setting is valid for at least the time
that the socket is open. As a udp does not close
when the iface that it is attached to, goes down,
it should not be removed from the iface on down.

Just with the socket api I have no way to detect that
the multicast membership no longer exists and then
also no way to recover.

Therefore we preserve the multicast membership on iface down
and then just send a leave without removing the membership from the
iface. This way the membership is still valid and will rejoin when the
iface comes back up.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-08 15:21:20 -04:00
Fin Maaß
082601cddc net: dns: mdns: leave mcast groups in mdns_test_reinit_with_stale_slot
leave mcast groups in mdns_test_reinit_with_stale_slot,
no longer assume the mdns groups are left on
net_if_down.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-08 15:21:20 -04:00
Johan Hedberg
c307d409de Bluetooth: Host: Fix typo in bt_recv_unsafe() comment
s/snice/since/

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Assisted-by: Claude:claude-fable-5
2026-08-07 16:27:05 -04:00
Johan Hedberg
5457ebb30d Bluetooth: Host: Remove unused bt_testing_tx_tid_get()
The last callers of bt_testing_tx_tid_get() were removed by
commit 28be8909a6 ("Bluetooth: host: remove TX thread"), which also
changed the function to return the system workqueue thread. That return
value has in turn been stale since
commit f101976e31 ("Bluetooth: Host: Run tx processor on its own thread")
moved TX processing to a dedicated thread whenever
CONFIG_BT_TX_PROCESSOR_THREAD is enabled (the default).

Instead of fixing the return value of a function nobody calls, remove
it, together with the leftover extern declarations in the bsim tests.
The att/pipeline test enabled CONFIG_BT_TESTING solely for this
function, so drop it there. The att/sequential test claimed the same in
a comment, but actually also depends on CONFIG_BT_TESTING for
bt_conn_suspend_tx(), so only the stale comment is corrected there.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Assisted-by: Claude:claude-fable-5
2026-08-07 16:26:55 -04:00
Robert Lubos
388959fdd1 net: lib: tls_credentials: Select PSA_CRYPTO in the PS backend
PSA_WANT_ALG_SHA_256 is defined inside an "if PSA_CRYPTO" block, so
selecting it without enabling PSA_CRYPTO aborts Kconfig on TF-M targets,
where SECURE_STORAGE (and thus its implicit PSA_CRYPTO select) is
unavailable.

Assisted-by: Cursor:claude-opus-5
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-08-07 11:20:16 -04:00
Fin Maaß
7e3c86052c net: openthread: use NET_MGMT_REGISTER_EVENT_HANDLER
use NET_MGMT_REGISTER_EVENT_HANDLER,
so we no longer need to init that part during runtime.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-07 11:20:06 -04:00
Fin Maaß
528ecffdfb net: lib: mcp: use NET_MGMT_REGISTER_EVENT_HANDLER
use NET_MGMT_REGISTER_EVENT_HANDLER,
so we no longer need to init that part during runtime.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-07 11:20:06 -04:00
Fin Maaß
cd2265b5db net: ppp: use NET_MGMT_REGISTER_EVENT_HANDLER
use NET_MGMT_REGISTER_EVENT_HANDLER,
so we no longer need to init that part during runtime.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-07 11:20:06 -04:00
Fin Maaß
05f3634c52 net: lib: ptp: use NET_MGMT_REGISTER_EVENT_HANDLER
use NET_MGMT_REGISTER_EVENT_HANDLER,
so we no longer need to init that part during runtime.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-07 11:20:06 -04:00
Fin Maaß
b9be86347e debug: coredump: use NET_MGMT_REGISTER_EVENT_HANDLER
use NET_MGMT_REGISTER_EVENT_HANDLER,
so we no longer need to init that part during runtime.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-07 11:20:06 -04:00
Fin Maaß
3031b02943 net: ip: ipv6: nbr: use NET_MGMT_REGISTER_EVENT_HANDLER
use NET_MGMT_REGISTER_EVENT_HANDLER,
so we no longer need to init that part during runtime.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-07 11:20:06 -04:00
Simon Duquennoy
9289f039d7 net: lib: wifi_credentials: Add feedback on errors
Add feedback when Wi-Fi shell add/delete commands fail.

Signed-off-by: Simon Duquennoy <simon.duquennoy@nordicsemi.no>
2026-08-07 11:19:43 -04:00
Liam Ogletree
79861deac4 modem: backends: Unify runtime PM log messages
Propagates #113545 to modems subsystem.

Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
2026-08-07 11:18:41 -04:00
Emil Gydesen
04b4a22c44 Bluetooth: BAP: SD: Shell: Add handling of pending PAST for term req
If we are pending PAST, we do not have a pa_sync object to delete, but
we should not rejec the request to stop the sync, as that indicates
that we should just stop waiting.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-08-07 11:17:26 -04:00
Emil Gydesen
1b6e9be1b7 Bluetooth: BAP: BA: Shell: Add handling of empty receive state
If the receive state is empty (NULL) we should simply ignore it.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-08-07 11:17:15 -04:00
Emil Gydesen
3f56d469c5 Bluetooth: CAP: Commander: Handle empty receive states
If the receive state read is empty, we should simply ignore it.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-08-07 11:17:15 -04:00
Philipp Steiner
6a382d80f5 net: zperf: fix UDP trailing packet loss accounting
Normalize the signed terminal sequence ID before comparing it with
unsigned session counters.

Encode its magnitude as the iPerf ACK datagram total and derive the
public received-packet result from total and loss.

Track recent missing sequence IDs so late packets only reconcile
genuine gaps. Duplicates can no longer mask real packet loss.

Add loopback regressions for trailing loss, reordered gap recovery,
and duplicate packets.

Assisted-by: Codex:GPT-5
Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
2026-08-07 06:52:49 -04:00
Pieter De Gendt
d212a3c691 net: core: mark looped back multicast as L2 processed
A multicast packet the sending socket should also receive is cloned in
net_try_send_data() and passed to net_recv_data(). The clone is taken
before the L2 header is written, yet is queued without
net_pkt_set_l2_processed(), so the receive path still offers it to the
L2. An L2 that has a header of its own then reads the network header as
a link layer one and drops the packet:

  process_data: Packet 0x446de8 discarded by L2

IP_MULTICAST_LOOP, and CONFIG_NET_INITIAL_IPV4_MCAST_LOOP which defaults
to y, therefore have no effect on an Ethernet interface: a sender never
receives its own multicast.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-08-07 06:51:27 -04:00
Alejandro Lara Raigada
93910c7d20 logging: frontend: stmesp: Prevent use when STM device is not ready
Add a readiness check before using the STMESP logging frontend.
If the STM device is not ready, skip frontend usage to avoid invalid access
and improve robustness during early boot or misconfiguration.

Signed-off-by: Alejandro Lara Raigada <Alejandro.Lararaigada@analog.com>
2026-08-07 06:51:17 -04:00
Fin Maaß
60c9415db1 net: sockets: tls: use K_MUTEX_DEFINE
use K_MUTEX_DEFINE
instead of init during runtime.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-07 06:50:45 -04:00
Fin Maaß
641962864b net: quic: use K_MUTEX_DEFINE
use K_MUTEX_DEFINE
instead of init during runtime.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-07 06:50:45 -04:00
Emil Gydesen
fba5caee39 Bluetooth: TBS: Use MUTEX_TIMEOUT instead of K_FOREVER
Two CCC callbacks used K_FOREVER instead of MUTEX_TIMEOUT
as the mutex timeout. Change to be consistent and to avoid
blocking everything in case that it could not lock the mutex.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-08-07 06:48:38 -04:00
Robert Rozelle
7ca8115aa6 net: mdns_responder: add CONFIG_MDNS_RESPONDER_ANNOUNCE_DNS_SD
RFC 6762 Section 8.3 requires the startup announcement to contain all
of a responder's newly registered resource records, not just address
records -- but send_announce() only ever sent A/AAAA records, never a
registered DNS-SD service's PTR/SRV/TXT records.

Add send_dns_sd_announce(), called from send_announce()'s per-family
loop when CONFIG_MDNS_RESPONDER_ANNOUNCE_DNS_SD is enabled: sends one
extra packet per DNS-SD service (registered via
DNS_SD_REGISTER_SERVICE() or mdns_responder_set_ext_records())
alongside the existing address-only announce, reusing
dns_sd_handle_ptr_query() (already used for direct query responses).

Disabled by default to keep startup announcements smaller/less
frequent for devices that don't need it -- clients that actively
query for services (e.g. avahi-browse) are unaffected either way,
since normal query/response handling already answers DNS-SD queries
regardless of this option.

Test: tests/net/lib/mdns_responder_probe/ registers one external
DNS-SD record, drives the responder through a normal (non-racing)
bring-up, and confirms at least one of the resulting announce packets
is a PTR answer for that service. Verified as a genuine regression
test: reverting the two send_dns_sd_announce() call sites reproduces
the exact "no announce packet included a PTR answer" failure.

Depends on the v4_svc/v6_svc probe-sizing fix in this branch's parent
commit: without it, CONFIG_MDNS_RESPONDER_PROBE fails independently of
this feature (probing itself can't complete), which would make this
test fail for an unrelated reason.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Robert Rozelle <rwrozelle@gmail.com>
2026-08-07 06:48:27 -04:00
Emil Gydesen
890e075066 Bluetooth: BAP: SD: shell: rm pa_sync_state from bis_synced cmd
Remove the pa_sync_state parsing from
cmd_bap_scan_delegator_bis_synced as it was not used by the command,
and caused the parsing of the bis_synced value to fail.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-08-07 06:46:33 -04:00
Emil Gydesen
4c1ea755bf Bluetooth: BAP: SD: Shell Compare with src_id instead of pointer
In the sync_state_get_or_new we should compare with the src_id instead
of the pointer. If the receive state was added locally via
cmd_bap_scan_delegator_add_src then the src_id is assigned, but not
the pointer. This caused any locally added receive states to be
unavailable, and thus causing error prints when using the
shell module.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-08-07 06:46:23 -04:00
Fin Maaß
d6154ce423 net: dhcpv6: use K_WORK_DELAYABLE_DEFINE
use K_WORK_DELAYABLE_DEFINE
instead of init during runtime.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-06 14:37:38 +02:00
Fin Maaß
03ccee1120 net: dhcpv4: use K_WORK_DELAYABLE_DEFINE
use K_WORK_DELAYABLE_DEFINE
instead of init during runtime.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-06 14:37:38 +02:00
Fin Maaß
02b4aff237 net: ipv6: pe: use K_WORK_DELAYABLE_DEFINE
use K_WORK_DELAYABLE_DEFINE
instead of init during runtime.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-06 14:37:38 +02:00
Fin Maaß
238dffc75e net: ipv6: nbr: use K_WORK_DELAYABLE_DEFINE
use K_WORK_DELAYABLE_DEFINE
instead of init during runtime.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-06 14:37:38 +02:00
Cheng Chang
abb66930be bluetooth: host: classic: shell: bip: make static vars testable
Mark static variables bip_app, rfcomm_server, and l2cap_server with
ZTESTABLE_STATIC to allow them to be accessed from unit tests while
maintaining static linkage in production builds.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2026-08-06 14:37:25 +02:00
Lyle Zhu
d41bcd02ec bluetooth: classic: avdtp: fix typo in UNSUPPORTED_CONFIGURATION
Fix typo in `BT_AVDTP_UNSUPPORTED_CONFIGURATION` constant name.
The constant was misspelled as `BT_AVDTP_UNSUPPORTED_CONFIGURAION`.

Update the enum definition in `avdtp.h` and all references in `a2dp.c`
to use the correct spelling.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-08-06 14:37:14 +02:00
Tom Burdick
7c3c352073 rtio: Timeout queue
Rather than having the timeout struct embedded in the submission, which
takes up significant space, use a common Kernel timeout entry that is
shared and managed through a custom RTIO timeout queue.

Adds additional testing around the management of this queue to ensure
that timeouts are ordered properly and that cancellations are best
effort handled by the timeout queue.

The timeout queue itself is now a singleton iodev that takes
submissions rather than baked into the framework.

Assisted-by: claude:opus-4.8
Signed-off-by: Tom Burdick <thomas.burdick@infineon.com>
2026-08-06 14:33:42 +02:00
Michal Frankiewicz
8b92d9b807 drivers: clock_control: split clock control into individual clocks.
Split clock control into individual clocks:
HFCLK, XO, LFCLK, HFCLK192M, XO24M, HFCLKAUDIO

Signed-off-by: Michal Frankiewicz <michal.frankiewicz@nordicsemi.no>
2026-08-06 14:30:12 +02:00