Re: [PATCH v3] Bluetooth: Add Broadcom channel priority commands
From: Joshua Peisach
Date: Mon May 25 2026 - 09:58:56 EST
On Mon May 25, 2026 at 8:11 AM EDT, Sasha Finkelstein wrote:
--- /dev/null
+++ b/net/bluetooth/brcm.c
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2026 The Asahi Linux Contributors
+ */
+
+#include <net/bluetooth/bluetooth.h>
+#include <net/bluetooth/hci_core.h>
+
+#include "brcm.h"
+
+struct brcm_prio_cmd {
+ __le16 handle;
+ u8 enable;
+} __packed;
+
+int brcm_set_high_priority(struct hci_dev *hdev, struct hci_conn *conn,
+ bool enable)
+{
+ struct sk_buff *skb;
+ struct brcm_prio_cmd cmd;
+
+ if (!hdev->brcm_capable)
+ return 0;
+
+ if (conn->brcm_high_prio == enable)
+ return 0;
+
+ cmd.handle = cpu_to_le16(conn->handle);
+ cmd.enable = !!enable;
+
Probably a dumb question, but worth asking - what is the purpose of the
"!!"? Wouldn't just passing "enable" be sufficient?
Also, currently, cmd.enable seems to just be set and used in the case
of boolean conditions. Would it make sense for the enable field in
brcm_prio_cmd to be a bool or does it not really matter?
+ skb = hci_cmd_sync(hdev, 0xfc57, sizeof(cmd), &cmd, HCI_CMD_TIMEOUT);
+ if (IS_ERR(skb))
+ return PTR_ERR(skb);
+
+ conn->brcm_high_prio = enable;
+ kfree_skb(skb);
+ return 0;
+}
diff --git a/net/bluetooth/brcm.h b/net/bluetooth/brcm.h
new file mode 100644
index 000000000000..2290fc6cf798
--- /dev/null
+++ b/net/bluetooth/brcm.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2026 The Asahi Linux Contributors
+ */
+
+#if IS_ENABLED(CONFIG_BT_BRCMEXT)
+
+int brcm_set_high_priority(struct hci_dev *hdev, struct hci_conn *conn,
+ bool enable);
+
+#else
+
+static inline int brcm_set_high_priority(struct hci_dev *hdev,
+ struct hci_conn *conn, bool enable)
+{
+ return 0;
+}
+
+#endif
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index c46c1236ebfa..0e74bad496a2 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -46,6 +46,7 @@
#include "msft.h"
#include "aosp.h"
#include "hci_codec.h"
+#include "brcm.h"
static void hci_rx_work(struct work_struct *work);
static void hci_cmd_work(struct work_struct *work);
@@ -3696,6 +3697,9 @@ static void hci_sched_acl_pkt(struct hci_dev *hdev)
skb = skb_dequeue(&chan->data_q);
+ if (skb->priority == TC_PRIO_INTERACTIVE)
+ brcm_set_high_priority(hdev, chan->conn, true);
+
hci_conn_enter_active_mode(chan->conn,
bt_cb(skb)->force_active);
---
base-commit: 8bc67e4db64aa72732c474b44ea8622062c903f0
change-id: 20260407-brcm-prio-b630e6cc3834
Best regards,
-- Sasha Finkelstein <k@xxxxxxxxxxxxxx>