From 9383e4fbf83f191bfae5beba974c62eafbdcd2a8 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 5 Apr 2024 15:33:49 +0200 Subject: [PATCH] Bluetooth: Controller: Fix BT_CTLR_EARLY_ABORT_PREVIOUS_PREPARE Fix BT_CTLR_EARLY_ABORT_PREVIOUS_PREPARE to setup new shorter preempt timeout irrespective of whether there is a previous prepare enqueued in the prepare pipeline. Relates to commit d573951f0daf ("Bluetooth: Controller: Revert back early abort of previous prepare"). Signed-off-by: Vinayak Kariappa Chettimada --- .../controller/ll_sw/nordic/lll/lll.c | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c index ed459c20d19..d8eb94a08b6 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c @@ -945,13 +945,6 @@ static uint32_t preempt_ticker_start(struct lll_event *first, (preempt_req != preempt_ack)) { uint32_t diff; - /* preempt timeout already started but no role/state in the head - * of prepare pipeline. - */ - if (!prev || prev->is_aborted) { - return TICKER_STATUS_SUCCESS; - } - /* Calc the preempt timeout */ p = &next->prepare_param; ull = HDR_LLL2ULL(p->param); @@ -985,14 +978,20 @@ static uint32_t preempt_ticker_start(struct lll_event *first, * A proper solution will be to re-design the pipeline * as a ordered list, instead of the current FIFO. */ - /* Set early as we get called again through the call to - * abort_cb(). + /* preempt timeout already started but no role/state in the head + * of prepare pipeline. */ - ticks_at_preempt = ticks_at_preempt_new; + if (prev && !prev->is_aborted) { + /* Set early as we get called again through the call to + * abort_cb(). + */ + ticks_at_preempt = ticks_at_preempt_new; - /* Abort previous prepare that set the preempt timeout */ - prev->is_aborted = 1U; - prev->abort_cb(&prev->prepare_param, prev->prepare_param.param); + /* Abort previous prepare that set the preempt timeout */ + prev->is_aborted = 1U; + prev->abort_cb(&prev->prepare_param, + prev->prepare_param.param); + } #endif /* CONFIG_BT_CTLR_EARLY_ABORT_PREVIOUS_PREPARE */ /* Schedule short preempt timeout */