Commit graph

9523 commits

Author SHA1 Message Date
Trond Einar Snekvik
85ad497c39 Bluetooth: Mesh: Don't reset PB ADV reliable timer on retransmit
The send_reliable function was reused in multiple places as part of the
k_delayed_work changes for Bluetooth Mesh in #33782. This function
contains a line that resets the start timer, causing prov_retransmit to
continously move the goal post for when to give up sending.

Extract this line out of the send_reliable function, and put it along
with the other link.tx initialization in bearer_ctl_send and
prov_send_adv.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2021-05-19 15:54:20 +03:00
Emil Gydesen
10011fd1de Bluetooth: Audio: Update VOCS conn check return value
Change the return value from -ENOTCONN to -EINVAL as that
is a more appropriate return value for checking a NULL
pointer.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-05-19 07:53:10 -05:00
Emil Gydesen
a9efa14a95 Bluetooth: Audio: Update AICS client conn check return value
Change from -ENOTCONN to -EINVAL as that is a more appropriate
return value for checking a NULL pointer.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-05-19 07:53:10 -05:00
Emil Gydesen
8470fe8cb3 Bluetooth: Audio: Update VCS Client conn check return value
Instead of return -ENOTCONN they will now return -EINVAL as
that is a more appropriate return value for checking if
the pointer is NULL.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-05-19 07:53:10 -05:00
Pavel Vasilyev
1b129c50c2 Bluetooth: Mesh: Remove outated RPL entry from persistent storage
This commit fixes a bug where outdated RPL entries might not be removed
properly from the persistent storage making those entries dead.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2021-05-18 12:29:53 -05:00
Freddie Yang
013008a3ef Bluetooth: Host: Disable BLE scan before setting random address
According to Bluetooth core specification v5.2, if Host set
random address when any of scanning (passive or active), the
Controller shall return the error code Command Disallowed (0x0C).

Signed-off-by: Freddie Yang <freddie.yang325@outlook.com>
2021-05-18 12:29:04 -05:00
Pavel Vasilyev
8717a0f678 Bluetooth: Mesh: Pass correct pointer to publish_sent
This commit fixes a bug where incorrect pointer passed to publish_sent
in access.c caused bus fault.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2021-05-18 11:05:46 +02:00
Trond Einar Snekvik
878043aff1 Bluetooth: Mesh: Change friend_cred decision point to friend selection
The network layer previously decided to use the friend credentials if
there was an established friendship. During the friendship setup phase,
the friendship is not considered established until the LPN receives the
first friend poll. Before this happens, the LPN should send a friend
poll message, encrypted with the friendship credentials. This wrongly
gets encrypted with the master credentials.

Change the decision point to whether the LPN has selected a friend,
which happens after the friend offer, and before the friend poll. This
will remain set for the duration of the friendship.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2021-05-17 13:36:24 +03:00
Pavel Vasilyev
22fabefdf2 Bluetooth: Mesh: Add VA flag to generic pending flags
This adds BT_MESH_SETTINGS_VA_PENDING to GENERIC_PENDING_BITS
as it should be stored by CONFIG_BT_MESH_STORE_TIMEOUT.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2021-05-17 13:23:30 +03:00
Pavel Vasilyev
3ae0f96acb Bluetooth: Mesh: Fix incorrect flag check in mesh settings
This bug was introduced in PR #31176, where setting's flags were
moved out from bt_mesh.flags to pending_flags.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2021-05-17 13:23:30 +03:00
Vinayak Kariappa Chettimada
7897eae2b4 Bluetooth: controller: Fix PPIs use for nRF52805 SoC
Fix regression in PPIs use for nRF52805 SoC, which has
fewer of them. And the regression was introduced in
commit e603b9d59e ("Bluetooth: controller: Adjust PPI
used for nRF51x and nRF52x").

Fixes #35204.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-13 22:05:41 -04:00
René Beckmann
41afd838aa Bluetooth: Crypto: Fix naming of params
The naming and documentation of the parameters was inconsistent with
their actual meaning and the implementation - enc_data and plaintext
were swapped.
Also, the parameter names in the file aes_ccm.c were completely
different from the ones in the header. Since all functions in the
header file are consistent in their parameter naming, I chose to make
the implementation follow the header and not the other way around.

Signed-off-by: René Beckmann <rene.beckmann@grandcentrix.net>
2021-05-12 12:37:27 +03:00
Vinayak Kariappa Chettimada
30f260dfaa Bluetooth: controller: Fix adv/scan context access post release
Fix advertiser and scanning context being accessed on done
event when connection complete node rx that is processed
earlier has release them.

Relates to #30735.
Fixes #35013.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-10 18:19:00 +02:00
Vinayak Kariappa Chettimada
32d9b68944 Bluetooth: controller: Implement LE Set Host Feature Command
Added implementation of HCI LE Set Host Feature command.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-07 15:25:18 +02:00
Vinayak Kariappa Chettimada
ed59ceba62 Bluetooth: controller: Replace use if LL_FEAT with ll_feat_get()
Replace the use of LL_FEAT define with ll_feat_get() so that
feature set value can be updated at runtime with host
feature bit values.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-07 15:25:18 +02:00
Emil Gydesen
82a32f5ca5 Bluetooth: Audio: Volume Control Service and client
This commit implements the volume control service (VCS) and
client, The implementation supports and uses the
Audio Input Control Service (AICS) and
Volume Offset Control Service (VOCS) secondary services.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-05-07 15:02:41 +02:00
Vinayak Kariappa Chettimada
a9e900dbfd Bluetooth: controller: Fix scheduling stall in BT_CTLR_LOW_LAT feature
Fix radio event scheduling stall when using BT_CTLR_LOW_LAT
feature.

Performing a Connection Update Procedure on an ACL
connection while simultaneously having continuous scanning
causes the ACL connection to drop in nRF51 series which uses
BT_CTLR_LOW_LAT by default.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-07 15:02:13 +02:00
Asger Munk Nielsen
29006bd6fb Bluetooth: Controller: ISO adaptation layer
Improves error handling and makes ISO adaptation layer
independent of CIS.

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2021-05-07 13:14:31 +02:00
Vinayak Kariappa Chettimada
7eba8c403d Bluetooth: controller: Add Kconfig for maximum Broadcast ISO PDU length
Added Kconfig option to configure the maximum Broadcast and
Synchronized Receiver ISO PDU length.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-07 13:10:11 +02:00
Thomas Ebert Hansen
5f43fb3463 Bluetooth: controller: Make number of done events vendor configurable
The amount of needed done events changes when using the "must expire"
logic.

Make the amount vendor configurable (via ull_vendor.h)

Defaults to the original amount of 3.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2021-05-07 13:08:27 +02:00
Rubin Gerritsen
98321c61fb bluetooth: host: Allow concurrent advertising with multiple ids
The HCI specification creates additional complexity to allow this
configuration:
 - When a connection gets established, we need to know which
   identity the HCI_LE_Connection_Complete event corresponds to.
 - The identity is a property of the advertising set.
   Therefore we need the advertising handle.
 - The advertising handle is part of the
   HCI_LE_Advertising_Set_Terminated event and is not part of
   the HCI_LE_Connection_Complete event. Therefore
   the information of both events needs to be combined.

By spec the LE_Connection_Complete comes first. Therefore we cache
this event until the identity is available.
The event is only cached when a connection gets established as
that is the only case where we need to resolve the identity.

As the caching requires more resources, it is only enabled if the
application requires multiple advertising sets and multiple
identities.

The host maps the HCI_LE_Advertising_Set_Terminated event with
the HCI_LE_Connection_Complete event by comparing the connection
handles.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2021-05-07 12:15:20 +03:00
Morten Priess
b8aae321a1 Bluetooth: controller: ISO resume ticker in ULL
Added function ull_conn_iso_resume_ticker_start to enable LLL ISO
peripheral/central to start the one-shot resume ticker.
At timeout the common lll_resume handler is called, and based on the
LLL state, the peripheral/central is able to resume the CIG event.

The resume acts exactly like a normal event resume from the prepare
pipeline, with the exception that the LLL must provide specific
lll_event instances.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2021-05-06 13:23:00 -04:00
Vinayak Kariappa Chettimada
03a285b9d5 Bluetooth: controller: Add LE Read Buffer Size v2 support
Add LE Read Buffer Size v2 support in the controller
implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-06 13:22:02 -04:00
Vinayak Kariappa Chettimada
44e9163484 Bluetooth: controller: Add ISO Buffer size Kconfig dependency
Add BT_CTLR_ISO_TX_BUFFER_SIZE depends on Broadcast ISO
and/or Connected ISO feature being enabled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-06 13:22:02 -04:00
Vinayak Kariappa Chettimada
63a68e6ff4 Bluetooth: HCI: Rename LE Read Buffer Size v2 struct members
Rename LE Read Buffer Size v2 struct members to related to
Bluetooth Specification use Length and Number terminology.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-06 13:22:02 -04:00
Vinayak Kariappa Chettimada
8db6941b1a Bluetooth: controller: Minor conditional compile comment correction
Corrected a conditional compile comment and added some
newlines.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-06 13:22:02 -04:00
Vinayak Kariappa Chettimada
ffb3242e4b Bluetooth: controller: Accumulate latency on aborting event in pipeline
Only accumulate latency when event has not been prepared but
has been aborted while being enqueued in pipeline.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-06 19:13:31 +02:00
Pavel Vasilyev
a335c755a7 Bluetooth: Mesh: Add option to include bt name in scan rsp
Sometimes it may be needed to know device name when proxy feature is
enabled.

This commit adds an option to include device name in scan response.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2021-05-06 19:20:00 +03:00
Piotr Pryga
ce56f046e5 bluetooth: Fix cte_type value in periodic adv sync report
Periodic advertising sync report returned wrong cte_type value.
This commit fixes the problem.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
7cdbeb541a Bluetooth: controller: Use common mem_link_rx for node_rx_iq_report
Change use of dedicated memory pool for linked list nodes for
node_rx_iq_report to common mem_link_rx. Former solution had
a drawback. Released link nodes may be enqueued to wrong memory
pool. E.g. link related with nopde_rx_iq_report went to common
link memory pool, whereas link nodes from common pool were enqueued
to dedicated list.
The solution was working because links have the same memory layout,
just different memory pools they originated from.
The problem may occur if one of those link memory pools is reset.
Then the same link may be used by node_rx and node_rx_iq_report
at the same time, causing controller failure.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
938f04ffaa Bluetooth: controller: Fix build error for non Nordic plaforms
Direction finding is implemented only for Nordic link layer.
Build was failing due to missing header files for Openisa (RiskV).
Added dummy lll_df_types.h header file to OpenISA lower link layer.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
7c834bf19d Bluetooth: host: Add handl HCI_LE_Connectionless_IQ_Report
Add handling for HCI_LE_Connectionless_IQ_Report received
from controller.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
64c359bcef Bluetoot: host: Make get_per_adv_sync to be global function
The function get_per_adv_sync is used by HCI events to get
reference to periodic advertising sync object related with
handle available in handled events. Due to implementation
of Direction Finding event handlers in separate source file,
direction.c instead of putting in hci_core.c the function
get_per_adv_sync has to be globally accessible.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
6518621805 Bluetooth: host: Add CTE receive and sample enable API
Add functions that give possibility to enable or disable
CTE receive and sample in connectionless mode.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
b48fe0a7db Bluetooth: host: Add option to enable connectionless CTE RX
Add Kconfig option that will enable supprot for connectionless
CTE reception. Thanks to that it will be possible to conditionally
enable or disable support of the feature and decrease code size
if the feature is not required.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
ca87766bd7 Bluetooth: controller: df: Set BT_CTLR_DF_ANT_SWITCH_RX enable
Set BT_CTLR_DF_ANT_SWITCH_RX enabled by default.
There is already added implementation that supports
this feature in controller, so it may be enabled by
default.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
4009692fcf Bluetooth: controller: Add connectionless CTE RX feat. in supp. feat. list
Add connectionless CTE RX feature to list of features supported
by controller. Add direction finding initialization in hci_core
if the feature is enabled.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
f74a0b294c Bluetooth: controller: Dropp IQ sampl report if CTE disabled after evt end
Disable of CTE sampling for periodic advertising sync PDUs may be
interrupted by radio event. In such situation, TX thread will be
handled before RX thread delivers IQ samples report to host. In
this case RX thread would deliver IQ samples report after CTE
sampling was disabled.

To avoid such situation RX thread has to check if:
- CTE sampling is not disabled,
- CTE sampling was not requested to be disabled after start of radio
  event.

CTE sampling configuration is double buffered. Updated configuration is
swapped at the beginning of radio event.

If CTE sampling is diabled or requested to disable (next radio event
didn't start), the IQ samples report should be dropped by RX thread
and should not be delivered to host.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
6652b18d19 Bluetooth: controller: LLL: Add CTE report for per. adv. PDU with bad CRC
Add reporing of IQ samples collected for CTE attached to periodic
advertising PDUs with bad CRC.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
e884c02d92 Bluetooth: controller: Add opt. to enable CTE samplig for PDUs with bad CRC
Add Kconfig option that will enable possiblity to sample CTE attached to
PDUs that have bard CRC. Sampling is based on CTEInfo field available
in received PDU. If radio is able to parse the field correclty then
it will start sampling even the CRC is wrong.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
17d9df1c7a Bluetooth: controller: hci: Add connectionless IQ report event handler
Add handler for HCI_LE_Connection_IQ_Report event.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
582ca85e29 Bluetooth: controller: hci: Add connectionelss IQ samplig enable handler
Add handler for HCI_LE_Set_Connectionless_IQ_Sampling_Enable HCI
command.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
ff24092bdd Bluetooth: controller: ULL: Add function to enable or disable CTE sampling
Add function that enables or disables CTE sampling attached to received
periodic advertising PDUs.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
b7c1c4575d Bluetooth: controller: LLL: Add CTE sampling and reporting
ULL may request LLL to start receiving and sampling CTE attached to
end of periodic advertising PDUs. When the CTE is successfully sampled,
LLL should report collected samples to ULL.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
edfb85736e Bluetooth: controller: radio: Add function to get CTEInfo from Radio reg
Nordic Radio perihperal provides possiblity to get value of CTEInfo
field parsed from received PDU. It is faster to get the information
from Radio register than parse a PDU content.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
646303834c Bluetooth: controller: LLL: DF: Add function to enable CTE receive
Add function to enable CTE receive and sampling. The function
is aimed to be used by code in lll_sync.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
d182b7169a Bluetooth: controller: Add function to update per sync event slot duration
To enable or disable CTE sampling during periodic advertising sync evnet
it is requireq to change the event duration. To make it possible new
function was added that handles the operation.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
871359d934 Bluetooth: controller: ULL: Add init of DF sync configuration
lll_sync object is used to store information for LLL to enable
or disable CTE sampling. The commit adds initialization of
lll_df_sync member of lll_sync.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
37dd38c988 Bluetooth: controller: LLL: Add DF configuration to lll_sync structure.
To enable or disable CTE sampling in periodic advertising scanner LLL
implementation lll_sync is extended by lll_df_sync member.
The lll_df_sync is a double buffer for lll_df_sync_cfg.
It will be used by LL thread to enable or disable CTE sampling and
provide configuration for sampling CTE in AoA mode.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
2f4e014f14 Bluetooth: controller: ULL: Add node_rx_iq_report handling in ULL RX path
Add handling of Direction Finding node_rx_iq_report type in ULL.
This is required to correctly deliver IQ samples collected by
LLL during receive of PDU including CTE.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00