Skip to content

Commit

Permalink
Bluetooth: Controller: Fix ISO Sync Receiver time reservations
Browse files Browse the repository at this point in the history
Fix ISO Sync Receiver time reservation calculation to use
peer broadcasted bis_spacing and sub_interval, instead of
incorrectly calculating using local implementation used
tMSS value.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
  • Loading branch information
cvinayak committed Nov 3, 2024
1 parent cd8bd8b commit 913f41d
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions subsys/bluetooth/controller/ll_sw/ull_sync_iso.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,6 @@ void ull_sync_iso_setup(struct ll_sync_iso_set *sync_iso,
struct pdu_big_info *bi;
uint32_t ready_delay_us;
uint32_t ticks_expire;
uint32_t ctrl_spacing;
uint32_t pdu_spacing;
uint32_t interval_us;
uint32_t ticks_diff;
struct pdu_adv *pdu;
Expand Down Expand Up @@ -581,11 +579,6 @@ void ull_sync_iso_setup(struct ll_sync_iso_set *sync_iso,
interval_us -= lll->window_widening_periodic_us;

/* Calculate ISO Receiver BIG event timings */
pdu_spacing = PDU_BIS_US(lll->max_pdu, lll->enc, lll->phy,
PHY_FLAGS_S8) +
EVENT_MSS_US;
ctrl_spacing = PDU_BIS_US(sizeof(struct pdu_big_ctrl), lll->enc,
lll->phy, PHY_FLAGS_S8);

/* Number of maximum BISes to sync from the first BIS to sync */
/* NOTE: When ULL scheduling is implemented for subevents, then update
Expand All @@ -605,22 +598,32 @@ void ull_sync_iso_setup(struct ll_sync_iso_set *sync_iso,
*/

if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_ISO_RESERVE_MAX)) {
/* Maximum time reservation for both sequential and interleaved
uint32_t ctrl_spacing;

/* Maximum time reservation for sequential and interleaved
* packing.
*/
slot_us = (pdu_spacing * lll->nse * num_bis) + ctrl_spacing;
if (lll->bis_spacing >= (lll->sub_interval * lll->nse)) {
slot_us = lll->sub_interval * lll->nse * num_bis;
} else {
slot_us = lll->bis_spacing * lll->nse * num_bis;
}

ctrl_spacing = PDU_BIS_US(sizeof(struct pdu_big_ctrl), lll->enc,
lll->phy, PHY_FLAGS_S8);
slot_us += ctrl_spacing;

Check notice on line 614 in subsys/bluetooth/controller/ll_sw/ull_sync_iso.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/bluetooth/controller/ll_sw/ull_sync_iso.c:614 - ctrl_spacing = PDU_BIS_US(sizeof(struct pdu_big_ctrl), lll->enc, - lll->phy, PHY_FLAGS_S8); + ctrl_spacing = + PDU_BIS_US(sizeof(struct pdu_big_ctrl), lll->enc, lll->phy, PHY_FLAGS_S8);

} else if (lll->bis_spacing >= (lll->sub_interval * lll->nse)) {
/* Time reservation omitting PTC subevents in sequential
* packing.
*/
slot_us = pdu_spacing * ((lll->nse * num_bis) - lll->ptc);
slot_us = lll->sub_interval * ((lll->nse * num_bis) - lll->ptc);

} else {
/* Time reservation omitting PTC subevents in interleaved
* packing.
*/
slot_us = pdu_spacing * ((lll->nse - lll->ptc) * num_bis);
slot_us = lll->bis_spacing * ((lll->nse - lll->ptc) * num_bis);
}

/* Add radio ready delay */
Expand Down

0 comments on commit 913f41d

Please sign in to comment.