linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: greearb@candelatech.com
To: linux-wireless@vger.kernel.org
Cc: ath10k@lists.infradead.org, Ben Greear <greearb@candelatech.com>
Subject: [PATCH v2 02/10] ath10k: add helper method to grab debug stats.
Date: Tue, 23 Sep 2014 14:17:17 -0700	[thread overview]
Message-ID: <1411507045-18973-2-git-send-email-greearb@candelatech.com> (raw)
In-Reply-To: <1411507045-18973-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb@candelatech.com>

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

Signed-off-by: Ben Greear <greearb@candelatech.com>
---

v2:  No changes.

 drivers/net/wireless/ath/ath10k/debug.c | 26 +++++++++++++++++---------
 drivers/net/wireless/ath/ath10k/debug.h |  3 +++
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 101c6f9..c2c02ce 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -371,6 +371,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(ar, "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)
 {
@@ -379,7 +394,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;
 
@@ -394,14 +408,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(ar, "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);
diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h
index d6276fe..ba6d280 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -142,4 +142,7 @@ static inline void ath10k_dbg_dump(struct ath10k *ar,
 {
 }
 #endif /* CONFIG_ATH10K_DEBUG */
+
+int ath10k_refresh_peer_stats(struct ath10k *ar);
+
 #endif /* _DEBUG_H_ */
-- 
1.7.11.7


  reply	other threads:[~2014-09-23 21:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23 21:17 [PATCH v2 01/10] ath10k: use 64-bit vdev map greearb
2014-09-23 21:17 ` greearb [this message]
2014-09-23 21:17 ` [PATCH v2 03/10] ath10k: support ethtool stats greearb
2014-09-24  7:44   ` Michal Kazior
2014-09-24 14:37     ` Ben Greear
2014-09-29  8:21       ` Kalle Valo
2014-09-29 16:07         ` Ben Greear
2014-09-23 21:17 ` [PATCH v2 04/10] ath10k: make firmware text debug messages more verbose greearb
2014-11-22 15:28   ` Kalle Valo
2014-11-22 16:07     ` Ben Greear
2014-11-24 15:18       ` Kalle Valo
2014-11-24 14:19   ` Kalle Valo
2014-09-23 21:17 ` [PATCH v2 05/10] ath10k: apply chainmask settings to vdev on creation greearb
2014-11-26  6:25   ` Kalle Valo
2014-09-23 21:17 ` [PATCH v2 06/10] ath10k: use configured nss instead of max nss greearb
2014-11-04 19:55   ` Ben Greear
2014-11-13 13:22     ` Kalle Valo
2014-11-26  6:26   ` Kalle Valo
2014-09-23 21:17 ` [PATCH v2 07/10] ath10k: add fw-powerup-fail to ethtool stats greearb
2014-09-29  8:24   ` Kalle Valo
2014-09-29 16:05     ` Ben Greear
2014-09-30 12:27       ` Michal Kazior
2014-09-30 15:53         ` Ben Greear
2014-09-23 21:17 ` [PATCH v2 08/10] ath10k: support CT firmware flag greearb
2014-09-23 21:17 ` [PATCH v2 09/10] ath10k: always request htc tx replenishment greearb
2014-09-23 21:17 ` [PATCH v2 10/10] ath10k: request firmware flush in ath10k_flush greearb
2014-10-01  8:22 ` [PATCH v2 01/10] ath10k: use 64-bit vdev map Kalle Valo

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=1411507045-18973-2-git-send-email-greearb@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=ath10k@lists.infradead.org \
    --cc=linux-wireless@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).