Skip to contentSkip to conversation

Bluetooth: btrtl: Shorten HCI_OP_RESET timeout

PATCH In review Hilda Wu 2 participants 3 messages Sep 27, 2024 – Oct 1, 2024 Bluetooth drivers

lore
Share & tools
lore

Hilda Wu

author
#0 lore raw

PATCH 1/1 Bluetooth: btrtl: Shorten HCI_OP_RESET timeout

Shorten the timeout for the HCI Reset on shutdown.

---
 drivers/bluetooth/btrtl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btrtl.c +1 -1
index 2d95b3ea046d..7128a8a0ba25 100644
@@ -1371,7 +1371,7 @@ int btrtl_shutdown_realtek(struct hci_dev *hdev)
 	/* According to the vendor driver, BT must be reset on close to avoid
 	 * firmware crash.
 	 */
-	skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
+	skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_CMD_TIMEOUT);
 	if (IS_ERR(skb)) {
 		ret = PTR_ERR(skb);
 		bt_dev_err(hdev, "HCI reset during shutdown failed");
Signature · 1 line
2.34.1
#1 lore raw

Dear Hilda,

Thank you for your patch.

Am 27.09.24 um 08:41 schrieb Hilda Wu:

Quoted 1 line

Shorten the timeout for the HCI Reset on shutdown.

Why? It’d be great if you elaborated, and documented how to reproduce the problem.

What is the old and new timeout value? For the git commit message summary, maybe use:

Bluetooth: btrtl: Decrease HCI_OP_RESET timeout from x ms to y ms

Quoted 10 lines
---
  drivers/bluetooth/btrtl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btrtl.c +0 -0
index 2d95b3ea046d..7128a8a0ba25 100644

drivers/bluetooth/btrtl.c int btrtl_shutdown_realtek(struct hci_dev *hdev) · line 1377

Quoted 8 lines
drivers/bluetooth/btrtl.c +1 -1
@@ -1371,7 +1371,7 @@ int btrtl_shutdown_realtek(struct hci_dev *hdev)
  	/* According to the vendor driver, BT must be reset on close to avoid
  	 * firmware crash.
  	 */
-	skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
+	skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_CMD_TIMEOUT);
  	if (IS_ERR(skb)) {
  		ret = PTR_ERR(skb);
  		bt_dev_err(hdev, "HCI reset during shutdown failed");

Kind regards,

Paul

author
#2 lore raw

Hi Paul,

Thank you for your opinion.
I just modified the commit message summary and sent v2. Please check the following comment.
Thanks again.

Regards,
Hilda

-----Original Message-----
From: Paul Menzel <[email protected]>
Sent: Friday, September 27, 2024 2:48 PM
To: Hilda Wu <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Max Chou <[email protected]>; KidmanLee <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] Bluetooth: btrtl: Shorten HCI_OP_RESET timeout

External mail.

Dear Hilda,

Thank you for your patch.

Am 27.09.24 um 08:41 schrieb Hilda Wu:

Quoted 1 line

Shorten the timeout for the HCI Reset on shutdown.

Why? It’d be great if you elaborated, and documented how to reproduce the problem.

Actually, this patch is not for fix something happen, but a prevention.
Let upper layer stack reduce the expected waiting time, for preventing stack daemon be blocked by the socket close if this could happen.

What is the old and new timeout value? For the git commit message summary, maybe use:

Add changes.

Bluetooth: btrtl: Decrease HCI_OP_RESET timeout from x ms to y ms

Add changes.

Quoted 10 lines
---
  drivers/bluetooth/btrtl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btrtl.c +0 -0
index 2d95b3ea046d..7128a8a0ba25 100644

drivers/bluetooth/btrtl.c int btrtl_shutdown_realtek(struct hci_dev *hdev) · line 1377

Quoted 9 lines
drivers/bluetooth/btrtl.c +2 -1
@@ -1371,7 +1371,7 @@ int btrtl_shutdown_realtek(struct hci_dev *hdev)
      /* According to the vendor driver, BT must be reset on close to avoid
       * firmware crash.
       */
-     skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
+     skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, 
+ HCI_CMD_TIMEOUT);
      if (IS_ERR(skb)) {
              ret = PTR_ERR(skb);
              bt_dev_err(hdev, "HCI reset during shutdown failed");

Kind regards,

Paul