Commit graph

9523 commits

Author SHA1 Message Date
Emil Gydesen
c938c81575 Bluetooth: Audio: VCS client use auto CCC discovery
Update the VCS client to use the auto CCC discovery
feature instead of expecting it to be a specific place
in the remote server's GATT database.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-28 20:12:55 -04:00
Emil Gydesen
5a11a19713 Bluetooth: Iso: Add BT_ISO_SDU_BUF_SIZE macro
Add the BT_ISO_SDU_BUF_SIZE which can be used to declare
the TX buffers for ISO, similar to the BT_L2CAP_SDU_BUF_SIZE
macro for L2CAP.

This also updates the ISO samples to use this as well
updating the SDU check to use
CONFIG_BT_ISO_TX_MTU/CONFIG_BT_ISO_RX_MTU without
subtracting the BT_ISO_CHAN_SEND_RESERVE to make the
API more clear.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-28 20:07:32 -04:00
Emil Gydesen
49b36f4e79 Bluetooth: iso: Handle broadcast iso data path failure
Handle the case that setting up the iso data path for a
broadcast (sink or source) bis fails.

As part of this fix, implement the lookup_big_by_handle
function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-28 20:03:39 -04:00
Lingao Meng
5ddbdcedd0 Bluetooth: Mesh: Move proxy message size to kconfig
Add `BT_MESH_PROXY_MSG_LEN` to config proxy message length

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-28 19:57:15 -04:00
Lingao Meng
4fcf549607 Bluetooth: Mesh: Use common buf size for all conn
Use common buffer size for all bluetooth mesh connection.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-28 19:57:15 -04:00
Lingao Meng
355b18c43e Bluetooth: Mesh: Add seperate config for pb-gatt dev name
Add seperate config to control whether device name include in
pb-gatt advertising scan response data.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-28 19:57:15 -04:00
Lingao Meng
3f68692069 Bluetooth: Mesh: Reflact disconnect logic to separate roles
remove section ordering to use code more readable.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-28 19:57:15 -04:00
Lingao Meng
22b234cf03 Bluetooth: Mesh: Move bt_mesh_proxy_role to proxy_msg.c
Mesh bt_mesh_proxy_role structure to proxy_msg.c

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-28 19:57:15 -04:00
Lingao Meng
bc1d6580dc Bluetooth: Mesh: Move proxy complete message to seperate role
Move proxy complete message to seperate role.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-28 19:57:15 -04:00
Lingao Meng
d831d8a7d3 Bluetooth: Mesh: Move command buffer to proxy_msg.c
Move command buffer alloc to proxy_msg.c.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-28 19:57:15 -04:00
Lingao Meng
a88aac2a7f Bluetooth: Mesh: Remove unnecessary prov buf get function
Remove `bt_mesh_pb_gatt_get_buf`.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-28 19:57:15 -04:00
Lingao Meng
c057a69a2c Bluetooth: Mesh: Rename bt_mesh_pb_gatt<*> function
Rename bt_mesh_pb_gatt_<*> function, and split from proxy.h

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-28 19:57:15 -04:00
Lingao Meng
b2889903a3 Bluetooth: Mesh: Split gatt services to pb-gatt and proxy
Split gatt services to pb-gatt-srv and proxy-srv.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-28 19:57:15 -04:00
Lingao Meng
412e7da951 Bluetooth: Mesh: Delete bt_mesh_proxy_prov_disable parameter.
we will no longer need the additional `disconnect` parameter,
such as we only process gatt database from disconnect handler.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-28 19:57:15 -04:00
Aleksandr Khromykh
6f2516d9a7 Bluetooth: Mesh: Refactoring provisioning to make all OOB auth working
The current implementation has hidden dependencies that break
OOB authentication if provisioner does not have the configured
input or output fields used for device capabilities.
It didn't allow to pass several OOB authentication cases.
After refactoring provisioner behavior is independent to
provisionee settings.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2021-09-28 19:54:00 -04:00
Vinayak Kariappa Chettimada
1ea0fabe72 Bluetooth: Controller: Fix BT_CTLR_FAST_ENC Kconfig help text
Fix BT_CTLR_FAST_ENC Kconfig help text to reflect the
current Encryption Setup Procedure behavior.

With the split architecture, Encryption Setup Procedure
will take 4 connection events when BT_CTLR_FAST_ENC is
enabled, in comparison to 3 connection events in the
legacy Controller architecture. This is due to split
architecture processes control procedures in the lower
priority Upper Linker Layer execution context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-28 15:39:55 +02:00
Pavel Vasilyev
e40998a4e4 Bluetooth: Mesh: Return ETIMEDOUT if k_sem_take call times out
EAGAIN is used in some other places in the code, e.g. if node is not
provisioned when a model tries to send a message. This change helps to
differentiated if the acknowledged message timed out from other failers.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2021-09-28 11:49:27 +02:00
Vinayak Kariappa Chettimada
f07763640e Bluetooth: Controller: Fix multiple peripheral connection deadlock
Fix deadlock in multiple peripheral connection in a device
due to redundant double reservation of node rx buffer during
crossover scenario in Data Length Update procedure.

Data Length Update resize state was reset back to response
wait state when peripheral received an acknowledgment to
local initiated Data Length Request PDU after having already
transitioned to resize state.

Implementation is designed to transition to resize state
under both Data Length Response reception and crossover
scenario of Data Length Request reception when procedure is
local initiated.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-28 11:38:16 +02:00
Joakim Andersson
284238339b Bluetooth: host: compile out check for multiple identities
Add check that can be removed by the compiler since the rest is only
needed when multiple identities have been enabled.

Fixes: #38134

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-09-27 22:27:18 -04:00
Emil Gydesen
623aaa136b Bluetooth: ISO: Remove bt_conn_unref for ISO deferred work
Removed the bt_conn_unref from the deferred_work function.
For ISO, the conn unref for the peripheral will happen in
the bt_iso_disconnected function. For the central, the
unref shall only happen when the CIG is terminated.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-27 22:24:23 -04:00
Joakim Andersson
dd0bf5c20b Bluetooth: shell: Log failure to register authentication handlers
Log failure to register authentication handlers since returning errors
from the shell is not visible to the user.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-09-27 19:47:50 +02:00
Joakim Andersson
0207e86e38 Bluetooth: shell: Handle return value of GATT service register functions
Handle return value of GATT service register and unregister functions.
Log action to shell.

Fixes: #38013

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-09-27 19:47:50 +02:00
Joakim Andersson
b08e5725ef Bluetooth: host: check return value of bt_rand when creating identities
Check the return value of bt_rand when creating identities.
Failure to generate a random IRK would result in the privacy feature
being compromised.

Fixes: #38120

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-09-27 17:14:20 +02:00
Joakim Andersson
884ebbbb9e Bluetooth: host: Fix unexpected control flow
Fix unexpected control flow in host keys module. A continue in a do
while false act the same as a break. This entire construct can be
replaced with a simple if else control flow.

Fixes: #38014

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-09-27 16:35:54 +02:00
Joakim Andersson
3a8190a194 Bluetooth: SDP: Check len is not zero before accessing data pointer
Check len is not zero before accessing data pointer, the len variable
is not checked before this point so cannot be trusted to not be zero.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-09-27 16:34:22 +02:00
Jamie McCrae
285a0737a3 Bluetooth: host: Fix non-extended adverts not being limited to 31 bytes
Fixes an issue whereby the application is configured for extended
advertising mode but advertises in legacy mode with a large device name
which should be limited to 31 bytes

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-09-27 10:10:00 -04:00
Joakim Andersson
05755df9c1 Bluetooth: host: Ignore return value of change-aware when reading DBhash
Ignore the return value of the bt_gatt_change_aware function when the
client is reading the database hash characteristic value. This is the
point where the client becomes change-aware, so nothing else should be
done if the client is change-unaware.

Fixes: #38012

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-09-27 08:23:17 -04:00
Szymon Janc
6440c9eb51 bluetooth: host: Fix legacy SMP pairing
This is a regression introduced in b8770acc28 when
aligning with BT Core Spec 5.3 naming convention.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-09-27 08:13:48 -04:00
Piotr Pryga
2637c0ed22 Bluetooth: controller: Fix compilation error due to missing includes
When CONFIG_ARM_MPU is explicitly unset in application prj.conf there
were build warnings related with implicit declarations of following
symbols: NRF_DT_GPIOS_TO_PSEL, __WFE, __SEV.
Lack of NRF_DT_GPIOS_TO_PSEL lead to build error due to undeclared
dfegpio0_gpios symbol.

The cause for the warnings and error were missing soc.h includes in
few source files. The missing includes were added in this commit.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-09-24 09:20:38 -04:00
Eric Johnson
83dd1d0a87 bluetooth: host: conn: Fix conn param during l2cap fallback
When falling back to L2CAP for connection parameter updates, the
interval min and maxes should also be saved.

Fixes #38613.

Signed-off-by: Eric Johnson <eric@liveathos.com>
2021-09-23 10:04:31 +02:00
Morten Priess
eb218a5405 Bluetooth: controller: Prevent multiple ticker_stop in cis_disabled_cb
When calling ull_conn_iso_cis_stop with no pending LLL events,
cis_disabled_cb may be called recursively if more than one CIS is
associated with a disconnecting ACL connection.

To prevent ticker_stop being called more than once, it shall be
registered at entry of cis_disabled_cb whether this is the last CIS.
Only then shall ticker_stop be called.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2021-09-21 12:52:15 -04:00
Vinayak Kariappa Chettimada
f3a0ae0cbc Bluetooth: Controller: Fix CIS LLL events pending check
CIS LLL events pending was checked incorrectly using a
mayfly incorrect set to be called from ULL LOW context,
but the actual call was from ULL HIGH context.

Beside this, the code was refactored to have file static
functions after global scope functions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-21 12:52:15 -04:00
Carles Cufi
4801cbd921 Bluetooth: controller: Replace {m_,s_} with {c_,p_}
Replace the old master and slave prefixes with the new central and
peripehral ones from the Bluetooth spec v5.3.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-09-21 13:01:29 +02:00
Carles Cufi
947b38ac0a Bluetooth: controller: Replace slave with peripheral
Replace the old slave term with the new peripheral
one from the Bluetooth spec v5.3.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-09-21 13:01:29 +02:00
Carles Cufi
ba2d2ee936 Bluetooth: controller: Replace master with central
Replace the old master term with the new central one
from the Bluetooth spec v5.3.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-09-21 13:01:29 +02:00
Carles Cufi
40e7f5cd73 Bluetooth: controller: Fix coding guidelines violation
Avoid using "free" since it's a reserved identifier, switch to
"free_idx".

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-09-21 13:01:29 +02:00
Carles Cufi
76bf881e42 Bluetooth: controller: Replace whitelist with FAL
Replace the old whitelist-related terms with the new filter accept list
one from the Bluetooth spec v5.3.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-09-21 13:01:29 +02:00
Carles Cufi
b8770acc28 Bluetooth: host: Align with terms in v5.3 spec
Align with the new inclusive naming terms in the v5.3 spec in the
Bluetooth Host implementation.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-09-20 20:01:32 +02:00
Carles Cufi
1821d342c2 Bluetooth: shell: Align with terms in v5.3 spec
Align with the new inclusive naming terms in the v5.3 spec in the
Bluetooth shell implementation.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-09-20 20:01:32 +02:00
Carles Cufi
3b33ba2320 Bluetooth: shell: Avoid reusing the same label
To avoid hitting the following violation:
Violation to rule 5.7 (Tag name should be unique)

Replace the use of "shell" in the shell as an instance of a pointer to
const struct shell.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-09-20 20:01:32 +02:00
Carles Cufi
f1dff28854 Bluetooth: controller: hci: Align to terms in the v5.3 spec
Align with the new inclusive naming terms in the v5.3 spec in the
controller's HCI implementation.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-09-20 20:01:32 +02:00
Vinayak Kariappa Chettimada
a9a01d4cb7 Bluetooth: Controller: Fix missing reset of Periodic Sync Create
Fix missing reset of Periodic Sync Create when HCI Reset is
performed.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-20 12:26:51 +02:00
Vinayak Kariappa Chettimada
29ae143a10 Bluetooth: Controller: Refactor out initiator reset
Refactor out the initiator reset implementation into a
function.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-20 12:26:51 +02:00
Emil Gydesen
bcc819028f Bluetooth: ISO: Add ISO tx callback struct array
Add an array similar to the bt_conn (ACL/L2CAP)
tx sent callback, and initialize it.

This increases the number of bt_conn_tx available
such that ISO does not take any of "L2CAP's" buffers,
but also ensures that the sent callback is called
for a broadcast iso only build.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-18 06:30:07 -04:00
Carles Cufi
1325edff48 Bluetooth: hci: Align terms with the Bluetooth v5.3 spec
The new inclusive naming terminology changes in v5.3 of the Bluetooth
specification affect the HCI layer, so apply all relevant changes to
align with it.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-09-17 16:05:01 +02:00
Vinayak Kariappa Chettimada
417647f057 Bluetooth: Controller: Fix extended header data be zero-length array
Fix the definiion of Common Extended Payload Format data
field in the PDU definitions to be zero-length array,
because PDU size are configurable and to avoid allocations
being made using these PDU structs.

Corrected the extended scan response length check code to
use the correct define instead.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-17 14:30:27 +02:00
Vinayak Kariappa Chettimada
14b369eda8 Bluetooth: Controller: Fix to use ticks_drift for duration calculation
Fix Extended Advertising stop on duration by using the
ticks_drift which now includes the random delay and any
ticker rescheduling of advertising radio events due to
collision with other radio events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-17 14:30:07 +02:00
Vinayak Kariappa Chettimada
19fe102862 Bluetooth: Controller: Propagate ticks_drift in the ticker callback
The ticker `ticks_drift` is propagated via the ticker
elapsed callback, in order to provide necessary information
to correctly calculate total elapsed durations by states and
roles that use ticker extensions to mitigate scheduling
collisions by drifting within a permitted window.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-17 14:30:07 +02:00
Vinayak Kariappa Chettimada
b01b5f6786 Bluetooth: Controller: Fix indentation in ticker interface file
Fix indentations in the ticker interface file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-17 14:30:07 +02:00
Lingao Meng
c4fbc5bb20 Bluetooth: host: Fix hci command done
When received hci command rsp which not for expected
hci command, we should ignore this.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-09-16 21:29:09 +03:00