Bluetooth: hci_sync: fix mesh adv timeout units

Mesh adv instance timeout and duration are in milliseconds, see
mesh_send_sync, hci_add_adv_instance.  hci_schedule_adv_instance_sync()
and hci_enable_ext_advertising_sync() ignore this, and scale the timeout
wrong.

Fix for mesh instances by using msecs_to_jiffies() in
hci_schedule_adv_instance_sync and fixing the scaling in
hci_enable_ext_advertising_sync.

Fixes BlueZ "Mesh - Send cancel" test failures.

Fixes: b338d91703 ("Bluetooth: Implement support for Mesh")
Assisted-by: opencode:qwen3.8-flash-next sashiko
Signed-off-by: Pauli Virtanen <pav@iki.fi>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Pauli Virtanen 2026-10-05 21:13:54 +03:00 committed by Luiz Augusto von Dentz
parent cfa67a1dbf
commit 8a8d51eeed

View File

@ -1672,7 +1672,8 @@ int hci_enable_ext_advertising_sync(struct hci_dev *hdev, u8 instance)
* scheduling it.
*/
if (adv && adv->timeout) {
u16 duration = adv->timeout * MSEC_PER_SEC;
u16 duration = adv->mesh ? adv->timeout :
adv->timeout * MSEC_PER_SEC;
/* Time = N * 10 ms */
set->duration = cpu_to_le16(duration / 10);
@ -2103,7 +2104,8 @@ int hci_schedule_adv_instance_sync(struct hci_dev *hdev, u8 instance,
hdev->adv_instance_timeout = timeout;
queue_delayed_work(hdev->req_workqueue,
&hdev->adv_instance_expire,
secs_to_jiffies(timeout));
adv->mesh ? msecs_to_jiffies(timeout) :
secs_to_jiffies(timeout));
}
/* If we're just re-scheduling the same instance again then do not