From: Zijun Hu <zijun.hu@oss.qualcomm.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Marcel Holtmann <marcel@holtmann.org>,
Zijun Hu <zijun_hu@icloud.com>,
linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/4] Bluetooth: Add generic support for vendor HCI packets
Date: Wed, 2 Sep 2026 18:22:33 +0800 [thread overview]
Message-ID: <0d642aed-f262-4d59-af18-25aefa29bb76@oss.qualcomm.com> (raw)
In-Reply-To: <CABBYNZLOBVHNvn1=56C-FHc64i5s7SAx3akL5Q3w4oUuekonUw@mail.gmail.com>
On 8/31/2026 10:45 PM, Luiz Augusto von Dentz wrote:
>> Packet type BT-HCI indicator PERI-HCI indicator
>> -----------------------------------------------------------------
>> CMD (Host -> Controller) 0x01 0x31
>> ACL Data (bidirectional) 0x02 0x32
>> EVENT (Controller -> Host) 0x04 0x34
>>
>> Implement HCI_VENDOR_PKT to generically support vendor HCI packets:
>>
>> - Log them in btmon as they appear on the wire.
>> - Allow userspace to send/receive them over HCI_CHANNEL_USER, gate RX
>> with the new socket option BT_RECV_VENDOR_PKT, off by default to
>> avoid regressions for existing applications.
>> - Add hdev->recv_vendor_pkt() to handle them in hci_rx_work().
>> - Add hci_send_vendor_frame() to send an HCI_VENDOR_PKT frame.
> I don't find this one very useful, as btmon already supports handling
> vendor events:
>
> { 0xff, "Vendor", vendor_evt, 0, false },
>
This commit actually implements your guidance concluded at 2026-07-20
after discussion:
https://lore.kernel.org/all/CABBYNZL_H2iRAshF-RCX41jbt0jots5i5W=aUUJC_wEN6wzp=w@mail.gmail.com
"I'm fine adding code to the likes of btmon to decode vendor packets, we already have
something similar for Intel although that uses a vendor event not a
vendor packet (both use 0xff, causing the confusion). The user of the
user channel shall be able to read/write starting with 0xff then
decode/encode the next byte as the actual vendor opcode."
Sorry that this patchset comes too late due to refining the last
commit, so it may no longer be top of mind.
vendor_evt() handles HCI_EV_VENDOR, which is very different and
easily distinguished from HCI_VENDOR_PKT, as table below:
+----------------+------------------------+------------------------+
| | HCI_VENDOR_PKT (0xff) | HCI_EV_VENDOR (0xff) |
+----------------+------------------------+------------------------+
| Defined by | Vendor | BT SIG |
+----------------+------------------------+------------------------+
| Hierarchy | Parallel to | Nested inside |
| | HCI_EVENT_PKT(0x04) | HCI_EVENT_PKT(0x04) |
+----------------+------------------------+------------------------+
| Direction | RX and TX | RX only |
+----------------+------------------------+------------------------+
| kernel <-> | HCI_VENDOR_PKT, ... | 0x04, HCI_EV_VENDOR, |
| userspace | | ... |
+----------------+------------------------+------------------------+
| kernel <-> | TX: 22, its payload | RX: 3, HCI_EV_VENDOR, |
| monitor | RX: 23, its payload | ... |
+----------------+------------------------+------------------------+
> This will complicate things because some drivers might label packets
> as vendor while others might inline them as an HCI vendor event. From
> the spec's point of view there is no generic HCI vendor packet, so the
> PERI approach really stands out as a non-compliant solution because it
> uses reserved opcodes.
Vendors sometimes define various HCI_VENDOR_PKTs for their H/W
controller based on their own considerations or requirements, such as
Qualcomm's PERI frames, and BT ACL with vendor-reserved handles, as in
the table below:
+--------+----------+------------------------------------------+
| Vendor | Coredump | Other |
+--------+----------+------------------------------------------+
| QCOM | 0xEDD | Enhanced Logging (0xEDC) |
+--------+----------+------------------------------------------+
| MTK | 0xFC6F | Firmware debug logging (0x05FF, 0x05FE) |
+--------+----------+------------------------------------------+
| NXP | 0xFFF | - |
+--------+----------+------------------------------------------+
These chips have been BT SIG certified and are commercially deployed.
This commit supports them, and also fixes issues similar to what the
commit below fixes for HCI_EV_VENDOR:
0bd606b31d40 ("Bluetooth: hci_event: Introduce handle_ev_vendor()
for HCI_EV_VENDOR")
It is also required infrastructure for supporting Qualcomm's
multi-subsystem chips.
May we address your concern by improving the naming and adding
comments to make each packet type's concept clearer?
May we address your concern by improving the naming and adding
comments to make each packet type's concept clearer in the BlueZ
patchset below:
https://lore.kernel.org/all/20260830-vendor_hci-v2-0-9903760957ab@oss.qualcomm.com
Please take a look when you get a chance, and let me know if you
have any further comments.
next prev parent reply other threads:[~2026-09-02 10:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 5:03 [PATCH v2 0/4] Bluetooth: btusb: Support Qualcomm multi-subsystem QCC2072 Zijun Hu
2026-08-31 5:03 ` [PATCH v2 1/4] Bluetooth: btusb: Add recv_intr() hook to btusb_data Zijun Hu
2026-08-31 6:41 ` Bluetooth: btusb: Support Qualcomm multi-subsystem QCC2072 bluez.test.bot
2026-08-31 5:03 ` [PATCH v2 2/4] Bluetooth: Add generic support for vendor HCI packets Zijun Hu
2026-08-31 14:45 ` Luiz Augusto von Dentz
2026-09-02 10:22 ` Zijun Hu [this message]
2026-08-31 5:03 ` [PATCH v2 3/4] Bluetooth: btusb: Build the driver from multiple source files Zijun Hu
2026-08-31 5:03 ` [PATCH v2 4/4] Bluetooth: btusb: Add support for Qualcomm multi-subsystem QCC2072 Zijun Hu
2026-08-31 14:34 ` [PATCH v2 0/4] Bluetooth: btusb: Support " Luiz Augusto von Dentz
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=0d642aed-f262-4d59-af18-25aefa29bb76@oss.qualcomm.com \
--to=zijun.hu@oss.qualcomm.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=zijun_hu@icloud.com \
/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