Skip to content

Commit 179fe06

Browse files
cvinayakcarlescufi
authored andcommitted
Bluetooth: Controller: Fix advertising pdu latest get
Fix advertising pdu latest get to defer release of stale PDU chain buffers. Returning NULL after some buffers where released causes LLL to assert when chained PDUs are switched. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 9170977 commit 179fe06

File tree

1 file changed

+7
-5
lines changed
  • subsys/bluetooth/controller/ll_sw/nordic/lll

1 file changed

+7
-5
lines changed

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,7 @@ struct pdu_adv *lll_adv_pdu_latest_get(struct lll_adv_pdu *pdu,
472472
* switch attempt (on next event).
473473
*/
474474
if (!MFIFO_ENQUEUE_IDX_GET(pdu_free, &free_idx)) {
475-
pdu->pdu[pdu_idx] = p;
476-
return NULL;
475+
break;
477476
}
478477

479478
#if defined(CONFIG_BT_CTLR_ADV_PDU_LINK)
@@ -488,16 +487,19 @@ struct pdu_adv *lll_adv_pdu_latest_get(struct lll_adv_pdu *pdu,
488487
p = next;
489488
} while (p);
490489

491-
pdu->pdu[pdu_idx] = NULL;
490+
/* If not all PDUs where released into mfifo, keep the list in
491+
* current data index, to be released on the next switch
492+
* attempt.
493+
*/
494+
pdu->pdu[pdu_idx] = p;
492495

496+
/* Progress to next data index */
493497
first += 1U;
494498
if (first == DOUBLE_BUFFER_SIZE) {
495499
first = 0U;
496500
}
497501
pdu->first = first;
498502
*is_modified = 1U;
499-
500-
pdu->pdu[pdu_idx] = NULL;
501503
}
502504

503505
return (void *)pdu->pdu[first];

0 commit comments

Comments
 (0)