From 25e6279493d673ec76ef5cb72bbfb0b651274144 Mon Sep 17 00:00:00 2001 From: Erik Brockhoff Date: Wed, 25 May 2022 09:17:59 +0200 Subject: [PATCH] Bluetooth: controller: llcp: fix for failing LL qualification tests Fixes issue re. sending packets after sending TERMINATE_IND. Fixes issue re. erroneous error code on 'timed out' termination (ie when peer does not ack terminate_ind) Signed-off-by: Erik Brockhoff --- subsys/bluetooth/controller/ll_sw/ull_conn.c | 4 +++- subsys/bluetooth/controller/ll_sw/ull_llcp_common.c | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn.c b/subsys/bluetooth/controller/ll_sw/ull_conn.c index 4225605ea5e..3c8fb01c8f1 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn.c @@ -1464,9 +1464,11 @@ void ull_conn_done(struct node_rx_event_done *done) (((conn->llcp_terminate.req - conn->llcp_terminate.ack) & 0xFF) == TERM_ACKED) || -#endif /* CONFIG_BT_LL_SW_LLCP_LEGACY */ conn->central.terminate_ack || (reason_final == BT_HCI_ERR_TERM_DUE_TO_MIC_FAIL) +#else /* CONFIG_BT_LL_SW_LLCP_LEGACY */ + 1 +#endif /* CONFIG_BT_LL_SW_LLCP_LEGACY */ #else /* CONFIG_BT_CENTRAL */ 1 #endif /* CONFIG_BT_CENTRAL */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c index a321bb079d8..c614e8ca025 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c @@ -514,6 +514,7 @@ static void lp_comm_send_req(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t ctx->state = LP_COMMON_STATE_WAIT_TX; } else { lp_comm_tx(conn, ctx); + ctx->data.term.error_code = BT_HCI_ERR_LOCALHOST_TERM_CONN; ctx->state = LP_COMMON_STATE_WAIT_TX_ACK; } break;