Commit graph

83 commits

Author SHA1 Message Date
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 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
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 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 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
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 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
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 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 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
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 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 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
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 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 3aa57808ac Bluetooth: controller: split: Add interface to get adv/scan handle
Added interface to get Advertiser and Scanner instance
handle for use in Lower Link Layer module.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-04 09:46:49 +02:00
Morten Priess 14537fee9d bluetooth: controller: Moved ull_entropy_get to LLL
Moved and renamed ull_entropy_get to lll_entropy_get, placed under
vendor specific ll_sw. This is needed for SW implemented entropy,
to allow vendor implementation of faster, less secure random number
generator for randomizing ADV timing.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-06-20 10:30:28 +02:00
Vinayak Kariappa Chettimada 79cb615770 Bluetooth: controller: split: Port Enc setup to be queueable
Port the fix for the controller implementation to make start
encryption queueable if there is any control procedure in
progress.

Refer to #15335.
Relates to #15335, #15186, #15958 and #14636.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-06-06 10:34:13 +02:00
Joakim Andersson 9e96df39f2 Bluetooth: controller: Fix compilation without broadcaster or observer
Fix compilation issues in central_hr or peripheral_hr sample when using
split LL and privacy is enabled.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-05-24 12:00:12 -04:00
Vinayak Kariappa Chettimada b928cef69c Bluetooth: controller: split: Port h/w privacy feature
Ported h/w based LL privacy to ULL/LLL split architecture.

Fixes #14675.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-05-24 12:00:12 -04:00
Asger Munk Nielsen 58e9ac6811 bluetooth: Controller: Refactor node_rx footer to avoid ptr arithmetic
The old footer was appended after PDU using pointer arithmetic. Now
the footer fields have been moved to the header struct, the
footer fields are now statically located in the data structure,
this is type safe and fields can be referred to by their actual
names rather than indirectly through reference to other members,
thus avoiding pointer arithmetic. Secondly, this change will pave
the way for adding other meta data in the future.

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2019-05-14 10:56:16 +02:00
Vinayak Kariappa Chettimada 9602a690bd Bluetooth: controller: Fix incorrect data type use in slot calc
Fix incorrect data type used in calculation of slot_us
detected by compiler, and reported as possible integer
overflow.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-05-06 14:41:58 +02:00
Vinayak Kariappa Chettimada b8c2c7e71a Bluetooth: controller: ull/lll: Increase adv random delay resolution
Increase the resolution of advertising random delay from
1 ms unit to 1 ticker unit.

Relates to #10289, #10391, and #10398.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-05-03 08:33:13 -04:00
Erik Brockhoff 1090b45225 bluetooth: controller: Update slot reservation time calculation for ADV
Correct slot reservation time calc for legacy advertise
Add dependency on data lengths for advertise and scan response

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2019-04-30 15:10:13 +02:00
Vinayak Kariappa Chettimada e90ba89812 Bluetooth: controller: Fixes to pass DLE/PHY conformance tests
Added implementation to pause data PDU transmission during
PHY update procedure in order to comply to BT Spec. v5.1
Vol.6, Part B, Section 5.1.10.1 Packet transmit time
restrictions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-04-23 12:09:23 -07:00
Vinayak Kariappa Chettimada 705515c092 Bluetooth: controller: Data Length Update port to ULL/LLL arch
Ported implementation of Data Length Update Procedure to
ULL/LLL architecture of the Link Layer.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-04-23 12:09:23 -07:00
Patrik Flykt 24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Carlos Stuart 75f77db432 include: misc: util.h: Rename min/max to MIN/MAX
There are issues using lowercase min and max macros when compiling a C++
application with a third-party toolchain such as GNU ARM Embedded when
using some STL headers i.e. <chrono>.

This is because there are actual C++ functions called min and max
defined in some of the STL headers and these macros interfere with them.
By changing the macros to UPPERCASE, which is consistent with almost all
other pre-processor macros this naming conflict is avoided.

All files that use these macros have been updated.

Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
2019-02-14 22:16:03 -05:00
Vinayak Kariappa Chettimada 85d92923e2 Bluetooth: controller: Rename non-Kconfig option macros
Remove CONFIG_ prefix from non-Kconfig macro definitions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-02-13 09:20:26 -05:00
Vinayak Kariappa Chettimada d33641f39a Bluetooth: controller: Remove underscore prefixes from functions
Cleanup and rename functions from having underscore prefixes.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-02-13 12:21:51 +01:00
Vinayak Kariappa Chettimada 1475402d41 Bluetooth: controller: Introduce ULL LLL architecture
This is a squash merge of commits introducing the new split
Upper Link Layer and Lower Link Layer architecture of the
Bluetooth Low Energy controller.

This introduces a new, improved Link Layer based on the
concept of split responsibilities; The Upper Link Layer
(ULL) is in charge of control procedures, inter-event
scheduling and overall role management. The code for the
ULL is shared among all hardware implementations. The
Lower Link Layer (LLL) is responsible for the intra-event
scheduling and vendor specific radio hardware access.

The communication between ULL and LLL is achieved through
a set of FIFOs that contain both control and data packets.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Signed-off-by: Wolfgang Puffitsch <wopu@oticon.com>
Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-01-23 09:45:06 +01:00