diff --git a/subsys/bluetooth/controller/ll_sw/lll.h b/subsys/bluetooth/controller/ll_sw/lll.h index 80fe85fffe1..d52bb3b23a1 100644 --- a/subsys/bluetooth/controller/ll_sw/lll.h +++ b/subsys/bluetooth/controller/ll_sw/lll.h @@ -586,6 +586,7 @@ void ull_rx_put(memq_link_t *link, void *rx); void ull_rx_put_done(memq_link_t *link, void *done); void ull_rx_sched(void); void ull_rx_sched_done(void); +void ull_rx_put_sched(memq_link_t *link, void *rx); void ull_iso_rx_put(memq_link_t *link, void *rx); void ull_iso_rx_sched(void); void *ull_iso_tx_ack_dequeue(void); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c index 186170ba76d..91cc8ed9884 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c @@ -723,8 +723,7 @@ int lll_adv_scan_req_report(struct lll_adv *lll, struct pdu_adv *pdu_adv_rx, node_rx->hdr.rx_ftr.rl_idx = rl_idx; #endif - ull_rx_put(node_rx->hdr.link, node_rx); - ull_rx_sched(); + ull_rx_put_sched(node_rx->hdr.link, node_rx); return 0; } @@ -1368,8 +1367,7 @@ static void isr_done(void *param) /* TODO: add other info by defining a payload struct */ node_rx->type = NODE_RX_TYPE_ADV_INDICATION; - ull_rx_put(node_rx->link, node_rx); - ull_rx_sched(); + ull_rx_put_sched(node_rx->link, node_rx); } #endif /* CONFIG_BT_CTLR_ADV_INDICATION */ @@ -1629,8 +1627,7 @@ static inline int isr_rx_pdu(struct lll_adv *lll, ftr->extra = ull_pdu_rx_alloc(); } - ull_rx_put(rx->hdr.link, rx); - ull_rx_sched(); + ull_rx_put_sched(rx->hdr.link, rx); return 0; #endif /* CONFIG_BT_PERIPHERAL */ 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 f0a4e9a8699..5a3ffb303e0 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 @@ -817,8 +817,7 @@ static void isr_tx_connect_rsp(void *param) } } - ull_rx_put(rx->hdr.link, rx); - ull_rx_sched(); + ull_rx_put_sched(rx->hdr.link, rx); if (is_done) { /* Stop further LLL radio events */ diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c index 71b7826e314..62f74a1ce9c 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_iso.c @@ -714,8 +714,7 @@ static void isr_done_term(void *param) rx->type = NODE_RX_TYPE_BIG_CHM_COMPLETE; rx->rx_ftr.param = lll; - ull_rx_put(rx->link, rx); - ull_rx_sched(); + ull_rx_put_sched(rx->link, rx); } /* Use new channel map */ diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c index eae7ac929b5..32d218ef51b 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_sync.c @@ -310,8 +310,7 @@ static void isr_done(void *param) rx->type = NODE_RX_TYPE_SYNC_CHM_COMPLETE; rx->rx_ftr.param = lll; - ull_rx_put(rx->link, rx); - ull_rx_sched(); + ull_rx_put_sched(rx->link, rx); } lll_isr_done(lll); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_prof.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_prof.c index 18dae667910..0ca926f7264 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_prof.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_prof.c @@ -146,8 +146,7 @@ void lll_prof_reserve_send(struct node_rx_pdu *rx) if (err) { rx->hdr.type = NODE_RX_TYPE_PROFILE; - ull_rx_put(rx->hdr.link, rx); - ull_rx_sched(); + ull_rx_put_sched(rx->hdr.link, rx); } } } @@ -236,8 +235,7 @@ static int send(struct node_rx_pdu *rx) p->ull_high = cputime_ull_high; p->ull_low = cputime_ull_low; - ull_rx_put(rx->hdr.link, rx); - ull_rx_sched(); + ull_rx_put_sched(rx->hdr.link, rx); return 0; } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c index d33ae28a9a2..8654f871030 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c @@ -1047,8 +1047,7 @@ static void isr_done_cleanup(void *param) /* TODO: add other info by defining a payload struct */ node_rx->type = NODE_RX_TYPE_SCAN_INDICATION; - ull_rx_put(node_rx->link, node_rx); - ull_rx_sched(); + ull_rx_put_sched(node_rx->link, node_rx); } #endif /* CONFIG_BT_CTLR_SCAN_INDICATION */ @@ -1092,8 +1091,7 @@ static void isr_done_cleanup(void *param) node_rx->hdr.rx_ftr.param = lll; - ull_rx_put(node_rx->hdr.link, node_rx); - ull_rx_sched(); + ull_rx_put_sched(node_rx->hdr.link, node_rx); } #endif /* CONFIG_BT_CTLR_ADV_EXT */ @@ -1259,8 +1257,7 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx, ftr->extra = ull_pdu_rx_alloc(); } - ull_rx_put(rx->hdr.link, rx); - ull_rx_sched(); + ull_rx_put_sched(rx->hdr.link, rx); return 0; #endif /* CONFIG_BT_CENTRAL */ @@ -1589,8 +1586,7 @@ static int isr_rx_scan_report(struct lll_scan *lll, uint8_t devmatch_ok, } #endif /* CONFIG_BT_CTLR_EXT_SCAN_FP */ - ull_rx_put(node_rx->hdr.link, node_rx); - ull_rx_sched(); + ull_rx_put_sched(node_rx->hdr.link, node_rx); return err; } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c index 15162acfe88..39f2cd47d1d 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c @@ -678,8 +678,7 @@ static void isr_done(void *param) node_rx->hdr.rx_ftr.param = lll; node_rx->hdr.rx_ftr.aux_failed = 1U; - ull_rx_put(node_rx->hdr.link, node_rx); - ull_rx_sched(); + ull_rx_put_sched(node_rx->hdr.link, node_rx); } else if (!trx_cnt) { struct event_done_extra *e; @@ -861,8 +860,7 @@ isr_rx_do_close: */ node_rx->hdr.rx_ftr.param = lll; - ull_rx_put(node_rx->hdr.link, node_rx); - ull_rx_sched(); + ull_rx_put_sched(node_rx->hdr.link, node_rx); } /* Check if LLL scheduled auxiliary PDU reception by scan @@ -1210,8 +1208,7 @@ static int isr_rx_pdu(struct lll_scan *lll, struct lll_scan_aux *lll_aux, ftr->aux_lll_sched = 0U; - ull_rx_put(node_rx->hdr.link, node_rx); - ull_rx_sched(); + ull_rx_put_sched(node_rx->hdr.link, node_rx); return 0; @@ -1288,9 +1285,7 @@ static int isr_rx_pdu(struct lll_scan *lll, struct lll_scan_aux *lll_aux, node_rx->hdr.type = NODE_RX_TYPE_EXT_AUX_REPORT; - ull_rx_put(node_rx->hdr.link, node_rx); - - ull_rx_sched(); + ull_rx_put_sched(node_rx->hdr.link, node_rx); /* Next aux scan is scheduled from LLL, we already handled radio * disable so prevent caller from doing it again. @@ -1550,8 +1545,7 @@ static void isr_rx_connect_rsp(void *param) #endif /* CONFIG_BT_CTLR_PRIVACY */ isr_rx_do_close: - ull_rx_put(rx->hdr.link, rx); - ull_rx_sched(); + ull_rx_put_sched(rx->hdr.link, rx); if (lll->lll_aux) { struct node_rx_pdu *node_rx; @@ -1564,8 +1558,7 @@ isr_rx_do_close: node_rx->hdr.rx_ftr.param = lll->lll_aux; - ull_rx_put(node_rx->hdr.link, node_rx); - ull_rx_sched(); + ull_rx_put_sched(node_rx->hdr.link, node_rx); radio_isr_set(lll_scan_isr_resume, lll); } else { diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c index 9081b199908..0434800cdba 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c @@ -981,8 +981,7 @@ static void isr_rx_adv_sync_estab(void *param) ftr->param = lll; ftr->sync_status = SYNC_STAT_TERM; - ull_rx_put(node_rx->hdr.link, node_rx); - ull_rx_sched(); + ull_rx_put_sched(node_rx->hdr.link, node_rx); } } @@ -1231,8 +1230,7 @@ static void isr_done(void *param) node_rx->hdr.rx_ftr.param = lll; node_rx->hdr.rx_ftr.aux_failed = 1U; - ull_rx_put(node_rx->hdr.link, node_rx); - ull_rx_sched(); + ull_rx_put_sched(node_rx->hdr.link, node_rx); } isr_rx_done_cleanup(param, ((trx_cnt) ? 1U : 0U), false); diff --git a/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_adv.c b/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_adv.c index 725c579dad3..3f98cf013d6 100644 --- a/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_adv.c +++ b/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_adv.c @@ -728,8 +728,7 @@ static void isr_done(void *param) /* TODO: add other info by defining a payload struct */ node_rx->type = NODE_RX_TYPE_ADV_INDICATION; - ull_rx_put(node_rx->link, node_rx); - ull_rx_sched(); + ull_rx_put_sched(node_rx->link, node_rx); } #else /* !CONFIG_BT_CTLR_ADV_INDICATION */ ARG_UNUSED(node_rx); @@ -940,8 +939,7 @@ static inline int isr_rx_pdu(struct lll_adv *lll, ftr->extra = ull_pdu_rx_alloc(); } - ull_rx_put(rx->hdr.link, rx); - ull_rx_sched(); + ull_rx_put_sched(rx->hdr.link, rx); return 0; #endif /* CONFIG_BT_PERIPHERAL */ @@ -1004,8 +1002,7 @@ static inline int isr_rx_sr_report(struct pdu_adv *pdu_adv_rx, node_rx->hdr.rx_ftr.rssi = (rssi_ready) ? (radio_rssi_get() & 0x7f) : 0x7f; - ull_rx_put(node_rx->hdr.link, node_rx); - ull_rx_sched(); + ull_rx_put_sched(node_rx->hdr.link, node_rx); return 0; } diff --git a/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_prof.c b/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_prof.c index 67f21b773dd..50772c34dda 100644 --- a/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_prof.c +++ b/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_prof.c @@ -133,8 +133,7 @@ void lll_prof_send(void) p->min = cputime_min; p->max = cputime_max; - ull_rx_put(rx->hdr.link, rx); - ull_rx_sched(); + ull_rx_put_sched(rx->hdr.link, rx); } } } diff --git a/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_scan.c b/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_scan.c index 02130404290..6908d915878 100644 --- a/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_scan.c +++ b/subsys/bluetooth/controller/ll_sw/openisa/lll/lll_scan.c @@ -615,8 +615,7 @@ static void isr_cleanup(void *param) /* TODO: add other info by defining a payload struct */ node_rx->type = NODE_RX_TYPE_SCAN_INDICATION; - ull_rx_put(node_rx->link, node_rx); - ull_rx_sched(); + ull_rx_put_sched(node_rx->link, node_rx); } #else /* !CONFIG_BT_CTLR_SCAN_INDICATION */ ARG_UNUSED(node_rx); @@ -855,8 +854,7 @@ static inline uint32_t isr_rx_pdu(struct lll_scan *lll, uint8_t devmatch_ok, ftr->extra = ull_pdu_rx_alloc(); } - ull_rx_put(rx->hdr.link, rx); - ull_rx_sched(); + ull_rx_put_sched(rx->hdr.link, rx); return 0; #endif /* CONFIG_BT_CENTRAL */ @@ -1138,8 +1136,7 @@ static uint32_t isr_rx_scan_report(struct lll_scan *lll, uint8_t rssi_ready, } #endif /* CONFIG_BT_CTLR_EXT_SCAN_FP */ - ull_rx_put(node_rx->hdr.link, node_rx); - ull_rx_sched(); + ull_rx_put_sched(node_rx->hdr.link, node_rx); return 0; } diff --git a/subsys/bluetooth/controller/ll_sw/ull.c b/subsys/bluetooth/controller/ll_sw/ull.c index 6fa72b9d2af..48bd68277db 100644 --- a/subsys/bluetooth/controller/ll_sw/ull.c +++ b/subsys/bluetooth/controller/ll_sw/ull.c @@ -1987,6 +1987,12 @@ void ull_rx_sched(void) mayfly_enqueue(TICKER_USER_ID_LLL, TICKER_USER_ID_ULL_HIGH, 1, &mfy); } +void ull_rx_put_sched(memq_link_t *link, void *rx) +{ + ull_rx_put(link, rx); + ull_rx_sched(); +} + #if !defined(CONFIG_BT_CTLR_LOW_LAT_ULL) void ull_rx_put_done(memq_link_t *link, void *done) { @@ -2168,8 +2174,7 @@ void *ull_event_done(void *param) ull_rx_put_done(link, evdone); ull_rx_sched_done(); #else - ull_rx_put(link, evdone); - ull_rx_sched(); + ull_rx_put_sched(link, evdone); #endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */ return evdone; diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv_iso.c b/subsys/bluetooth/controller/ll_sw/ull_adv_iso.c index 498608083b1..a2b52d97f94 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv_iso.c @@ -1272,6 +1272,5 @@ static void tx_lll_flush(void *param) rx->hdr.link = NULL; /* Enqueue the terminate towards ULL context */ - ull_rx_put(link, rx); - ull_rx_sched(); + ull_rx_put_sched(link, rx); } diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn.c b/subsys/bluetooth/controller/ll_sw/ull_conn.c index 06578a34529..beaf91948df 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn.c @@ -2790,8 +2790,7 @@ static void tx_lll_flush(void *param) rx->hdr.link = NULL; /* Enqueue the terminate towards ULL context */ - ull_rx_put(link, rx); - ull_rx_sched(); + ull_rx_put_sched(link, rx); } #if defined(CONFIG_BT_CTLR_LLID_DATA_START_EMPTY) diff --git a/tests/bluetooth/controller/mock_ctrl/src/ull.c b/tests/bluetooth/controller/mock_ctrl/src/ull.c index 7baa115a7e9..747d5042af9 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/ull.c +++ b/tests/bluetooth/controller/mock_ctrl/src/ull.c @@ -259,6 +259,10 @@ void ull_rx_sched(void) { } +void ull_rx_put_sched(memq_link_t *link, void *rx) +{ +} + /* Forward declaration */ struct node_rx_event_done; void ull_drift_ticks_get(struct node_rx_event_done *done, uint32_t *ticks_drift_plus,