linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] bluetooth:Adding driver and quirk defs for multi-role LE
@ 2020-04-23 14:43 Alain Michaud
  2020-04-23 14:43 ` [PATCH v3 1/3] " Alain Michaud
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Alain Michaud @ 2020-04-23 14:43 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Alain Michaud

This series adds BTUSB and quirk support for the driver to confirm that
the reported LE_states can be trusted.  The quirk will be used to
gradually roll out the feature to supported controllers without
affecting the stability of other controllers.  If all controllers FWs
are fixed or else validated, we can consider removing the quirk over
time.


Alain Michaud (3):
  bluetooth:Adding driver and quirk defs for multi-role LE
  bluetooth:allow scatternet connections if supported.
  bluetooth:btusb: Adding support for LE scatternet to Jfp and ThP

 drivers/bluetooth/btusb.c   | 11 ++++++++---
 include/net/bluetooth/hci.h |  9 +++++++++
 net/bluetooth/hci_event.c   |  4 +++-
 3 files changed, 20 insertions(+), 4 deletions(-)

-- 
2.26.1.301.g55bc3eb7cb9-goog


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

* [PATCH v3 1/3] bluetooth:Adding driver and quirk defs for multi-role LE
  2020-04-23 14:43 [PATCH v3 0/3] bluetooth:Adding driver and quirk defs for multi-role LE Alain Michaud
@ 2020-04-23 14:43 ` Alain Michaud
  2020-04-28  9:29   ` Marcel Holtmann
  2020-04-23 14:43 ` [PATCH v3 2/3] bluetooth:allow scatternet connections if supported Alain Michaud
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Alain Michaud @ 2020-04-23 14:43 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Alain Michaud

This change adds the relevant driver and quirk to allow drivers to
report the le_states as being trustworthy.

This has historically been disabled as controllers did not reliably
support this. In particular, this will be used to relax this condition
for controllers that have been well tested and reliable.

	/* Most controller will fail if we try to create new connections
	 * while we have an existing one in slave role.
	 */
	if (hdev->conn_hash.le_num_slave > 0)
		return NULL;

Signed-off-by: Alain Michaud <alainm@chromium.org>
---

 drivers/bluetooth/btusb.c   | 2 +-
 include/net/bluetooth/hci.h | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 3bdec42c9612..dd27e28d4601 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -58,7 +58,7 @@ static struct usb_driver btusb_driver;
 #define BTUSB_CW6622		0x100000
 #define BTUSB_MEDIATEK		0x200000
 #define BTUSB_WIDEBAND_SPEECH	0x400000
-
+#define BTUSB_VALID_LE_STATES   0x800000
 static const struct usb_device_id btusb_table[] = {
 	/* Generic Bluetooth USB device */
 	{ USB_DEVICE_INFO(0xe0, 0x01, 0x01) },
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 5f60e135aeb6..25c2e5ee81dc 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -214,6 +214,15 @@ enum {
 	 * This quirk must be set before hci_register_dev is called.
 	 */
 	HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED,
+
+	/* When this quirk is set, the controller has validated that
+	 * LE states reported through the HCI_LE_READ_SUPPORTED_STATES are
+	 * valid.  This mechanism is necessary as many controllers have
+	 * been seen has having trouble initiating a connectable
+	 * advertisement despite the state combination being reported as
+	 * supported.
+	 */
+	HCI_QUIRK_VALID_LE_STATES,
 };
 
 /* HCI device flags */
-- 
2.26.1.301.g55bc3eb7cb9-goog


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

* [PATCH v3 2/3] bluetooth:allow scatternet connections if supported.
  2020-04-23 14:43 [PATCH v3 0/3] bluetooth:Adding driver and quirk defs for multi-role LE Alain Michaud
  2020-04-23 14:43 ` [PATCH v3 1/3] " Alain Michaud
@ 2020-04-23 14:43 ` Alain Michaud
  2020-04-23 14:43 ` [PATCH v3 3/3] bluetooth:btusb: Adding support for LE scatternet to Jfp and ThP Alain Michaud
  2020-04-27 14:52 ` [PATCH v3 0/3] bluetooth:Adding driver and quirk defs for multi-role LE Alain Michaud
  3 siblings, 0 replies; 7+ messages in thread
From: Alain Michaud @ 2020-04-23 14:43 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Alain Michaud

This change allows scatternet connections to be created if the
controller reports support and the HCI_QUIRK_VALID_LE_STATES indicates
that the reported LE states can be trusted.

Signed-off-by: Alain Michaud <alainm@chromium.org>
---

 net/bluetooth/hci_event.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 0a591be8b0ae..830688612e05 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -5245,7 +5245,9 @@ static struct hci_conn *check_pending_le_conn(struct hci_dev *hdev,
 	/* Most controller will fail if we try to create new connections
 	 * while we have an existing one in slave role.
 	 */
-	if (hdev->conn_hash.le_num_slave > 0)
+	if (hdev->conn_hash.le_num_slave > 0 &&
+	    (!test_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks) ||
+	     !(hdev->le_states[3] & 0x10)))
 		return NULL;
 
 	/* If we're not connectable only connect devices that we have in
-- 
2.26.1.301.g55bc3eb7cb9-goog


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

* [PATCH v3 3/3] bluetooth:btusb: Adding support for LE scatternet to Jfp and ThP
  2020-04-23 14:43 [PATCH v3 0/3] bluetooth:Adding driver and quirk defs for multi-role LE Alain Michaud
  2020-04-23 14:43 ` [PATCH v3 1/3] " Alain Michaud
  2020-04-23 14:43 ` [PATCH v3 2/3] bluetooth:allow scatternet connections if supported Alain Michaud
@ 2020-04-23 14:43 ` Alain Michaud
  2020-04-27 14:52 ` [PATCH v3 0/3] bluetooth:Adding driver and quirk defs for multi-role LE Alain Michaud
  3 siblings, 0 replies; 7+ messages in thread
From: Alain Michaud @ 2020-04-23 14:43 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Alain Michaud

This change adds support for LE scatternet connections to Intel's JfP
and ThP controllers.

Signed-off-by: Alain Michaud <alainm@chromium.org>
---

 drivers/bluetooth/btusb.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index dd27e28d4601..d801c332b85a 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -335,7 +335,8 @@ static const struct usb_device_id blacklist_table[] = {
 
 	/* Intel Bluetooth devices */
 	{ USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_NEW |
-						     BTUSB_WIDEBAND_SPEECH },
+						     BTUSB_WIDEBAND_SPEECH |
+						     BTUSB_VALID_LE_STATES },
 	{ USB_DEVICE(0x8087, 0x0026), .driver_info = BTUSB_INTEL_NEW |
 						     BTUSB_WIDEBAND_SPEECH },
 	{ USB_DEVICE(0x8087, 0x0029), .driver_info = BTUSB_INTEL_NEW |
@@ -348,7 +349,8 @@ static const struct usb_device_id blacklist_table[] = {
 	{ USB_DEVICE(0x8087, 0x0aa7), .driver_info = BTUSB_INTEL |
 						     BTUSB_WIDEBAND_SPEECH },
 	{ USB_DEVICE(0x8087, 0x0aaa), .driver_info = BTUSB_INTEL_NEW |
-						     BTUSB_WIDEBAND_SPEECH },
+						     BTUSB_WIDEBAND_SPEECH |
+						     BTUSB_VALID_LE_STATES },
 
 	/* Other Intel Bluetooth devices */
 	{ USB_VENDOR_AND_INTERFACE_INFO(0x8087, 0xe0, 0x01, 0x01),
@@ -3877,6 +3879,9 @@ static int btusb_probe(struct usb_interface *intf,
 	if (id->driver_info & BTUSB_WIDEBAND_SPEECH)
 		set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks);
 
+	if (id->driver_info & BTUSB_VALID_LE_STATES)
+		set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
+
 	if (id->driver_info & BTUSB_DIGIANSWER) {
 		data->cmdreq_type = USB_TYPE_VENDOR;
 		set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks);
-- 
2.26.1.301.g55bc3eb7cb9-goog


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

* Re: [PATCH v3 0/3] bluetooth:Adding driver and quirk defs for multi-role LE
  2020-04-23 14:43 [PATCH v3 0/3] bluetooth:Adding driver and quirk defs for multi-role LE Alain Michaud
                   ` (2 preceding siblings ...)
  2020-04-23 14:43 ` [PATCH v3 3/3] bluetooth:btusb: Adding support for LE scatternet to Jfp and ThP Alain Michaud
@ 2020-04-27 14:52 ` Alain Michaud
  3 siblings, 0 replies; 7+ messages in thread
From: Alain Michaud @ 2020-04-27 14:52 UTC (permalink / raw)
  To: Alain Michaud; +Cc: BlueZ

Friendly ping on these series.


On Thu, Apr 23, 2020 at 10:43 AM Alain Michaud <alainm@chromium.org> wrote:
>
> This series adds BTUSB and quirk support for the driver to confirm that
> the reported LE_states can be trusted.  The quirk will be used to
> gradually roll out the feature to supported controllers without
> affecting the stability of other controllers.  If all controllers FWs
> are fixed or else validated, we can consider removing the quirk over
> time.
>
>
> Alain Michaud (3):
>   bluetooth:Adding driver and quirk defs for multi-role LE
>   bluetooth:allow scatternet connections if supported.
>   bluetooth:btusb: Adding support for LE scatternet to Jfp and ThP
>
>  drivers/bluetooth/btusb.c   | 11 ++++++++---
>  include/net/bluetooth/hci.h |  9 +++++++++
>  net/bluetooth/hci_event.c   |  4 +++-
>  3 files changed, 20 insertions(+), 4 deletions(-)
>
> --
> 2.26.1.301.g55bc3eb7cb9-goog
>

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

* Re: [PATCH v3 1/3] bluetooth:Adding driver and quirk defs for multi-role LE
  2020-04-23 14:43 ` [PATCH v3 1/3] " Alain Michaud
@ 2020-04-28  9:29   ` Marcel Holtmann
  0 siblings, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2020-04-28  9:29 UTC (permalink / raw)
  To: Alain Michaud; +Cc: linux-bluetooth

Hi Alain,

> This change adds the relevant driver and quirk to allow drivers to
> report the le_states as being trustworthy.
> 
> This has historically been disabled as controllers did not reliably
> support this. In particular, this will be used to relax this condition
> for controllers that have been well tested and reliable.
> 
> 	/* Most controller will fail if we try to create new connections
> 	 * while we have an existing one in slave role.
> 	 */
> 	if (hdev->conn_hash.le_num_slave > 0)
> 		return NULL;
> 
> Signed-off-by: Alain Michaud <alainm@chromium.org>
> ---
> 
> drivers/bluetooth/btusb.c   | 2 +-
> include/net/bluetooth/hci.h | 9 +++++++++
> 2 files changed, 10 insertions(+), 1 deletion(-)

all 3 patches have been applied to bluetooth-next tree.

Regards

Marcel


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

* [PATCH v3 0/3] bluetooth:Adding driver and quirk defs for multi-role LE
@ 2020-04-21 15:59 Alain Michaud
  0 siblings, 0 replies; 7+ messages in thread
From: Alain Michaud @ 2020-04-21 15:59 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Alain Michaud

This series adds BTUSB and quirk support for the driver to confirm that
the reported LE_states can be trusted.  The quirk will be used to
gradually roll out the feature to supported controllers without
affecting the stability of other controllers.  If all controllers FWs
are fixed or else validated, we can consider removing the quirk over
time.

Alain Michaud (3):
  bluetooth:Adding driver and quirk defs for multi-role LE
  bluetooth:allow scatternet connections if supported.
  bluetooth:btusb: Adding support for LE scatternet to Jfp and ThP

 drivers/bluetooth/btusb.c   | 11 ++++++++---
 include/net/bluetooth/hci.h |  9 +++++++++
 net/bluetooth/hci_event.c   |  4 +++-
 3 files changed, 20 insertions(+), 4 deletions(-)

-- 
2.26.1.301.g55bc3eb7cb9-goog


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

end of thread, other threads:[~2020-04-28  9:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-23 14:43 [PATCH v3 0/3] bluetooth:Adding driver and quirk defs for multi-role LE Alain Michaud
2020-04-23 14:43 ` [PATCH v3 1/3] " Alain Michaud
2020-04-28  9:29   ` Marcel Holtmann
2020-04-23 14:43 ` [PATCH v3 2/3] bluetooth:allow scatternet connections if supported Alain Michaud
2020-04-23 14:43 ` [PATCH v3 3/3] bluetooth:btusb: Adding support for LE scatternet to Jfp and ThP Alain Michaud
2020-04-27 14:52 ` [PATCH v3 0/3] bluetooth:Adding driver and quirk defs for multi-role LE Alain Michaud
  -- strict thread matches above, loose matches on Subject: below --
2020-04-21 15:59 Alain Michaud

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