zephyr/tests/bluetooth/controller/mock_ctrl/include/kconfig.h
Piotr Pryga 131c089aaf Bluetooth: Controller: llcp: Fix wrong eff time calc if PHY changed
If there is a PHY change on a connection it may happen that effective
RX and TX time changes also. That change is applied after an instant.

Implemented handling of effective time calculation is based on the
maximum PDU length, new PHY and local (default) maximum TX or RX time.

The maximum TX value is set to default one that corresponds to PHY 1M
during the Controller initialization. It can be updated by host to other
value. By default Zephyr Host updates it to max possible TX time for all
supported PHYs. If PHY CODED is enabled, it is the longest possible TX
duration 17040 us.

The maximum RX value is set to default during connection creation.
In case of use of legacy advertising, the value is also related with
PHY 1M. It can be updated by data length extension procedure.

If the maximum RX value is set to some value and there is a change
of a PHY to one that requires more time to send a PDU with the same
length, then the maximum RX value is wrongly calculated.

Function pu_calc_eff_time returns a value that is the default_time
argument. The problem is that the default_time should be adjusted
to new maximum RX time required for a new PHY.

To solve that there should be an evaluation of a new maximum RX and
TX time based on new PHY.

The commit adds missing evaluation.

The problem occurred in DF tests that check collision mitigation
between PHY update control procedure and CTE request control procedure.

There was missing CONFIG_BT_CTLR_PHY_CODED option in CTE request
unit tests. The code was working because the ULL implementation of
PHY change control procedure does not verify if PHY CODED is supported.

When missing support was enabled, tests showed wrong evaluation of
maximum RX time. It also unveiled error in CTE request unit tests
implementation. The default_tx_time was set to wrong value 2120 us
as if PHY CODED was not supported. To fix it, the value was changed
to PDU_DC_PAYLOAD_TIME_MAX_CODED.

There was also added a mock for a feature exchange procedure done
during unit tests setup step. That allows to correctly calculate
maximum TX time by ull_dle_max_time_get function.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-05-26 16:29:10 +02:00

177 lines
3.8 KiB
C

/*
* Copyright (c) 2020 Demant
* Copyright (c) 2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Common Kconfig settings
*/
#ifndef CONFIG_BT_LL_SW_SPLIT
#define CONFIG_BT_LL_SW_SPLIT y
#endif
#define CONFIG_BT_CONN
#define CONFIG_BT_MAX_CONN 4
/* ensure that proper configuration is set */
#ifndef CONFIG_BT_PERIPHERAL
#define CONFIG_BT_PERIPHERAL y
#endif
#ifndef CONFIG_BT_CENTRAL
#define CONFIG_BT_CENTRAL y
#endif
#ifndef CONFIG_BT_CTLR_PHY
#define CONFIG_BT_CTLR_PHY 1
#endif
#ifndef CONFIG_BT_CTLR_PHY_2M
#define CONFIG_BT_CTLR_PHY_2M y
#endif
#ifndef CONFIG_BT_CTLR_PHY_CODED
#define CONFIG_BT_CTLR_PHY_CODED y
#endif
#ifndef CONFIG_BT_CTLR_LOW_LAT
#define CONFIG_BT_CTLR_LOW_LAT y
#endif
#ifndef CONFIG_BT_CTLR_ULL_HIGH_PRIO
#define CONFIG_BT_CTLR_ULL_HIGH_PRIO 1
#endif
#ifndef CONFIG_BT_CTLR_ULL_LOW_PRIO
#define CONFIG_BT_CTLR_ULL_LOW_PRIO 1
#endif
#ifndef CONFIG_BT_CTLR_DATA_LENGTH
#define CONFIG_BT_CTLR_DATA_LENGTH y
#endif
#ifndef CONFIG_BT_CTLR_DATA_LENGTH_MAX
#define CONFIG_BT_CTLR_DATA_LENGTH_MAX 251
#endif
#ifndef CONFIG_BT_CTLR_LE_ENC
#define CONFIG_BT_CTLR_LE_ENC y
#endif
#ifndef CONFIG_BT_CTLR_LE_PING
#define CONFIG_BT_CTLR_LE_PING y
#endif
#ifndef CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG
#define CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG y
#endif
#ifndef CONFIG_BT_CTLR_CONN_RSSI
#define CONFIG_BT_CTLR_CONN_RSSI y
#endif
#ifndef CONFIG_BT_CTLR_MIN_USED_CHAN
#define CONFIG_BT_CTLR_MIN_USED_CHAN y
#endif
#ifndef CONFIG_BT_CTLR_CONN_PARAM_REQ
#define CONFIG_BT_CTLR_CONN_PARAM_REQ y
#endif
#ifndef CONFIG_BT_CTLR_EXT_REJ_IND
#define CONFIG_BT_CTLR_EXT_REJ_IND y
#endif
#ifndef CONFIG_BT_CTLR_XTAL_ADVANCED
#define CONFIG_BT_CTLR_XTAL_ADVANCED y
#endif
#ifndef CONFIG_BT_CTLR_LLCP_CONN
#define CONFIG_BT_CTLR_LLCP_CONN 4
#endif
#ifndef CONFIG_BT_CTLR_LLCP_TX_PER_CONN_TX_CTRL_BUF_NUM_MAX
#define CONFIG_BT_CTLR_LLCP_TX_PER_CONN_TX_CTRL_BUF_NUM_MAX (4)
#endif
#ifndef CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM
#define CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM CONFIG_BT_CTLR_LLCP_CONN
#endif
#ifndef CONFIG_BT_CTLR_LLCP_REMOTE_PROC_CTX_BUF_NUM
#define CONFIG_BT_CTLR_LLCP_REMOTE_PROC_CTX_BUF_NUM CONFIG_BT_CTLR_LLCP_CONN
#endif
#ifndef CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM
#define CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM 2
#endif
#ifndef CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM
#define CONFIG_BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM 1
#endif
/*
* Direction finding related Kconfig settings
*/
/* Direction finding non LE Features configs */
#ifndef CONFIG_BT_CTLR_DF
#define CONFIG_BT_CTLR_DF y
#endif
#ifndef CONFIG_BT_CTLR_DF_CTE_TX
#define CONFIG_BT_CTLR_DF_CTE_TX y
#endif
#ifndef CONFIG_BT_CTLR_DF_CTE_RX_SAMPLE_1US
#define CONFIG_BT_CTLR_DF_CTE_RX_SAMPLE_1US y
#endif
#ifndef CONFIG_BT_CTLR_DF_ANT_SWITCH_1US
#define CONFIG_BT_CTLR_DF_ANT_SWITCH_1US y
#endif
/* Direction finding LE Features configs */
#ifndef CONFIG_BT_CTLR_DF_CONN_CTE_RX
#define CONFIG_BT_CTLR_DF_CONN_CTE_RX y
#endif
#ifndef CONFIG_BT_CTLR_DF_CONN_CTE_TX
#define CONFIG_BT_CTLR_DF_CONN_CTE_TX y
#endif
#ifndef CONFIG_BT_CTLR_DF_CONN_CTE_REQ
#define CONFIG_BT_CTLR_DF_CONN_CTE_REQ y
#endif
#ifndef CONFIG_BT_CTLR_DF_CONN_CTE_RSP
#define CONFIG_BT_CTLR_DF_CONN_CTE_RSP y
#endif
#ifndef CONFIG_BT_CTLR_DF_ANT_SWITCH_TX
#define CONFIG_BT_CTLR_DF_ANT_SWITCH_TX y
#endif
#ifndef CONFIG_BT_CTLR_DF_ANT_SWITCH_RX
#define CONFIG_BT_CTLR_DF_ANT_SWITCH_RX y
#endif
#ifndef CONFIG_BT_CTLR_DF_CTE_RX
#define CONFIG_BT_CTLR_DF_CTE_RX y
#endif
#ifndef CONFIG_BT_CTLR_DF_MAX_ANT_SW_PATTERN_LEN
#define CONFIG_BT_CTLR_DF_MAX_ANT_SW_PATTERN_LEN 38
#endif
/* Kconfig Cheats */
#define CONFIG_BT_LOG_LEVEL 1
#define CONFIG_BT_CTLR_COMPANY_ID 0x1234
#define CONFIG_BT_CTLR_SUBVERSION_NUMBER 0x5678
#define CONFIG_BT_CTLR_ASSERT_HANDLER y
#define CONFIG_BT_BUF_ACL_TX_COUNT 7
#define CONFIG_BT_BUF_ACL_TX_SIZE 27
#define CONFIG_BT_CTLR_RX_BUFFERS 7