Before a LL_FEATURE_REQ is sent, verify that the Data Length Update
procedure is still supported as it could have been unmasked as the result
of a previously completed Feature Exchange procedure.
Add unit test to verify the case of enqueuing both a
Feature Exchange procedure and Data Length Update procedure, where the
Feature Exchange procedure would result in the unmasking of the Data
Length Update procedure.
Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
Resume the TX Data Q when a LL_UNKNOWN_RSP is recieved instead of a
LL_PHY_RSP.
Update PHY Update unit test with more coverage of the TX Data Q pause
state.
Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
If an instant based remote procedure 'overtakes' a local ditto
the local procedure will be 'completed' by remote rejection
but collision flag would not get set ensuring that a new local
conflicting procedure cannot be started before the remote is completed.
This can thus lead to invalid local initiation.
Added unittest to cover case
Fix by ensuring collision flag is set also in the above mentioned
scenario.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
rp_enc_state_wait_ltk_reply() is executed in thread context, so
it is not allowed to move the encryption state machine forward.
Defer LTK reply handling to next prepare event by introducing a continue
state.
Update the unit test to reflect this, and remove the TODO that actually
said there was an issue in the first place.
Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
- Fix masking for no coded phy
- Allow ISO_Interval < SDU_Interval for framed mode
- Change BT_HCI_ERR_INSUFFICIENT_RESOURCES to
BT_HCI_ERR_CONN_LIMIT_EXCEEDED.
- Prevent starting same CIS twice
- Cancel an initiated CIS creation procedure if terminated before
sending CIS_IND.
- Implement canceling of local CC procedure. Respond to CIS_RSP with
REJECT, if canceled after CIS_REQ was sent.
- Introduce state CIG_STATE_INITIATING for central, to keep track of
initiating CIS connection, in transition between CONFIGURABLE and
ACTIVE.
Fixes EBQ test /HCI/CIS/BC-03-C.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Add test to verify that
1) A peripheral role cannot initiate an encryption pause
2) A peripheral role rejects a LL_PAUSE_ENC_REQ while a CIS is
established
Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
In order to have clean, self-contained HCI headers that do not have any
dependencies towards the Host or any other part of the system (except
types), reorganize the headers in the following way:
- Split out the macros and structs from hci.h to a new hci_types.h
- Merge the existing hci_err.h into the new hci_types.h
Fixes#58214.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
When possible re-use the already allocated RX node for notifications.
Store (retain) RX node and Link element on RX if NTF could occur.
Pass link element to LLCP (ull_cp_rx()) together with RX node.
New RX node type RETAIN introduced to signal retention
When no RX node is available allocate one and hold off TX on procedures
until such time that a node is available for NTF.
In case waiting for NTF buffer avail is needed, allocate and store TX
node to use for TX once NTF becomes available.
CIS Established (incl. timeout handling) is now handled entirely as a
specific event driven by ull_conn_iso - ie removal of procedure check
of cis->established and cis->expire, as this is doubling mechanism
in the conn_iso context.
Unit test and helpers updated to handle new node type.
Function ull_cp_release_ntf() was used only in unit test, so moved to
helper context.
Updating release_ntf to handle the fact that with piggy-backing in test
context the node used for NTF can be from two different memory pools
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Twister now supports using YAML lists for all fields that were written
as space-separated lists. Used twister_to_list.py script. Some artifacts
on string length are due to how ruamel dumps content.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Include ticker expire remainder value when calculating the
cis_offset to acheive fine timing in scheduling the CIG
radio events relative to its associated ACL radio events.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Start/pause encryption should not be initiated on ACL with CIS
established (BT Core Spec 5.4, Vol 6, Part B, Sect. 5.1.3)
Adding test for the added procedure peek function
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
In the helper-module we do a memcpy of a structure but the size
is possibly incorrect.
This PR ensures that the correct sizes are used.
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Use the minimum supported cis_offset_min considering that
ACL radio event does not overlap with CIG event. Use the
calculated maximum of local and remote cis_offset_min in the
Response PDU.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Many areas of Zephyr divide and round up without using the DIV_ROUND_UP
macro. Make use of it, so that we make use of a tested system macro and
at the same time we make code more readable.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit removes the legacy LLCP code including the
Kconfig option
It also updates the babblesim tests, and removes the
tests for the legacy controller
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Fix scan window value corruption due to modification of
stored ticks_window value when enabling continuous scan.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When possible re-use the already allocated RX node for notifications.
Store (retain) RX node and Link element on RX if NTF could occur.
Pass link element to LLCP (ull_cp_rx()) together with RX node.
New RX node type RETAIN introduced to signal retention
When no RX node is available allocate one and hold off TX on procedures
until such time that a node is available for NTF.
In case waiting for NTF buffer avail is needed, allocate and store TX
node to use for TX once NTF becomes available.
CIS Established (incl. timeout handling) is now handled entirely as a
specific event driven by ull_conn_iso - ie removal of procedure check
of cis->established and cis->expire, as this is doubling mechanism
in the conn_iso context.
Unit test and helpers updated to handle new node type.
Function ull_cp_release_ntf() was used only in unit test, so moved to
helper context.
Updating release_ntf to handle the fact that with piggy-backing in test
context the node used for NTF can be from two different memory pools
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
The number of connections for the tx_buffer_alloc needs to be at least 3
For one of the tests it was set to default 1, which leads to unspecified
behaviour.
This is fixed by setting the maximum nr. of connections to 4
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Adds REQUIRED to samples and tests for finding the zephyr package
to align all samples and tests with the same call and parameters.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
In ull_llcp* some functions used in unittesting did not have
the llcp_ prefix
Although this is not a big issue since they are only used when
testing the module this commit adds the prefix so that we
have a more consistent naming
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Update unittests for the following areas/controll procedures
- API
- collision handling
- invalid PDUs
- unsupported procedures
- buffer allocation
- TX queue
- Data Length Update
- PHY update
- Encryption
- Ping
- Version
- Channel map update
- Min. used channels
- Connection update
- SCA
- Terminate connection
- CTE request
- CIS create
- CIS terminate
Also moved the internal API tests from the ull_llcp* files
to the proper unittest C-file
Unused files are removed
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Use instant_latency at the CIG start event count to detect
skipped connection event around the instant. In the future
add implementation to compensate for skipped ACL connection
event and adjust the CIS event count at CIG start.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Make Data, ISO, BIS and CIS PDU structure's octet 3 vendor
specific.
This will allow vendors not supporting the octet 3 or
CTEInfo (8 bits) to save 1 octet in their PDU structures.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
To be able to timely start the first CIS/CIG, if the requested instant
is the next connection event, call ull_peripheral_iso_start directly
from rp_cc_state_wait_rx_cis_ind instead of waiting for next time
through the state machine.
To enable ULL/LLL to prevent adding latency when LLCP is waiting for
instant, local- and remote procedures with instant now expose a function
for checking this state.
Fixed event_counter function to prevent one-off in RX path. Unified to
use single function ull_conn_event_counter.
Fixed LLCP unit tests and added new mock function.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Update the unittests for feature exchange to use the new ZTEST API
Here we only update the feature exchange procedure. The remaining
unittests will be done in a next PR
Mocks, helper routines and the Unit Under Test are splitted out as
a library instead of adding them to the file list
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Fix the controller implementation to perform connection
event length reservation based on the completed Data Length
Update and/or PHY Update Procedure.
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
The status field is currently a uint32_t even though there are only
3 possible values. Reducing it to a uint8_t allows status to fit in
existing padding in the struct, saving 4 bytes per ticker_user_op
Updated function signatures to match; ticker_op_func left as-is
to avoid having to update a whole bunch of files for no real benefit
Signed-off-by: Troels Nilsson <trnn@demant.com>
The underlying Kconfig setting NET_BUF_USER_DATA_SIZE is not used anywhere,
so this define is removed here.
Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
Instead of storing the calculated reload value (in conn intervals) in
the conn object, now store the timeout value, and perform calculation
when used. This allows using the timeout value across all CIS's without
having to re-calc and store on change of TO
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Add mayfly locking around the access to the local pending procedure list
as it is accessed by both thread and mayfly.
Fixes#45427
Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
The `bluetooth/common/log.h` and `bluetooth/common/log.c` files have been
removed. Files that were using them have been updated to use
`zephyr/logging/log.h` instead.
Those replacement have been done consequently:
- `/BT_DBG/LOG_DBG/`
- `/BT_ERR/LOG_ERR/`
- `/BT_WARN/LOG_WRN/`
- `/BT_INFO/LOG_INF/`
- `/BT_HEXDUMP_DBG/LOG_HEXDUMP_DBG/`
- `/BT_DBG_OBJ_ID/LOG_DBG_OBJ_ID/`
Also, some files were relying on the `common/log.h` include to include
`zephyr/bluetooth/hci.h`, in those cases the include of `hci.h` has
been added.
For files that were including `common/log.h` but not using any logs,
the include has been removed and not replaced.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Adding support for allowing user extension code to support deferring
anchor point moves. Refactored LLCP only.
Note: This is NOT supported by LEGACY LLCP impl.
KConfig'd by BT_CTLR_USER_CPR_ANCHOR_POINT_MOVE
Modified ll_conn_update API, to accommodate passing offsets
Modified CPR/CU context data structure
Modified CPR/CU procedure to handle anchor point move wait state
Fixed up unit tests, adding anchor point move cases to CPR/CU test
Signed-off-by: Erik Brockhoff <erbr@oticon.com>