Commit graph

1155 commits

Author SHA1 Message Date
Cristi Caciuloiu 2a2f84256c bluetooth: controller: openisa: encryption and decryption using CAUv3
Created unit tests for the encryption and decryption functions.
Tested with the peripheral and with central_hr samples.
Due to latency of CAUv3 when used as CCM inline accelerator
only one of the PDU can be encrypted/decrypted within an
bilateral exchange M->S + S->M in a connection event.
If the RXed PDU is encrypted, the TXed PDU must be empty
with More Data if there is data in the LLL queue.
The TXed PDU will be encrypted when an empty PDU is RXed.

Signed-off-by: Cristi Caciuloiu <cristian.caciuloiu@nxp.com>
2020-02-18 12:34:27 +02:00
Vinayak Kariappa Chettimada 23c5003d12 Bluetooth: controller: split: Fix regression in privacy port
Fix regression due to addition of conditional compilations
while porting the privacy feature from legacy to split
controller.

Fixes #22801.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-02-14 18:21:16 +01:00
Andries Kruithof 82a6208b40 Bluetooth: controller: split: fix HCI read_max_data_len
In the function le_read_max_data_len the rx-component is not set.
This PR fixes this

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-02-12 14:37:09 +02:00
Vinayak Kariappa Chettimada 8a3a4bb589 Bluetooth: controller: split: Fix PHY update tx pause
Data transmission was paused when PHY update request control
PDU was enqueued in ULL. If there was pending data PDU in
ULL that was not enqueued towards LLL, this caused
transmission to stall.

Move the tx pause due to PHY update request/response being
enqueued to pre_tx_ack callback, this way all pending PDUs
in ULL is enqueued to LLL.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-02-10 10:22:42 +01:00
Andrew Boie efc5fe07a2 kernel: overhaul unused stack measurement
The existing stack_analyze APIs had some problems:

1. Not properly namespaced
2. Accepted the stack object as a parameter, yet the stack object
   does not contain the necessary information to get the associated
   buffer region, the thread object is needed for this
3. Caused a crash on certain platforms that do not allow inspection
   of unused stack space for the currently running thread
4. No user mode access
5. Separately passed in thread name

We deprecate these functions and add a new API
k_thread_stack_space_get() which addresses all of these issues.

A helper API log_stack_usage() also added which resembles
STACK_ANALYZE() in functionality.

Fixes: #17852

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-02-08 10:02:35 +02:00
Alex Porosanu 03892c1571 Bluetooth: controller: split: openisa: fix missing include
If CONFIG_BT_CTLR_CONN_RSSI is enabled, then lll_conn.h should
be included as well. Otherwise, struct lll_conn is unknown
at the compile unit level. This has been reproduced by
compiling the hci_uart sample, where the following error occurs:

lll_adv.c: In function 'isr_rx_pdu':
lll_adv.c:722:13: error: dereferencing pointer to incomplete
                         type 'struct lll_conn'
    lll->conn->rssi_latest =  radio_rssi_get();
             ^~

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
2020-02-07 15:52:26 -06:00
Vinayak Kariappa Chettimada a81fc17bb2 Bluetooth: controller: split: Fix uninitialized advertiser rl_idx
Fix uninitialized advertiser rl_idx used to check own identity
in CONNECT_IND received for directed advertisements.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-02-07 14:09:05 +01:00
Peter Bigot ddc3f0699f gpio: replace gpio pin write/read with set/get
This API will be deprecated in favor of the new API that clearly
specifies whether it works on logical or physical levels.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Morten Priess c1cb5ea540 Bluetooth: controller: Remove compiler specific warning
Some compilers can't resolve the conditional if/else/else construction
in ull_conn event_len_prep function, and fail with an 'uninitialized
variables' error. The change has no functional impact.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2020-02-04 18:11:18 +01:00
Thomas Ebert Hansen 4efbbce692 Bluetooth: controller: Fix settings dependency
BT_CTLR_SETTINGS should not depend on BT_SETTINGS as this will prevent
using settings system in the controller in a controller only build.
(BT_SETTINGS depends on BT_HCI_HOST)

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2020-02-04 12:50:27 +01:00
Joakim Andersson 291ebdd4e4 Bluetooth: Fix infinite recursion in host-based bt_rand
Fix infinite recursion in host-based bt_rand function. This would call
HCI LE Random Number command, which would in turn call bt_rand, causing
an infinite recursion.

bt_rand -> prng_reseed -> BT_HCI_OP_LE_RAND -> le_rand -> bt_rand

To solve this issue the controller should avoid doing calls into the
host, so all calls to bt_rand in the controller should be replaced with
a call to a controller function.

Fixes #22202

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-01-31 18:33:06 +01:00
Rubin Gerritsen 171a9fa167 bluetooth: controller: Guard SW based privacy config by Zephyr LL
SW based privacy is an implementation detail in the zephyr link layers.
Therefore it should not be visible when selecting an out-of-tree
controller.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-01-31 10:59:35 +01:00
Morten Priess 2945143edd Bluetooth: controller: split: Force central cleanup on MIC error
Since a peer MIC failure closes the event, it does not allow a terminate
acknowledge. For that reason a peer MIC fail for central role must force
a conn_cleanup.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2020-01-31 10:15:19 +01:00
Andries Kruithof 3db3ae5aed Bluetooth: controller: split: Fix DLE preparation routine
This fixes the EBQ tests 129 and 130. These tests check behaviour for
the DLE procedure when Encoded PHY or 2M PHY are not supported.
See also BT core spec. Version 5.1, Vol6, Part B, Section 5.1.9

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-01-30 15:25:40 +01:00
Erik Brockhoff 88f8880e16 bluetooth: controller: fixing issue with white list clear
When clearing the whitelist, possible white listings in resolve list
were left. These are now also cleared.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2020-01-30 15:11:45 +01:00
Vinayak Kariappa Chettimada 0ee81aab9a Bluetooth: controller: Clean up nrf cmake include
Clean up the nRF cmake include file to remove redundant
check for BT_LLL_VENDOR_NORDIC inside the file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-29 15:27:24 +01:00
Wolfgang Puffitsch 2071c2fb7a Bluetooth: controller: Support SMI TX flag as setting
SMI TX is different than other controller features in that it does not
necessarily imply any software changes; whether SMI TX is supported
may be simply a matter of hardware calibration. This change supports
using the same software on chips that do or do not support SMI TX
depending on calibration.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2020-01-28 20:28:50 +01:00
Wolfgang Puffitsch e477c5a525 Bluetooth: controller: Add feature bits for SMI support
Enable setting features bits for Stable Modulation Index in controller
features.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2020-01-28 20:28:50 +01:00
Morten Priess c20a870b6b bluetooth: controller: Added use of slot_window for ADV
Request ticker re-scheduling of ADV (within the 10ms randomized window).

Signed-off-by: Morten Priess <mtpr@oticon.com>
2020-01-28 08:07:54 +01:00
Morten Priess 64c89d682f bluetooth: controller: Implemented dynamic re-scheduling in ticker
As a part of a ticker extension interface, it is now possible to specify
a slot_window when starting a ticker. When setting the
ticks_slot_window to a non-zero value, it is requested that the node
timeout is re-located to a position within the window, where the node
does not collide with other nodes - aligning to the end of the window.
The solution takes into consideration if a node has already been
updated with drift correction (e.g. ADV randomization), subtracting this
from the window.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2020-01-28 08:07:54 +01:00
Vinayak Kariappa Chettimada c793c0edda Bluetooth: controller: split: Update lll_conn_flush interface
Updated the lll_conn_flush interface to pass the connection
handle while the LLL connection context stored handle has
been invalidated.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-27 13:51:08 +01:00
Vinayak Kariappa Chettimada d9c67ebd77 Bluetooth: controller: split: Revert Move invalidation of connection handle
This reverts commit d3e3f8d2b4.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-27 13:51:08 +01:00
Vinayak Kariappa Chettimada 43d8166045 Bluetooth: controller: split: Revert conn handle invalidation
This reverts commit 7417e6e09e.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-27 13:51:08 +01:00
Alex Porosanu 3412612085 bluetooth: controller: refactor CMake related files
Zephyr aims to enable supporting of multiple SW defined
BLE LL. There is a complex hierarchy of defines in the
CMake files controlling the compilation units that part of
the final library. Adding another SW LL implementation
from a different SoC provider will make the main controller
CMake file unmaintable.
As such, split the into vendor-specific CMake files for
easier additions.

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
2020-01-23 16:08:00 +01:00
Marek Pieta e2905c09cb Bluetooth: controller: Fix Kconfig dependency
Change adds missing Kconfig dependency.
The CONFIG_BT_CTLR_FILTER is used only for SW Link Layers.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2020-01-23 11:00:17 +01:00
Ulf Magnusson 4e85006ba4 dts: Rename generated_dts_board*.{h,conf} to devicetree*.{h,conf}
generated_dts_board.h is pretty redundant and confusing as a name. Call
it devicetree.h instead.

dts.h would be another option, but DTS stands for "devicetree source"
and is the source code format, so it's a bit confusing too.

The replacement was done by grepping for 'generated_dts_board' and
'GENERATED_DTS_BOARD'.

Two build diagram and input-output SVG files were updated as well, along
with misc. documentation.

hal_ti, mcuboot, and ci-tools updates are included too, in the west.yml
update.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-01-17 17:57:59 +01:00
Erik Brockhoff 48b6dae329 Bluetooth: controller: split: ULL filter API modifications
Moving struct definitions into header file and adding API to
allow accessing data-structures from lll context

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2020-01-17 17:11:54 +01:00
Dominik Ermel 50f7555789 Bluetooth: Selecting ENTROPY_GENERATOR for crypto
Bluetooth sample with controller crypto, requires sys_rand32_get that
used to be linked with Tinycrypt. The selection, within Kconfig of
Tinycrypt, that has been enabling compilation of the symbol has
been removed and thus preventing controller crypto to link.

This commit moves the selection to BT_CTLR_CRYPTO.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-01-16 13:25:31 +01:00
Vinayak Kariappa Chettimada b5c63c69ca Bluetooth: controller: split: Fix ull_disable hang
Under race conditions it is possible that there is no call
to k_sem_give to the waiting k_sem_take in the ull_disable
function.

ull_disable function checks for reference count before
using a mayfly to schedule lll_disable, which in turn
would close requested currently active role event leading
to done event being propogated to ULL. Done event would
then call the set disabled_cb callback when the reference
count is zero, giving the semaphore to the waiting
k_sem_give in the ull_disable.

Under race conditions if the reference count reached zero
after the reference count check and before the disabled_cb
was assigned in the ull_disable function, then there are
chances that a k_sem_give is not called while ull_disable
proceeds to waiting using k_sem_take.

Fixes #21586.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-16 10:54:40 +01:00
Vinayak Kariappa Chettimada 9a6d200cb9 Bluetooth: controller: legacy: Fix redundant priv variable check
Fix the redundant check of priv flag variable introduced as
regression in commit f8877e39ce ("Bluetooth: controller:
legacy: Fix controller address check").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-16 08:49:35 +01:00
Vinayak Kariappa Chettimada 51c46d94ed Bluetooth: controller: Fix CONFIG_BT_CTLR_TX_BUFFER_SIZE range
Fix CONFIG_BT_CTLR_TX_BUFFER_SIZE value range to 251 Bytes
due to implementation limitation in use of u8_t for PDU
length fields in controller Tx buffers.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-15 15:26:19 +01:00
Vinayak Kariappa Chettimada 8cd9a94b2f Bluetooth: controller: split: Fix controller privacy address check
Fix controllers address check in cases of controller-based
privacy is supported but not used to start advertising.

This fixes regression introduced in
commit 896619ad40 ("Bluetooth: controller: Fix
controller address check").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-15 15:24:55 +01:00
Andries Kruithof 98430a61cf Bluetooth: controller: split: Refactor DLE prepare
Refactor the event_len_prep routine to increase readability without
affecting code size

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-01-15 14:01:23 +01:00
Andries Kruithof 26a97aed4f Bluetooth: controller: split: Fix LENGTH_REQ PDU prepare
There is an obscure bug in the case that CFG_BT_CTLR_PHY is not defined;
when a feature-exchange already has happened the lr->max_tx_time and
lr->max_rx_time are not calculated.
This bug is fixed by this commit.

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-01-15 14:01:23 +01:00
Rubin Gerritsen 4ce9c9d59c bluetooth: controller: Guard zephyr LL specific configurations
This change prevents zephyr LL specific configurations to show up when
using an out of tree BLE controller.

BT_CTLR_ASSERT_HANDLER is used outside the controller as well,
so this is kept as is.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-01-14 11:07:40 -05:00
Andries Kruithof 44daa9f15c Bluetooth: controller: Refactor time calculation for LL DLE procedure
Refactor the PKT_US macro to show more clearly where the different
fields come from

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-01-10 14:10:23 +01:00
Vinayak Kariappa Chettimada f8877e39ce Bluetooth: controller: legacy: Fix controller address check
Fix controllers address check in cases of controller-based privacy.
When controller has been instructed by the host to use privacy
the controller should look up the peer identity address and generate
an address based on the local IRK. In the case where no match
is found or the local IRK is all zeroes the controller shall use
the fallback address. If the fallback address is not valid the
controller shall return invalid params.

This commit fixes these issues:
 - Starting a private advertiser without valid random address set
   but a valid local IRK exists. In this case the advertiser should
   be able to advertise using the RPA regardless of a valid random
   or public address.
 - Starting a private advertiser with a fallback to the public
   address type or an adveriser using public address  does not
   check if a valid public address exists. The host cannot
   advertise with an all-zero public address.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-09 15:34:23 +01:00
Joakim Andersson f5d2b3271a Bluetooth: controller: Fix bug in LE create conn with filter policy
Fix bug when connecting using whitelist and split controller.
The peer address was set to an all zeroes address.

Bug using shell:
bt init
bt wl-add <addr>
bt wl-connect on
Connected: 00:00:00:00:00:00 (public)

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-01-08 10:48:47 +01:00
Vinayak Kariappa Chettimada 19ac87c4f0 Bluetooth: controller: Add set adv param cmd param validation
Added implementation to validate HCI LE Set Advertising
Parameters Command parameters.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-06 17:42:34 +01:00
Vinayak Kariappa Chettimada ec1e66ebd8 Bluetooth: controller: Add Kconfig option for parameter checking
Added Kconfig option to conditionally compile in HCI command
parameter validation code.

When building a combined host plus controller application,
only validations in the host at the top level close to the
API caller is sufficient.

The controller validations are included in controller only
builds.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-06 17:42:34 +01:00
Christopher Friedt 5308a941a9 Bluetooth: controller: define adv channel access address as macro in pdu.h
The new macro is PDU_AC_ACCESS_ADDR

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-01-06 09:58:18 +01:00
Vinayak Kariappa Chettimada c9c65a9b9b Bluetooth: controller: split: Pass scanner LLL context in event
Pass the scanner LLL context in the generated connection
complete event with unknown connecion id for HCI Create
Connection Cancel Command Response.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-03 14:16:16 +01:00
Vinayak Kariappa Chettimada 13a3270096 Bluetooth: controller: split: Fix assert in PDU Rx quota increment
Directed advertising timeout released PDU Rx quota which it
should not be.

Relates to assert in #21006.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-03 14:16:16 +01:00
Vinayak Kariappa Chettimada ca8b6028c6 Bluetooth: controller: split: Move statements close to related context
Minor refactor, move statements close to related context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-03 14:16:16 +01:00
Vinayak Kariappa Chettimada 4f42baa43d Bluetooth: controller: split: Use define instead of magic number
Use HCI Error Code define instead of magic number.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-03 14:16:16 +01:00
Joakim Andersson f675e14718 Bluetooth: controller: Use 24-bit functions for LL Features
Use 24-bit functions for LL Features copying to make byteorder more
readable.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-01-02 19:05:27 +01:00
Vinayak Kariappa Chettimada f5bbb4d3fd Bluetooth: controller: legacy: Fix tx_time calculation for length update
Fix tx_time calculation for the case that BT_CTRL_PHY is defined and
there has not been a feature exchange.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-02 16:53:54 +01:00
Wolfgang Puffitsch 41e6016885 Bluetooth: controller: split: Fix tx_time calculation for length update
Fix tx_time calculation for the case that BT_CTRL_PHY is defined and
there has not been a feature exchange.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-01-02 16:53:45 +01:00
Joakim Andersson 40c20b1f18 Bluetooth: Change remote version event from prio to normal event type
This commit reverts the change that moved the remote version event from
a priority event to a normal event. This is done because the strategy
for using this event has been changed and will be used with a callback
instead of a semaphore that could be locked from the RX thread.

This commit retains the infrastructure that was added in the controller
so that moving events to priority processing is still possible.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-12-23 14:47:31 +02:00
Joakim Andersson a34d4afe7d Bluetooth: Host: Fix issues with host IRK handling
Fix multiple issues related to the way the host handles
Identity Information related to privacy

1. If the controller provided a public address the IRK
   for this identity would be randomly generated but not
   stored persistenly.

2. Fix the handling of the above issue which was fixed
   for the random address but would initiate settings save
   ID on every boot.

3. Fix the host not using the Vendor Specific HCI commands
   related to retrieving the Identity Root (IR) from the
   controller and using the key diversified function d1
   to generate an IRK as specified in the BT Core spec.

Make sure that a Host generated ID is only saved when it is first
generated.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-12-20 15:45:34 +01:00
Joakim Andersson 091ebf905d Bluetooth: controller: Return FICR as a static address IR
Return the IR defined in FICR as the Identity Root for the static
address through the read static addresses command instead of providing
it through the Read Key Hierarchy Root command.
This is following the recommendations in the Zephyr HCI extension
document in doc/reference/bluetooth/hci.txt

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-12-20 15:45:34 +01:00
Joakim Andersson 896619ad40 Bluetooth: controller: Fix controller address check
Fix controllers address check in cases of controller-based privacy.
When controller has been instructed by the host to use privacy
the controller should look up the peer identity address and generate
an address based on the local IRK. In the case where no match
is found or the local IRK is all zeroes the controller shall use
the fallback address. If the fallback address is not valid the
controller shall return invalid params.

This commit fixes these issues:
 - Starting a private advertiser without valid random address set
   but a valid local IRK exists. In this case the advertiser should
   be able to advertise using the RPA regardless of a valid random
   or public address.
 - Starting a private advertiser with a fallback to the public
   address type or an adveriser using public address  does not
   check if a valid public address exists. The host cannot
   advertise with an all-zero public address.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
2019-12-20 15:26:41 +01:00
Vinayak Kariappa Chettimada b0826a7f65 Bluetooth: controller: split: Reduce time to setup tIFS switch
Refactor to reduce the setup next tIFS switch within tIFS
period of the Radio ISR.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-18 22:02:02 +01:00
Vinayak Kariappa Chettimada 7ba5e012f7 Bluetooth: controller: nordic: Tune tIFS switching
Remove the 4us advanced radio reception, the implementation
passes all timing conformance tests without this.
This change should reduce some radio power consumption by
avoiding redundant reception duration.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-18 22:02:02 +01:00
Krzysztof Chruscinski 00156ad80a drivers: clock_control: nrf: Switch to single clock device
Low frequency and high frequency clocks had separate devices
while they are actually handled by single peripheral with single
interrupt. The split was done probably because opaque subsys
argument in the API was used for other purposes and there was
no way to pass the information which clock should be controlled.
Implementation changes some time ago and subsys parameter was
no longer used. It now can be used to indicate which clock should
be controlled.

Change become necessary when nrf5340 is taken into account where
there are more clocks and current approach would lead to create
multiple devices - mess.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-12-17 14:38:19 +01:00
Vinayak Kariappa Chettimada 9128200e6c Bluetooth: controller: legacy: Fix compiler warnings
Fix compiler warnings when central only support is used.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-17 13:14:37 +01:00
Vinayak Kariappa Chettimada e23c7fbba6 Bluetooth: controller: legacy: Fix length and ping rsp
Fix LENGTH_RSP and PING_RSP to be send after Encryption
Setup under the cases where LENGTH_REQ or PING_REQ cross-
over with ENC_REQ in the same connection event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-17 13:14:37 +01:00
Vinayak Kariappa Chettimada 1ede7db159 Bluetooth: controller: legacy: Fix Tx Ctrl PDU leak
Overlapping Feature Exchange requested by host with
Encryption Setup requested by the application caused the
controller to corrupt its Tx queue leading to Tx Ctrl PDU
buffers from leaking from the system.

Relates to #21299.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-17 13:14:37 +01:00
Andrei Stoica 930d178c69 Bluetooth: controller: enable dynamic TXP over LEGACY arch (#17731)
This commit targets solving issue #17731 over the Nordic LL LEGACY
arch of the BLE stack in Zephyr. This functionality is exposed
to the user as HCI Zephyr Command extensions

- BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL
- BT_HCI_OP_VS_READ_TX_POWER_LEVEL

which enable Tx power read/write operations within BLE radio events
on a per role/connection basis.

The functionality is enabled upon the Kconfig advanced configuration
triggered by

- BT_CTLR_TX_PWR_DYNAMIC_CONTROL

depending on the enablement of Zephyr HCI vendor-specific command
extensions.

Signed-off-by: Andrei Stoica <stoica.razvan.andrei@gmail.com>
2019-12-17 12:29:57 +01:00
Andrei Stoica abd1d047dd Bluetooth: controller: enable dynamic TXP over LL_SPLIT arch (#17731)
This commit targets solving issue #17731 over the LL_SW_SPLIT
arch of the BLE stack in Zephyr. This functionality is exposed
to the user as HCI Zephyr Command extensions

- BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL
- BT_HCI_OP_VS_READ_TX_POWER_LEVEL

which enable Tx power read/write operations within BLE radio events
on a per role/connection basis.

The functionality is enabled upon the Kconfig advanced configuration
triggered by

- BT_CTLR_TX_PWR_DYNAMIC_CONTROL

depending on the enablement of Zephyr HCI vendor-specific command
extensions.

Necessary low-level radio HAL functionality and power definitions
are also supplied to address the high-level functionality of
controlling the Tx power.

Signed-off-by: Andrei Stoica <stoica.razvan.andrei@gmail.com>
2019-12-17 12:29:57 +01:00
Vinayak Kariappa Chettimada f95a7faa58 Bluetooth: controller: split: Fix compiler warnings
Fix compiler warnings when PHY update feature is not selected.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-16 16:16:08 +01:00
Vinayak Kariappa Chettimada 9bd8518baf Bluetooth: controller: split: Fix length and ping rsp
Fix LENGTH_RSP and PING_RSP to be send after Encryption
Setup under the cases where LENGTH_REQ or PING_REQ cross-
over with ENC_REQ in the same connection event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-16 16:16:08 +01:00
Vinayak Kariappa Chettimada f7c890e08c Bluetooth: controller: split: Fix Tx Ctrl PDU leak
Overlapping Feature Exchange requested by host with
Encryption Setup requested by the application caused the
controller to corrupt its Tx queue leading to Tx Ctrl PDU
buffers from leaking from the system.

Fixes #21299.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-16 16:16:08 +01:00
Asger Munk Nielsen 612984e09c Bluetooth: controller: SW deferred privacy IRK size define
Replaced symbolic constants with a define for the size of IRKs.

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2019-12-13 15:35:25 +01:00
Asger Munk Nielsen 1d412c4acd Bluetooth: controller: SW deferred privacy
Enable deferred resolve of RPA

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2019-12-13 15:35:25 +01:00
Joakim Andersson e978d8620f Bluetooth: controller: Fix rx buffer leak for LL Version priority event
Fix leak of the node_rx buffer when processing the LL version ind as a
priority event. This leak meant being able to establish new connections
was no longer possible, because there weren't enough events to process
the all the events during connection establishment. And instead the LL
ignored the connection request sent by the peer.

Removed the inline extern declaration of a function which had a proper
header included.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-12-13 15:15:53 +01:00
Vinayak Kariappa Chettimada bf623906f3 Bluetooth: controller: split: Fix missing version ind state reset
Fix implementation for the missing reset of version
information procedure request state value.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-13 13:21:27 +01:00
Vinayak Kariappa Chettimada 7417e6e09e Bluetooth: controller: split: conn handle invalidation on release
Move invalidation of connection handle to connection context
release done on release of terminate rx node.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-12 08:48:24 +01:00
Wolfgang Puffitsch d3e3f8d2b4 Bluetooth: controller: split: Move invalidation of connection handle
Move invalidation of connection handle when flushing TX buffers into
LLL context. Otherwise, LLL may or may not see invalidated handle
depending on mayfly scheduling.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-12-12 08:48:24 +01:00
Ulf Magnusson 984bfae831 global: Remove leading/trailing blank lines in files
Remove leading/trailing blank lines in .c, .h, .py, .rst, .yml, and
.yaml files.

Will avoid failures with the new CI test in
https://github.com/zephyrproject-rtos/ci-tools/pull/112, though it only
checks changed files.

Move the 'target-notes' target in boards/xtensa/odroid_go/doc/index.rst
to get rid of the trailing blank line there. It was probably misplaced.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-11 19:17:27 +01:00
Joakim Andersson a1d73acfcd Bluetooth: HCI: Handle invalid ACL flags.
Handle invalid ACL flags in HCI transport.
Only Point to Point is supported over HCI in both directions.
Fix flushable start HCI ACL packets not allowed on LE-U connections
from Host to controller.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-12-11 12:34:34 +02:00
Vinayak Kariappa Chettimada 5f10154724 Bluetooth: controller: split: Fix HCI LE Add Device to Whitelist
According to BT Spec v5.1 Vol 2 Part E Section 7.8.16, if the
device is already in the White List, the controller should not
add the device to the White List and should return success.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-10 22:29:15 +02:00
Vinayak Kariappa Chettimada 09f7364cf8 Bluetooth: controller: legacy: Fix HCI LE Add Device to Whitelist
According to BT Spec v5.1 Vol 2 Part E Section 7.8.16, if the
device is already in the White List, the controller should not
add the device to the White List and should return success.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-10 22:29:15 +02:00
Kumar Gala 24ae1b1aa7 include: Fix use of <misc/FOO.h> -> <sys/FOO.h>
Fix #include <misc/FOO.h> as misc/FOO.h has been deprecated and
should be #include <sys/FOO.h>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-12-10 08:39:37 -05:00
Vinayak Kariappa Chettimada 92e017fd70 Bluetooth: controller: split: Support Zero Latency IRQs
Add support for Zero Latency IRQs, which avoids any Zephyr
OS or application influenced ISR latencies on the
controller's ISRs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-03 10:43:09 +01:00
Vinayak Kariappa Chettimada dab182896e Bluetooth: controller: split: Revert broken ZLI support
This reverts commit 3096c0e741.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-03 10:43:09 +01:00
Vinayak Kariappa Chettimada c53ca07246 Bluetooth: controller: legacy: Revert broken ZLI support
This reverts commit a1945db08a.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-12-03 10:43:09 +01:00
Vinayak Kariappa Chettimada 44bbdd0a94 Bluetooth: controller: Fix llcp_rx check assert
If LL Connection Parameter Request or LL Connection Update
or LL PHY Update procedure is started by the local device
while a LL Length Update Request PDU has been sent by peer
then a Rx node has been stored in the llcp_rx place holder
for generation of Length Update procedure complete.

The failing assert check is incorrect in the above scenario
hence remove. Instead a missing append of the allocated Rx
node to the llcp_rx list has been added to the controller
implementation.

This issue relates to commit d12c53f89f ("Bluetooth:
controller: split: Fix missing data len update event").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-27 18:43:02 +01:00
Vinayak Kariappa Chettimada 430df927b0 Bluetooth: controller: split: Fix aborting of connection req PDU
Fix the initiator so that connection request PDU is not abort
mid-air by preemption by the overalapping first connection
event.

If the connection establishment is in progress, then the
first connection event trying to abort the initiator will
wait the connection request to be transmited completely.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-22 08:40:41 +01:00
Vinayak Kariappa Chettimada d5314b8387 Bluetooth: controller: split: Add missing BT_DEBUG_ENABLED define
Add missing BT_DEBUG_ENABLED definitions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-21 17:08:37 +01:00
Vinayak Kariappa Chettimada 2993b1ec0a Bluetooth: controller: legacy: Add missing BT_DEBUG_ENABLED define
Add missing BT_DEBUG_ENABLED definitions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-21 17:08:37 +01:00
Vinayak Kariappa Chettimada 83d6e5d3d4 Bluetooth: controller: Add missing BT_DEBUG_ENABLED define
Add missing BT_DEBUG_ENABLED definitions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-21 17:08:37 +01:00
Vinayak Kariappa Chettimada e27abee331 Bluetooth: controller: split: Schedule first conn event ASAP
Enable ticker job mayfly as soon as possible when
establishing connection. This is required so as to not miss
the first connection event in slow CPU like in nRF51 series.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-21 17:08:03 +01:00
Alex Porosanu fec5bbb1c1 Bluetooth: controller: openisa: sync with Nordic SW LL
There are some changes that were introduced to the Nordic SW LL,
and as such, in order to maintain compatibility, propragate them
to the OpenISA SW LL as well.

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
2019-11-21 10:35:16 +01:00
Vinayak Kariappa Chettimada 91fe1d9aa1 Bluetooth: controller: split: Dont use continuous directed adv in nRF51
In nRF51 which uses CONFIG_BT_CTLR_LOW_LAT, the advertising
PDU tend to get aborted in directed advertising at event slot
durations.

Dont not use continuous directed advertising event in nRF51
where CONFIG_BT_CTLR_LOW_LAT scheduling design alternative
is used. Instead close the event after each triplet of PDU
has been tx-ed.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-21 08:43:41 +01:00
Vinayak Kariappa Chettimada 528944708c Bluetooth: controller: split: Fix non-connectable event slot time
Fix the calculation of non connectable advertising event
slot reservation duration.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-21 08:43:05 +01:00
Vinayak Kariappa Chettimada b33ccbf275 Bluetooth: controller: split: Fix directed adv event interval
Fix the directed advertising event interval calculation.
When CONFIG_BT_CTLR_LOW_LAT is used then prepare duration
has to be included in the event slot reservation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-21 08:42:27 +01:00
George Stefan d2212581be Bluetooth: controller: split: Fix check for control procedures request
Remove wrong #ifdef that guarded the control procedures request check

Signed-off-by: George Stefan <george.stefan@nxp.com>
2019-11-20 19:37:42 +01:00
Vinayak Kariappa Chettimada 3805290055 Bluetooth: controller: legacy: Fix the slow Enc Setup alternative
Fix the implementation of slow encryption setup design
alternative to send ENC_RSP PDU before sending REJECT_IND
or REJECT_EXT_IND PDU.

Fixes #19917.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-19 13:53:50 -05:00
Vinayak Kariappa Chettimada 62f939adb8 Bluetooth: controller: split: Fix typo EVENT_RX_TX_TURNARROUND
Fix typo in EVENT_RX_TX_TURNARROUND.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-19 15:37:56 +01:00
Vinayak Kariappa Chettimada 4a42e636e8 Bluetooth: controller: Fix Code PHY update support dependency
Fix the regression introduced as part of
commit 57d9411837 ("bluetooth: kconfig: disable some
options for openisa/RV32M1").

Also, prior to PR that introduced this regression, the Coded
PHY support selection was incorrectly depending on PHY update
support Kconfig BT_PHY_UPDATE. This was already fixed as part
the previous PR.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-15 16:01:31 +01:00
Emil Obalski 446d98b09e bluetooth: Add bluetooth support for nRF52833
This commit adds support for bluetooth in nRF52833 SoC.
Bluetooth radio related files created and added to Zephyr.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2019-11-13 10:33:38 -06:00
Morten Priess 087706498e bluetooth: controller: Perform synchronized LLL reset via mayfly
Use semaphore to synchronize lll_reset completion with HCI thread for
returning (command complete) only when all is done.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-11-12 11:34:28 +01:00
Erik Brockhoff ed61065f2c Bluetooth: controller: ull_filter: RPA ADV refresh fix
local variable (idx) was used in conflicting contexts

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2019-11-12 11:30:05 +01:00
Vinayak Kariappa Chettimada d1d603afc3 Bluetooth: controller: split: Fix conn update to be cacheable
Fix connection update procedure to be cacheable if any other
local or remote control procedure is in progress.

Relates to commit 9c14567ce2 ("Bluetooth: controller: Fix
conn update to be cacheable").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-11 14:17:35 +01:00
Carles Cufi 4657d8515a Bluetooth: controller: openisa: Fix radio ISR signature
Non-direct ISRs are supposed to take a void pointer as an argument,
unliike direct ones, which take no arguments. Since the radio ISR is not
declared as direct, the void pointer argument was missing, likely due to
a copy-paste mistake from the nordic LLL, which indeed uses a direct ISR
for the radio ISR.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-11-11 13:53:03 +01:00
Anas Nashif 53f30bc3ac Bluetooth: controller: openisa: do not use instances for openisa IRQs
An issue with DT generation where instance defines are not determinstic
generating values that collide with existing IRQs.

Fixes #20558

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-11-10 11:17:35 -05:00
Ioannis Glaropoulos 9d52f798c5 bluetooth: controller: define SW IRQ structure for nRF53 SoCs
Extend the nRF5-specific SW IRQ framework to support nRF53.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-08 19:26:35 +01:00
Ioannis Glaropoulos fb56d56dc9 bluetooth: controller: setup nRF53 DDPI configuration for Coded PHY
This commit provides the DPPI configuration for the Radio
driver for nRF5340 SoC, supporting LE Coded PHY.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-08 19:26:35 +01:00
Ioannis Glaropoulos 17859e1eee bluetooth: controller: setup DDPI configuration for nRF5340
This commit provides the DPPI configuration for the Radio
driver for nRF5340 SoC.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-08 19:26:35 +01:00
Ioannis Glaropoulos 0186c66ac3 bluetooth: controller: enable support for nRF53 when building radio.c
Add the require #ifdef blocks in radio.c, in order to support
building for nRF53 SoC series (and, in particular, for nRF5340
CPU1 SoC).

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-08 19:26:35 +01:00
Ioannis Glaropoulos 1b3039ef1a bluetooth: controller: include nRF5340-specific radio header
Conditionally include nrf5340_radio.h when building the
BLE controller for nRF5340 SoC. Introduce the header for
nrf5340.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-08 19:26:35 +01:00
Ioannis Glaropoulos 613e716e11 bluetooth: controller: enable support for nRF53 in Kconfig
This commit enables support in bluetooth/controller/Kconfig
for nRF53 series of SoCs.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-08 19:26:35 +01:00
Ioannis Glaropoulos a7a4c89579 bluetooth: controller: conditionally define NRF_RADIO_TXPOWER_POS4DBM
nRF5340 does not support a Radio TX power of 4dBm, so we
introduce a dependency for the respective Kconfig option
for TX power, so the option is never defined for nRF5340.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-08 19:26:35 +01:00
Ioannis Glaropoulos 53e4c215ee include: bluetooth: define hci macro for nRF53
Define the nRF53 HW variant in include/bluetooth/hci_vs.h
and pass the define in hci_vendor.h

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-08 19:26:35 +01:00
Trond Einar Snekvik c704495807 Bluetooth: Move Company ID config out of ctlr
The Company ID concept is not restricted to the controller, and should
be part of the wider Bluetooth scope, so it can be used on a
controller-less device. It's used in multiple host level modules, most
notably the Bluetooth Mesh and Device Information Service.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2019-11-08 16:16:37 +01:00
Alex Porosanu 57d9411837 bluetooth: kconfig: disable some options for openisa/RV32M1
Some Bluetooth options are currently not supported by the experimental
BLE SW LL implementation done on VEGABoard. As such, hide them from
the user altogether.

The full list of disabled config options is as follows:

- CONFIG_BT_PHY_UPDATE
- CONFIG_BT_DATA_LEN_UPDATE
- CONFIG_BT_HCI_VS
- CONFIG_BT_CTLR_LE_ENC
- CONFIG_BT_CTLR_CONN_PARAM_REQ
- CONFIG_BT_CTLR_EXT_REJ_IND
- CONFIG_BT_CTLR_SLAVE_FEAT_REQ
- CONFIG_BT_CTLR_LE_PING
- CONFIG_BT_CTLR_PRIVACY
- CONFIG_BT_CTLR_EXT_SCAN_FP
- CONFIG_BT_CTLR_CHAN_SEL_2
- CONFIG_BT_CTLR_ADV_EXT
- CONFIG_BT_CTLR_XTAL_ADVANCED
- CONFIG_BT_CTLR_SCHED_ADVANCED
- CONFIG_BT_CTLR_TIFS_HW

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
2019-11-08 15:38:57 +01:00
David Leach 5edcb7dc2a bluetooth: controller: openisa/RV32M1: add debug pins support
Add SW defined BLE LL debug support on Vega platform by using
the debug GPIO pins infrastructure.

Signed-off-by: David Leach <david.leach@nxp.com>
2019-11-08 15:38:57 +01:00
George Stefan d87aaa6107 bluetooth: controller: openisa/RV32M1: enable the BLE SW controller
This patch updates the config files required to enable the
BLE SW defined controller to be built on RV32M1 SoCs. Only the split
version is supported.

Signed-off-by: George Stefan <george.stefan@nxp.com>
Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
Signed-off-by: Ionut Ursescu <ionut.ursescu@nxp.com>
2019-11-08 15:38:57 +01:00
George Stefan b063456015 bluetooth: controller: openisa/RV32M1: BLE Link Layer ULL/LLL split
This commit takes the Nordic LLL and adapts it for RV32M1 SoCs, using
the blocks that are specific to this SoC: the GenFSK & LPTMR IP
blocks.

Signed-off-by: George Stefan <george.stefan@nxp.com>
Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
Signed-off-by: Ionut Ursescu <ionut.ursescu@nxp.com>
2019-11-08 15:38:57 +01:00
George Stefan 24d9ad2494 bluetooth: controller: openisa/RV32M1: add HAL for LPTMR & GenFSK
This commit adds the HAL layer needed for the BLE controller
LL on RV32M1 SoCs on OpenISA boards. Specifically, the controller
makes use of the the GenFSK and LPTMR IP blocks.

Signed-off-by: George Stefan <george.stefan@nxp.com>
Signed-off-by: Radu Alexe <radu.alexe@nxp.com>
Signed-off-by: Ionut Ursescu <ionut.ursescu@nxp.com>
2019-11-08 15:38:57 +01:00
David Leach 94106a8ff3 boards: riscv: rv32m1: add support for GPIO debugging
Having a pin toggle when the code reaches a certain point
is really useful for debugging; the infrastructure is already
in place for Nordic boards, so just build upon and enable the
mechanism on the Vega board as well.

Signed-off-by: David Leach <david.leach@nxp.com>
2019-11-08 15:38:57 +01:00
Andrzej Głąbek d84447e943 bluetooth: nordic: Update nrfx HAL calls with pointers to HW instances
Update calls to nrfx HAL functions to reflect API changes introduced in
nrfx 2.0.0. All these functions are now called with the first parameter
pointing to the structure of registers of the relevant peripheral.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-11-08 14:54:12 +01:00
Vinayak Kariappa Chettimada 2f965a1fb0 Bluetooth: controller: split: Fix DLE for remote unsupported Coded PHY
Fix Data Length Procedure to use Feature Exchange values to
send correct parameters based on whether Coded PHY is
supported by remote peer.

Relates to BT TS.5.1.1 tests:
LL/CON/MAS/BV-129-C
LL/CON/MAS/BV-130-C
LL/CON/SLA/BV-132-C
LL/CON/SLA/BV-133-C

Relates to commit fca32e41e6 ("Bluetooth: controller: Fix
DLE for remote unsupported Coded PHY").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-08 14:30:25 +01:00
Vinayak Kariappa Chettimada 48e5d9482a Bluetooth: controller: split: Fix the slow Enc Setup alternative
Fix the implementation of slow encryption setup design
alternative to send ENC_RSP PDU before sending REJECT_IND
or REJECT_EXT_IND PDU.

Fixes #19917.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-08 14:29:36 +01:00
Vinayak Kariappa Chettimada 0a892310d3 Bluetooth: controller: split: Fix feature exchange state reset
Fix feature exchange event generation to be correctly
deferred to wait for Rx node availability for cases when
the procedure has already been performed on air.

Without this fix, remote feature request from host may not
get back a HCI event back.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-08 14:29:21 +01:00
Vinayak Kariappa Chettimada ebb2c0d208 Bluetooth: controller: split: Port missing break latency
Port missing implementation of the slave latency break
when there is data to be sent to peer master. Without this
initial data send from slave is delay by upto the slave
latency number of connection events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-08 14:29:07 +01:00
Vinayak Kariappa Chettimada f344516a0b Bluetooth: controller: split: Fix enc procedure reject handling
This is a port of the commit 4135fb55f1 ("Bluetooth:
controller: Fix rejected enc procedure not terminated") and
commit 4d59ef306b ("Bluetooth: controller: Check if enc
procedure is in progress").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-08 14:28:10 +01:00
Wolfgang Puffitsch e108898270 Bluetooth: controller: split: Make number of TX ctrl buffers configurable
A single connections may take up to 4 buffers at the same time. Make
number of connections that support this worst-case number
configurable.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-11-06 17:58:54 +01:00
Vinayak Kariappa Chettimada 3420f0863c Bluetooth: controller: split: Add data length procedure queueing
Added implementation to cache Data Length Procedure when
another control procedure is in progress.

Relates to commit 26317491e04b ("Bluetooth: controller: Add
data length procedure queueing").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-06 12:46:52 +01:00
Vinayak Kariappa Chettimada b9a8682d78 Bluetooth: controller: split: Fix Re-encryption procedure
Fix MIC failure on re-encryption procedure when responding
at the same time to peer initiated feature request.

Relates to commit 560d6ddb964c ("Bluetooth: controller: Fix
Re-encryption procedure").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-06 12:46:52 +01:00
Vinayak Kariappa Chettimada 11c3d2cd4e Bluetooth: controller: split: Fix ENC_REQ PDU retransmission
Fix dropped ENC_REQ PDU when retransmitting, if slave was
not listening or nack-ed it.

Relates to commit 31256568a283 ("Bluetooth: controller: Fix
ENC_REQ PDU retransmission").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-06 12:46:52 +01:00
Vinayak Kariappa Chettimada bff76b4cce Bluetooth: controller: split: Fix control tx queue handling
Fix control tx queue handling to correctly pause control PDU
responses during encryption setup.

Relates to commit 4b4b650174bf ("Bluetooth: controller: Fix
control tx queue handling").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-06 12:46:52 +01:00
Vinayak Kariappa Chettimada 16dbb9a4fe Bluetooth: controller: split: Fix cmd disallowed and collision disconnects
Fix implementation to correctly cache the control procedures
initiatable by local and peer. And, fix feature exchange and
version information procedures from being disallowed by
having then as cached requests to the controller.

Relates to #15256 and commit 0dcfa3853782 ("Bluetooth:
controller: Fix cmd disallowed and collision disconnects").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-06 12:46:52 +01:00
Vinayak Kariappa Chettimada b0c495791a Bluetooth: controller: split: Fix start encryption in progress check
Fix check in start encryption to disallow new encryption
setup while there is one already in progress.

Relates to commit 120eba45f81b ("Bluetooth: controller: Fix
start encryption in progress check").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-06 12:46:52 +01:00
Vinayak Kariappa Chettimada 7f0a95468a Bluetooth: controller: split: Fix data PDU leak during ctrl PDU defer
Fix a bug where in tx data PDU enqueued, while a ctrl PDU is
deferred due to Encryption setup being in progress, is
leaked causing HCI Tx Buffer Overflow crash.

Relates to commit 671ccc4b0ee6 ("Bluetooth: controller: Fix
data PDU leak during ctrl PDU defer").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-06 12:46:52 +01:00
Vinayak Kariappa Chettimada d8928d7952 Bluetooth: controller: split: Fix DLE during data transmission
Fix bug in Data Length Update procedure that caused the
connection to drop due to the implementation sending bigger
PDU before the peer has acknowledged the receipt of Length
Response PDU.

Relates to commit ffbbec7a89ca ("Bluetooth: controller: Fix
DLE during data transmission").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-06 12:46:52 +01:00
Ioannis Glaropoulos 46b728204e bluetooth: controller: nrf5: use nrfx function to get CCM IRQ line
We use the nRFx API nrf_get_irq_number(.) to retrieve the IRQ
line of the CCM peripheral, instead of the hard coded enum
value from MDK. We do this for portability, since these
enums may be different for different nRF SoC series.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-05 16:42:15 +01:00
Vinayak Kariappa Chettimada 709dee5ed0 Bluetooth: controller: split: Fix conditional compile error
Fix conditional compilation error in building the central
only samples as all peripheral structure member accesses in
the controller where not correctly compiled out.

Regression introduced in commit 6d8b12468e ("Bluetooth:
controller: split: Refactor LLL conn structure").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-05 11:22:38 +01:00
Ulf Magnusson bd6e04411e kconfig: Clean up header comments and make them consistent
Use this short header style in all Kconfig files:

    # <description>

    # <copyright>
    # <license>

    ...

Also change all <description>s from

    # Kconfig[.extension] - Foo-related options

to just

    # Foo-related options

It's clear enough that it's about Kconfig.

The <description> cleanup was done with this command, along with some
manual cleanup (big letter at the start, etc.)

    git ls-files '*Kconfig*' | \
        xargs sed -i -E '1 s/#\s*Kconfig[\w.-]*\s*-\s*/# /'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-04 17:31:27 -05:00
Ioannis Glaropoulos 73483094da bluetooth: controller: nrf5: simplify preprocessor conditionals
We make a minor simplification in the way we define
RADIO_PDU_LEN_MAX in Nordic nRF LE radio driver; as
nRF51 SoC series is the only series where the LL PDU
max length representation is limited to a 5-bit field,
we simplify the conditional preprocessor expression,
to avoid having to list all nRF5x SoCs with PDU LEN
MAX is represented by an 8-bit integer field.

In addition, we modify the preprocessor conditional,
that compiles in the CCM support for 8-bit length field,
PDUs to be an #ifndef CONFIG_SOC_SERIES_NRF51X, instead
of #ifdef CONFIG_SOC_COMPATIBLE_NRF52X; this will
simplify the expression when adding nRF53X series
support.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-11-04 17:14:06 +01:00
Vinayak Kariappa Chettimada eed51cc018 Bluetooth: controller: split: Fix missing terminate_ack initialization
Add the missing initialization of master role terminate_ack
flag. This caused slave initiated remote termination as
procedure timeout.

Fixes #20135.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-04 10:44:59 +01:00
Vinayak Kariappa Chettimada 6d8b12468e Bluetooth: controller: split: Refactor LLL conn structure
Refactor the LLL connection context to move out the member
fields not accessed in LLL execution context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-11-04 10:44:59 +01:00
Morten Priess ca5c829a84 bluetooth: controller: Move calculation of max_tx_octets to ULL
Move calculation of max_tx_octets from Nordic lll_conn.c to ULL, to
allow usage by other vendors and prevent duplicate code.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-11-02 11:15:44 +01:00
Morten Priess 89ab68f242 bluetooth: controller: Vendor specific ticker resolution margin
With sub-microsecond resolution in ticker, it is not necessary to add a
precision margin to the conn_offset. A macro is created to allow setting
the margin to something other than the hard coded 2 * EVENT_JITTER_US.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-11-02 11:14:38 +01:00
Morten Priess b631cc09ab bluetooth: controller: Add vendor specific overhead to TX buffer size
TX pdu buffers may need to be augmented for fragmentation or other
purpose, depending on vendor LLL implementation. Introduced define to
add extra bytes to TX buffer size, defaulting to 0 if unused.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-11-01 17:54:29 +01:00
Solveig Fure aefe941396 bluetooth: controller: Remove condition for header inclusion
Remove ifdef guard around inclusion of nrf_clock_control.h in bluetooth
controller as the defines in this header are needed anyway.

Signed-off-by: Solveig Fure <solveig.fure@nordicsemi.no>
2019-10-28 16:24:51 +01:00
Carles Cufi 8c2b849ae7 Bluetooth: hci: Fix Create Connection Cancel assert
Since the LE (Enhanced) Connection Complete that comes as part of
cancelling a connection does not come through the priority rx thread in
hci_driver.c, the event class was not being calculated and cached.
Hence, calculate and cache the class whenever an event is received as
part of invoking a command.

Fixes #20110.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-10-24 20:33:59 +02:00
Vinayak Kariappa Chettimada 09088d856f Bluetooth: controller: split: Fix conn RSSI initial value
On connection callback generated by host, application
reading the RSSI value by using HCI LE Read RSSI Command
received -127 dB as the first connection event has not
occured yet in order to measure the RSSI value.

Fix this by using the RSSI value of received advertising
PDU by the initiator, and using the RSSI value of the
received CONNECT_REQ PDU by the connectable advertiser as
the initial value at connection setup.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-22 13:19:26 +02:00
Vinayak Kariappa Chettimada 4cc3cab9c7 Bluetooth: controller: legacy: Fix conn RSSI initial value
On connection callback generated by host, application
reading the RSSI value by using HCI LE Read RSSI Command
received -127 dB as the first connection event has not
occured yet in order to measure the RSSI value.

Fix this by using the RSSI value of received advertising
PDU by the initiator, and using the RSSI value of the
received CONNECT_REQ PDU by the connectable advertiser as
the initial value at connection setup.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-22 13:19:26 +02:00
Vinayak Kariappa Chettimada 9c14567ce2 Bluetooth: controller: Fix conn update to be cacheable
Fix connection update procedure to be cacheable if any other
local or remote control procedure is in progress.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-22 13:18:56 +02:00
Vinayak Kariappa Chettimada fcd9612016 Bluetooth: controller: split: Fix incorrect MD bit value
MD bit was set based on whether a memq link's next pointer
being NULL, instead the check should be that the  memq has
more elements.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-21 13:01:26 +02:00
Vinayak Kariappa Chettimada 8ada121b68 Bluetooth: controller: split: Fix slave latency enable
Fix regression in porting slave latency, slave latency
enabled was not used, cause slave latency to be applied
before first packet being acknowledged by the master.

Regression in commit 5dff214d57 ("Bluetooth: controller:
split: Fix missing slave latency impl.").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-21 10:21:30 +02:00
Ulf Magnusson 72fb847a25 bluetooth: kconfig: Remove unused BT_CTLR_LOWEST_PRIO symbol
Added in commit 1475402d41 ("Bluetooth: controller: Introduce ULL LLL
architecture"), then never used.

Found with a script.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-18 19:43:47 +02:00
Vinayak Kariappa Chettimada 3d4aef8f99 Bluetooth: controller: split: Stop pre-empt timer
Add pre-empt timer stop when a prepare is executed so that
when the pipeline has another event queued, the firing of
the pre-empt timer does not pre-empt the just executed
prepare.

Relates to #19685.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-16 16:00:36 +02:00
Vinayak Kariappa Chettimada 4d4fb8e301 Bluetooth: controller: split: Fix ticks slot used on conn update
Fix incorrectly calculated ticks slots for a connection on
connection update. The reservation incorrectly included the
prepare offset.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-15 16:04:05 +02:00
Vinayak Kariappa Chettimada fca32e41e6 Bluetooth: controller: Fix DLE for remote unsupported Coded PHY
Fix Data Length Procedure to use Feature Exchange values to
send correct parameters based on whether Coded PHY is
supported by remote peer.

Relates to BT TS.5.1.1 tests:
LL/CON/MAS/BV-129-C
LL/CON/MAS/BV-130-C
LL/CON/SLA/BV-132-C
LL/CON/SLA/BV-133-C

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-15 13:26:29 +02:00
Vinayak Kariappa Chettimada af696bdd4c Bluetooth: controller: split: Fix ctrl proc rx node starvation
Rx nodes are reserved during control procedures for
generation of HCI event on completion. Fix the allocation
and reservation in the form of a linked list per connection
context. Worst case, this list will hold one rx node for
overlapping non-instant control procedure (Data Length
Update) plus two rx node for control procedure with instant
(PHY update with Data Length Update support).

Fixes #19198.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-14 11:25:10 +02:00
Carles Cufi 6c34983ed2 Bluetooth: controller: Handle remote version as a prio event
The remote version information event needs to be processed by the
prio_recv_thread() thread in order to unblock the Host RX thread
(effectively hci_driver's recv_thread()) when it blocks waiting for a
response to a remote version information.

Add the same time gate the inclusion of the feature behind a new Kconfig
option: CONFIG_BT_REMOTE_INFO.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-10-11 13:31:52 +02:00
Carles Cufi b37be1c0c5 Bluetooth: controller: Introduce a new LLCP class
In order to be able to distinguish between connection-related events
that are generated by the controller and others genrated by LL control
procedures, introduce a new class for LLCP.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-10-11 13:31:52 +02:00
Carles Cufi 058724f329 Bluetooth: controller: Optimize calls to hci_get_class()
Cache the result of calling hci_get_class() to avoid repeatedly invoking
it on the same data. In order to cache it we take advantage of the fact
that both radio_pdu_node_rx_hdr and node_rx_hdr are not packed
structures and they currently have a spare padding byte (between type
and handle).

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-10-11 13:31:52 +02:00
Carles Cufi 9c32a6d287 Bluetooth: controller: hci: Obtain pdu_data using a macro
Hide the details of obtaining a pointer to the PDU data from a node_rx
structure to simplify the code.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-10-11 13:31:52 +02:00
Carles Cufi db5e6f861d Bluetooth: controller: Further trim connection-related code
Conditionally compile additional code that is only relevant when
enabling connections.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-10-11 13:31:52 +02:00
Wolfgang Puffitsch 34b95feb54 Bluetooth: controller: split: Call LLL reset functions from ll_reset
Call LLL reset functions when calling ll_reset to avoid carrying LLL
state across HCI resets. Respective functions already exist in LLL but
had not been called from anywhere.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-10-11 08:58:33 +02:00
Vinayak Kariappa Chettimada d12c53f89f Bluetooth: controller: split: Fix missing data len update event
Fix missing generation of data length update HCI event when
effective tx and rx timings change due to PHY update
procedure.

Fixes BT LL TS 5.1.0 test:
LL/CON/MAS/BV-52-C [Master Receiving Data, LE Coded, CI
Change]

Relates to #17097.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-10 12:13:54 +02:00
Vinayak Kariappa Chettimada 186a584d0a Bluetooth: controller: split: cond. compile job disable
When ULL High and ULL Low are not at same execution priority
level, it is not necessary to disable ULL Low execution when
updating ticker using stop and start. Also, ULL Low need not
be disable inside Radio Events. This commit corrects some of
the conditional compiles.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-10 12:12:47 +02:00
Vinayak Kariappa Chettimada b71eb71de7 Bluetooth: controller: Fix Kconfig conditional optionals
Fix Kconfig conditional include of Minimum Channels Used
and Channel Selection Algorithm #2.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-09 15:53:14 +02:00
Wolfgang Puffitsch 537f06a532 Bluetooth: controller: split: Add hook for flushing in LLL
Add hook for flushing in LLL to allow clean-up of LLL-specific
resources.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-10-09 13:17:58 +02:00
Vinayak Kariappa Chettimada d534492bf9 Bluetooth: controller: Fix ticker previous slot value
Fix ticker previous slot value with elapsed ticks value from
the time stopped ticker has expired. When a ticker is
stopped, if it was in its reserved time space, then the
currently occupied slot (was set to 0) should be the amount
of time that has elapsed in the expired and stopped ticker's
reserved time space and beyond until the stop.
This is required to ensure that any other new ticker does
not get scheduled over the stopped ticker's reserved time
space.

Fixes #19515.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-09 09:19:32 +02:00
Vinayak Kariappa Chettimada a1945db08a Bluetooth: controller: Support Zero Latency IRQs
Add support for Zero Latency IRQs, which avoids any Zephyr
OS or application influenced ISR latencies on the
controller's ISRs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-09 09:19:18 +02:00
Vinayak Kariappa Chettimada 3096c0e741 Bluetooth: controller: split: Support Zero Latency IRQs
Add support for Zero Latency IRQs, which avoids any Zephyr
OS or application influenced ISR latencies on the
controller's ISRs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-09 09:19:18 +02:00
Vinayak Kariappa Chettimada 1e20009212 Bluetooth: controller: Add Zero Latency IRQ Kconfig
Add a Kconfig option to enable use of Zero Latency IRQs in
the controller.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-09 09:19:18 +02:00
Thomas Ebert Hansen 392d3a864a Bluetooth: controller: Fix endianness for length update.
Fix endianness when accessing length update parameters over HCI

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2019-10-08 11:38:55 +02:00
Morten Priess 90fabfd96b bluetooth: controller: Prevent unnecesary ticker "must expire"
When running a ticker node as "must expire", the node would invoke the
ticker callback even when programmed with latency. As "must expire" is
intended for scheduled events which are skipped due to collision, and as
such expected by LLL, purposefully skipped events should not generate
"must expire" callbacks.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-10-08 11:37:58 +02:00
Vinayak Kariappa Chettimada 786bed70ac Bluetooth: controller: split: Fix central_hr sample compilation
Fix ULL implementation that uses conditional compilation by
replacing back to use of #if defined(...) in code accessing
compiled out struct members.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 21:46:13 +02:00
Vinayak Kariappa Chettimada 1d00072bdc Bluetooth: controller: split: Fix flushing Tx buffers in ULL
Fix for possible Tx Buffer leak during disconnection when
the buffers are in ULL context and not yet enqueued towards
LLL context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 20:29:29 +02:00
Vinayak Kariappa Chettimada aa38b2298c Bluetooth: controller: split: Fix for Tx Buffer Overflow error
When more than one simultaneous connections are active,
transmitting data packets to peer, a termination causes
host to use the flushed pending number of completed packets
count for other active connections. This is on reception
of HCI disconnection complete event. But the controller has
not yet released any of the pending enqueued Tx buffers
which was happening after the disconnection event was
dispatched to HCI layer.

The fix here is to dispatch the disconnection complete event
from the LLL context after pending Tx buffers have been
flushed and the buffers get returned to Tx pool in the ULL
context. This way buffers are in the Tx pool before host
get to process the disconnection complete event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 20:29:29 +02:00
Vinayak Kariappa Chettimada 203b5859a1 Bluetooth: controller: split: Fix flushing Tx buffers in HCI
Fix for possible Tx Buffer leak during disconnection when
the buffers are in HCI thread context  and not yet demux-ed
and enqueued towards LLL context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 20:29:29 +02:00
Vinayak Kariappa Chettimada 7d49726498 Bluetooth: controller: split: Fix LLL Tx flush to be immediate
Fix the mayfly scheduling of the Tx buffer flushing on
connection termination to be immediate (not to tailchain).

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 20:29:29 +02:00
Krzysztof Chruscinski ec6b7e780b bluetooth: controller: Align nrf link layer to new clock control API
Align to use clock_control_get_status for blocking clock start.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-10-04 17:15:39 +02:00
Joakim Andersson 4d59ef306b Bluetooth: controller: Check if enc procedure is in progress
Check if the encryption procedure is in progress when receiving
rejection for the procedure.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-10-04 15:10:45 +02:00
Joakim Andersson 4135fb55f1 Bluetooth: controller: Fix rejected enc procedure not terminated
Fix issue in the handling of LL_REJECT_EXT_IND packets, this would look
at the procedures that are enqueued, and not the procedure that was
being rejected. This meant that although a reject was received for the
encryption procedure, the handling for a different control procedure was
run.
This would result in the link being terminated as control procedure
timer would time out for the encryption procedure.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-10-04 15:10:45 +02:00
Vinayak Kariappa Chettimada 6f7f5153db Bluetooth: controller: split: Fix radio abort race condition
When aborting radio event, there is a possibility that the
packet timer would start the radio while the packet timer
is being reset. Hence, perform a second radio state disable
with packet timers uninitialised.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 12:44:46 +02:00
Vinayak Kariappa Chettimada 20e385e675 Bluetooth: controller: split: Fix missing radio status reset
Fix missing radio status and configurations reset on radio
event abort. This caused under race conditions the radio
being put into active state after being aborted.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 12:44:46 +02:00
Vinayak Kariappa Chettimada 8d8d6a7608 Bluetooth: controller: split: Fix incorrect mayfly caller id
Fix incorrect ticker/mayfly user id used in scheduling the
abort of a radio event. Incorrect use of thread context as
the caller caused the abort function to be scheduled from
thread context while being called from ULL high context
level in reality. This could cause corruption of mayfly
scheduling.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 12:44:46 +02:00
Vinayak Kariappa Chettimada 848015854a Bluetooth: controller: split: Fix flash driver co-operation
When flash driver requests abort of radio event in unreserved
time space, resume radio events in the pipeline were not
flushed. These resumed events caused flash driver to assert
on the check whether radio was in use.

Fixed by flushing the pipeline of all radio events, resume
and also those events in pipeline with pre-empt timeout
being setup.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 12:44:46 +02:00
Vinayak Kariappa Chettimada 9d6c170e22 Bluetooth: controller: split: Fix advertising for multiple peripherals
When multiple simultaneous peripheral connections are
supported, restarting connectable advertising by host on
peripheral connection establishment failed in controller.
This prevented establishing new connections while first
connection was active.

The failure was caused by a bug in the way controller was
using quota for Rx PDU buffers. As the quota count was
release before the connection complete event rx PDU buffer
being released, the Rx PDUs needed to reserve for
connection complete event for new connectable advertising
was not available. This caused the connectable advertising
enable to fail.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 12:44:00 +02:00
Vinayak Kariappa Chettimada 5dff214d57 Bluetooth: controller: split: Fix missing slave latency impl.
Port the missing slave latency implementation from legacy
controller.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-10-04 12:43:24 +02:00
Wolfgang Puffitsch 799b46e35e Bluetooth: controller: Use entropy driver directly in bt_rand
Use entropy driver directly in bt_rand instead of stitching together
calls to sys_rand32_get to improve efficiency. The use of
sys_rand32_get could also leak timestamps into keys.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-10-02 13:21:24 +02:00
Morten Priess 70cbf342ff bluetooth: controller: RX PDU meta data support in LLL
Added support for vendor specific meta data in LLL node_rx_hdr. This
enables vendors to add "footer" data to the RX PDU, for supporting
specialized BLE features.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-10-02 13:20:50 +02:00
Joakim Andersson 3920844842 Bluetooth: Host: Fix usage of re-using Bluetooth log buffers
Fix calling bt_hex and bt_addr_le_str multiple times in the same logging
call could result in string overwritten since log_strdup is not
guaranteed to duplicate the string buffer in all logging configurations.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-09-30 17:47:43 +02:00
Morten Priess c1038de6e8 bluetooth: controller: Add vendor operations to TICKER_USER_ULL_HIGH_OPS
Added to allow vendor specific increase of user operation capacity for
ULL_HIGH, to support queuing additional ticker operations.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-09-30 13:04:17 +02:00
Morten Priess cd07fe94d6 bluetooth: controller: Use ticker must_expire to ensure ADV timing rand
Enabled use of ticker must_expire feature for ensuring ADV timing
randomization, even when ADV doesn't get air-time. This reduces ADV
collisions. Not active for nRF51 platform for now.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-09-30 12:52:52 +02:00
Morten Priess 5ce4df2a67 bluetooth: controller: Connection meta property support in LLL
Added support for vendor specific meta data in LLL conn object. This
enables vendors to add state data to connection, for supporting
specialized BLE slave features.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-09-30 12:52:33 +02:00
Vinayak Kariappa Chettimada c38e2ee61a Bluetooth: controller: Fix refactored SWI regression
Fix regression introduced in refactoring of use of SWI.
Reduced use of SWI cannot be used in combination with
CONFIG_BT_CTLR_LOW_LAT as additional SWI is required
to split ticker WORKER and JOB contexts in order to
disable JOB but keep WORKER enabled.

Regression introduced in commit 78b461ae3e ("Bluetooth:
controller: Refactor use of SWI").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-30 12:25:10 +02:00
Vinayak Kariappa Chettimada 571809009e Bluetooth: controller: Fix legacy for TICKER_COMPATABILITY_MODE
When not using ticker compatibility mode in legacy
controller, ticker job should not be disabled inside radio
events.

Ticker compatibility mode was introduced in
commit 3a9173afe1 ("bluetooth: controller: Revised ticker
for improved conflict resolution").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-25 11:53:38 +02:00
Andrzej Głąbek 35754375bc soc: nordic: Get rid of nrf_common.h
This file contains redundant definitions of a bunch of nRF IRQ numbers
(not all, however) that only generates confusion, as enumeration values
provided by MDK can be used instead.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-09-24 16:20:16 +02:00
Andrzej Głąbek 57c6cfc9cd nordic: Use hal/ in all inclusions of nrfx HAL header files
Header files of nrfx HALs are not supposed to be included directly
but only with their names prepended with the hal/ directory (so that
an inclusion of an nrfx HAL header clearly differs from an inclusion
of an nrfx driver header).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-09-24 16:20:16 +02:00
Vinayak Kariappa Chettimada f965b9c685 Bluetooth: controller: Fix DLE event on PHY update
Fix HCI Data Length Update event generation on PHY update
procedure, i.e. preserve Data Length Parameters on PHY
update.

Fixes BT LL.TS.5.1.1 tests:
LL/CON/MAS/BV-126-C
LL/CON/MAS/BV-127-C
LL/CON/SLA/BV-129-C
LL/CON/SLA/BV-130-C

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-24 10:37:44 +02:00
Vinayak Kariappa Chettimada 5ef52da005 Bluetooth: controller: Fix mayfly optimization
Fix incorrect reset of mayfly pended flag. This fix reduces
CPU use by mayfly.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-24 10:37:23 +02:00
Ioannis Glaropoulos 3bf872110d bluetooth: controller: nRF52811: fix LE Coded S2 Radio Timings
The nRF52811 Radio is similar to nRF52840 and exhibits
similar Radio Timings constants. We align the LE Coded
PHY (S2) RX chain delay with that of nRF52840, which,
eventually fixes the TIFS for nRF52811. In nRF52840 we
correct the inline comment only.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-24 09:02:15 +02:00
Vinayak Kariappa Chettimada 3202f91748 Bluetooth: controller: Fix to reject invalid enable command
Fix to reject invalid advertise and scan enable commands.

Fixes BT HCI.TS.5.1.1 tests:
HCI/DDI/BI-06-C
HCI/DDI/BI-07-C

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-24 08:15:56 +02:00
Vinayak Kariappa Chettimada 0ef062407c Bluetooth: controller: split: Fix to reject invalid enable command
Fix to reject invalid advertise and scan enable commands.

Fixes BT HCI.TS.5.1.1 tests:
HCI/DDI/BI-06-C
HCI/DDI/BI-07-C

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-24 08:15:32 +02:00
Ioannis Glaropoulos 5692ee17ed bluetooth: controller: replace SOC_NRF52840 in ifdef blocks for Coded
We have introduced option HAS_HW_NRF_RADIO_BLE_CODED, which
reflects that an nRF SoC has a Radio with LE Coded PHY
capabilities. We now modify all #ifdef expressions for
Coded PHY in the nRF controller port, removing SOC_NRF52840
and adding this new option instead. This allows to build
an nRF controller with Coded PHY support for SOCs other
than nRF52840.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-23 10:50:01 +02:00
Ioannis Glaropoulos b2809ff769 bluetooth: controller: enable Coded PHY support for nRF52811
Nordic nRF52811 SoC has a 2.4GHx Radio which supports
LE Coded PHY, so we add the option to build a BLE
Controller for nRF52811 platforms with LE Coded PHY
support.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-23 10:50:01 +02:00
Vinayak Kariappa Chettimada bfd393ac62 Bluetooth: controller: legacy: Ensure that a case statement is present
When compiling a sample like a beacon, none of the `if defined()`
statements in the switch case are actually compiled in, so the compiler
complains of an orphan mem_release();break; sequence.
Add a type that we know will always be compiled in in order to avoid
this issue.

Relates to commit 76bfea7cf9 ("Bluetooth: controller: Ensure that a
`case` statement is present").

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-18 20:56:43 +02:00
Vinayak Kariappa Chettimada 28f46131b3 Bluetooth: controller: split: Fix Rx reserved for conn cmplt
When both central and peripheral are supported, one each Rx
node will be needed by connectable advertising and the
initiator to generate connection complete, hence
conditionally set the count.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-16 21:46:35 +02:00
Vinayak Kariappa Chettimada 78b461ae3e Bluetooth: controller: Refactor use of SWI
Refactor to abstract the use of software interrupts in nRF5
Series.

Also, reduce the number of SWI used when interrupt priority
level configured is same for ULL High and ULL Low contexts.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-16 19:06:51 +02:00
Ioannis Glaropoulos ee85f248fc bluetooth: controller: abstract PPI handling for LE Coded
This commit completes the refactoring of radio.c, so it
calls abstract functions for PPI handling for LE Coded
PHY (e.g. enable, disable channels, or configure endpoints),
which, then, call the platform-specific functions for PPI
handling. The abstract functions are simple wrappers,
implemented in radio_nrf5_ppi.h, conditionally, if we
build the controller with support for LE Coded PHY.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-16 19:06:51 +02:00
Ioannis Glaropoulos f754ee4aa8 bluetooth: controller: conditionally define macros for LE Coded PHY
Make the definitions of LE Coded PHY-specific macros
and inline functions conditional, i.e. only if we
actually build the controller with support for LE
Coded PHY.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-16 19:06:51 +02:00
Ioannis Glaropoulos dc3e9b1755 bluetooth: controller: abstract PPI handling functions
This commit refactors radio.c, so it calls abstract functions
for PPI handling (e.g. enable, disable channels, or configure
endpoints), which, then, call the platform-specific functions
for PPI handling. The abstract functions are simple wrappers,
implemented in radio_nrf5_ppi.h.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-16 19:06:51 +02:00
Ioannis Glaropoulos d72d4f356d bluetooth: controller: define generic macros for LLL, ULL LOW IRQs
This commit defines generic macros for the software interrupt
(SWI) IRQ lines that are used for LLL and ULL LOW interrupts.
This is done for both the cases of the legacy and new (split)
controller architectures. In addition, it abstracts some of
the functionality around software-IRQ signals, to generic
functions, which have platform-specific implementations.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-16 19:06:51 +02:00
Kristoffer Rist Skøien c58af2b686 Bluetooth: Controller: Typo in Kconfig
Changed documentation in Bluetooth Controller
Kconfig for BT_CTLR_ASSERT_HANDLER

Signed-off-by: Kristoffer Rist Skøien <kristoffer.skoien@nordicsemi.no>
2019-09-10 08:32:02 -05:00
Stephanos Ioannidis 9b0e738e37 bluetooth: controller: Explicitly include toolchain.h.
This commit adds an explicit inclusion of toolchain.h from pdu.h.

The endianness preprocessor definitions (__BYTE_ORDER__,
__ORDER_LITTLE_ENDIAN__, __ORDER_BIG_ENDIAN__) are used by pdu.h;
these being not defined can easily go unnoticed and cause unexpected
behaviours, as detailed in PR #18922.

toolchain.h ensures that these preprocessor definitions are defined and
*must* be included in a file that uses these definitions.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2019-09-09 21:40:54 +02:00
Morten Priess d62ad4117c bluetooth: controller: Added function to support RX link quota update
Added ll_rx_link_inc_quota to allow vendor to manipulate
mem_link_rx.quota_pdu when cleaning up nodes via ull_vendor.h.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-09-08 12:39:09 +02:00
Vinayak Kariappa Chettimada a28eba9897 Bluetooth: controller: Fix data PDU leak during ctrl PDU defer
Fix a bug where in tx data PDU enqueued, while a ctrl PDU is
deferred due to Encryption setup being in progress, is
leaked causing HCI Tx Buffer Overflow crash.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-07 17:10:22 +02:00
Vinayak Kariappa Chettimada af5bcf354a Bluetooth: controller: Fix start encryption in progress check
Fix check in start encryption to disallow new encryption
setup while there is one already in progress.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-07 17:10:22 +02:00
Vinayak Kariappa Chettimada 7872b733d1 Bluetooth: controller: Fix Re-encryption procedure
Fix MIC failure on re-encryption procedure when responding
at the same time to peer initiated feature request.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-07 17:10:22 +02:00
Vinayak Kariappa Chettimada 46d5554664 Bluetooth: controller: Fix ENC_REQ PDU retransmission
Fix dropped ENC_REQ PDU when retransmitting, if slave was
not listening or nack-ed it.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-07 17:10:22 +02:00
Vinayak Kariappa Chettimada 6991d09977 Bluetooth: controller: Fix control tx queue handling
Fix control tx queue handling to correctly pause control PDU
responses during encryption setup.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-07 17:10:22 +02:00
Vinayak Kariappa Chettimada 1d978e8856 Bluetooth: controller: Add data length procedure queueing
Added implementation to cache Data Length Procedure when
another control procedure is in progress.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-07 17:10:22 +02:00
Vinayak Kariappa Chettimada 2e365424f0 Bluetooth: controller: Defer encryption setup if in conn update
Workaround, defer peer initiated encryption while local
initiated procedure with instant is not complete. Peer
master has sent CONN_UPDATE_IND in response to
CONN_PARAM_REQ, and also has initiated a Encryption Setup
thereafter. In this case, avoid corruption of the connection
update context by deferring the Encryption Setup.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-07 17:10:22 +02:00
Vinayak Kariappa Chettimada 3f695f7823 Bluetooth: controller: Fix cmd disallowed and collision disconnects
Fix implementation to correctly cache the control procedures
initiatable by local and peer. And, fix feature exchange and
version information procedures from being disallowed by
having then as cached requests to the controller.

Relates to #15256.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-07 17:10:22 +02:00
Ioannis Glaropoulos 1d45a2fe77 bluetooth: controller: minor fixes in inline comments
Several minor fixes to inline comments of #ifdef .. #endif
blocks.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-07 14:18:36 +02:00
Ioannis Glaropoulos 98356a14b7 bluetooth: controller: remove redundant header inclusions
nrf_timer.h and nrf_ppi.h are included by including
radio_nrf5.h, so we do not need to include them in
radio.c.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-07 14:18:36 +02:00
Vinayak Kariappa Chettimada 73bf27f243 Bluetooth: controller: split: Fix crash on terminate
Remove incorrect LL_ASSERT check in Lower Link Layer that
checked for invalid connection handle on reception of PDU.
The assert is not needed as PDUs can be received until the
Upper Link Layer is aware of the acknowledgement of the
terminate ind PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-09-03 13:56:12 +02:00
Vinayak Kariappa Chettimada 0d766c668d Bluetooth: controller: split: Fix PDU handling on terminate
Fix handling of Rx-ed PDU on termination, do not process
Rx-ed control PDUs and release the PDU buffer back to the
free pool.

Without this fix, Rx-ed control PDU was responded with a
Tx PDU, which did not get acknowledged or released.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-31 17:04:29 +02:00
Wolfgang Puffitsch e8e668ae9c Bluetooth: controller: Fix endianness for length update.
Fix endianness when accessing length update parameters in PDU.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-08-28 13:03:39 +02:00
Vinayak Kariappa Chettimada 3f894250ef Bluetooth: controller: Fix Enc setup reset on rejection
Fix reset of Encryption Procedure state on reception of
REJECT_IND and REJECT_EXT_IND.

This is a regression in commit 79cb615770 ("Bluetooth:
controller: split: Port Enc setup to be queueable")

Relates to #18578.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-28 12:07:40 +02:00
Vinayak Kariappa Chettimada 385b82dcef Bluetooth: controller: split: Fix data pause on Enc Req enqueue
Fix the controller implementation to handle data packet
enqueue being pause on Encryption Request be done early in
the ULL when enqueueing packets towards LLL.

Fixes #18645.

Signed-off-by: Vinayak Kariappa Chettimada <vinayak.chettimada@gmail.com>
2019-08-27 15:13:38 +02:00
Erik Brockhoff a4bd5b6835 bluetooth: controller: Fixing race re. adv disable in HDC
Re. issue "BT LL assert on LL/CON/ADV/BV-04-C #18584"

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2019-08-23 18:26:13 +02:00
Vinayak Kariappa Chettimada 1751648db0 Bluetooth: controller: split: Fix Enc setup reset on rejection
Fix reset of Encryption Procedure state on reception of
REJECT_IND and REJECT_EXT_IND.

This is a regression in commit 79cb615770 ("Bluetooth:
controller: split: Port Enc setup to be queueable")

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-22 16:40:46 +02:00
Vinayak Kariappa Chettimada 73f0fa3727 Bluetooth: controller: split: Tx cleanup and comments
Post Tx pool corruption fix, clean up code and add comments
explaining the use of Tx node next field used to indicate
the Tx node's allocation from Control or Data pool.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-22 14:34:04 +02:00
Vinayak Kariappa Chettimada bdcec8418f Bluetooth: controller: split: Fix Tx FIFO, queue, and pool corruption
Fix the Tx FIFO, queue and pool corruption due to missing
release of link object to Tx link pool and hence missing
reset of the per connection initially allocated Tx link
free pointer.

The bug caused Tx PDUs and associated memory to be lost
leading to missing L2CAP segment transmissions. With lost
control PDU buffers, ULL would stall processing Done events
also leading to controller asserts.

Fixes #18546.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-22 14:34:04 +02:00
Vinayak Kariappa Chettimada 07460176ed Bluetooth: controller: split: Fix control flow issues
This fixes reported Coverity CID 203393 control flow issues.

Fixes #18381.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-20 14:17:26 +02:00
Morten Priess 69ff0f310e bluetooth: controller: Fix for uninitialized data compile error
Due to conditional compile path ending in LL_ASSERT(0), the compiler
sees code following the assert as using uninitialized variables.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-08-19 13:05:19 +02:00
Morten Priess c635f4cb6d bluetooth: controller: Fix for coverity CID 203524
Fixes coverity issue: [Coverity CID :203524] Incorrect expression in
/subsys/bluetooth/controller/ticker/ticker.c #18382

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-08-19 11:26:20 +02:00
Carles Cufi cb700d0e12 Bluetooth: controller: Disable AE by default
Disable Advertising Extensions by default, since they are not really
operational and they take RAM.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-08-15 15:07:12 +02:00
Carles Cufi 76bfea7cf9 Bluetooth: controller: Ensure that a case statement is present
When compiling a sample like a beacon, none of the `if defined()`
statements in the switch case are actually compiled in, so the compiler
complains of an orphan mem_release();break; sequence.
Add a type that we know will always be compiled in in order to avoid
this issue.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-08-15 15:07:12 +02:00
Vinayak Kariappa Chettimada 5d30d49f88 Bluetooth: controller: Fix ifdef block comment
Fix a minor incorrectly commented ifdef block.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-15 11:53:59 +02:00
Vinayak Kariappa Chettimada 3e0e378dca Bluetooth: controller: split: Fix pipeline for continuous events
Fix the pipeline prepare-resume implementation to correctly
handle multiple continuous events that request resume on
being pre-empted.

Symptoms of the bug being, when having continuous scanning,
and an active peripheral if a directed advertising is
started the peripheral event are not scheduled causing link
supervision timeout.

This is fixed by not having an enqueued resume event
prepared if there is an enqueued new non-resume event in the
pipeline.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-11 16:42:52 +02:00
Vinayak Kariappa Chettimada d90f3db3bc Bluetooth: controller: split: Increase pipeline size
Increase pipeline size to accommodate probable multiple
prepare for directed advertising events, with reserved time
which are shorter than prepare duration, being enqueued.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-11 16:42:52 +02:00
Vinayak Kariappa Chettimada e4ae7b8818 Bluetooth: controller: split: Increase event start overhead time
Increase the event start overhead time to accommodate for
processing time for dequeueing pipeline in Upper Link Layer.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-11 16:42:52 +02:00
Vinayak Kariappa Chettimada f6799ff57e Bluetooth: controller: split: Reduce event done queue size
Reduce the maximum number of pending event done elements by
decoupling it from the maximum pipeline elements.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-08-11 16:42:52 +02:00
Joakim Andersson 50b28c010d Bluetooth: controller: Fix assert in RPA timeout for advertiser
Fix assert in the RPA timeout when no resolving entry exists in the
resolving list, and the advertiser was requested to use a local IRK
to generate it's own address.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-08-07 20:49:49 +02:00
Morten Priess 3a9173afe1 bluetooth: controller: Revised ticker for improved conflict resolution
Changed ticker behavior to resolve conflicts in ticker_worker instead of
in ticker_job. This allows better real-time slot allocation, as well as
allowing callbacks even if ticker node doesn't get air-time (for audio
stream housekeeping). A priority property now also allows prioritizing
one ticker node over others.
Compatibility mode enables lagacy ticker behavior if needed.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-08-07 13:52:48 +02:00
Joakim Andersson bd89cc3f4d Bluetooth: Controller: Fix privacy advertiser connect peer address type
Fix an issue with enhanced connection complete event raised by the
advertiser role. The advertiser reported that it has resolved the
the identity address of the peer, even when the peer is connecting
using it's identity address.
The host will not have the correct on-air address type i.e public.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-08-06 14:53:33 +02:00
Vinayak Kariappa Chettimada 09c1c9e800 Bluetooth: controller: Decorrelate address generation from resolution
Changes related to Bluetooth TSE 11068.

This is done because the current test suite does not issue
an LE Enable Address Resolution command anymore in RPA
generation tests. Makes sense now that the Bluetooth SIG has
agreed to completely decouple address resolution from
generation.

Fixes BT LL TS 5.1.0 test:
LL/SEC/ADV/BV-03-C [Privacy - Non-connectable Undirected
Advertising, Resolvable Private Address]

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-31 15:22:49 +02:00
Vinayak Kariappa Chettimada 20ccdab445 Bluetooth: controller: split: Fix pipeline prepare/resume loop
Fix the pipeline prepare or resume dequeue loop from
overflow. Fixes premature exit of dequeue of done FIFO
which caused the pipeline to overflow due to previously
placed done is not dequeued correctly and next event not
being put back into the pipeline.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-30 12:57:02 +02:00
Wolfgang Puffitsch c5c3a46824 Bluetooth: controller: Settings for company_id and subversion_number.
Enable use of settings system in controller and introduce settings for
company_id and subversion_number.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-07-23 10:58:03 +02:00
Vinayak Kariappa Chettimada 6cf26b8fe6 Bluetooth: controller: Make ULL/LLL split the default
Make the Upper and Lower Link Layer split architecture
implementation of the controller as the default when
building Zephyr Bluetooth Low Energy controller support
in applications.

Noticeable missing feature (porting) in comparison to old
architecture implementation is, Advanced scheduling of
connection events.

The missing features will subsequently be submitted
upstream.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-22 14:23:42 +02:00
Vinayak Kariappa Chettimada f4eb03c538 Bluetooth: controller: Rename BT_LL_SW to BT_LL_SW_LEGACY
Rename the controller Kconfig option BT_LL_SW to
BT_LL_SW_LEGACY in preparation towards switch to new Link
Layer implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-22 14:23:42 +02:00
Vinayak Kariappa Chettimada 60bf4da4aa Bluetooth: controller: split: Conditional compile LL Rx pool use
Conditional compile the use of Rx Pool used to dispatch ULL
context generated messages towards LL thread context, which
is presently only used in connections.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-22 12:34:49 +02:00
Vinayak Kariappa Chettimada 04f351ac0a Bluetooth: controller: Fix cond compile of DLU event generation
Fix the conditional compile of Data Length Update event
generation on PHY Update Procedure when Data Length
Extensions are not supported.

The regression was introduced in
commit 70a89876d0 ("Bluetooth: controller: Fix missing
data length update event")

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-18 14:20:32 +02:00
Vinayak Kariappa Chettimada da431f2a7d Bluetooth: controller: split: Handle zero length L2CAP start frame
Added a fix to handle L2CAP start frame with payload length
of zero which otherwise sent zero length data start PDU on
air.

Relates to #17046.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-17 15:07:52 +02:00
Vinayak Kariappa Chettimada a081e001b0 Bluetooth: controller: split: Fix PHY update proc symmetric rsp
Fix PHY update procedure to correctly handle master
requesting asymmetrical and slave symmetrical.

Fixes BT LL TS 5.1.0 conformance test:
LL/CON/MAS/BV-117-C [PHY Update Procedure - Master
Requests Asymmetrical, Slave Symmetrical]

Relates to #17097.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-17 14:46:49 +02:00
Vinayak Kariappa Chettimada ae8628d089 Bluetooth: controller: split: Fix packet timing restrict reset
Fixed a bug related to missing reset of packet timing
restriction variable.

Fixes BT LL TS 5.1.0 test:
LL/CON/SLA/BV-55-C [Initiating PHY Update Procedure - Packet
Time Restrictions, LE Coded]

Related to #17097.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-17 14:45:49 +02:00
Wolfgang Puffitsch 845064bb31 Bluetooth: controller: hci: Add user hooks.
Add hooks for processing of HCI user events on the controller side.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-07-17 13:53:13 +02:00
Wolfgang Puffitsch e54a7ba324 Bluetooth: controller: hci: Add some documentation for encode_control().
No functional change.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2019-07-17 13:53:13 +02:00
Vinayak Kariappa Chettimada e0965fa53c Bluetooth: controller: Update Bluetooth version to 5.1
Update the Bluetooth HCI Version to 5.1.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-16 12:53:10 +02:00