From 29f26bac2456bc14f79a756098d1b2feb9503a07 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 21 Apr 2020 15:08:14 +0530 Subject: [PATCH] Bluetooth: controller: split: Schedule auxiliary after primary PDU Fix to avoid a crash due to missing aux_ptr in current primary PDU constructed by LE Set Extended Advertising Parameter Set, while aux_ptr was populated by LE Set Extended Advertising Data Set in the latest double buffered PDU. Signed-off-by: Vinayak Kariappa Chettimada --- .../bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c | 3 +++ subsys/bluetooth/controller/ll_sw/ull_adv.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c index 86cc5deeed1..81525f7bded 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c @@ -149,6 +149,9 @@ static int prepare_cb(struct lll_prepare_param *prepare_param) if (h->adi) { ptr += sizeof(struct ext_adv_adi); } + + LL_ASSERT((pri->type == PDU_ADV_TYPE_EXT_IND) && h->aux_ptr); + aux = (void *)ptr; #if !defined(BT_CTLR_ADV_EXT_PBACK) diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv.c b/subsys/bluetooth/controller/ll_sw/ull_adv.c index 091922f26ca..0a1a22b481d 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv.c @@ -1010,11 +1010,19 @@ uint8_t ll_adv_enable(uint8_t enable) aux = (void *)HDR_LLL2EVT(lll_aux); ull_hdr_init(&aux->ull); + + /* Keep aux interval equal or higher than primary PDU + * interval. + */ aux->interval = adv->interval + (HAL_TICKER_TICKS_TO_US(ULL_ADV_RANDOM_DELAY) / 625U); + /* schedule after primary channel PDUs */ + ticks_anchor += ticks_slot; + ticks_anchor += HAL_TICKER_US_TO_TICKS(EVENT_MAFS_US); + ret = ull_adv_aux_start(aux, ticks_anchor, &ret_cb); aux_is_started = 1U;