Commit graph

9523 commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada
99916bead0 Bluetooth: controller: Refactor to use ull_sync naming
Refactored to use ull_sync naming instead of ull_scan_sync.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
7a5413dcca Bluetooth: controller: Add Kconfig to config Periodic Sync Sets
Added Kconfig option to configure supported simultaneous
Periodic Sync Sets.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
5c525f0350 Bluetooth: controller: Add HCI integration of Periodic Sync
Added implementation to integrate the Periodic Sync LL
interface with HCI layer.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
b0cc96ec61 Bluetooth: controller: Add initial ULL Periodic Sync code
Add initial files and code for Periodic Sync feature support.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
5acdb7d9d2 Bluetooth: controller: Add depends on BT_PER_ADV
Enable controller periodic advertising if host supports it.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Joakim Andersson
b5bf46fe3c Bluetooth: host: Don't use struct with zero size
Don't use the ATT structs that has contains only a flexible array
member. This is not supported by C99 standard, only through GNU C
extension with zero length array.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-07 14:51:30 +02:00
Vinayak Kariappa Chettimada
c87c1a8890 Bluetooth: controller: Fix implicit declaration warning
Fix implicit declaration warning for peripheral_latency_cancel
by moving it to ull_slave file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-06 13:47:18 +02:00
Andrew Boie
ed7263bf6b bluetooth: add dep on !SMP
The BT code uses co-op thread priorities to implement some
critical sections. This won't work with SMP turned on.
Express this in our configuration ontology, so that it's
not possible for the end user to set up the system in this
way and get crashes or odd behavior.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-10-05 19:33:02 -07:00
Jordan Montgomery
ec9080a036 Bluetooth: controller: Fix Null deref during adv data update
Added a check for adv->lll.aux before starting extended advertising to
fix observed NULL pointer dereference when updating AD data of legacy
advertising.

Fixes #28544.

Signed-off-by: Jordan Montgomery <montytyper@msn.com>
2020-10-05 11:47:30 +02:00
Emil Gydesen
8cc051ccac Bluetooth: host: Change PA sync callbacks to global callbacks
Changes the callbacks for periodic sync callbacks such that multiple
applications can register callbacks, similar to the connection and
scan callbacks.

This change will make it easier to support the PAST feature, as
PA syncs make be created by the controller which then notifies
the host, and thus the application (if callback registered).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-10-02 11:49:13 +02:00
Xavier Chapron
824f423e54 misc: Replace assert include and calls by sys/__assert.h equivalent
Replace all calls to the assert macro that comes from libc by calls to
__ASSERT_NO_MSG(). This is usefull as the former might be different
depending on the libc used and the later can be customized to reduce
flash footprint.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-10-02 11:42:40 +02:00
YanBiao Hao
dc89bfcc7f Bluetooth: Mesh: Config Client network transmit set/get API
Get/Set network transmit parameter of a node.

Signed-off-by: YanBiao Hao <haoyanbiao@xiaomi.com>
2020-10-02 11:30:12 +02:00
Emil Gydesen
0be8a91a73 Bluetooth: host: Add NULL checks for scan callbacks
The scan callbacks may be NULL, which would cause an error if
e.g. the timeout callback wasn't set and the scan terminates after
a timeout.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-10-01 13:57:53 -04:00
Lingao Meng
f16c653be9 Bluetooth: Mesh: Move Replay Protect to seperate module
Move RPL to seperate module, and remove it in `bt_mesh`
structure.

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-10-01 16:20:24 +03:00
Vinayak Kariappa Chettimada
8f203e46ca Bluetooth: shell: Fix PER SYNC conditional compilation
Fix conditional compilation to allow building test shell
with Periodic Advertising Sync alone.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-01 12:54:06 +02:00
Vinayak Kariappa Chettimada
416d7ee32a Bluetooth: controller: Fix latency cancel on LLCP initiation
Fix controller implementation to cancel peripheral latency
when initiating new control procedures.

Fixes #28699.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-01 12:53:53 +02:00
Vinayak Kariappa Chettimada
b6fb074d6e Bluetooth: controller: Connection termination race condition
Add checks to abort connection radio event preparation and
start, if the connection terminates with a race condition
with new radio event being prepared or being in prepare
pipeline.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-01 11:47:35 +02:00
Vinayak Kariappa Chettimada
3e2dc0d706 Bluetooth: controller: Add branch prediction hints
Add branch prediction hints in critical control paths in the
code.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-01 11:47:35 +02:00
Vinayak Kariappa Chettimada
d64bbd5a06 Bluetooth: controller: Add missing debug pin toggle
Add missing debug pin toggle on abort of connection event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-01 11:47:35 +02:00
Vinayak Kariappa Chettimada
48a0c0c3a8 Bluetooth: controller: Fix undeclared identifier
Fix undeclared CONFIG_BT_CTLR_DATA_LENGTH_MAX when Force
MD bit automatic feature is enabled in nRF51 Series.

Fixes #28774.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-30 06:38:19 -05:00
Vinayak Kariappa Chettimada
e4fe7435d7 Bluetooth: controller: Added Force MD bit automatic feature
Added automatic runtime calculation of Forced MD bit count
based on incoming Tx buffer throughput.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-28 15:23:21 +02:00
Vinayak Kariappa Chettimada
3bbe2c0a07 Bluetooth: controller: Add in-system Tx throughput measurement
Added feature to in-system measure incoming Tx throughput.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-28 15:23:21 +02:00
Vinayak Kariappa Chettimada
cf05f49ee2 Bluetooth: controller: Refactor Force MD bit implementation
Add Force MD bit feature wherein connection events can be
extended to match the rate at which applications provide
new Tx data. MD bit in Tx PDUs is forced on if there has
been CONFIG_BT_CTLR_TX_BUFFERS count number times Tx/Rx
happened in a connection event. The assumption here is,
if controller's tx buffers are full, it is probable that
the application would send more Tx data during the
connection event, and keeping the connection event alive
will help improve overall throughput.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-28 15:23:21 +02:00
Vinayak Kariappa Chettimada
1fcb0d0b5e Bluetooth: controller: Add force MD bit feature
Add force Md bit feature wherein connection events can be
extended to match the rate at which applications provide
new Tx data.

Fixes #27981.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-28 15:23:21 +02:00
Vinayak Kariappa Chettimada
62f1ad79bb Bluetooth: controller: Fix connection event close check
Fix the check that decides to close a connection event,
which was missing a check on MD bit being set for empty PDU
to be Tx-ed out.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-28 15:23:21 +02:00
Vinayak Kariappa Chettimada
45593ff508 Bluetooth: controller: Optimise Tx PDU preparation
Optimize the Tx PDU preparation, empty PDU only needs MD bit
to be modified, other fields be initialised only at power up.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-28 15:23:21 +02:00
Vinayak Kariappa Chettimada
6b1cfdda33 Bluetooth: controller: Fix premature connection event close
Fix premature connection event close due to the new Tx
buffers not being de-multiplexed and routed to connection's
Lower Link Layer context when they arrive while being
inside the connection's radio event.

Also, fix master prepare to demux and enqueue two Tx buffers
so that MD bit can be set correctly.

Relates to #27981.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-28 15:23:21 +02:00
Vinayak Kariappa Chettimada
0096fca39d Bluetooth: controller: Refactor ull_conn_tx_ack function
Refactor ull_conn_tx_ack function as it no longer needs to
return the connection context back to caller.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-28 15:23:21 +02:00
Vinayak Kariappa Chettimada
35c0b77304 Bluetooth: controller: Add interface to get ULL ref count
Add a static inline interface to get ULL context reference
count.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-28 15:23:21 +02:00
Vinayak Kariappa Chettimada
41017478b1 Bluetooth: controller: Move tx_ull_dequeue to static functions
Move tx_ull_dequeue function to be placed alongwith other
static function definitions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-28 15:23:21 +02:00
Vinayak Kariappa Chettimada
2dc174fb10 Bluetooth: controller: Minor relocation of lll_conn_flush function
Minor relocation of lll_conn_flush function to place alongwith
non-static functions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-28 15:23:21 +02:00
Vinayak Kariappa Chettimada
accd35fe62 Bluetooth: controller: Remove commented code
Remove commented out code.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-28 15:23:21 +02:00
Trond Einar Snekvik
fc4fe09966 Bluetooth: Mesh: Provisioning: Reject identical random
Adds check for provisioning random values that are identical to our own,
and terminates the provisioning procedure.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-09-24 13:45:15 -05:00
Ilya Averyanov
e363decf1c Bluetooth: fix strncpy call in bt_set_name
In bt_set_name we already get name length so let's use it in strncpy
Also fix warning with enable -Wstringop-truncation

Signed-off-by: Ilya Averyanov <a1ien.n3t@gmail.com>
2020-09-24 13:41:57 -05:00
Emil Gydesen
8825ce0ce6 Bluetooth: Shell: Fix PA shell command parameter cnt
The sync create and sync delete dit not have the correct
amount of mandatory and optional parameters set in the
SHELL_CMD_ARG declarations.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-09-24 21:29:47 +03:00
Emil Gydesen
68a357e66d Bluetooth: Shell: PA sync terminate callback clears entry
The sync terminate callback did not set any entries in the
PA sync array to NULL, thus not allowing the shell to
reuse them in case that the sync was lost unexpectectly.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-09-24 21:29:47 +03:00
Emil Gydesen
27f6bf19e8 Bluetooth: Host: Change PA sync scan to fast scan
Instead of doing slow (non-fast) scan when syncing to
a PA, it will now do a fast scan, which drastically reduces the
time it takes to create the sync. The application may
still do explicit slow scan if wanted.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-09-24 21:29:47 +03:00
Emil Gydesen
b78245db60 Bluetooth: Host: Fix PA sync cancel scan update
When the application cancels the PA sync, it would update
the scan before clearing the BT_PER_ADV_SYNC_SYNCING flag
which cause the scan to always start again.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-09-24 21:29:47 +03:00
Vinayak Kariappa Chettimada
222dca5598 Bluetooth: controller: Fix redundant PDU transmission
Fix the redundant PDU transmission when the new Tx PDU
buffer is enqueued after MD bit value of zero was
transmitted previously in a connection event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-24 17:27:00 +02:00
Vinayak Kariappa Chettimada
1c3659519f Bluetooth: controller: nRF53x: Fix missing sw_switch clear DPPI config
Fix missing sw_switch timer clear DPPI config when
re-enabling Tx or Rx after radio_disable() or
radio_switch_complete_and_disable() call in LLL state/role
contexts.

Fixes #28471.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-24 17:05:14 +02:00
Joakim Andersson
407411f1af Bluetooth: host: Fix stuck OOB get local functions SC is not supported
Fix bt_le_oob_get_local and bt_le_ext_adv_oob_get_local stuck forever
waiting for the sc_local_pkey_ready semaphore when SC HCI commands
are not supported in the controller.

By using the le_sc_supported helper function the runtime check of HCI
commands and the feature check of CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY
is combined to be handled int the same way.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-09-22 19:37:31 +02:00
Joakim Andersson
214175483b Bluetooth: SMP: Move le_sc_supported helper function up
Move the le_sc_supported helper function up in the source file so that
it can be re-used in other places without a forward declaration.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-09-22 19:37:31 +02:00
Luiz Augusto von Dentz
d8fd5bab04 Bluetooth: L2CAP: Truncate RX MTU if segmentation is not supported
If hannel don't have alloc_buf and the RX MTU is configured to require
segmentation this warn the user and truncate the RX MTU.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-09-22 10:56:27 +03:00
Erik Brockhoff
9bbbf17cf2 bluetooth: controller: fix mark/unmark error in ull_adv::disable
In case where ull_adv::disable() is disallowed, disable_mark is
erroneously re-mark instead of un-marked

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2020-09-21 17:05:19 -05:00
Luiz Augusto von Dentz
25fda14702 Bluetooth: GATT: Fix assuming CCC position
Accourding to the spec the CCC descriptor may occur in any position
within the characteristic definition after the Characteristic Value.

Fixes #28324

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-09-21 17:15:19 +03:00
Vinayak Kariappa Chettimada
a8ffc03f6e Bluetooth: controller: Fix REJECT_IND PDU handling
Fix for handling REJECT_IND PDU received for PHY Update,
Connection Parameter Request and Data Length Update control
procedures.

If a link layer control procedure collision occurs, example
with local initiated PHY Update Procedure, and peer sends a
REJECT_IND PDU, then the PHY Update Procedure is stalled.

Fixes #28282.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-21 14:52:41 +02:00
Ievgenii Meshcheriakov
d27c32efc3 drivers/flash/soc_flash_nrf: Rename config option SOC_FLASH_NRF_RADIO_SYNC
Call it SOC_FLASH_NRF_RADIO_SYNC_TICKER so it is not too generic.

Signed-off-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@nordicsemi.no>
2020-09-21 13:06:16 +02:00
Lingao Meng
4cc8cb1c15 Bluetooth: Mesh: Fix send input_complete before public key
According Mesh Profile Spec 5.4.2.4 Authentication, if device
use Input OOB Authentication method, should send input complete
pub after local public key has been acked.

`bt_mesh_input_string` or `bt_mesh_input_number` directly send
`input_complete`, however does not check whether the pub key has
been sent.

Mesh Provisioning timeout set to `60` seconds, so even this
probability is extremely low, it does not mean that there is no
such probability.

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-09-21 13:07:18 +03:00
Joakim Andersson
0fe62c6392 Bluetooth: host: Fix bug in device name shortening handling
Fix bug in device name shortening handling leading to memory
corruption.
This is triggered by an underflow in the length field of the shortened
name when set_data_len + 2 > set_data_len_max.

Fixes: #27693

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-09-19 10:25:49 +02:00
Joakim Andersson
f332d51d60 Bluetooth: host: Ignore failure to set passive scanner address
Ignore error when failing to set the passive scanner private address.
This can happen because in between the time we checked if the
advertiser was enabled and the time we execute the set random address
command the state of the advertiser could have changed in the
controller, and we only set the state once the command has completed
in the controller.

Fixes: #25672

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-09-19 10:19:03 +02:00