public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Bluetooth: hci_sync: revert some mesh modifications
@ 2025-06-25 13:09 Christian Eggers
  2025-06-25 13:09 ` [PATCH 2/3] Bluetooth: MGMT: set_mesh: update LE scan interval and window Christian Eggers
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Christian Eggers @ 2025-06-25 13:09 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz, Brian Gix,
	Inga Stotland
  Cc: linux-bluetooth, linux-kernel, Christian Eggers, stable

This reverts minor parts of the changes made in commit b338d91703fa
("Bluetooth: Implement support for Mesh"). It looks like these changes
were only made for development purposes but shouldn't have been part of
the commit.

Fixes: b338d91703fa ("Bluetooth: Implement support for Mesh")
Cc: stable@vger.kernel.org
Signed-off-by: Christian Eggers <ceggers@arri.de>
---
 net/bluetooth/hci_sync.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 6687f2a4d1eb..1f8806dfa556 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -1970,13 +1970,10 @@ static int hci_clear_adv_sets_sync(struct hci_dev *hdev, struct sock *sk)
 static int hci_clear_adv_sync(struct hci_dev *hdev, struct sock *sk, bool force)
 {
 	struct adv_info *adv, *n;
-	int err = 0;
 
 	if (ext_adv_capable(hdev))
 		/* Remove all existing sets */
-		err = hci_clear_adv_sets_sync(hdev, sk);
-	if (ext_adv_capable(hdev))
-		return err;
+		return hci_clear_adv_sets_sync(hdev, sk);
 
 	/* This is safe as long as there is no command send while the lock is
 	 * held.
@@ -2004,13 +2001,11 @@ static int hci_clear_adv_sync(struct hci_dev *hdev, struct sock *sk, bool force)
 static int hci_remove_adv_sync(struct hci_dev *hdev, u8 instance,
 			       struct sock *sk)
 {
-	int err = 0;
+	int err;
 
 	/* If we use extended advertising, instance has to be removed first. */
 	if (ext_adv_capable(hdev))
-		err = hci_remove_ext_adv_instance_sync(hdev, instance, sk);
-	if (ext_adv_capable(hdev))
-		return err;
+		return hci_remove_ext_adv_instance_sync(hdev, instance, sk);
 
 	/* This is safe as long as there is no command send while the lock is
 	 * held.
@@ -2109,16 +2104,13 @@ int hci_read_tx_power_sync(struct hci_dev *hdev, __le16 handle, u8 type)
 int hci_disable_advertising_sync(struct hci_dev *hdev)
 {
 	u8 enable = 0x00;
-	int err = 0;
 
 	/* If controller is not advertising we are done. */
 	if (!hci_dev_test_flag(hdev, HCI_LE_ADV))
 		return 0;
 
 	if (ext_adv_capable(hdev))
-		err = hci_disable_ext_adv_instance_sync(hdev, 0x00);
-	if (ext_adv_capable(hdev))
-		return err;
+		return hci_disable_ext_adv_instance_sync(hdev, 0x00);
 
 	return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_ADV_ENABLE,
 				     sizeof(enable), &enable, HCI_CMD_TIMEOUT);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] Bluetooth: MGMT: set_mesh: update LE scan interval and window
  2025-06-25 13:09 [PATCH 1/3] Bluetooth: hci_sync: revert some mesh modifications Christian Eggers
@ 2025-06-25 13:09 ` Christian Eggers
  2025-06-25 13:09 ` [PATCH 3/3] Bluetooth: MGMT: mesh_send: check instances prior disabling advertising Christian Eggers
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Christian Eggers @ 2025-06-25 13:09 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz, Brian Gix,
	Inga Stotland
  Cc: linux-bluetooth, linux-kernel, Christian Eggers, stable

According to the message of commit b338d91703fa ("Bluetooth: Implement
support for Mesh"), MGMT_OP_SET_MESH_RECEIVER should set the passive scan
parameters.  Currently the scan interval and window parameters are
silently ignored, although user space (bluetooth-meshd) expects that
they can be used [1]

[1] https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/mesh/mesh-io-mgmt.c#n344
Fixes: b338d91703fa ("Bluetooth: Implement support for Mesh")
Cc: stable@vger.kernel.org
Signed-off-by: Christian Eggers <ceggers@arri.de>
---
 net/bluetooth/mgmt.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index d540f7b4f75f..5d0f772c7a99 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2153,6 +2153,9 @@ static int set_mesh_sync(struct hci_dev *hdev, void *data)
 	else
 		hci_dev_clear_flag(hdev, HCI_MESH);
 
+	hdev->le_scan_interval = __le16_to_cpu(cp->period);
+	hdev->le_scan_window = __le16_to_cpu(cp->window);
+
 	len -= sizeof(*cp);
 
 	/* If filters don't fit, forward all adv pkts */
@@ -2167,6 +2170,7 @@ static int set_mesh(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
 {
 	struct mgmt_cp_set_mesh *cp = data;
 	struct mgmt_pending_cmd *cmd;
+	__u16 period, window;
 	int err = 0;
 
 	bt_dev_dbg(hdev, "sock %p", sk);
@@ -2180,6 +2184,23 @@ static int set_mesh(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
 		return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_MESH_RECEIVER,
 				       MGMT_STATUS_INVALID_PARAMS);
 
+	/* Keep allowed ranges in sync with set_scan_params() */
+	period = __le16_to_cpu(cp->period);
+
+	if (period < 0x0004 || period > 0x4000)
+		return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_MESH_RECEIVER,
+				       MGMT_STATUS_INVALID_PARAMS);
+
+	window = __le16_to_cpu(cp->window);
+
+	if (window < 0x0004 || window > 0x4000)
+		return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_MESH_RECEIVER,
+				       MGMT_STATUS_INVALID_PARAMS);
+
+	if (window > period)
+		return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_MESH_RECEIVER,
+				       MGMT_STATUS_INVALID_PARAMS);
+
 	hci_dev_lock(hdev);
 
 	cmd = mgmt_pending_add(sk, MGMT_OP_SET_MESH_RECEIVER, hdev, data, len);
@@ -6432,6 +6453,7 @@ static int set_scan_params(struct sock *sk, struct hci_dev *hdev,
 		return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS,
 				       MGMT_STATUS_NOT_SUPPORTED);
 
+	/* Keep allowed ranges in sync with set_mesh() */
 	interval = __le16_to_cpu(cp->interval);
 
 	if (interval < 0x0004 || interval > 0x4000)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] Bluetooth: MGMT: mesh_send: check instances prior disabling advertising
  2025-06-25 13:09 [PATCH 1/3] Bluetooth: hci_sync: revert some mesh modifications Christian Eggers
  2025-06-25 13:09 ` [PATCH 2/3] Bluetooth: MGMT: set_mesh: update LE scan interval and window Christian Eggers
@ 2025-06-25 13:09 ` Christian Eggers
  2025-06-25 13:31 ` [1/3] Bluetooth: hci_sync: revert some mesh modifications bluez.test.bot
  2025-06-25 21:00 ` [PATCH 1/3] " patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: Christian Eggers @ 2025-06-25 13:09 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz, Brian Gix,
	Inga Stotland
  Cc: linux-bluetooth, linux-kernel, Christian Eggers, stable

The unconditional call of hci_disable_advertising_sync() in
mesh_send_done_sync() also disables other LE advertisings (non mesh
related).

I am not sure whether this call is required at all, but checking the
adv_instances list (like done at other places) seems to solve the
problem.

Fixes: b338d91703fa ("Bluetooth: Implement support for Mesh")
Cc: stable@vger.kernel.org
Signed-off-by: Christian Eggers <ceggers@arri.de>
---
 net/bluetooth/mgmt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 5d0f772c7a99..1485b455ade4 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1080,7 +1080,8 @@ static int mesh_send_done_sync(struct hci_dev *hdev, void *data)
 	struct mgmt_mesh_tx *mesh_tx;
 
 	hci_dev_clear_flag(hdev, HCI_MESH_SENDING);
-	hci_disable_advertising_sync(hdev);
+	if (list_empty(&hdev->adv_instances))
+		hci_disable_advertising_sync(hdev);
 	mesh_tx = mgmt_mesh_next(hdev, NULL);
 
 	if (mesh_tx)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [1/3] Bluetooth: hci_sync: revert some mesh modifications
  2025-06-25 13:09 [PATCH 1/3] Bluetooth: hci_sync: revert some mesh modifications Christian Eggers
  2025-06-25 13:09 ` [PATCH 2/3] Bluetooth: MGMT: set_mesh: update LE scan interval and window Christian Eggers
  2025-06-25 13:09 ` [PATCH 3/3] Bluetooth: MGMT: mesh_send: check instances prior disabling advertising Christian Eggers
@ 2025-06-25 13:31 ` bluez.test.bot
  2025-06-25 21:00 ` [PATCH 1/3] " patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2025-06-25 13:31 UTC (permalink / raw)
  To: linux-bluetooth, ceggers

[-- Attachment #1: Type: text/plain, Size: 2027 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/project/bluetooth/list/?series=975791

---Test result---

Test Summary:
CheckPatch                    PENDING   0.53 seconds
GitLint                       PENDING   0.28 seconds
SubjectPrefix                 PASS      0.20 seconds
BuildKernel                   PASS      24.59 seconds
CheckAllWarning               PASS      26.67 seconds
CheckSparse                   PASS      30.61 seconds
BuildKernel32                 PASS      24.00 seconds
TestRunnerSetup               PASS      469.78 seconds
TestRunner_l2cap-tester       PASS      25.07 seconds
TestRunner_iso-tester         PASS      36.43 seconds
TestRunner_bnep-tester        PASS      5.84 seconds
TestRunner_mgmt-tester        PASS      134.01 seconds
TestRunner_rfcomm-tester      PASS      9.31 seconds
TestRunner_sco-tester         PASS      14.75 seconds
TestRunner_ioctl-tester       PASS      9.96 seconds
TestRunner_mesh-tester        FAIL      11.44 seconds
TestRunner_smp-tester         PASS      8.47 seconds
TestRunner_userchan-tester    PASS      6.13 seconds
IncrementalBuild              PENDING   1.02 seconds

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

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

##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0

Failed Test Cases
Mesh - Send cancel - 1                               Timed out    2.098 seconds
Mesh - Send cancel - 2                               Timed out    1.996 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] Bluetooth: hci_sync: revert some mesh modifications
  2025-06-25 13:09 [PATCH 1/3] Bluetooth: hci_sync: revert some mesh modifications Christian Eggers
                   ` (2 preceding siblings ...)
  2025-06-25 13:31 ` [1/3] Bluetooth: hci_sync: revert some mesh modifications bluez.test.bot
@ 2025-06-25 21:00 ` patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2025-06-25 21:00 UTC (permalink / raw)
  To: Christian Eggers
  Cc: marcel, johan.hedberg, luiz.dentz, brian.gix, inga.stotland,
	linux-bluetooth, linux-kernel, stable

Hello:

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

On Wed, 25 Jun 2025 15:09:29 +0200 you wrote:
> This reverts minor parts of the changes made in commit b338d91703fa
> ("Bluetooth: Implement support for Mesh"). It looks like these changes
> were only made for development purposes but shouldn't have been part of
> the commit.
> 
> Fixes: b338d91703fa ("Bluetooth: Implement support for Mesh")
> Cc: stable@vger.kernel.org
> Signed-off-by: Christian Eggers <ceggers@arri.de>
> 
> [...]

Here is the summary with links:
  - [1/3] Bluetooth: hci_sync: revert some mesh modifications
    https://git.kernel.org/bluetooth/bluetooth-next/c/1984453983fd
  - [2/3] Bluetooth: MGMT: set_mesh: update LE scan interval and window
    https://git.kernel.org/bluetooth/bluetooth-next/c/41d630621be1
  - [3/3] Bluetooth: MGMT: mesh_send: check instances prior disabling advertising
    https://git.kernel.org/bluetooth/bluetooth-next/c/8dcd9b294572

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] 5+ messages in thread

end of thread, other threads:[~2025-06-25 20:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-25 13:09 [PATCH 1/3] Bluetooth: hci_sync: revert some mesh modifications Christian Eggers
2025-06-25 13:09 ` [PATCH 2/3] Bluetooth: MGMT: set_mesh: update LE scan interval and window Christian Eggers
2025-06-25 13:09 ` [PATCH 3/3] Bluetooth: MGMT: mesh_send: check instances prior disabling advertising Christian Eggers
2025-06-25 13:31 ` [1/3] Bluetooth: hci_sync: revert some mesh modifications bluez.test.bot
2025-06-25 21:00 ` [PATCH 1/3] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox