Bluetooth: controller: Fix JIT rescheduling for ext. advertising

Fixes two issues with the JIT scheduler:

Rescheduling of primary advertising packets for extended advertising
when using the JIT scheduler did not work, since the done events for
the primary events never made it into the reschedule logic

The EVENT_DONE_EXTRA_TYPE_ADV_AUX event (for auxillary packets) could
cause a "reschedule" for a primary event that was actually sent
successfully (causing it to be sent twice)

Signed-off-by: Troels Nilsson <trnn@demant.com>
This commit is contained in:
Troels Nilsson 2022-12-21 16:23:10 +01:00 committed by Fabio Baltieri
commit d7acb9355c
2 changed files with 9 additions and 3 deletions

View file

@ -1372,10 +1372,10 @@ static void isr_done(void *param)
#endif /* CONFIG_BT_CTLR_ADV_INDICATION */
#if defined(CONFIG_BT_CTLR_ADV_EXT) || defined(CONFIG_BT_CTLR_JIT_SCHEDULING)
#if defined(CONFIG_BT_CTLR_ADV_EXT)
#if defined(CONFIG_BT_CTLR_ADV_EXT) && !defined(CONFIG_BT_CTLR_JIT_SCHEDULING)
/* If no auxiliary PDUs scheduled, generate primary radio event done */
if (!lll->aux)
#endif /* CONFIG_BT_CTLR_ADV_EXT */
#endif /* CONFIG_BT_CTLR_ADV_EXT && !CONFIG_BT_CTLR_JIT_SCHEDULING */
{
struct event_done_extra *extra;

View file

@ -1995,7 +1995,7 @@ void ull_adv_done(struct node_rx_event_done *done)
lll = &adv->lll;
#if defined(CONFIG_BT_CTLR_JIT_SCHEDULING)
if (done->extra.result != DONE_COMPLETED) {
if (done->extra.type == EVENT_DONE_EXTRA_TYPE_ADV && done->extra.result != DONE_COMPLETED) {
/* Event aborted or too late - try to re-schedule */
uint32_t ticks_elapsed;
uint32_t ticks_now;
@ -2061,6 +2061,12 @@ void ull_adv_done(struct node_rx_event_done *done)
adv->lll.hdr.score -= 1;
}
}
#if defined(CONFIG_BT_CTLR_ADV_EXT)
if (done->extra.type == EVENT_DONE_EXTRA_TYPE_ADV && adv->lll.aux) {
/* Primary event of extended advertising done - wait for aux done */
return;
}
#endif /* CONFIG_BT_CTLR_ADV_EXT */
#endif /* CONFIG_BT_CTLR_JIT_SCHEDULING */
#if defined(CONFIG_BT_CTLR_ADV_EXT)