2020-04-23 14:44:48

by Alain Michaud

[permalink] [raw]
Subject: [PATCH v3 0/3] bluetooth:Adding driver and quirk defs for multi-role LE

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


2020-04-23 14:44:51

by Alain Michaud

[permalink] [raw]
Subject: [PATCH v3 1/3] bluetooth:Adding driver and quirk defs for multi-role LE

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 <[email protected]>
---

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

2020-04-23 14:44:53

by Alain Michaud

[permalink] [raw]
Subject: [PATCH v3 2/3] bluetooth:allow scatternet connections if supported.

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 <[email protected]>
---

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

2020-04-23 14:45:19

by Alain Michaud

[permalink] [raw]
Subject: [PATCH v3 3/3] bluetooth:btusb: Adding support for LE scatternet to Jfp and ThP

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

Signed-off-by: Alain Michaud <[email protected]>
---

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

2020-04-27 14:55:28

by Alain Michaud

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] bluetooth:Adding driver and quirk defs for multi-role LE

Friendly ping on these series.


On Thu, Apr 23, 2020 at 10:43 AM Alain Michaud <[email protected]> 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
>

2020-04-28 09:30:21

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] bluetooth:Adding driver and quirk defs for multi-role LE

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 <[email protected]>
> ---
>
> 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