Skip to contentSkip to conversation

Bluetooth: hci_core: Enable buffer flow control for SCO/eSCO

PATCH Applied Luiz Augusto von Dentz 4 participants 5 messages Feb 18, 2025 – Feb 20, 2025

Subsystems (2)

v1 of 6 Applied 1/1 Latest is v6 →

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: hci_core: Enable buffer flow control for SCO/eSCO

From: Luiz Augusto von Dentz <[email protected]>

This enables buffer flow controler for SCO/eSCO which apparently for some reason has not been in use up until now which caused sco_cnt to never be updated, but recently this has caused the following problem:

< HCI Command: Read Buffer Size (0x04|0x0005) plen 0

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 11

Read Buffer Size (0x04|0x0005) ncmd 1
Status: Success (0x00)
ACL MTU: 1021 ACL max packet: 5
SCO MTU: 240 SCO max packet: 8
...
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120

Quoted 1 line

HCI Event: Hardware Error (0x10) plen 1

        Code: 0x0a
Fixes 7fedd3bb6b77 ("Bluetooth: Prioritize SCO traffic")
---
 net/bluetooth/hci_core.c | 2 ++
 1 file changed, 2 insertions(+)
net/bluetooth/hci_core.c +2 -0
index e7ec12437c8b..5c88d3816c6a 100644
@@ -3564,6 +3564,7 @@ static void hci_sched_sco(struct hci_dev *hdev)
 			BT_DBG("skb %p len %d", skb, skb->len);
 			hci_send_frame(hdev, skb);
 
+			hdev->sco_cnt--;
 			conn->sent++;
 			if (conn->sent == ~0)
 				conn->sent = 0;
@@ -3588,6 +3589,7 @@ static void hci_sched_esco(struct hci_dev *hdev)
 			BT_DBG("skb %p len %d", skb, skb->len);
 			hci_send_frame(hdev, skb);
 
+			hdev->sco_cnt--;
 			conn->sent++;
 			if (conn->sent == ~0)
 				conn->sent = 0;
Signature · 1 line
2.48.1
#1 lore raw

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=935304

---Test result---

Test Summary:

CheckPatch                    PENDING   0.35 seconds
GitLint                       PENDING   0.21 seconds
SubjectPrefix                 PASS      0.10 seconds
BuildKernel                   PASS      25.09 seconds
CheckAllWarning               PASS      28.51 seconds
CheckSparse                   PASS      30.92 seconds
BuildKernel32                 PASS      24.34 seconds
TestRunnerSetup               PASS      438.23 seconds
TestRunner_l2cap-tester       PASS      21.00 seconds
TestRunner_iso-tester         PASS      35.53 seconds
TestRunner_bnep-tester        PASS      4.83 seconds
TestRunner_mgmt-tester        FAIL      122.70 seconds
TestRunner_rfcomm-tester      PASS      8.32 seconds
TestRunner_sco-tester         PASS      10.33 seconds
TestRunner_ioctl-tester       PASS      8.36 seconds
TestRunner_mesh-tester        PASS      5.95 seconds
TestRunner_smp-tester         PASS      7.26 seconds
TestRunner_userchan-tester    PASS      4.95 seconds
IncrementalBuild              PENDING   0.75 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 490, Passed: 483 (98.6%), Failed: 3, Not Run: 4

Failed Test Cases

LL Privacy - Add Device 3 (AL is full)               Failed       0.193 seconds
LL Privacy - Set Flags 2 (Enable RL)                 Failed       0.130 seconds
LL Privacy - Start Discovery 1 (Disable RL)          Failed       0.170 seconds

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Luiz Augusto von Dentz
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 22 lines · On Tue, 18 Feb 2025 16:43:44 -0500 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

This enables buffer flow controler for SCO/eSCO which apparently for some reason has not been in use up until now which caused sco_cnt to never be updated, but recently this has caused the following problem:

< HCI Command: Read Buffer Size (0x04|0x0005) plen 0

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 11

Read Buffer Size (0x04|0x0005) ncmd 1
Status: Success (0x00)
ACL MTU: 1021 ACL max packet: 5
SCO MTU: 240 SCO max packet: 8
...
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120

Quoted 4 lines
Quoted 1 line

HCI Event: Hardware Error (0x10) plen 1

        Code: 0x0a

[...]

Here is the summary with links:
- [v1] Bluetooth: hci_core: Enable buffer flow control for SCO/eSCO

    https://git.kernel.org/bluetooth/bluetooth-next/c/eaaf44d2e680

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#3 lore raw
In reply to Luiz Augusto von Dentz

Hi Luiz,

ti, 2025-02-18 kello 16:43 -0500, Luiz Augusto von Dentz kirjoitti:

Quoted 5 lines

From: Luiz Augusto von Dentz <[email protected]>

This enables buffer flow controler for SCO/eSCO which apparently for some reason has not been in use up until now which caused sco_cnt to never be updated, but recently this has caused the following problem:

Should this first check or explicitly enable
Synchronous_Flow_Control_Enable setting, via
HCI_Read/Write_Synchronous_Flow_Control_Enable?

IIRC SCO packets by default don't generate Number of Completed Packets, so is there something that is incrementing sco_cnt?

Quoted 45 lines

< HCI Command: Read Buffer Size (0x04|0x0005) plen 0

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 11

Read Buffer Size (0x04|0x0005) ncmd 1
Status: Success (0x00)
ACL MTU: 1021 ACL max packet: 5
SCO MTU: 240 SCO max packet: 8
...
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120

Quoted 1 line

HCI Event: Hardware Error (0x10) plen 1

        Code: 0x0a
Fixes 7fedd3bb6b77 ("Bluetooth: Prioritize SCO traffic")
---
 net/bluetooth/hci_core.c | 2 ++
 1 file changed, 2 insertions(+)
net/bluetooth/hci_core.c +2 -0
index e7ec12437c8b..5c88d3816c6a 100644
@@ -3564,6 +3564,7 @@ static void hci_sched_sco(struct hci_dev *hdev)
 			BT_DBG("skb %p len %d", skb, skb->len);
 			hci_send_frame(hdev, skb);
 
+			hdev->sco_cnt--;
 			conn->sent++;
 			if (conn->sent == ~0)
 				conn->sent = 0;
@@ -3588,6 +3589,7 @@ static void hci_sched_esco(struct hci_dev *hdev)
 			BT_DBG("skb %p len %d", skb, skb->len);
 			hci_send_frame(hdev, skb);
 
+			hdev->sco_cnt--;
 			conn->sent++;
 			if (conn->sent == ~0)
 				conn->sent = 0;
Signature · 1 line
Pauli Virtanen
author maintainer
#4 lore raw

Hi Pauli,

Quoted 10 lines · Pauli Virtanen

Hi Luiz,

ti, 2025-02-18 kello 16:43 -0500, Luiz Augusto von Dentz kirjoitti:

Quoted 5 lines

From: Luiz Augusto von Dentz <[email protected]>

This enables buffer flow controler for SCO/eSCO which apparently for some reason has not been in use up until now which caused sco_cnt to never be updated, but recently this has caused the following problem:

Quoted 6 lines

Should this first check or explicitly enable
Synchronous_Flow_Control_Enable setting, via
HCI_Read/Write_Synchronous_Flow_Control_Enable?

IIRC SCO packets by default don't generate Number of Completed Packets, so is there something that is incrementing sco_cnt?

Yeah, totally forgot this exists for SCO, we will need to check if it is supported before we can turn it on.

Quoted 48 lines
Quoted 38 lines

< HCI Command: Read Buffer Size (0x04|0x0005) plen 0

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 11

Read Buffer Size (0x04|0x0005) ncmd 1
Status: Success (0x00)
ACL MTU: 1021 ACL max packet: 5
SCO MTU: 240 SCO max packet: 8
...
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120
< SCO Data TX: Handle 257 flags 0x00 dlen 120

Quoted 1 line

HCI Event: Hardware Error (0x10) plen 1

        Code: 0x0a
Fixes 7fedd3bb6b77 ("Bluetooth: Prioritize SCO traffic")
---
 net/bluetooth/hci_core.c | 2 ++
 1 file changed, 2 insertions(+)
net/bluetooth/hci_core.c +1 -0
index e7ec12437c8b..5c88d3816c6a 100644
@@ -3564,6 +3564,7 @@ static void hci_sched_sco(struct hci_dev *hdev)
                      BT_DBG("skb %p len %d", skb, skb->len);
                      hci_send_frame(hdev, skb);
 
+                     hdev->sco_cnt--;
                      conn->sent++;
                      if (conn->sent == ~0)
                              conn->sent = 0;

net/bluetooth/hci_core.c static void hci_sched_esco(struct hci_dev *hdev) · line 3595

Quoted 7 lines
net/bluetooth/hci_core.c +1 -0
@@ -3588,6 +3589,7 @@ static void hci_sched_esco(struct hci_dev *hdev)
                      BT_DBG("skb %p len %d", skb, skb->len);
                      hci_send_frame(hdev, skb);
 
+                     hdev->sco_cnt--;
                      conn->sent++;
                      if (conn->sent == ~0)
                              conn->sent = 0;

--
Pauli Virtanen

Signature · 1 line
Luiz Augusto von Dentz