diff mbox series

[BlueZ,1/2] btdev: Fix CIS Established Event parameters

Message ID 20230623212430.1702254-1-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,1/2] btdev: Fix CIS Established Event parameters | expand

Commit Message

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

ISO Interval and Transport Latency were inverted.
---
 emulator/btdev.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

Comments

bluez.test.bot@gmail.com June 23, 2023, 10:42 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=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
patchwork-bot+bluetooth@kernel.org June 26, 2023, 8:50 p.m. UTC | #2
Hello:

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

On Fri, 23 Jun 2023 14:24:29 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> 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!
diff mbox series

Patch

diff --git a/emulator/btdev.c b/emulator/btdev.c
index d5450190c38e..637f0bb98057 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -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);
 	}