Commit graph

9523 commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada
283a30875b Bluetooth: controller: Add code comments for ext adv report
Added code comments to explain the reasons to drop
incomplete advertising and sync report.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-23 17:01:50 +01:00
Vinayak Kariappa Chettimada
d80d79e7f9 Bluetooth: controller: Use HCI defines for constants
Use HCI defines for PHY, and RSSI constants.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-23 17:01:50 +01:00
Vinayak Kariappa Chettimada
20939b7b11 Bluetooth: controller: Periodic Advertising Report generation
Added implementation for LE Periodic Advertising Report
event generation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-23 17:01:50 +01:00
Vinayak Kariappa Chettimada
5b62fae902 Bluetooth: controller: Fix Extended Advertising Report generation
Fix Extended Advertising Report generation that skipped
population of AD data when there was no extended header.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-23 17:01:50 +01:00
Asger Munk Nielsen
3df64a306b Bluetooth: controller: Create HCI stubs for CIG/CIS and ISO tests
Put infrastructure for the following HCI commands/events in place:
* LE Setup ISO Data Path command
* LE Remove ISO Data Path command
* Configure Data Path command
* LE Set CIG Parameters Test command
* LE ISO Read Test Counters command
* LE ISO Receive Test command
* LE ISO Test End command
* LE ISO Transmit Test command

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2020-11-20 10:56:51 +01:00
Vinayak Kariappa Chettimada
e9892c0000 tests: Bluetooth: shell: Fix PAST commands conditional compilation
Enclose PAST subscribe/unsubscribe test commands inside
CONFIG_BT_PER_ADV_SYNC and CONFIG_BT_CONN conditional
compilation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-20 11:39:13 +02:00
Vinayak Kariappa Chettimada
6578a366d5 Bluetooth: host: Fix Periodic Adv Set Info Transfer dependency
Periodic Advertising Set Info Transfer depends on Extended
Advertising and connections hence enclose the LE Periodic
Advertising Set Info Sync Transfer implementation inside
CONFIG_BT_PER_ADV and CONFIG_BT_CONN conditional
compilation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-20 11:39:13 +02:00
Vinayak Kariappa Chettimada
77d4ad65c5 Bluetooth: host: Fix PAST dependency on connections
Periodic Advertising Sync Transfer depends on connections
hence enclose the LE Periodic Advertising Sync Transfer
Received Event code inside CONFIG_BT_CONN conditional
compilation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-20 11:39:13 +02:00
Joakim Andersson
34e66db776 Bluetooth: host: Fix different endian in comparison
Fix the debug key-set comparison for debug keys comparing the
generated key in big-endian format against the debug private
key in little-endian format.

Fix this by converting the private key to big-endian format for
convenience.

Use the _be suffix for all variables to make the mixing of the
endian formats easier to read.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-11-19 12:40:13 +01:00
Emil Gydesen
deac6d73c5 Bluetooth: controller: Removes guards ull_adv_sync_*
Two ull_adv_sync function declarations, ull_adv_sync_reset and
ull_adv_sync_init was guarded by a #if causing CI issues.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-11-19 12:36:23 +01:00
Emil Gydesen
6b72bed967 Bluetooth: Controller: Add common ULL ticker stop with mark function
The same code block for marking an object with
ull_disable_mark, stopping the ticker and then unmarking
the object appeared multiple places; often with a regression
bug where instead of unmarking it in case of error, it would
be "remarked".

This commit fixes the bug, and moves the functionality to
a common function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-11-19 12:36:14 +01:00
Emil Gydesen
071db25f66 Bluetooth: Controller: Adds missing ull_disable in ll_sync_terminate
A call to `ull_disable` was missing in the function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-11-19 12:36:14 +01:00
Lingao Meng
65395f30ec Bluetooth: Mesh: Fixes pb-adv segment recv
Wrong use of function `find_msb_set(~link.rx.seg)`,
uint8_t type is implicitly converted to uint32_t.
As a result, it always returns 32 instead of the
expected value, resulting in abnormal processing
of prov segment.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2020-11-19 13:28:28 +02:00
Lingao Meng
9cd34f8675 Bluetooth: Mesh: Fixes prov string log dump
Missing log_strdup around the string.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2020-11-19 13:28:28 +02:00
Lingao Meng
109d6d4d8c Bluetooth: Mesh: Fixes wrong prov pointer clear
The structure pointer was wrongly cleared before,
`bearer` and `role` in `bt_mesh_prov_link` structure
resulting in illegal pointer access.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2020-11-19 13:28:28 +02:00
Ilya Averyanov
d262b064a2 Bluetooth: shell: fix compilation
phy2str also used when CONFIG_BT_USER_PHY_UPDATE not only
when CONFIG_BT_OBSERVER

Signed-off-by: Ilya Averyanov <a1ien.n3t@gmail.com>
2020-11-19 13:28:06 +02:00
Lingao Meng
88f8c735a7 Bluetooth: Mesh: Fixes missing set virtual addr
Fixes missing virtual address set

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2020-11-19 13:23:48 +02:00
Lingao Meng
4fbce04372 Bluetooth: Mesh: Correction of missing beacon auth generation
When kr phase to `BT_MESH_KEY_REVOKED`, should also call beacon
authentication, since beacon flag has change(0x01-->0x00).

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2020-11-19 13:21:28 +02:00
Marcin Niestroj
8669709d1e Bluetooth: DIS: settings: select SETTINGS
DIS module builts fine when BT_DIS_SETTINGS is selected, but SETTINGS is
not. However no settings handlers are executed, just like with
BT_DIS_SETTINGS disabled, which might confuse user.

Select SETTINGS, so settings handlers are properly selected and executed
in runtime.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-11-19 13:18:16 +02:00
Marcin Niestroj
faabbb6809 Bluetooth: DIS: settings: drop dependency on BT_SETTINGS
Currently BT_DIS_SETTINGS and BT_SETTINGS are independent in
Kconfig. This seems fine, because BT_SETTINGS pulls a lot of
functionality, which is not really needed to implement DIS with values
configured in runtime (from settings subsystem).

Drop BT_SETTINGS conditional compilation and leave check on
BT_DIS_SETTINGS only.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-11-19 13:18:16 +02:00
Morten Priess
5a10f27f13 Bluetooth: controller: Make WL size configurable
In architectures supporting more than 8 WL entries, e.g. pure
software implementations, it is desirable to be able to increase the
WL size. This change increases the range to 1..16 for SOCs other than
nRF5x and OpenISA.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2020-11-17 20:03:00 +01:00
Vinayak Kariappa Chettimada
ef2ece82c0 Bluetooth: controller: openisa: Fix sanitycheck failures
Fix sanitycheck failures when building
samples/bluetooth/peripheral_hr for rv32m1_vega_ri5cy
platform.

Updates from nRF platform related to 255 byte AD data
support have been directly copied into openisa port to
fix build failures.

Relates to commit c2fc629dd2 ("Bluetooth: controller:
255 byte AD payload support").

Fixes #29967.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-17 19:47:27 +01:00
Vinayak Kariappa Chettimada
05ca10001e Bluetooth: controller: nrf: Fix sanitycheck failures
Fix sanitycheck failures covered by following tests:

`./scripts/sanitycheck -p nrf51dk_nrf51422 -T tests/bluetooth/init`

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-17 19:47:27 +01:00
Vinayak Kariappa Chettimada
b2b93871a3 Bluetooth: controller: Fix minor typo in comment
Fix minor typo in comment that was not caught by check
compliance stage in PR CI.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-17 19:47:27 +01:00
Thomas Ebert Hansen
002b579416 bluetooth: controller: Add vendor operations to TICKER_USER_THREAD_OPS
Allow vendor specific increase of user operation capacity for
THREAD, to support queuing additional ticker operations.

Relocate TICKER_USER_<XXX>_VENDOR_OPS to before TICKER_USER_<XXX>_OPS.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2020-11-17 19:37:39 +01:00
Vinayak Kariappa Chettimada
27dcc39494 Bluetooth: controller: Fix regression in central event close
Fix regression in connection radio event close in central
role introduced in commit 222dca5598

Fixes #29957.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-17 12:16:36 +01:00
Marek Pieta
3b4ead139f Bluetooth: controller: Fix TX power dependencies
Change adds missing TX power dependencies. nRF52833 and nRF52820 SoCs
also support higher TX power values.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2020-11-17 11:52:06 +02:00
Emil Gydesen
919ba04988 Bluetooth: host: Periodic advertiser list support
Adds support for using the periodic advertiser list.
This list allows the application to rely on specific
devices when creating periodic advertising syncs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-11-16 16:35:44 +01:00
Emil Gydesen
1dada244c1 Bluetooth: host: Periodic Advertising Sync Transfer
Adds support for the periodic advertising sync transfer
(PAST) feature, which allows a synced device, or an
advertiser, to transfer synchronization of a periodic
advertising train to a connected device.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-11-16 13:40:09 +01:00
Joakim Andersson
2cc4d8d95c Bluetooth: mesh: Fix use of deprecated scan parameter filter_dup
Fix use of deprecated scan parameter filter_dup.
Should have been changed to options as part of:
be57dfbe2a

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-11-13 16:49:28 -05:00
Vinayak Kariappa Chettimada
59888103d2 Bluetooth: controller: Fix AD data size overflow check
pdu->len is only 8 bits and CONFIG_BT_CTLR_ADV_DATA_LEN_MAX
can be upto 1650 bytes. Fix the implementation to use 16
bit auto variable to check AD data length overflow.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-13 09:56:53 +01:00
Vinayak Kariappa Chettimada
afff307645 Bluetooth: controller: Initial support for set periodic adv data
Add initial support for LE Set Periodic Advertising Data
command.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-13 09:56:53 +01:00
Vinayak Kariappa Chettimada
92a942257d Bluetooth: controller: Fix Extended Advertising data population
Fix Extended Advertising Data population when there is no
Extended Header to be filled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-13 09:56:53 +01:00
Andrzej Kaczmarek
a17952237f Bluetooth: controller: Fix build error
.../ll_sw/nordic/lll/lll_scan.c: In function 'isr_tx':
.../ll_sw/nordic/lll/lll_scan.c:483:19: error: unused variable 'lll'
                                              [-Werror=unused-variable]
  483 |  struct lll_scan *lll = param;
      |                   ^~~
cc1: all warnings being treated as errors

This fixes https://github.com/zephyrproject-rtos/zephyr/issues/29968.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-11-13 00:02:12 +02:00
Andrzej Kaczmarek
273cb94c0d Bluetooth: controller: Resolve AdvA in ADV_EXT_IND properly
Since ADV_EXT_IND is received on primary channel, the AR is configured
to resolve AdvA in legacy PDU (assuming on 1M) and it will not resolve
AdvA properly. In such case, we should resolve AdvA manually in LLL.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-11-11 13:27:25 +01:00
Andrzej Kaczmarek
0316329db1 Bluetooth: controller: Add radio API to resolve addr via AAR
This allows to synchronously resolve any address using AAR. The AAR
has to be configured prior to calling this function.

The intended use for this function is to resolve AdvA in a PDU on
primary channel when AR was configured for different PDU type. That
means AR was configured to resolve in legacy PDU, but extended PDU
was received and we need to resolve AdvA manually. In such case, AAR
is already configured so just need to trigger it again with proper
ADDRPTR.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-11-11 13:27:25 +01:00
Andrzej Kaczmarek
de027edfb8 Bluetooth: controller: Configure AR for resolving in ext adv
This patch allows to configure AR for resolving AdvA in extended adv
PDUs. The extra 'flags' field provides a hint from caller on how to
setup AR:
- if legacy PDU is expected, AdvA is set after PDU header,
- if extended PDU is expected, AdvA is set with +2B offset due to
  common extended advertising header,
- if Coded PHY is used, AdvA is set with extra +5b offset due to CI and
  TERM1 fields.

Note that AUX_SCAN_REQ and AUX_CONNECT_REQ are also considered legacy
PDUs here since they are exactly the same as SCAN_REQ and CONNECT_IND.

If neither legacy nor extended PDU is specified, it's derived from PHY,
i.e. 1M means legacy, non-1M means extended. Since it is still possible
to receive different type PDU in such case, it's up to LLL to detect
this and resolve AdvA when RX is done.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-11-11 13:27:25 +01:00
Andrzej Kaczmarek
fb0c3dbaa4 Bluetooth: controller: Disable AAR PPI on AR reset
This was never disabled so would be triggered even if not explicitly
enabled.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-11-11 13:27:25 +01:00
Emil Gydesen
d911f99bfc Bluetooth: controller: guard NODE_RX_TYPE_USER with range value
Instead of guarding the NODE_RX_TYPE_USER cases with
CONFIG_BT_CTLR_USER_EXT we guard them with
CONFIG_BT_CTLR_USER_EVT_RANGE > 0 as that is the actual value that
enables/disables the NODE_RX_TYPE_USER values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-11-11 13:25:20 +01:00
Emil Gydesen
58eb76e06d Bluetooth: Controller: Change node_rx_type to auto incrementing enum
Instead of having explicit values for each entry in the enum that
has to be updated for each new entry (thus requiring manual work
which can also be error-prone), the enum will now be
self-incrementing, to make it easier and safer to add new
entries.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-11-11 13:25:20 +01:00
Emil Gydesen
8af767e28c Bluetooth: controller: Remove #ifdef for node_rx_type enum
Removed the #ifdef's for the node_rx_type enum. Since the
savings, they just make the enum harder to read.

Furthermore it will also ensure that all the enum values
will have the same value once the enum entries are no
longer manually defined.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-11-11 13:25:20 +01:00
Erik Brockhoff
b67233c6a4 bluetooth: controller: don't assert on rl disabled
Simply return 0 to indicate the deferred resolve was not accepted when
address resolve is not enabled

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2020-11-11 13:24:14 +01:00
Thomas Ebert Hansen
28a8582a49 Bluetooth: host: Fix endianness in conn. handle
Fix the endianness of the connection handle in the handler for
BT_HCI_EVT_REMOTE_VERSION_INFO.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2020-11-11 13:23:49 +01:00
Andrzej Kaczmarek
04a48d9ec2 Bluetooth: controller: Fix build without BT_CENTRAL
lll->conn is only defined valid when BT_CENTRAL is enabled.
Also ull_sched_mfy_after_mstr_offset_get is only used when BT_CENTRAL
is enabled.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-11-11 13:23:33 +01:00
Lingao Meng
7e302979f3 Bluetooth: Mesh: Fix DST field check when send
Add check for dst field in transport layer tx function.

Fixes: #29868

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-11-11 13:23:14 +01:00
Trond Einar Snekvik
a2aad2b3f8 Bluetooth: Mesh: Check TTL max value on transport TX
Adds check for TTL max in the transport send functions, and moves
setting of default TTL to transport.

Fixes #29855.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-11-11 13:22:34 +01:00
Joakim Andersson
d81197ff77 Bluetooth: shell: Fix shell scan option duplicate filtering options
Fix the shell always setting the filter duplicates option for active
scan.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-11-11 13:22:02 +01:00
Joakim Andersson
bd7a2fc395 Bluetooth: host: Change directed advertising to privacy-enabled peer
Change the advertising option that controls if the directed advertiser
will use an RPA or the identity address of the peer for the initiator
address.
This option currently has two issues:
 - It behaves differently if the privacy feature has been enabled,
   which can be confusing for application to use.
 - It cannot start a directed advertiser towards a peer that is not
   privacy-enabled and has distributed an IRK.

This commit includes the following changes:
 - When privacy has been enabled in order to advertise towards a
   privacy-enabled peer the BT_LE_ADV_OPT_DIR_ADDR_RPA option must now
   be set (same as when privacy has been disabled).
 - It is now possible to start a directed advertiser using the identity
   address of the peer when privacy-enabled.
 - When privacy has been enabled the advertising option combination
   of using the local identity address and an RPA as the initiator
   address is now disallowed and will return an error code.
   This is done because this combination did not actually work and would
   have used the identity address of the peer instead.
 - If the controller does not support controller-based privacy then
   using the option BT_LE_ADV_OPT_DIR_ADDR_RPA will return ENOTSUP
   because this behavior cannot be done with host-based privacy.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-11-11 13:22:02 +01:00
Andrzej Kaczmarek
904a421915 Bluetooth: controller: Disallow starting scannable adv w/o scan rsp
Scannable advertising set cannot be started without scan response data.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-11-11 13:20:40 +01:00
Andrzej Kaczmarek
7195ce6970 Bluetooth: controller: Allow to discard scan response data
Host can discard scan response data by setting empty data. We simply
set PDU length to 0 to indicate this, it will make future check easier.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-11-11 13:20:40 +01:00