Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Aditya Garg <aditya.garg@linux.dev>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Andre Eikmeyer <dev@deq.rocks>,
	marcel@holtmann.org, linux-bluetooth@vger.kernel.org,
	linux-kernel@vger.kernel.org, sven@kernel.org, j@jannau.net,
	neal@gompa.dev, asahi@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org, 66ton99@gmail.com,
	josemiguelo.ochoa@gmail.com,
	Yossef Osman <Yossef.Osman@proton.me>
Subject: Re: [PATCH 2/4] Bluetooth: btbcm: clear vendor bits in LE advertising report types
Date: Wed, 4 Nov 2026 21:04:16 +0530	[thread overview]
Message-ID: <F6EC6963-A4F5-4109-BD87-E4FE0A80C6C8@linux.dev> (raw)
In-Reply-To: <CABBYNZLMVso40XpULwTwBwAE4tpXndSJMKhmoVLrmgm+unBNCA@mail.gmail.com>


> On 4 Nov 2026, at 8:55 PM, Luiz Augusto von Dentz <luiz.dentz@gmail.com> wrote:
> 
> Hi Andre,
> 
>> On Wed, Nov 4, 2026 at 10:16 AM Andre Eikmeyer <dev@deq.rocks> wrote:
>> 
>> The BCM4364B0 of the MacBookPro15,1 (UART) and the BCM4377 of the
>> MacBookAir9,1 (PCIe) set bits 4, 5 and 7 of the event type in LE
>> Advertising Report events. btmon on the 15,1 shows types 0x10, 0x13,
>> 0x14, 0x20, 0x23, 0x24, 0x93 and 0xa0 next to plain 0x00, 0x03 and 0x04,
>> the same advertiser shows up as 0x13, 0x23 and 0x03. The kernel log of
>> the 9,1 lists 0x10 to 0x24 and 0x80, 0x83, 0x90, 0x93, 0xa0, 0xa3.
>> process_adv_report() drops every type above 0x04 with "Unknown
>> advertising packet type", so most advertisements never reach the host.
>> An AirDrop sender was reported as 0x23, 0x23 and 0x13 and only the
>> fourth report, 0x03, reached BlueZ 32 s after the first one.
>> 
>> Add btbcm_fixup_le_adv_report(), which clears the bits above the type,
>> and call it from hci_bcm on Apple machines and from hci_bcm4377 before
>> the event goes to the core.
>> 
>> Suggested-by: Jose Miguel Ochoa <josemiguelo.ochoa@gmail.com>
>> Tested-by: Yossef Osman <Yossef.Osman@proton.me>
>> Tested-by: Aditya Garg <aditya.garg@linux.dev>
>> Signed-off-by: Andre Eikmeyer <dev@deq.rocks>
>> ---
>> drivers/bluetooth/btbcm.c       | 30 ++++++++++++++++++++++++++++++
>> drivers/bluetooth/btbcm.h       |  5 +++++
>> drivers/bluetooth/hci_bcm.c     |  5 +++++
>> drivers/bluetooth/hci_bcm4377.c |  1 +
>> 4 files changed, 41 insertions(+)
>> 
>> diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c
>> index 0facfe62333..527a5c75fd6 100644
>> --- a/drivers/bluetooth/btbcm.c
>> +++ b/drivers/bluetooth/btbcm.c
>> @@ -282,6 +282,36 @@ void btbcm_set_acl_priority_on_connect(struct hci_dev *hdev, struct sk_buff *skb
>> }
>> EXPORT_SYMBOL_GPL(btbcm_set_acl_priority_on_connect);
>> 
>> +/* The BCM4364 and BCM4377 of the T2 Macs set bits above the event type of LE
>> + * Advertising Reports, 0x13 and 0x23 for ADV_NONCONN_IND for example. The
>> + * core drops reports of unknown types, so clear them.
>> + */
>> +void btbcm_fixup_le_adv_report(struct sk_buff *skb)
>> +{
>> +       struct hci_event_hdr *hdr = (void *)skb->data;
>> +       struct hci_ev_le_advertising_info *info;
>> +       u8 *p, *end;
>> +       u8 num;
>> +
>> +       if (hci_skb_pkt_type(skb) != HCI_EVENT_PKT ||
>> +           skb->len < HCI_EVENT_HDR_SIZE + 2 || hdr->evt != HCI_EV_LE_META)
>> +               return;
>> +
>> +       p = skb->data + HCI_EVENT_HDR_SIZE;
>> +       if (p[0] != HCI_EV_LE_ADVERTISING_REPORT)
>> +               return;
>> +
>> +       num = p[1];
>> +       p += 2;
>> +       end = skb->data + skb->len;
>> +       while (num-- && p + sizeof(*info) + 1 <= end) {
>> +               info = (void *)p;
>> +               info->type &= 0x0f;
>> +               p += sizeof(*info) + info->length + 1;
>> +       }
>> +}
>> +EXPORT_SYMBOL_GPL(btbcm_fixup_le_adv_report);
> 
> I don't think I agree with this being cleaner then doing at
> hci_event.though; not only is it more code but it also walks the
> packet which is inefficient and may have security implications as
> well.

The hci_event patch makes it apply for all Broadcom chips. The author who sent that patch themselves use a T2 Mac. I doubt all Broadcom chips need this because there have been no bug reports from normal PCs.

  reply	other threads:[~2026-11-04 15:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 15:15 [PATCH 0/4] Bluetooth: Broadcom controllers of the Apple T2 Macs Andre Eikmeyer
2026-11-04 15:15 ` [PATCH 1/4] Bluetooth: btbcm: raise ACL priority on Apple Broadcom controllers Andre Eikmeyer
2026-11-05  5:22   ` kernel test robot
2026-11-04 15:15 ` [PATCH 2/4] Bluetooth: btbcm: clear vendor bits in LE advertising report types Andre Eikmeyer
2026-11-04 15:24   ` Luiz Augusto von Dentz
2026-11-04 15:34     ` Aditya Garg [this message]
2026-11-04 15:46     ` André Eikmeyer
2026-11-04 16:29       ` Luiz Augusto von Dentz
2026-11-04 16:47         ` André Eikmeyer
2026-11-05  9:10   ` kernel test robot
2026-11-04 15:16 ` [PATCH 3/4] Revert "Bluetooth: hci_event: strip Broadcom vendor bits from legacy adv report type" Andre Eikmeyer
2026-11-04 15:16 ` [PATCH 4/4] Bluetooth: set the strict duplicate filter quirk on Apple Broadcom controllers Andre Eikmeyer

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=F6EC6963-A4F5-4109-BD87-E4FE0A80C6C8@linux.dev \
    --to=aditya.garg@linux.dev \
    --cc=66ton99@gmail.com \
    --cc=Yossef.Osman@proton.me \
    --cc=asahi@lists.linux.dev \
    --cc=dev@deq.rocks \
    --cc=j@jannau.net \
    --cc=josemiguelo.ochoa@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=neal@gompa.dev \
    --cc=sven@kernel.org \
    /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