All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Pause service discovery for suspend
@ 2020-12-17 23:04 Abhishek Pandit-Subedi
  2020-12-18  0:17 ` bluez.test.bot
  2020-12-18 21:31 ` [PATCH] " Marcel Holtmann
  0 siblings, 2 replies; 3+ messages in thread
From: Abhishek Pandit-Subedi @ 2020-12-17 23:04 UTC (permalink / raw)
  To: marcel, linux-bluetooth
  Cc: chromeos-bluetooth-upstreaming, Abhishek Pandit-Subedi,
	David S. Miller, Johan Hedberg, netdev, linux-kernel,
	Jakub Kicinski, Luiz Augusto von Dentz

Just like MGMT_OP_START_DISCOVERY, we should reject
MGMT_OP_START_SERVICE_DISCOVERY with MGMT_STATUS_BUSY when we are paused
for suspend.

Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
---
On ChromeOS, we started getting reports of scanning failing after
resuming from suspend. The root cause was that Start Service Discovery
was being called while discovery was supposed to be paused for suspend
and it was screwing up some internal state. Adding this check
immediately fixed it.

The fix was tested by doing the following:
* Set Discovery Filter ({'transport': 'auto'})
* Start Discovery
* Suspend
* Resume
* Check the Discovering property

Without the fix, this test failed when checking the Discovering
property above.

 net/bluetooth/mgmt.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index fa0f7a4a1d2fc8a..608dda5403b7327 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -4798,6 +4798,14 @@ static int start_service_discovery(struct sock *sk, struct hci_dev *hdev,
 		goto failed;
 	}
 
+	if (hdev->discovery_paused) {
+		err = mgmt_cmd_complete(sk, hdev->id,
+					MGMT_OP_START_SERVICE_DISCOVERY,
+					MGMT_STATUS_BUSY, &cp->type,
+					sizeof(cp->type));
+		goto failed;
+	}
+
 	uuid_count = __le16_to_cpu(cp->uuid_count);
 	if (uuid_count > max_uuid_count) {
 		bt_dev_err(hdev, "service_discovery: too big uuid_count value %u",
-- 
2.29.2.729.g45daf8777d-goog


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

* RE: Bluetooth: Pause service discovery for suspend
  2020-12-17 23:04 [PATCH] Bluetooth: Pause service discovery for suspend Abhishek Pandit-Subedi
@ 2020-12-18  0:17 ` bluez.test.bot
  2020-12-18 21:31 ` [PATCH] " Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2020-12-18  0:17 UTC (permalink / raw)
  To: linux-bluetooth, abhishekpandit

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

---Test result---

##############################
    Test: CheckPatch - PASS
    

    ##############################
    Test: CheckGitLint - FAIL
    workflow: Add workflow files for ci
1: T1 Title exceeds max length (92>72): "Merge ac26b99ca74df317ca64caa033fb2232c5860731 into c886b3ae0439ee0022dcd63d6faaa04fe19244ed"
3: B6 Body message is missing

Bluetooth: Pause service discovery for suspend
1: T1 Title exceeds max length (92>72): "Merge ac26b99ca74df317ca64caa033fb2232c5860731 into c886b3ae0439ee0022dcd63d6faaa04fe19244ed"
3: B6 Body message is missing


    ##############################
    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: 392 (94.2%), Failed: 8, 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: 43336 bytes --]

[-- Attachment #3: bnep-tester.log --]
[-- Type: application/octet-stream, Size: 3529 bytes --]

[-- Attachment #4: mgmt-tester.log --]
[-- Type: application/octet-stream, Size: 547755 bytes --]

[-- Attachment #5: rfcomm-tester.log --]
[-- Type: application/octet-stream, Size: 11651 bytes --]

[-- Attachment #6: sco-tester.log --]
[-- Type: application/octet-stream, Size: 9886 bytes --]

[-- Attachment #7: smp-tester.log --]
[-- Type: application/octet-stream, Size: 11797 bytes --]

[-- Attachment #8: userchan-tester.log --]
[-- Type: application/octet-stream, Size: 5427 bytes --]

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

* Re: [PATCH] Bluetooth: Pause service discovery for suspend
  2020-12-17 23:04 [PATCH] Bluetooth: Pause service discovery for suspend Abhishek Pandit-Subedi
  2020-12-18  0:17 ` bluez.test.bot
@ 2020-12-18 21:31 ` Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2020-12-18 21:31 UTC (permalink / raw)
  To: Abhishek Pandit-Subedi
  Cc: linux-bluetooth, CrosBT Upstreaming, David S. Miller,
	Johan Hedberg, netdev, LKML, Jakub Kicinski,
	Luiz Augusto von Dentz

Hi Abhishek,

> Just like MGMT_OP_START_DISCOVERY, we should reject
> MGMT_OP_START_SERVICE_DISCOVERY with MGMT_STATUS_BUSY when we are paused
> for suspend.
> 
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> ---
> On ChromeOS, we started getting reports of scanning failing after
> resuming from suspend. The root cause was that Start Service Discovery
> was being called while discovery was supposed to be paused for suspend
> and it was screwing up some internal state. Adding this check
> immediately fixed it.
> 
> The fix was tested by doing the following:
> * Set Discovery Filter ({'transport': 'auto'})
> * Start Discovery
> * Suspend
> * Resume
> * Check the Discovering property
> 
> Without the fix, this test failed when checking the Discovering
> property above.
> 
> net/bluetooth/mgmt.c | 8 ++++++++
> 1 file changed, 8 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

end of thread, other threads:[~2020-12-18 21:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 23:04 [PATCH] Bluetooth: Pause service discovery for suspend Abhishek Pandit-Subedi
2020-12-18  0:17 ` bluez.test.bot
2020-12-18 21:31 ` [PATCH] " 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.