Commit graph

9523 commits

Author SHA1 Message Date
Piotr Pryga
85c4176446 Bluetooth: controller: Add handling of CTE request failed
CTE request control procedure may failed due to rejection by
peer device or due to receive of LL_CTE_RSP PDU without CTE.
These events has to be reported to host by HCI_LE_CTE_Request_Failed.

The commit adds missing functionalit.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Piotr Pryga
cb29f29cc9 Bluetooth: Controller: Integrate CTE req in ULL with refactored LLCPs
Integrate existing CTE request control procedure code in ULL with
implementation of refactor LLCPs.
The commit includes code responsible for:
- enabling CTE request and scheduling its execution by refactored
  LLCPs framework,
- running CTE request periodically
- disabling CTE reqest in case it is running periodic

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Piotr Pryga
f6f1ab9071 Bluetooth: Controller: Add storage for remote CTE request data
There are data received from peer device with CTE request.
These data are not part of local CTE request procedure and
they don't belong to CTE response configuration, hence separate
storage was provided.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Piotr Pryga
e25380b59f Bluetooth: Controller: Remove unused members from llcp_df_rsp_cfg
ant_sw_len and ant_ids members of the structure llcp_df_rsp_cfg
were not used. These data are stored in lll_df_conn_tx_cfg
that is member of lll_conn. Unused members are removed.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Piotr Pryga
6587336a5b Bluetooth: Controller: llcp: Make remote CTE REQ to compile with CTE RSP
Part of the CTE request procdure that is related with handling of
remote request should be compiled when CTE RSP is enabled.
Withouth it CTE response will not work. Local CTE request does not
need code reponsible for handling of remote reques.

The commit changes conditional compilation guards.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Piotr Pryga
e3eb224cd0 Bluetooth: Controller: Add init CTE REQ and RSP variables on conn create
There were missing initialization for CTX request and response conotrol
procedure related variables. The variables were zeored on system
startup but not initialized when a connection is established.
In case of re-use of connection instance for new connection it was not
possible to setup procedures again.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Piotr Pryga
0086e86153 Bluetooth: hci: Fix wrong CTE request interval type
Request interval is a number of connection events that
is used to periodically run CTE request control procedure.
BT 5.3 Core Specification defines it as 2 octets long.
It had wrong type uint8_t. Changed to correct one uint16_t.

The commit also changes type of cte_rsp_en field of lll_df_conn_tx_cfg
to state that it is a boolean flag.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Piotr Pryga
5e2211fa3c Bluetooth: Controller: df: Use PDUs CTEInfo to config radio TX
CTE type and length parameters in connected mode are dependent
on remote CTE request procedure. These parameters are required
to setup radio to correctly transmit CTE. The same parameters
are also included in CTEInfo byte of data channel PDU header.
The parameters were provided to LLL with PDU to be transmitted
and by lll_conn::df_tx_cfg, hence it was redundant.
The PDUs CTEInfo has to be set before transmission anyway.
The contents of the PDU are set in ULL by CTE RSP control
procedure. To remove redundancy CTE length and type from lll_df_-
conn_tx_cfg were removed from ll_df_conn_tx_cfg. It was better
option becuse it saves instructions in LLL.

Radio in connected mode was configured by lll_df_conn_cte_tx_enable.
The function just unpacked the lll_df_conn_tx_cfg mebmers and
called static function df_cte_tx_configure.
Instead of extending parameters list of lll_df_conn_cte_tx_enable,
the function was removed and df_cte_tx_configure was changed to
be global function - lll_df_cte_tx_configure.
Now LLL directly passes all parameters from pdu_data::cte_info
and ll_df_conn_tx_cfg to lll_df_cte_tx_configure.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Piotr Pryga
569cdaa58d Bluetooth: Controller: llcp: setting of CTE related content in pdu_data
The llcp_pdu_encode_cte_rsp functio didn't set pdu_data fields related
with CTE transmission. The commit fixes that.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Piotr Pryga
c50b474e01 BLuetooth: Controller: llcp: Fix wrong conditions in remote CTE req
There were wrong conditions in rp_comm_tx function for CTE request
that vefiry if:
- PHY is allowed one,
- CTE length is within allowed value.

The commit fixes it.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Piotr Pryga
c5812bab5e Bluetooth: Controller: Add Kconfig to enable CTE RX in conn mode
The CTE reception and sampling in connected mode was enabled
with CONFIG_BT_CTLR_DF_CONN_CTE_REQ. This is a separate fearure
tha can be enabled when CTE reqest procedure is disabled.
What more the CONFIG_BT_CTLR_DF_CONN_CTE_REQ is dependent
on CONFIG_BT_CTLR_DF_CONN_CTE_RX, not other way around.

The commit adds separate Kconfig to provide such possibility.
Also changes compilation guards for code related with the
CTE reception and sampling.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Piotr Pryga
4080b03b0b Bluetooth: Controller: ull: df: use new LLCP structus in conn CTE req
The implementation of the ll_df_set_conn_cte_req_enable function was
based on former implementation of LLCPs. The CTE request and response
control procedures are not implemented in former LLCPs framework.
The code has been updated to use data structues from refactored
implementation of LLCPs.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Piotr Pryga
b379bf99aa Bluetooth: Controller: ULL: Add impl for HCI connection CTE rsp enable
There were missing code responsible for execution of HCI_LE_Connection_-
CTE_Response_Enable HCI command.

The commit adds missing implementation into hci and upper link layer.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-01-21 09:30:23 -05:00
Emil Gydesen
eb2ae4c5a9 Bluetooth: ISO: Fix missing ISO type for peripheral ISO
For the peripheral ISO role, the iso->type was never set,
causing setup data path to fail.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-21 15:46:01 +02:00
Nazar Palamar
db1538e7cf Bluetooth: host: Update hci_init function to call setup function.
Updated hci_init function to call HCI vendor-specific Setup function
(bt_dev.drv->setup()) on beginning of HCI initialization.

This feature need when the BT Controller requires execution of the
vendor-specific commands sequence to initialize the BT Controller before
the BT Host executes a Reset sequence. To enable this feature the
CONFIG_BT_HCI_SETUP should be enable.

Fixes #41140

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2022-01-21 15:04:15 +02:00
Vinayak Kariappa Chettimada
b5e749edfe Bluetooth: Controller: Apply suggestions from code review
Apply suggestions from code review.

Co-authored-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-01-19 13:45:09 -05:00
Vinayak Kariappa Chettimada
af5e6a1108 Bluetooth: Controller: Skip re-init of static initialized PDU fields
Skip re-initialization of statically initialized PDU struct
fields that are not modified at runtime.

When supporting connection oriented CTE, the cp bit and
resv field used for CTE info are modified, hence
re-initialized these and accordingly reset the values
when just-in-time HCI Tx Data fragmentation is performed
in the Lower Link Layer.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-01-19 13:45:09 -05:00
Emil Gydesen
20264174b8 Bluetooth: ISO: Remove double dereferencing in init functions
Remove the double dereferencing in the big_init_bis and
cig_init_cis functions.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 13:19:47 -05:00
Emil Gydesen
0785e9479d Bluetooth: ISO: Add function to get info of ISO channel
The application may want to want the type of an
ISO channel, and take action based on what the type is.

It has been implemented as a get_info to be
consistent with other get_info functions in the
Bluetooth subsystem.

The bt_iso_info struct can be expanded with more information
later as required.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 13:19:47 -05:00
Emil Gydesen
c6b78b93d9 Bluetooth: ISO: Add ISO channel type
Add a enum for the ISO channel type instead of using
a boolean for just bis/cis.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 13:19:47 -05:00
Emil Gydesen
28a133cf6d Bluetooth: ISO: Fix bad chan pointer for disconnect
If a central disconnects an ISO, then the `chan` pointer
will become NULL before attempting to call the
disconnect callback.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 13:16:30 -05:00
Anders Storrø
a37ee2be6e Bluetooth: Mesh: LPN teminate cb establish clause
Adds clause so that the LPN  must have a established friend
connection for the connection terminate callback to trigger
upon clearing a friendship.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-01-18 10:41:18 -05:00
Emil Gydesen
ffd4fd571a Bluetooth: CSIS: Merge the two client discovery functions
Merges bt_csis_client_discover and
bt_csis_client_discover_sets, as they should be done
together for the discovery procedure from the CSIP
spec.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
e9703294b1 Bluetooth: CSIS: Rename bt_csis_client_set
Rename struct bt_csis_client_set to
struct bt_csis_client_csis_inst, as that is more descriptive
of the actual content of the struct.

This also avoids the confusion about what a "set" is,
which is clearly not a single instance of CSIS
on a single remote server.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
47e23ab344 Bluetooth: CSIS: Add bt_csis_client_set_info struct
Several APIs worked on the bt_csis_client_set struct,
which not only included information about a set, but
also a reference to a specific CSIS instance.

A specialized struct only for the set information
is more useful in those scenarios.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
3953289fda Bluetooth: CSIS: Modify bt_csis_client_get_lock_state to read all members
Modify bt_csis_client_get_lock_state to be the Ordered Access
procedure, which means that instead of reading a single lock value
on a single device, it will read the lock value for all
set members supplied in the function, and return true if any
of them is locked, or false otherwise.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
086d2e0270 Bluetooth: CSIS: Remove set handle check from verify_members_and_get_inst
The verify_members_and_get_inst can be used for more than just
locking the set, so checking the specific handle in that
does not make sense.

The handle is furthermore already checked in
csis_client_write_set_lock.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
18b6501ff9 Bluetooth: CSIS: Fix wrong handle check in csis_client_write_set_lock
The wrong handle value was checked.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
9c5f30a64c Bluetooth: CSIS: Rename bt_csis_client_lock_get
Rename bt_csis_client_lock_get to
bt_csis_client_get_lock_state. `get` could be
misunderstood as acquire, i.e. that `get` would
mean that the lock was taken by this device.

The new name should make it more obviously that it
is just a read procedure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
ebb962dfc3 Bluetooth: CSIS: Document missing functions in csis.h
Document the functions and callbacks, macros, etc. that
was missing in the file.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
f13aa0e059 Bluetooth: CSIS: Remove addr from bt_csis_client_set_member
Remove the addr struct from bt_csis_client_set_member as that
was only used by the upper layers and not the CSIS client
itself, and as such should only reside in the
upper layers.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
f2401ecbe9 Bluetooth: CSIS: Don't expose SIRK type to upper layers
Change how the SIRK is exposed to the upper layers.
The SIRK will always be the unencrypted 16 octet
SIRK now, instead of a struct.

This not only allows us to avoid having a
__packed struct in the API, but also gives a better
API as we don't expose encrypted data to the upper layers.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
e7ec241fe7 Bluetooth: CSIS: Remove BT_CSIS_ERROR_SIRK_ACCESS_REJECTED
Remove the error code BT_CSIS_ERROR_SIRK_ACCESS_REJECTED
as it no longer exists in the specification.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
170d094ca8 Bluetooth: CSIS: Refactor bt_csis_client_lock_get to use member
Refactor the bt_csis_client_lock_get function to use a
pointer to a member and a set instead of a bt_conn
pointer and an index.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
bb5b1901fd Bluetooth: CSIS: Fix bad lock and release set error values
Some lock_set and release_set callback had incorrect error
messages.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
9c3745a69b Bluetooth: CSIS: Refactor bt_csis_client_lock_read_cb to use set
Refactor the bt_csis_client_lock_read_cb callback to use
a bt_csis_client_set pointer instead of conn and index.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
061fb633a5 Bluetooth: CSIS: Remove conn from bt_csis_client_lock_changed_cb
The connection pointer can be inferred based on the
set pointer, by using e.g. CONTAINER_OF.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
fa1be6436a Bluetooth: CSIS: Refactor bt_csis_client_discover_sets to use member
Refactor bt_csis_client_discover_sets to use the
bt_csis_client_set_member struct instead of a bt_conn.
The bt_csis_client_set_member represents a remote server
(set member), and make it possible to avoid sending indexes
of instances around instead of bt_csis.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
728f390f65 Bluetooth: CSIS: Remove unused functions and callbacks from csis.h
Remove the lock and release sets functions, as well
as the discover member function as they have been removed
from the implementation a while ago.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
2bf89990ee Bluetooth: CSIS: Expose bt_csis to client via bt_csis_client_set_member
Use the bt_csis_client_set_member struct to store the individual
bt_csis client struct. This way they are exposed to the
client application.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
c8be71a257 Bluetooth: CSIS: Use bt_csis for CSIS client
Use the bt_csis struct instead of the
bt_csis_client_svc_inst struct for the CSIS client.
This makes it more similar to not only the CSIS
implementation, but also the other LE Audio
client implementations.

Furthermore, this change will make it easier to use
bt_csis in the API in the future.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
ca8ed046a1 Bluetooth: CSIS: Rename servers to client_insts in csis_client.c
Rename the array to a more descriptive name and change the type
to bt_csis, as well as renaming the individual variables
when accessing the array.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen
f2b4896536 Bluetooth: CSIS: Move csis_instance to csis_internal.h
Move the struct definition to the internal header file,
and add it to the bt_csis struct.

This also renames the csis_instance to
bt_csis_client_svc_inst to use the bt_csis prefix.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Anders Storrø
499c4fb1e3 Bluetooth: Mesh: Add LPN-disable BabbleSim test
Adds test to check correct behaviour for disabling
LPN feature.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-01-17 15:49:46 -05:00
Anders Storrø
e6d0ec1aba Bluetooth: Mesh: Add check to LPN friend_req_sent
Adds state check to the friend_req_sent CB to ensure
that the CB does not alter the LPN state if it is in a
disabled state. This resolves behavioural issue for lpn_set(false).

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-01-17 15:49:46 -05:00
Krzysztof Chruscinski
262cc55609 logging: Deprecate v1, default to v2
Reduced logging mode selection to deferred, immediate, minimal and
frontend. Decoupled logging version from mode and created CONFIG_LOG1
which can be used to explicitly select deprecated version.

From now on, chosing CONFIG_LOG_MODE_{IMMEDIATE,DEFERRED} will result
in version2.

Deprecated CONFIG_LOG2_MODE_{IMMEDIATE,DEFERRED} with cmake warning.

Codebase adapted to those changes.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-17 15:49:10 -05:00
Trond Einar Snekvik
eadf04af82 Bluetooth: Mesh: Return a boolean from subnet_find callback
bt_mesh_subnet_find calls a callback for every subnet, and returns the
subnet that got a non-zero return code from the callback. As pointed out
in #41693, the callback should return a boolean, not an int.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2022-01-17 11:52:57 -05:00
Anders Storrø
8d9735824a Bluetooth: Mesh: GATT proxy enable fix for ext adv
Adds fix so that a node running with extended adveriser is able to
enable GATT proxy correctly. This fixes a corner case issue  where a
device with no other ongoing message sending is unable to advertise
the GATT proxy through
bt_mesh_gatt_proxy_set(BT_MESH_FEATURE_ENABLED) .

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-01-17 11:43:39 -05:00
Morten Priess
c71dd80834 Bluetooth: controller: Fixed BSIM ISO compile error
Added missing #includes for access to ULL functions.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2022-01-13 15:15:49 +01:00
Rubin Gerritsen
a722c014ad Bluetooth: Host: Support setting long periodic adv data
If the advertiser is not running, the host can now set
periodic advertising data in multiple operations.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2022-01-13 13:23:29 +01:00