Bluetooth: hci_sync: Fix invalid Supervision_Timeout in LE Set Default Rate
Subsystems (2)
Luiz Augusto von Dentz
maintainerPATCH 1/1 Bluetooth: hci_sync: Fix invalid Supervision_Timeout in LE Set Default Rate
From: Luiz Augusto von Dentz <[email protected]>
The LE Set Default Rate Parameters command is rejected with Invalid HCI Command Parameters (0x12) because the Supervision_Timeout of 120 ms is exactly the minimum recommended by HOGP v1.2:
Greater than or equal to (1 + Peripheral Latency) x Subrate max x Connection Interval max x 2
But the Core spec treats the equality as invalid:
BLUETOOTH CORE SPECIFICATION Version 6.3 | Vol 4, Part E 7.8.158. LE Set Default Rate Parameters command
If Connection_Interval_Max x Subrate_Max x (Max_Latency + 1) is greater than or equal to Supervision_Timeout x 40, the Controller shall return the error code Invalid HCI Command Parameters (0x12).
With the current values 0x78 x 4 x 1 = 480 >= 0x0c x 40 = 480.
Fix this by using 2 s as the default Supervision_Timeout, which is 10x lower than the 20 s used for non-SCI connections while still well above the minimum required, and make sure it remains above the minimum in case interval_max is raised to match the controller's minimum supported connection interval.
--- net/bluetooth/hci_sync.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)
net/bluetooth/hci_sync.c +27 -3
@@ -4828,6 +4828,9 @@ static int hci_le_set_def_rate_sync(struct hci_dev *hdev)struct hci_cp_le_set_def_rate cp;u16 interval_min =0x000a ;/* 1.25 ms */ u16 interval_max =0x0078 ;/* 15 ms */ +u16 subrate_max =0x0004 ; +u16 max_latency =0x0000 ; +u32 supv_timeout;if (!le_sci_capable (hdev))return 0 ;
@@ -4852,10 +4855,31 @@ static int hci_le_set_def_rate_sync(struct hci_dev *hdev) cp.interval_min =cpu_to_le16 (interval_min); cp.interval_max =cpu_to_le16 (interval_max); cp.subrate_min =cpu_to_le16 (0x0001 ); - cp.subrate_max =cpu_to_le16 (0x0004 ); - cp.max_latency =cpu_to_le16 (0x0000 ); + cp.subrate_max =cpu_to_le16 (subrate_max); + cp.max_latency =cpu_to_le16 (max_latency); cp.cont_num =cpu_to_le16 (0x0001 ); - cp.supv_timeout =cpu_to_le16 (0x000c );/* 120 ms */ + +/* HOGP v1.2 recommends a Supervision_Timeout greater than or equal to +* (1 + Max_Latency) x Subrate_Max x Connection_Interval_Max x 2, but +* the Core spec treats the equality as invalid: +* +* BLUETOOTH CORE SPECIFICATION Version 6.3 | Vol 4, Part E +* 7.8.158. LE Set Default Rate Parameters command +* +* If Connection_Interval_Max x Subrate_Max x (Max_Latency + 1) is +* greater than or equal to Supervision_Timeout x 40, the Controller +* shall return the error code Invalid HCI Command Parameters (0x12). +* +* So default to 2 s, 10x lower than the 20 s used for non-SCI +* connections while still well above the minimum required, but make +* sure it stays strictly above the minimum in case interval_max has +* been raised. +*/ + supv_timeout = (u32 )interval_max * subrate_max * (max_latency +1 ); + supv_timeout = supv_timeout /40 +1 ; + supv_timeout =clamp_t (u32,max_t (u32, supv_timeout,0x00c8 ), +0x000a ,0x0c80 ); + cp.supv_timeout =cpu_to_le16 (supv_timeout);/* The connection event length recommended in requests by a Peripheral * uses units of 125 us with a valid range of 0x0001 to 0x7CFF
Signature · 1 line
2.56.0
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/series/1186606/
---Test result---
Test Summary:
CheckPatch PASS 0.81 seconds VerifyFixes PASS 0.12 seconds VerifySignedoff PASS 0.12 seconds GitLint PASS 0.35 seconds SubjectPrefix PASS 0.12 seconds BuildKernel PASS 30.60 seconds CheckAllWarning PASS 34.32 seconds CheckSparse PASS 38.07 seconds BuildKernel32 PASS 30.33 seconds CheckKernelLLVM PASS 36.30 seconds TestRunnerSetup PASS 716.05 seconds TestRunner_l2cap-tester PASS 12.74 seconds TestRunner_iso-tester PASS 10.77 seconds TestRunner_bnep-tester PASS 3.11 seconds TestRunner_mgmt-tester PASS 87.72 seconds TestRunner_rfcomm-tester PASS 4.48 seconds TestRunner_sco-tester PASS 5.65 seconds TestRunner_ioctl-tester PASS 4.70 seconds TestRunner_mesh-tester PASS 5.55 seconds TestRunner_smp-tester PASS 4.32 seconds TestRunner_userchan-tester PASS 3.21 seconds TestRunner_6lowpan-tester PASS 4.41 seconds IncrementalBuild PASS 28.88 seconds
https://github.com/bluez/bluetooth-next/pull/949
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 10 lines · On Thu, 15 Oct 2026 11:39:09 -0400 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
The LE Set Default Rate Parameters command is rejected with Invalid HCI Command Parameters (
0x12) because theSupervision_Timeoutof 120 ms is exactly the minimum recommended by HOGP v1.2:Greater than or equal to (1 + Peripheral Latency) x Subrate max x Connection Interval max x 2
[...]
Here is the summary with links:
- [v1] Bluetooth: hci_sync: Fix invalid Supervision_Timeout in LE Set Default Rate
https://git.kernel.org/bluetooth/bluetooth-next/c/76e76945eb79
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html