diff mbox series

[1/6] Bluetooth: ISO: fix maximum number of CIS in Set CIG Parameters

Message ID 46eefccceb45556120a0d1fa95cf27c576e9649a.1685294131.git.pav@iki.fi
State New
Headers show
Series LE Set CIG Parameters / Create CIS fixes | expand

Commit Message

Pauli Virtanen May 28, 2023, 5:44 p.m. UTC
The maximum CIS_Count is 0x1f (Core v5.3 Vol 4 Part E Sec 7.8.97).

Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
---
 net/bluetooth/hci_conn.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Pauli Virtanen May 28, 2023, 11:23 p.m. UTC | #1
su, 2023-05-28 kello 17:44 +0000, Pauli Virtanen kirjoitti:
> The maximum CIS_Count is 0x1f (Core v5.3 Vol 4 Part E Sec 7.8.97).
> 
> Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections")
> Signed-off-by: Pauli Virtanen <pav@iki.fi>
> ---
>  net/bluetooth/hci_conn.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> index 1f906f8508bc..7b1a83ec50ae 100644
> --- a/net/bluetooth/hci_conn.c
> +++ b/net/bluetooth/hci_conn.c
> @@ -788,7 +788,7 @@ struct iso_list_data {
>  	int count;
>  	struct {
>  		struct hci_cp_le_set_cig_params cp;
> -		struct hci_cis_params cis[0x11];
> +		struct hci_cis_params cis[0x1f];
>  	} pdu;
>  };
>  
> @@ -1815,7 +1815,8 @@ static bool hci_le_set_cig_params(struct hci_conn *conn, struct bt_iso_qos *qos)
>  	}
>  
>  	/* Reprogram all CIS(s) with the same CIG */
> -	for (data.cig = qos->ucast.cig, data.cis = 0x00; data.cis < 0x11;
> +	for (data.cig = qos->ucast.cig, data.cis = 0x00;
> +	     data.cis < ARRAY_SIZE(data.pdu.cis);
>  	     data.cis++) {
>  		data.count = 0;
>  

Probably should also have cleaned up this loop while at it, the command
takes 0x1f configurations at most, but CIS IDs are <= 0xef. For v2...
diff mbox series

Patch

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 1f906f8508bc..7b1a83ec50ae 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -788,7 +788,7 @@  struct iso_list_data {
 	int count;
 	struct {
 		struct hci_cp_le_set_cig_params cp;
-		struct hci_cis_params cis[0x11];
+		struct hci_cis_params cis[0x1f];
 	} pdu;
 };
 
@@ -1815,7 +1815,8 @@  static bool hci_le_set_cig_params(struct hci_conn *conn, struct bt_iso_qos *qos)
 	}
 
 	/* Reprogram all CIS(s) with the same CIG */
-	for (data.cig = qos->ucast.cig, data.cis = 0x00; data.cis < 0x11;
+	for (data.cig = qos->ucast.cig, data.cis = 0x00;
+	     data.cis < ARRAY_SIZE(data.pdu.cis);
 	     data.cis++) {
 		data.count = 0;