All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Bluetooth: Further improvements for suspend tasks
@ 2020-12-08  0:12 Abhishek Pandit-Subedi
  2020-12-08  0:12 ` [PATCH 1/1] Bluetooth: Remove hci_req_le_suspend_config Abhishek Pandit-Subedi
  0 siblings, 1 reply; 4+ messages in thread
From: Abhishek Pandit-Subedi @ 2020-12-08  0:12 UTC (permalink / raw)
  To: marcel, linux-bluetooth
  Cc: chromeos-bluetooth-upstreaming, Abhishek Pandit-Subedi,
	David S. Miller, Johan Hedberg, Alain Michaud, linux-kernel,
	Jakub Kicinski, Luiz Augusto von Dentz, netdev, Howard Chung


Hi Marcel,

This patch further improves suspend handling by getting rid of the
separate function used for always configuring LE scan. Instead, we only
configure LE scan if it is necessary and properly set the task bits
depending on what actions were taken.

The previously sent-up CL was incomplete due to a merge problem between
ChromeOS and upstream. We merged https://patchwork.kernel.org/project/bluetooth/patch/20200917164632.BlueZ.v2.4.I3774a8f0d748c7c6ec3402c4adcead32810c9164@changeid/
but the upstream version didn't have the same changes:
https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/commit/?id=36afe87ac10fd71f98c40ccf9923b83e0d3fab68

This fix was tested after reverting all our local patches, applying the
upstream patches and this patch on top.

Thanks
Abhishek



Abhishek Pandit-Subedi (1):
  Bluetooth: Remove hci_req_le_suspend_config

 net/bluetooth/hci_request.c | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

-- 
2.29.2.576.ga3fc446d84-goog


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

* [PATCH 1/1] Bluetooth: Remove hci_req_le_suspend_config
  2020-12-08  0:12 [PATCH 0/1] Bluetooth: Further improvements for suspend tasks Abhishek Pandit-Subedi
@ 2020-12-08  0:12 ` Abhishek Pandit-Subedi
  2020-12-08  1:48   ` Bluetooth: Further improvements for suspend tasks bluez.test.bot
  2020-12-18 21:27   ` [PATCH 1/1] Bluetooth: Remove hci_req_le_suspend_config Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: Abhishek Pandit-Subedi @ 2020-12-08  0:12 UTC (permalink / raw)
  To: marcel, linux-bluetooth
  Cc: chromeos-bluetooth-upstreaming, Abhishek Pandit-Subedi,
	Alain Michaud, David S. Miller, Johan Hedberg, linux-kernel,
	Jakub Kicinski, Luiz Augusto von Dentz, netdev, Howard Chung

Add a missing SUSPEND_SCAN_ENABLE in passive scan, remove the separate
function for configuring le scan during suspend and update the request
complete function to clear both enable and disable tasks.

Fixes: dce0a4be8054 ("Bluetooth: Set missing suspend task bits")
Reviewed-by: Alain Michaud <alainm@chromium.org>
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
---

 net/bluetooth/hci_request.c | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index 71bffd745472043..5aa7bd5030a218c 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -1087,6 +1087,8 @@ void hci_req_add_le_passive_scan(struct hci_request *req)
 	if (hdev->suspended) {
 		window = hdev->le_scan_window_suspend;
 		interval = hdev->le_scan_int_suspend;
+
+		set_bit(SUSPEND_SCAN_ENABLE, hdev->suspend_tasks);
 	} else if (hci_is_le_conn_scanning(hdev)) {
 		window = hdev->le_scan_window_connect;
 		interval = hdev->le_scan_int_connect;
@@ -1170,19 +1172,6 @@ static void hci_req_set_event_filter(struct hci_request *req)
 	hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
 }
 
-static void hci_req_config_le_suspend_scan(struct hci_request *req)
-{
-	/* Before changing params disable scan if enabled */
-	if (hci_dev_test_flag(req->hdev, HCI_LE_SCAN))
-		hci_req_add_le_scan_disable(req, false);
-
-	/* Configure params and enable scanning */
-	hci_req_add_le_passive_scan(req);
-
-	/* Block suspend notifier on response */
-	set_bit(SUSPEND_SCAN_ENABLE, req->hdev->suspend_tasks);
-}
-
 static void cancel_adv_timeout(struct hci_dev *hdev)
 {
 	if (hdev->adv_instance_timeout) {
@@ -1245,8 +1234,10 @@ static void suspend_req_complete(struct hci_dev *hdev, u8 status, u16 opcode)
 {
 	bt_dev_dbg(hdev, "Request complete opcode=0x%x, status=0x%x", opcode,
 		   status);
-	if (test_and_clear_bit(SUSPEND_SCAN_ENABLE, hdev->suspend_tasks) ||
-	    test_and_clear_bit(SUSPEND_SCAN_DISABLE, hdev->suspend_tasks)) {
+	if (test_bit(SUSPEND_SCAN_ENABLE, hdev->suspend_tasks) ||
+	    test_bit(SUSPEND_SCAN_DISABLE, hdev->suspend_tasks)) {
+		clear_bit(SUSPEND_SCAN_ENABLE, hdev->suspend_tasks);
+		clear_bit(SUSPEND_SCAN_DISABLE, hdev->suspend_tasks);
 		wake_up(&hdev->suspend_wait_q);
 	}
 }
@@ -1336,7 +1327,7 @@ void hci_req_prepare_suspend(struct hci_dev *hdev, enum suspended_state next)
 		/* Enable event filter for paired devices */
 		hci_req_set_event_filter(&req);
 		/* Enable passive scan at lower duty cycle */
-		hci_req_config_le_suspend_scan(&req);
+		__hci_update_background_scan(&req);
 		/* Pause scan changes again. */
 		hdev->scanning_paused = true;
 		hci_req_run(&req, suspend_req_complete);
@@ -1346,7 +1337,7 @@ void hci_req_prepare_suspend(struct hci_dev *hdev, enum suspended_state next)
 
 		hci_req_clear_event_filter(&req);
 		/* Reset passive/background scanning to normal */
-		hci_req_config_le_suspend_scan(&req);
+		__hci_update_background_scan(&req);
 
 		/* Unpause directed advertising */
 		hdev->advertising_paused = false;
-- 
2.29.2.576.ga3fc446d84-goog


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

* RE: Bluetooth: Further improvements for suspend tasks
  2020-12-08  0:12 ` [PATCH 1/1] Bluetooth: Remove hci_req_le_suspend_config Abhishek Pandit-Subedi
@ 2020-12-08  1:48   ` bluez.test.bot
  2020-12-18 21:27   ` [PATCH 1/1] Bluetooth: Remove hci_req_le_suspend_config Marcel Holtmann
  1 sibling, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2020-12-08  1:48 UTC (permalink / raw)
  To: linux-bluetooth, abhishekpandit

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

---Test result---

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

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuildK - PASS



---
Regards,
Linux Bluetooth


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

* Re: [PATCH 1/1] Bluetooth: Remove hci_req_le_suspend_config
  2020-12-08  0:12 ` [PATCH 1/1] Bluetooth: Remove hci_req_le_suspend_config Abhishek Pandit-Subedi
  2020-12-08  1:48   ` Bluetooth: Further improvements for suspend tasks bluez.test.bot
@ 2020-12-18 21:27   ` Marcel Holtmann
  1 sibling, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2020-12-18 21:27 UTC (permalink / raw)
  To: Abhishek Pandit-Subedi
  Cc: linux-bluetooth, CrosBT Upstreaming, Alain Michaud,
	David S. Miller, Johan Hedberg, LKML, Jakub Kicinski,
	Luiz Augusto von Dentz, netdev, Howard Chung

Hi Abhishek,

> Add a missing SUSPEND_SCAN_ENABLE in passive scan, remove the separate
> function for configuring le scan during suspend and update the request
> complete function to clear both enable and disable tasks.
> 
> Fixes: dce0a4be8054 ("Bluetooth: Set missing suspend task bits")
> Reviewed-by: Alain Michaud <alainm@chromium.org>
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> ---
> 
> net/bluetooth/hci_request.c | 25 ++++++++-----------------
> 1 file changed, 8 insertions(+), 17 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08  0:12 [PATCH 0/1] Bluetooth: Further improvements for suspend tasks Abhishek Pandit-Subedi
2020-12-08  0:12 ` [PATCH 1/1] Bluetooth: Remove hci_req_le_suspend_config Abhishek Pandit-Subedi
2020-12-08  1:48   ` Bluetooth: Further improvements for suspend tasks bluez.test.bot
2020-12-18 21:27   ` [PATCH 1/1] Bluetooth: Remove hci_req_le_suspend_config 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.