Commit graph

9523 commits

Author SHA1 Message Date
Andrzej Kaczmarek
b08a0bd8a7 Bluetooth: controller: Fix LE Set Ext Scan Rsp Data restrictions
This fixes restrictions for setting/discarding scan response data to
mach spec.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-11-11 13:20:40 +01:00
Vinayak Kariappa Chettimada
701d524143 Bluetooth: controller: Fix memory alignment of PDU buffer reference
Align the PDU buffer reference in struct node_rx_pdu so that
node rx type specific parameters, like, terminate and sync
lost reason can be accessed without any memory alignment
issues.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-11 13:20:33 +01:00
Vinayak Kariappa Chettimada
d7d8ae7894 Bluetooth: controller: Use connection complete variable naming
Use the connection complete varaible naming to access
connection complete parameters.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-11 13:20:33 +01:00
Vinayak Kariappa Chettimada
a5b489e2fa Bluetooth: controller: Make conn cancel and sync cancel impl. consistent
Make the connection cancel and periodic advertising sync
create cancel implementation consistent.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-11 13:20:33 +01:00
Vinayak Kariappa Chettimada
92b2591558 Bluetooth: controller: Fix missing storage for sync cancel reason
Fix missing storage allocation in ll_sync_set structure for
storing the sync cancel reason.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-11 13:20:33 +01:00
Vinayak Kariappa Chettimada
be090f7b33 Bluetooth: controller: Fix maximum AC PDU payload size calcuation
Fix maximum Advertising Channel PDU payload size calculation
by including the Common Extended Advertising Payload Format
overload alongwith the AD data maximum size supported.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-11 12:28:05 +01:00
Vinayak Kariappa Chettimada
f677144f30 Bluetooth: controller: Remove unused defined in pdu.h file
Remove used constant macro defined in pdu.h file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-11 12:28:05 +01:00
Vinayak Kariappa Chettimada
09c5035359 Bluetooth: controller: Added comments related to AD data double buffering
Added inline comments explaining the implementation of AD
data PDU double buffering.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-11 12:28:05 +01:00
Vinayak Kariappa Chettimada
22ec1acacc Bluetooth: controller: Minor move code closer to locality of reference
Minor change to move code closer to locality of reference.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-11 12:28:05 +01:00
Vinayak Kariappa Chettimada
c842eef3ae Bluetooth: controller: Add semaphore to indicate free AD data buffers
Add semaphore implementation to indicate and wait for free
AD data buffers.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-11 12:28:05 +01:00
Vinayak Kariappa Chettimada
dc02ebf5ed Bluetooth: controller: Release AD data on advertising set remove
Add implementation to release AD data PDU buffers on
advertising set remove.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-11 12:28:05 +01:00
Vinayak Kariappa Chettimada
5b396aaafb Bluetooth: controller: Use mfifo to return stale AD data PDU
Added implementation using mfifo to return stale AD data PDU
from LLL to Thread context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-11 12:28:05 +01:00
Vinayak Kariappa Chettimada
2be0d07543 Bluetooth: controller: Add Max. AD data buffers Kconfig option
Add Kconfig option to configure maximum number of buffered
AD data PDUs across enabled advertising sets.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-11 12:28:05 +01:00
Vinayak Kariappa Chettimada
c2fc629dd2 Bluetooth: controller: 255 byte AD payload support
Add 255 byte AD payload support.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-11 12:28:05 +01:00
Wolfgang Puffitsch
f68d7863e5 Bluetooth: controller: Create HCI stubs for CIG/CIS creation and removal
Put infrastructure for the following HCI commands/events in place:
* LE Set CIG Parameters command
* LE Remove CIG command
* LE Create CIS command
* LE Accept CIS Request command
* LE Reject CIS Request command
* LE CIS Established event
* LE CIS Request event

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2020-11-10 13:19:08 +01:00
Wolfgang Puffitsch
e5356595ca Bluetooth: controller: Introduce Kconfig options for CIS central/peripheral
Add Kconfig options to enable Connected Isochronous Stream central and
peripheral roles.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2020-11-10 13:19:08 +01:00
Jordan Yates
ffab099eb9 Bluetooth: add destroy callback to indication
Adds a `destroy` callback to the `struct bt_gatt_indicate_params` which
is used to signify to the application that the indication operation has
completed and the struct instance can be freed/destroyed.

This is required as the number of indication value callbacks that will
be triggered is not known by the caller when the `conn` parameter is
`NULL`.

Tracking when this callback should be run is mananged by a private
reference counter inside the struct.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-11-10 11:21:46 +01:00
Jordan Yates
170f17e0e7 Bluetooth: indication callback signature update
Update the signature of the `bt_gatt_indicate_func_t` callback type by
replacing the attr pointer with a pointer to the
`bt_gatt_indicate_params` struct that was used to start the indication.

This allows the callback to free the `bt_gatt_indicate_params` instance
if it was allocated from storage, while still allowing the
`bt_gatt_attr` value to be accessed through `params->attr`.

Allocating the `bt_gatt_indicate_params` instance from storage is
desirable as multiple indications can be queued, however each instance
must be valid until the callback is run.

Implements API update from #29357

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-11-10 11:21:46 +01:00
Joakim Andersson
f8956cfbc7 Bluetooth: L2CAP: Enable L2CAP dynamic channels without Enhanced CBFC
Allow application to enable L2CAP dynamic channels without support
for Enhanced Credit Based Flow Control (CBFC).

Since these are separate features in the qualification it should
be possible to qualify L2CAP connection oriented channels without
also having to qualify L2CAP enhanced credit based flow control.

The L2CAP/LE/REJ/BI-02-C conformance test will fail when enhanced CBFC
has not been selected in the ICS.

The lower tester expects that since the Enhanced CBFC is not supported,
the command L2CAP_CREDIT_BASED_CONNECTION_REQ should be met with an
L2CAP_COMMAND_REJECT_RSP and not an L2CAP_CREDIT_BASED_CONNECTION_RSP.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-11-09 11:25:10 +01:00
Trond Einar Snekvik
ad2fd44d7a Bluetooth: Mesh: Encapsulate feature config
Moves mesh feature configuration to a separate module, deprecating the
bt_mesh_cfg_srv structure. The initial values for the features should
now be enabled through KConfig, where new config entries have been added
for each feature.

This removes the upward dependency on the config server from the core
stack, and makes the config server a pure frontend for the configuration
states, as all spec mandated behavior around the feature states is now
encapsulated.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-11-09 11:23:34 +02:00
Trond Einar Snekvik
0dc9e5cd96 Bluetooth: Mesh: Move heartbeat to separate module
Encapsulates the Heartbeat state and functionality in a separate
heartbeat module, removing all manipulation of the heartbeat state from
the transport and config server modules.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-11-09 11:23:34 +02:00
Trond Einar Snekvik
b20a44ded8 Bluetooth: controller: Silence unused variable warning with non-AE
Places definition of lll under the ADV_EXT #ifdef in lll_adv.c:isr_tx,
to silence build warnings for non-AE builds.

Follow-up from #29753.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-11-05 11:10:22 -06:00
Andrzej Kaczmarek
dd5e9c4da1 Bluetooth: controller: Add common def for max AD size on legacy
This def can be used instead of hardcoding "31" everywhere.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-11-05 12:17:16 +01:00
Andrzej Kaczmarek
5166426940 Bluetooth: controller: Fix timings for non-1M PHY on advertising
We need to use actual phy wherever required to make sure radio delays
are calculated properly. This is especially important for LE Coded
since delays for that phy are significantly higher than on 1M and 2M.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-11-05 12:17:16 +01:00
Andrzej Kaczmarek
1df5897679 Bluetooth: controller: Verify AD length for legacy adv
We should not allow setting more than 31 bytes of AD on legacy
instances.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-11-05 12:17:16 +01:00
Andrzej Kaczmarek
5aab391f4b Bluetooth: controller: Update HCI supported cmds with ext adv
Return proper bitmask of supported commands when extended advertising
enabled.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-11-05 12:17:16 +01:00
Andrzej Kaczmarek
f2de6931de Bluetooth: controller: Remove redundant check
ull_adv_data_set() is only used for legacy advertising data (either via
legacy HCI command or as fallback for extended advertising set which
uses legacy PDUs) so there is no need to check for extended advertising.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-11-05 12:17:16 +01:00
Andrzej Kaczmarek
aec809e75e Bluetooth: controller: Remove redundant check
We handle secondary channel only for extended advertising sets, that
means we always have ADV_EXT_IND on primary channel so there is no need
to support non-ext PDUs here.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-11-05 12:17:16 +01:00
Trond Einar Snekvik
86c793af3f sys: util: Replace MIN(MAX(a, b), c) with CLAMP
Replaces all existing variants of value clamping with the MIN and MAX
macros with the CLAMP macro.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-11-05 12:12:17 +01:00
Trond Einar Snekvik
2fb56ba74d Bluetooth: Mesh: Account for ASZMIC in encrypt
The decision to set aszmic = 1 in the net_tx structure was made after
the variable was passed to the crypto context, creating a discrepancy
between the two when aszmic is 1.

Extracts transport encryption to a separate function.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-11-03 16:04:30 +02:00
Emil Gydesen
b0a99051f5 Bluetooth: shell: Avoid registering PA sync callbacks more than once
The PA sync callbacks would have been registered for each new
PA sync, which would cause the callbacks to be called multiple times
if multiple PA syncs were created.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-11-03 11:04:07 +01:00
Emil Gydesen
12ceb6c195 Bluetooth: host: Handle PA sync cancel event
The sync established event caused by a cancel by the host
was not properly handled. When cancelling the sync established
event is created, and the sync object should not be deleted
before that event is received.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-11-03 11:04:07 +01:00
Lingao Meng
5efe6ff887 Bluetooth: Mesh: Fix set friend_cred flag incorrectly
Only set friend_cred to true when friendship established and
use friend cred security material decryption successfully.

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-11-02 12:47:36 +02:00
Trond Einar Snekvik
a878b36af0 Bluetooth: Mesh: Permit model walk from any model
Fixes bug where applications that disable model extensions end up in an
infinite loop, and adds support for walking model subtrees, as opposed
to forcing root to be unextended.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-11-02 12:46:45 +02:00
Vinayak Kariappa Chettimada
84096455ad Bluetooth: controller: Adv set terminated event on Directed Adv timeout
Add generation of Advertising Set Terminated event on High
Duty Cycle Directed Advertising Timeout.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-30 15:55:57 +01:00
Vinayak Kariappa Chettimada
ad348337a5 Bluetooth: controller: Reduce use of ARG_UNUSED on auto variables
Reduce the use of ARG_UNUSED on auto variables and try to
use conditional compilation where appropriate.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-30 15:54:56 +01:00
Michał Narajowski
3908638bab Bluetooth: Mesh: Fix model tree walk procedure
`bt_mesh_model_tree_walk()` was too simplistic and did not track visited
nodes which caused it to fall into infinite loop. Moreover the double
next jump could skip a level causing depth value to be invalid.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2020-10-30 16:27:20 +02:00
Lingao Meng
0bcd66ac36 Bluetooth: Mesh: Fix build warning with Warray-bounds
../zephyrNew/subsys/bluetooth/mesh/prov.c: In function
'bt_mesh_prov_reset_state': ../zephyrNew/subsys/bluetooth/mesh
/prov.c:61:2⚠️ '__builtin_memset' offset [52, 292] from
the object at 'bt_mesh_prov_link' is out of the bounds of referenced
subobject 'dhkey' with type 'uint8_t[32]' {aka 'unsigned char[32]'}
at offset 19 [-Warray-bounds] 61 | memset(&bt_mesh_prov_link.dhkey, 0,

Fixes: #29634

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-10-30 10:59:55 +02:00
Luiz Augusto von Dentz
09e95a26a4 Bluetooth: ISO: Fix crash when channel has already been disconnected
If chan->conn is already NULL do not call bt_conn_unref as that will
likely cause a crash, also this make sure that if channel has been
disconnected using bt_iso_chan_disconnect it removes the channel from
connection list before setting the chan->conn to NULL.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-10-29 20:34:55 +02:00
Joakim Andersson
92deb9ddba Bluetooth: host: Document and check for disallowed directed advertising
Document and validate advertising parameters for the disallowed
advertising mode high duty cycle directed connectable advertising
using extended advertising PDUs.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-29 16:02:57 +02:00
Vinayak Kariappa Chettimada
f8889c1d87 Bluetooth: controller: Fix unused variable compiler warning
Fix unused variable compiler warning with asserts disabled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-29 14:31:38 +02:00
Joakim Andersson
5e999a3081 Bluetooth: ATT: Handle encrypt change event unrelated to current req
Fix issue where the encrypt change has an error code, but the
encrypt change request was unrelated to the current ATT request.

This lead to the current ATT transaction being interpreted as finished
an the ATT client would proceed with the next ATT request, which would
fail since the ATT client is now violating the ATT single transaction
rule.

Updated similar if statement checking for the opposite to improve
readability.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-29 14:28:40 +02:00
Lingao Meng
627ee1125b Bluetooth: Mesh: Remove bt_mesh_net_start
Move `bt_mesh_net_start` functionality to `bt_mesh_start`.

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-10-29 14:17:09 +02:00
Trond Einar Snekvik
af5bd00d1c Bluetooth: Mesh: Move labels to transport
Moves the virtual address labels to the transport layer, disconnecting
them from the configuration server.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-10-29 14:14:43 +02:00
YanBiao Hao
c9be68532c Bluetooth: Mesh: Add Config Client API
The api is used to reset a node (other than a Provisioner) and
remove it from the network

Signed-off-by: YanBiao Hao <haoyanbiao@xiaomi.com>
2020-10-29 14:13:36 +02:00
Lingao Meng
1e9bd13c99 Bluetooth: Mesh: Fixes Relay to frnd_cred message
If low power node publish with unicast address other
than friend address, the friend node should relayed
this message to all network interface.

When Proxy feature enabled, message from gatt bearer should
relay to adv bearer even relay feature disabled.

Fixes: #29544

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-10-29 14:07:58 +02:00
Lingao Meng
5374245dd6 Bluetooth: Mesh: split prov.c into two separate modules
Currently all provisioning procedure into common source
files call `prov.c`, that will not compile separately.

Add `BT_MESH_NODE` to control whether nodes are supported
and device provisioning is supported, this will be used in
provisioner role.

Add more provisioner OOB authentication method.

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-10-28 12:53:09 +02:00
Vinayak Kariappa Chettimada
b3c9565891 Bluetooth: controller: Remove redundant condition compile
Remove a redundant condition compile.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-26 17:40:08 +01:00
Vinayak Kariappa Chettimada
c74438cdfa Bluetooth: controller: Fix arguments unused without Extended Scanning
Fix arguments unused when not enabling Extended Scanning
which was introduced in
commit 0cef1e43c9 ("Bluetooth: controller: Extended
Scanning Coded PHY duration and period").

Fixes #29442.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-26 17:40:08 +01:00
Joakim Andersson
999a91e30d Bluetooth: host: Fix application conn param update not started
Fix application conn param update submitted before the timeout of
CONFIG_BT_CONN_PARAM_UPDATE has expired being ignored when
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-26 16:16:35 +02:00