From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384352; b=M7z2LX05OLK/JdoF+ABKftxPpn/k7TWJEmbPHF0KBtxxULFPdJSg0xqqEyLtDX0XkKqC DNtqjdhHcpbmhusuj33+FIIcCW4cHcM6OGjNbaRLFqrFUAMkS/pLUpgoKi9N9x+3RN4yV l5D+UR4TbnF4YnPIyh6X1JoQresE2z+/o1LE6X9Z6hhhL0bi15RHrmSvUHEmlzwGyOzQY R1zvk2SazsFnqfUwj936sHIE4205jaidw096IA7bIRWMmCTf/s+p5R4RP/VmP8DAryaZO 3Jdv9JEdDh8lirMlg+m960UBa6+tTFIxOFYVed0p6MuQGbsKuHwY67UEfhjPFoTfWRQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384352; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=5QOlzYGU12jPW/P5uuUjsb/2+jH73ClJ2urc+Wf6FFs=; b=W1tv/kCl6DDtem90R9RpHhnXulAFYU+QDHuOngfK36xM8dIaT2yoaEWWHlWgQEqjqMHq zEqg+UlDHaatUcUJijZPl1C40QW9P8TEQU7/cJOeTupxjP2xx2uV2nRw247KPYKPnmSZ3 P+QaCpinFtd4Jhot5Rc8eqwOIMQdggspt+vDepXiCAnIsfVm0i25cMzDdTuGVRNgZuJhW CxuHgnf9Ha7Io1x6qTyXFA3BigpRmqQ/9MxscrlLF7owpV9CNKXvW8B9NiYNiSgkN1yp2 aoxvHVFNCdy8HCy3jsmSU85WVv5g92Ea7jbHyX4dDpEwkJLVYfzfEOncLX+QpryLNBA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=LX5xlVEq; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C13B606A32C; Fri, 4 Dec 2026 11:39:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=LX5xlVEq Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86F031F000CE; Fri, 4 Dec 2026 11:39:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384352; bh=5QOlzYGU12jPW/P5uuUjsb/2+jH73ClJ2urc+Wf6FFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LX5xlVEqbya4k4S6l5RIDfQkm+d49psQXF5zuwHelGi/U7sfkM3eEdwoeEBeTMbwa 6tU6Eh8vF/0NuYG+PN/SqrsSI+cGC1qD2Gh4Du9/GRZg6d8fmQusi3XGzFj5sqGWRb 6d3Ez4Cl9DDo6zp8rq1mAeD3WMPFl4nb2E+BWA2k= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ying Hsu , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.6 0116/1167] Bluetooth: Add vendor-specific packet classification for ISO data Date: Fri, 4 Dec 2026 18:52:23 +0900 Message-ID: <20261204100705.115152363@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ying Hsu [ Upstream commit f25b7fd36cc3a850e006aed686f5bbecd200de1b ] When HCI raw sockets are opened, the Bluetooth kernel module doesn't track CIS/BIS connections. User-space applications have to identify ISO data by maintaining connection information and look up the mapping for each ACL data packet received. Besides, btsnoop log captured in kernel couldn't tell ISO data from ACL data in this case. To avoid additional lookups, this patch introduces vendor-specific packet classification for Intel BT controllers to distinguish ISO data packets from ACL data packets. Signed-off-by: Ying Hsu Signed-off-by: Luiz Augusto von Dentz Stable-dep-of: 19b4e5701712 ("Bluetooth: hci_core: Fix queuing rx_work while workqueue is drained") Signed-off-by: Sasha Levin --- drivers/bluetooth/btintel.c | 25 +++++++++++++++++++++++-- include/net/bluetooth/hci_core.h | 1 + net/bluetooth/hci_core.c | 16 ++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index 8286397b96845..6aadd6547970d 100644 --- a/drivers/bluetooth/btintel.c +++ b/drivers/bluetooth/btintel.c @@ -2581,6 +2581,24 @@ static void btintel_set_dsm_reset_method(struct hci_dev *hdev, data->acpi_reset_method = btintel_acpi_reset_method; } +#define BTINTEL_ISODATA_HANDLE_BASE 0x900 + +static u8 btintel_classify_pkt_type(struct hci_dev *hdev, struct sk_buff *skb) +{ + /* + * Distinguish ISO data packets form ACL data packets + * based on their connection handle value range. + */ + if (hci_skb_pkt_type(skb) == HCI_ACLDATA_PKT) { + __u16 handle = __le16_to_cpu(hci_acl_hdr(skb)->handle); + + if (hci_handle(handle) >= BTINTEL_ISODATA_HANDLE_BASE) + return HCI_ISODATA_PKT; + } + + return hci_skb_pkt_type(skb); +} + int btintel_bootloader_setup_tlv(struct hci_dev *hdev, struct intel_version_tlv *ver) { @@ -2885,11 +2903,14 @@ static int btintel_setup_combined(struct hci_dev *hdev) err = btintel_bootloader_setup(hdev, &ver); btintel_register_devcoredump_support(hdev); break; + case 0x18: /* GfP2 */ + case 0x1c: /* GaP */ + /* Re-classify packet type for controllers with LE audio */ + hdev->classify_pkt_type = btintel_classify_pkt_type; + fallthrough; case 0x17: - case 0x18: case 0x19: case 0x1b: - case 0x1c: case 0x1e: /* Display version information of TLV type */ btintel_version_info_tlv(hdev, &ver_tlv); diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 62804d98d3ee2..b13687023a0f2 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -651,6 +651,7 @@ struct hci_dev { int (*get_codec_config_data)(struct hci_dev *hdev, __u8 type, struct bt_codec *codec, __u8 *vnd_len, __u8 **vnd_data); + u8 (*classify_pkt_type)(struct hci_dev *hdev, struct sk_buff *skb); }; #define HCI_PHY_HANDLE(handle) (handle & 0xff) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 42b1f40c86542..7248e98e23cff 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -2914,15 +2914,31 @@ int hci_reset_dev(struct hci_dev *hdev) } EXPORT_SYMBOL(hci_reset_dev); +static u8 hci_dev_classify_pkt_type(struct hci_dev *hdev, struct sk_buff *skb) +{ + if (hdev->classify_pkt_type) + return hdev->classify_pkt_type(hdev, skb); + + return hci_skb_pkt_type(skb); +} + /* Receive frame from HCI drivers */ int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb) { + u8 dev_pkt_type; + if (!hdev || (!test_bit(HCI_UP, &hdev->flags) && !test_bit(HCI_INIT, &hdev->flags))) { kfree_skb(skb); return -ENXIO; } + /* Check if the driver agree with packet type classification */ + dev_pkt_type = hci_dev_classify_pkt_type(hdev, skb); + if (hci_skb_pkt_type(skb) != dev_pkt_type) { + hci_skb_pkt_type(skb) = dev_pkt_type; + } + switch (hci_skb_pkt_type(skb)) { case HCI_EVENT_PKT: break; -- 2.53.0