Skip to content

Commit e21ff70

Browse files
cvinayakfabiobaltieri
authored andcommitted
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 ddf0499 ("Bluetooth: Controller: Add abort fairness in overlapping Periodic Sync"). Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 468b600 commit e21ff70

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

subsys/bluetooth/controller/ll_sw/lll_sync.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ struct lll_sync {
2727
uint8_t filter_policy:1;
2828
uint8_t is_rx_enabled:1;
2929
uint8_t is_aux_sched:1;
30+
uint8_t forced:1;
3031

3132
#if defined(CONFIG_BT_CTLR_SYNC_ISO)
3233
uint8_t sca:3;

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,13 @@ static int is_abort_cb(void *next, void *curr, lll_prepare_cb_t *resume_cb)
562562

563563
lll_sync_next = ull_sync_lll_is_valid_get(next);
564564
if (!lll_sync_next) {
565+
lll_sync_curr = curr;
566+
567+
/* Do not abort if near supervision timeout */
568+
if (lll_sync_curr->forced) {
569+
return 0;
570+
}
571+
565572
/* Abort current event as next event is not a
566573
* scan and not a scan aux event.
567574
*/

subsys/bluetooth/controller/ll_sw/ull_sync.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,7 @@ void ull_sync_setup(struct ll_scan_set *scan, struct ll_scan_aux_set *aux,
722722
memcpy(lll->crc_init, si->crc_init, sizeof(lll->crc_init));
723723
lll->event_counter = sys_le16_to_cpu(si->evt_cntr);
724724
lll->phy = aux->lll.phy;
725+
lll->forced = 0U;
725726

726727
interval = sys_le16_to_cpu(si->interval);
727728
interval_us = interval * PERIODIC_INT_UNIT_US;
@@ -1020,6 +1021,7 @@ void ull_sync_done(struct node_rx_event_done *done)
10201021
struct ll_sync_set *sync;
10211022
uint16_t elapsed_event;
10221023
uint16_t skip_event;
1024+
uint8_t force_lll;
10231025
uint16_t lazy;
10241026
uint8_t force;
10251027

@@ -1100,14 +1102,19 @@ void ull_sync_done(struct node_rx_event_done *done)
11001102

11011103
/* check timeout */
11021104
force = 0U;
1105+
force_lll = 0U;
11031106
if (sync->timeout_expire) {
11041107
if (sync->timeout_expire > elapsed_event) {
11051108
sync->timeout_expire -= elapsed_event;
11061109

11071110
/* break skip */
11081111
lll->skip_event = 0U;
11091112

1110-
if (skip_event) {
1113+
if (sync->timeout_expire <= 6U) {
1114+
force_lll = 1U;
1115+
1116+
force = 1U;
1117+
} else if (skip_event) {
11111118
force = 1U;
11121119
}
11131120
} else {
@@ -1117,6 +1124,8 @@ void ull_sync_done(struct node_rx_event_done *done)
11171124
}
11181125
}
11191126

1127+
lll->forced = force_lll;
1128+
11201129
/* Check if skip needs update */
11211130
lazy = 0U;
11221131
if ((force) || (skip_event != lll->skip_event)) {

0 commit comments

Comments
 (0)