aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorZhu Yi <yi.zhu@intel.com>2007-09-26 23:27:43 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:53:27 -0400
commit0209dc11c769f51f037a17a4ea7bed43eaee998c (patch)
treeb1166b470ae87bd756bf7f7895b4707faa98e4eb /drivers
parent98d7e09af513da19389128f23d49893b11de81fa (diff)
[PATCH] iwlwifi: add debugfs rate scale stats
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> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.c40
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 e5f8cce443ba..287c75705c44 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 {
124 struct iwl_scale_tbl_info lq_info[LQ_SIZE]; 124 struct iwl_scale_tbl_info lq_info[LQ_SIZE];
125#ifdef CONFIG_MAC80211_DEBUGFS 125#ifdef CONFIG_MAC80211_DEBUGFS
126 struct dentry *rs_sta_dbgfs_scale_table_file; 126 struct dentry *rs_sta_dbgfs_scale_table_file;
127 struct dentry *rs_sta_dbgfs_stats_table_file;
127 struct iwl_rate dbg_fixed; 128 struct iwl_rate dbg_fixed;
128 struct iwl_priv *drv; 129 struct iwl_priv *drv;
129#endif 130#endif
@@ -2068,6 +2069,7 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
2068 2069
2069 return count; 2070 return count;
2070} 2071}
2072
2071static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, 2073static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
2072 char __user *user_buf, size_t count, loff_t *ppos) 2074 char __user *user_buf, size_t count, loff_t *ppos)
2073{ 2075{
@@ -2116,20 +2118,56 @@ static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
2116 .read = rs_sta_dbgfs_scale_table_read, 2118 .read = rs_sta_dbgfs_scale_table_read,
2117 .open = open_file_generic, 2119 .open = open_file_generic,
2118}; 2120};
2121static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file,
2122 char __user *user_buf, size_t count, loff_t *ppos)
2123{
2124 char buff[1024];
2125 int desc = 0;
2126 int i, j;
2127
2128 struct iwl_rate_scale_priv *rs_priv = file->private_data;
2129 for (i = 0; i < LQ_SIZE; i++) {
2130 desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n"
2131 "rate=0x%X\n",
2132 rs_priv->active_tbl == i?"*":"x",
2133 rs_priv->lq_info[i].lq_type,
2134 rs_priv->lq_info[i].is_SGI,
2135 rs_priv->lq_info[i].is_fat,
2136 rs_priv->lq_info[i].is_dup,
2137 rs_priv->lq_info[i].current_rate.rate_n_flags);
2138 for (j = 0; j < IWL_RATE_COUNT; j++) {
2139 desc += sprintf(buff+desc,
2140 "counter=%d success=%d %%=%d\n",
2141 rs_priv->lq_info[i].win[j].counter,
2142 rs_priv->lq_info[i].win[j].success_counter,
2143 rs_priv->lq_info[i].win[j].success_ratio);
2144 }
2145 }
2146 return simple_read_from_buffer(user_buf, count, ppos, buff, desc);
2147}
2148
2149static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
2150 .read = rs_sta_dbgfs_stats_table_read,
2151 .open = open_file_generic,
2152};
2119 2153
2120static void rs_add_debugfs(void *priv, void *priv_sta, 2154static void rs_add_debugfs(void *priv, void *priv_sta,
2121 struct dentry *dir) 2155 struct dentry *dir)
2122{ 2156{
2123 struct iwl_rate_scale_priv *rs_priv = priv_sta; 2157 struct iwl_rate_scale_priv *rs_priv = priv_sta;
2124 rs_priv->rs_sta_dbgfs_scale_table_file = 2158 rs_priv->rs_sta_dbgfs_scale_table_file =
2125 debugfs_create_file("rate_scale_table", 0444, dir, 2159 debugfs_create_file("rate_scale_table", 0600, dir,
2126 rs_priv, &rs_sta_dbgfs_scale_table_ops); 2160 rs_priv, &rs_sta_dbgfs_scale_table_ops);
2161 rs_priv->rs_sta_dbgfs_stats_table_file =
2162 debugfs_create_file("rate_stats_table", 0600, dir,
2163 rs_priv, &rs_sta_dbgfs_stats_table_ops);
2127} 2164}
2128 2165
2129static void rs_remove_debugfs(void *priv, void *priv_sta) 2166static void rs_remove_debugfs(void *priv, void *priv_sta)
2130{ 2167{
2131 struct iwl_rate_scale_priv *rs_priv = priv_sta; 2168 struct iwl_rate_scale_priv *rs_priv = priv_sta;
2132 debugfs_remove(rs_priv->rs_sta_dbgfs_scale_table_file); 2169 debugfs_remove(rs_priv->rs_sta_dbgfs_scale_table_file);
2170 debugfs_remove(rs_priv->rs_sta_dbgfs_stats_table_file);
2133} 2171}
2134#endif 2172#endif
2135 2173