Commit graph

22128 commits

Author SHA1 Message Date
Jamie McCrae
7627367024 settings: Add retention backend
Adds a retention backend for settings

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-07-21 07:23:29 -04:00
Cheng Chang
c9651c6710 Bluetooth: host: a2dp: Fix stream recv callback not be checked
Now when role is sink and source sends data, stream recv callback is
not registered, apps works fail. so stream recv callback should be
checked.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2025-07-21 07:23:15 -04:00
Robert Lubos
388a283d88 net: tcp: Fix declaration after label warning with clang
clang reports a warning about a label followed by a variable
declaration:

  label followed by a declaration is a C23 extension

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-07-21 06:57:14 -04:00
Robert Lubos
90bba475f5 net: tcp: Fix unaligned access warning with clang
Fix one leftover unaligned access warning generated by clang:

  warning: taking address of packed member 'th_seq' of class or
  structure 'tcphdr' may result in an unaligned pointer value

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-07-21 06:57:14 -04:00
Jorge Ramirez-Ortiz
8c0c4bdace net: latmon: Add latency monitor service
Latmon service to interface with Xenomai's Latmus.

Link: https://evlproject.org/core/benchmarks/#latmus-gpio-response-time

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
2025-07-20 12:27:30 -04:00
Nirav Agrawal
b59d8d56bf bluetooth: bap_unicast_client: fix PTS BAP/UCL/SCC/BV-103-C failure
- In bap_unicast_client, it was assumed that ASE is binded with CIS
 handler during sending "received_stop_ready" to unicast_server.
- In case where unicast_client has not started the stream with
 "receiver_start_ready" att command to server, but wants to disable
 ASE which was Enabled previously (but not stream!) causes failure
 since there is no cis_create has happened and linked to ASE.
- In BAP_TS, "BAP/UCL/SCC/BV-103-C" has a same test conditions where
 client first enables the ASE, disable the ASE, and expecting
 "receiver_stop_ready" att command from client to server followed by
 server notification to enter its ASE in QoS_configured state.
- Removed this condition checks to send expected att command to
 server from Enabling ASE state to Disable ASE.

Signed-off-by: Nirav Agrawal <nirav.agrawal@nxp.com>
2025-07-20 12:24:43 -04:00
Jamie McCrae
5ef8a576bf settings: Only use mutexes when multithreading is enabled
Allows usage of settings when multithreading is disabled

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-07-19 15:50:23 -04:00
Shrek Wang
c68359ff32 net: tcp: Add support for partially valid data recv
Based on TCP Spec., if the incoming packet seqnum is old but with
new data (seqnum + len > conn->ack), that part of valid data should
be accepted. Now Zephyr doesn't support it.
This patch will add support to such scenario.

Signed-off-by: Shrek Wang <inet_eman@outlook.com>
2025-07-19 15:47:57 -04:00
Vinayak Kariappa Chettimada
e3e410aeed Bluetooth: Controller: Fix LLCP event_counter value used during prepare
Fix LLCP to use event_counter value used during prepare to
compare instant to be the value as when in prepare and not
incorrectly use a stale value (when two radio events
overlap).

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-07-19 15:47:45 -04:00
Jamie McCrae
87b1bb8916 dfu: img_util: Upload to slot0 if not running from slot0
Fixes an issue for MCUboot DFU whereby images would always be
uploaded to slot1 instead of slot0 meaning that updates would
never take effect, but retains uploading to slot1 if the
application is running from slot0

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-07-19 15:45:53 -04:00
Jukka Rissanen
e4a1905245 net: Add alignment support for net_buf data length alloc
The alignment value tells the amount of alignment of buffer length
when allocating net_buf data for sending. By default there is no
special alignment. This is needed for example with Nordic Wi-Fi
chip that uses SPI driver that expects 4 byte alignment for the
length of the data that is being sent.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-07-19 15:37:01 -04:00
Jordan Yates
5c0521c585 conn_mgr: make internal state static
Make the interface interface state array static, ensuring that the array
is zeroed at boot. This enables interfaces which initialise earlier than
the CONN_MGR module to set flags in their init functions.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-07-19 15:35:31 -04:00
Fin Maaß
7e05345562 shell: move date_service to sys_clock api
move date_service from posix api
to sys_clock api.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-07-19 15:30:29 -04:00
Loic Domaigne
f314560b4a Bluetooth: Controller: Fix a potential NULL pointer dereference
Fix a potential NULL pointer dereference for skip_fields in the function
ull_adv_sync_copy_pdu_header. This issue been reported by Coverity.

Coverity CID: 392529

Signed-off-by: Loic Domaigne <tech@domaigne.com>
2025-07-19 13:50:57 -04:00
Andrey Dodonov
8e70b5ad48 net: lib: http: allow configuring response chunk size
Introduce Kconfig HTTP_SERVER_STATIC_FS_RESPONSE_SIZE,
size of individual chunks when serving files.

Signed-off-by: Andrey Dodonov <Andrey.Dodonov@endress.com>
2025-07-19 13:48:00 -04:00
Tom Burdick
7bc4d14cfc llext: Drop unused memory domain member
Not sure why this vestigal struct member was here at this point (18
months ago...) but its unused and was causing problems for certain
parts.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2025-07-19 13:40:42 -04:00
Serhiy Katsyuba
98dfa0aa0b pm: Fix to prevent incorrect forever timeout
K_TICKS_FOREVER is defined as -1. Guard logic has been added for the case
when `ticks - exit_latency_ticks == -1` to prevent sys_clock_set_timeout()
from incorrectly setting a forever timeout.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2025-07-19 13:27:08 -04:00
Håvard Reierstad
d989188f29 Bluetooth: Host: l2cap: Fix MPS/MTU confusion
The implementation used BT_L2CAP_ECRED_MIN_MTU to check the lower limits
of both MTU and MPS, instead of BT_L2CAP_ECRED_MIN_MPS for MPS. While
these are the same here, confusion may arise. This commit fixes the
confusion.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2025-07-19 13:26:29 -04:00
Seppo Takalo
d5f4ca3b64 net: ppp: Allow peer-options to be rejected
There are cases, for example when peer is requesting two DNS
addresses, but we can only give one, we should reject the secondary
DNS request first, before sending NAK to acceptable options.

Option parser can reject a parameter by returning -ENOTSUP and when
it wants to NAK the parameter, it returns -EINVAL.

On RFC 1661:
Configure-Reject
  If some Configuration Options received in a Configure-Request are
  not recognizable or are not acceptable for negotiation (as
  configured by a network administrator), then the implementation
  MUST transmit a Configure-Reject.

Configure-Nak
  If every instance of the received Configuration Options is
  recognizable, but some values are not acceptable, then the
  implementation MUST transmit a Configure-Nak.

So as stated by RFC, we should start the negotiation by rejecting all
parameters that we cannot configure. I added an example of rejecting
DNS requests, if we don't have those.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2025-07-19 13:24:41 -04:00
Seppo Takalo
5a31f3d108 net: ppp: ipcp: Don't request DNS if not needed
When Kconfig option CONFIG_NET_L2_PPP_OPTION_DNS_USE is enabled,
Zephyr should request two DNS addresses in IPCP negotiation by sending
IPCP ConfReq for DNS otions using 0.0.0.0 as an address.

Remote peer may offer DNS by sending IPCP ConfNak with proper address.
This is explained in RFC 1332 and RFC 1877 (DNS extension).

When no DNS is required, we should only send IPCP ConfReq for IP
address, without having DNS fields in the same request.

However, when PPP is configured to serve a DNS using Kconfig option
CONFIG_NET_L2_PPP_OPTION_SERVE_DNS it should serve the DNS address in the
IPCP ConfNak message and from the ipcp.peer_options structure, not from
the ipcp.my_options.

This might break backward compatibility outside this repository
as DNS addresses used to be served from ipcp.my_options.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2025-07-19 13:24:41 -04:00
Robert Lubos
3d93657ca9 net: if: Add const qualifier to addr pointer where applicable
Some APIs taken in_addr/in6_addr pointer w/o const qualifier, while they
do not actually intend to modify the provided address. This commit
adds the missing const qualifier where applicable.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-07-19 13:24:08 -04:00
Florian La Roche
d933e0301e net: sockets: add missing break
Add a missing break to socket handling.

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
2025-07-19 10:10:58 +02:00
Mark Wang
e71b5122f7 bluetooth: classic: add role switch API
add bt_conn_br_switch_role and bt_conn_br_set_role_switchable to control
the role switch, add DEFAULT_ROLE_SWITCHABLE Kconfig to control the default
role switch state.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-07-19 09:59:16 +02:00
Mark Wang
31fba83fb3 bluetooth: classic: add role changed callback
add `role_changed` to `struct bt_conn_cb` to notify the HCI_Role_Change
event to application.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-07-19 09:59:16 +02:00
Matthias Plöger
239d53c5fc zbus: add user-configurable HEAP_MEM_POOL_ADD_SIZE_ZBUS
Zbus currently does only support default heap sizes.
The configuration option allows to decrease rom-footprint for embedded
applications. Adding the option to ZBus improves its flexibility and
while not increasing its complexity.

Add default of 0 value to compensate for previous cases where
HEAP_MEM_POOL_ADD_SIZE_ZBUS was defined as "".

Consistent naming 'Zbus'/'zbus' to 'ZBus'

Signed-off-by: Matthias Plöger <matthias.ploeger@phoenixcontact.com>
2025-07-19 09:56:21 +02:00
Tom Burdick
cbfe7813c7 pmci: mctp: I2C+GPIO Target binding
Adds a I2C+GPIO Target device binding for MCTP communication over I2C.

The binding requires an i2c bus and gpio pin, along with a specified I2C
and endpoint address pair. These are then used to create an MCTP binding
which can be used to communicate in a peer to peer manner among other
MCTP endpoints.

Each message transmit signals to the bus controller using a GPIO logical
high and is unset on transmission completion. Pending transmitters are
queued using a semaphore avoiding memcpy being needed to asynchronously
transmit mctp pktbufs.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2025-07-19 09:53:21 +02:00
Tom Burdick
6464329346 pmci: mctp: I2C+GPIO controller bindings
Adds a custom MCTP binding for an I2C bus controller using GPIO signaling
for write requests rather than mode switching.

This binding operates a lot like the I3C binding specification DMTF has
for MCTP. The controller expects to receive interrupts (from GPIO pins)
and upon getting an interrupt read a message from the I2C target device.

The macro does a lot of the heavy lifting to setup all the state needed
for capturing GPIOs, being able to do asynchronous reads/writes, and
such. The entire controller works using state machines driven by
interrupts leading to low latency and clear ram costs.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2025-07-19 09:53:21 +02:00
Tom Burdick
e3cc7a8c63 pmci: mctp: Supply dedicated mctp heap
Unfortunately libc malloc/free are wrapped with a sys_mutex which is
troublesome for mctp as we likely want to allocate from interrupts in many
cases.

Supply mctp with a dedicated heap initialized and assigned at boot
saving applications a step. The default size is quite small and works
well so long as messages are small.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2025-07-19 09:53:21 +02:00
Cheng Chang
5b204de53a Bluetooth: host: L2CAP: Fix configuration parameters not be checked
Now in other mode rather than basic mode, configuration parameters
include MTU, Flush Time and QoS have been checked.
But in basic mode, they also need to be checked, so the code about this
should not be controlled by macro CONFIG_BT_L2CAP_RET_FC.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2025-07-19 09:51:02 +02:00
Ravinder Singh
394c97a819 Bluetooth: LE: CONN: Added bt_conn_le_set_default_phy function.
Added bt_le_set_default_phy in hci. This handles
the HCI_LE_Set_Default_PHY HCI command.
Added call to bt_conn_le_set_default_phy in central_gatt_write and
peripheral_gatt_write samples.

Signed-off-by: Ravinder Singh <ravinder.singh2@infineon.com>
2025-07-19 09:46:34 +02:00
Sean Kyer
cba074230d settings: Add TF-M ITS backend
Add settings_its backend in order for a non-secure
Bluetooth application to be able to save Bluetooth
settings to persistent storage.

Signed-off-by: Sean Kyer <Sean.Kyer@analog.com>
2025-07-19 09:45:56 +02:00
Make Shi
dcd9adec29 Bluetooth: AVRCP: Adjust positions of internal static functions
- Move the static function locations to beginning of the file to the
  file to avoid function declarations.

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-07-19 09:40:19 +02:00
Make Shi
ba05d5c2b2 Bluetooth: Shell: AVRCP: support unit info request and response
Add avrcp_unit_info_req callback function in shell and a command to set
the unit info response.

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-07-19 09:40:19 +02:00
Make Shi
c95d3167e2 Bluetooth: AVRCP: Implement unit message reception on the AVRCP target
- Add a new callback to support the situation when a unit info command is
  received, and add an API to respond to the unit info command.

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-07-19 09:40:19 +02:00
Make Shi
a559fee00b Bluetooth: AVRCP: Refactored AVRCP API for CT/TG separation
- Only AVRCP connect and disconnect api for AVRCP common functions.
- Added _ct prefixes to all CT callback functions and feature APIs.
- Updated shell demo code for AVRCP API changes.

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-07-19 09:40:19 +02:00
Alberto Escolar Piedras
8270444a4d subsys/fs/fuse_fs_access: Remove NATIVE_APPLICATION support
It is not possible to build anymore in that mode, so we do not
need to support it in this driver cmake files.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-07-19 09:38:15 +02:00
Alberto Escolar Piedras
af750b2b41 subsys/tracing/backend_posix: Remove NATIVE_APPLICATION support
It is not possible to build anymore in that mode, so we do not
need to support it in this driver cmake files.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-07-19 09:38:15 +02:00
Anas Nashif
1a7ce3f45e Revert "init: Make entry init-function less and introduce service objects"
This reverts commit 175da6bdb0.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-16 16:39:36 -05:00
Gaetan Perrot
dd180c2789 ipc_service: ipc_icbmsg: fix unchecked error in icmsg_open()
Coverity (CID 516253) reported that the return value of
initialize_tx_with_sid_disabled() was set but not used, leading to
potential silent failures.

Check if the return value is negative and propagate the error through the
existing cleanup path.

Fixes: CID 516253

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-11 13:15:04 -10:00
Robert Lubos
151295f98e net: sockets: Move socket vtable definition
Offloaded socket implementations need to create the socket operations
vtable, therefore need access to struct socket_op_vtable. So far this
has been defined in a private header, so implementations needed to add
the header location to the include path in CMake.

Therefore, move struct socket_op_vtable definition to the internal part
of the public socket header, so it's no longer needed to include a
private header. This is also more consistent with the rest of the public
header content, as for example macros needed to register a socket
implementation are already there.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-07-11 16:32:49 -05:00
Hake Huang
fb9783d880 tests: ztest: add test hold status in DEVICE_PM
for DEVICE_PM and DEVICE_PM_RUNTIME, ztest need
hold status like CONFIG_PM, otherwise the following
flash will be blocked for some SOC

Signed-off-by: Hake Huang <hake.huang@nxp.com>
2025-07-11 13:44:16 -05:00
Szymon Janc
d699e8ccf0 Bluetooth: Host: Make error messages unique
Both bt_le_adv_stop() and bt_le_adv_resume() were logging same
error message. Add aditional context to it so that logs are
distinguishable.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2025-07-11 08:25:53 -10:00
Andrey Dodonov
1c0608dc02 net: http: service: check for uncompressed file correctly
Correct not resetting compression extension,
when checking for an uncompressed file,
in case if compression is enabled, but no compressed file found.

Signed-off-by: Andrey Dodonov <Andrey.Dodonov@endress.com>
2025-07-10 16:01:47 -05:00
Robert Lubos
4872527605 net: coap_client: Don't send RST on unrecognized ACK response
According to CoAP RFC (7252, ch. 4.2), Reset cannot be sent in a
response for an ACK reply, rejected ACKs should be silently ignored
instead. Therefore, in case an unrecognized response is received, verify
the response type before sending Reset.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-07-10 16:01:03 -05:00
Simon Piriou
932005abf2 net: l2: ieee802154: mgmt: fix net_pkt leaks
The ieee802154_radio_send() function does not decrease reference counter
of the net_pkt, it's instead done one layer above in ieee802154_send().
This commit updates the mgmt functions using ieee802154_radio_send() to
always free the used net_pkt afterward.

Signed-off-by: Simon Piriou <spiriou31@gmail.com>
2025-07-10 10:13:35 -05:00
Lyle Zhu
e4569c434a Bluetooth: Classic: L2CAP: Fix retransmission timer restarting
When received the valid S frame, the retransmission timer should not
be restarted if unacknowledged I-frames have been sent but the
retransmission timer has not elapsed.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-07-09 09:43:12 -05:00
Vinayak Kariappa Chettimada
f6495d8b43 Bluetooth: Controller: Fix Tx Ack FIFO index corruption under race
Fix Tx Ack FIFO's first index being advanced beyond a
recorded ack_last value in a node_rx when under race
between ll_rx_get() being pre-empted while executing the
`tx_cmplt_get()` and a call to `ll_rx_put()` in an
interrupt service routine.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-07-09 09:42:58 -05:00
Simon Piriou
732a3a5c66 net: l2: ieee802154: shell: fix scan argc validation
Bump the argc check from 3 to 4 as the shell scan command has 3 required
parameters, the last being the scan duration:
- argv[0]
- passive|active
- channels
- per-channel duration in ms

Signed-off-by: Simon Piriou <spiriou31@gmail.com>
2025-07-09 00:26:29 -05:00
Luis Ubieda
b0caaed43b rtio: workq: Restructure workqueue as a threads pool with a queue
Based on a discussion around P4WQ limitations for our application, it
was determined that the RTIO workqueue required the ability to use
additional threads from the pool in spite of work items blocked.
Since this is not covered, nor desired for the P4WQ, then remove this
dependency and re-implement it in a way that covers also this use-case.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-07-08 18:35:26 -05:00
Loic Domaigne
a0a47a4b6d Bluetooth: ASCS: fix uninitialized pointer read
Fix uninitialized pointer read reported by Coverity.
Coverity CID: 529879

Signed-off-by: Loic Domaigne <tech@domaigne.com>
2025-07-08 13:44:37 -05:00