Commit graph

2921 commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada
10142ab398 Bluetooth: controller: Added some comments for fields in node rx struct
Added internal comments about the use of some of the fields
in the node rx structure.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-23 11:39:47 +02:00
Vinayak Kariappa Chettimada
61e7eb907c Bluetooth: controller: Define struct in node rx for adv term event
Defined struct in node rx for passing event parameters of
Advertising Set Terminated Event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-23 11:39:47 +02:00
Vinayak Kariappa Chettimada
cd0e72a91e Bluetooth: controller: Reworked adv set terminate event
Reworked the implementation of Advertising Set Terminate
event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-23 11:39:47 +02:00
Dag Bjarvin
46a622837d Bluetooth: controller: Release term event memory on timeout
Release memory allocated to ext adv terminate event, after timeout

Signed-off-by: Dag Bjarvin <Dag.Bjarvin@nordicsemi.no>
2020-07-23 11:39:47 +02:00
Dag Bjarvin
0df34da5d7 Bluetooth: controller: Terminate event for ext adv
Update to free term event node

Signed-off-by: Dag Bjarvin <Dag.Bjarvin@nordicsemi.no>
2020-07-23 11:39:47 +02:00
Vinayak Kariappa Chettimada
a4eead690d Bluetooth: controller: Adv Set Terminated Evt on duration
Implementation of Advertising Set Terminated Event on
duration sans use of additional variable in advertising
set context structure.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-23 11:39:47 +02:00
Dag Bjarvin
12fdddb80d Bluetooth: controller: Add terminate event for external advertising
Add terminate event for duration timeout, max number of events and
connection.

Signed-off-by: Dag Bjarvin <Dag.Bjarvin@nordicsemi.no>
2020-07-23 11:39:47 +02:00
Luiz Augusto von Dentz
75f47a56b5 Bluetooth: Add config option to disable security checks
This adds CONFIG_BT_CONN_DISABLE_SECURITY which can be used to disable
security checks for incoming requests enabling to test accessing GATT
attributes and L2CAP channels that would otherwise require
encryption/authentication in order to be accessed.

It depends on BT_TESTING to indicate to the users that this is a
testing feature which shall not be used in production.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-07-23 11:00:04 +02:00
Andrzej Kaczmarek
38997a5719 Bluetooth: host: Do not set AD on scannable ext adv
Advertising data is not supported on scannable extended advertising
instances.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-07-23 10:58:33 +02:00
Andrzej Kaczmarek
d93489035c Bluetooth: host: Add flag to indicate ext adv set
It should be possible to identify whether advertising set uses legacy
or extended advertising to avoid performing operations that are not
supported on either of them.

For example, scannable advertising can have advertising data set only
if legacy PDUs are used.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-07-23 10:58:33 +02:00
Krzysztof Chruscinski
2b4763076e bluetooth: controller: Adapt to onoff clock control
Adapt link layer to use onoff service when controlling clock.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-07-20 16:22:21 +02:00
Joakim Andersson
c4c0e64331 Bluetooth: host: Fix infinite recursion in persistent advertising
Fix a crash in the persistent advertising handling.
This occurs because the callstack of the RX thread overflowed
due to an infinite recursion between bt_conn_unref and
bt_le_adv_resume.
This happens when starting a new advertiser is denied by the
controller, then the conn object reserved will be released again
and the host will attempt to resume advertising in the bt_conn_unerf
at the end of bt_le_adv_resume.
This situation can happen if the host supports more connections
than the controller.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-20 15:58:36 +02:00
Joakim Andersson
970e921cd7 Bluetooth: hci_ecc: Follow BT spec when public key is invalid
Follow Bluetooth specification recommendation of setting the output
of the DH_Key field in the LE Generate DHKey Complete event when the
public key is invalid.

 If the Remote_P-256_Public_Key parameter of the HCI_LE_Generate_DHKey
 command (see Section 7.8.37) was invalid (see [Vol 3] Part H, Section
 2.3.5.6.1), then all octets of the DH_Key event parameter should be
 set to 0xFF.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-20 12:48:23 +02:00
Trond Einar Snekvik
f8663774de Bluetooth: Mesh: Document shell commands
Adds a high-level documentation page for the Bluetooth Mesh Shell
subsystem, documenting all available commands and their parameters.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-07-20 12:47:31 +02:00
Vinayak Kariappa Chettimada
4bf2a0d520 Bluetooth: controller: Make coding style around ret_cb consistent
Updated implementation to have consistent initialization of
ret_cb use when passing it to ticker function calls.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-20 12:46:54 +02:00
Vinayak Kariappa Chettimada
13f079f212 Bluetooth: controller: Fix missing ticker status initialization
Fix missing ticker status callback return value
initialization.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-20 12:46:54 +02:00
Vinayak Kariappa Chettimada
c9332e76b3 tests: Bluetooth: shell: Remove cmd_ull_reset
Remove cmd_ull_reset command, as this would put the host out
of sync. Also, this command is seldom used/required.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-20 12:46:26 +02:00
Vinayak Kariappa Chettimada
293a2f69d0 Bluetooth: controller: Remove redundant BT_LL_SW_SPLIT conditional
Remove redundant use of BT_LL_SW_SPLIT conditional.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-20 12:46:26 +02:00
Emil Gydesen
5b59c002f6 Bluetooth: Gatt: Automatic discover of CCC when subscribing
Added a feature that allows an application to request
automatic discovery of the CCCD handle when subscriping
to a characteristic. In order to preserver RAM, the application
is expected to provide the discovery parameters, and it's up
to the application whether or not it wants to reuse the
discovery parameters or use one for each characteristic.

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-07-20 12:46:18 +02:00
Rubin Gerritsen
742358c6a6 bluetooth: controller: Kconfig: debug pins depends on BT_LL_SPLIT
When BT_LL_SPLIT is not selected, it should not be visible.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-07-17 12:57:49 +02:00
Rubin Gerritsen
f9b19186f5 bluetooth: controller: Kconfig: Move LL version config to split ll
These configs are not generic.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-07-17 12:57:49 +02:00
Rubin Gerritsen
cd63479f2e bluetooth: controller: Kconfig: Move RX_PRIO configs to split ll
These configs are not generic

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-07-17 12:57:49 +02:00
Rubin Gerritsen
6c7ed9627e bluetooth: controller: Kconfig: Move LLL selection to split config
The dependency to LL_SPLIT is removed.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-07-17 12:57:49 +02:00
Rubin Gerritsen
1ec8b0ff0a bluetooth: controller: Kconfig: Move split LL helper configs to file
These configs are not generic.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-07-17 12:57:49 +02:00
Rubin Gerritsen
eea9d258a3 bluetooth: controller: Kconfig: Split out split config to new file
By splitting it out to a separate file, it will become easier to
separate generic and non-generic controller features.
This commit only contains the simple extraction.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-07-17 12:57:49 +02:00
Vinayak Kariappa Chettimada
8666236bc6 Bluetooth: controller: Fix overflow due to use uninitialised PDU
Fixed memory corruption when using uninitialised previous
PDU to populate current PDUs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-16 14:43:46 +02:00
Trond Einar Snekvik
6b5c2e02d3 Bluetooth: Mesh: Transport seg send timeout
Resolves a corner case where the segmented sending would be rescheduled
before the segments were done sending. This would happen if the
processing of each segment took longer than the retry delay. The
consequence of this was that some segments were resent multiple times at
the cost of other segments, occasionally causing a loss of transfers.

Rearranges, realigns and documents seg_tx structure bitfields in
transport.c. Removes bitwidth of counter fields, and collecting all flag
fields into one byte.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-07-16 13:10:42 +02:00
Wolfgang Puffitsch
da5eff8087 Bluetooth: controller: Enforce support for Read RSSI command in Kconfig
Enforce support for Read RSSI command if BT_CONN and BT_HCI_RAW are
selected. According to the Bluetooth specification, support for the
Read RSSI command is mandatory if the Connection State is
supported. BT_HCI_RAW indicates that the controller is an
independently qualifiable module and not part of a combined
host/controller build. This change avoids a configuration that cannot
be possibly qualified.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2020-07-16 12:13:37 +02:00
Marek Pieta
a6e8cf4374 bluetooth: gatt: Fix storing subscriptions
Change fixes storing subscriptions in settings. CCC write can interrupt
the ccc_delayed_store. Without the change, new CCC was not stored in
non-volatile memory and the work that stored CCC was not resubmitted.
That resulted in lost subscription after reboot.

Fixes: #26862

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2020-07-16 12:13:22 +02:00
Vinayak Kariappa Chettimada
6ecd5e56ed Bluetooth: controller: Minor refactor of sync implementation
Minor refactoring of code in periodic advertising
implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-16 12:12:41 +02:00
Vinayak Kariappa Chettimada
be72282be5 Bluetooth: controller: Refactor sync enabled and started states
Refactor implementation to perform enable and started state
updates at consistent places in code.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-16 12:12:00 +02:00
Vinayak Kariappa Chettimada
d3457d1f12 Bluetooth: controller: Refactor sync PDU variable names
Refactor and use variable name ter_pdu for periodic
advertising PDU pointers.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-16 12:11:19 +02:00
Vinayak Kariappa Chettimada
6a862b9862 Bluetooth: controller: Non-overlapping sync PDUs
Updated implementation to schedule non-overlapping
ADV_EXT_IND, AUX_ADV_IND, and AUX_SYNC_IND PDUs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-16 12:11:04 +02:00
Joakim Andersson
d6b526a038 Bluetooth: shell: Add bond_deleted callback
Add the bond_deleted callback to the bluetooth shell.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-16 12:09:57 +02:00
Joakim Andersson
4876923085 Bluetooth: shell: Use selected ID when selecting default connection
Use the selected local ID when switching the default connection.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-16 12:09:57 +02:00
Joakim Andersson
71ab1ec5a7 Bluetooth: host: Add bond_deleted callback
Add bond_deleted callback so that the application can keep track
of when bond information is deleted in the stack.
Bond information can be deleted by the application through bt_unpair
or automatically by the stack in some cases, e.g when
CONFIG_BT_KEYS_OVERWRITE_OLDEST is enabled and the oldest bond
is overwritten.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-16 12:09:57 +02:00
Joakim Andersson
ae4ac87a91 Bluetooth: shell: Add advertising options one-time and directed privacy
Add advertising option for undirected one-time advertising, and
directed advertising using identity, and peer direct is RPA option.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-15 17:49:20 +02:00
Joakim Andersson
411bd99982 Bluetooth: shell: Print PHY and data len info in info command
Print the PHY and data len information from the conn info struct.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-15 15:12:45 +02:00
Joakim Andersson
8482ab64e0 Bluetooth: host: Start persistent advertiser with max conn reached
Allow calling bt_le_adv_start with no connection object available
when not the option BT_LE_ADV_OPT_ONE_TIME has been set. In this
case the advertiser will be restarted once there is a connectable
advertiser object available.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-15 15:12:28 +02:00
Vinayak Kariappa Chettimada
2ca56a2ab7 Bluetooth: controller: Add missing aux acquire on periodic adv
Added implementation to acquire and initialize auxiliary
channel instance on use of periodic advertising.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-14 12:52:41 +02:00
Luiz Augusto von Dentz
ede13428e7 Bluetooth: GATT: Fix not being able to notify
When CONFIG_BT_GATT_NOTIFY_MULTIPLE is selected and the remote has
enabled support for using its procedure data can sometimes not fit
into the buffer since the multiple variant has a bigger header, so
instead of failing immediatelly this attempts to send the data using
the legacy PDU instead so those using bt_gatt_get_mtu - 3 can still be
sent.

Fixes #26106

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-07-13 12:23:48 +02:00
Rubin Gerritsen
8561fc9563 bluetooth: controller: Kconfig: Add dependency when ADV_EXT is y
BT_CTLR_SCAN_REQ_NOTIFY is only available for BT_LL_SW_SPLIT

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-07-13 11:54:17 +02:00
Rubin Gerritsen
82b3276777 bluetooth: controller: ADV_EXT enabled by default
Enable Advertising Extensions by default if supported by the controller.
That is, do not enable it by default for BT_LL_SW_SPLIT.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-07-13 11:54:17 +02:00
Asbjørn Sæbø
1886cb4b4e Bluetooth: Shell: Add shell command to output the ATT MTU size
It is sometimes useful to know what the ATT MTU size is.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2020-07-10 13:14:30 +02:00
Marek Pieta
4e43e00c4c Bluetooth: controller: Safe default value of BT_CTLR_LLCP_CONN
Change sets default value of Kconfig option BT_CTLR_LLCP_CONN to
BT_MAX_CONN. The default value should properly handle the worst case.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2020-07-09 19:08:50 +02:00
Vinayak Kariappa Chettimada
dc55538645 Bluetooth: controller: Fix missing skip value calculation
Fix missing recalculation of skip value of the ticker being
inserted into ordered list, when it collides and is being
attempted to be inserted at next periodic interval.
This fix is for ticker compatibility mode which is used as
default for nRF51 series.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-09 19:08:35 +02:00
Trond Einar Snekvik
cb7835d18f Bluetooth: Mesh: Wait for proxy on node reset
Adds idle wait callback to proxy by counting the number of pending
notifications.

Ensures that all connected nodes have received messages before resetting
the mesh stack.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-07-09 13:49:26 +02:00
Vinayak Kariappa Chettimada
eb2a64989b drivers: flash: nrf: Fix flash operation timeout
Fix flash operation timeout due to incorrect use of
secondary ticker to abort any radio in use. Ticker id 0
is reserved for split controller's pipeline preempt timeout.
Using the same ticker id caused the secondary ticker to
not be started if controller is using the same ticker id
for pipeline preempt timeout.

Fixes #26333.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-09 07:17:41 -04:00
Michał Narajowski
67ab8a3173 Bluetooth: Mesh: Fix response to Provisioning PDU with invalid type
Reverse the order of these checks because invalid PDU type will
never be expected. If PDU type is invalid we should respond with
error 0x0002 - Invalid format.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2020-07-08 10:19:02 +02:00
Vinayak Kariappa Chettimada
2b45736f28 Bluetooth: controller: Add Periodic Advertising HCI integration
Add implementation to integrate the HCI Periodic Advertising
interface.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-07 15:04:51 +02:00