Bluetooth: controller: Send disconnect complete when CIS is terminated

Previously the host would handle disconnecting associated CISes and
invoking callbacks when a host ACL conn was disconnected.

This responsibility has now been moved to the controller, which needs to
send a NODE_RX_TYPE_TERMINATE with the CIS handle for proper
disconnection in the host. This is in accordance with the spec.

As disconnect reason, the CIS uses the ACL reason, which is passed to
the host along with the handle.

Signed-off-by: Morten Priess <mtpr@oticon.com>
This commit is contained in:
Morten Priess 2021-10-18 14:52:05 +02:00 committed by Carles Cufí
commit cd470da214
6 changed files with 44 additions and 16 deletions

View file

@ -1961,8 +1961,15 @@ static void conn_cleanup_iso_cis_released_cb(struct ll_conn *conn)
cis = ll_conn_iso_stream_get_by_acl(conn, NULL);
if (cis) {
struct node_rx_pdu *rx;
uint8_t reason;
/* More associated CISes - stop next */
ull_conn_iso_cis_stop(cis, conn_cleanup_iso_cis_released_cb);
rx = (void *)&conn->llcp_terminate.node_rx;
reason = *(uint8_t *)rx->pdu;
ull_conn_iso_cis_stop(cis, conn_cleanup_iso_cis_released_cb,
reason);
} else {
/* No more CISes associated with conn - finalize */
conn_cleanup_finalize(conn);
@ -2038,7 +2045,8 @@ static void conn_cleanup(struct ll_conn *conn, uint8_t reason)
cis = ll_conn_iso_stream_get_by_acl(conn, NULL);
if (cis) {
/* Stop CIS and defer cleanup to after teardown. */
ull_conn_iso_cis_stop(cis, conn_cleanup_iso_cis_released_cb);
ull_conn_iso_cis_stop(cis, conn_cleanup_iso_cis_released_cb,
reason);
return;
}
#endif /* CONFIG_BT_CTLR_PERIPHERAL_ISO || CONFIG_BT_CTLR_CENTRAL_ISO */