Commit 99bdd271 authored by Vinayak Kariappa Chettimada's avatar Vinayak Kariappa Chettimada Committed by Carles Cufi
Browse files

Bluetooth: Controller: Fix multiple advertising set assert



Fix assert at line 1085 in ull_adv_aux.c due to auxiliary
offset calculation scheduling on ticker timeout under must
expire which can happen for overlapping multiple advertising
sets without previous calculation not complete, a single
mayfly instance is used hence the assertion.

Signed-off-by: default avatarVinayak Kariappa Chettimada <vich@nordicsemi.no>
parent 9ebca5b4
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -2128,6 +2128,12 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t remainder, uint16_t laz
				     TICKER_USER_ID_LLL, 0, &mfy);
		LL_ASSERT(!ret);

#if defined(CONFIG_BT_CTLR_ADV_EXT) && (CONFIG_BT_CTLR_ADV_AUX_SET > 0)
		if (adv->lll.aux) {
			ull_adv_aux_offset_get(adv);
		}
#endif /* CONFIG_BT_CTLR_ADV_EXT && (CONFIG_BT_CTLR_ADV_AUX_SET > 0) */

#if defined(CONFIG_BT_CTLR_JIT_SCHEDULING)
		adv->ticks_at_expire = ticks_at_expire;
#endif /* CONFIG_BT_CTLR_JIT_SCHEDULING */
@@ -2164,12 +2170,6 @@ static void ticker_cb(uint32_t ticks_at_expire, uint32_t remainder, uint16_t laz
#endif /* CONFIG_BT_CTLR_ADV_EXT */
	}

#if defined(CONFIG_BT_CTLR_ADV_EXT) && (CONFIG_BT_CTLR_ADV_AUX_SET > 0)
	if (adv->lll.aux) {
		ull_adv_aux_offset_get(adv);
	}
#endif /* CONFIG_BT_CTLR_ADV_EXT && (CONFIG_BT_CTLR_ADV_AUX_SET > 0) */

	DEBUG_RADIO_PREPARE_A(1);
}

+5 −0
Original line number Diff line number Diff line
@@ -1047,6 +1047,11 @@ void ull_adv_aux_offset_get(struct ll_adv_set *adv)
	static struct mayfly mfy = {0, 0, &link, NULL, mfy_aux_offset_get};
	uint32_t ret;

	/* NOTE: Single mayfly instance is sufficient as primary channel PDUs
	 *       use time reservation, and this mayfly shall complete within
	 *       the radio event. Multiple advertising sets do not need
	 *       independent mayfly allocations.
	 */
	mfy.param = adv;
	ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1,
			     &mfy);