Skip to content

Commit d6c3e04

Browse files
cvinayakcarlescufi
authored andcommitted
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>
1 parent 680e29d commit d6c3e04

File tree

3 files changed

+59
-4
lines changed

3 files changed

+59
-4
lines changed

subsys/bluetooth/controller/Kconfig.ll_sw_split

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,20 @@ config BT_CTLR_CENTRAL_SPACING
459459
(active clock jitter) + 17040 (PDU rx) = (radio event overheads +
460460
34234) microseconds.
461461

462+
config BT_CTLR_CENTRAL_RESERVE_MAX
463+
bool "Use maximum data PDU size time reservation for Central"
464+
depends on BT_CENTRAL
465+
default y
466+
help
467+
Use the maximum data PDU size time reservation considering the Data
468+
length could be updated from default 27 bytes to maximum support size.
469+
If maximum time reservation is disabled then time reservation
470+
corresponding to the default data length at the time of the
471+
start/enable of Central role is used.
472+
473+
Note, currently this value is only used to space multiple central
474+
connections and not for actual ticker time reservations.
475+
462476
config BT_CTLR_SLOT_RESERVATION_UPDATE
463477
bool "Update event length reservation after PHY or DLE update"
464478
depends on !BT_LL_SW_LLCP_LEGACY && (BT_CTLR_DATA_LENGTH || BT_CTLR_PHY)

subsys/bluetooth/controller/ll_sw/ull_sched.c

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
#include <zephyr/kernel.h>
8-
97
#include <zephyr/sys/byteorder.h>
8+
#include <zephyr/bluetooth/hci.h>
109

1110
#include "hal/ccm.h"
1211
#include "hal/radio.h"
@@ -44,7 +43,7 @@
4443
#include "ull_adv_internal.h"
4544
#include "ull_conn_internal.h"
4645

47-
#include <zephyr/bluetooth/hci.h>
46+
#include "ll_feat.h"
4847

4948
#include "hal/debug.h"
5049

@@ -875,8 +874,46 @@ static struct ull_hdr *ull_hdr_get_cb(uint8_t ticker_id, uint32_t *ticks_slot)
875874

876875
conn = ll_conn_get(ticker_id - TICKER_ID_CONN_BASE);
877876
if (conn && !conn->lll.role) {
877+
uint32_t ticks_slot_conn;
878+
879+
if (IS_ENABLED(CONFIG_BT_CTLR_CENTRAL_RESERVE_MAX)) {
880+
uint32_t ready_delay_us;
881+
uint16_t max_tx_time;
882+
uint16_t max_rx_time;
883+
uint32_t time_us;
884+
885+
#if defined(CONFIG_BT_CTLR_PHY)
886+
ready_delay_us =
887+
lll_radio_tx_ready_delay_get(conn->lll.phy_tx,
888+
conn->lll.phy_flags);
889+
#else
890+
ready_delay_us =
891+
lll_radio_tx_ready_delay_get(0U, 0U);
892+
#endif
893+
894+
#if defined(CONFIG_BT_CTLR_PHY_CODED)
895+
max_tx_time = PDU_DC_MAX_US(LL_LENGTH_OCTETS_TX_MAX,
896+
PHY_CODED);
897+
max_rx_time = PDU_DC_MAX_US(LL_LENGTH_OCTETS_RX_MAX,
898+
PHY_CODED);
899+
#else /* !CONFIG_BT_CTLR_PHY_CODED */
900+
max_tx_time = PDU_DC_MAX_US(LL_LENGTH_OCTETS_TX_MAX,
901+
PHY_1M);
902+
max_rx_time = PDU_DC_MAX_US(LL_LENGTH_OCTETS_RX_MAX,
903+
PHY_1M);
904+
#endif /* !CONFIG_BT_CTLR_PHY_CODED */
905+
906+
time_us = EVENT_OVERHEAD_START_US +
907+
ready_delay_us + max_rx_time +
908+
EVENT_IFS_US + max_tx_time;
909+
ticks_slot_conn =
910+
HAL_TICKER_US_TO_TICKS(time_us);
911+
} else {
912+
ticks_slot_conn = conn->ull.ticks_slot;
913+
}
914+
878915
*ticks_slot =
879-
MAX(conn->ull.ticks_slot,
916+
MAX(ticks_slot_conn,
880917
HAL_TICKER_US_TO_TICKS(
881918
CONFIG_BT_CTLR_CENTRAL_SPACING));
882919

tests/bluetooth/bsim_bt/bsim_test_multiple/prj.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@ CONFIG_BT_CTLR_RX_BUFFERS=6
4545
# (Event Overhead + Radio Ready Delay + Rx window + 1064 + 154 + 1064)
4646
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
4747
CONFIG_BT_CTLR_CENTRAL_SPACING=3750
48+
49+
# Do not use max data PDU size time reservation for connection events spacing
50+
# instead use lesser value as supplied in CONFIG_BT_CTLR_CENTRAL_SPACING
51+
CONFIG_BT_CTLR_CENTRAL_RESERVE_MAX=n

0 commit comments

Comments
 (0)