Bluetooth: Controller: Fix BT_CTLR_SCAN_AUX_SYNC_RESERVE_MIN

Fix BT_CTLR_SCAN_AUX_SYNC_RESERVE_MIN such that event is not
aborted when near supervision timeout conditions.

Relates to commit ddf04997a5 ("Bluetooth: Controller: Add
abort fairness in overlapping Periodic Sync").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2024-07-15 18:03:27 +02:00 committed by Fabio Baltieri
commit e21ff7067d
3 changed files with 18 additions and 1 deletions

View file

@ -27,6 +27,7 @@ struct lll_sync {
uint8_t filter_policy:1; uint8_t filter_policy:1;
uint8_t is_rx_enabled:1; uint8_t is_rx_enabled:1;
uint8_t is_aux_sched:1; uint8_t is_aux_sched:1;
uint8_t forced:1;
#if defined(CONFIG_BT_CTLR_SYNC_ISO) #if defined(CONFIG_BT_CTLR_SYNC_ISO)
uint8_t sca:3; uint8_t sca:3;

View file

@ -562,6 +562,13 @@ static int is_abort_cb(void *next, void *curr, lll_prepare_cb_t *resume_cb)
lll_sync_next = ull_sync_lll_is_valid_get(next); lll_sync_next = ull_sync_lll_is_valid_get(next);
if (!lll_sync_next) { if (!lll_sync_next) {
lll_sync_curr = curr;
/* Do not abort if near supervision timeout */
if (lll_sync_curr->forced) {
return 0;
}
/* Abort current event as next event is not a /* Abort current event as next event is not a
* scan and not a scan aux event. * scan and not a scan aux event.
*/ */

View file

@ -722,6 +722,7 @@ void ull_sync_setup(struct ll_scan_set *scan, struct ll_scan_aux_set *aux,
memcpy(lll->crc_init, si->crc_init, sizeof(lll->crc_init)); memcpy(lll->crc_init, si->crc_init, sizeof(lll->crc_init));
lll->event_counter = sys_le16_to_cpu(si->evt_cntr); lll->event_counter = sys_le16_to_cpu(si->evt_cntr);
lll->phy = aux->lll.phy; lll->phy = aux->lll.phy;
lll->forced = 0U;
interval = sys_le16_to_cpu(si->interval); interval = sys_le16_to_cpu(si->interval);
interval_us = interval * PERIODIC_INT_UNIT_US; interval_us = interval * PERIODIC_INT_UNIT_US;
@ -1020,6 +1021,7 @@ void ull_sync_done(struct node_rx_event_done *done)
struct ll_sync_set *sync; struct ll_sync_set *sync;
uint16_t elapsed_event; uint16_t elapsed_event;
uint16_t skip_event; uint16_t skip_event;
uint8_t force_lll;
uint16_t lazy; uint16_t lazy;
uint8_t force; uint8_t force;
@ -1100,6 +1102,7 @@ void ull_sync_done(struct node_rx_event_done *done)
/* check timeout */ /* check timeout */
force = 0U; force = 0U;
force_lll = 0U;
if (sync->timeout_expire) { if (sync->timeout_expire) {
if (sync->timeout_expire > elapsed_event) { if (sync->timeout_expire > elapsed_event) {
sync->timeout_expire -= elapsed_event; sync->timeout_expire -= elapsed_event;
@ -1107,7 +1110,11 @@ void ull_sync_done(struct node_rx_event_done *done)
/* break skip */ /* break skip */
lll->skip_event = 0U; lll->skip_event = 0U;
if (skip_event) { if (sync->timeout_expire <= 6U) {
force_lll = 1U;
force = 1U;
} else if (skip_event) {
force = 1U; force = 1U;
} }
} else { } else {
@ -1117,6 +1124,8 @@ void ull_sync_done(struct node_rx_event_done *done)
} }
} }
lll->forced = force_lll;
/* Check if skip needs update */ /* Check if skip needs update */
lazy = 0U; lazy = 0U;
if ((force) || (skip_event != lll->skip_event)) { if ((force) || (skip_event != lll->skip_event)) {