From: Peter Hurley <peter@hurleysoftware.com>
To: linux-bluetooth <linux-bluetooth@vger.kernel.org>
Subject: [RFC v2 3/4] Bluetooth: Track per-connection stats
Date: Fri, 2 Sep 2011 19:52:46 -0400 [thread overview]
Message-ID: <1315007566.2495.5.camel@THOR> (raw)
Add per-hci connection rx/tx stats and expose through debugfs
"connections" file.
Example file contents:
s a p
h t t o s k u s s p r
n y a u s e t e e i e
Dest l p t t p y h c c n f
BC:0D:A5:7A:F5:96 14 ACL 1 1 1 0xff 0 1 0 0 1
00:0D:FD:1E:99:30 13 ACL 1 0 0 0xff 4 2 2 0 1
00:07:61:B2:3E:97 12 ACL 1 0 0 0xff 4 0 0 0 2
00:07:61:76:D8:1B 11 ACL 1 0 0 0xff 4 1 0 0 2
Rx Tx
Dest bytes pkt err null bytes pkt err unack
BC:0D:A5:7A:F5:96 0 0 0 0 0 0 0 7
00:0D:FD:1E:99:30 0 0 0 0 0 0 0 0
00:07:61:B2:3E:97 0 0 0 0 0 0 0 0
00:07:61:76:D8:1B 0 0 0 0 0 0 0 0
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
v2: Add example output to commit msg
include/net/bluetooth/hci_core.h | 12 ++++++++++++
net/bluetooth/hci_sysfs.c | 17 +++++++++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 6c994c0..1f2ed18 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -208,6 +208,16 @@ struct hci_dev {
int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
};
+struct hci_conn_stats {
+ __u32 null_rx;
+ __u32 err_rx;
+ __u32 err_tx;
+ __u32 pkt_rx;
+ __u32 pkt_tx;
+ __u32 byte_rx;
+ __u32 byte_tx;
+};
+
struct hci_conn {
struct list_head list;
@@ -253,6 +263,8 @@ struct hci_conn {
struct work_struct work_add;
struct work_struct work_del;
+ struct hci_conn_stats stats;
+
struct device dev;
atomic_t devref;
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 3d00769..0775398 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -568,6 +568,23 @@ static int connections_show(struct seq_file *f, void *p)
atomic_read(&c->devref));
}
+ seq_printf(f, "\n\n Rx "
+ "Tx\n");
+ seq_printf(f, "Dest bytes pkt err null "
+ "bytes pkt err unack\n");
+
+ list_for_each(l, &h->list) {
+ struct hci_conn *c;
+ c = list_entry(l, struct hci_conn, list);
+
+ seq_printf(f,"%s %-11u %-6u %-3u %-5u %-11u %-6u %-3u %u\n",
+ batostr(&c->dst),
+ c->stats.byte_rx, c->stats.pkt_rx,
+ c->stats.err_rx, c->stats.null_rx,
+ c->stats.byte_tx, c->stats.pkt_tx,
+ c->stats.err_tx, c->sent);
+ };
+
hci_dev_unlock_bh(hdev);
return 0;
--
1.7.4.1
reply other threads:[~2011-09-02 23:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1315007566.2495.5.camel@THOR \
--to=peter@hurleysoftware.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.