From 804419592fe2d9957448e846cd05b07cce8f0c69 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 26 Jan 2021 16:26:38 +0530 Subject: [PATCH] Bluetooth: controller: Fix incorrect reset of CPR reject state Fix regression in adding the state for Connection Parameter Request being rejected where in Connection Parameter Request Procedure state machine was prematurely reset before the reject PDU was enqueued. Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/ull_conn.c | 13 ++++++++++--- subsys/bluetooth/controller/ll_sw/ull_sched.c | 9 --------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn.c b/subsys/bluetooth/controller/ll_sw/ull_conn.c index f681d229610..1140ce1f105 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn.c @@ -2320,8 +2320,14 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, uint16_t lazy, return -EINPROGRESS; case LLCP_CUI_STATE_REJECT: - /* move to in progress */ - conn->llcp_cu.state = LLCP_CUI_STATE_INPROG; + /* procedure request acked */ + conn->llcp_ack = conn->llcp_req; + conn->llcp_cu.ack = conn->llcp_cu.req; + conn->llcp_conn_param.ack = conn->llcp_conn_param.req; + + /* reset mutex */ + ull_conn_upd_curr_reset(); + /* enqueue control PDU */ pdu_ctrl_tx = CONTAINER_OF(conn->llcp.conn_upd.pdu_win_offset, @@ -2329,7 +2335,8 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, uint16_t lazy, llctrl.conn_update_ind.win_offset); tx = CONTAINER_OF(pdu_ctrl_tx, struct node_tx, pdu); ctrl_tx_enqueue(conn, tx); - return -EINPROGRESS; + return -ECANCELED; + default: LL_ASSERT(0); break; diff --git a/subsys/bluetooth/controller/ll_sw/ull_sched.c b/subsys/bluetooth/controller/ll_sw/ull_sched.c index c45bee1e6d3..bc062e420d7 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sched.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sched.c @@ -277,15 +277,6 @@ void ull_sched_mfy_win_offset_select(void *param) } else { struct pdu_data *pdu_ctrl_tx; - /* procedure request acked */ - conn->llcp_ack = conn->llcp_req; - - /* CPR request acked */ - conn->llcp_conn_param.ack = conn->llcp_conn_param.req; - - /* reset mutex */ - ull_conn_upd_curr_reset(); - /* send reject_ind_ext */ pdu_ctrl_tx = CONTAINER_OF(conn->llcp.conn_upd.pdu_win_offset, struct pdu_data,