* [PATCH 0/2] Bluetooth: hci_sync: fix mesh adv timeout units
@ 2026-10-05 18:13 Pauli Virtanen
2026-10-05 18:13 ` [PATCH 1/2] " Pauli Virtanen
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Pauli Virtanen @ 2026-10-05 18:13 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Pauli Virtanen
For mesh advertisements = adv_info::mesh nonzero, the time units are
milliseconds instead of seconds like normally.
This was forgotten in hci_schedule_adv_instance_sync() and
hci_enable_ext_advertising_sync() which scheduled 1000x too large
timeouts.
Fix that. This is the cause for the mesh-tester "Mesh - Send cancel"
failures.
Since the timeout units depend on the adv type, make
hdev->adv_instance_timeout to just bool indicating if timeout is active
or not.
Triaged via LLM. I wrote the patches.
Assisted-by: opencode:qwen3.8-flash-next
Pauli Virtanen (2):
Bluetooth: hci_sync: fix mesh adv timeout units
Bluetooth: make hdev->adv_instance_timeout a boolean
include/net/bluetooth/hci_core.h | 2 +-
net/bluetooth/hci_core.c | 6 +++---
net/bluetooth/hci_sync.c | 14 ++++++++------
net/bluetooth/mgmt.c | 2 +-
4 files changed, 13 insertions(+), 11 deletions(-)
--
2.55.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] Bluetooth: hci_sync: fix mesh adv timeout units
2026-10-05 18:13 [PATCH 0/2] Bluetooth: hci_sync: fix mesh adv timeout units Pauli Virtanen
@ 2026-10-05 18:13 ` Pauli Virtanen
2026-10-06 2:18 ` bluez.test.bot
2026-10-05 18:13 ` [PATCH 2/2] Bluetooth: make hdev->adv_instance_timeout a boolean Pauli Virtanen
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Pauli Virtanen @ 2026-10-05 18:13 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Pauli Virtanen
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: b338d91703fa ("Bluetooth: Implement support for Mesh")
Assisted-by: opencode:qwen3.8-flash-next sashiko
Signed-off-by: Pauli Virtanen <pav@iki.fi>
---
net/bluetooth/hci_sync.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 1fe11d3ef1aa..94dcbbc767e5 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -1670,7 +1670,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);
@@ -2101,7 +2102,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
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] Bluetooth: make hdev->adv_instance_timeout a boolean
2026-10-05 18:13 [PATCH 0/2] Bluetooth: hci_sync: fix mesh adv timeout units Pauli Virtanen
2026-10-05 18:13 ` [PATCH 1/2] " Pauli Virtanen
@ 2026-10-05 18:13 ` Pauli Virtanen
2026-10-06 14:30 ` [PATCH 0/2] Bluetooth: hci_sync: fix mesh adv timeout units patchwork-bot+bluetooth
2026-10-06 15:00 ` patchwork-bot+bluetooth
3 siblings, 0 replies; 6+ messages in thread
From: Pauli Virtanen @ 2026-10-05 18:13 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Pauli Virtanen
Mesh uses millisecond time units for advertisements instead of seconds
as normally. These values go to hdev->adv_instance_timeout, which then
has mixed units. hdev->adv_instance_timeout is however only used as a
true/false flag.
Make hdev->adv_instance_timeout boolean flag, to avoid possible future
problems with its mixed-units values.
Signed-off-by: Pauli Virtanen <pav@iki.fi>
---
include/net/bluetooth/hci_core.h | 2 +-
net/bluetooth/hci_core.c | 6 +++---
net/bluetooth/hci_sync.c | 8 ++++----
net/bluetooth/mgmt.c | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index f631d9484a0b..aa04dec45153 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -601,7 +601,7 @@ struct hci_dev {
struct list_head adv_instances;
unsigned int adv_instance_cnt;
__u8 cur_adv_instance;
- __u16 adv_instance_timeout;
+ bool adv_instance_timeout;
struct delayed_work adv_instance_expire;
struct idr adv_monitors_idr;
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 05d1ca25f44f..416803d8d604 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1617,7 +1617,7 @@ int hci_remove_adv_instance(struct hci_dev *hdev, u8 instance)
if (hdev->cur_adv_instance == instance) {
if (hdev->adv_instance_timeout) {
cancel_delayed_work(&hdev->adv_instance_expire);
- hdev->adv_instance_timeout = 0;
+ hdev->adv_instance_timeout = false;
}
hdev->cur_adv_instance = 0x00;
}
@@ -1647,7 +1647,7 @@ void hci_adv_instances_clear(struct hci_dev *hdev)
if (hdev->adv_instance_timeout) {
disable_delayed_work(&hdev->adv_instance_expire);
- hdev->adv_instance_timeout = 0;
+ hdev->adv_instance_timeout = false;
}
list_for_each_entry_safe(adv_instance, n, &hdev->adv_instances, list) {
@@ -2437,7 +2437,7 @@ struct hci_dev *hci_alloc_dev_priv(int sizeof_priv)
hdev->adv_tx_power = HCI_TX_POWER_INVALID;
hdev->adv_instance_cnt = 0;
hdev->cur_adv_instance = 0x00;
- hdev->adv_instance_timeout = 0;
+ hdev->adv_instance_timeout = false;
hdev->advmon_allowlist_duration = 300;
hdev->advmon_no_filter_duration = 500;
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 94dcbbc767e5..7a07aba43262 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -468,7 +468,7 @@ static void reenable_adv(struct work_struct *work)
static void cancel_adv_timeout(struct hci_dev *hdev)
{
if (hdev->adv_instance_timeout) {
- hdev->adv_instance_timeout = 0;
+ hdev->adv_instance_timeout = false;
cancel_delayed_work(&hdev->adv_instance_expire);
}
}
@@ -568,7 +568,7 @@ static void adv_timeout_expire(struct work_struct *work)
hci_dev_lock(hdev);
- hdev->adv_instance_timeout = 0;
+ hdev->adv_instance_timeout = false;
if (hdev->cur_adv_instance == 0x00)
goto unlock;
@@ -2099,7 +2099,7 @@ int hci_schedule_adv_instance_sync(struct hci_dev *hdev, u8 instance,
/* Only use work for scheduling instances with legacy advertising */
if (!ext_adv_capable(hdev)) {
- hdev->adv_instance_timeout = timeout;
+ hdev->adv_instance_timeout = true;
queue_delayed_work(hdev->req_workqueue,
&hdev->adv_instance_expire,
adv->mesh ? msecs_to_jiffies(timeout) :
@@ -5572,7 +5572,7 @@ int hci_dev_close_sync(struct hci_dev *hdev)
if (hdev->adv_instance_timeout) {
cancel_delayed_work_sync(&hdev->adv_instance_expire);
- hdev->adv_instance_timeout = 0;
+ hdev->adv_instance_timeout = false;
}
err = hci_dev_shutdown(hdev);
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index aea3482e3893..2e35b09579d3 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1299,7 +1299,7 @@ void mgmt_advertising_removed(struct sock *sk, struct hci_dev *hdev,
static void cancel_adv_timeout(struct hci_dev *hdev)
{
if (hdev->adv_instance_timeout) {
- hdev->adv_instance_timeout = 0;
+ hdev->adv_instance_timeout = false;
cancel_delayed_work(&hdev->adv_instance_expire);
}
}
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: Bluetooth: hci_sync: fix mesh adv timeout units
2026-10-05 18:13 ` [PATCH 1/2] " Pauli Virtanen
@ 2026-10-06 2:18 ` bluez.test.bot
0 siblings, 0 replies; 6+ messages in thread
From: bluez.test.bot @ 2026-10-06 2:18 UTC (permalink / raw)
To: linux-bluetooth, pav
[-- Attachment #1: Type: text/plain, Size: 1606 bytes --]
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/1179822/
---Test result---
Test Summary:
CheckPatch PASS 2.14 seconds
VerifyFixes PASS 0.13 seconds
VerifySignedoff PASS 0.13 seconds
GitLint PASS 0.69 seconds
SubjectPrefix PASS 1.87 seconds
BuildKernel PASS 29.74 seconds
CheckAllWarning PASS 33.57 seconds
CheckSparse PASS 36.52 seconds
BuildKernel32 PASS 29.49 seconds
CheckKernelLLVM PASS 37.48 seconds
TestRunnerSetup PASS 781.61 seconds
TestRunner_l2cap-tester PASS 12.58 seconds
TestRunner_iso-tester PASS 10.75 seconds
TestRunner_bnep-tester PASS 3.13 seconds
TestRunner_mgmt-tester PASS 61.35 seconds
TestRunner_rfcomm-tester PASS 4.49 seconds
TestRunner_sco-tester PASS 5.60 seconds
TestRunner_ioctl-tester PASS 4.66 seconds
TestRunner_mesh-tester PASS 5.51 seconds
TestRunner_smp-tester PASS 4.33 seconds
TestRunner_userchan-tester PASS 3.17 seconds
TestRunner_6lowpan-tester PASS 15.96 seconds
IncrementalBuild PASS 60.62 seconds
https://github.com/bluez/bluetooth-next/pull/863
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] Bluetooth: hci_sync: fix mesh adv timeout units
2026-10-05 18:13 [PATCH 0/2] Bluetooth: hci_sync: fix mesh adv timeout units Pauli Virtanen
2026-10-05 18:13 ` [PATCH 1/2] " Pauli Virtanen
2026-10-05 18:13 ` [PATCH 2/2] Bluetooth: make hdev->adv_instance_timeout a boolean Pauli Virtanen
@ 2026-10-06 14:30 ` patchwork-bot+bluetooth
2026-10-06 15:00 ` patchwork-bot+bluetooth
3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+bluetooth @ 2026-10-06 14:30 UTC (permalink / raw)
To: Pauli Virtanen; +Cc: linux-bluetooth
Hello:
This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Mon, 5 Oct 2026 21:13:53 +0300 you wrote:
> For mesh advertisements = adv_info::mesh nonzero, the time units are
> milliseconds instead of seconds like normally.
>
> This was forgotten in hci_schedule_adv_instance_sync() and
> hci_enable_ext_advertising_sync() which scheduled 1000x too large
> timeouts.
>
> [...]
Here is the summary with links:
- [1/2] Bluetooth: hci_sync: fix mesh adv timeout units
https://git.kernel.org/bluetooth/bluetooth-next/c/87a49b610708
- [2/2] Bluetooth: make hdev->adv_instance_timeout a boolean
(no matching commit)
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] Bluetooth: hci_sync: fix mesh adv timeout units
2026-10-05 18:13 [PATCH 0/2] Bluetooth: hci_sync: fix mesh adv timeout units Pauli Virtanen
` (2 preceding siblings ...)
2026-10-06 14:30 ` [PATCH 0/2] Bluetooth: hci_sync: fix mesh adv timeout units patchwork-bot+bluetooth
@ 2026-10-06 15:00 ` patchwork-bot+bluetooth
3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+bluetooth @ 2026-10-06 15:00 UTC (permalink / raw)
To: Pauli Virtanen; +Cc: linux-bluetooth
Hello:
This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Mon, 5 Oct 2026 21:13:53 +0300 you wrote:
> For mesh advertisements = adv_info::mesh nonzero, the time units are
> milliseconds instead of seconds like normally.
>
> This was forgotten in hci_schedule_adv_instance_sync() and
> hci_enable_ext_advertising_sync() which scheduled 1000x too large
> timeouts.
>
> [...]
Here is the summary with links:
- [1/2] Bluetooth: hci_sync: fix mesh adv timeout units
(no matching commit)
- [2/2] Bluetooth: make hdev->adv_instance_timeout a boolean
https://git.kernel.org/bluetooth/bluetooth-next/c/dedfbdb9bf06
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-10-06 15:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-05 18:13 [PATCH 0/2] Bluetooth: hci_sync: fix mesh adv timeout units Pauli Virtanen
2026-10-05 18:13 ` [PATCH 1/2] " Pauli Virtanen
2026-10-06 2:18 ` bluez.test.bot
2026-10-05 18:13 ` [PATCH 2/2] Bluetooth: make hdev->adv_instance_timeout a boolean Pauli Virtanen
2026-10-06 14:30 ` [PATCH 0/2] Bluetooth: hci_sync: fix mesh adv timeout units patchwork-bot+bluetooth
2026-10-06 15:00 ` patchwork-bot+bluetooth
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.