Skip to content

Commit 730f7ca

Browse files
erbr-otaescolar
authored andcommitted
Bluetooth: controller: add missing NTF alloc in central CIS Create
If a CIS create is requested prior to having a complete feature exchange the central will initiate a feat exch before enqueing the CIS create. IF then the feature exchange results in peripheral NOT supporting CIS create the central needs to allocate an RX node for the NTF Signed-off-by: Erik Brockhoff <[email protected]>
1 parent 25897f8 commit 730f7ca

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ static void lp_cc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_
643643
/* LLCP Local Procedure FSM states */
644644
enum {
645645
LP_CC_STATE_IDLE,
646+
LP_CC_STATE_WAIT_NTF_AVAIL,
646647
LP_CC_STATE_WAIT_OFFSET_CALC,
647648
LP_CC_STATE_WAIT_OFFSET_CALC_TX_REQ,
648649
LP_CC_STATE_WAIT_TX_CIS_REQ,
@@ -839,7 +840,7 @@ static void lp_cc_st_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t ev
839840
} else {
840841
/* Peer doesn't support CIS Peripheral so report unsupported */
841842
ctx->data.cis_create.error = BT_HCI_ERR_UNSUPP_REMOTE_FEATURE;
842-
lp_cc_complete(conn, ctx, evt, param);
843+
ctx->state = LP_CC_STATE_WAIT_NTF_AVAIL;
843844
}
844845
break;
845846
default:
@@ -854,6 +855,26 @@ static void lp_cc_st_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t ev
854855
}
855856
}
856857

858+
static void lp_cc_state_wait_ntf_avail(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt,
859+
void *param)
860+
{
861+
switch (evt) {
862+
case LP_CC_EVT_RUN:
863+
if (llcp_ntf_alloc_is_available()) {
864+
ctx->node_ref.rx = llcp_ntf_alloc();
865+
/* Mark node as RETAIN to trigger put/sched */
866+
ctx->node_ref.rx->hdr.type = NODE_RX_TYPE_RETAIN;
867+
868+
/* Now we're good to complete procedure*/
869+
lp_cc_complete(conn, ctx, evt, param);
870+
}
871+
break;
872+
default:
873+
/* Ignore other evts */
874+
break;
875+
}
876+
}
877+
857878
static void cc_prepare_cis_ind(struct ll_conn *conn, struct proc_ctx *ctx)
858879
{
859880
uint8_t err;
@@ -1040,6 +1061,9 @@ static void lp_cc_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_
10401061
case LP_CC_STATE_IDLE:
10411062
lp_cc_st_idle(conn, ctx, evt, param);
10421063
break;
1064+
case LP_CC_STATE_WAIT_NTF_AVAIL:
1065+
lp_cc_state_wait_ntf_avail(conn, ctx, evt, param);
1066+
break;
10431067
case LP_CC_STATE_WAIT_OFFSET_CALC_TX_REQ:
10441068
lp_cc_st_wait_offset_calc_tx_req(conn, ctx, evt, param);
10451069
break;

0 commit comments

Comments
 (0)