Bluetooth: Controller: Central maximum data PDU size time spacing

Use the maximum data PDU size time reservation space
considering the Data length could be updated from default
27 bytes to maximum support size.

If maximum time reservation is disabled then time space
reservation corresponding to the default data length at the
time of the start/enable of Central role is used.

Note, currently this value is only used to space multiple central
connections and not for actual ticker time reservations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2022-12-15 13:05:23 +05:30 committed by Carles Cufí
commit d6c3e04eb8
3 changed files with 59 additions and 4 deletions

View file

@ -459,6 +459,20 @@ config BT_CTLR_CENTRAL_SPACING
(active clock jitter) + 17040 (PDU rx) = (radio event overheads + (active clock jitter) + 17040 (PDU rx) = (radio event overheads +
34234) microseconds. 34234) microseconds.
config BT_CTLR_CENTRAL_RESERVE_MAX
bool "Use maximum data PDU size time reservation for Central"
depends on BT_CENTRAL
default y
help
Use the maximum data PDU size time reservation considering the Data
length could be updated from default 27 bytes to maximum support size.
If maximum time reservation is disabled then time reservation
corresponding to the default data length at the time of the
start/enable of Central role is used.
Note, currently this value is only used to space multiple central
connections and not for actual ticker time reservations.
config BT_CTLR_SLOT_RESERVATION_UPDATE config BT_CTLR_SLOT_RESERVATION_UPDATE
bool "Update event length reservation after PHY or DLE update" bool "Update event length reservation after PHY or DLE update"
depends on !BT_LL_SW_LLCP_LEGACY && (BT_CTLR_DATA_LENGTH || BT_CTLR_PHY) depends on !BT_LL_SW_LLCP_LEGACY && (BT_CTLR_DATA_LENGTH || BT_CTLR_PHY)

View file

@ -4,9 +4,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#include <zephyr/kernel.h>
#include <zephyr/sys/byteorder.h> #include <zephyr/sys/byteorder.h>
#include <zephyr/bluetooth/hci.h>
#include "hal/ccm.h" #include "hal/ccm.h"
#include "hal/radio.h" #include "hal/radio.h"
@ -44,7 +43,7 @@
#include "ull_adv_internal.h" #include "ull_adv_internal.h"
#include "ull_conn_internal.h" #include "ull_conn_internal.h"
#include <zephyr/bluetooth/hci.h> #include "ll_feat.h"
#include "hal/debug.h" #include "hal/debug.h"
@ -875,8 +874,46 @@ static struct ull_hdr *ull_hdr_get_cb(uint8_t ticker_id, uint32_t *ticks_slot)
conn = ll_conn_get(ticker_id - TICKER_ID_CONN_BASE); conn = ll_conn_get(ticker_id - TICKER_ID_CONN_BASE);
if (conn && !conn->lll.role) { if (conn && !conn->lll.role) {
uint32_t ticks_slot_conn;
if (IS_ENABLED(CONFIG_BT_CTLR_CENTRAL_RESERVE_MAX)) {
uint32_t ready_delay_us;
uint16_t max_tx_time;
uint16_t max_rx_time;
uint32_t time_us;
#if defined(CONFIG_BT_CTLR_PHY)
ready_delay_us =
lll_radio_tx_ready_delay_get(conn->lll.phy_tx,
conn->lll.phy_flags);
#else
ready_delay_us =
lll_radio_tx_ready_delay_get(0U, 0U);
#endif
#if defined(CONFIG_BT_CTLR_PHY_CODED)
max_tx_time = PDU_DC_MAX_US(LL_LENGTH_OCTETS_TX_MAX,
PHY_CODED);
max_rx_time = PDU_DC_MAX_US(LL_LENGTH_OCTETS_RX_MAX,
PHY_CODED);
#else /* !CONFIG_BT_CTLR_PHY_CODED */
max_tx_time = PDU_DC_MAX_US(LL_LENGTH_OCTETS_TX_MAX,
PHY_1M);
max_rx_time = PDU_DC_MAX_US(LL_LENGTH_OCTETS_RX_MAX,
PHY_1M);
#endif /* !CONFIG_BT_CTLR_PHY_CODED */
time_us = EVENT_OVERHEAD_START_US +
ready_delay_us + max_rx_time +
EVENT_IFS_US + max_tx_time;
ticks_slot_conn =
HAL_TICKER_US_TO_TICKS(time_us);
} else {
ticks_slot_conn = conn->ull.ticks_slot;
}
*ticks_slot = *ticks_slot =
MAX(conn->ull.ticks_slot, MAX(ticks_slot_conn,
HAL_TICKER_US_TO_TICKS( HAL_TICKER_US_TO_TICKS(
CONFIG_BT_CTLR_CENTRAL_SPACING)); CONFIG_BT_CTLR_CENTRAL_SPACING));

View file

@ -45,3 +45,7 @@ CONFIG_BT_CTLR_RX_BUFFERS=6
# (Event Overhead + Radio Ready Delay + Rx window + 1064 + 154 + 1064) # (Event Overhead + Radio Ready Delay + Rx window + 1064 + 154 + 1064)
CONFIG_BT_CTLR_ADVANCED_FEATURES=y CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_CENTRAL_SPACING=3750 CONFIG_BT_CTLR_CENTRAL_SPACING=3750
# Do not use max data PDU size time reservation for connection events spacing
# instead use lesser value as supplied in CONFIG_BT_CTLR_CENTRAL_SPACING
CONFIG_BT_CTLR_CENTRAL_RESERVE_MAX=n