Skip to contentSkip to conversation

bap: reduce ISO sync timeout to 2s

PATCH Superseded Yang Li 3 participants 9 messages Jan 12 – Feb 20 Bluetooth drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 bap: reduce ISO sync timeout to 2s

The ISO sync timeout was previously set to 20 seconds, which is too long for PA sync. This could leave the userspace flow pending for an extended period of time.

---
 lib/bluetooth/bluetooth.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bluetooth/bluetooth.h +1 -1
index f9f22c3f7..572009e75 100644
@@ -152,7 +152,7 @@ struct bt_voice {
 #define BT_ISO_QOS_BIG_UNSET	0xff
 #define BT_ISO_QOS_BIS_UNSET	0xff
 
-#define BT_ISO_SYNC_TIMEOUT	0x07d0 /* 20 secs */
+#define BT_ISO_SYNC_TIMEOUT	0x00c8 /* 2 secs */
 
 /* For an ISO Broadcaster, this value is used to compute
  * the desired Periodic Advertising Interval as a function

---
base-commit: a94f994201a69a36753abda65cc51937de9cd3e3
change-id: 20260112-iso_sync_timeout-8e3ecf43d82e

Best regards,

Signature · 1 line
Yang Li <[email protected]>
#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=1041012

---Test result---

Test Summary:

CheckPatch                    PENDING   0.25 seconds
GitLint                       PENDING   0.22 seconds
BuildEll                      PASS      20.03 seconds
BluezMake                     PASS      634.54 seconds
MakeCheck                     PASS      19.21 seconds
MakeDistcheck                 PASS      241.94 seconds
CheckValgrind                 PASS      289.19 seconds
CheckSmatch                   PASS      351.19 seconds
bluezmakeextell               PASS      181.90 seconds
IncrementalBuild              PENDING   0.33 seconds
ScanBuild                     PASS      1022.63 seconds

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

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

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

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Yang Li

Hi Yang,

Quoted 6 lines · On Mon, Jan 12, 2026 at 1:42 AM Yang Li via B4 Relay…

From: Yang Li <[email protected]>

The ISO sync timeout was previously set to 20 seconds, which is too long for PA sync. This could leave the userspace flow pending for an extended period of time.

I think we used 20 seconds based on the connection timeout, that said I do wonder if 2 seconds is going to be enough given that the advertisement window can be wider than that, specially when SID needs to be resolved.

Quoted 29 lines
---
 lib/bluetooth/bluetooth.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bluetooth/bluetooth.h +1 -2
index f9f22c3f7..572009e75 100644
@@ -152,7 +152,7 @@ struct bt_voice {
 #define BT_ISO_QOS_BIG_UNSET   0xff
 #define BT_ISO_QOS_BIS_UNSET   0xff
 
-#define BT_ISO_SYNC_TIMEOUT    0x07d0 /* 20 secs */
+#define BT_ISO_SYNC_TIMEOUT    0x00c8 /* 2 secs */
 
 /* For an ISO Broadcaster, this value is used to compute
  * the desired Periodic Advertising Interval as a function
 
---

base-commit: a94f994201a69a36753abda65cc51937de9cd3e3
change-id: 20260112-iso_sync_timeout-8e3ecf43d82e

Best regards,
--
Yang Li <[email protected]>

Signature · 1 line
Luiz Augusto von Dentz
author
#3 lore raw

Hi Luiz,

Quoted 8 lines

[ EXTERNAL EMAIL ]

Hi Yang,

Quoted 2 lines · On Mon, Jan 12, 2026 at 1:42 AM Yang Li via B4 Relay…

From: Yang Li <[email protected]>

Quoted 7 lines
Quoted 3 lines

The ISO sync timeout was previously set to 20 seconds, which is too long for PA sync. This could leave the userspace flow pending for an extended period of time.

I think we used 20 seconds based on the connection timeout, that said I do wonder if 2 seconds is going to be enough given that the advertisement window can be wider than that, specially when SID needs to be resolved.

Yes, the Core Specification defines a PA sync timeout when no PA reports are received for six consecutive PA intervals. In our testing across a wide range of devices, a PA sync timeout of around 3.6 seconds works well.

This assumes a PA interval of 500 ms, which is already a relatively large value. Taking into account six intervals plus the time needed to receive extended advertising during scanning, this timeout should cover most practical use cases.

I understand this is ultimately an empirical choice, and I am happy to adjust it based on feedback. From your experience, do you have a recommended timeout value?

Quoted 33 lines
Quoted 24 lines
---
  lib/bluetooth/bluetooth.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
lib/bluetooth/bluetooth.h +1 -2
index f9f22c3f7..572009e75 100644
@@ -152,7 +152,7 @@ struct bt_voice {
  #define BT_ISO_QOS_BIG_UNSET   0xff
  #define BT_ISO_QOS_BIS_UNSET   0xff
 
-#define BT_ISO_SYNC_TIMEOUT    0x07d0 /* 20 secs */
+#define BT_ISO_SYNC_TIMEOUT    0x00c8 /* 2 secs */
 
  /* For an ISO Broadcaster, this value is used to compute
   * the desired Periodic Advertising Interval as a function
 
---

base-commit: a94f994201a69a36753abda65cc51937de9cd3e3
change-id: 20260112-iso_sync_timeout-8e3ecf43d82e

Quoted 6 lines

Best regards,
--
Yang Li <[email protected]>

--
Luiz Augusto von Dentz

#4 lore raw

Hi Yang,

Quoted 24 lines · Yang Li

Hi Luiz,

Quoted 8 lines

[ EXTERNAL EMAIL ]

Hi Yang,

Quoted 2 lines · On Mon, Jan 12, 2026 at 1:42 AM Yang Li via B4 Relay…

From: Yang Li <[email protected]>

Quoted 7 lines
Quoted 3 lines

The ISO sync timeout was previously set to 20 seconds, which is too long for PA sync. This could leave the userspace flow pending for an extended period of time.

I think we used 20 seconds based on the connection timeout, that said I do wonder if 2 seconds is going to be enough given that the advertisement window can be wider than that, specially when SID needs to be resolved.

Yes, the Core Specification defines a PA sync timeout when no PA reports are received for six consecutive PA intervals. In our testing across a wide range of devices, a PA sync timeout of around 3.6 seconds works well.

Quoted 8 lines

This assumes a PA interval of 500 ms, which is already a relatively large value. Taking into account six intervals plus the time needed to receive extended advertising during scanning, this timeout should cover most practical use cases.

I understand this is ultimately an empirical choice, and I am happy to adjust it based on feedback. From your experience, do you have a recommended timeout value?

Actually the code define some recommended values for us to scan:

TGAP(Sync_Scan_­Interval)

320 ms

Interval between the start of adjacent synchronization scan windows

Recommended value

TGAP(Sync_Scan_­Window)

91.25 ms

Duration of Synchronization scan window

Recommended value

TGAP(Sync_Train_­Duration)

30.72 s

Duration of synchronizability mode

Required value

That said the duration seem to be only mention in the context of the source, anyway perhaps we can use 6x320ms=1920ms(~2sec), this will make us resolve the broadcasters a lot faster but then we need to check in case we timeout we should try to rescan a few times.

Quoted 34 lines
Quoted 34 lines
Quoted 25 lines
---
  lib/bluetooth/bluetooth.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
lib/bluetooth/bluetooth.h +1 -2
index f9f22c3f7..572009e75 100644
@@ -152,7 +152,7 @@ struct bt_voice {
  #define BT_ISO_QOS_BIG_UNSET   0xff
  #define BT_ISO_QOS_BIS_UNSET   0xff
 
-#define BT_ISO_SYNC_TIMEOUT    0x07d0 /* 20 secs */
+#define BT_ISO_SYNC_TIMEOUT    0x00c8 /* 2 secs */
 
  /* For an ISO Broadcaster, this value is used to compute
   * the desired Periodic Advertising Interval as a function
 
---

base-commit: a94f994201a69a36753abda65cc51937de9cd3e3
change-id: 20260112-iso_sync_timeout-8e3ecf43d82e

Quoted 6 lines

Best regards,
--
Yang Li <[email protected]>

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz
author
#5 lore raw

Hi Luiz,

Quoted 57 lines

[ EXTERNAL EMAIL ]

Hi Yang,

Quoted 22 lines · Yang Li

Hi Luiz,

Quoted 8 lines

[ EXTERNAL EMAIL ]

Hi Yang,

Quoted 2 lines · On Mon, Jan 12, 2026 at 1:42 AM Yang Li via B4 Relay…

From: Yang Li <[email protected]>

Quoted 7 lines
Quoted 3 lines

The ISO sync timeout was previously set to 20 seconds, which is too long for PA sync. This could leave the userspace flow pending for an extended period of time.

I think we used 20 seconds based on the connection timeout, that said I do wonder if 2 seconds is going to be enough given that the advertisement window can be wider than that, specially when SID needs to be resolved.

Yes, the Core Specification defines a PA sync timeout when no PA reports are received for six consecutive PA intervals. In our testing across a wide range of devices, a PA sync timeout of around 3.6 seconds works well.

Quoted 8 lines

This assumes a PA interval of 500 ms, which is already a relatively large value. Taking into account six intervals plus the time needed to receive extended advertising during scanning, this timeout should cover most practical use cases.

I understand this is ultimately an empirical choice, and I am happy to adjust it based on feedback. From your experience, do you have a recommended timeout value?

Actually the code define some recommended values for us to scan:

TGAP(Sync_Scan_­Interval)

320 ms

Interval between the start of adjacent synchronization scan windows

Recommended value

TGAP(Sync_Scan_­Window)

91.25 ms

Duration of Synchronization scan window

Recommended value

TGAP(Sync_Train_­Duration)

30.72 s

Quoted 8 lines

Duration of synchronizability mode

Required value

That said the duration seem to be only mention in the context of the source, anyway perhaps we can use 6x320ms=1920ms(~2sec), this will make us resolve the broadcasters a lot faster but then we need to check in case we timeout we should try to rescan a few times.

I understand.

In our system, the application layer has a timer to monitor whether the PA sync process times out. If it does, it will re-execute the scanning and PA sync actions.

Quoted 35 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
---
   lib/bluetooth/bluetooth.h | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
lib/bluetooth/bluetooth.h +1 -2
index f9f22c3f7..572009e75 100644
@@ -152,7 +152,7 @@ struct bt_voice {
   #define BT_ISO_QOS_BIG_UNSET   0xff
   #define BT_ISO_QOS_BIS_UNSET   0xff
 
-#define BT_ISO_SYNC_TIMEOUT    0x07d0 /* 20 secs */
+#define BT_ISO_SYNC_TIMEOUT    0x00c8 /* 2 secs */
 
   /* For an ISO Broadcaster, this value is used to compute
    * the desired Periodic Advertising Interval as a function
 
---

base-commit: a94f994201a69a36753abda65cc51937de9cd3e3
change-id: 20260112-iso_sync_timeout-8e3ecf43d82e

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

Best regards,
--
Yang Li <[email protected]>

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

#6 lore raw

Hi Yang,

Quoted 71 lines · Yang Li

Hi Luiz,

Quoted 57 lines

[ EXTERNAL EMAIL ]

Hi Yang,

Quoted 22 lines · Yang Li

Hi Luiz,

Quoted 8 lines

[ EXTERNAL EMAIL ]

Hi Yang,

Quoted 2 lines · On Mon, Jan 12, 2026 at 1:42 AM Yang Li via B4 Relay…

From: Yang Li <[email protected]>

Quoted 7 lines
Quoted 3 lines

The ISO sync timeout was previously set to 20 seconds, which is too long for PA sync. This could leave the userspace flow pending for an extended period of time.

I think we used 20 seconds based on the connection timeout, that said I do wonder if 2 seconds is going to be enough given that the advertisement window can be wider than that, specially when SID needs to be resolved.

Yes, the Core Specification defines a PA sync timeout when no PA reports are received for six consecutive PA intervals. In our testing across a wide range of devices, a PA sync timeout of around 3.6 seconds works well.

Quoted 8 lines

This assumes a PA interval of 500 ms, which is already a relatively large value. Taking into account six intervals plus the time needed to receive extended advertising during scanning, this timeout should cover most practical use cases.

I understand this is ultimately an empirical choice, and I am happy to adjust it based on feedback. From your experience, do you have a recommended timeout value?

Actually the code define some recommended values for us to scan:

TGAP(Sync_Scan_­Interval)

320 ms

Interval between the start of adjacent synchronization scan windows

Recommended value

TGAP(Sync_Scan_­Window)

91.25 ms

Duration of Synchronization scan window

Recommended value

TGAP(Sync_Train_­Duration)

30.72 s

Quoted 8 lines

Duration of synchronizability mode

Required value

That said the duration seem to be only mention in the context of the source, anyway perhaps we can use 6x320ms=1920ms(~2sec), this will make us resolve the broadcasters a lot faster but then we need to check in case we timeout we should try to rescan a few times.

Quoted 5 lines

I understand.

In our system, the application layer has a timer to monitor whether the PA sync process times out. If it does, it will re-execute the scanning and PA sync actions.

You mean in bap plugin? Or something other than bap plugin short PA sync that enumerates broadcasters? Anyway, if your system is using something else that is besides the point, the thing is that PA short sync shall be able to recover if the PA Sync times out.

Quoted 35 lines
Quoted 35 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
---
   lib/bluetooth/bluetooth.h | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
lib/bluetooth/bluetooth.h +1 -2
index f9f22c3f7..572009e75 100644
@@ -152,7 +152,7 @@ struct bt_voice {
   #define BT_ISO_QOS_BIG_UNSET   0xff
   #define BT_ISO_QOS_BIS_UNSET   0xff
 
-#define BT_ISO_SYNC_TIMEOUT    0x07d0 /* 20 secs */
+#define BT_ISO_SYNC_TIMEOUT    0x00c8 /* 2 secs */
 
   /* For an ISO Broadcaster, this value is used to compute
    * the desired Periodic Advertising Interval as a function
 
---

base-commit: a94f994201a69a36753abda65cc51937de9cd3e3
change-id: 20260112-iso_sync_timeout-8e3ecf43d82e

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

Best regards,
--
Yang Li <[email protected]>

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz
author
#7 lore raw

Hi Luiz,

Quoted 75 lines

[ EXTERNAL EMAIL ]

Hi Yang,

Quoted 70 lines · Yang Li

Hi Luiz,

Quoted 56 lines

[ EXTERNAL EMAIL ]

Hi Yang,

Quoted 21 lines · Yang Li

Hi Luiz,

Quoted 8 lines

[ EXTERNAL EMAIL ]

Hi Yang,

Quoted 2 lines · On Mon, Jan 12, 2026 at 1:42 AM Yang Li via B4 Relay…

From: Yang Li <[email protected]>

Quoted 7 lines
Quoted 3 lines

The ISO sync timeout was previously set to 20 seconds, which is too long for PA sync. This could leave the userspace flow pending for an extended period of time.

I think we used 20 seconds based on the connection timeout, that said I do wonder if 2 seconds is going to be enough given that the advertisement window can be wider than that, specially when SID needs to be resolved.

Yes, the Core Specification defines a PA sync timeout when no PA reports are received for six consecutive PA intervals. In our testing across a wide range of devices, a PA sync timeout of around 3.6 seconds works well.

Quoted 8 lines

This assumes a PA interval of 500 ms, which is already a relatively large value. Taking into account six intervals plus the time needed to receive extended advertising during scanning, this timeout should cover most practical use cases.

I understand this is ultimately an empirical choice, and I am happy to adjust it based on feedback. From your experience, do you have a recommended timeout value?

Actually the code define some recommended values for us to scan:

TGAP(Sync_Scan_­Interval)

320 ms

Interval between the start of adjacent synchronization scan windows

Recommended value

TGAP(Sync_Scan_­Window)

91.25 ms

Duration of Synchronization scan window

Recommended value

TGAP(Sync_Train_­Duration)

30.72 s

Quoted 8 lines

Duration of synchronizability mode

Required value

That said the duration seem to be only mention in the context of the source, anyway perhaps we can use 6x320ms=1920ms(~2sec), this will make us resolve the broadcasters a lot faster but then we need to check in case we timeout we should try to rescan a few times.

I understand.

Quoted 7 lines
Quoted 3 lines

In our system, the application layer has a timer to monitor whether the PA sync process times out. If it does, it will re-execute the scanning and PA sync actions.

You mean in bap plugin? Or something other than bap plugin short PA sync that enumerates broadcasters? Anyway, if your system is using something else that is besides the point, the thing is that PA short sync shall be able to recover if the PA Sync times out.

Yes, the short PA sync is implemented in the bap plugin.

The application layer will initiate an LE Scan with a timeout of 3 seconds. Once the PA sync is successful, it will create a transport and notify the application layer via the DBus signal. If the PA sync fails, it will rescan and trigger the PA sync again in the next LE Scan cycle.

Quoted 38 lines
Quoted 32 lines
Quoted 32 lines
Quoted 31 lines
Quoted 31 lines
Quoted 23 lines
---
    lib/bluetooth/bluetooth.h | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)
lib/bluetooth/bluetooth.h +1 -2
index f9f22c3f7..572009e75 100644
@@ -152,7 +152,7 @@ struct bt_voice {
    #define BT_ISO_QOS_BIG_UNSET   0xff
    #define BT_ISO_QOS_BIS_UNSET   0xff
 
-#define BT_ISO_SYNC_TIMEOUT    0x07d0 /* 20 secs */
+#define BT_ISO_SYNC_TIMEOUT    0x00c8 /* 2 secs */
 
    /* For an ISO Broadcaster, this value is used to compute
     * the desired Periodic Advertising Interval as a function
 
---

base-commit: a94f994201a69a36753abda65cc51937de9cd3e3
change-id: 20260112-iso_sync_timeout-8e3ecf43d82e

Quoted 6 lines

Best regards,
--
Yang Li <[email protected]>

--
Luiz Augusto von Dentz

Quoted 2 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

#8 lore raw

Hi Yang,

Quoted 88 lines · Yang Li

Hi Luiz,

Quoted 75 lines

[ EXTERNAL EMAIL ]

Hi Yang,

Quoted 70 lines · Yang Li

Hi Luiz,

Quoted 56 lines

[ EXTERNAL EMAIL ]

Hi Yang,

Quoted 21 lines · Yang Li

Hi Luiz,

Quoted 8 lines

[ EXTERNAL EMAIL ]

Hi Yang,

Quoted 2 lines · On Mon, Jan 12, 2026 at 1:42 AM Yang Li via B4 Relay…

From: Yang Li <[email protected]>

Quoted 7 lines
Quoted 3 lines

The ISO sync timeout was previously set to 20 seconds, which is too long for PA sync. This could leave the userspace flow pending for an extended period of time.

I think we used 20 seconds based on the connection timeout, that said I do wonder if 2 seconds is going to be enough given that the advertisement window can be wider than that, specially when SID needs to be resolved.

Yes, the Core Specification defines a PA sync timeout when no PA reports are received for six consecutive PA intervals. In our testing across a wide range of devices, a PA sync timeout of around 3.6 seconds works well.

Quoted 8 lines

This assumes a PA interval of 500 ms, which is already a relatively large value. Taking into account six intervals plus the time needed to receive extended advertising during scanning, this timeout should cover most practical use cases.

I understand this is ultimately an empirical choice, and I am happy to adjust it based on feedback. From your experience, do you have a recommended timeout value?

Actually the code define some recommended values for us to scan:

TGAP(Sync_Scan_­Interval)

320 ms

Interval between the start of adjacent synchronization scan windows

Recommended value

TGAP(Sync_Scan_­Window)

91.25 ms

Duration of Synchronization scan window

Recommended value

TGAP(Sync_Train_­Duration)

30.72 s

Quoted 8 lines

Duration of synchronizability mode

Required value

That said the duration seem to be only mention in the context of the source, anyway perhaps we can use 6x320ms=1920ms(~2sec), this will make us resolve the broadcasters a lot faster but then we need to check in case we timeout we should try to rescan a few times.

I understand.

Quoted 7 lines
Quoted 3 lines

In our system, the application layer has a timer to monitor whether the PA sync process times out. If it does, it will re-execute the scanning and PA sync actions.

You mean in bap plugin? Or something other than bap plugin short PA sync that enumerates broadcasters? Anyway, if your system is using something else that is besides the point, the thing is that PA short sync shall be able to recover if the PA Sync times out.

Quoted 6 lines

Yes, the short PA sync is implemented in the bap plugin.

The application layer will initiate an LE Scan with a timeout of 3 seconds. Once the PA sync is successful, it will create a transport and notify the application layer via the DBus signal. If the PA sync fails, it will rescan and trigger the PA sync again in the next LE Scan cycle.

Looks like we never reached a conclusion here, or you are still with the opinion that 2 seconds timeout is the way to go?

Quoted 38 lines
Quoted 38 lines
Quoted 32 lines
Quoted 32 lines
Quoted 31 lines
Quoted 31 lines
Quoted 23 lines
---
    lib/bluetooth/bluetooth.h | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)
lib/bluetooth/bluetooth.h +1 -2
index f9f22c3f7..572009e75 100644
@@ -152,7 +152,7 @@ struct bt_voice {
    #define BT_ISO_QOS_BIG_UNSET   0xff
    #define BT_ISO_QOS_BIS_UNSET   0xff
 
-#define BT_ISO_SYNC_TIMEOUT    0x07d0 /* 20 secs */
+#define BT_ISO_SYNC_TIMEOUT    0x00c8 /* 2 secs */
 
    /* For an ISO Broadcaster, this value is used to compute
     * the desired Periodic Advertising Interval as a function
 
---

base-commit: a94f994201a69a36753abda65cc51937de9cd3e3
change-id: 20260112-iso_sync_timeout-8e3ecf43d82e

Quoted 6 lines

Best regards,
--
Yang Li <[email protected]>

--
Luiz Augusto von Dentz

Quoted 2 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz