Commit graph

9523 commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada
e998593c2e Bluetooth: Controller: nRF54Lx: Port for data whitening register use
nRF54Lx have updated Data Whitening register settings, add
implementation to correctly set them up.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-30 11:47:15 -04:00
Vinayak Kariappa Chettimada
01d7a5bf13 Bluetooth: Controller: Ticker support for free running counter
Add ticker implementation support for free running counter
use.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-30 11:47:15 -04:00
Vinayak Kariappa Chettimada
a947d6f635 Bluetooth: Controller: Add HAL_TICKER_TICKS_TO_US_64BIT define
Add HAL_TICKER_TICKS_TO_US_64BIT define, to return
microsecond value in 64-bits.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-30 11:47:15 -04:00
Vinayak Kariappa Chettimada
ded2c74a97 Bluetooth: Controller: Remove redundant HAL_TICKER_CNTR_CLK_FREQ_HZ
Remove redundant HAL_TICKER_CNTR_CLK_FREQ_HZ define.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-30 11:47:15 -04:00
Vinayak Kariappa Chettimada
55b7dba8ec Bluetooth: Controller: Refactor sw_switch hal interface use
Refactor sw_switch hal interface use and document why some
PPI/DPPI channel group related subscriptions are not
disabled explicitly.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-30 11:47:15 -04:00
Vinayak Kariappa Chettimada
a7fff7445c Bluetooth: Controller: Fix ext conn create when using single timer
Fix Extended Connection Creation when using single timer
feature in the Controller.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-30 11:47:15 -04:00
Vinayak Kariappa Chettimada
bcd28e0a86 Bluetooth: Controller: Fix sw switch single timer for spurious TXEN/RXEN
Fix software tIFS switching using single timer from
triggering spurious TXEN/RXEN if the first remainder is
shorter than the tIFS delay calculated in the sw_switch()
function.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-30 11:47:15 -04:00
Vinayak Kariappa Chettimada
7fbf337e6f Bluetooth: Controller: Fix BT_CTLR_EARLY_ABORT_PREVIOUS_PREPARE depends
Fix BT_CTLR_EARLY_ABORT_PREVIOUS_PREPARE Kconfig depends on.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-30 11:47:15 -04:00
Pavel Vasilyev
1fa27888f4 bluetooth: mesh: Fix proxy client compilation
When building proxy client without proxy server, it fails to find
the `identity` field in the `struct bt_mesh_subnet_keys` because the
latter only compiles when Proxy server is enabled. It should be
possible to compile Proxy Client without Proxy server.

This commit compiles the field if any of GATT features is enabled.

Fixes #75914

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-08-30 11:43:51 -04:00
Alberto Escolar Piedras
5c17f51bda Bluetooth: Controller: Initialize BIG info RFU field
The BIG info new Framing Mode field was not initialiazed, so
random garbage was being sent to the air in this field.
For the controller this field is still RFU.
The spec specifies RFU fields must be initialiazed to
0. So let's do so to avoid sending invalid data,
and avoid having random data in the air which can cause
random differences in testcases.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-08-30 11:43:40 -04:00
Anuj Pathak
7e1dc5ae3e bluetooth: services: hrs: added control point write callback
- HRS control point was added to server but no write callback is
defined, this causes issues if control point characterstic is
written by the client

Signed-off-by: Anuj Pathak <anuj@croxel.com>
2024-08-29 16:12:12 -04:00
Nithin Ramesh Myliattil
d8e4bc7ff0 bluetooth: BAS: add gatt notify for battery level status char
gatt notification for battery level status char is added
in battery service.

Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
2024-08-29 18:03:09 +02:00
Anuj Pathak
957d59814b bluetooth: services: added current time service
- added ctc implementation
- updated Kconfig & CMake files
- updated service doc

Signed-off-by: Anuj Pathak <anuj@croxel.com>
2024-08-29 11:38:28 +02:00
Mark Wang
b4ddf3dec6 Bluetooth: Classic: SDP: fix that record len is SEQ32
find the headset which a2dp related record len is SEQ32,
fix sdp_client_get_total too because it doesn't handle
SEQ32 too.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2024-08-29 11:38:02 +02:00
Emil Gydesen
3e9197a58a Bluetooth: Mesh: Rename mesh test primitives
Since testing.c/h was moved to mesh, all functions and
structs in those files now follow a bt_mesh_test_*
naming scheme to be consistent with the naming in Zephyr.

Due to missing includes in many files, this commit also
added some that were missing in order to build since
the order of includes have changed.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-08-27 15:14:08 -04:00
Emil Gydesen
f1b182b585 Bluetooth: Mesh: Move testing.h to mesh subsys instead of include
The file is only ever used by mesh and it is even stated in the
header of the file that it is internal APIs.

The include file has been merged with the host testing.h file
as that was mesh specific as well. Similarly the testing.c
file was also moved

This is part of a process to clean up the file structure of
Bluetooth as it's a bit messy, which is evident from the
MAINTAINERS.yml file.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-08-27 15:14:08 -04:00
Szymon Janc
77cbd27a80 bluetooth: gatt: Fix ATT Read By Type by DB change unaware client
When change unaware client send ATT request it shall get Database
Out of Sync error. Reading GATT database hash is an exception here.

This was affecting GATT/SR/GAS/BV-05-C qualification test case.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-08-27 07:14:59 -04:00
Emil Gydesen
eaf92a1494 tests: Bluetooth: CAP: Initiator unicast start unittests
Adds unittests for the CAP Initiator start procedure, simply
verifying that the procedure works as well as
testing invalid parameters.
This also allows us to remove the invalid behavior checks
from the babblesim test implementation.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-08-26 17:27:36 -04:00
Vinayak Kariappa Chettimada
f05d16dabb Bluetooth: Controller: Fix missing Broadcast ISO Sync MIC failure
Fix missing implementation to handle Broadcast ISO MIC
failure during Broadcast ISO establishment, and during an
already established Broadcast ISO sync.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-26 18:52:55 +02:00
Vinayak Kariappa Chettimada
d5da582e00 Bluetooth: Controller: Fix PA setup for ISO Broadcast
Fix missing PA setup for ISO Broadcast subevent transmits.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-26 18:52:42 +02:00
Johan Hedberg
5736b71193 Bluetooth: Host: Fix incorrect build assert
We want to make sure `struct closure` fits in the user data, so a user data
size of `sizeof(struct closure)` is valid.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-08-26 18:51:11 +02:00
Valerio Setti
98ddf107fa mbedtls: rename CONFIG_MBEDTLS_ZEPHYR_ENTROPY and move it
- Slightly improve the name of this kconfig adding the suffix
  _POLL in order to highlight that this adds a callback
  function used to poll data.

- Description was also updated to point out that this symbols
  might not only use the (secure) entropy driver, but also
  generic number generators, some of which are not really
  secure.

- The symbol was move from Kconfig to Kconfig.tls-generic because
  this is where MBEDTLS_ENTROPY_C is located and since
  MBEDTLS_ENTROPY_HARDWARE_ALT depends on the former (it only
  makes sense if the entropy module is also enabled), we add
  also the "depends on".

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-08-24 07:16:51 -04:00
Junho Lee
0f7f6edcf6 Bluetooth: Mesh: Fix uninitialized field when cancelling transfer blob
Initialize the missing chunk field when canceling a BLOB Transfer.
If you canceled a BLOB Transfer, the missing_chunk was not cleared in
the next BLOB Transfer. This can make it look like there are still
missing chunks, even though all chunks in the block have already been
received, and it does cause bugs.

Signed-off-by: Junho Lee <tot0roprog@gmail.com>
2024-08-23 09:53:09 +02:00
Jonathan Rico
4bdca17e21 Bluetooth: OTS: Use proper kconfig log option
`OTS_CLIENT=y` and `OTS=n` is a valid config.

Since the logs weren't conditionally included, this flew under the radar
for a while.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-08-21 16:44:44 -04:00
Jonathan Rico
3324eecbae Bluetooth: Re-organize logging Kconfig options
- got rid of "Others" menu
- JK I made a new one: "Common"
- moved all host-related opts to "Host" instead of "Others"
- moved all audio-related opts behind `if BT_AUDIO`
- moved only controller kconfig to controller/Kconfig.ll_sw_split
  - it had a dependency there already

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-08-21 16:44:44 -04:00
Jonathan Rico
f7631d4b4a Bluetooth: Conditionally include logging Kconfigs
Having all the configs be visible by default clutters the menuconfig
view. Make them visible only when the corresponding subsys or module is
enabled.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-08-21 16:44:44 -04:00
Jonathan Rico
6b6c4333b7 Bluetooth: doc: update kconfig docstring
CONFIG_BT_CONN_TX_USER_DATA_SIZE is now used for callbacks in the host.
We don't want to limit ourselves to that, so change the wording to be
more generic.
In the future, the plan is to not use user_data at all, removing the
need for the kconfig altogether.

Also rename the structure that was referenced in the docstring.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-08-20 19:58:39 -04:00
Nithin Ramesh Myliattil
baa5683e59 bluetooth: BAS: add battery level status char to bas service
Added the battery level status char to bas service
as per bas_1.1 spec. Added BSIM test for BAS service
to test the NTF/INDs of BAS characteristics.

Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
2024-08-20 18:59:14 -04:00
Jan Müller
c910520f4d Bluetooth: Host: Rework enabling of scanner
To make the scanner module more understandable and more streamlined, I
reworked the update mechanism of the scanner. The scanner tracks now the
parameters that were used to enable it and the reason why it is running.
This facilitates state logic and allows other modules to "start the
scanner", altough it is already running.
This is mostly a refactoring and not a functional change.

Added a test to verify the behavior.

Signed-off-by: Jan Müller <jan.mueller@nordicsemi.no>

add to task
2024-08-20 14:54:25 -04:00
Kyra Lengfeld
0a7908588c Bluetooth: Mesh: add Kconfig options for BLOB chunk size
The MBT server, as the MBT client currently sets the maximum chunk size
according to maximum supported segments in the accesss layer. This might
be suboptimal for some use cases.
The added Kconfig options give customers the option to fine tune it
themselves.

Future work will include addition of an API for the customer to modify
it also during runtime.

Signed-off-by: Kyra Lengfeld <kyra.lengfeld@nordicsemi.no>
2024-08-20 14:45:57 +02:00
Chang An
e8db417a00 LE Audio: add conn parameter for bt_vcp_vol_rend_cb
Add conn parameter to status/flags callbacks of bt_vcp_vol_rend_cb
to differentiate between remote and local changes.

Signed-off-by: Chang An <chang.an_1@nxp.com>
2024-08-20 14:45:35 +02:00
Jonathan Rico
cbb62333aa Bluetooth: L2CAP: remove commented-out assert
This assert cannot be turned on, as `pdu` will be NULL sometimes. This
is okay, it just means that the current channel doesn't have anything to
send and that we should probably try another one.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-08-20 10:33:31 +02:00
Jonathan Rico
c98bc820a3 Bluetooth: Host: remove outdated comment
This comment refers to an old piece of code that never got in main.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-08-20 10:33:31 +02:00
Jonathan Rico
6fa6c4c256 Bluetooth: L2CAP: Downgrade user_data API error to a warning
When user_data is not zeroed-out, the API returns an error. Downgrade
the API error to a warning log instead.

Introducing this check (#76489) broke a few PTS tests, as user_data is
not initialized by `net_buf_alloc()`. Doing so is in discussion:

https://github.com/zephyrproject-rtos/zephyr/issues/77088

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-08-19 09:55:49 -04:00
Sean Madigan
2a46edeaed bluetooth: controller: kconfig: select power control for plm
Path loss monitoring does not work without LE Power Control
also enabled in the controller, so update the dependencies
in the kconfigs so path loss monitoring selects power
control.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2024-08-17 08:55:13 -04:00
Sean Madigan
2e7c488484 bluetooth: host: conn: Fix renamed callback_list
callback_list was renamed to conn_cbs in commit 3eb975d.

However plm callback was missed due to it not being built
anywhere.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2024-08-17 08:55:13 -04:00
Jonathan Rico
80a92f51a5 Bluetooth: Host: Add missing bt_tx_irq_raise()
Trigger the TX processor on connection teardown.

When a disconnection happens before the controller has acknowledged some
ACL fragments the host has sent, we run `process_unack_tx()` to free
those unacknowledged buffers and their associated TX contexts.

The problem is that the TX processor still holds a reference to the conn
object. That reference is not released until the TX processor is
triggered again and figures out that the connection is invalid.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-08-16 16:29:41 +01:00
Vinayak Kariappa Chettimada
3590bd648f Bluetooth: Controller: Fix missing invalid aux offset check
Fix missing invalid aux offset check that was being caught
in a development assertion check. If aux offset where less
than the PDU time of the primary channel PDU, radio was
redundantly being setup delayed for reception that was
being caught in an assertion check.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-16 16:29:28 +01:00
Vinayak Kariappa Chettimada
521ea5561a Bluetooth: Controller: Add assertion checks for delayed radio start
Add assertion checks for delayed radio start.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-16 16:29:28 +01:00
Théo Battrel
f3dcaaee35 Tests: Bluetooth: Add another ISO frag test
This test create a setup where an ISO broadcaster will send fragmented
data and get stopped after sending the first fragment and repeating that
operation multiple time to verify that buffers are not leaked.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-08-16 11:20:14 +01:00
Théo Battrel
3a098c9f61 Bluetooth: Host: Unref ISO fragments after disconnection
When sending data using ISO and the data is fragmented, if the
connection is cut before all the fragments are sent, the data buffer
will be leaked.

Fix the issue by unref'ing the buffer when ISO is not in a connected
state.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-08-16 11:20:14 +01:00
Théo Battrel
70696f5b0f Bluetooth: Host: Free ISO TX context
When disconnected while sending data, if ISO doesn't get the number of
completed packets it will not call `process_unack_tx` and thus will leak
TX context.

Fix that by setting the connection state in ISO disconnection which will
trigger a call to `process_unack_tx`.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-08-16 11:20:14 +01:00
Henrik Brix Andersen
69fe9b0c50 net: buf: remove use of special putter and getter functions
Convert users of net_buf_put() and net_buf_get() functions to use
non-wrapped putters and getters k_fifo_put() and k_fifo_get().

Special handling of net_bufs in k_fifos is no longer needed after commit
3d306c181f, since these actions are now
atomic regardless of any net_buf fragments.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2024-08-16 09:55:11 +02:00
Emil Gydesen
9014bb66a6 Bluetooth: Logging: Fix typo Voluem -> Volume
Fix a small typo.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-08-16 09:50:03 +02:00
Luis Ubieda
775cd201c3 bluetooth: host: Add API to get a connection's UATT MTU
Similar to bt_att_get_mtu but only considering the Unenhanced ATT
channel.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-08-15 10:17:13 +01:00
Alberto Escolar Piedras
f5f5937657 subsys/bluetooth: Correct BT_HCI_VS_EXT_DETECT default
native_sim should be treated as native_posix.
Let's fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-08-14 09:14:10 -04:00
Jonathan Rico
73572e4151 Bluetooth: L2CAP: Initialize private channel object members
We own those fields, so we should initialize them before use.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-08-14 10:47:49 +01:00
Vinayak Kariappa Chettimada
85790c95a9 Bluetooth: Controller: Introduce EVENT_MAFS_MIN_US value
Introduce Controller dependent EVENT_MAFS_MIN_US value to
use as the value when populating the aux offset between
Extended Advertising primary and auxiliary channel PDUs.

This can be used as workaround for peers having difficulty
receiving Extended Advertising PDUs with near 300 us MAFS
values used in aux offset calculations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-14 10:46:48 +01:00
Vinayak Kariappa Chettimada
4dbfb22a7e Bluetooth: Controller: Relax radio packet pointer assignment deadline
Relax the radio packet pointer assignment deadline assertion
until access address being transmitted. The PDU buffer is
probably only needed just after access address is being
transmitted or received by the radio. This will give some
more breathing room for slow CPUs like in nRF51x SoCs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-14 10:45:59 +01:00
Vinayak Kariappa Chettimada
642d4be940 Bluetooth: Controller: Fix regression using speed optimization
Fix regression using speed optimization introduced in
commit 1b7fe792e0 ("Bluetooth: Controller: Support Link
Time Optimizations (LTO)").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-08-14 10:45:59 +01:00