Skip to content

Commit 0a586db

Browse files
cvinayakpetejohanson
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 <[email protected]>
1 parent 0608058 commit 0a586db

File tree

3 files changed

+81
-17
lines changed

3 files changed

+81
-17
lines changed

subsys/bluetooth/controller/Kconfig.ll_sw_split

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -436,20 +436,40 @@ config BT_CTLR_SCHED_ADVANCED_CENTRAL_CONN_SPACING
436436
depends on BT_CTLR_SCHED_ADVANCED
437437
default 0
438438
help
439-
The central preferred connection spacing defines an additional spacing
440-
in microseconds, added to the fixed ~1250 us spacing obtained by enabling
441-
BT_CTLR_SCHED_ADVANCED. Specifying 0 (default) will obtain a spacing of
442-
~1250 us, whereas specifying 1250 will yield a spacing of ~2500 us.
443-
The spacing is defined as the distance in time between the anchor points
444-
of the established central role connections.
445-
The precision is determined by the resolution of the platform dependent
446-
ticker clock.
447-
When specifying values above 6.25 ms, the spacing may be unobtainable if
448-
the connection interval becomes smaller than the total spacing. In that
449-
case, modulo is applied and a total spacing of 15 ms on a 10 ms connection
450-
interval yields 5 ms spacing.
451-
For multiple connections, it may become impossible to honor the preferred
452-
spacing, in which case overlapping will occur.
439+
The preferred connection spacing between multiple simultaneous central
440+
roles in microseconds. The Controller will calculate the required time
441+
reservation using the data length and PHY currently in use. The
442+
greater of the preferred spacing and the calculated time reservation
443+
will be used.
444+
The precision is determined by the resolution of the platform
445+
dependent ticker clock.
446+
The upper range is a ceil value permitting any tuning of Controller's
447+
radio handling overheads and to allow Coded PHY S8 coding scheme PDU
448+
time, i.e. radio event overheads + 17040 (PDU Tx) + 150 (tIFS) + 4
449+
(active clock jitter) + 17040 (PDU rx) = (radio event overheads +
450+
34234) microseconds.
451+
452+
config BT_CTLR_CENTRAL_RESERVE_MAX
453+
bool "Use maximum data PDU size time reservation for Central"
454+
depends on BT_CENTRAL
455+
default y
456+
help
457+
Use the maximum data PDU size time reservation considering the Data
458+
length could be updated from default 27 bytes to maximum support size.
459+
If maximum time reservation is disabled then time reservation
460+
corresponding to the default data length at the time of the
461+
start/enable of Central role is used.
462+
463+
Note, currently this value is only used to space multiple central
464+
connections and not for actual ticker time reservations.
465+
466+
config BT_CTLR_SLOT_RESERVATION_UPDATE
467+
bool "Update event length reservation after PHY or DLE update"
468+
depends on !BT_LL_SW_LLCP_LEGACY && (BT_CTLR_DATA_LENGTH || BT_CTLR_PHY)
469+
default y
470+
help
471+
Updates the event length reservation after a completed Data Length Update
472+
and/or PHY Update procedure to avoid overlap of radio events
453473

454474
config BT_CTLR_LLL_PRIO
455475
int "Lower Link Layer (Radio) IRQ priority" if (BT_CTLR_ULL_LLL_PRIO_SUPPORT && !BT_CTLR_ZLI)

subsys/bluetooth/controller/ll_sw/ull_sched.c

Lines changed: 43 additions & 3 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"
@@ -48,6 +47,7 @@
4847
#define LOG_MODULE_NAME bt_ctlr_ull_sched
4948
#include "common/log.h"
5049
#include "hal/debug.h"
50+
#include "ll_feat.h"
5151

5252
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
5353
#if defined(CONFIG_BT_LL_SW_LLCP_LEGACY)
@@ -876,7 +876,47 @@ static struct ull_hdr *ull_hdr_get_cb(uint8_t ticker_id, uint32_t *ticks_slot)
876876

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

881921
return &conn->ull;
882922
}

tests/bluetooth/bsim_bt/bsim_test_multiple/prj.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,7 @@ CONFIG_BT_CTLR_RX_BUFFERS=6
4343
# accuracy, current value here is sufficient for 500ppm at 1 second interval.
4444
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
4545
CONFIG_BT_CTLR_SCHED_ADVANCED_CENTRAL_CONN_SPACING=1000
46+
47+
# Do not use max data PDU size time reservation for connection events spacing
48+
# instead use lesser value as supplied in CONFIG_BT_CTLR_CENTRAL_SPACING
49+
CONFIG_BT_CTLR_CENTRAL_RESERVE_MAX=n

0 commit comments

Comments
 (0)