Skip to contentSkip to conversation

ath10k: add helper method to grab debug stats.

PATCH In review [email protected] 2 participants 4 messages Apr 1, 2014 – Apr 5, 2014 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath10k: add helper method to grab debug stats.

From: Ben Greear <[email protected]>

It can be nice to update the firmware's stats while debugging other bits of the driver, so add helper method to do this.

---
 drivers/net/wireless/ath/ath10k/debug.c | 26 +++++++++++++++++---------
 drivers/net/wireless/ath/ath10k/debug.h |  2 ++
 2 files changed, 19 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath10k/debug.c +17 -9
index f562ac5..5813286 100644
@@ -283,6 +283,21 @@ void ath10k_debug_read_target_stats(struct ath10k *ar,
 	complete(&ar->debug.event_stats_compl);
 }
 
+int ath10k_refresh_peer_stats(struct ath10k *ar)
+{
+	int ret = ath10k_wmi_request_stats(ar, WMI_REQUEST_PEER_STAT);
+	if (ret) {
+		ath10k_warn("could not request stats (%d)\n", ret);
+		return ret;
+	}
+
+	ret = wait_for_completion_timeout(&ar->debug.event_stats_compl, 1*HZ);
+	if (ret <= 0)
+		return ret;
+
+	return 0;
+}
+
 static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf,
 				    size_t count, loff_t *ppos)
 {
@@ -291,7 +306,6 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf,
 	char *buf = NULL;
 	unsigned int len = 0, buf_len = 8000;
 	ssize_t ret_cnt = 0;
-	long left;
 	int i;
 	int ret;
 
@@ -306,14 +320,8 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf,
 	if (!buf)
 		goto exit;
 
-	ret = ath10k_wmi_request_stats(ar, WMI_REQUEST_PEER_STAT);
-	if (ret) {
-		ath10k_warn("could not request stats (%d)\n", ret);
-		goto exit;
-	}
-
-	left = wait_for_completion_timeout(&ar->debug.event_stats_compl, 1*HZ);
-	if (left <= 0)
+	ret = ath10k_refresh_peer_stats(ar);
+	if (ret)
 		goto exit;
 
 	spin_lock_bh(&ar->data_lock);
drivers/net/wireless/ath/ath10k/debug.h +2 -0
index 12573fa..e5d1391 100644
@@ -135,4 +135,6 @@ struct dbglog_hdr_s {
 
 void ath10k_dbg_print_fw_dbg_buffer(u8 *buffer, int len, const char* lvl);
 
+int ath10k_refresh_peer_stats(struct ath10k *ar);
+
 #endif /* _DEBUG_H_ */
Signature · 7 lines
1.7.11.7


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#1 lore raw
Quoted 7 lines · [email protected] writes:

From: Ben Greear <[email protected]>

It can be nice to update the firmware's stats while debugging other bits of the driver, so add helper method to do this.

[...]

drivers/net/wireless/ath/ath10k/debug.h struct dbglog_hdr_s { · line 138

Quoted 7 lines
drivers/net/wireless/ath/ath10k/debug.h +1 -0
@@ -135,4 +135,6 @@ struct dbglog_hdr_s {
 
 void ath10k_dbg_print_fw_dbg_buffer(u8 *buffer, int len, const char* lvl);
 
+int ath10k_refresh_peer_stats(struct ath10k *ar);

I don't see anyone calling this. How are you planning to use it?

Signature · 1 line
Kalle Valo
author
#2 lore raw
Quoted 16 lines · Kalle Valo
Quoted 7 lines · [email protected] writes:

From: Ben Greear <[email protected]>

It can be nice to update the firmware's stats while debugging other bits of the driver, so add helper method to do this.

[...]

Quoted 4 lines
drivers/net/wireless/ath/ath10k/debug.h +0 -0
@@ -135,4 +135,6 @@ struct dbglog_hdr_s {
 
Quoted 5 lines

drivers/net/wireless/ath/ath10k/debug.h struct dbglog_hdr_s { · line 138

Quoted 3 lines
drivers/net/wireless/ath/ath10k/debug.h +1 -0
  void ath10k_dbg_print_fw_dbg_buffer(u8 *buffer, int len, const char* lvl);
 
+int ath10k_refresh_peer_stats(struct ath10k *ar);

I don't see anyone calling this. How are you planning to use it?

The RFC patch that debugs tx-hang calls it..nice to see he firmware's buffer reap stats and such before/after trying to flush the buffers.

I figure it will be useful for other such uses as well, now that stats actually work.

Thanks,
Ben

Signature · 8 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#3 lore raw
Quoted 23 lines · Ben Greear
Quoted 16 lines · Kalle Valo
Quoted 7 lines · [email protected] writes:

From: Ben Greear <[email protected]>

It can be nice to update the firmware's stats while debugging other bits of the driver, so add helper method to do this.

[...]

Quoted 4 lines
drivers/net/wireless/ath/ath10k/debug.h +0 -0
@@ -135,4 +135,6 @@ struct dbglog_hdr_s {
 
Quoted 5 lines

drivers/net/wireless/ath/ath10k/debug.h struct dbglog_hdr_s { · line 138

Quoted 3 lines
drivers/net/wireless/ath/ath10k/debug.h +1 -0
  void ath10k_dbg_print_fw_dbg_buffer(u8 *buffer, int len, const char* lvl);
 
+int ath10k_refresh_peer_stats(struct ath10k *ar);

I don't see anyone calling this. How are you planning to use it?

Quoted 5 lines

The RFC patch that debugs tx-hang calls it..nice to see he firmware's buffer reap stats and such before/after trying to flush the buffers.

I figure it will be useful for other such uses as well, now that stats actually work.

Ok, I'll drop this patch for now. You can resend when we have callers for this.

Signature · 1 line
Kalle Valo