Bluetooth: hci_conn: Add support for linking multiple hcon
Subsystems (2)
Luiz Augusto von Dentz
maintainerPATCH v3 1/3 Bluetooth: hci_conn: Add support for linking multiple hcon
From: Luiz Augusto von Dentz <[email protected]>
Since it is required for some configurations to have multiple CIS with the same peer which is now covered by iso-tester in the following test cases:
ISO AC 6(i) - Success
ISO AC 7(i) - Success
ISO AC 8(i) - Success
ISO AC 9(i) - Success
ISO AC 11(i) - Success
--- include/net/bluetooth/hci_core.h | 14 ++- net/bluetooth/hci_conn.c | 157 ++++++++++++++++++++++--------- net/bluetooth/hci_event.c | 94 +++++++++--------- net/bluetooth/iso.c | 8 +- 4 files changed, 174 insertions(+), 99 deletions(-)
include/net/bluetooth/hci_core.h +12 -2
@@ -770,7 +770,10 @@ struct hci_conn {void *iso_data;struct amp_mgr *amp_mgr; -struct hci_conn *link; +struct list_head link_list; +struct hci_conn *parent; +struct hci_link *link; +struct bt_codec codec;void (*connect_cfm_cb) (struct hci_conn *conn,u8 status);
@@ -780,6 +783,11 @@ struct hci_conn {void (*cleanup)(struct hci_conn *conn); }; +struct hci_link { +struct list_head list; +struct hci_conn *conn; +}; +struct hci_chan {struct list_head list;__u16 handle;
@@ -1383,12 +1391,14 @@ static inline void hci_conn_put(struct hci_conn *conn)put_device (&conn->dev); } -static inline void hci_conn_hold (struct hci_conn *conn) +static inline struct hci_conn *hci_conn_hold (struct hci_conn *conn) {BT_DBG ("hcon %p orig refcnt %d" , conn,atomic_read (&conn->refcnt));atomic_inc (&conn->refcnt);cancel_delayed_work (&conn->disc_work); + +return conn; }static inline void hci_conn_drop (struct hci_conn *conn)
net/bluetooth/hci_conn.c +114 -43
286 lines not on this page · raw message
net/bluetooth/hci_event.c +42 -52
153 lines not on this page · raw message
net/bluetooth/iso.c +6 -2
@@ -1657,8 +1657,12 @@ static void iso_connect_cfm(struct hci_conn *hcon, __u8 status)/* Check if LE link has failed */ if (status) { -if (hcon->link) -iso_conn_del (hcon->link,bt_to_errno (status)); +struct hci_link *link, *t; + +list_for_each_entry_safe (link, t, &hcon->link_list, + list) +iso_conn_del (link->conn,bt_to_errno (status)); +return ; }
Signature · 1 line
2.39.2
Luiz Augusto von Dentz
maintainerPATCH v3 2/3 Bluetooth: hci_conn: Fix not matching by CIS ID
From: Luiz Augusto von Dentz <[email protected]>
This fixes only matching CIS by address which prevents creating new hcon if upper layer is requesting a specific CIS ID.
--- include/net/bluetooth/hci_core.h | 12 +++++++++++- net/bluetooth/hci_conn.c | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-)
include/net/bluetooth/hci_core.h +11 -1
@@ -1180,7 +1180,9 @@ static inline struct hci_conn *hci_conn_hash_lookup_le(struct hci_dev *hdev,static inline struct hci_conn *hci_conn_hash_lookup_cis (struct hci_dev *hdev,bdaddr_t *ba, -__u8 ba_type) +__u8 ba_type, +__u8 cig, +__u8 id) {struct hci_conn_hash *h = &hdev->conn_hash;struct hci_conn *c;
@@ -1191,6 +1193,14 @@ static inline struct hci_conn *hci_conn_hash_lookup_cis(struct hci_dev *hdev,if (c->type !=ISO_LINK )continue ; +/* Match CIG ID if set */ +if (cig !=BT_ISO_QOS_CIG_UNSET && cig != c->iso_qos.ucast.cig) +continue ; + +/* Match CIS ID if set */ +if (id !=BT_ISO_QOS_CIS_UNSET && id != c->iso_qos.ucast.cis) +continue ; +if (ba_type == c->dst_type && !bacmp (&c->dst, ba)) {rcu_read_unlock ();return c;
net/bluetooth/hci_conn.c +2 -1
@@ -1841,7 +1841,8 @@ struct hci_conn *hci_bind_cis(struct hci_dev *hdev, bdaddr_t *dst, {struct hci_conn *cis; - cis =hci_conn_hash_lookup_cis (hdev, dst, dst_type); + cis =hci_conn_hash_lookup_cis (hdev, dst, dst_type, qos->ucast.cig, + qos->ucast.cis);if (!cis) { cis =hci_conn_add (hdev,ISO_LINK , dst,HCI_ROLE_MASTER );if (!cis)
Signature · 1 line
2.39.2
Luiz Augusto von Dentz
maintainerPATCH v3 3/3 Bluetooth: hci_conn: Fix not waiting for HCI_EVT_LE_CIS_ESTABLISHED
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
When submitting HCI_OP_LE_CREATE_CIS the code shall wait for HCI_EVT_LE_CIS_ESTABLISHED thus enforcing the serialization of HCI_OP_LE_CREATE_CIS as the Core spec does not allow to send them in parallel:
BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E page 2566:
If the Host issues this command before all the HCI_LE_CIS_Established events from the previous use of the command have been generated, the Controller shall return the error code Command Disallowed (0x0C).
--- include/net/bluetooth/hci_sync.h | 2 + net/bluetooth/hci_conn.c | 58 +--------------------------- net/bluetooth/hci_sync.c | 65 ++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 57 deletions(-)
include/net/bluetooth/hci_sync.h +2 -0
@@ -122,6 +122,8 @@ int hci_abort_conn_sync(struct hci_dev *hdev, struct hci_conn *conn, u8 reason);int hci_le_create_conn_sync (struct hci_dev *hdev,struct hci_conn *conn); +int hci_le_create_cis_sync (struct hci_dev *hdev,struct hci_conn *conn); +int hci_le_remove_cig_sync (struct hci_dev *hdev,u8 handle);int hci_le_terminate_big_sync (struct hci_dev *hdev,u8 handle,u8 reason);
net/bluetooth/hci_conn.c +1 -57
64 lines not on this page · raw message
net/bluetooth/hci_sync.c +65 -0
71 lines not on this page · raw message
Signature · 1 line
2.39.2
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 6 lines · On Fri, 14 Apr 2023 13:26:06 -0700 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
Since it is required for some configurations to have multiple CIS with the same peer which is now covered by iso-tester in the following test cases:
Quoted 7 lines
ISO AC 6(i) - Success
ISO AC 7(i) - Success
ISO AC 8(i) - Success
ISO AC 9(i) - Success
ISO AC 11(i) - Success[...]
Here is the summary with links:
- [BlueZ,v3,1/3] Bluetooth: hci_conn: Add support for linking multiple hcon (no matching commit)
- [BlueZ,v3,2/3] Bluetooth: hci_conn: Fix not matching by CIS ID
https://git.kernel.org/bluetooth/bluetooth-next/c/450b35ffd344 - [BlueZ,v3,3/3] Bluetooth: hci_conn: Fix not waiting for HCI_EVT_LE_CIS_ESTABLISHED https://git.kernel.org/bluetooth/bluetooth-next/c/2e5ad941e0e5
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html