Skip to contentSkip to conversation

Bluetooth: Add a helper function to extract iso header

PATCH In review Kiran K 4 participants 6 messages Jul 26, 2024 – Aug 6, 2024

Subsystems (2)
lore
Share & tools
lore

Kiran K

author
#0 lore raw

PATCH 1/3 Bluetooth: Add a helper function to extract iso header

Add a helper function hci_iso_hdr() to extract iso header from skb.

---
 include/net/bluetooth/hci.h | 5 +++++
 1 file changed, 5 insertions(+)
include/net/bluetooth/hci.h +5 -0
index e372a88e8c3f..ace5d210af38 100644
@@ -2898,6 +2898,11 @@ static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
 	return (struct hci_sco_hdr *) skb->data;
 }
 
+static inline struct hci_iso_hdr *hci_iso_hdr(const struct sk_buff *skb)
+{
+	return (struct hci_iso_hdr *)skb->data;
+}
+
 /* Command opcode pack/unpack */
 #define hci_opcode_pack(ogf, ocf)	((__u16) ((ocf & 0x03ff)|(ogf << 10)))
 #define hci_opcode_ogf(op)		(op >> 10)
Signature · 1 line
2.40.1
author
#1 lore raw

PATCH 2/3 Bluetooth: Add tx/rx counters to track iso packets

Add counters in hci_dev_stats to track iso tx and rx packets.

---
 include/net/bluetooth/hci_sock.h | 2 ++
 net/bluetooth/hci_core.c         | 2 ++
 2 files changed, 4 insertions(+)
include/net/bluetooth/hci_sock.h +2 -0
index 13e8cd4414a1..98991a11844a 100644
@@ -101,6 +101,8 @@ struct hci_dev_stats {
 	__u32 acl_rx;
 	__u32 sco_tx;
 	__u32 sco_rx;
+	__u32 iso_tx;
+	__u32 iso_rx;
 	__u32 byte_rx;
 	__u32 byte_tx;
 };
net/bluetooth/hci_core.c +2 -0
index 8a4ebd93adfc..b0d40b62238b 100644
@@ -3858,6 +3858,8 @@ static void hci_isodata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 	bt_dev_dbg(hdev, "len %d handle 0x%4.4x flags 0x%4.4x", skb->len,
 		   handle, flags);
 
+	hdev->stat.iso_rx++;
+
 	hci_dev_lock(hdev);
 	conn = hci_conn_hash_lookup_handle(hdev, handle);
 	hci_dev_unlock(hdev);
Signature · 1 line
2.40.1
#2 lore raw

Re: [PATCH v1 2/3] Bluetooth: Add tx/rx counters to track iso packets

Hi Kiran,

Quoted 36 lines · Kiran K

Add counters in hci_dev_stats to track iso tx and rx packets.

---
 include/net/bluetooth/hci_sock.h | 2 ++
 net/bluetooth/hci_core.c         | 2 ++
 2 files changed, 4 insertions(+)
include/net/bluetooth/hci_sock.h +2 -0
index 13e8cd4414a1..98991a11844a 100644
@@ -101,6 +101,8 @@ struct hci_dev_stats {
        __u32 acl_rx;
        __u32 sco_tx;
        __u32 sco_rx;
+       __u32 iso_tx;
+       __u32 iso_rx;
        __u32 byte_rx;
        __u32 byte_tx;
 };
net/bluetooth/hci_core.c +2 -1
index 8a4ebd93adfc..b0d40b62238b 100644
@@ -3858,6 +3858,8 @@ static void hci_isodata_packet(struct hci_dev *hdev, struct sk_buff *skb)
        bt_dev_dbg(hdev, "len %d handle 0x%4.4x flags 0x%4.4x", skb->len,
                   handle, flags);
 
+       hdev->stat.iso_rx++;
+
        hci_dev_lock(hdev);
        conn = hci_conn_hash_lookup_handle(hdev, handle);
        hci_dev_unlock(hdev);
--
Quoted 1 line

2.40.1

This breaks HCIGETDEVINFO since it changes its size, not really sure how ioctl-tester pass it but perhaps it is not really checking the size, anyway that's why Ive left it unchanged since otherwise we have to break ioctl APIs which are considered deprecated anyway.

Signature · 1 line
Luiz Augusto von Dentz
author
#3 lore raw

PATCH 3/3 Bluetooth: btintel_pcie: Add support for ISO data

In reply to Kiran K

From: Kiran <[email protected]>

Add support for handling ISO RX and TX packets.

---
 drivers/bluetooth/btintel_pcie.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/bluetooth/btintel_pcie.c +17 -0
index 0d1a0415557b..8a5b5bce0a7d 100644
@@ -46,6 +46,7 @@ MODULE_DEVICE_TABLE(pci, btintel_pcie_table);
 #define BTINTEL_PCIE_HCI_ACL_PKT	0x00000002
 #define BTINTEL_PCIE_HCI_SCO_PKT	0x00000003
 #define BTINTEL_PCIE_HCI_EVT_PKT	0x00000004
+#define BTINTEL_PCIE_HCI_ISO_PKT	0x00000005
 
 static inline void ipc_print_ia_ring(struct hci_dev *hdev, struct ia *ia,
 				     u16 queue_num)
@@ -423,6 +424,18 @@ static int btintel_pcie_recv_frame(struct btintel_pcie_data *data,
 			goto exit_error;
 		}
 		break;
+
+	case BTINTEL_PCIE_HCI_ISO_PKT:
+		if (skb->len >= HCI_ISO_HDR_SIZE) {
+			plen = HCI_ISO_HDR_SIZE + __le16_to_cpu(hci_iso_hdr(skb)->dlen);
+			pkt_type = HCI_ISODATA_PKT;
+		} else {
+			bt_dev_err(hdev, "ISO packet is too short");
+			ret = -EILSEQ;
+			goto exit_error;
+		}
+		break;
+
 	default:
 		bt_dev_err(hdev, "Invalid packet type received: 0x%4.4x",
 			   pcie_pkt_type);
@@ -1082,6 +1095,10 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
 		type = BTINTEL_PCIE_HCI_SCO_PKT;
 		hdev->stat.sco_tx++;
 		break;
+	case HCI_ISODATA_PKT:
+		type = BTINTEL_PCIE_HCI_ISO_PKT;
+		hdev->stat.iso_tx++;
+		break;
 	default:
 		bt_dev_err(hdev, "Unknown HCI packet type");
 		return -EILSEQ;
Signature · 1 line
2.40.1
#4 lore raw
In reply to Kiran K

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=874047

---Test result---

Test Summary:

CheckPatch                    PASS      2.08 seconds
GitLint                       PASS      0.93 seconds
SubjectPrefix                 PASS      0.35 seconds
BuildKernel                   PASS      29.56 seconds
CheckAllWarning               PASS      32.00 seconds
CheckSparse                   PASS      37.29 seconds
CheckSmatch                   PASS      102.80 seconds
BuildKernel32                 PASS      28.72 seconds
TestRunnerSetup               PASS      527.14 seconds
TestRunner_l2cap-tester       PASS      19.91 seconds
TestRunner_iso-tester         PASS      28.97 seconds
TestRunner_bnep-tester        PASS      4.86 seconds
TestRunner_mgmt-tester        PASS      119.13 seconds
TestRunner_rfcomm-tester      PASS      7.46 seconds
TestRunner_sco-tester         PASS      15.08 seconds
TestRunner_ioctl-tester       PASS      8.02 seconds
TestRunner_mesh-tester        FAIL      8.17 seconds
TestRunner_smp-tester         PASS      6.91 seconds
TestRunner_userchan-tester    PASS      6.66 seconds
IncrementalBuild              PASS      57.24 seconds

Details
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner Output:
Total: 10, Passed: 9 (90.0%), Failed: 1, Not Run: 0

Failed Test Cases
Mesh - Send cancel - 1 Failed 0.100 seconds

---
Regards,
Linux Bluetooth

#5 lore raw
In reply to Kiran K
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 6 lines · On Fri, 26 Jul 2024 16:13:24 +0530 you wrote:

Add a helper function hci_iso_hdr() to extract iso header from skb.

---
 include/net/bluetooth/hci.h | 5 +++++
 1 file changed, 5 insertions(+)

Here is the summary with links:
- [v1,1/3] Bluetooth: Add a helper function to extract iso header

    https://git.kernel.org/bluetooth/bluetooth-next/c/54aca0cc489f

- [v1,2/3] Bluetooth: Add tx/rx counters to track iso packets (no matching commit)
- [v1,3/3] Bluetooth: btintel_pcie: Add support for ISO data (no matching commit)

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html