Skip to content

Commit 3e0e378

Browse files
cvinayakcarlescufi
authored andcommitted
Bluetooth: controller: split: Fix pipeline for continuous events
Fix the pipeline prepare-resume implementation to correctly handle multiple continuous events that request resume on being pre-empted. Symptoms of the bug being, when having continuous scanning, and an active peripheral if a directed advertising is started the peripheral event are not scheduled causing link supervision timeout. This is fixed by not having an enqueued resume event prepared if there is an enqueued new non-resume event in the pipeline. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent d90f3db commit 3e0e378

File tree

1 file changed

+9
-19
lines changed
  • subsys/bluetooth/controller/ll_sw/nordic/lll

1 file changed

+9
-19
lines changed

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

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -191,21 +191,9 @@ void lll_resume(void *param)
191191
struct lll_event *next = param;
192192
int ret;
193193

194-
if (event.curr.abort_cb) {
195-
ret = prepare(next->is_abort_cb, next->abort_cb,
196-
next->prepare_cb, next->prio,
197-
&next->prepare_param, next->is_resume);
198-
LL_ASSERT(!ret || ret == -EINPROGRESS);
199-
200-
return;
201-
}
202-
203-
event.curr.is_abort_cb = next->is_abort_cb;
204-
event.curr.abort_cb = next->abort_cb;
205-
event.curr.param = next->prepare_param.param;
206-
207-
ret = next->prepare_cb(&next->prepare_param);
208-
LL_ASSERT(!ret);
194+
ret = prepare(next->is_abort_cb, next->abort_cb, next->prepare_cb,
195+
next->prio, &next->prepare_param, next->is_resume);
196+
LL_ASSERT(!ret || ret == -EINPROGRESS);
209197
}
210198

211199
void lll_disable(void *param)
@@ -426,12 +414,14 @@ static int prepare(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb,
426414
struct lll_event *p;
427415
u8_t idx = UINT8_MAX;
428416

417+
/* Find the ready prepare in the pipeline */
429418
p = ull_prepare_dequeue_iter(&idx);
430-
while (p && p->is_aborted) {
419+
while (p && (p->is_aborted || p->is_resume)) {
431420
p = ull_prepare_dequeue_iter(&idx);
432421
}
433422

434-
if (event.curr.abort_cb || p) {
423+
/* Current event active or another prepare is ready in the pipeline */
424+
if (event.curr.abort_cb || (p && is_resume)) {
435425
#if !defined(CONFIG_BT_CTLR_LOW_LAT)
436426
u32_t preempt_anchor;
437427
struct evt_hdr *evt;
@@ -453,11 +443,11 @@ static int prepare(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb,
453443
prepare_cb, prio, is_resume);
454444
LL_ASSERT(!ret);
455445

446+
#if !defined(CONFIG_BT_CTLR_LOW_LAT)
456447
if (is_resume) {
457448
return -EINPROGRESS;
458449
}
459450

460-
#if !defined(CONFIG_BT_CTLR_LOW_LAT)
461451
/* Calc the preempt timeout */
462452
evt = HDR_LLL2EVT(prepare_param->param);
463453
preempt_anchor = prepare_param->ticks_at_expire;
@@ -571,7 +561,7 @@ static void preempt(void *param)
571561
return;
572562
}
573563

574-
while (next && next->is_resume) {
564+
while (next && (next->is_aborted || next->is_resume)) {
575565
next = ull_prepare_dequeue_iter(&idx);
576566
}
577567

0 commit comments

Comments
 (0)