Skip to content

Commit 1e320a3

Browse files
cvinayaknashif
authored andcommitted
Bluetooth: controller: Fix PHY Update procedure checks
Fix PHY update procedure to check transaction violations. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 6eb998b commit 1e320a3

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

subsys/bluetooth/controller/ll_sw/ull_conn.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5157,11 +5157,12 @@ static int phy_rsp_send(struct ll_conn *conn, struct node_rx_pdu *rx,
51575157
struct pdu_data_llctrl_phy_req *p;
51585158
struct pdu_data *pdu_ctrl_tx;
51595159
struct node_tx *tx;
5160+
int err;
51605161

5161-
/* acquire tx mem */
5162-
tx = mem_acquire(&mem_conn_tx_ctrl.free);
5162+
/* Check transaction violation and get free ctrl tx PDU */
5163+
tx = ctrl_tx_rsp_mem_acquire(conn, rx, &err);
51635164
if (!tx) {
5164-
return -ENOBUFS;
5165+
return err;
51655166
}
51665167

51675168
/* Wait for peer master to complete the procedure */
@@ -5537,9 +5538,18 @@ static inline void ctrl_tx_ack(struct ll_conn *conn, struct node_tx **tx,
55375538
uint8_t phy_tx_time[8] = {PHY_1M, PHY_1M, PHY_2M,
55385539
PHY_1M, PHY_CODED, PHY_CODED,
55395540
PHY_CODED, PHY_CODED};
5540-
struct lll_conn *lll = &conn->lll;
5541+
struct lll_conn *lll;
55415542
uint8_t phys;
55425543

5544+
/* Reset the transaction lock when PHY update response
5545+
* sent by peripheral is acknowledged.
5546+
*/
5547+
if (pdu_tx->llctrl.opcode ==
5548+
PDU_DATA_LLCTRL_TYPE_PHY_RSP) {
5549+
conn->common.txn_lock = 0U;
5550+
}
5551+
5552+
lll = &conn->lll;
55435553
phys = conn->llcp_phy.tx | lll->phy_tx;
55445554
lll->phy_tx_time = phy_tx_time[phys];
55455555
}

0 commit comments

Comments
 (0)