linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle
@ 2021-01-27 17:17 Miao-chen Chou
  2021-01-27 17:45 ` [v4] " bluez.test.bot
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Miao-chen Chou @ 2021-01-27 17:17 UTC (permalink / raw)
  To: Bluetooth Kernel Mailing List
  Cc: Alain Michaud, Archie Pusaka, Luiz Augusto von Dentz,
	Marcel Holtmann, Miao-chen Chou, Abhishek Pandit-Subedi,
	David S. Miller, Johan Hedberg, linux-kernel, netdev

This moves msft_do_close() from hci_dev_do_close() to
hci_unregister_dev() to avoid clearing MSFT extension info. This also
re-reads MSFT info upon every msft_do_open() even if MSFT extension has
been initialized.

The following test steps were performed.
(1) boot the test device and verify the MSFT support debug log in syslog
(2) restart bluetoothd and verify msft_do_close() doesn't get invoked
    and msft_do_open re-reads the MSFT support.

Signed-off-by: Miao-chen Chou <mcchou@chromium.org>
Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Reviewed-by: Archie Pusaka <apusaka@chromium.org>
Reviewed-by: Alain Michaud <alainm@chromium.org>
---

Changes in v4:
- Re-read the MSFT data instead of skipping if it's initiated already

Changes in v3:
- Remove the accepted commits from the series

 net/bluetooth/hci_core.c |  4 ++--
 net/bluetooth/msft.c     | 21 ++++++++++++++++++---
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index eeafed2efc0da..8056f0d4ae172 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1764,8 +1764,6 @@ int hci_dev_do_close(struct hci_dev *hdev)
 
 	hci_sock_dev_event(hdev, HCI_DEV_DOWN);
 
-	msft_do_close(hdev);
-
 	if (hdev->flush)
 		hdev->flush(hdev);
 
@@ -3844,6 +3842,8 @@ void hci_unregister_dev(struct hci_dev *hdev)
 	unregister_pm_notifier(&hdev->suspend_notifier);
 	cancel_work_sync(&hdev->suspend_prepare);
 
+	msft_do_close(hdev);
+
 	hci_dev_do_close(hdev);
 
 	if (!test_bit(HCI_INIT, &hdev->flags) &&
diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index 8579bfeb28364..4465d018280eb 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -73,16 +73,31 @@ static bool read_supported_features(struct hci_dev *hdev,
 
 void msft_do_open(struct hci_dev *hdev)
 {
-	struct msft_data *msft;
+	struct msft_data *msft = NULL;
 
 	if (hdev->msft_opcode == HCI_OP_NOP)
 		return;
 
 	bt_dev_dbg(hdev, "Initialize MSFT extension");
 
-	msft = kzalloc(sizeof(*msft), GFP_KERNEL);
-	if (!msft)
+	/* If MSFT data exists, reset its members */
+	if (hdev->msft_data) {
+		msft = hdev->msft_data;
+		hdev->msft_data = NULL;
+
+		msft->features = 0;
+		kfree(msft->evt_prefix);
+		msft->evt_prefix = NULL;
+		msft->evt_prefix_len = 0;
+
+	} else {
+		msft = kzalloc(sizeof(*msft), GFP_KERNEL);
+	}
+
+	if (!msft) {
+		bt_dev_err(hdev, "Failed to init MSFT extension");
 		return;
+	}
 
 	if (!read_supported_features(hdev, msft)) {
 		kfree(msft);
-- 
2.30.0.280.ga3ce27912f-goog


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

* RE: [v4] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle
  2021-01-27 17:17 [PATCH v4] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle Miao-chen Chou
@ 2021-01-27 17:45 ` bluez.test.bot
  2021-01-27 22:10 ` bluez.test.bot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2021-01-27 17:45 UTC (permalink / raw)
  To: linux-bluetooth, mcchou

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

---Test result---

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

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

Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle
1: T1 Title exceeds max length (92>72): "Merge a765f0572ed42889469140e621fbcd6c17ed295b into 1fd5d8d67a1e56ef9fde78a8c972ba2ff9f42de4"
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 - PASS
    Total: 416, Passed: 400 (96.2%), Failed: 0, 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: 43340 bytes --]

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

[-- Attachment #4: mgmt-tester.log --]
[-- Type: application/octet-stream, Size: 546230 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] 5+ messages in thread

* RE: [v4] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle
  2021-01-27 17:17 [PATCH v4] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle Miao-chen Chou
  2021-01-27 17:45 ` [v4] " bluez.test.bot
@ 2021-01-27 22:10 ` bluez.test.bot
  2021-02-12  1:32 ` [PATCH v4] " Miao-chen Chou
  2021-02-26 20:23 ` Marcel Holtmann
  3 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2021-01-27 22:10 UTC (permalink / raw)
  To: linux-bluetooth, mcchou

[-- 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=423081

---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 - PASS
    Total: 416, Passed: 400 (96.2%), Failed: 0, 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: 43341 bytes --]

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

[-- Attachment #4: mgmt-tester.log --]
[-- Type: application/octet-stream, Size: 546230 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: 5430 bytes --]

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

* Re: [PATCH v4] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle
  2021-01-27 17:17 [PATCH v4] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle Miao-chen Chou
  2021-01-27 17:45 ` [v4] " bluez.test.bot
  2021-01-27 22:10 ` bluez.test.bot
@ 2021-02-12  1:32 ` Miao-chen Chou
  2021-02-26 20:23 ` Marcel Holtmann
  3 siblings, 0 replies; 5+ messages in thread
From: Miao-chen Chou @ 2021-02-12  1:32 UTC (permalink / raw)
  To: Bluetooth Kernel Mailing List
  Cc: Alain Michaud, Archie Pusaka, Luiz Augusto von Dentz,
	Marcel Holtmann, Abhishek Pandit-Subedi, David S. Miller,
	Johan Hedberg, LKML, netdev

Hi Marcel,

A friendly ping on this patch. :)

Regards,
Miao

On Wed, Jan 27, 2021 at 9:17 AM Miao-chen Chou <mcchou@chromium.org> wrote:
>
> This moves msft_do_close() from hci_dev_do_close() to
> hci_unregister_dev() to avoid clearing MSFT extension info. This also
> re-reads MSFT info upon every msft_do_open() even if MSFT extension has
> been initialized.
>
> The following test steps were performed.
> (1) boot the test device and verify the MSFT support debug log in syslog
> (2) restart bluetoothd and verify msft_do_close() doesn't get invoked
>     and msft_do_open re-reads the MSFT support.
>
> Signed-off-by: Miao-chen Chou <mcchou@chromium.org>
> Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> Reviewed-by: Archie Pusaka <apusaka@chromium.org>
> Reviewed-by: Alain Michaud <alainm@chromium.org>
> ---
>
> Changes in v4:
> - Re-read the MSFT data instead of skipping if it's initiated already
>
> Changes in v3:
> - Remove the accepted commits from the series
>
>  net/bluetooth/hci_core.c |  4 ++--
>  net/bluetooth/msft.c     | 21 ++++++++++++++++++---
>  2 files changed, 20 insertions(+), 5 deletions(-)
>
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index eeafed2efc0da..8056f0d4ae172 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -1764,8 +1764,6 @@ int hci_dev_do_close(struct hci_dev *hdev)
>
>         hci_sock_dev_event(hdev, HCI_DEV_DOWN);
>
> -       msft_do_close(hdev);
> -
>         if (hdev->flush)
>                 hdev->flush(hdev);
>
> @@ -3844,6 +3842,8 @@ void hci_unregister_dev(struct hci_dev *hdev)
>         unregister_pm_notifier(&hdev->suspend_notifier);
>         cancel_work_sync(&hdev->suspend_prepare);
>
> +       msft_do_close(hdev);
> +
>         hci_dev_do_close(hdev);
>
>         if (!test_bit(HCI_INIT, &hdev->flags) &&
> diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
> index 8579bfeb28364..4465d018280eb 100644
> --- a/net/bluetooth/msft.c
> +++ b/net/bluetooth/msft.c
> @@ -73,16 +73,31 @@ static bool read_supported_features(struct hci_dev *hdev,
>
>  void msft_do_open(struct hci_dev *hdev)
>  {
> -       struct msft_data *msft;
> +       struct msft_data *msft = NULL;
>
>         if (hdev->msft_opcode == HCI_OP_NOP)
>                 return;
>
>         bt_dev_dbg(hdev, "Initialize MSFT extension");
>
> -       msft = kzalloc(sizeof(*msft), GFP_KERNEL);
> -       if (!msft)
> +       /* If MSFT data exists, reset its members */
> +       if (hdev->msft_data) {
> +               msft = hdev->msft_data;
> +               hdev->msft_data = NULL;
> +
> +               msft->features = 0;
> +               kfree(msft->evt_prefix);
> +               msft->evt_prefix = NULL;
> +               msft->evt_prefix_len = 0;
> +
> +       } else {
> +               msft = kzalloc(sizeof(*msft), GFP_KERNEL);
> +       }
> +
> +       if (!msft) {
> +               bt_dev_err(hdev, "Failed to init MSFT extension");
>                 return;
> +       }
>
>         if (!read_supported_features(hdev, msft)) {
>                 kfree(msft);
> --
> 2.30.0.280.ga3ce27912f-goog
>

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

* Re: [PATCH v4] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle
  2021-01-27 17:17 [PATCH v4] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle Miao-chen Chou
                   ` (2 preceding siblings ...)
  2021-02-12  1:32 ` [PATCH v4] " Miao-chen Chou
@ 2021-02-26 20:23 ` Marcel Holtmann
  3 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2021-02-26 20:23 UTC (permalink / raw)
  To: Miao-chen Chou
  Cc: Bluetooth Kernel Mailing List, Alain Michaud, Archie Pusaka,
	Luiz Augusto von Dentz, Abhishek Pandit-Subedi, David S. Miller,
	Johan Hedberg, LKML, netdev

Hi Miao-chen,

> This moves msft_do_close() from hci_dev_do_close() to
> hci_unregister_dev() to avoid clearing MSFT extension info. This also
> re-reads MSFT info upon every msft_do_open() even if MSFT extension has
> been initialized.
> 
> The following test steps were performed.
> (1) boot the test device and verify the MSFT support debug log in syslog
> (2) restart bluetoothd and verify msft_do_close() doesn't get invoked
>    and msft_do_open re-reads the MSFT support.
> 
> Signed-off-by: Miao-chen Chou <mcchou@chromium.org>
> Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> Reviewed-by: Archie Pusaka <apusaka@chromium.org>
> Reviewed-by: Alain Michaud <alainm@chromium.org>
> ---
> 
> Changes in v4:
> - Re-read the MSFT data instead of skipping if it's initiated already
> 
> Changes in v3:
> - Remove the accepted commits from the series
> 
> net/bluetooth/hci_core.c |  4 ++--
> net/bluetooth/msft.c     | 21 ++++++++++++++++++---
> 2 files changed, 20 insertions(+), 5 deletions(-)

can you please re-base this against bluetooth-next tree since it no longer applies cleanly. Thanks.

Regards

Marcel


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

end of thread, other threads:[~2021-02-26 20:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-27 17:17 [PATCH v4] Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle Miao-chen Chou
2021-01-27 17:45 ` [v4] " bluez.test.bot
2021-01-27 22:10 ` bluez.test.bot
2021-02-12  1:32 ` [PATCH v4] " Miao-chen Chou
2021-02-26 20:23 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).