Skip to contentSkip to conversation

btdev: Fix CIS Established Event parameters

PATCH Applied Luiz Augusto von Dentz 3 participants 4 messages Jun 23, 2023 – Jun 26, 2023 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/2 btdev: Fix CIS Established Event parameters

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

ISO Interval and Transport Latency were inverted.

---
 emulator/btdev.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
emulator/btdev.c +12 -6
index d5450190c38e..637f0bb98057 100644
@@ -5940,8 +5940,14 @@ static int cmd_create_cis(struct btdev *dev, const void *data, uint8_t len)
 	return 0;
 }
 
-static uint32_t le_cis_transport_latecy(uint8_t ft, uint8_t iso_interval,
-						uint8_t sdu_interval[3])
+static uint8_t le_cis_interval(uint8_t sdu_interval[3])
+{
+	/* ISO Interval (slots of 1.25 ms) = SDU_Interval (us) */
+	return get_le24(sdu_interval) / 1250;
+}
+
+static uint32_t le_cis_latecy(uint8_t ft, uint8_t iso_interval,
+					uint8_t sdu_interval[3])
 {
 	uint32_t latency;
 	uint32_t interval = get_le24(sdu_interval);
@@ -5949,7 +5955,7 @@ static uint32_t le_cis_transport_latecy(uint8_t ft, uint8_t iso_interval,
 	/* Transport_Latency = FT × ISO_Interval - SDU_Interval */
 	latency = ft * (iso_interval * 1250) - interval;
 
-	return latency <= interval ? latency : interval;
+	return latency >= interval ? latency : interval;
 }
 
 static void le_cis_estabilished(struct btdev *dev, struct btdev_conn *conn,
@@ -5983,7 +5989,7 @@ static void le_cis_estabilished(struct btdev *dev, struct btdev_conn *conn,
 		evt.p_ft = 0x02;
 		evt.c_mtu = le_cig->cis[cis_idx].c_sdu;
 		evt.p_mtu = le_cig->cis[cis_idx].p_sdu;
-		evt.interval = (le_cig->params.c_latency + 0.625) / 1.25;
+		evt.interval = le_cis_interval(le_cig->params.c_interval);
 
 		/* BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 6, Part G
 		 * page 3050:
@@ -5993,9 +5999,9 @@ static void le_cis_estabilished(struct btdev *dev, struct btdev_conn *conn,
 		 * Transport_Latency_P_To_C = CIG_Sync_Delay + FT_P_To_C ×
 		 * ISO_Interval - SDU_Interval_P_To_C
 		 */
-		put_le24(le_cis_transport_latecy(evt.c_ft, evt.interval,
+		put_le24(le_cis_latecy(evt.c_ft, evt.interval,
 				le_cig->params.c_interval), evt.c_latency);
-		put_le24(le_cis_transport_latecy(evt.p_ft, evt.interval,
+		put_le24(le_cis_latecy(evt.p_ft, evt.interval,
 				le_cig->params.p_interval), evt.p_latency);
 	}
 
Signature · 1 line
2.40.1
author maintainer
#1 lore raw

PATCH 2/2 iso-tester: Fix checks of latency and interval

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

Due to rounding of latency, BAP uses msec while HCI uses slots of 1.25 ms, values may not return an exact match which is fine since the BAP QoS suggests they are the maximum latency/interval so values bellow that shall be considered a match.

---
 tools/iso-tester.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/iso-tester.c +4 -4
index d6c79db9072b..bbd5a47f6197 100644
@@ -1480,14 +1480,14 @@ static int connect_iso_sock(struct test_data *data, uint8_t num, int sk)
 static bool check_io_qos(const struct bt_iso_io_qos *io1,
 				const struct bt_iso_io_qos *io2)
 {
-	if (io1->interval && io2->interval && io1->interval != io2->interval) {
-		tester_warn("Unexpected IO interval: %u != %u",
+	if (io1->interval && io2->interval && io1->interval > io2->interval) {
+		tester_warn("Unexpected IO interval: %u > %u",
 				io1->interval, io2->interval);
 		return false;
 	}
 
-	if (io1->latency && io2->latency && io1->latency != io2->latency) {
-		tester_warn("Unexpected IO latency: %u != %u",
+	if (io1->latency && io2->latency && io1->latency > io2->latency) {
+		tester_warn("Unexpected IO latency: %u > %u",
 				io1->latency, io2->latency);
 		return false;
 	}
Signature · 1 line
2.40.1
#2 lore raw
In reply to Luiz Augusto von Dentz

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

---Test result---

Test Summary:

CheckPatch                    PASS      0.74 seconds
GitLint                       PASS      0.51 seconds
BuildEll                      PASS      26.27 seconds
BluezMake                     PASS      752.96 seconds
MakeCheck                     PASS      11.68 seconds
MakeDistcheck                 PASS      152.27 seconds
CheckValgrind                 PASS      245.87 seconds
CheckSmatch                   WARNING   330.57 seconds
bluezmakeextell               PASS      100.03 seconds
IncrementalBuild              PASS      1279.32 seconds
ScanBuild                     PASS      978.92 seconds

Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
emulator/btdev.c:417:29: warning: Variable length array is used.

---
Regards,
Linux Bluetooth

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

Hello:

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

Quoted 6 lines · On Fri, 23 Jun 2023 14:24:29 -0700 you wrote:

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

ISO Interval and Transport Latency were inverted.

---
 emulator/btdev.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

Here is the summary with links:
- [BlueZ,1/2] btdev: Fix CIS Established Event parameters

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=3f018d52d4ac
  - [BlueZ,2/2] iso-tester: Fix checks of latency and interval
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=1d6456a2537d

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html