All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhu Yi <yi.zhu@intel.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org, Zhu Yi <yi.zhu@intel.com>,
	Tomas Winkler <tomas.winkler@intel.com>
Subject: [PATCH] iwlwifi: add debugfs rate scale stats
Date: Thu, 27 Sep 2007 11:27:43 +0800	[thread overview]
Message-ID: <11908636833477-git-send-email-yi.zhu@intel.com> (raw)
In-Reply-To: <11908636823439-git-send-email-yi.zhu@intel.com>

This patch adds rates scale statistics to debugfs:
$ cat /sys/kernel/debug/ieee80211/phy<X>/stations/<mac>/rate_stats_table

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-4965-rs.c |   40 +++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index e5f8cce..287c757 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -124,6 +124,7 @@ struct iwl_rate_scale_priv {
 	struct iwl_scale_tbl_info lq_info[LQ_SIZE];
 #ifdef CONFIG_MAC80211_DEBUGFS
 	struct dentry *rs_sta_dbgfs_scale_table_file;
+	struct dentry *rs_sta_dbgfs_stats_table_file;
 	struct iwl_rate dbg_fixed;
 	struct iwl_priv *drv;
 #endif
@@ -2068,6 +2069,7 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
 
 	return count;
 }
+
 static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
 			char __user *user_buf, size_t count, loff_t *ppos)
 {
@@ -2116,20 +2118,56 @@ static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
 	.read = rs_sta_dbgfs_scale_table_read,
 	.open = open_file_generic,
 };
+static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file,
+			char __user *user_buf, size_t count, loff_t *ppos)
+{
+	char buff[1024];
+	int desc = 0;
+	int i, j;
+
+	struct iwl_rate_scale_priv *rs_priv = file->private_data;
+	for (i = 0; i < LQ_SIZE; i++) {
+		desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n"
+				"rate=0x%X\n",
+				rs_priv->active_tbl == i?"*":"x",
+				rs_priv->lq_info[i].lq_type,
+				rs_priv->lq_info[i].is_SGI,
+				rs_priv->lq_info[i].is_fat,
+				rs_priv->lq_info[i].is_dup,
+				rs_priv->lq_info[i].current_rate.rate_n_flags);
+		for (j = 0; j < IWL_RATE_COUNT; j++) {
+			desc += sprintf(buff+desc,
+					"counter=%d success=%d %%=%d\n",
+					rs_priv->lq_info[i].win[j].counter,
+					rs_priv->lq_info[i].win[j].success_counter,
+					rs_priv->lq_info[i].win[j].success_ratio);
+		}
+	}
+	return simple_read_from_buffer(user_buf, count, ppos, buff, desc);
+}
+
+static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
+	.read = rs_sta_dbgfs_stats_table_read,
+	.open = open_file_generic,
+};
 
 static void rs_add_debugfs(void *priv, void *priv_sta,
 					struct dentry *dir)
 {
 	struct iwl_rate_scale_priv *rs_priv = priv_sta;
 	rs_priv->rs_sta_dbgfs_scale_table_file =
-		debugfs_create_file("rate_scale_table", 0444, dir,
+		debugfs_create_file("rate_scale_table", 0600, dir,
 				rs_priv, &rs_sta_dbgfs_scale_table_ops);
+	rs_priv->rs_sta_dbgfs_stats_table_file =
+		debugfs_create_file("rate_stats_table", 0600, dir,
+			rs_priv, &rs_sta_dbgfs_stats_table_ops);
 }
 
 static void rs_remove_debugfs(void *priv, void *priv_sta)
 {
 	struct iwl_rate_scale_priv *rs_priv = priv_sta;
 	debugfs_remove(rs_priv->rs_sta_dbgfs_scale_table_file);
+	debugfs_remove(rs_priv->rs_sta_dbgfs_stats_table_file);
 }
 #endif
 
-- 
1.5.1

  reply	other threads:[~2007-09-27  3:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <11908636643693-git-send-email-yi.zhu@intel.com>
2007-09-27  3:27 ` [PATCH] iwlwifi: replacing IPW with IWL in error messages Zhu Yi
2007-09-27  3:27   ` [PATCH] iwlwifi: workaournd REPLY_COMPRESSED_BA command in iwl_rx_handle Zhu Yi
2007-09-27  3:27     ` [PATCH] iwlwifi: Correction for sending beacon in config_ap Zhu Yi
2007-09-27  3:27       ` [PATCH] iwlwifi: clear station table in rxon unconditionally Zhu Yi
2007-09-27  3:27         ` [PATCH] iwlwifi: Fix typo in rate sacling algorithm Zhu Yi
2007-09-27  3:27           ` [PATCH] iwlwifi: fix add_station to avoid FW error Zhu Yi
2007-09-27  3:27             ` [PATCH] iwlwifi: removing unnecessary memset in 4965 rate scale Zhu Yi
2007-09-27  3:27               ` [PATCH] iwlwifi: add debugfs framework to " Zhu Yi
2007-09-27  3:27                 ` [PATCH] iwlwifi: add read rate scale table debugfs function Zhu Yi
2007-09-27  3:27                   ` [PATCH] iwlwifi: limit printouts on hot path Zhu Yi
2007-09-27  3:27                     ` [PATCH] iwlwifi: add supp_rates to rate scale sta private data Zhu Yi
2007-09-27  3:27                       ` [PATCH] iwlwifi: rs_rate_scale_perform clean up Zhu Yi
2007-09-27  3:27                         ` [PATCH] iwlwifi: set fixed rate through debugfs Zhu Yi
2007-09-27  3:27                           ` Zhu Yi [this message]
2007-09-27  3:27                             ` [PATCH] iwlwifi: Update iwlwifi version stamp to 1.1.17 Zhu Yi
2007-09-27  4:35                           ` [PATCH] iwlwifi: set fixed rate through debugfs Randy Dunlap
2007-09-27  4:43                             ` Zhu Yi
2007-09-27 14:26                               ` Randy Dunlap
2007-09-28  7:44                                 ` Tomas Winkler
2007-09-27  4:32   ` [PATCH] iwlwifi: replacing IPW with IWL in error messages Randy Dunlap
2007-09-27  4:42     ` Zhu Yi
2007-09-27 20:41 ` iwlwifi driver updates John W. Linville

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=11908636833477-git-send-email-yi.zhu@intel.com \
    --to=yi.zhu@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=tomas.winkler@intel.com \
    /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.