Commit graph

22,555 commits

Author SHA1 Message Date
Mark Wang
70c965d33d bluetooth: l2cap: accept the default flush timeout (0xFFFF) in conf_rsp
Some headsets reply conf_rsp with flush timeout (0xFFFF) even conf_req
don't configure the flush timeout, stack should accept it.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-09-17 11:16:03 +01:00
Mark Wang
811c5eb64b bluetooth: l2cap: support the classic l2cap rx flush timeout
add one Kconfig `BT_L2CAP_RX_FLUSH_TO` to configure the minimum L2CAP RX
flush timeout accepted during processing peer's l2cap flush timeout
configuration.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-09-17 11:16:03 +01:00
Cheng Chang
31f36fdbb8 bluetooth: host: l2cap: fix issue that can't get chan by psm
when role is server and try to get chan by psm in application, it
works fail because chan do not store psm.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2025-09-17 10:07:12 +02:00
Fin Maaß
76c1bc02e1 sd: evaluate constants first
evaluate constants first, so the
compiler can optimize it.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-09-17 08:45:15 +02:00
Lyle Zhu
49157ea8fc Bluetooth: SDP: Check tail room of allocated buffer
In partial resolved notification case, there is a case that the tail
room of new allocated buffer is not bigger than the tail room of the
current receiving buffer. Since, the new allocated buffer has the same
size with the current receiving buffer, it means a complete SDP record
cannot fit into the allocated buffer. In this way, the following SDP
discovery should be stopped.

In partial resolved notification case, if the tail room of the new
allocated buffer is not more the tail room of the current receiving
buffer, reports the error `-ENOMEM` and stop the following SDP
discovery.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-09-16 09:56:13 +02:00
Lyle Zhu
624407840f Bluetooth: SDP: Partial resolved if no space for next SDP SSA discover
The minimum receiving buffer size is 0x0007. The following SDP
discovery should not be started if the space of the receiving buffer
is less than 0x0007.

If there is no more space of the receiving buffer for the next SDP SSA
discovery, try to notify the upper layer with the partial resolved.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-09-16 09:56:13 +02:00
Lyle Zhu
22c14df4dc Bluetooth: Classic: SDP: Check max attr byte count for req and rsp
In the SDP specification, the `MaximumAttributeByteCount` of SA and
SSA should be in range 0x0007-0xffff. But in the current
implementation, this value is not checked both SDP server and client
sides.

Check the `MaximumAttributeByteCount` when receiving the SA or SSA
request on SDP server side.

Check the tail room of the receiving buffer before sending the SA or
SSA request on SDP client side.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-09-16 09:56:13 +02:00
Dmitrii Sharshakov
82e4fd84f4 jwt: fix signature length for JWT_SIGN_RSA_LEGACY
Fix the reference to the Kconfig item.

Fixes #73329

Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
2025-09-16 09:53:44 +02:00
Tom Burdick
e8c676be47 rtio: More useful callback OPs
Callbacks now take a result parameter which may, if the callback was
linkd to by a previous submissions, have the result code from the last
submission.

Additionally the userdata is now const by default making it easier to
use the device pointer as the userdata which is very common.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2025-09-16 09:53:14 +02:00
Kai Cheng
3e03a658b0 Bluetooth: DID: add did profile
add did profile codes

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2025-09-16 09:52:53 +02:00
Emil Gydesen
64ea5334e4 Bluetooth: BAP: SD: Remove address lookups
Remove lookups in the Scan Delegator that relates to
the advertiser address. The reason for this, is that the
address is not considered a unique value for receive states,
since the address may change over time in the case of (N)RPAs.
Instead we shall rely exclusively on the address type, the sid
and the broadcast ID.

The implementation of the Scan Delegator and Broadcast Sink
has been updated to not use addresses for lookups anymore,
and there has been a minor API modification to set the
PA sync state as part of bt_bap_scan_delegator_add_src
as the higher layers are better suited to handle the
PA Sync state.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-09-15 19:45:23 -04:00
Yangbo Lu
590d9d1c6f net: dsa: support PTP timestamping in netc tag driver
Supported PTP timestamping in netc tag driver.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-15 14:06:56 -04:00
Yangbo Lu
15dc8d78f2 net: pkt: support common usage of control block
Supported common usage of control block for any layer.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-15 14:06:56 -04:00
Yangbo Lu
997edb4e13 net: dsa: add PTP solution in core driver
Added PTP solution in core driver. Now only gPTP was supported.

- ethernet_api like get_capabilities and get_ptp_clock
  were supported in port driver.

- For TX timestamp, added new dsa_api port_txtstamp for device
  to handle. Device driver might put pkt in queue, and reported
  timestamp after completing transmitting on hardware.

- For RX timestamp, the timestamp could be given to pkt in tag
  driver or device driver.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-15 14:06:56 -04:00
Yangbo Lu
eabc1b38bf net: dsa: support tagger data and connecting device to tag protocol
Supported tagger data and connecting device to tag protocol, so that some
device specific work could be handled.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-15 14:06:56 -04:00
Yangbo Lu
ea6bdfe890 net: dsa: move dsa_tag_netc.h to public include directory
Moved dsa_tag_netc.h to public include directory for devices
reusing.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-15 14:06:56 -04:00
Mark Wang
67f246477f bluetooth: a2dp: save the reconfig to stream
The reconfig's configuration is not saved to stream, fix it.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-09-15 14:45:20 +02:00
Mark Wang
0963a8c2de bluetooth: a2dp: add bt_a2dp_stream_create_pdu
use bt_a2dp_stream_create_pdu to create the stream pdu net buf, then
application can use the buf->len to check whether the buf's size exceeds
the l2cap mtu.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-09-15 14:45:10 +02:00
Victor Brzeski
de0d8b9655 usb: device_next: cdc_acm: switch irq_lock to spinlock
Change the irq_lock to a spinlock to be more semantically
correct.

Signed-off-by: Victor Brzeski <vbrzeski@gmail.com>
2025-09-15 12:08:53 +02:00
Make Shi
b47f5fd88c Bluetooth: AVRCP: Dropping the connection when error response failure
Disconnect the L2CAP connection when fails on sending an error response
(unit info, subunit info, or passthrough).

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-09-15 12:07:30 +02:00
Make Shi
d57cce993e Bluetooth: shell: Add support for AVRCP TG passthrough
Add a callback function in shell and a new command for AVRCP TG
passthrough support

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-09-15 12:07:30 +02:00
Make Shi
0835fdca08 Bluetooth: AVRCP: Implement Pass Through command reception on TG
Add a new callback to support the situation when a Pass Through command
is received, and add an API to respond to the Pass Through command.

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-09-15 12:07:30 +02:00
Make Shi
33406d50c8 Bluetooth: Shell: AVRCP: support subunit info request and response
Add avrcp_subunit_info_req callback function in shell and a command to set
the subunit info response.

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

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-09-15 12:07:30 +02:00
Make Shi
21ed38526d Bluetooth: AVCTP: support fragmented packet transmission and reception
- Implemented fragmented packet handling for AVCTP protocol
- Refactored AVCTP header structure to support multiple packet types
- Enhanced AVCTP send logic with packet segmentation support
- Updated AVRCP integration to support new AVCTP fragmented flow

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-09-15 12:07:30 +02:00
Hoang Nguyen
1f6dd19462 arch: arm64: cortex_a: Add CPU load for Cortex-A
- Add calls to sys_trace_idle_exit before leaving idle state
  to track CPU load
- Extend CPU_LOAD to CPU_CORTEX_A in Kconfig

Signed-off-by: Hoang Nguyen <hoang.nguyen.jx@bp.renesas.com>
Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2025-09-13 18:14:59 -04:00
Jukka Rissanen
909710b598 net: context: Make sure TCP allocation is not leaked
If we have allocated a TCP connection, and if after that
we get an error like EADDRINUSE, then we must de-allocate
the TCP connection otherwise there is a buffer leak.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-09-13 18:13:21 -04:00
Georgios Vasilakis
53b2802fff net: websocket: Allow using PSA APIs to calculate SHA1
The websocket used mbedtls functions to calculate the
SHA1 needed. Update the code to use PSA crypto calls instead
when the configuration CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT
is enabled.

This can be useful for applications which use TF-M
since it only provides PSA crypto APIs.

Also check the error code from the mbedtls_sha1
call since it can fail and it was not checked before.

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
2025-09-12 18:31:04 +02:00
Yangbo Lu
5aaf69e145 net: ethernet: make inclusion relation clear for DSA and Ethernet headers
DSA is part of Ethernet and will utilize more Ethernet definitions for
more features support. So, it's proper to let DSA header include
Ethernet header with moving some DSA definiton from DSA header to
Ethernet header and adding DSA header including in c files using DSA
definition.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-12 13:19:41 +02:00
Yangbo Lu
0501be8090 net: ethernet: use void pointer for dsa switch context
In ethernet_context structure, it just needs a void pointer
for dsa switch context.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-12 13:19:41 +02:00
Emil Gydesen
e0c5c277a5 Bluetooth: PACS: Improve handling of notify on reconnect
When we reconnect to a bonded device we always attempted to
send the changed PACS notifications, regardless of
whether the remote device has subscribed to them or not.

This resulted in a lot of failed attempts to send
notifications when
CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION is enabled (which it is
by default).

Ideally we would not set the flags for devices that have not
subscribed, but since we cannot call bt_gatt_is_subscribed for
non-connected devices, we need to do this when the notify_cb
is called.

It would be possible to use BT_GATT_CCC_MANAGED instead
of BT_AUDIO_CCC to keep track of the writes for each client,
but that would be a minor optimization which would require
significant rework and additions to PACS. The current
solution is inspired by the implementation used in has.c

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-09-12 13:19:18 +02:00
Philipp Finke
8a831150f0 net: sockets: socket_service: Fixed issue that prevented reconfiguration
Once running, a socket service could not be reconfigured (i.e. changing
file descriptors and/or events to be polled). This was due to an wrong
check at the end of the thread main loop of socket_service_thread that
evaluated to false as variable ret is zero if trigger_work(), which is
called previously for all returned events, returns successfully.

Signed-off-by: Philipp Finke <philipp_finke@gmx.de>
2025-09-12 08:20:18 +01:00
Mark Wang
71ec12d6c0 bluetooth: avdtp: implement the avdtp fragmentation and reassembly
Define BT_AVDTP_SIGNAL_SDU_MAX Kconfig item to limit the max avdtp signal
SDU size, then use avdtp self defined net buf pool to prepare data. Use
default acl_tx_pool pool do to the fragmentation.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-09-12 08:19:16 +01:00
Emil Gydesen
146dce9f7e Bluetooth: BAP: Shell: Reverse in/out terminology
In USB "in" refers to data going from device to host,
and "out" refers to data going from host to device.

From a BT perspective "usb_out" then refers to the data
we receive from the host, to be sent over BT, so the "out"
terminology still works for that, and vice versa for
incoming BT data.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-09-11 18:09:52 +01:00
Cristian Bulacu
cbd599fecd net: sockets: Return mapped address from sock_get_pkt_src_addr() function
When an IPv4 packet is received on a dual-stack socket, return
the mapped v4 to v6 address as source address.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-09-11 18:09:09 +01:00
Cristian Bulacu
48897a9090 net: context: Fix issues in context_sendto() function
Fixed issue when `sendmsg()` was in use and `CONFIG_NET_IPV6`
and `CONFIG_NET_IPV4_MAPPING_TO_IPV6` were in use, as `dst_addr`
argument of `context_sendto()` was passed NULL,
but also used to determine `sa_family`.
Use msghdr, if available, to determine if v4 to v6 mapping is
present.
Also set `dst_addr` to unmapped value  when v4 to v6 mapping is
used.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-09-11 18:09:09 +01:00
Cristian Bulacu
3072c53a84 net: context: Add support to set hoplimit when v4 to v6 mapping is used
If v4 to v6 mapping is used, cmsg_level and cmsg_type should
be compared with IPv6 values even if pkt family if AF_INET.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-09-11 18:09:09 +01:00
Andrea Ronco
4b451307dc doc: mgmt: mcumgr: fix typo in fs_mgmt Kconfig
Fixing a typo in FS managment Kconfig docstring

Signed-off-by: Andrea Ronco <aronco@ethz.ch>
2025-09-11 18:08:20 +01:00
Aleksandr Khromykh
3a6cfe3736 bluetooth: mesh: remove wrong state warning
Commit removes `Wrong state` warning from some DFU API.
This information has value only for debugging.
No any value for application to generate warning
on the regular basis.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-09-11 14:18:35 +01:00
Jukka Rissanen
80953bb8e0 net: tcp: Print TCP connection info consistently
Print TCP connection pointer value for debug prints
consistently so that it is easier to find debug prints that
are related to a certain TCP connection.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-09-11 09:54:27 +02:00
Jeppe Odgaard
3813b3cdda net: config: sntp: improve logging
Print return code on error and remove logging in `sntp_resync_handler`
since it calls `net_init_clock_via_sntp` which already does logging.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-09-10 16:39:34 +02:00
Emil Dahl Juhl
5b7c462c12 rtio: executor: add relaxed RTIO_OP_AWAIT variant
Allow the rtio executor to handle the RTIO_OP_AWAIT for cases where no
rtio_iodev needs to be blocked while waiting for the signal.

When the RTIO_OP_AWAIT was introduced, the highlighted usecase was
performing transactions within an exact time window. This can be
achieved by blocking the rtio_iodev, effectively locking the bus, while
awaiting.

However, a relaxed implementation which doesn't block any rtio_iodev is
really useful for device drivers that use some kind of ready-event
during transactions. For example in order to read configuration out of
a sensor, the following flow may be required:

    1. Write some cmd like "read accelerometer scale"
    2. Await data-ready GPIO rising edge (might take "a long time")
    3. Read the requested data payload from the sensor

Using a relaxed variant of the RTIO_OP_AWAIT this can be elegantly put
together in a single chained rtio sequence. And by not blocking the
rtio_iodev, other devices can be operated during the await period.
Of course, not blocking the rtio_iodev also means that the bus may be
busy when the RTIO_OP_AWAIT completes and thus, step 3 may be blocked
for a some time and the guarantee of an exact time window cannot be
achieved with the relaxed variant.

To make the API clearer, separate helpers are added for the strict
(blocking iodev) and relaxed (blocking only the sqe chain) variant
respectively.

Signed-off-by: Emil Dahl Juhl <emil@s16s.ai>
2025-09-10 16:39:15 +02:00
Emil Gydesen
3568f25fed Bluetooth: BAP: Add missing ep check in client_qos
The bt_bap_unicast_client_qos function was recently
modified to check for presentation delay, however it did
not consider that a unicast group may contain streams that
are not configured, and thus do not have endpoints.

Add a stream->ep != NULL check to only consider configured
streams.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-09-10 13:02:39 +02:00
Utsav Munendra
2a6d692937 fs: Shell command ls to list file sizes
List the file size helps in developer debugging experience. Provide
a config to disable new behavior in case any users depended on
command output to be a list.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-09-10 13:02:31 +02:00
Cla Mattia Galliard
8e6521a14d net: socket: Specify the packet socket-type, when inputting
Specify the socket type, when inputting a packet into a packet-socket.

Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
2025-09-10 13:01:56 +02:00
Cla Mattia Galliard
b9968e9d1f net: core: Decide about l2-processing based on l2_processed-flag
Use the l2_processed-flag to decide whether a network packet needs to be
processed by an L2-handler. This could be used in the future to requeue
packets for later processing by a different traffic class queue.

Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
2025-09-10 13:01:56 +02:00
Cla Mattia Galliard
0327bb1ae0 net: pkt: Store is_loopback info in packet meta-data
Store the flag in the packet meta-data so that processing may be deferred
if necessary.

Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
2025-09-10 13:01:56 +02:00
Lyle Zhu
d330e86e03 Bluetooth: Classic: l2cap: Fix ACL conn invalid issue
There is an issue found that the L2CAP BR channel attempts to send
signaling commands through fixed channel when the ACL connect is
broken. At this time, the ACL connect of fixed channel is invalid.
Then the `__assert` occurs in function `bt_conn_ref()`.

Fixed the issue by checking the ACL conn of the L2CAP channel before
sending the data.

Here is a referred fault case for this changes,
There are two connected L2CAP Channels. The first one is primary
connection of the profile. And the second one is secondary connection
of the profile. When the primary connection is broken, the secondary
connection should also be disconnected.
In normal case, if the primary connection is disconnected by calling
L2CAP channel disconnection function, the secondary connection will
be disconnected by calling L2CAP channel disconnection in the
disconnected callback of primary connection.

But there is a corner case is that, the ACL connection is broken.
When the disconnected callback of primary connection is called, the
function call of L2CAP channel disconnection for secondary connection
will be asserted. Because the signaling channel (fixed channel ID
0x01) is disconnected and the `chan->conn` of the fixed channel is
NULL in this time.

The call stack is,
o bt_conn_ref() -> Asserted in this function.
o bt_conn_data_ready() -> The parameter is `br_chan->chan.conn`.
  It is the NULL.
o raise_data_ready() -> The parameter `br_chan` is fixed channel.
o bt_l2cap_br_send_cb() -> The parameter is ACL conn and CID of fixed
  channel (cid = 0x01). The channel can be found, but `chan->conn` is
  NULL.
o l2cap_br_chan_send_req()
o bt_l2cap_br_chan_disconnect()
o bt_l2cap_chan_disconnect() -> The parameter is the channel of
  secondary connection. The state of secondary channel is connected,
  because the stack is handling the primary channel disconnecting.
  And the function is called in disconnected callback of primary
  channel.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-09-10 10:27:38 +01:00
Mark Wang
5d79e8ce8b bluetooth: avdtp: fix dereferencing null pointer sep
Get seid from buf not sep.
CID 548589
CID 548590

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-09-10 10:12:30 +02:00
Lyle Zhu
22346b47b8 Bluetooth: Classic: SDP: Support ATTR ID list setting for SA/SSA REQ
In current implementation, the ATTR ID list is set with fixed value
(0x0000, 0xffff). For the case that responding a lot of SDP record
data, the responded data cannot be processed properly due to the
receiving buffer size limitation. In this case, the ATTR ID list can
be used to reduce the length of the responding data. In this way, it
will help reduce the SDP's requirement for receiving data buffer size.

Add the attribute ID list configuration to the SDP discovery request
structure `struct bt_sdp_discover_params`.

If the `struct bt_sdp_discover_params::ids` is NULL, or
`struct bt_sdp_discover_params::ids::count` is 0, the default range
(0x0000, 0xffff) is used.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-09-10 08:27:21 +02:00