Commit graph

22,555 commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada
3e2beedb21 Bluetooth: Controller: Minor update adding comments
Minor update adding comments in the implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-08-28 19:57:28 +02:00
Vinayak Kariappa Chettimada
043dee2919 Bluetooth: Controller: Move declaration close to locality of reference
Move the declaration code to locality of reference and be
consistent in how the code pattern is, related to calling
LLL disable.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-08-28 19:57:28 +02:00
Vinayak Kariappa Chettimada
e94d9c7811 Bluetooth: Controller: Fix event overhead check for single timer use
Single timer use needs additional event overhead to start
radio to ensure the software switch implementation executing
in radio completion ISR can correctly set the tIFS switching
after a maximum radio ISR latency.

The latency value shall be the used additional overhead so
that there is no spurious tIFS switch before radio ISR
executes.

The additional event overhead value is not considered in the
event overhead check.

Relates to commit 37bf99eee7 ("Bluetooth: Controller: Fix
radio_tmr_start_us for single timer use").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-08-28 19:57:28 +02:00
Vinayak Kariappa Chettimada
66d85b448b Bluetooth: Controller: Fix assertion establishing connection
Fix an assertion detecting delayed prepare establishing an
ACL connection due to scanner or advertiser not disabled
immediately when scheduling the first connection event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-08-28 19:57:28 +02:00
Vinayak Kariappa Chettimada
fe7675e209 Bluetooth: Controller: Fix assertion due to cleared pending radio IRQ
Fix assertion on scan disable observed in BabbleSIM audio
tests due to clearing of pending radio IRQ under race
conditions between scanning being stopped by application
and scanning stopped on central connection setup.

irq_enable/disable is not needed either as radio_isr_set
is always called from Radio or LLL execution context which
are co-operative with each other at same execution priority.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-08-28 19:57:28 +02:00
Vinayak Kariappa Chettimada
355648a69f Bluetooth: Controller: Fix missing radio tmr status reset
Fix missing radio tmr status reset on radio_disable call,
without this which disables PPI/DPPI caused under race
conditions the radio to transition into Tx or Rx state and
put the Controller's state out of sync with the Radio
peripherals internal state. The symptoms being that the
Central role was not transmitting in the next interval;
also, caused the defer iterations to reach maximum events
being enqueued in the pipeline, and manifesting as large
CPU overheads in redundant prepare of deferred events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-08-28 19:57:28 +02:00
Vinayak Kariappa Chettimada
4b272e0b33 Bluetooth: Controller: Fix missing radio status reset
Fix missing radio status reset on early abort of central
and peripheral prepare.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-08-28 19:57:28 +02:00
Aleksander Wasaznik
73fbdbe1e7 Bluetooth: document bt_addr_le_is_resolved()
I believe there is some confusion about what this function does. This
function is doing some type-bending, so it's extra important to document
it.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2025-08-28 13:59:45 +02:00
Lyle Zhu
613dcf327e Bluetooth: Classic: SCO: Get SCO conn info
Save the air_mode to SCO connect object.

Add a structure `struct bt_conn_sco_info` to return the SCO conn info.

Return SCO info through `struct bt_conn_sco_info` when calling the
function `bt_conn_get_info()`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-28 13:59:10 +02:00
Alex Fabre
714cbd85ec log: backend: net: add const qualifier to hostname
When setting the net log hostname, the string content is not modified.

Signed-off-by: Alex Fabre <alex.fabre@rtone.fr>
2025-08-28 11:32:11 +02:00
Bastien Beauchamp
ad849debee pm: skip min_residency_ticks calculation if input is 0
In the default PM policy, the function k_us_to_ticks_ceil32() is used
and does calculation using 64-bit integers which can be slow and
avoidable if the input is 0.

Signed-off-by: Bastien Beauchamp <bastien.beauchamp@silabs.com>
2025-08-28 08:57:06 +02:00
Aaron Ye
8bbc05df71 Bluetooth: Host: direction: correct the cte_req_enable opcode
The opcode of hci_df_set_conn_cte_req_enable command should be
BT_HCI_OP_LE_CONN_CTE_REQ_ENABLE (0x2056).

Signed-off-by: Aaron Ye <aye@ambiq.com>
2025-08-28 06:24:33 +02:00
Cheng Chang
2768acb856 bluetooth: host: avdtp: Fix command and response format error
There are three aspects of changes involved:
1.  The format of Service Category should be checked  in set
configuration cmd and error code and Service Category
should be detailed in response.
2. There is no  INT Stream Endpoint ID in re_config cmd,.
3. Fail ACP SEID should be added to start and suspend rej rsp.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2025-08-28 06:24:19 +02:00
Emil Gydesen
56b0e3eb34 Bluetooth: Host: Rearrange fields in bt_le_ext_adv
Move the CONFIG_BT_EXT_ADV fields up and have the 2
8-bit values first, so they can be placed in the same
word as the previous 2 when applicable.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-27 20:52:19 +02:00
Emil Gydesen
ef700ec525 Bluetooth: CAP: Remove sid from u->b handover params
The SID is now gettable via bt_le_ext_adv_get_info.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-27 20:52:19 +02:00
Emil Gydesen
bbcbcbfc41 Bluetooth: Adv: Store SID and expose via adv_info
Store the SID in the advertising set, and let it be possible
to get it again via bt_le_ext_adv_get_info.

The SID may be used by higher layers to shared information
about the advertising set.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-27 20:52:19 +02:00
Emil Gydesen
b714ea3484 Bluetooth: Shell: Increment SID per set
Instead of always using SID=0 for advertising sets (which can be
tricky if there are multiple advertising sets using the same SID
and address), the SID will be incremented and wrap around when
reaching the max to reduce the risk of 2 or more sets having the
same SID.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-27 20:52:19 +02:00
Sean Kyer
3a54a4d123 settings: Add EXPERIMENTAL to TF-M ITS backend
Add select EXPERIMENTAL to the TF-M ITS
backend of the settings subsystem.

Signed-off-by: Sean Kyer <sean.actor@gmail.com>
2025-08-27 16:35:23 +02:00
Sean Kyer
20360ff4da settings: Remove default selection of TF-M ITS backend
Remove the default selection of SETTINGS_TFM_ITS when
TFM_PARTITION_INTERNAL_TRUSTED_STORAGE is enabled
which caused this backend to be built when it was
not intended.

Signed-off-by: Sean Kyer <sean.actor@gmail.com>
2025-08-27 16:35:23 +02:00
Lyle Zhu
5245307512 Bluetooth: GATT: Check len of response before parsing response PDU
In function `parse_read_by_uuid()`, the response length is not checked
before parsing the response PDU. There is a potential issue that the
`len` will be underflowed if the `len` is less than the size of
`struct bt_att_data`.

Check the length before parsing the response PDU. If the length is less
then the size of `struct bt_att_data`, notify the upper layer with the
error `BT_ATT_ERR_INVALID_PDU` and stop the parsing.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-27 15:16:47 +02:00
Jeppe Odgaard
cbc2b3b540 shell: mqtt: remove username and password preprocessor checks
`#ifdef` will always evaluate to true when used on string Kconfig options.
Therefore username and password is set to "" if unset in Kconfig which is
not an issue.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-08-27 09:47:04 +02:00
Mike J. Chen
ebab75bb73 nvs: support sector_size of 64KB
Allows NVS to work with flash device configured to
use only 64KB block erase. Due to how addresses
are encoded internally in NVS, 64KB is the maximum
sector size. Add a test for this during mount.

Add a native_sim unit test case for 64kb erase block size

Signed-off-by: Mike J. Chen <mjchen@google.com>
2025-08-26 16:13:23 +02:00
Jeppe Odgaard
a8c8f7f2b8 shell: mqtt: select NET_CONNECTION_MANAGER
Replace `select NET_MGMT` and `select NET_MGMT_EVENT` with
`select NET_CONNECTION_MANAGER` to get L4 events.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-08-26 13:25:47 +02:00
Jeppe Odgaard
ddc4479243 shell: mqtt: use topic levels
Change topic from <device_id>_rx (and tx) to <device_id>/sh/rx.

This allows use of wildcards. E.g. subscribe to all devices "+/sh/tx".

Level "sh" is added to the topic to make it less generic and prevent
potential clashes with other topics.

The topic part after <device_id> is configurable via Kconfig.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-08-26 13:25:47 +02:00
Vinayak Kariappa Chettimada
3461135d02 Bluetooth: Controller: Fix assertion in scan aux release
Fix assertion under race conditions where LLL scheduling
did not have an auxiliary context assigned but when node rx
is released an auxiliary context is picked from the scan
context that has no parent assigned yet due to a previously
assigned auxiliary context to the scan context was not
cleared.

Relates to commit 49642efa41 ("Bluetooth: Controller: Fix
regression in scan aux release").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-08-26 11:34:36 +02:00
Vinayak Kariappa Chettimada
5ce9d0c621 Bluetooth: Controller: Fix extended scanning assert on invalid chan_idx
Fix extended scanning assert on invalid chan_idx received in
the aux pointer structure.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-08-26 11:34:36 +02:00
Make Shi
9cfbed62df Bluetooth: Shell: AVRCP: Shell interface for browsing support
- Add shell interface for browsing connect and disconnect testing and
  SetBrowsedPlayer command testing.

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-08-26 09:32:21 +02:00
Make Shi
240ad5cedc bluetooth: avrcp: Add support for AVRCP browsing
- AVRCP SDP record updates for browsing channel
- L2CAP setup for AVCTP browsing channel, and add connect/disconnect
- Add SetBrowsedPlayer browsing command handling

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-08-26 09:32:21 +02:00
Make Shi
b923bde676 bluetooth: avrcp: provide an API for net buffer allocation
Add bt_avrcp_create_pdu() to allocate net_buf with protocol headroom.

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-08-26 09:32:21 +02:00
Make Shi
895ba04b32 Bluetooth: AVCTP: Refactors the AVCTP to support multiple L2CAP PSMs
- This patch refactors the AVCTP layer to support multiple L2CAP PSMs
- Introduced bt_avctp_server structure for dynamic L2CAP server
  registration and new server register apis
- Added k_sem protected server list to support multiple AVCTP servers

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-08-26 09:32:21 +02:00
Emil Gydesen
62c8ca3498 Bluetooth: CAP: Shell: Print generated broadcast ID
Since the broadcast ID is generated at runtime, it is nice
to get it printed so that it can be shared.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-25 17:49:55 +02:00
Emil Gydesen
bfaa1169e8 Bluetooth: BAP: Shell: Print generated broadcast ID
Since the broadcast ID is generated at runtime, it is nice
to get it printed so that it can be shared.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-25 17:49:55 +02:00
Emil Gydesen
7ec51764d0 Bluetooth: BAP: Shell: Print broadcast ID and broadcast name when scanning
When scanning, the broadcast_scan_recv now prints the broadcast ID
and the broadcast name (if found). Without this, it is not possible
to use the shell to scan for an unknown broadcast ID or broadcast
name.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-25 17:49:55 +02:00
Jonas Spinner
da75828459 net: gptp: fix clock accuracy description
Previously, the Kconfig option `NET_GPTP_CLOCK_ACCURACY_2_5MS` had a
incorrect description "1.5ms".

Signed-off-by: Jonas Spinner <jonas.spinner@burkert.com>
2025-08-25 17:49:39 +02:00
Mark Wang
3544546356 bluetooth: a2dp: implement the get_all_capabilities
From avdtp spec, the get_all_capablities should be used if the avdtp
version is v1.3, otherwise the get_capabilities should be used.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-08-25 13:31:55 +02:00
Mark Wang
d8f35a5baa bluetooth: sdp: add avdtp protocol
get the avdtp version through the bt_sdp_get_proto_param

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-08-25 13:31:55 +02:00
Emil Gydesen
c9e1725665 Bluetooth: GATT: ASSERT instead of LOG_DBG for write length check
In bt_gatt_write_without_response_cb there is a check for
write != length. However since the call to bt_att_create_pdu
should ensure that this is possible, this should never happen.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-25 11:39:42 +02:00
Emil Gydesen
04a15510a9 Bluetooth: ASCS: Use LOG_DBG when failing to alloc buffer for notification
Since there is a retry mechanism implement, this is not something
that the user needs to be warned about.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-25 11:39:42 +02:00
Emil Gydesen
d3ffdf4b24 Bluetooth: GATT: Modify some LOG_WRN/ERR to LOG_DBG
When an API function returns an appropriate error code,
LOG_DBG is better suited than LOG_WRN or LOG_ERR as the
caller can handle the return value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-25 11:39:42 +02:00
Emil Gydesen
ace3a60137 Bluetooth: ATT: Change LOG_ERR to DBG when failing to allocate buffer
For user-initiated requests like notifications, read and write
requests, there will be an error code, so there does not need to be
a generic LOG_ERR if these fail to be allocated.

However if the response or (indication) confirmation PDUs fail
to be allocated, these should still be logged as errors.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-25 11:39:42 +02:00
Emil Gydesen
00d4ab1c9c Bluetooth: Conn: LOG_DBG for buffer alloc fail
Use LOG_DBG rather than LOG_WRN, as that is an expected
scenario when using K_NO_WAIT (e.g. when sending
GATT notifications), and it is better for higher layers
to determine if this is indeed an error.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-25 11:39:42 +02:00
Pavel Vasilyev
d59af08b19 bluetooth: host: gatt: Compile out att cmds for long write proc
`bt_att_recv`, which parses ATT PDUs, already contains code that
responds with `BT_ATT_ERR_NOT_SUPPORTED` if a given handler is not
implemented.

Therefore, `att_prepare_write_req` and `att_exec_write_req` handlers do
not need to explicitly return `BT_ATT_ERR_NOT_SUPPORTED` when
`CONFIG_BT_ATT_PREPARE_COUNT` is set to 0 and can be completely removed.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-08-25 09:13:22 +02:00
Tom Burdick
9c27d72922 rtio: Add a context pool
Adds a context pool that can be used when a number of threads may be
dynamically created to use with RTIO. While the pool has a small cost to
it, the cost of verifying a statically declared kobject likely makes it
worth avoiding dynamically allocating these with the typical
kobject_alloc method. Instead this arena style pool of objects can be
used where the kobject validation uses the gperf hash created at build
time.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2025-08-22 16:45:53 +02:00
Pavel Vasilyev
50928fc517 bluetooth: host: remove bt_ prefix from internal functions
Remove the bt_ prefix from internal functions to avoid confusion when
reading code.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-08-22 14:50:38 +02:00
Pavel Vasilyev
dfe05dd0d7 bluetooth: host: prefix API functions with bt_
Prefix API functions of a module with bt_ to avoid confusion when
reading code.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-08-22 14:50:38 +02:00
Pavel Vasilyev
c21e613fa9 bluetooth: host: mark internal functions and variables as static
Mark functions and variables as static when not used outside a unit.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-08-22 14:50:38 +02:00
Jun Lin
b30d2ac07c ec_host_cmd: shi: npcx: change log level for some error messages
It was observed in a project that when an error transaction occurs,
printing the error message can delay resetting the SHI state machine and
initializing the output buffer, which may cause the subsequent
transaction to fail, especially during stress tests involving heavy host
command communication.
This commit changes some error log level from ERR to DBG to prevent the
condition above from happening.
Also change the default debug level for the SHI driver to LOG_LEVEL_ERR.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2025-08-22 12:37:17 +02:00
Lyle Zhu
de0b53578a Bluetooth: SDP: Fix ssa discovery issue caused by setting range
If the range of the service search attribute request is set and the
start of the range is not 0x0000, the response data of the request is
not valid. It is caused by the data element sequence has not be added
to response data. The client cannot parse the response data properly.

The root cause of this issue is that the total length of service
record will be added only when adding the first attribute of service
record.

Fix the issue by reset the `state.last_att` and `state.last_att_index`
if the index of current record is not same with `state.current_svc`.

And do not update `state.last_att`, `state.last_att_index`, and
`state.current_svc` in the function `select_attrs()`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-22 12:36:09 +02:00
Lyle Zhu
bb159e9d08 Bluetooth: SDP: Fix issue that RX buf is used for others discovery
In current implementation, the received buffer is incorrectly used for
other SDP discover requests.

Release the RX buffer when the SDP discovery is done. And allocate the
new RX buffer from the pool of the new SDP discovery request.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-22 12:36:01 +02:00
Robert Lubos
faa507ef6c net: Fix misc Kconfig style issues in networking area
Fix misc Kconfig style issues in networking area.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-08-21 20:12:48 +02:00