* [PATCH v2] Bluetooth: Cancel le_scan_restart work when stopping discovery
@ 2021-03-15 17:30 Sonny Sasaka
2021-03-15 18:27 ` [v2] " bluez.test.bot
2021-03-15 20:07 ` [PATCH v2] " Marcel Holtmann
0 siblings, 2 replies; 3+ messages in thread
From: Sonny Sasaka @ 2021-03-15 17:30 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Sonny Sasaka, Abhishek Pandit-Subedi
Not cancelling it has caused a bug where passive background scanning is
disabled out of the blue, preventing BLE keyboards/mice to reconnect.
Here is how it happens:
After hci_req_stop_discovery, there is still le_scan_restart_work
scheduled. Invocation of le_scan_restart_work causes a harmful
le_scan_disable_work to be scheduled. This le_scan_disable_work will
eventually disable passive scanning when the timer fires.
Sample btmon trace:
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
Type: Passive (0x00)
Interval: 367.500 msec (0x024c)
Window: 37.500 msec (0x003c)
Own address type: Public (0x00)
Filter policy: Accept all advertisement (0x00)
> HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Parameters (0x08|0x000b) ncmd 1
Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
Scanning: Enabled (0x01)
Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 2
Status: Success (0x00)
...
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
Scanning: Disabled (0x00)
Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 2
Status: Success (0x00)
// Background scanning is not working here onwards.
Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Signed-off-by: Sonny Sasaka <sonnysasaka@chromium.org>
---
net/bluetooth/hci_request.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index d7ee11ef70d3e..8ace5d34b01ef 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -3252,6 +3252,7 @@ bool hci_req_stop_discovery(struct hci_request *req)
if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) {
cancel_delayed_work(&hdev->le_scan_disable);
+ cancel_delayed_work(&hdev->le_scan_restart);
hci_req_add_le_scan_disable(req, false);
}
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [v2] Bluetooth: Cancel le_scan_restart work when stopping discovery 2021-03-15 17:30 [PATCH v2] Bluetooth: Cancel le_scan_restart work when stopping discovery Sonny Sasaka @ 2021-03-15 18:27 ` bluez.test.bot 2021-03-15 20:07 ` [PATCH v2] " Marcel Holtmann 1 sibling, 0 replies; 3+ messages in thread From: bluez.test.bot @ 2021-03-15 18:27 UTC (permalink / raw) To: linux-bluetooth, sonnysasaka [-- Attachment #1: Type: text/plain, Size: 1599 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=448487 ---Test result--- ############################## Test: CheckPatch - PASS ############################## Test: CheckGitLint - PASS ############################## Test: CheckBuildK - PASS ############################## Test: CheckTestRunner: Setup - PASS ############################## Test: CheckTestRunner: l2cap-tester - PASS Total: 40, Passed: 34 (85.0%), Failed: 0, Not Run: 6 ############################## Test: CheckTestRunner: bnep-tester - PASS Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0 ############################## Test: CheckTestRunner: mgmt-tester - FAIL Total: 416, Passed: 397 (95.4%), Failed: 3, Not Run: 16 ############################## Test: CheckTestRunner: rfcomm-tester - PASS Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0 ############################## Test: CheckTestRunner: sco-tester - PASS Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0 ############################## Test: CheckTestRunner: smp-tester - PASS Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0 ############################## Test: CheckTestRunner: userchan-tester - PASS Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0 --- Regards, Linux Bluetooth [-- Attachment #2: l2cap-tester.log --] [-- Type: application/octet-stream, Size: 43342 bytes --] [-- Attachment #3: bnep-tester.log --] [-- Type: application/octet-stream, Size: 3532 bytes --] [-- Attachment #4: mgmt-tester.log --] [-- Type: application/octet-stream, Size: 546674 bytes --] [-- Attachment #5: rfcomm-tester.log --] [-- Type: application/octet-stream, Size: 11653 bytes --] [-- Attachment #6: sco-tester.log --] [-- Type: application/octet-stream, Size: 9888 bytes --] [-- Attachment #7: smp-tester.log --] [-- Type: application/octet-stream, Size: 11799 bytes --] [-- Attachment #8: userchan-tester.log --] [-- Type: application/octet-stream, Size: 5429 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] Bluetooth: Cancel le_scan_restart work when stopping discovery 2021-03-15 17:30 [PATCH v2] Bluetooth: Cancel le_scan_restart work when stopping discovery Sonny Sasaka 2021-03-15 18:27 ` [v2] " bluez.test.bot @ 2021-03-15 20:07 ` Marcel Holtmann 1 sibling, 0 replies; 3+ messages in thread From: Marcel Holtmann @ 2021-03-15 20:07 UTC (permalink / raw) To: Sonny Sasaka; +Cc: Bluetooth Kernel Mailing List, Abhishek Pandit-Subedi Hi Sonny, > Not cancelling it has caused a bug where passive background scanning is > disabled out of the blue, preventing BLE keyboards/mice to reconnect. > Here is how it happens: > After hci_req_stop_discovery, there is still le_scan_restart_work > scheduled. Invocation of le_scan_restart_work causes a harmful > le_scan_disable_work to be scheduled. This le_scan_disable_work will > eventually disable passive scanning when the timer fires. > > Sample btmon trace: > > < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7 > Type: Passive (0x00) > Interval: 367.500 msec (0x024c) > Window: 37.500 msec (0x003c) > Own address type: Public (0x00) > Filter policy: Accept all advertisement (0x00) >> HCI Event: Command Complete (0x0e) plen 4 > LE Set Scan Parameters (0x08|0x000b) ncmd 1 > Status: Success (0x00) > < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2 > Scanning: Enabled (0x01) > Filter duplicates: Disabled (0x00) >> HCI Event: Command Complete (0x0e) plen 4 > LE Set Scan Enable (0x08|0x000c) ncmd 2 > Status: Success (0x00) > ... > < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2 > Scanning: Disabled (0x00) > Filter duplicates: Disabled (0x00) >> HCI Event: Command Complete (0x0e) plen 4 > LE Set Scan Enable (0x08|0x000c) ncmd 2 > Status: Success (0x00) > // Background scanning is not working here onwards. > > Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org> > Signed-off-by: Sonny Sasaka <sonnysasaka@chromium.org> > > --- > net/bluetooth/hci_request.c | 1 + > 1 file changed, 1 insertion(+) patch has been applied to bluetooth-next tree. Regards Marcel ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-15 20:08 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-03-15 17:30 [PATCH v2] Bluetooth: Cancel le_scan_restart work when stopping discovery Sonny Sasaka 2021-03-15 18:27 ` [v2] " bluez.test.bot 2021-03-15 20:07 ` [PATCH v2] " Marcel Holtmann
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.