Skip to content

Commit

Permalink
Bluetooth: Controller: Fix prepare overhead in scheduling ISO
Browse files Browse the repository at this point in the history
Fix double prepare overhead considered in scheduling
extended, periodic and ISO broadcast radio events when using
LOW LAT variant.

ticks_slot maintained in ticker includes the overhead, the
ticks_slot stored in role/state context exclude the overhead
hence take care to include ticks_slot_overhead when value is
used from context and not when value used from ticker nodes.

Add jitter due to ticker resolution unit between scheduled
radio events. This will allow the synchronizing side too to
not overlap due to ticker resolution related jitter.

(cherry picked from commit 585d98e)

Original-Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
GitOrigin-RevId: 585d98e
Change-Id: I9f2481af2027e527384a6bdaff8af75ca8dc2560
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5233910
Tested-by: Tristan Honscheid <honscheid@google.com>
Reviewed-by: Tristan Honscheid <honscheid@google.com>
Commit-Queue: Tristan Honscheid <honscheid@google.com>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
  • Loading branch information
cvinayak authored and Chromeos LUCI committed Feb 3, 2024
1 parent 3a9a639 commit 25d981d
Showing 1 changed file with 11 additions and 30 deletions.
41 changes: 11 additions & 30 deletions subsys/bluetooth/controller/ll_sw/ull_sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,16 @@ static int group_free_slot_get(uint8_t user_id, uint32_t ticks_slot_abs,
#if defined(CONFIG_BT_BROADCASTER) && CONFIG_BT_CTLR_ADV_AUX_SET > 0
} else if (IN_RANGE(ticker_id, TICKER_ID_ADV_AUX_BASE,
TICKER_ID_ADV_AUX_LAST)) {
const struct ll_adv_aux_set *aux;

*ticks_anchor += ticks_to_expire;
*ticks_anchor += ticks_slot;
*ticks_anchor += HAL_TICKER_US_TO_TICKS(
EVENT_TICKER_RES_MARGIN_US << 1);

#if defined(CONFIG_BT_CTLR_ADV_PERIODIC)
const struct ll_adv_aux_set *aux;

aux = ull_adv_aux_get(ticker_id -
TICKER_ID_ADV_AUX_BASE);

#if defined(CONFIG_BT_CTLR_ADV_PERIODIC)
if (aux->lll.adv->sync) {
const struct ll_adv_sync_set *sync;

Expand All @@ -345,29 +346,15 @@ static int group_free_slot_get(uint8_t user_id, uint32_t ticks_slot_abs,
}
#endif /* CONFIG_BT_CTLR_ADV_PERIODIC */

if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT)) {
*ticks_anchor +=
MAX(aux->ull.ticks_active_to_start,
aux->ull.ticks_prepare_to_start);
}

return 0;

#if defined(CONFIG_BT_CTLR_ADV_PERIODIC)
} else if (IN_RANGE(ticker_id, TICKER_ID_ADV_SYNC_BASE,
TICKER_ID_ADV_SYNC_LAST)) {
*ticks_anchor += ticks_to_expire;
*ticks_anchor += ticks_slot;

if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT)) {
const struct ll_adv_sync_set *sync;

sync = ull_adv_sync_get(ticker_id -
TICKER_ID_ADV_SYNC_BASE);
*ticks_anchor +=
MAX(sync->ull.ticks_active_to_start,
sync->ull.ticks_prepare_to_start);
}
*ticks_anchor += HAL_TICKER_US_TO_TICKS(
EVENT_TICKER_RES_MARGIN_US << 1);

return 0;

Expand All @@ -376,16 +363,8 @@ static int group_free_slot_get(uint8_t user_id, uint32_t ticks_slot_abs,
TICKER_ID_ADV_ISO_LAST)) {
*ticks_anchor += ticks_to_expire;
*ticks_anchor += ticks_slot;

if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT)) {
const struct ll_adv_iso_set *iso;

iso = ull_adv_iso_get(ticker_id -
TICKER_ID_ADV_ISO_BASE);
*ticks_anchor +=
MAX(iso->ull.ticks_active_to_start,
iso->ull.ticks_prepare_to_start);
}
*ticks_anchor += HAL_TICKER_US_TO_TICKS(
EVENT_TICKER_RES_MARGIN_US << 1);

return 0;

Expand All @@ -398,6 +377,8 @@ static int group_free_slot_get(uint8_t user_id, uint32_t ticks_slot_abs,
TICKER_ID_CONN_LAST)) {
*ticks_anchor += ticks_to_expire;
*ticks_anchor += ticks_slot;
*ticks_anchor += HAL_TICKER_US_TO_TICKS(
EVENT_TICKER_RES_MARGIN_US << 1);

return 0;
#endif /* CONFIG_BT_CONN */
Expand Down

0 comments on commit 25d981d

Please sign in to comment.