diff mbox series

[v5] Bluetooth: hci_event: Fix parsing of CIS Established Event

Message ID 20230623212439.1702413-1-luiz.dentz@gmail.com (mailing list archive)
State Superseded
Commit 5f68122ac2828a437a5cc0891552fa31aa4bc755
Headers show
Series [v5] Bluetooth: hci_event: Fix parsing of CIS Established Event | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse warning CheckSparse WARNING net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
tedd_an/CheckSmatch warning CheckSparse WARNING net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester fail TestRunner_iso-tester: Total: 80, Passed: 54 (67.5%), Failed: 26, Not Run: 0
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester success TestRunner PASS
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Luiz Augusto von Dentz June 23, 2023, 9:24 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

The ISO Interval on CIS Established Event uses 1.25 ms slots:

    BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E
    page 2304:

      Time = N * 1.25 ms

In addition to that this always update the QoS settings based on CIS
Established Event.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/hci_event.c | 45 ++++++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 13 deletions(-)

Comments

bluez.test.bot@gmail.com June 23, 2023, 10:01 p.m. UTC | #1
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=759915

---Test result---

Test Summary:
CheckPatch                    PASS      0.91 seconds
GitLint                       PASS      0.40 seconds
SubjectPrefix                 PASS      0.14 seconds
BuildKernel                   PASS      45.47 seconds
CheckAllWarning               PASS      48.19 seconds
CheckSparse                   WARNING   55.80 seconds
CheckSmatch                   WARNING   135.44 seconds
BuildKernel32                 PASS      41.15 seconds
TestRunnerSetup               PASS      532.88 seconds
TestRunner_l2cap-tester       PASS      20.47 seconds
TestRunner_iso-tester         FAIL      29.96 seconds
TestRunner_bnep-tester        PASS      7.28 seconds
TestRunner_mgmt-tester        PASS      154.03 seconds
TestRunner_rfcomm-tester      PASS      11.33 seconds
TestRunner_sco-tester         PASS      10.17 seconds
TestRunner_ioctl-tester       PASS      12.01 seconds
TestRunner_mesh-tester        PASS      9.08 seconds
TestRunner_smp-tester         PASS      10.73 seconds
TestRunner_userchan-tester    PASS      8.11 seconds
IncrementalBuild              PASS      39.36 seconds

Details
##############################
Test: CheckSparse - WARNING
Desc: Run sparse tool with linux kernel
Output:
net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 80, Passed: 54 (67.5%), Failed: 26, Not Run: 0

Failed Test Cases
ISO QoS 44_1_1 - Success                             Failed       0.268 seconds
ISO QoS 44_2_1 - Success                             Failed       0.272 seconds
ISO QoS 48_1_1 - Success                             Failed       0.268 seconds
ISO QoS 48_2_1 - Success                             Failed       0.256 seconds
ISO QoS 48_3_1 - Success                             Failed       0.276 seconds
ISO QoS 48_4_1 - Success                             Failed       0.264 seconds
ISO QoS 48_5_1 - Success                             Failed       0.264 seconds
ISO QoS 48_6_1 - Success                             Failed       0.272 seconds
ISO QoS 8_1_2 - Success                              Failed       0.260 seconds
ISO QoS 8_2_2 - Success                              Failed       0.280 seconds
ISO QoS 16_1_2 - Success                             Failed       0.256 seconds
ISO QoS 16_2_2 - Success                             Failed       0.252 seconds
ISO QoS 24_1_2 - Success                             Failed       0.256 seconds
ISO QoS 24_2_2 - Success                             Failed       0.260 seconds
ISO QoS 32_1_2 - Success                             Failed       0.256 seconds
ISO QoS 32_2_2 - Success                             Failed       0.260 seconds
ISO QoS 44_1_2 - Success                             Failed       0.256 seconds
ISO QoS 44_2_2 - Success                             Failed       0.268 seconds
ISO QoS 48_1_2 - Success                             Failed       0.252 seconds
ISO QoS 48_2_2 - Success                             Failed       0.276 seconds
ISO QoS 48_3_2 - Success                             Failed       0.268 seconds
ISO QoS 48_4_2 - Success                             Failed       0.252 seconds
ISO QoS 48_5_2 - Success                             Failed       0.256 seconds
ISO QoS 48_6_2 - Success                             Failed       0.268 seconds
ISO 48_2_1 Defer Send - Success                      Failed       0.268 seconds
ISO 48_2_1 Defer Receive - Success                   Failed       0.216 seconds


---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org June 26, 2023, 8:42 p.m. UTC | #2
Hello:

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

On Fri, 23 Jun 2023 14:24:39 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> The ISO Interval on CIS Established Event uses 1.25 ms slots:
> 
>     BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E
>     page 2304:
> 
> [...]

Here is the summary with links:
  - [v5] Bluetooth: hci_event: Fix parsing of CIS Established Event
    https://git.kernel.org/bluetooth/bluetooth-next/c/5f68122ac282

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index b1aefe4bb751..77cbf13037b3 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -6822,6 +6822,7 @@  static void hci_le_cis_estabilished_evt(struct hci_dev *hdev, void *data,
 {
 	struct hci_evt_le_cis_established *ev = data;
 	struct hci_conn *conn;
+	struct bt_iso_qos *qos;
 	bool pending = false;
 	u16 handle = __le16_to_cpu(ev->handle);
 
@@ -6846,21 +6847,39 @@  static void hci_le_cis_estabilished_evt(struct hci_dev *hdev, void *data,
 
 	pending = test_and_clear_bit(HCI_CONN_CREATE_CIS, &conn->flags);
 
-	if (conn->role == HCI_ROLE_SLAVE) {
-		__le32 interval;
+	qos = &conn->iso_qos;
 
-		memset(&interval, 0, sizeof(interval));
+	/* Convert ISO Interval (1.25 ms slots) to SDU Interval (us) */
+	qos->ucast.in.interval = le16_to_cpu(ev->interval) * 1250;
+	qos->ucast.out.interval = qos->ucast.in.interval;
 
-		memcpy(&interval, ev->c_latency, sizeof(ev->c_latency));
-		conn->iso_qos.ucast.in.interval = le32_to_cpu(interval);
-		memcpy(&interval, ev->p_latency, sizeof(ev->p_latency));
-		conn->iso_qos.ucast.out.interval = le32_to_cpu(interval);
-		conn->iso_qos.ucast.in.latency = le16_to_cpu(ev->interval);
-		conn->iso_qos.ucast.out.latency = le16_to_cpu(ev->interval);
-		conn->iso_qos.ucast.in.sdu = le16_to_cpu(ev->c_mtu);
-		conn->iso_qos.ucast.out.sdu = le16_to_cpu(ev->p_mtu);
-		conn->iso_qos.ucast.in.phy = ev->c_phy;
-		conn->iso_qos.ucast.out.phy = ev->p_phy;
+	switch (conn->role) {
+	case HCI_ROLE_SLAVE:
+		/* Convert Transport Latency (us) to Latency (msec) */
+		qos->ucast.in.latency =
+			DIV_ROUND_CLOSEST(get_unaligned_le24(ev->c_latency),
+					  1000);
+		qos->ucast.out.latency =
+			DIV_ROUND_CLOSEST(get_unaligned_le24(ev->p_latency),
+					  1000);
+		qos->ucast.in.sdu = le16_to_cpu(ev->c_mtu);
+		qos->ucast.out.sdu = le16_to_cpu(ev->p_mtu);
+		qos->ucast.in.phy = ev->c_phy;
+		qos->ucast.out.phy = ev->p_phy;
+		break;
+	case HCI_ROLE_MASTER:
+		/* Convert Transport Latency (us) to Latency (msec) */
+		qos->ucast.out.latency =
+			DIV_ROUND_CLOSEST(get_unaligned_le24(ev->c_latency),
+					  1000);
+		qos->ucast.in.latency =
+			DIV_ROUND_CLOSEST(get_unaligned_le24(ev->p_latency),
+					  1000);
+		qos->ucast.out.sdu = le16_to_cpu(ev->c_mtu);
+		qos->ucast.in.sdu = le16_to_cpu(ev->p_mtu);
+		qos->ucast.out.phy = ev->c_phy;
+		qos->ucast.in.phy = ev->p_phy;
+		break;
 	}
 
 	if (!ev->status) {