linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] Bluetooth: ISO: consider right CIS when removing CIG at cleanup
@ 2023-05-22 20:52 Pauli Virtanen
  2023-05-22 20:52 ` [PATCH v2 2/2] Bluetooth: ISO: fix CIG auto-allocation to select configurable CIG Pauli Virtanen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pauli Virtanen @ 2023-05-22 20:52 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

When looking for CIS blocking CIG removal, consider only the CIS with
the right CIG ID. Don't try to remove CIG with unset CIG ID.

Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
---

Notes:
    * v2: add forgotten signoff + fixes

 net/bluetooth/hci_conn.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index f75ef12f18f7..2363477af89d 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -950,6 +950,8 @@ static void find_cis(struct hci_conn *conn, void *data)
 	/* Ignore broadcast */
 	if (!bacmp(&conn->dst, BDADDR_ANY))
 		return;
+	if (d->cig != conn->iso_qos.ucast.cig)
+		return;
 
 	d->count++;
 }
@@ -963,6 +965,9 @@ static void cis_cleanup(struct hci_conn *conn)
 	struct hci_dev *hdev = conn->hdev;
 	struct iso_list_data d;
 
+	if (conn->iso_qos.ucast.cig == BT_ISO_QOS_CIG_UNSET)
+		return;
+
 	memset(&d, 0, sizeof(d));
 	d.cig = conn->iso_qos.ucast.cig;
 
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] Bluetooth: ISO: fix CIG auto-allocation to select configurable CIG
  2023-05-22 20:52 [PATCH v2 1/2] Bluetooth: ISO: consider right CIS when removing CIG at cleanup Pauli Virtanen
@ 2023-05-22 20:52 ` Pauli Virtanen
  2023-05-22 21:10 ` [PATCH v2 1/2] Bluetooth: ISO: consider right CIS when removing CIG at cleanup patchwork-bot+bluetooth
  2023-05-22 21:48 ` [v2,1/2] " bluez.test.bot
  2 siblings, 0 replies; 4+ messages in thread
From: Pauli Virtanen @ 2023-05-22 20:52 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Make CIG auto-allocation to select the first CIG_ID that is still
configurable. Also use correct CIG_ID range (see Core v5.3 Vol 4 Part E
Sec 7.8.97 p.2553).

Previously, it would always select CIG_ID 0 regardless of anything,
because cis_list with data.cis == 0xff (BT_ISO_QOS_CIS_UNSET) would not
count any CIS. Since we are not adding CIS here, use find_cis instead.

Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
---

Notes:
    * v2: add forgotten signoff + fixes
    
    It could also make sense to always auto-allocate to an unused CIG_ID
    instead.  However, that changes current behavior, and would force
    userspace to do the allocation themselves as they may want to use as few
    CIG as possible. I think e.g Intel AX210 doesn't support multiple CIG.
    
    With the patchset adding new BlueZ iso-tester CIG tests:
    
    ISO Connect2 CIG auto/auto Seq - Success             Passed       0.148 seconds

 net/bluetooth/hci_conn.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 2363477af89d..99150d054a8d 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1771,24 +1771,23 @@ static bool hci_le_set_cig_params(struct hci_conn *conn, struct bt_iso_qos *qos)
 
 	memset(&data, 0, sizeof(data));
 
-	/* Allocate a CIG if not set */
+	/* Allocate first still reconfigurable CIG if not set */
 	if (qos->ucast.cig == BT_ISO_QOS_CIG_UNSET) {
-		for (data.cig = 0x00; data.cig < 0xff; data.cig++) {
+		for (data.cig = 0x00; data.cig < 0xf0; data.cig++) {
 			data.count = 0;
-			data.cis = 0xff;
 
-			hci_conn_hash_list_state(hdev, cis_list, ISO_LINK,
-						 BT_BOUND, &data);
+			hci_conn_hash_list_state(hdev, find_cis, ISO_LINK,
+						 BT_CONNECT, &data);
 			if (data.count)
 				continue;
 
-			hci_conn_hash_list_state(hdev, cis_list, ISO_LINK,
+			hci_conn_hash_list_state(hdev, find_cis, ISO_LINK,
 						 BT_CONNECTED, &data);
 			if (!data.count)
 				break;
 		}
 
-		if (data.cig == 0xff)
+		if (data.cig == 0xf0)
 			return false;
 
 		/* Update CIG */
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] Bluetooth: ISO: consider right CIS when removing CIG at cleanup
  2023-05-22 20:52 [PATCH v2 1/2] Bluetooth: ISO: consider right CIS when removing CIG at cleanup Pauli Virtanen
  2023-05-22 20:52 ` [PATCH v2 2/2] Bluetooth: ISO: fix CIG auto-allocation to select configurable CIG Pauli Virtanen
@ 2023-05-22 21:10 ` patchwork-bot+bluetooth
  2023-05-22 21:48 ` [v2,1/2] " bluez.test.bot
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2023-05-22 21:10 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hello:

This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon, 22 May 2023 20:52:44 +0000 you wrote:
> When looking for CIS blocking CIG removal, consider only the CIS with
> the right CIG ID. Don't try to remove CIG with unset CIG ID.
> 
> Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections")
> Signed-off-by: Pauli Virtanen <pav@iki.fi>
> ---
> 
> [...]

Here is the summary with links:
  - [v2,1/2] Bluetooth: ISO: consider right CIS when removing CIG at cleanup
    (no matching commit)
  - [v2,2/2] Bluetooth: ISO: fix CIG auto-allocation to select configurable CIG
    https://git.kernel.org/bluetooth/bluetooth-next/c/fb576dc48252

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [v2,1/2] Bluetooth: ISO: consider right CIS when removing CIG at cleanup
  2023-05-22 20:52 [PATCH v2 1/2] Bluetooth: ISO: consider right CIS when removing CIG at cleanup Pauli Virtanen
  2023-05-22 20:52 ` [PATCH v2 2/2] Bluetooth: ISO: fix CIG auto-allocation to select configurable CIG Pauli Virtanen
  2023-05-22 21:10 ` [PATCH v2 1/2] Bluetooth: ISO: consider right CIS when removing CIG at cleanup patchwork-bot+bluetooth
@ 2023-05-22 21:48 ` bluez.test.bot
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2023-05-22 21:48 UTC (permalink / raw)
  To: linux-bluetooth, pav

[-- Attachment #1: Type: text/plain, Size: 2496 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=749935

---Test result---

Test Summary:
CheckPatch                    PASS      1.23 seconds
GitLint                       FAIL      0.83 seconds
SubjectPrefix                 PASS      0.14 seconds
BuildKernel                   PASS      42.43 seconds
CheckAllWarning               PASS      47.20 seconds
CheckSparse                   PASS      53.66 seconds
CheckSmatch                   PASS      141.21 seconds
BuildKernel32                 PASS      39.84 seconds
TestRunnerSetup               PASS      572.92 seconds
TestRunner_l2cap-tester       PASS      19.08 seconds
TestRunner_iso-tester         PASS      25.65 seconds
TestRunner_bnep-tester        PASS      6.73 seconds
TestRunner_mgmt-tester        PASS      143.08 seconds
TestRunner_rfcomm-tester      PASS      11.26 seconds
TestRunner_sco-tester         PASS      10.24 seconds
TestRunner_ioctl-tester       PASS      11.53 seconds
TestRunner_mesh-tester        PASS      8.35 seconds
TestRunner_smp-tester         PASS      9.87 seconds
TestRunner_userchan-tester    PASS      6.99 seconds
IncrementalBuild              FAIL      0.94 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[v2,2/2] Bluetooth: ISO: fix CIG auto-allocation to select configurable CIG

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
16: B2 Line has trailing whitespace: "    "
21: B2 Line has trailing whitespace: "    "
23: B2 Line has trailing whitespace: "    "
24: B1 Line exceeds max length (83>80): "    ISO Connect2 CIG auto/auto Seq - Success             Passed       0.148 seconds"
##############################
Test: IncrementalBuild - FAIL
Desc: Incremental build with the patches in the series
Output:

error: patch failed: net/bluetooth/hci_conn.c:950
error: net/bluetooth/hci_conn.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch


---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-22 21:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-22 20:52 [PATCH v2 1/2] Bluetooth: ISO: consider right CIS when removing CIG at cleanup Pauli Virtanen
2023-05-22 20:52 ` [PATCH v2 2/2] Bluetooth: ISO: fix CIG auto-allocation to select configurable CIG Pauli Virtanen
2023-05-22 21:10 ` [PATCH v2 1/2] Bluetooth: ISO: consider right CIS when removing CIG at cleanup patchwork-bot+bluetooth
2023-05-22 21:48 ` [v2,1/2] " bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).