Skip to content

Commit 0fbf31a

Browse files
cvinayaknashif
authored andcommitted
Bluetooth: controller: Fix auxiliary PDU disable
When Extended Advertising terminated due to duration or maximum number of events, the auxiliary PDU scheduling is now correctly stopped. Fixes #31254. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 5b7f4d1 commit 0fbf31a

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

subsys/bluetooth/controller/ll_sw/ull.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,8 +826,17 @@ void ll_rx_dequeue(void)
826826
case NODE_RX_TYPE_EXT_ADV_TERMINATE:
827827
{
828828
struct ll_adv_set *adv;
829+
struct lll_adv_aux *lll_aux;
829830

830831
adv = ull_adv_set_get(rx->handle);
832+
lll_aux = adv->lll.aux;
833+
if (lll_aux) {
834+
struct ll_adv_aux_set *aux;
835+
836+
aux = (void *)HDR_LLL2EVT(lll_aux);
837+
838+
aux->is_started = 0U;
839+
}
831840

832841
#if defined(CONFIG_BT_PERIPHERAL)
833842
struct lll_conn *lll_conn = adv->lll.conn;

subsys/bluetooth/controller/ll_sw/ull_adv.c

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ static void conn_release(struct ll_adv_set *adv);
7272
#endif /* CONFIG_BT_PERIPHERAL */
7373

7474
#if defined(CONFIG_BT_CTLR_ADV_EXT)
75+
static void ticker_op_aux_stop_cb(uint32_t status, void *param);
7576
static void ticker_op_ext_stop_cb(uint32_t status, void *param);
7677
static void ext_disabled_cb(void *param);
7778
#endif /* CONFIG_BT_CTLR_ADV_EXT */
@@ -1583,6 +1584,7 @@ void ull_adv_done(struct node_rx_event_done *done)
15831584
{
15841585
struct lll_adv *lll = (void *)HDR_ULL2LLL(done->param);
15851586
struct ll_adv_set *adv = (void *)HDR_LLL2EVT(lll);
1587+
struct lll_adv_aux *lll_aux;
15861588
struct node_rx_hdr *rx_hdr;
15871589
uint8_t handle;
15881590
uint32_t ret;
@@ -1612,9 +1614,23 @@ void ull_adv_done(struct node_rx_event_done *done)
16121614
rx_hdr->rx_ftr.param_adv_term.conn_handle = 0xffff;
16131615
rx_hdr->rx_ftr.param_adv_term.num_events = adv->event_counter;
16141616

1615-
ret = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH,
1616-
(TICKER_ID_ADV_BASE + handle), ticker_op_ext_stop_cb,
1617-
adv);
1617+
lll_aux = lll->aux;
1618+
if (lll_aux) {
1619+
struct ll_adv_aux_set *aux;
1620+
uint8_t aux_handle;
1621+
1622+
aux = (void *)HDR_LLL2EVT(lll_aux);
1623+
aux_handle = ull_adv_aux_handle_get(aux);
1624+
ret = ticker_stop(TICKER_INSTANCE_ID_CTLR,
1625+
TICKER_USER_ID_ULL_HIGH,
1626+
(TICKER_ID_ADV_AUX_BASE + aux_handle),
1627+
ticker_op_aux_stop_cb, adv);
1628+
} else {
1629+
ret = ticker_stop(TICKER_INSTANCE_ID_CTLR,
1630+
TICKER_USER_ID_ULL_HIGH,
1631+
(TICKER_ID_ADV_BASE + handle),
1632+
ticker_op_ext_stop_cb, adv);
1633+
}
16181634

16191635
LL_ASSERT((ret == TICKER_STATUS_SUCCESS) ||
16201636
(ret == TICKER_STATUS_BUSY));
@@ -1903,6 +1919,21 @@ static void conn_release(struct ll_adv_set *adv)
19031919
#endif /* CONFIG_BT_PERIPHERAL */
19041920

19051921
#if defined(CONFIG_BT_CTLR_ADV_EXT)
1922+
static void ticker_op_aux_stop_cb(uint32_t status, void *param)
1923+
{
1924+
uint8_t handle;
1925+
uint32_t ret;
1926+
1927+
LL_ASSERT(status == TICKER_STATUS_SUCCESS);
1928+
1929+
handle = ull_adv_handle_get(param);
1930+
ret = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_LOW,
1931+
(TICKER_ID_ADV_BASE + handle), ticker_op_ext_stop_cb,
1932+
param);
1933+
LL_ASSERT((ret == TICKER_STATUS_SUCCESS) ||
1934+
(ret == TICKER_STATUS_BUSY));
1935+
}
1936+
19061937
static void ticker_op_ext_stop_cb(uint32_t status, void *param)
19071938
{
19081939
static memq_link_t link;

0 commit comments

Comments
 (0)