diff mbox series

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

Message ID 20240726104326.459668-2-kiran.k@intel.com
State New
Headers show
Series [v1,1/3] Bluetooth: Add a helper function to extract iso header | expand

Commit Message

Kiran K July 26, 2024, 10:43 a.m. UTC
Add counters in hci_dev_stats to track iso tx and rx packets.

Signed-off-by: Kiran K <kiran.k@intel.com>
---
 include/net/bluetooth/hci_sock.h | 2 ++
 net/bluetooth/hci_core.c         | 2 ++
 2 files changed, 4 insertions(+)

Comments

Luiz Augusto von Dentz Aug. 6, 2024, 2:22 p.m. UTC | #1
Hi Kiran,

On Fri, Jul 26, 2024 at 6:30 AM Kiran K <kiran.k@intel.com> wrote:
>
> Add counters in hci_dev_stats to track iso tx and rx packets.
>
> Signed-off-by: Kiran K <kiran.k@intel.com>
> ---
>  include/net/bluetooth/hci_sock.h | 2 ++
>  net/bluetooth/hci_core.c         | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/include/net/bluetooth/hci_sock.h b/include/net/bluetooth/hci_sock.h
> index 13e8cd4414a1..98991a11844a 100644
> --- a/include/net/bluetooth/hci_sock.h
> +++ b/include/net/bluetooth/hci_sock.h
> @@ -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;
>  };
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 8a4ebd93adfc..b0d40b62238b 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -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);
> --
> 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.
diff mbox series

Patch

diff --git a/include/net/bluetooth/hci_sock.h b/include/net/bluetooth/hci_sock.h
index 13e8cd4414a1..98991a11844a 100644
--- a/include/net/bluetooth/hci_sock.h
+++ b/include/net/bluetooth/hci_sock.h
@@ -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;
 };
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 8a4ebd93adfc..b0d40b62238b 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -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);