diff mbox series

[BlueZ,v1] isotest: Fix ISO send data rate

Message ID 20240606162903.620906-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit 272d8e8c959908dbe9e4b6b301ebbd3e8e5b53a4
Headers show
Series [BlueZ,v1] isotest: Fix ISO send data rate | 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/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Luiz Augusto von Dentz June 6, 2024, 4:29 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

We are sending data to controller at wrong average rate not equal to
1 packet / SDU interval, if Transport_Latency is not an integer multiple
of SDU_Interval.  The calculation currently may also give zero, so no
data gets sent.
---
 tools/isotest.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

bluez.test.bot@gmail.com June 6, 2024, 6:06 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=859627

---Test result---

Test Summary:
CheckPatch                    PASS      0.48 seconds
GitLint                       PASS      0.34 seconds
BuildEll                      PASS      24.70 seconds
BluezMake                     PASS      1778.70 seconds
MakeCheck                     PASS      13.34 seconds
MakeDistcheck                 PASS      181.33 seconds
CheckValgrind                 PASS      255.58 seconds
CheckSmatch                   PASS      355.87 seconds
bluezmakeextell               PASS      120.02 seconds
IncrementalBuild              PASS      1481.70 seconds
ScanBuild                     PASS      1004.49 seconds



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org June 7, 2024, 3:20 p.m. UTC | #2
Hello:

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

On Thu,  6 Jun 2024 12:29:03 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> We are sending data to controller at wrong average rate not equal to
> 1 packet / SDU interval, if Transport_Latency is not an integer multiple
> of SDU_Interval.  The calculation currently may also give zero, so no
> data gets sent.
> 
> [...]

Here is the summary with links:
  - [BlueZ,v1] isotest: Fix ISO send data rate
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=272d8e8c9599

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/isotest.c b/tools/isotest.c
index 68154b19caa4..c1bb6abd29aa 100644
--- a/tools/isotest.c
+++ b/tools/isotest.c
@@ -46,6 +46,7 @@ 
 #define NSEC_USEC(_t) (_t / 1000L)
 #define SEC_USEC(_t)  (_t  * 1000000L)
 #define TS_USEC(_ts)  (SEC_USEC((_ts)->tv_sec) + NSEC_USEC((_ts)->tv_nsec))
+#define ROUND_CLOSEST(_x, _y) (((_x) + (_y / 2)) / (_y))
 
 #define DEFAULT_BIG_ID 0x01
 #define DEFAULT_BIS_ID 0x01
@@ -834,7 +835,9 @@  static void do_send(int sk, int fd, char *peer, bool repeat)
 	}
 
 	/* num of packets = latency (ms) / interval (us) */
-	num = (out->latency * 1000 / out->interval);
+	num = ROUND_CLOSEST(out->latency * 1000, out->interval);
+	if (!num)
+		num = 1;
 
 	syslog(LOG_INFO, "Number of packets: %d", num);
 
@@ -843,8 +846,7 @@  static void do_send(int sk, int fd, char *peer, bool repeat)
 		 * latency:
 		 * jitter buffer = 2 * (SDU * subevents)
 		 */
-		sndbuf = 2 * ((out->latency * 1000 / out->interval) *
-							out->sdu);
+		sndbuf = 2 * (num * out->sdu);
 
 	len = sizeof(sndbuf);
 	if (setsockopt(sk, SOL_SOCKET, SO_SNDBUF, &sndbuf, len) < 0) {