linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] Bluetooth: hci_sync: Fix suspending with wrong filter policy
@ 2024-07-16 15:01 Luiz Augusto von Dentz
  2024-07-16 15:33 ` [v2] " bluez.test.bot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2024-07-16 15:01 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

When suspending the scan filter policy cannot be 0x00 (no acceptlist)
since that means the host has to process every advertisement report
waking up the system, so this attempts to check if hdev is marked as
suspended and if the resulting filter policy would be 0x00 (no
acceptlist) then skip passive scanning if thre no devices in the
acceptlist otherwise reset the filter policy to 0x01 so the acceptlist
is used since the devices programmed there can still wakeup be system.

Fixes: 182ee45da083 ("Bluetooth: hci_sync: Rework hci_suspend_notifier")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/hci_sync.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index cd2ed16da8a4..a31d39a821f4 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -2976,6 +2976,27 @@ static int hci_passive_scan_sync(struct hci_dev *hdev)
 	 */
 	filter_policy = hci_update_accept_list_sync(hdev);
 
+	/* If suspended and filter_policy set to 0x00 (no acceptlist) then
+	 * passive scanning cannot be started since that would require the host
+	 * to be woken up to process the reports.
+	 */
+	if (hdev->suspended && !filter_policy) {
+		/* Check if accept list is empty then there is no need to scan
+		 * while suspended.
+		 */
+		if (list_empty(&hdev->le_accept_list))
+			return 0;
+
+		/* If there are devices is the accept_list that means some
+		 * devices could not be programmed which in non-suspended case
+		 * means filter_policy needs to be set to 0x00 so the host needs
+		 * to filter, but since this is treating suspended case we
+		 * can ignore device needing host to filter to allow devices in
+		 * the acceptlist to be able to wakeup the system.
+		 */
+		filter_policy = 0x01;
+	}
+
 	/* When the controller is using random resolvable addresses and
 	 * with that having LE privacy enabled, then controllers with
 	 * Extended Scanner Filter Policies support can now enable support
-- 
2.45.2


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

* RE: [v2] Bluetooth: hci_sync: Fix suspending with wrong filter policy
  2024-07-16 15:01 [PATCH v2] Bluetooth: hci_sync: Fix suspending with wrong filter policy Luiz Augusto von Dentz
@ 2024-07-16 15:33 ` bluez.test.bot
  2024-07-16 15:57 ` [PATCH v2] " Paul Menzel
  2024-07-17 20:00 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2024-07-16 15:33 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 1698 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=871711

---Test result---

Test Summary:
CheckPatch                    PASS      0.51 seconds
GitLint                       PASS      0.21 seconds
SubjectPrefix                 PASS      0.07 seconds
BuildKernel                   PASS      29.74 seconds
CheckAllWarning               PASS      32.75 seconds
CheckSparse                   PASS      38.10 seconds
CheckSmatch                   PASS      102.56 seconds
BuildKernel32                 PASS      28.75 seconds
TestRunnerSetup               PASS      528.01 seconds
TestRunner_l2cap-tester       PASS      22.05 seconds
TestRunner_iso-tester         PASS      35.14 seconds
TestRunner_bnep-tester        PASS      4.83 seconds
TestRunner_mgmt-tester        FAIL      112.32 seconds
TestRunner_rfcomm-tester      PASS      7.47 seconds
TestRunner_sco-tester         PASS      15.07 seconds
TestRunner_ioctl-tester       PASS      7.93 seconds
TestRunner_mesh-tester        PASS      6.00 seconds
TestRunner_smp-tester         PASS      11.27 seconds
TestRunner_userchan-tester    PASS      5.00 seconds
IncrementalBuild              PASS      28.15 seconds

Details
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 492, Passed: 489 (99.4%), Failed: 1, Not Run: 2

Failed Test Cases
LL Privacy - Add Device 7 (AL is full)               Failed       0.192 seconds


---
Regards,
Linux Bluetooth


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

* Re: [PATCH v2] Bluetooth: hci_sync: Fix suspending with wrong filter policy
  2024-07-16 15:01 [PATCH v2] Bluetooth: hci_sync: Fix suspending with wrong filter policy Luiz Augusto von Dentz
  2024-07-16 15:33 ` [v2] " bluez.test.bot
@ 2024-07-16 15:57 ` Paul Menzel
  2024-07-17 20:00 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Menzel @ 2024-07-16 15:57 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Dear Luiz,


Thank you for the patch. Four minor comments.

Am 16.07.24 um 17:01 schrieb Luiz Augusto von Dentz:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> When suspending the scan filter policy cannot be 0x00 (no acceptlist)
> since that means the host has to process every advertisement report
> waking up the system, so this attempts to check if hdev is marked as
> suspended and if the resulting filter policy would be 0x00 (no
> acceptlist) then skip passive scanning if thre no devices in the

there are

> acceptlist otherwise reset the filter policy to 0x01 so the acceptlist
> is used since the devices programmed there can still wakeup be system.

wake the system up?

> Fixes: 182ee45da083 ("Bluetooth: hci_sync: Rework hci_suspend_notifier")
> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> ---
>   net/bluetooth/hci_sync.c | 21 +++++++++++++++++++++
>   1 file changed, 21 insertions(+)
> 
> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> index cd2ed16da8a4..a31d39a821f4 100644
> --- a/net/bluetooth/hci_sync.c
> +++ b/net/bluetooth/hci_sync.c
> @@ -2976,6 +2976,27 @@ static int hci_passive_scan_sync(struct hci_dev *hdev)
>   	 */
>   	filter_policy = hci_update_accept_list_sync(hdev);
>   
> +	/* If suspended and filter_policy set to 0x00 (no acceptlist) then
> +	 * passive scanning cannot be started since that would require the host
> +	 * to be woken up to process the reports.
> +	 */
> +	if (hdev->suspended && !filter_policy) {
> +		/* Check if accept list is empty then there is no need to scan
> +		 * while suspended.
> +		 */
> +		if (list_empty(&hdev->le_accept_list))
> +			return 0;
> +
> +		/* If there are devices is the accept_list that means some

i*n* the

> +		 * devices could not be programmed which in non-suspended case
> +		 * means filter_policy needs to be set to 0x00 so the host needs
> +		 * to filter, but since this is treating suspended case we
> +		 * can ignore device needing host to filter to allow devices in
> +		 * the acceptlist to be able to wakeup the system.

to wake up

> +		 */
> +		filter_policy = 0x01;
> +	}
> +
>   	/* When the controller is using random resolvable addresses and
>   	 * with that having LE privacy enabled, then controllers with
>   	 * Extended Scanner Filter Policies support can now enable support


Kind regards,

Paul

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

* Re: [PATCH v2] Bluetooth: hci_sync: Fix suspending with wrong filter policy
  2024-07-16 15:01 [PATCH v2] Bluetooth: hci_sync: Fix suspending with wrong filter policy Luiz Augusto von Dentz
  2024-07-16 15:33 ` [v2] " bluez.test.bot
  2024-07-16 15:57 ` [PATCH v2] " Paul Menzel
@ 2024-07-17 20:00 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2024-07-17 20:00 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hello:

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

On Tue, 16 Jul 2024 11:01:26 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> When suspending the scan filter policy cannot be 0x00 (no acceptlist)
> since that means the host has to process every advertisement report
> waking up the system, so this attempts to check if hdev is marked as
> suspended and if the resulting filter policy would be 0x00 (no
> acceptlist) then skip passive scanning if thre no devices in the
> acceptlist otherwise reset the filter policy to 0x01 so the acceptlist
> is used since the devices programmed there can still wakeup be system.
> 
> [...]

Here is the summary with links:
  - [v2] Bluetooth: hci_sync: Fix suspending with wrong filter policy
    https://git.kernel.org/bluetooth/bluetooth-next/c/54dd4796336d

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

end of thread, other threads:[~2024-07-17 20:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-16 15:01 [PATCH v2] Bluetooth: hci_sync: Fix suspending with wrong filter policy Luiz Augusto von Dentz
2024-07-16 15:33 ` [v2] " bluez.test.bot
2024-07-16 15:57 ` [PATCH v2] " Paul Menzel
2024-07-17 20:00 ` 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;
as well as URLs for NNTP newsgroup(s).