diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index 7cef480413..0e2685f29c 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -961,6 +961,13 @@ config BT_CTLR_SCAN_UNRESERVED Scanner will not use time space reservation for scan window when in continuous scan mode. +config BT_CTLR_EARLY_ABORT_PREVIOUS_PREPARE + bool "Early abort previous prepare" + default y + help + Early abort previous prepare present before a short prepare is + enqueued in the prepare pipeline. + config BT_MAYFLY_YIELD_AFTER_CALL bool "Yield from mayfly thread after first call" default y diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c index 6d51b63ecb..473282eb61 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c @@ -906,6 +906,26 @@ static uint32_t preempt_ticker_start(struct lll_event *first, LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || (ret == TICKER_STATUS_BUSY)); +#if defined(CONFIG_BT_CTLR_EARLY_ABORT_PREVIOUS_PREPARE) + /* FIXME: Prepare pipeline is not a ordered list implementation, + * and for short prepare being enqueued, ideally the + * pipeline has to be implemented as ordered list. + * Until then a workaround to abort a prepare present + * before the short prepare being enqueued is implemented + * below. + * 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(). + */ + 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); +#endif /* CONFIG_BT_CTLR_EARLY_ABORT_PREVIOUS_PREPARE */ + /* Schedule short preempt timeout */ first = next; } else {