From e5cf9ce1f2363089a042eae41e04e9ebe790faaa Mon Sep 17 00:00:00 2001 From: Alexander Svensen Date: Fri, 3 May 2019 12:20:07 +0200 Subject: [PATCH] Bluetooth: controller: ull/lll: Do not feature exc more than once Updated the controller implementation to not feature exchange if already done once either by local or remote peer device in an active connection session. Signed-off-by: Alexander Svensen --- subsys/bluetooth/controller/ll_sw/ull_conn.c | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn.c b/subsys/bluetooth/controller/ll_sw/ull_conn.c index 9b6534d1cc9..d904a566214 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn.c @@ -2168,6 +2168,44 @@ static inline void event_fex_prep(struct ll_conn *conn) { struct node_tx *tx; + if (conn->common.fex_valid) { + struct node_rx_pdu *rx; + struct pdu_data *pdu; + + /* procedure request acked */ + conn->llcp_ack = conn->llcp_req; + + /* get a rx node for ULL->LL */ + rx = ll_pdu_rx_alloc(); + if (!rx) { + return; + } + + rx->hdr.handle = conn->lll.handle; + rx->hdr.type = NODE_RX_TYPE_DC_PDU; + + /* prepare feature rsp structure */ + pdu = (void *)rx->pdu; + pdu->ll_id = PDU_DATA_LLID_CTRL; + pdu->len = offsetof(struct pdu_data_llctrl, feature_rsp) + + sizeof(struct pdu_data_llctrl_feature_rsp); + pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_FEATURE_RSP; + (void)memset(&pdu->llctrl.feature_rsp.features[0], 0x00, + sizeof(pdu->llctrl.feature_rsp.features)); + pdu->llctrl.feature_req.features[0] = + conn->llcp_features & 0xFF; + pdu->llctrl.feature_req.features[1] = + (conn->llcp_features >> 8) & 0xFF; + pdu->llctrl.feature_req.features[2] = + (conn->llcp_features >> 16) & 0xFF; + + /* enqueue feature rsp structure into rx queue */ + ll_rx_put(rx->hdr.link, rx); + ll_rx_sched(); + + return; + } + tx = mem_acquire(&mem_conn_tx_ctrl.free); if (tx) { struct pdu_data *pdu = (void *)tx->pdu;