Commit graph

9523 commits

Author SHA1 Message Date
Herman Berget
40237f3e99 Bluetooth: Host: Make bt_eatt_count public
bt_eatt_count returns the number of EATT channels connected for a given
connection.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-04-04 14:22:22 +02:00
Herman Berget
a4a6e7a042 Bluetooth: Host: Make bt_eatt_connect connect up to BT_EATT_MAX channels
bt_eatt_connect may now send multiple credit based connection requests.
Previously it would only send one and thus only allow 5 EATT channels to
be connected.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-04-04 14:22:22 +02:00
Herman Berget
4750d9621f Bluetooth: Host: Cancel EATT connection work in att_reset
When att->conn is set to NULL in att_reset, EATT connection will fail.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-04-04 14:22:22 +02:00
Vinayak Kariappa Chettimada
9530fb739b Bluetooth: Controller: Fix use of uninitialized secondary PHY
Fix connectable advertising to not use uninitialized
secondary PHY value to set the max_tx_time and max_rx_time
for a non-extended connectable advertising context.

The symptoms being Data Length Update event being generated
when peer central initiated Data Length Update Procedure
does not change from default 27 byte 328 us values.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-04-04 14:11:32 +02:00
Vinayak Kariappa Chettimada
08311d747d Bluetooth: Controller: Use macro to check scanning on PHY enabled
Use a macro to check where scanning on 1M and/or Coded PHY
is enabled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-04-04 14:11:24 +02:00
Vinayak Kariappa Chettimada
4137a5b1af Bluetooth: Controller: Offset Coded PHY scan window
Offset the Coded PHY scan window by 1M PHY scan window
duration so that when 1M PHY scan window is less than
scan interval then Coded PHY scan window can utilize the
radio thereafter for its scan window duration. For
example, with 20 ms interval and 10 ms window there can
be 10 ms 1M PHY followed by 10 ms of Coded PHY scanning.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-04-04 14:11:24 +02:00
Vinayak Kariappa Chettimada
6316ca44af Bluetooth: Controller: Introduce a timeout to get HCI event buffer
Introduce a timeout to get HCI event buffer when preparing
Extended and Periodic Advertising reports. This will prevent
silent hanging of Controller in case of insuffient Rx buffer
configurations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-04-04 14:09:51 +02:00
Vinayak Kariappa Chettimada
36c4c64675 Bluetooth: Controller: Workaround nRF52840 Revision 3 Errata 191
Add workaround for nRF52840 Revision 3 Errata 191. Removed
workaround for fixed nRF52840 Engineering Revision A Errata
164.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-04-04 13:03:08 +02:00
Kamil Gawor
54c9a3b8e9 Bluetooth: Controller: Fix b2b rx shorts
This fixes Radio Rx when switching back-to-back is
used and device support CTE. For the CTE reception we need to use
PHYEND->DISABLE short instead of END->DISABLE short.
Using NRF_RADIO_SHORTS_PDU_END_DISABLE short handles
both cases.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2022-04-04 11:14:52 +02:00
Kamil Gawor
c2a0d7f761 Bluetooth: Controller: Improve handling iq samples in DTM
This adds improvements in handling IQ samples
in the Direct Test Mode.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2022-04-04 11:14:44 +02:00
Vinayak Kariappa Chettimada
992d133b42 Bluetooth: Increase supported maximum simultaneous connection to 250
Increase the supported maximum simultaneous connection to
250, tested under BabbleSim simulations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-04-04 10:24:34 +02:00
Vinayak Kariappa Chettimada
cfc44101a6 Bluetooth: Controller: Update to increase simultaneous connection limit
Update Controller to use uint16_t instead of uint8_t to
allow buffer counts to exceed beyond 255. Also fix pointer
arithmetic from being restricted to uint16_t that prevented
calculating the memory index for large offsets. This will
now allow support for 250 simultaneous connections, limited
by ticker_id type being uint8_t.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-04-04 10:24:34 +02:00
Vinayak Kariappa Chettimada
8ef4cfc577 Bluetooth: Controller: Force MD feature not supported in LOW LAT ULL
Add Kconfig dependency to disable use of Force MD feature
when using LOW LAT ULL variant of the Controller.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-04-04 10:24:19 +02:00
Vinayak Kariappa Chettimada
018f59e46f Bluetooth: Controller: NULL structure fields before release to pool
NULL structure fields before releasing memory back to pool.
Add assertion check to prevent NULL pointer dereferencing of
node rx.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-04-02 15:40:09 +02:00
Erik Brockhoff
046ef86e7a bluetooth: controller: optimizing random get in encryption procedure
Utilizing packed location of SKDm/s and IVm/s to only call
csrand_get() once

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-04-02 15:40:02 +02:00
Erik Brockhoff
e42d453e3e bluetooth: controller: use global ull_conn_event_counter() in procedures
Replace the use of local event_counter() functions with one defined
in ull_conn.c

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-04-02 15:40:02 +02:00
Erik Brockhoff
045735787d bluetooth: controller: removing 'no-brainer' TODOs from refactored LLCP
Getting rid of TODOs that are fairly straight forward to resolve
* introduce role checks in ENC API
* Remove ASSERT on re-rx of LL_VERSION_IND, ignore instead
* in tests/.../ctrl_chmu: rename variable and initialize initial ch map
* in tests/.../mock_ctrl/util.c: Changing TODO into FYI
* in tests/.../helper_features.h update mask and remove TODO comment
* in ull_llcp_remote.c: re-order cases in proc_with_instant switch
* in ull_conn_upd.c: PARAM REQ only uses REJECT_EXT_IND
* in ull_llcp_common.c: in CENTRAL on rx of LL_MIN_USED_CHANNELS_IND
     chose to do nothing re. channel map. Update unit test accordingly

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-04-02 15:40:02 +02:00
Erik Brockhoff
628d3224f9 bluetooth: controller: removing 'empty' TODO's from refactored LLCP
Cleanup, removing TODOs that should just be removed

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-04-02 15:40:02 +02:00
Andrzej Głąbek
586e26e8fc soc: nrf: Use data from DTS to populate HAS_HW_NRF_* Kconfig options
Instead of selecting appropriate HAS_HW_NRF_* options for particular
nRF SoCs (and simulated nRF52 target), set their values basing on
information from devicetree.
Correct also semantics of those options so that they are set only when
a corresponding DT node is enabled. This allows using them directly in
Kconfig dependencies of Zephyr drivers for nRF peripherals. Update
appropriately these dependencies.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-02 15:14:38 +02:00
Vinayak Kariappa Chettimada
7802d88309 Bluetooth: Controller: Fix missing dup filtering cond. compile
Fix missing duplicate filtering feature conditional
compilation which caused build error when duplicate
filtering feature is disabled when Periodic Advertising
feature selected.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-04-01 12:39:37 -05:00
Carles Cufi
65a2e4b760 Bluetooth: host: Clear the supported commands list when disabling
Whenever we disable Bluetooth we need to  clear the supported commands
array, because there are several functions that check whether a
controller is ready to receive a particular command by testing a bit on
that bitfield.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-04-01 11:21:51 +02:00
Carles Cufi
00636682ca Bluetooth: host: Introduce a new bt_hci_le_rand() call
In order to get rid of the duplication of the code that we had until now
in the tree, consolidate the handling of multiple calls to
bt_hci_cmd_send_sync(BT_HCI_OP_LE_RAND, ...) in a single location,
namely in hci_core.

This allows all of the users of this HCI command to use a single
implementation of the iterated sending of the HCI command to fill a
buffer with random bytes.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-04-01 11:21:51 +02:00
Vinayak Kariappa Chettimada
aab1b579b7 Bluetooth: Controller: Workaround nRF5340 Revision 1 Errata 117
Add implementation workaround for nRF5340 Revision 1 Errata
117.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-03-31 13:43:57 +02:00
Rubin Gerritsen
b52397584a Bluetooth: Controller: Enhance experimental SW_SPLIT Kconfigs names
This makes the it more intuitive when searching.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2022-03-31 10:29:21 +02:00
Rubin Gerritsen
8649eb122e Bluetooth: Controller: Only show one prompt for experimental configs
Uses the proposed workaround in
https://github.com/ulfalizer/Kconfiglib/issues/117

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2022-03-31 10:29:21 +02:00
Emil Gydesen
78fe76156b Bluetooth: Host: Add const to bt_conn_index
The `bt_conn_index` simply returns the index
of a `bt_conn` struct. There is no reason why
such a function should not use `const`.

Not using `const` will make other lookup/index
functions that perhaps relies on the bt_conn index
unable to use `const` as well.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-30 11:32:08 +02:00
Saleh Mehdikhani
d201d4d79a Bluetooth: Controller: Fixing value of sample_offset when PHY is 1M
When PHY is set to 1M, due to missed "break" statement of switch/case
the sample_offset will be set to the corresponding values of 2M
which causes improper function of sampling CTE signals.
By adding "break" statement the problem has solved.

Fixes: #44296

Signed-off-by: Saleh Mehdikhani <saleh.mehdikhani@unikie.com>
2022-03-30 11:30:05 +02:00
Emil Gydesen
5d18f93561 Bluetooth: Audio: Unicast client missing unref on ACL disconnected
The unicast client takes a reference to the ACL, but did
not return the reference when the ACL disconnected, but
rather just reset everything.

Modified to detach the stream, ensuring
a bt_conn_unref on ACL disconnect.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-29 12:30:07 -07:00
Lingao Meng
154f5c02a8 Bluetooth: host: crypto: Add a config to select how rand is generated
Considering that in most scenarios, bt_rand will not be called
frequently, but the current implementation of tinycrypt will
occupy more than 300 bytes of RAM space. Its existence is to
optimize the frequent call of bt_rand.

Therefore, it is considered to put it into a config
(`BT_HOST_CRYPTO_RANDOM`), when this config has been selected,
will use tinycrypt library for random. Otherwise will call bt random
hci command.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-03-29 12:59:33 +02:00
Vinayak Kariappa Chettimada
586ba9fd13 Bluetooth: Controller: Increase BT_RX_STACK_SIZE for BT_HCI_RAW enabled
Increase BT_RX_STACK_SIZE for BT_HCI_RAW enabled, as HCI
Extended Advertising Report generation requires more program
stack.

Without the update conformance test run failed with hanging
controller with mem manage fault.

Profiled the hci_uart sample using BlueZ by performing
`find -l` in `btmgmt` utility with the sample built
using:

CONFIG_THREAD_ANALYZER=y
CONFIG_THREAD_ANALYZER_AUTO=y
CONFIG_THREAD_ANALYZER_AUTO_INTERVAL=5
CONFIG_THREAD_NAME=y

Thread analyze:
 HCI uart TX         : STACK: unused 496 usage 528 / 1024 (51 %); CPU: 0 %
      : Total CPU cycles used: 146
 BT RX               : STACK: unused 72 usage 696 / 768 (90 %); CPU: 0 %
      : Total CPU cycles used: 3549
 BT RX pri           : STACK: unused 88 usage 168 / 256 (65 %); CPU: 0 %
      : Total CPU cycles used: 1210
 thread_analyzer     : STACK: unused 528 usage 496 / 1024 (48 %); CPU: 0 %
      : Total CPU cycles used: 889
 sysworkq            : STACK: unused 344 usage 168 / 512 (32 %); CPU: 0 %
      : Total CPU cycles used: 0
 logging             : STACK: unused 240 usage 528 / 768 (68 %); CPU: 0 %
      : Total CPU cycles used: 4305
 idle 00             : STACK: unused 228 usage 92 / 320 (28 %); CPU: 99 %
      : Total CPU cycles used: 3101052
 main                : STACK: unused 672 usage 352 / 1024 (34 %); CPU: 0 %
      : Total CPU cycles used: 395
 ISR0                : STACK: unused 1248 usage 800 / 2048 (39 %)

Signed-off-by: Vinayak Kariappa Chettimada <vinayak.kariappa@gmail.com>
2022-03-28 12:47:34 +02:00
Asbjørn Sæbø
ed2ea2c7df Bluetooth: Audio: Media - truncate strings for notification
Truncate strings being notified to fit the ATT_MTU, to prevent
notifications from not being delivered due to being too long.

For now uses the minimum ATT_MTU, as the MCS does not yet track
connections.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2022-03-28 12:46:53 +02:00
Abe Kohandel
3a03d9c50d bluetooth: ots: reduce directory listing memory usage
Allocating a buffer to hold the entire directory listing consumes a very
large sum of memory when a large number of OTS objects are supported.

This implementation minimizes the memory footprint of the directory
listing by only allocating the minimum necessary buffer size to allow
for efficient over the air transfer. The contents of the transferred
buffer are built incrementally and upon request.

The directory listing manipulation upon object creation and deletion can
be removed since the directory listing content is never constructed
until it is requested.

Signed-off-by: Abe Kohandel <abe.kohandel@gmail.com>
2022-03-28 12:45:51 +02:00
Emil Gydesen
a7ed7b7250 Bluetooth: Audio: Make bt_tbs_client_cb const
Add `const` for the bt_tbs_client_cb as it is a singleton
that should not change over time.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-28 12:45:03 +02:00
Emil Gydesen
b32491df11 Bluetooth: Audio: Add Telephone Bearer Client shell module
Add a shell module for the TBS client.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-28 12:45:03 +02:00
Emil Gydesen
ab4056ad8a Bluetooth: Audio: Add Telephone Bearer Service client
Add a client for the telephone bearer service (TBS).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-28 12:45:03 +02:00
Emil Gydesen
500a1792b8 Bluetooth: Audio: Add TBS shell module
Add a shell module for the TBS.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-28 12:45:03 +02:00
Emil Gydesen
2a08b9e73c Bluetooth: Audio: Add Telephone Bearer Service server
Add the telephone bearer service server implementation.
This support multiple service instances as well as the
generic telephone bearer service, but is still a work in
progress and should be treated as such.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-28 12:45:03 +02:00
Emil Gydesen
66479fd001 Bluetooth: Host: Remove duplicated bt_auth callbacks
Remove the duplicated pairing_complete, pairing_failed
and bond_deleted informational callbacks from bt_auth.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-25 15:17:18 -07:00
Emil Gydesen
9c2cf4ded5 Bluetooth: Host: Add auth_info_cb struct
Add a new callback structure for Bluetooth authentication

This struct is meant to replace the information-only
callbacks in bt_conn_auth_cb. The reason for this is that
due to the nature of bt_conn_auth_cb, it can only be registered
once. To allow mulitple users gain information about pairing
and bond deletions, this new struct is needed.

Samples, tests, etc. are updated to use the new struct.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-25 15:17:18 -07:00
Marek Pieta
15ebdfafe2 Bluetooth: Controller: Fix filter bdaddr list size
The lll_filter is used for rl_filter and fal_filter. Size of bdaddr
must be big enough for the worst case.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2022-03-25 16:13:06 +01:00
Emil Gydesen
fe91c1dbc4 Bluetooth: ISO: Add named enum for bt_iso_state
Add an enum for the state field, to provide more
semantics to it.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-25 15:36:02 +01:00
Emil Gydesen
9e862411b3 Bluetooth: ISO: Add STATE infix for ISO state enum
Change from BT_ISO_<state> to BT_ISO_STATE_<state>
to make the value more descriptive.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-25 15:36:02 +01:00
Emil Gydesen
5d25e34d89 Bluetooth: ISO: Add ing to the bt_iso (dis)connect-ing state
Add `ing` to the `BT_ISO_CONNECT` and `BT_ISO_DISCONNECT`
states, so that the name better matches the actual state.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-25 15:36:02 +01:00
Emil Gydesen
c1e95d6084 Bluetooth: Host: Add ing to the bt_conn (dis)connect-ing state
Add `ing` to the `BT_CONN_CONNECT` and `BT_CONN_DISCONNECT`
states, so that the name better matches the actual state.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-25 15:36:02 +01:00
Emil Gydesen
dc4d70da26 Bluetooth: conn: Expose simplified connection state in get_info
Add a state field in struct bt_conn_info that is a simplified
version of the internal state value (bt_conn_state_t).

This should provide an application to better determine the state
of the connection whne calling bt_conn_get_info, in case the
application does not keep track of the state itself.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-25 15:36:02 +01:00
Vinayak Kariappa Chettimada
2954658d3b Bluetooth: Controller: Cond. compile ISOAL for broadcast/receive only
Conditional compile ISOAL implementation to support ISO
Broadcast only and ISO Receive only application builds.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-03-25 12:52:11 +01:00
Vinayak Kariappa Chettimada
1825f81cd3 Bluetooth: Controller: Fix compiler error due to missing include file
Fix compile error, compiling the connectionless direction
finding samples, due to missing include file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-03-25 10:42:14 +01:00
Vinayak Kariappa Chettimada
690fc52a03 Bluetooth: Controller: Fix Periodic Sync CTE time reservations
Fix Periodic Advertising Synchronization time reservation
updated when enabling/disabling direction finding IQ
sampling.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-03-25 10:42:14 +01:00
Anders Storrø
c0eb461c50 Bluetooth: Mesh: shell several arg idx bug fix
Fixes errornous arg index for new identity in cmd_node_id.
Fixes errornous arg index for uuid in mod_pub_set.
Fixes errornous arg index for net_idx in hb_pub_set.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-03-25 10:42:08 +01:00
Anders Storrø
cbf97cb441 Bluetooth: Mesh: shell several arg idx bug fix
Fixes errornous arg index for new identity in cmd_node_id.
Fixes errornous arg index for uuid in mod_pub_set.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-03-25 10:42:08 +01:00