diff mbox series

Bluetooth: hci_sync: avoid dup filtering when passive scanning with adv monitor

Message ID 20240729155546.20932-1-anton@khirnov.net
State Accepted
Commit 2360f368524bb817b71bdd2efed53d0c3c3929ad
Headers show
Series Bluetooth: hci_sync: avoid dup filtering when passive scanning with adv monitor | expand

Commit Message

Anton Khirnov July 29, 2024, 3:55 p.m. UTC
This restores behaviour (including the comment) from now-removed
hci_request.c, and also matches existing code for active scanning.

Without this, the duplicates filter is always active when passive
scanning, which makes it impossible to work with devices that send
nontrivial dynamic data in their advertisement reports.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
---
 net/bluetooth/hci_sync.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Luiz Augusto von Dentz July 29, 2024, 4:18 p.m. UTC | #1
Hi Anton,

On Mon, Jul 29, 2024 at 5:06 PM Anton Khirnov <anton@khirnov.net> wrote:
>
> This restores behaviour (including the comment) from now-removed
> hci_request.c, and also matches existing code for active scanning.

Make sure you add the Fixes tag with the commit hash that introduced
the problem, since we might want to backport this.

> Without this, the duplicates filter is always active when passive
> scanning, which makes it impossible to work with devices that send
> nontrivial dynamic data in their advertisement reports.
>
> Signed-off-by: Anton Khirnov <anton@khirnov.net>
> ---
>  net/bluetooth/hci_sync.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> index a31d39a821f4..e79cd40bd079 100644
> --- a/net/bluetooth/hci_sync.c
> +++ b/net/bluetooth/hci_sync.c
> @@ -3019,6 +3019,20 @@ static int hci_passive_scan_sync(struct hci_dev *hdev)
>         } else if (hci_is_adv_monitoring(hdev)) {
>                 window = hdev->le_scan_window_adv_monitor;
>                 interval = hdev->le_scan_int_adv_monitor;
> +
> +               /* Disable duplicates filter when scanning for advertisement
> +                * monitor for the following reasons.
> +                *
> +                * For HW pattern filtering (ex. MSFT), Realtek and Qualcomm
> +                * controllers ignore RSSI_Sampling_Period when the duplicates
> +                * filter is enabled.
> +                *
> +                * For SW pattern filtering, when we're not doing interleaved
> +                * scanning, it is necessary to disable duplicates filter,
> +                * otherwise hosts can only receive one advertisement and it's
> +                * impossible to know if a peer is still in range.
> +                */
> +               filter_dups = LE_SCAN_FILTER_DUP_DISABLE;
>         } else {
>                 window = hdev->le_scan_window;
>                 interval = hdev->le_scan_interval;
> --
> 2.39.2
>
>
diff mbox series

Patch

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index a31d39a821f4..e79cd40bd079 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -3019,6 +3019,20 @@  static int hci_passive_scan_sync(struct hci_dev *hdev)
 	} else if (hci_is_adv_monitoring(hdev)) {
 		window = hdev->le_scan_window_adv_monitor;
 		interval = hdev->le_scan_int_adv_monitor;
+
+		/* Disable duplicates filter when scanning for advertisement
+		 * monitor for the following reasons.
+		 *
+		 * For HW pattern filtering (ex. MSFT), Realtek and Qualcomm
+		 * controllers ignore RSSI_Sampling_Period when the duplicates
+		 * filter is enabled.
+		 *
+		 * For SW pattern filtering, when we're not doing interleaved
+		 * scanning, it is necessary to disable duplicates filter,
+		 * otherwise hosts can only receive one advertisement and it's
+		 * impossible to know if a peer is still in range.
+		 */
+		filter_dups = LE_SCAN_FILTER_DUP_DISABLE;
 	} else {
 		window = hdev->le_scan_window;
 		interval = hdev->le_scan_interval;