@@ -42,6 +42,8 @@ static inline struct ll_scan_aux_set *aux_acquire(void);
4242static inline void aux_release (struct ll_scan_aux_set * aux );
4343static inline uint8_t aux_handle_get (struct ll_scan_aux_set * aux );
4444static inline struct ll_sync_set * sync_create_get (struct ll_scan_set * scan );
45+ static void last_disabled_cb (void * param );
46+ static void done_disabled_cb (void * param );
4547static void flush (struct ll_scan_aux_set * aux , struct node_rx_hdr * rx );
4648static void ticker_cb (uint32_t ticks_at_expire , uint32_t remainder ,
4749 uint16_t lazy , uint8_t force , void * param );
@@ -338,7 +340,14 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_hdr *rx)
338340#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
339341
340342 if (aux ) {
341- flush (aux , rx );
343+ struct ull_hdr * hdr ;
344+
345+ /* Setup the disabled callback to flush the auxiliary PDUs */
346+ hdr = & aux -> ull ;
347+ LL_ASSERT (!hdr -> disabled_cb );
348+
349+ hdr -> disabled_param = rx ;
350+ hdr -> disabled_cb = last_disabled_cb ;
342351
343352 return ;
344353 }
@@ -351,8 +360,14 @@ void ull_scan_aux_done(struct node_rx_event_done *done)
351360{
352361 struct lll_scan_aux * lll = (void * )HDR_ULL2LLL (done -> param );
353362 struct ll_scan_aux_set * aux = (void * )HDR_LLL2EVT (lll );
363+ struct ull_hdr * hdr ;
354364
355- flush (aux , NULL );
365+ /* Setup the disabled callback to flush the auxiliary PDUs */
366+ hdr = & aux -> ull ;
367+ LL_ASSERT (!hdr -> disabled_cb );
368+
369+ hdr -> disabled_param = aux ;
370+ hdr -> disabled_cb = done_disabled_cb ;
356371}
357372
358373uint8_t ull_scan_aux_lll_handle_get (struct lll_scan_aux * lll )
@@ -395,6 +410,22 @@ static inline struct ll_sync_set *sync_create_get(struct ll_scan_set *scan)
395410#endif /* !CONFIG_BT_CTLR_SYNC_PERIODIC */
396411}
397412
413+ static void last_disabled_cb (void * param )
414+ {
415+ struct ll_scan_aux_set * aux ;
416+ struct node_rx_hdr * rx ;
417+
418+ rx = param ;
419+ aux = (void * )HDR_LLL2EVT (rx -> rx_ftr .param );
420+
421+ flush (aux , rx );
422+ }
423+
424+ static void done_disabled_cb (void * param )
425+ {
426+ flush (param , NULL );
427+ }
428+
398429static void flush (struct ll_scan_aux_set * aux , struct node_rx_hdr * rx )
399430{
400431 if (aux -> rx_last ) {
0 commit comments