Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Bluetooth: msft: add a bluetooth parameter, msft_enable
@ 2021-08-12  4:23 Koba Ko
  2021-08-12  5:29 ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: Koba Ko @ 2021-08-12  4:23 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	David S. Miller, Jakub Kicinski, linux-bluetooth, netdev,
	linux-kernel, apusaka

With Intel AC9560, follow this scenario and can't turn on bt since.
1. turn off BT
2. then suspend&resume multiple times
3. turn on BT

Get this error message after turn on bt.
[ 877.194032] Bluetooth: hci0: urb 0000000061b9a002 failed to resubmit (113)
[ 886.941327] Bluetooth: hci0: Failed to read MSFT supported features (-110)

Remove msft from compilation would be helpful.
Turn off msft would be also helpful.

Because msft is enabled as default and can't turn off without
compliation,
Introduce a bluetooth parameter, msft_enable, to control.

Signed-off-by: Koba Ko <koba.ko@canonical.com>
---
 include/net/bluetooth/hci_core.h |  1 +
 net/bluetooth/hci_core.c         | 16 ++++++++++++++++
 net/bluetooth/msft.c             | 30 +++++++++++++++++++++++++++++-
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index a7d06d7da602..002753db936a 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1229,6 +1229,7 @@ static inline void *hci_get_priv(struct hci_dev *hdev)
 	return (char *)hdev + sizeof(*hdev);
 }
 
+void hci_set_msft(bool enable);
 struct hci_dev *hci_dev_get(int index);
 struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src, u8 src_type);
 
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index cb2e9e513907..9e1bdaea20a8 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1045,6 +1045,22 @@ static int hci_linkpol_req(struct hci_request *req, unsigned long opt)
 	return 0;
 }
 
+void hci_set_msft(bool enable)
+{
+	struct hci_dev *hdev = NULL, *d;
+
+	read_lock(&hci_dev_list_lock);
+	list_for_each_entry(d, &hci_dev_list, list) {
+		hdev = hci_dev_hold(d);
+		if (enable)
+			msft_do_open(hdev);
+		else
+			msft_do_close(hdev);
+		hci_dev_put(hdev);
+	}
+	read_unlock(&hci_dev_list_lock);
+}
+
 /* Get HCI device by index.
  * Device is held on return. */
 struct hci_dev *hci_dev_get(int index)
diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index b4bfae41e8a5..0bb50ee11bf8 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -97,6 +97,34 @@ struct msft_data {
 	__u8 filter_enabled;
 };
 
+static bool msft_enable = true;
+
+static int msft_set_enable(const char *s, const struct kernel_param *kp)
+{
+	bool do_enable;
+	int ret;
+
+	if (!s)
+		return 0;
+
+	ret = strtobool(s, &do_enable);
+	if (ret || msft_enable == do_enable)
+		return ret;
+
+	hci_set_msft(do_enable);
+
+	msft_enable = do_enable;
+
+	return ret;
+}
+
+static const struct kernel_param_ops msft_enable_ops = {
+	.set = msft_set_enable,
+	.get = param_get_bool,
+};
+
+module_param_cb(msft_enable, &msft_enable_ops, &msft_enable, 0644);
+
 static int __msft_add_monitor_pattern(struct hci_dev *hdev,
 				      struct adv_monitor *monitor);
 
@@ -186,7 +214,7 @@ void msft_do_open(struct hci_dev *hdev)
 {
 	struct msft_data *msft;
 
-	if (hdev->msft_opcode == HCI_OP_NOP)
+	if (!msft_enable || hdev->msft_opcode == HCI_OP_NOP)
 		return;
 
 	bt_dev_dbg(hdev, "Initialize MSFT extension");
-- 
2.25.1


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

* Re: [PATCH] Bluetooth: msft: add a bluetooth parameter, msft_enable
  2021-08-12  4:23 [PATCH] Bluetooth: msft: add a bluetooth parameter, msft_enable Koba Ko
@ 2021-08-12  5:29 ` Marcel Holtmann
  2021-08-12  5:37   ` Koba Ko
  0 siblings, 1 reply; 4+ messages in thread
From: Marcel Holtmann @ 2021-08-12  5:29 UTC (permalink / raw)
  To: Koba Ko
  Cc: Johan Hedberg, Luiz Augusto von Dentz, David S. Miller,
	Jakub Kicinski, BlueZ, open list:NETWORKING [GENERAL],
	open list, Archie Pusaka

Hi Koba,

> With Intel AC9560, follow this scenario and can't turn on bt since.
> 1. turn off BT
> 2. then suspend&resume multiple times
> 3. turn on BT
> 
> Get this error message after turn on bt.
> [ 877.194032] Bluetooth: hci0: urb 0000000061b9a002 failed to resubmit (113)
> [ 886.941327] Bluetooth: hci0: Failed to read MSFT supported features (-110)
> 
> Remove msft from compilation would be helpful.
> Turn off msft would be also helpful.
> 
> Because msft is enabled as default and can't turn off without
> compliation,
> Introduce a bluetooth parameter, msft_enable, to control.
> 
> Signed-off-by: Koba Ko <koba.ko@canonical.com>
> ---
> include/net/bluetooth/hci_core.h |  1 +
> net/bluetooth/hci_core.c         | 16 ++++++++++++++++
> net/bluetooth/msft.c             | 30 +++++++++++++++++++++++++++++-
> 3 files changed, 46 insertions(+), 1 deletion(-)

NAK.

This is for the Intel guys to figure out. Otherwise I am going to disable MSFT extension for AC9560 completely. What is your hw_variant for that hardware?

Regards

Marcel


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

* Re: [PATCH] Bluetooth: msft: add a bluetooth parameter, msft_enable
  2021-08-12  5:29 ` Marcel Holtmann
@ 2021-08-12  5:37   ` Koba Ko
  2021-08-12  6:00     ` Koba Ko
  0 siblings, 1 reply; 4+ messages in thread
From: Koba Ko @ 2021-08-12  5:37 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Johan Hedberg, Luiz Augusto von Dentz, David S. Miller,
	Jakub Kicinski, BlueZ, open list:NETWORKING [GENERAL],
	open list, Archie Pusaka

On Thu, Aug 12, 2021 at 1:29 PM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Koba,
>
> > With Intel AC9560, follow this scenario and can't turn on bt since.
> > 1. turn off BT
> > 2. then suspend&resume multiple times
> > 3. turn on BT
> >
> > Get this error message after turn on bt.
> > [ 877.194032] Bluetooth: hci0: urb 0000000061b9a002 failed to resubmit (113)
> > [ 886.941327] Bluetooth: hci0: Failed to read MSFT supported features (-110)
> >
> > Remove msft from compilation would be helpful.
> > Turn off msft would be also helpful.
> >
> > Because msft is enabled as default and can't turn off without
> > compliation,
> > Introduce a bluetooth parameter, msft_enable, to control.
> >
> > Signed-off-by: Koba Ko <koba.ko@canonical.com>
> > ---
> > include/net/bluetooth/hci_core.h |  1 +
> > net/bluetooth/hci_core.c         | 16 ++++++++++++++++
> > net/bluetooth/msft.c             | 30 +++++++++++++++++++++++++++++-
> > 3 files changed, 46 insertions(+), 1 deletion(-)
>
> NAK.
>
> This is for the Intel guys to figure out. Otherwise I am going to disable MSFT extension for AC9560 completely. What is your hw_variant for that hardware?
Would you please guide to dump hw_variant? thanks
>
> Regards
>
> Marcel
>

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

* Re: [PATCH] Bluetooth: msft: add a bluetooth parameter, msft_enable
  2021-08-12  5:37   ` Koba Ko
@ 2021-08-12  6:00     ` Koba Ko
  0 siblings, 0 replies; 4+ messages in thread
From: Koba Ko @ 2021-08-12  6:00 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Johan Hedberg, Luiz Augusto von Dentz, David S. Miller,
	Jakub Kicinski, BlueZ, open list:NETWORKING [GENERAL],
	open list, Archie Pusaka

On Thu, Aug 12, 2021 at 1:37 PM Koba Ko <koba.ko@canonical.com> wrote:
>
> On Thu, Aug 12, 2021 at 1:29 PM Marcel Holtmann <marcel@holtmann.org> wrote:
> >
> > Hi Koba,
> >
> > > With Intel AC9560, follow this scenario and can't turn on bt since.
> > > 1. turn off BT
> > > 2. then suspend&resume multiple times
> > > 3. turn on BT
> > >
> > > Get this error message after turn on bt.
> > > [ 877.194032] Bluetooth: hci0: urb 0000000061b9a002 failed to resubmit (113)
> > > [ 886.941327] Bluetooth: hci0: Failed to read MSFT supported features (-110)
> > >
> > > Remove msft from compilation would be helpful.
> > > Turn off msft would be also helpful.
> > >
> > > Because msft is enabled as default and can't turn off without
> > > compliation,
> > > Introduce a bluetooth parameter, msft_enable, to control.
> > >
> > > Signed-off-by: Koba Ko <koba.ko@canonical.com>
> > > ---
> > > include/net/bluetooth/hci_core.h |  1 +
> > > net/bluetooth/hci_core.c         | 16 ++++++++++++++++
> > > net/bluetooth/msft.c             | 30 +++++++++++++++++++++++++++++-
> > > 3 files changed, 46 insertions(+), 1 deletion(-)
> >
> > NAK.
> >
> > This is for the Intel guys to figure out. Otherwise I am going to disable MSFT extension for AC9560 completely. What is your hw_variant for that hardware?
> Would you please guide to dump hw_variant? thanks
Found it,
Bluetooth: hci0: Found Intel DDC parameters: intel/ibt-19-0-1.ddc


> >
> > Regards
> >
> > Marcel
> >

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

end of thread, other threads:[~2021-08-12  6:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12  4:23 [PATCH] Bluetooth: msft: add a bluetooth parameter, msft_enable Koba Ko
2021-08-12  5:29 ` Marcel Holtmann
2021-08-12  5:37   ` Koba Ko
2021-08-12  6:00     ` Koba Ko

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).