Skip to content

Commit 1f238a1

Browse files
cvinayaknashif
authored andcommitted
Bluetooth: controller: Fix ENC_REQ PDU retransmission
Fix dropped ENC_REQ PDU when retransmitting, if slave was not listening or nack-ed it. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent bbdf13d commit 1f238a1

File tree

1 file changed

+17
-10
lines changed
  • subsys/bluetooth/controller/ll_sw

1 file changed

+17
-10
lines changed

subsys/bluetooth/controller/ll_sw/ctrl.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9783,19 +9783,22 @@ static bool is_enc_req_pause_tx(struct connection *conn)
97839783
pdu_data_tx = (void *)conn->pkt_tx_head->pdu_data;
97849784
if ((pdu_data_tx->ll_id == PDU_DATA_LLID_CTRL) &&
97859785
(pdu_data_tx->llctrl.opcode == PDU_DATA_LLCTRL_TYPE_ENC_REQ)) {
9786-
if ((conn->llcp_req != conn->llcp_ack) ||
9787-
(conn->llcp_feature.ack != conn->llcp_feature.req) ||
9788-
(conn->llcp_version.ack != conn->llcp_version.req) ||
9786+
if (((conn->llcp_req != conn->llcp_ack) &&
9787+
(conn->llcp_type != LLCP_ENCRYPTION)) ||
9788+
((conn->llcp_req == conn->llcp_ack) &&
9789+
((conn->llcp_feature.ack != conn->llcp_feature.req) ||
9790+
(conn->llcp_version.ack != conn->llcp_version.req) ||
97899791
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
9790-
(conn->llcp_conn_param.ack != conn->llcp_conn_param.req) ||
9792+
(conn->llcp_conn_param.ack !=
9793+
conn->llcp_conn_param.req) ||
97919794
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
97929795
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
9793-
(conn->llcp_length.ack != conn->llcp_length.req) ||
9796+
(conn->llcp_length.ack != conn->llcp_length.req) ||
97949797
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
97959798
#if defined(CONFIG_BT_CTLR_PHY)
9796-
(conn->llcp_phy.ack != conn->llcp_phy.req) ||
9799+
(conn->llcp_phy.ack != conn->llcp_phy.req) ||
97979800
#endif /* CONFIG_BT_CTLR_PHY */
9798-
0) {
9801+
0))) {
97999802
struct radio_pdu_node_tx *node_tx;
98009803

98019804
/* if we have control packets enqueued after this PDU
@@ -9825,10 +9828,14 @@ static bool is_enc_req_pause_tx(struct connection *conn)
98259828
return true;
98269829
}
98279830

9828-
conn->llcp.encryption.initiate = 1U;
9831+
if (conn->llcp_req == conn->llcp_ack) {
9832+
conn->llcp.encryption.initiate = 1U;
98299833

9830-
conn->llcp_type = LLCP_ENCRYPTION;
9831-
conn->llcp_ack--;
9834+
conn->llcp_type = LLCP_ENCRYPTION;
9835+
conn->llcp_ack--;
9836+
} else {
9837+
LL_ASSERT(conn->llcp_type == LLCP_ENCRYPTION);
9838+
}
98329839
}
98339840

98349841
/* Head contains a permitted data or control packet. */

0 commit comments

Comments
 (0)