Skip to content

Commit

Permalink
Use proper fix for Bluetooth LE advertisement stall (#2598) (#2714)
Browse files Browse the repository at this point in the history
Instead of reverting the new hci_sync based BLE scan disable logic
use the fix proposed by Luiz:
https://lore.kernel.org/linux-bluetooth/CABBYNZ+5RMqNVMyYKi+gOVaV+K6k8Z-C37KnfGa=qRUORc3dWg@mail.gmail.com/

This fix avoids BLE stalls just like the revert.
  • Loading branch information
agners authored Aug 30, 2023
1 parent 60ea200 commit fcf6156
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 221 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
From b93f2a3748f32cde4a09cade7948bb406a2a4091 Mon Sep 17 00:00:00 2001
Message-ID: <b93f2a3748f32cde4a09cade7948bb406a2a4091.1693428313.git.stefan@agner.ch>
From: Luiz Augusto von Dentz <[email protected]>
Date: Tue, 29 Aug 2023 13:59:36 -0700
Subject: [PATCH] Bluetooth: hci_sync: Fix handling of
HCI_QUIRK_STRICT_DUPLICATE_FILTER

When HCI_QUIRK_STRICT_DUPLICATE_FILTER is set LE scanning requires
periodic restarts of the scanning procedure as the controller would
consider device previously found as duplicated despite of RSSI changes,
but in order to set the scan timeout properly set le_scan_restart needs
to be synchronous so it shall not use hci_cmd_sync_queue which defers
the command processing to cmd_sync_work.

link: https://lore.kernel.org/linux-bluetooth/[email protected]/#t
Fixes: 27d54b778ad1 ("Bluetooth: Rework le_scan_restart for hci_sync")
Signed-off-by: Luiz Augusto von Dentz <[email protected]>
---
net/bluetooth/hci_sync.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 2ae038dfc39f..f8bb2504f99a 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -412,11 +412,6 @@ static int hci_le_scan_restart_sync(struct hci_dev *hdev)
LE_SCAN_FILTER_DUP_ENABLE);
}

-static int le_scan_restart_sync(struct hci_dev *hdev, void *data)
-{
- return hci_le_scan_restart_sync(hdev);
-}
-
static void le_scan_restart(struct work_struct *work)
{
struct hci_dev *hdev = container_of(work, struct hci_dev,
@@ -426,15 +421,15 @@ static void le_scan_restart(struct work_struct *work)

bt_dev_dbg(hdev, "");

- hci_dev_lock(hdev);
-
- status = hci_cmd_sync_queue(hdev, le_scan_restart_sync, NULL, NULL);
+ status = hci_le_scan_restart_sync(hdev);
if (status) {
bt_dev_err(hdev, "failed to restart LE scan: status %d",
status);
- goto unlock;
+ return;
}

+ hci_dev_lock(hdev);
+
if (!test_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks) ||
!hdev->discovery.scan_start)
goto unlock;
--
2.42.0

This file was deleted.

0 comments on commit fcf6156

Please sign in to comment.