linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bruno Pitrus <brunopitrus@hotmail.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Paul Menzel <pmenzel@molgen.mpg.de>,
	"linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH] Bluetooth: HCI: Introduce HCI_QUIRK_BROKEN_LE_CODED
Date: Thu, 24 Aug 2023 09:03:25 +0000	[thread overview]
Message-ID: <28219751.mYOd1jRtt3@bruno-beit> (raw)
In-Reply-To: <CABBYNZ+6pRytUHfi68h4Q=A9urNR=JtuJ0mzG+615q0Lyyeg+w@mail.gmail.com>

Dnia środa, 23 sierpnia 2023 18:35:27 CEST Luiz Augusto von Dentz pisze:
> Hi Bruno,
> 
> On Wed, Aug 23, 2023 at 2:21 AM Bruno Pitrus <brunopitrus@hotmail.com> wrote:
> >
> > Dnia środa, 23 sierpnia 2023 10:26:31 CEST Paul Menzel pisze:
> > > Dear Luiz,
> > >
> > >
> > > Thank you for your answer.
> > >
> > > Am 22.08.23 um 22:20 schrieb Luiz Augusto von Dentz:
> > > > Hi Paul,
> > > >
> > > > On Tue, Aug 22, 2023 at 1:01 PM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
> > > >>
> > > >> [CC: +Bruno]
> > > >>
> > > >> Dear Luiz,
> > > >>
> > > >>
> > > >> Thank you for the patch.
> > > >>
> > > >> Am 22.08.23 um 21:14 schrieb Luiz Augusto von Dentz:
> > > >>> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> > > >>>
> > > >>> This introduces HCI_QUIRK_BROKEN_LE_CODED is is used to indicate that
> > > >>
> > > >> …. It is used …
> > > >>
> > > >>> 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 …
> > > >>
> > > >>> Link: https://github.com/bluez/bluez/issues/577
> > > >>> Link: https://github.com/bluez/bluez/issues/582
> > > >>> Link: https://lore.kernel.org/linux-bluetooth/CABBYNZKco-v7wkjHHexxQbgwwSz-S=GZ=dZKbRE1qxT1h4fFbQ@mail.gmail.com/T/#
> > > >>> Fixes: 288c90224eec ("Bluetooth: Enable all supported LE PHY by default")
> > > >>> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> > > >>> ---
> > > >>>    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(-)
> > > >>>
> > > >>> diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
> > > >>> index 9b239ce96fa4..3ed60b2b0340 100644
> > > >>> --- a/drivers/bluetooth/btintel.c
> > > >>> +++ b/drivers/bluetooth/btintel.c
> > > >>> @@ -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;
> > > >>> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> > > >>> index c58425d4c592..767921d7f5c1 100644
> > > >>> --- a/include/net/bluetooth/hci.h
> > > >>> +++ b/include/net/bluetooth/hci.h
> > > >>> @@ -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/
> > > >>
> > > >>> +      * 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 */
> > > >>> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> > > >>> index 6e2988b11f99..e6359f7346f1 100644
> > > >>> --- a/include/net/bluetooth/hci_core.h
> > > >>> +++ b/include/net/bluetooth/hci_core.h
> > > >>> @@ -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?
> > > >
> > > > 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
> > >
> > 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?

  reply	other threads:[~2023-08-24  9:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22 19:14 [PATCH] Bluetooth: HCI: Introduce HCI_QUIRK_BROKEN_LE_CODED Luiz Augusto von Dentz
2023-08-22 20:01 ` Paul Menzel
2023-08-22 20:20   ` Luiz Augusto von Dentz
2023-08-23  8:26     ` Paul Menzel
2023-08-23  9:21       ` Bruno Pitrus
2023-08-23 16:35         ` Luiz Augusto von Dentz
2023-08-24  9:03           ` Bruno Pitrus [this message]
2023-08-22 20:14 ` bluez.test.bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28219751.mYOd1jRtt3@bruno-beit \
    --to=brunopitrus@hotmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=pmenzel@molgen.mpg.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).