[PATCH v2] Bluetooth: qca: Allow capturing QCA debug logs in snoop logs

Dishank Garg <[email protected]> Tue, 04 Aug 2026 10:47:49 +0530
Newsgroups org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-bluetooth,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Add a debugfs flag to forward QCA diagnostic ACL packets as regular
ACL data, enabling their capture in Bluetooth snoop logs.

Signed-off-by: Dishank Garg <[email protected]>
---
This series adds support for capturing QCA controller debug/diagnostic
logs in Bluetooth snoop logs. Currently, ACL packets carrying QCA
diagnostic data are intercepted and routed to the diagnostic layer via
hci_recv_diag(), which means they never show up in snoop captures.
This makes it hard to correlate QCA debug logs with the surrounding
HCI/ACL traffic when debugging issues, since the two have to be
captured and aligned separately.

The series adds a new debugfs knob, diag_as_acl, under the hci_qca
debugfs directory. When enabled, diagnostic ACL packets are forwarded
through the normal ACL receive path instead of being diverted to the
diagnostic layer, so they get captured in the standard Bluetooth snoop
log alongside all other traffic.
---
Changes in v2:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v1: https://patch.msgid.link/[email protected]
---
 drivers/bluetooth/hci_qca.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 1222f97800f4..6996966319e8 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -182,6 +182,7 @@ struct qca_data {
 	u64 rx_votes_on;
 	u64 tx_votes_off;
 	u64 rx_votes_off;
+	bool diag_as_acl;
 	u64 votes_on;
 	u64 votes_off;
 };
@@ -698,6 +699,7 @@ static void qca_debugfs_init(struct hci_dev *hdev)
 	debugfs_create_u32("wake_retrans", mode, ibs_dir, &qca->wake_retrans);
 	debugfs_create_u32("tx_idle_delay", mode, ibs_dir,
 			   &qca->tx_idle_delay);
+	debugfs_create_bool("diag_as_acl", 0644, hdev->debugfs, &qca->diag_as_acl);
 }
 
 /* Flush protocol data */
@@ -998,12 +1000,14 @@ static int qca_ibs_wake_ack(struct hci_dev *hdev, struct sk_buff *skb)
 
 static int qca_recv_acl_data(struct hci_dev *hdev, struct sk_buff *skb)
 {
+	struct hci_uart *hu = hci_get_drvdata(hdev);
+	struct qca_data *qca = hu->priv;
 	/* We receive debug logs from chip as an ACL packets.
 	 * Instead of sending the data to ACL to decode the
 	 * received data, we are pushing them to the above layers
 	 * as a diagnostic packet.
 	 */
-	if (get_unaligned_le16(skb->data) == QCA_DEBUG_HANDLE)
+	if (!READ_ONCE(qca->diag_as_acl) && get_unaligned_le16(skb->data) == QCA_DEBUG_HANDLE)
 		return hci_recv_diag(hdev, skb);
 
 	return hci_recv_frame(hdev, skb);

---
base-commit: f5a7e2ae5f0a9a5caf59501457938eeb249a7dc8
change-id: 20260803-qca_logs_enable-9b8197aaac09

Best regards,
--  
Dishank Garg <[email protected]>