Skip to contentSkip to conversation

Bluetooth: HCI: Introduce HCI_QUIRK_BROKEN_LE_CODED

PATCH Superseded Luiz Augusto von Dentz 4 participants 8 messages Aug 22, 2023 – Aug 24, 2023

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: HCI: Introduce HCI_QUIRK_BROKEN_LE_CODED

From: Luiz Augusto von Dentz <[email protected]>

This introduces HCI_QUIRK_BROKEN_LE_CODED is is used to indicate that LE Coded PHY shall not be used, it is then set for some Intel models that claims to support it but when used causes many problems.

---
 drivers/bluetooth/btintel.c      |  2 ++
 include/net/bluetooth/hci.h      | 10 ++++++++++
 include/net/bluetooth/hci_core.h |  4 +++-
 3 files changed, 15 insertions(+), 1 deletion(-)
drivers/bluetooth/btintel.c +2 -0
index 9b239ce96fa4..3ed60b2b0340 100644
@@ -2776,6 +2776,8 @@ static int btintel_setup_combined(struct hci_dev *hdev)
 		case 0x11:      /* JfP */
 		case 0x12:      /* ThP */
 		case 0x13:      /* HrP */
+			set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks);
+			fallthrough;
 		case 0x14:      /* CcP */
 			set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
 			fallthrough;
include/net/bluetooth/hci.h +10 -0
index c58425d4c592..767921d7f5c1 100644
@@ -319,6 +319,16 @@ enum {
 	 * This quirk must be set before hci_register_dev is called.
 	 */
 	HCI_QUIRK_USE_MSFT_EXT_ADDRESS_FILTER,
+
+	/*
+	 * When this quirk is set, LE Coded PHY is shall not be used. This is
+	 * required for some Intel controllers which erroneously claim to
+	 * support it but it causes problems with extended scanning.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_LE_CODED,
 };
 
 /* HCI device flags */
include/net/bluetooth/hci_core.h +3 -1
index 6e2988b11f99..e6359f7346f1 100644
@@ -1817,7 +1817,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
 #define scan_2m(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_2M) || \
 		      ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_2M))
 
-#define le_coded_capable(dev) (((dev)->le_features[1] & HCI_LE_PHY_CODED))
+#define le_coded_capable(dev) (((dev)->le_features[1] & HCI_LE_PHY_CODED) && \
+			       !test_bit(HCI_QUIRK_BROKEN_LE_CODED, \
+					 &(dev)->quirks))
 
 #define scan_coded(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_CODED) || \
 			 ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_CODED))
Signature · 1 line
2.41.0
#1 lore raw

[CC: +Bruno]

Dear Luiz,

Thank you for the patch.

Am 22.08.23 um 21:14 schrieb Luiz Augusto von Dentz:

Quoted 3 lines

From: Luiz Augusto von Dentz <[email protected]>

This introduces HCI_QUIRK_BROKEN_LE_CODED is is used to indicate that

…. It is used …

Quoted 2 lines

LE Coded PHY shall not be used, it is then set for some Intel models that claims to support it but when used causes many problems.

that claim to …

Quoted 29 lines
---
  drivers/bluetooth/btintel.c      |  2 ++
  include/net/bluetooth/hci.h      | 10 ++++++++++
  include/net/bluetooth/hci_core.h |  4 +++-
  3 files changed, 15 insertions(+), 1 deletion(-)
drivers/bluetooth/btintel.c +2 -0
index 9b239ce96fa4..3ed60b2b0340 100644
@@ -2776,6 +2776,8 @@ static int btintel_setup_combined(struct hci_dev *hdev)
  		case 0x11:      /* JfP */
  		case 0x12:      /* ThP */
  		case 0x13:      /* HrP */
+			set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks);
+			fallthrough;
  		case 0x14:      /* CcP */
  			set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
  			fallthrough;
include/net/bluetooth/hci.h +0 -0
index c58425d4c592..767921d7f5c1 100644

include/net/bluetooth/hci.h enum { · line 324

Quoted 6 lines
include/net/bluetooth/hci.h +3 -0
@@ -319,6 +319,16 @@ enum {
  	 * This quirk must be set before hci_register_dev is called.
  	 */
  	HCI_QUIRK_USE_MSFT_EXT_ADDRESS_FILTER,
+
+	/*
+	 * When this quirk is set, LE Coded PHY is shall not be used. This is

s/is shall/shall/

Quoted 15 lines
include/net/bluetooth/hci.h +7 -0
+	 * required for some Intel controllers which erroneously claim to
+	 * support it but it causes problems with extended scanning.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_LE_CODED,
  };
 
  /* HCI device flags */
include/net/bluetooth/hci_core.h +0 -0
index 6e2988b11f99..e6359f7346f1 100644

include/net/bluetooth/hci_core.h void hci_conn_del_sysfs(struct hci_conn *conn); · line 1825

Quoted 10 lines
include/net/bluetooth/hci_core.h +3 -1
@@ -1817,7 +1817,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
  #define scan_2m(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_2M) || \
  		      ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_2M))
 
-#define le_coded_capable(dev) (((dev)->le_features[1] & HCI_LE_PHY_CODED))
+#define le_coded_capable(dev) (((dev)->le_features[1] & HCI_LE_PHY_CODED) && \
+			       !test_bit(HCI_QUIRK_BROKEN_LE_CODED, \
+					 &(dev)->quirks))
 
  #define scan_coded(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_CODED) || \
  			 ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_CODED))

Will this be future proof, once firmware for the broken controllers are fixed?

Kind regards,

Paul

#7 lore raw
In reply to Luiz Augusto von Dentz

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=778336

---Test result---

Test Summary:

CheckPatch                    FAIL      1.31 seconds
GitLint                       FAIL      0.61 seconds
SubjectPrefix                 PASS      0.14 seconds
BuildKernel                   PASS      33.22 seconds
CheckAllWarning               PASS      36.40 seconds
CheckSparse                   PASS      41.61 seconds
CheckSmatch                   PASS      113.71 seconds
BuildKernel32                 PASS      32.12 seconds
TestRunnerSetup               PASS      500.59 seconds
TestRunner_l2cap-tester       PASS      28.88 seconds
TestRunner_iso-tester         PASS      52.09 seconds
TestRunner_bnep-tester        PASS      11.46 seconds
TestRunner_mgmt-tester        PASS      227.05 seconds
TestRunner_rfcomm-tester      PASS      17.28 seconds
TestRunner_sco-tester         PASS      20.68 seconds
TestRunner_ioctl-tester       PASS      19.46 seconds
TestRunner_mesh-tester        PASS      14.52 seconds
TestRunner_smp-tester         PASS      15.55 seconds
TestRunner_userchan-tester    PASS      12.10 seconds
IncrementalBuild              PASS      30.68 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
Bluetooth: HCI: Introduce HCI_QUIRK_BROKEN_LE_CODED
WARNING: Possible repeated word: 'is'
#81:
This introduces HCI_QUIRK_BROKEN_LE_CODED is is used to indicate that

total: 0 errors, 1 warnings, 34 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13361346.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
Bluetooth: HCI: Introduce HCI_QUIRK_BROKEN_LE_CODED

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
11: B1 Line exceeds max length (116>80): "Link: https://lore.kernel.org/linux-bluetooth/CABBYNZKco-v7wkjHHexxQbgwwSz-S=GZ=dZKbRE1qxT1h4fFbQ@mail.gmail.com/T/#"

---
Regards,
Linux Bluetooth

author maintainer
#2 lore raw
In reply to Paul Menzel

Hi Paul,

Quoted 81 lines · Paul Menzel

[CC: +Bruno]

Dear Luiz,

Thank you for the patch.

Am 22.08.23 um 21:14 schrieb Luiz Augusto von Dentz:

Quoted 3 lines

From: Luiz Augusto von Dentz <[email protected]>

This introduces HCI_QUIRK_BROKEN_LE_CODED is is used to indicate that

…. It is used …

Quoted 2 lines

LE Coded PHY shall not be used, it is then set for some Intel models that claims to support it but when used causes many problems.

that claim to …

Quoted 29 lines
---
  drivers/bluetooth/btintel.c      |  2 ++
  include/net/bluetooth/hci.h      | 10 ++++++++++
  include/net/bluetooth/hci_core.h |  4 +++-
  3 files changed, 15 insertions(+), 1 deletion(-)
drivers/bluetooth/btintel.c +2 -0
index 9b239ce96fa4..3ed60b2b0340 100644
@@ -2776,6 +2776,8 @@ static int btintel_setup_combined(struct hci_dev *hdev)
              case 0x11:      /* JfP */
              case 0x12:      /* ThP */
              case 0x13:      /* HrP */
+                     set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks);
+                     fallthrough;
              case 0x14:      /* CcP */
                      set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
                      fallthrough;
include/net/bluetooth/hci.h +0 -0
index c58425d4c592..767921d7f5c1 100644

include/net/bluetooth/hci.h enum { · line 324

Quoted 6 lines
include/net/bluetooth/hci.h +3 -0
@@ -319,6 +319,16 @@ enum {
       * This quirk must be set before hci_register_dev is called.
       */
      HCI_QUIRK_USE_MSFT_EXT_ADDRESS_FILTER,
+
+     /*
+      * When this quirk is set, LE Coded PHY is shall not be used. This is

s/is shall/shall/

Quoted 23 lines
include/net/bluetooth/hci.h +7 -0
+      * required for some Intel controllers which erroneously claim to
+      * support it but it causes problems with extended scanning.
+      *
+      * This quirk can be set before hci_register_dev is called or
+      * during the hdev->setup vendor callback.
+      */
+     HCI_QUIRK_BROKEN_LE_CODED,
  };
 
  /* HCI device flags */
include/net/bluetooth/hci_core.h +3 -1
index 6e2988b11f99..e6359f7346f1 100644
@@ -1817,7 +1817,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
  #define scan_2m(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_2M) || \
                    ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_2M))
 
-#define le_coded_capable(dev) (((dev)->le_features[1] & HCI_LE_PHY_CODED))
+#define le_coded_capable(dev) (((dev)->le_features[1] & HCI_LE_PHY_CODED) && \
+                            !test_bit(HCI_QUIRK_BROKEN_LE_CODED, \
+                                      &(dev)->quirks))
 
Quoted 5 lines

include/net/bluetooth/hci_core.h void hci_conn_del_sysfs(struct hci_conn *conn); · line 1825

Quoted 2 lines
include/net/bluetooth/hci_core.h +0 -0
  #define scan_coded(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_CODED) || \
                       ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_CODED))

Will this be future proof, once firmware for the broken controllers are fixed?

Yes, it won't cause any regressions if the firmware is fixed in the future, but LE coded PHY will need to be re-enabled by removing the quirks, this is why we say it is broken but we can't depend on runtime detection and should probably print a warning until we have a proper fix for it lands at the firmware side. We could in theory set HCI_QUIRK_BROKEN_LE_CODED based on the firmware version but firmware versioning schemes tend to change so I'm afraid that could also cause regression like this in the future.

Quoted 4 lines

Kind regards,

Paul

Signature · 1 line
Luiz Augusto von Dentz
#3 lore raw

Dear Luiz,

Thank you for your answer.

Am 22.08.23 um 22:20 schrieb Luiz Augusto von Dentz:

Quoted 90 lines

Hi Paul,

Quoted 81 lines · Paul Menzel

[CC: +Bruno]

Dear Luiz,

Thank you for the patch.

Am 22.08.23 um 21:14 schrieb Luiz Augusto von Dentz:

Quoted 3 lines

From: Luiz Augusto von Dentz <[email protected]>

This introduces HCI_QUIRK_BROKEN_LE_CODED is is used to indicate that

…. It is used …

Quoted 2 lines

LE Coded PHY shall not be used, it is then set for some Intel models that claims to support it but when used causes many problems.

that claim to …

Quoted 29 lines
---
   drivers/bluetooth/btintel.c      |  2 ++
   include/net/bluetooth/hci.h      | 10 ++++++++++
   include/net/bluetooth/hci_core.h |  4 +++-
   3 files changed, 15 insertions(+), 1 deletion(-)
drivers/bluetooth/btintel.c +2 -0
index 9b239ce96fa4..3ed60b2b0340 100644
@@ -2776,6 +2776,8 @@ static int btintel_setup_combined(struct hci_dev *hdev)
               case 0x11:      /* JfP */
               case 0x12:      /* ThP */
               case 0x13:      /* HrP */
+                     set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks);
+                     fallthrough;
               case 0x14:      /* CcP */
                       set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
                       fallthrough;
include/net/bluetooth/hci.h +0 -0
index c58425d4c592..767921d7f5c1 100644

include/net/bluetooth/hci.h enum { · line 324

Quoted 6 lines
include/net/bluetooth/hci.h +3 -0
@@ -319,6 +319,16 @@ enum {
        * This quirk must be set before hci_register_dev is called.
        */
       HCI_QUIRK_USE_MSFT_EXT_ADDRESS_FILTER,
+
+     /*
+      * When this quirk is set, LE Coded PHY is shall not be used. This is

s/is shall/shall/

Quoted 23 lines
include/net/bluetooth/hci.h +7 -0
+      * required for some Intel controllers which erroneously claim to
+      * support it but it causes problems with extended scanning.
+      *
+      * This quirk can be set before hci_register_dev is called or
+      * during the hdev->setup vendor callback.
+      */
+     HCI_QUIRK_BROKEN_LE_CODED,
   };
 
   /* HCI device flags */
include/net/bluetooth/hci_core.h +3 -1
index 6e2988b11f99..e6359f7346f1 100644
@@ -1817,7 +1817,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
   #define scan_2m(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_2M) || \
                     ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_2M))
 
-#define le_coded_capable(dev) (((dev)->le_features[1] & HCI_LE_PHY_CODED))
+#define le_coded_capable(dev) (((dev)->le_features[1] & HCI_LE_PHY_CODED) && \
+                            !test_bit(HCI_QUIRK_BROKEN_LE_CODED, \
+                                      &(dev)->quirks))
 
Quoted 5 lines

include/net/bluetooth/hci_core.h void hci_conn_del_sysfs(struct hci_conn *conn); · line 1825

Quoted 2 lines
include/net/bluetooth/hci_core.h +0 -0
   #define scan_coded(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_CODED) || \
                        ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_CODED))

Will this be future proof, once firmware for the broken controllers are fixed?

Quoted 8 lines

Yes, it won't cause any regressions if the firmware is fixed in the future, but LE coded PHY will need to be re-enabled by removing the quirks, this is why we say it is broken but we can't depend on runtime detection and should probably print a warning until we have a proper fix for it lands at the firmware side. We could in theory set HCI_QUIRK_BROKEN_LE_CODED based on the firmware version but firmware versioning schemes tend to change so I'm afraid that could also cause regression like this in the future.

Understood. Maybe you could add the known broken firmware versions to the commit message for posterity though.

Kind regards,

Paul

#4 lore raw

Dnia środa, 23 sierpnia 2023 10:26:31 CEST Paul Menzel pisze:

Quoted 105 lines

Dear Luiz,

Thank you for your answer.

Am 22.08.23 um 22:20 schrieb Luiz Augusto von Dentz:

Quoted 90 lines

Hi Paul,

Quoted 81 lines · Paul Menzel

[CC: +Bruno]

Dear Luiz,

Thank you for the patch.

Am 22.08.23 um 21:14 schrieb Luiz Augusto von Dentz:

Quoted 3 lines

From: Luiz Augusto von Dentz <[email protected]>

This introduces HCI_QUIRK_BROKEN_LE_CODED is is used to indicate that

…. It is used …

Quoted 2 lines

LE Coded PHY shall not be used, it is then set for some Intel models that claims to support it but when used causes many problems.

that claim to …

Quoted 29 lines
---
   drivers/bluetooth/btintel.c      |  2 ++
   include/net/bluetooth/hci.h      | 10 ++++++++++
   include/net/bluetooth/hci_core.h |  4 +++-
   3 files changed, 15 insertions(+), 1 deletion(-)
drivers/bluetooth/btintel.c +2 -0
index 9b239ce96fa4..3ed60b2b0340 100644
@@ -2776,6 +2776,8 @@ static int btintel_setup_combined(struct hci_dev *hdev)
               case 0x11:      /* JfP */
               case 0x12:      /* ThP */
               case 0x13:      /* HrP */
+                     set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks);
+                     fallthrough;
               case 0x14:      /* CcP */
                       set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
                       fallthrough;
include/net/bluetooth/hci.h +0 -0
index c58425d4c592..767921d7f5c1 100644

include/net/bluetooth/hci.h enum { · line 324

Quoted 6 lines
include/net/bluetooth/hci.h +3 -0
@@ -319,6 +319,16 @@ enum {
        * This quirk must be set before hci_register_dev is called.
        */
       HCI_QUIRK_USE_MSFT_EXT_ADDRESS_FILTER,
+
+     /*
+      * When this quirk is set, LE Coded PHY is shall not be used. This is

s/is shall/shall/

Quoted 23 lines
include/net/bluetooth/hci.h +7 -0
+      * required for some Intel controllers which erroneously claim to
+      * support it but it causes problems with extended scanning.
+      *
+      * This quirk can be set before hci_register_dev is called or
+      * during the hdev->setup vendor callback.
+      */
+     HCI_QUIRK_BROKEN_LE_CODED,
   };
 
   /* HCI device flags */
include/net/bluetooth/hci_core.h +3 -1
index 6e2988b11f99..e6359f7346f1 100644
@@ -1817,7 +1817,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
   #define scan_2m(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_2M) || \
                     ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_2M))
 
-#define le_coded_capable(dev) (((dev)->le_features[1] & HCI_LE_PHY_CODED))
+#define le_coded_capable(dev) (((dev)->le_features[1] & HCI_LE_PHY_CODED) && \
+                            !test_bit(HCI_QUIRK_BROKEN_LE_CODED, \
+                                      &(dev)->quirks))
 
Quoted 5 lines

include/net/bluetooth/hci_core.h void hci_conn_del_sysfs(struct hci_conn *conn); · line 1825

Quoted 2 lines
include/net/bluetooth/hci_core.h +0 -0
   #define scan_coded(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_CODED) || \
                        ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_CODED))

Will this be future proof, once firmware for the broken controllers are fixed?

Quoted 8 lines

Yes, it won't cause any regressions if the firmware is fixed in the future, but LE coded PHY will need to be re-enabled by removing the quirks, this is why we say it is broken but we can't depend on runtime detection and should probably print a warning until we have a proper fix for it lands at the firmware side. We could in theory set HCI_QUIRK_BROKEN_LE_CODED based on the firmware version but firmware versioning schemes tend to change so I'm afraid that could also cause regression like this in the future.

Quoted 8 lines

Understood. Maybe you could add the known broken firmware versions to the commit message for posterity though.

Kind regards,

Paul

Thanks,
This patch partly works for me. The mouse now takes several dozen seconds to detect where the computer did not find it at all before. But note that in kernel 6.3.x it was always detected immediately.

author maintainer
#5 lore raw

Hi Bruno,

Quoted 111 lines · Bruno Pitrus

Dnia środa, 23 sierpnia 2023 10:26:31 CEST Paul Menzel pisze:

Quoted 109 lines

Dear Luiz,

Thank you for your answer.

Am 22.08.23 um 22:20 schrieb Luiz Augusto von Dentz:

Quoted 90 lines

Hi Paul,

Quoted 81 lines · Paul Menzel

[CC: +Bruno]

Dear Luiz,

Thank you for the patch.

Am 22.08.23 um 21:14 schrieb Luiz Augusto von Dentz:

Quoted 3 lines

From: Luiz Augusto von Dentz <[email protected]>

This introduces HCI_QUIRK_BROKEN_LE_CODED is is used to indicate that

…. It is used …

Quoted 2 lines

LE Coded PHY shall not be used, it is then set for some Intel models that claims to support it but when used causes many problems.

that claim to …

Quoted 29 lines
---
   drivers/bluetooth/btintel.c      |  2 ++
   include/net/bluetooth/hci.h      | 10 ++++++++++
   include/net/bluetooth/hci_core.h |  4 +++-
   3 files changed, 15 insertions(+), 1 deletion(-)
drivers/bluetooth/btintel.c +2 -0
index 9b239ce96fa4..3ed60b2b0340 100644
@@ -2776,6 +2776,8 @@ static int btintel_setup_combined(struct hci_dev *hdev)
               case 0x11:      /* JfP */
               case 0x12:      /* ThP */
               case 0x13:      /* HrP */
+                     set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks);
+                     fallthrough;
               case 0x14:      /* CcP */
                       set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
                       fallthrough;
include/net/bluetooth/hci.h +0 -0
index c58425d4c592..767921d7f5c1 100644

include/net/bluetooth/hci.h enum { · line 324

Quoted 6 lines
include/net/bluetooth/hci.h +3 -0
@@ -319,6 +319,16 @@ enum {
        * This quirk must be set before hci_register_dev is called.
        */
       HCI_QUIRK_USE_MSFT_EXT_ADDRESS_FILTER,
+
+     /*
+      * When this quirk is set, LE Coded PHY is shall not be used. This is

s/is shall/shall/

Quoted 23 lines
include/net/bluetooth/hci.h +7 -0
+      * required for some Intel controllers which erroneously claim to
+      * support it but it causes problems with extended scanning.
+      *
+      * This quirk can be set before hci_register_dev is called or
+      * during the hdev->setup vendor callback.
+      */
+     HCI_QUIRK_BROKEN_LE_CODED,
   };
 
   /* HCI device flags */
include/net/bluetooth/hci_core.h +3 -1
index 6e2988b11f99..e6359f7346f1 100644
@@ -1817,7 +1817,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
   #define scan_2m(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_2M) || \
                     ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_2M))
 
-#define le_coded_capable(dev) (((dev)->le_features[1] & HCI_LE_PHY_CODED))
+#define le_coded_capable(dev) (((dev)->le_features[1] & HCI_LE_PHY_CODED) && \
+                            !test_bit(HCI_QUIRK_BROKEN_LE_CODED, \
+                                      &(dev)->quirks))
 
Quoted 5 lines

include/net/bluetooth/hci_core.h void hci_conn_del_sysfs(struct hci_conn *conn); · line 1825

Quoted 2 lines
include/net/bluetooth/hci_core.h +0 -0
   #define scan_coded(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_CODED) || \
                        ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_CODED))

Will this be future proof, once firmware for the broken controllers are fixed?

Quoted 8 lines

Yes, it won't cause any regressions if the firmware is fixed in the future, but LE coded PHY will need to be re-enabled by removing the quirks, this is why we say it is broken but we can't depend on runtime detection and should probably print a warning until we have a proper fix for it lands at the firmware side. We could in theory set HCI_QUIRK_BROKEN_LE_CODED based on the firmware version but firmware versioning schemes tend to change so I'm afraid that could also cause regression like this in the future.

Understood. Maybe you could add the known broken firmware versions to the commit message for posterity though.

Quoted 7 lines
Quoted 4 lines

Kind regards,

Paul

Thanks,
This patch partly works for me. The mouse now takes several dozen seconds to detect where the computer did not find it at all before. But note that in kernel 6.3.x it was always detected immediately.

What version did you try, v2 didn't have any effect for me, only v3 worked which had the same behavior of AX210 so it discovered it quite quickly.

Signature · 1 line
Luiz Augusto von Dentz
#6 lore raw

Dnia środa, 23 sierpnia 2023 18:35:27 CEST Luiz Augusto von Dentz pisze:

Quoted 118 lines

Hi Bruno,

Quoted 115 lines · Bruno Pitrus

Dnia środa, 23 sierpnia 2023 10:26:31 CEST Paul Menzel pisze:

Quoted 113 lines

Dear Luiz,

Thank you for your answer.

Am 22.08.23 um 22:20 schrieb Luiz Augusto von Dentz:

Quoted 90 lines

Hi Paul,

Quoted 81 lines · Paul Menzel

[CC: +Bruno]

Dear Luiz,

Thank you for the patch.

Am 22.08.23 um 21:14 schrieb Luiz Augusto von Dentz:

Quoted 3 lines

From: Luiz Augusto von Dentz <[email protected]>

This introduces HCI_QUIRK_BROKEN_LE_CODED is is used to indicate that

…. It is used …

Quoted 2 lines

LE Coded PHY shall not be used, it is then set for some Intel models that claims to support it but when used causes many problems.

that claim to …

Quoted 29 lines
---
   drivers/bluetooth/btintel.c      |  2 ++
   include/net/bluetooth/hci.h      | 10 ++++++++++
   include/net/bluetooth/hci_core.h |  4 +++-
   3 files changed, 15 insertions(+), 1 deletion(-)
drivers/bluetooth/btintel.c +2 -0
index 9b239ce96fa4..3ed60b2b0340 100644
@@ -2776,6 +2776,8 @@ static int btintel_setup_combined(struct hci_dev *hdev)
               case 0x11:      /* JfP */
               case 0x12:      /* ThP */
               case 0x13:      /* HrP */
+                     set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks);
+                     fallthrough;
               case 0x14:      /* CcP */
                       set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
                       fallthrough;
include/net/bluetooth/hci.h +0 -0
index c58425d4c592..767921d7f5c1 100644

include/net/bluetooth/hci.h enum { · line 324

Quoted 6 lines
include/net/bluetooth/hci.h +3 -0
@@ -319,6 +319,16 @@ enum {
        * This quirk must be set before hci_register_dev is called.
        */
       HCI_QUIRK_USE_MSFT_EXT_ADDRESS_FILTER,
+
+     /*
+      * When this quirk is set, LE Coded PHY is shall not be used. This is

s/is shall/shall/

Quoted 23 lines
include/net/bluetooth/hci.h +7 -0
+      * required for some Intel controllers which erroneously claim to
+      * support it but it causes problems with extended scanning.
+      *
+      * This quirk can be set before hci_register_dev is called or
+      * during the hdev->setup vendor callback.
+      */
+     HCI_QUIRK_BROKEN_LE_CODED,
   };
 
   /* HCI device flags */
include/net/bluetooth/hci_core.h +3 -1
index 6e2988b11f99..e6359f7346f1 100644
@@ -1817,7 +1817,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
   #define scan_2m(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_2M) || \
                     ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_2M))
 
-#define le_coded_capable(dev) (((dev)->le_features[1] & HCI_LE_PHY_CODED))
+#define le_coded_capable(dev) (((dev)->le_features[1] & HCI_LE_PHY_CODED) && \
+                            !test_bit(HCI_QUIRK_BROKEN_LE_CODED, \
+                                      &(dev)->quirks))
 
Quoted 5 lines

include/net/bluetooth/hci_core.h void hci_conn_del_sysfs(struct hci_conn *conn); · line 1825

Quoted 2 lines
include/net/bluetooth/hci_core.h +0 -0
   #define scan_coded(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_CODED) || \
                        ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_CODED))

Will this be future proof, once firmware for the broken controllers are fixed?

Quoted 8 lines

Yes, it won't cause any regressions if the firmware is fixed in the future, but LE coded PHY will need to be re-enabled by removing the quirks, this is why we say it is broken but we can't depend on runtime detection and should probably print a warning until we have a proper fix for it lands at the firmware side. We could in theory set HCI_QUIRK_BROKEN_LE_CODED based on the firmware version but firmware versioning schemes tend to change so I'm afraid that could also cause regression like this in the future.

Understood. Maybe you could add the known broken firmware versions to the commit message for posterity though.

Kind regards,

Paul

Quoted 9 lines
Quoted 3 lines

Thanks,
This patch partly works for me. The mouse now takes several dozen seconds to detect where the computer did not find it at all before. But note that in kernel 6.3.x it was always detected immediately.

What version did you try, v2 didn't have any effect for me, only v3 worked which had the same behavior of AX210 so it discovered it quite quickly.

I only tried v1 patch ( https://www.spinics.net/lists/linux-bluetooth/msg106406.html ). Should i try a later version instead?