* [PATCH v1 2/3] Bluetooth: HCI: Fix using LE/ACL buffers for ISO packets
2025-06-27 15:18 [PATCH v1 1/3] Bluetooth: ISO: Don't initiate CIS connections if there are no buffers Luiz Augusto von Dentz
@ 2025-06-27 15:18 ` Luiz Augusto von Dentz
2025-06-27 15:18 ` [PATCH v1 3/3] Bluetooth: hci_conn: Make unacked packet handling more robust Luiz Augusto von Dentz
2025-06-27 16:01 ` [v1,1/3] Bluetooth: ISO: Don't initiate CIS connections if there are no buffers bluez.test.bot
2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2025-06-27 15:18 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
ISO packets shall not use LE/ACL buffer pool, that feature seem to be
exclusive to LE-ACL only.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
net/bluetooth/hci_conn.c | 24 ++++++++++--------------
net/bluetooth/hci_core.c | 3 +--
net/bluetooth/hci_event.c | 16 +++-------------
3 files changed, 14 insertions(+), 29 deletions(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 4f379184df5b..23ea56031dff 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1139,27 +1139,23 @@ void hci_conn_del(struct hci_conn *conn)
disable_delayed_work_sync(&conn->auto_accept_work);
disable_delayed_work_sync(&conn->idle_work);
- if (conn->type == ACL_LINK) {
- /* Unacked frames */
+ /* Handle unnacked frames */
+ switch (conn->type) {
+ case ACL_LINK:
hdev->acl_cnt += conn->sent;
- } else if (conn->type == LE_LINK) {
+ break;
+ case LE_LINK:
cancel_delayed_work(&conn->le_conn_timeout);
if (hdev->le_pkts)
hdev->le_cnt += conn->sent;
else
hdev->acl_cnt += conn->sent;
- } else {
- /* Unacked ISO frames */
- if (conn->type == CIS_LINK ||
- conn->type == BIS_LINK) {
- if (hdev->iso_pkts)
- hdev->iso_cnt += conn->sent;
- else if (hdev->le_pkts)
- hdev->le_cnt += conn->sent;
- else
- hdev->acl_cnt += conn->sent;
- }
+ break;
+ case CIS_LINK:
+ case BIS_LINK:
+ hdev->iso_cnt += conn->sent;
+ break;
}
skb_queue_purge(&conn->data_q);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 42f597cb0941..192a21c2ea12 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3757,8 +3757,7 @@ static void hci_sched_iso(struct hci_dev *hdev)
!hci_conn_num(hdev, BIS_LINK))
return;
- cnt = hdev->iso_pkts ? &hdev->iso_cnt :
- hdev->le_pkts ? &hdev->le_cnt : &hdev->acl_cnt;
+ cnt = &hdev->iso_cnt;
while (*cnt && (conn = hci_low_sent(hdev, CIS_LINK, BIS_LINK,
"e))) {
while (quote-- && (skb = skb_dequeue(&conn->data_q))) {
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index c4b87bfb4c1a..ef5fa8ecd56d 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -4469,19 +4469,9 @@ static void hci_num_comp_pkts_evt(struct hci_dev *hdev, void *data,
case CIS_LINK:
case BIS_LINK:
- if (hdev->iso_pkts) {
- hdev->iso_cnt += count;
- if (hdev->iso_cnt > hdev->iso_pkts)
- hdev->iso_cnt = hdev->iso_pkts;
- } else if (hdev->le_pkts) {
- hdev->le_cnt += count;
- if (hdev->le_cnt > hdev->le_pkts)
- hdev->le_cnt = hdev->le_pkts;
- } else {
- hdev->acl_cnt += count;
- if (hdev->acl_cnt > hdev->acl_pkts)
- hdev->acl_cnt = hdev->acl_pkts;
- }
+ hdev->iso_cnt += count;
+ if (hdev->iso_cnt > hdev->iso_pkts)
+ hdev->iso_cnt = hdev->iso_pkts;
break;
default:
--
2.49.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH v1 3/3] Bluetooth: hci_conn: Make unacked packet handling more robust
2025-06-27 15:18 [PATCH v1 1/3] Bluetooth: ISO: Don't initiate CIS connections if there are no buffers Luiz Augusto von Dentz
2025-06-27 15:18 ` [PATCH v1 2/3] Bluetooth: HCI: Fix using LE/ACL buffers for ISO packets Luiz Augusto von Dentz
@ 2025-06-27 15:18 ` Luiz Augusto von Dentz
2025-06-27 16:01 ` [v1,1/3] Bluetooth: ISO: Don't initiate CIS connections if there are no buffers bluez.test.bot
2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2025-06-27 15:18 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This attempts to make unacked packet handling more robust by detecting
if there are no connections left then restore all buffers of the
respective pool.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
net/bluetooth/hci_conn.c | 34 +++++++++++++++++++++++++++-------
1 file changed, 27 insertions(+), 7 deletions(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 23ea56031dff..6ed69a4b01db 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1139,22 +1139,42 @@ void hci_conn_del(struct hci_conn *conn)
disable_delayed_work_sync(&conn->auto_accept_work);
disable_delayed_work_sync(&conn->idle_work);
- /* Handle unnacked frames */
+ /* Handle unnacked frames:
+ *
+ * - In case there are no connection restore all buffers to the pool
+ * - Otherwise restore just the buffers considered in transit for the
+ * hci_conn
+ */
switch (conn->type) {
case ACL_LINK:
- hdev->acl_cnt += conn->sent;
+ if (!hci_conn_num(hdev, ACL_LINK))
+ hdev->acl_cnt = hdev->acl_pkts;
+ else
+ hdev->acl_cnt += conn->sent;
break;
case LE_LINK:
cancel_delayed_work(&conn->le_conn_timeout);
- if (hdev->le_pkts)
- hdev->le_cnt += conn->sent;
- else
- hdev->acl_cnt += conn->sent;
+ if (hdev->le_pkts) {
+ if (!hci_conn_num(hdev, LE_LINK))
+ hdev->le_cnt = hdev->le_pkts;
+ else
+ hdev->le_cnt += conn->sent;
+ } else {
+ if (!hci_conn_num(hdev, LE_LINK) &&
+ !hci_conn_num(hdev, ACL_LINK))
+ hdev->acl_cnt = hdev->acl_pkts;
+ else
+ hdev->acl_cnt += conn->sent;
+ }
break;
case CIS_LINK:
case BIS_LINK:
- hdev->iso_cnt += conn->sent;
+ if (!hci_conn_num(hdev, CIS_LINK) &&
+ !hci_conn_num(hdev, BIS_LINK))
+ hdev->iso_cnt = hdev->iso_pkts;
+ else
+ hdev->iso_cnt += conn->sent;
break;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* RE: [v1,1/3] Bluetooth: ISO: Don't initiate CIS connections if there are no buffers
2025-06-27 15:18 [PATCH v1 1/3] Bluetooth: ISO: Don't initiate CIS connections if there are no buffers Luiz Augusto von Dentz
2025-06-27 15:18 ` [PATCH v1 2/3] Bluetooth: HCI: Fix using LE/ACL buffers for ISO packets Luiz Augusto von Dentz
2025-06-27 15:18 ` [PATCH v1 3/3] Bluetooth: hci_conn: Make unacked packet handling more robust Luiz Augusto von Dentz
@ 2025-06-27 16:01 ` bluez.test.bot
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2025-06-27 16:01 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 2912 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=976702
---Test result---
Test Summary:
CheckPatch PENDING 0.28 seconds
GitLint PENDING 0.25 seconds
SubjectPrefix PASS 0.30 seconds
BuildKernel PASS 24.63 seconds
CheckAllWarning PASS 26.92 seconds
CheckSparse WARNING 30.61 seconds
BuildKernel32 PASS 23.99 seconds
TestRunnerSetup PASS 469.26 seconds
TestRunner_l2cap-tester PASS 25.13 seconds
TestRunner_iso-tester PASS 35.95 seconds
TestRunner_bnep-tester PASS 5.89 seconds
TestRunner_mgmt-tester FAIL 128.31 seconds
TestRunner_rfcomm-tester PASS 9.20 seconds
TestRunner_sco-tester PASS 14.58 seconds
TestRunner_ioctl-tester PASS 9.92 seconds
TestRunner_mesh-tester FAIL 11.55 seconds
TestRunner_smp-tester PASS 8.46 seconds
TestRunner_userchan-tester PASS 6.08 seconds
IncrementalBuild PENDING 1.01 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: CheckSparse - WARNING
Desc: Run sparse tool with linux kernel
Output:
net/bluetooth/hci_core.c:85:9: warning: context imbalance in '__hci_dev_get' - different lock contexts for basic blocknet/bluetooth/hci_core.c: note: in included file (through include/linux/notifier.h, include/linux/memory_hotplug.h, include/linux/mmzone.h, include/linux/gfp.h, include/linux/xarray.h, include/linux/radix-tree.h, ...):net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 490, Passed: 484 (98.8%), Failed: 2, Not Run: 4
Failed Test Cases
LL Privacy - Start Discovery 2 (Disable RL) Failed 0.188 seconds
LL Privacy - Set Device Flag 1 (Device Privacy) Failed 0.167 seconds
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0
Failed Test Cases
Mesh - Send cancel - 1 Timed out 2.149 seconds
Mesh - Send cancel - 2 Timed out 2.002 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread