aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAbhijeet Kolekar <abhijeet.kolekar@intel.com>2010-04-08 18:29:07 -0400
committerReinette Chatre <reinette.chatre@intel.com>2010-04-16 16:51:31 -0400
commitb8c76267cfb9a025afdd122bc2a8942dbf493dd1 (patch)
treebfb110fa71b0285003651ad05f4ff3c74f8d69d5 /drivers/net
parent69e72801224693bb520cf3ece5e6bf67f0448c96 (diff)
iwlwifi: add debugfs ops to iwlwifi
Seperate debugfs functions into iwlagn specific debugfs file and Add debugfs ops to iwlwifi. Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwlwifi/Makefile1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c834
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h56
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debug.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c775
10 files changed, 973 insertions, 739 deletions
diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile
index a684a72eb6e..5ed2dcbe6d0 100644
--- a/drivers/net/wireless/iwlwifi/Makefile
+++ b/drivers/net/wireless/iwlwifi/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_IWLAGN) += iwlagn.o
12iwlagn-objs := iwl-agn.o iwl-agn-rs.o iwl-agn-led.o iwl-agn-ict.o 12iwlagn-objs := iwl-agn.o iwl-agn-rs.o iwl-agn-led.o iwl-agn-ict.o
13iwlagn-objs += iwl-agn-ucode.o iwl-agn-hcmd.o iwl-agn-tx.o 13iwlagn-objs += iwl-agn-ucode.o iwl-agn-hcmd.o iwl-agn-tx.o
14iwlagn-objs += iwl-agn-lib.o 14iwlagn-objs += iwl-agn-lib.o
15iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-agn-debugfs.o
15 16
16iwlagn-$(CONFIG_IWL4965) += iwl-4965.o 17iwlagn-$(CONFIG_IWL4965) += iwl-4965.o
17iwlagn-$(CONFIG_IWL5000) += iwl-5000.o 18iwlagn-$(CONFIG_IWL5000) += iwl-5000.o
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 9a0191a5ea3..8431ffce37d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -46,6 +46,7 @@
46#include "iwl-helpers.h" 46#include "iwl-helpers.h"
47#include "iwl-agn-hw.h" 47#include "iwl-agn-hw.h"
48#include "iwl-agn-led.h" 48#include "iwl-agn-led.h"
49#include "iwl-agn-debugfs.h"
49 50
50/* Highest firmware API version supported */ 51/* Highest firmware API version supported */
51#define IWL1000_UCODE_API_MAX 3 52#define IWL1000_UCODE_API_MAX 3
@@ -212,6 +213,11 @@ static struct iwl_lib_ops iwl1000_lib = {
212 .set_ct_kill = iwl1000_set_ct_threshold, 213 .set_ct_kill = iwl1000_set_ct_threshold,
213 }, 214 },
214 .add_bcast_station = iwl_add_bcast_station, 215 .add_bcast_station = iwl_add_bcast_station,
216 .debugfs_ops = {
217 .rx_stats_read = iwl_ucode_rx_stats_read,
218 .tx_stats_read = iwl_ucode_tx_stats_read,
219 .general_stats_read = iwl_ucode_general_stats_read,
220 },
215 .recover_from_tx_stall = iwl_bg_monitor_recover, 221 .recover_from_tx_stall = iwl_bg_monitor_recover,
216 .check_plcp_health = iwl_good_plcp_health, 222 .check_plcp_health = iwl_good_plcp_health,
217 .check_ack_health = iwl_good_ack_health, 223 .check_ack_health = iwl_good_ack_health,
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 0a5f21e1488..85672978cab 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -47,6 +47,7 @@
47#include "iwl-sta.h" 47#include "iwl-sta.h"
48#include "iwl-agn-led.h" 48#include "iwl-agn-led.h"
49#include "iwl-agn.h" 49#include "iwl-agn.h"
50#include "iwl-agn-debugfs.h"
50 51
51static int iwl4965_send_tx_power(struct iwl_priv *priv); 52static int iwl4965_send_tx_power(struct iwl_priv *priv);
52static int iwl4965_hw_get_temperature(struct iwl_priv *priv); 53static int iwl4965_hw_get_temperature(struct iwl_priv *priv);
@@ -2217,6 +2218,11 @@ static struct iwl_lib_ops iwl4965_lib = {
2217 .set_ct_kill = iwl4965_set_ct_threshold, 2218 .set_ct_kill = iwl4965_set_ct_threshold,
2218 }, 2219 },
2219 .add_bcast_station = iwl_add_bcast_station, 2220 .add_bcast_station = iwl_add_bcast_station,
2221 .debugfs_ops = {
2222 .rx_stats_read = iwl_ucode_rx_stats_read,
2223 .tx_stats_read = iwl_ucode_tx_stats_read,
2224 .general_stats_read = iwl_ucode_general_stats_read,
2225 },
2220 .check_plcp_health = iwl_good_plcp_health, 2226 .check_plcp_health = iwl_good_plcp_health,
2221}; 2227};
2222 2228
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index e967cfcac22..e4349368527 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -48,6 +48,7 @@
48#include "iwl-agn-led.h" 48#include "iwl-agn-led.h"
49#include "iwl-agn-hw.h" 49#include "iwl-agn-hw.h"
50#include "iwl-5000-hw.h" 50#include "iwl-5000-hw.h"
51#include "iwl-agn-debugfs.h"
51 52
52/* Highest firmware API version supported */ 53/* Highest firmware API version supported */
53#define IWL5000_UCODE_API_MAX 2 54#define IWL5000_UCODE_API_MAX 2
@@ -320,6 +321,11 @@ static struct iwl_lib_ops iwl5000_lib = {
320 .set_ct_kill = iwl5000_set_ct_threshold, 321 .set_ct_kill = iwl5000_set_ct_threshold,
321 }, 322 },
322 .add_bcast_station = iwl_add_bcast_station, 323 .add_bcast_station = iwl_add_bcast_station,
324 .debugfs_ops = {
325 .rx_stats_read = iwl_ucode_rx_stats_read,
326 .tx_stats_read = iwl_ucode_tx_stats_read,
327 .general_stats_read = iwl_ucode_general_stats_read,
328 },
323 .recover_from_tx_stall = iwl_bg_monitor_recover, 329 .recover_from_tx_stall = iwl_bg_monitor_recover,
324 .check_plcp_health = iwl_good_plcp_health, 330 .check_plcp_health = iwl_good_plcp_health,
325 .check_ack_health = iwl_good_ack_health, 331 .check_ack_health = iwl_good_ack_health,
@@ -377,6 +383,11 @@ static struct iwl_lib_ops iwl5150_lib = {
377 .set_ct_kill = iwl5150_set_ct_threshold, 383 .set_ct_kill = iwl5150_set_ct_threshold,
378 }, 384 },
379 .add_bcast_station = iwl_add_bcast_station, 385 .add_bcast_station = iwl_add_bcast_station,
386 .debugfs_ops = {
387 .rx_stats_read = iwl_ucode_rx_stats_read,
388 .tx_stats_read = iwl_ucode_tx_stats_read,
389 .general_stats_read = iwl_ucode_general_stats_read,
390 },
380 .recover_from_tx_stall = iwl_bg_monitor_recover, 391 .recover_from_tx_stall = iwl_bg_monitor_recover,
381 .check_plcp_health = iwl_good_plcp_health, 392 .check_plcp_health = iwl_good_plcp_health,
382 .check_ack_health = iwl_good_ack_health, 393 .check_ack_health = iwl_good_ack_health,
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 63d27e3e4e3..7b695e757a2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -47,6 +47,7 @@
47#include "iwl-agn-hw.h" 47#include "iwl-agn-hw.h"
48#include "iwl-6000-hw.h" 48#include "iwl-6000-hw.h"
49#include "iwl-agn-led.h" 49#include "iwl-agn-led.h"
50#include "iwl-agn-debugfs.h"
50 51
51/* Highest firmware API version supported */ 52/* Highest firmware API version supported */
52#define IWL6000_UCODE_API_MAX 4 53#define IWL6000_UCODE_API_MAX 4
@@ -284,6 +285,11 @@ static struct iwl_lib_ops iwl6000_lib = {
284 .set_ct_kill = iwl6000_set_ct_threshold, 285 .set_ct_kill = iwl6000_set_ct_threshold,
285 }, 286 },
286 .add_bcast_station = iwl_add_bcast_station, 287 .add_bcast_station = iwl_add_bcast_station,
288 .debugfs_ops = {
289 .rx_stats_read = iwl_ucode_rx_stats_read,
290 .tx_stats_read = iwl_ucode_tx_stats_read,
291 .general_stats_read = iwl_ucode_general_stats_read,
292 },
287 .recover_from_tx_stall = iwl_bg_monitor_recover, 293 .recover_from_tx_stall = iwl_bg_monitor_recover,
288 .check_plcp_health = iwl_good_plcp_health, 294 .check_plcp_health = iwl_good_plcp_health,
289 .check_ack_health = iwl_good_ack_health, 295 .check_ack_health = iwl_good_ack_health,
@@ -352,6 +358,11 @@ static struct iwl_lib_ops iwl6050_lib = {
352 .set_calib_version = iwl6050_set_calib_version, 358 .set_calib_version = iwl6050_set_calib_version,
353 }, 359 },
354 .add_bcast_station = iwl_add_bcast_station, 360 .add_bcast_station = iwl_add_bcast_station,
361 .debugfs_ops = {
362 .rx_stats_read = iwl_ucode_rx_stats_read,
363 .tx_stats_read = iwl_ucode_tx_stats_read,
364 .general_stats_read = iwl_ucode_general_stats_read,
365 },
355 .recover_from_tx_stall = iwl_bg_monitor_recover, 366 .recover_from_tx_stall = iwl_bg_monitor_recover,
356 .check_plcp_health = iwl_good_plcp_health, 367 .check_plcp_health = iwl_good_plcp_health,
357 .check_ack_health = iwl_good_ack_health, 368 .check_ack_health = iwl_good_ack_health,
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c
new file mode 100644
index 00000000000..f249b706bf1
--- /dev/null
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c
@@ -0,0 +1,834 @@
1/******************************************************************************
2*
3* GPL LICENSE SUMMARY
4*
5* Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
6*
7* This program is free software; you can redistribute it and/or modify
8* it under the terms of version 2 of the GNU General Public License as
9* published by the Free Software Foundation.
10*
11* This program is distributed in the hope that it will be useful, but
12* WITHOUT ANY WARRANTY; without even the implied warranty of
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14* General Public License for more details.
15*
16* You should have received a copy of the GNU General Public License
17* along with this program; if not, write to the Free Software
18* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
19* USA
20*
21* The full GNU General Public License is included in this distribution
22* in the file called LICENSE.GPL.
23*
24* Contact Information:
25* Intel Linux Wireless <ilw@linux.intel.com>
26* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27*****************************************************************************/
28
29#include "iwl-agn-debugfs.h"
30
31ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf,
32 size_t count, loff_t *ppos)
33 {
34 struct iwl_priv *priv = file->private_data;
35 int pos = 0;
36 char *buf;
37 int bufsz = sizeof(struct statistics_rx_phy) * 40 +
38 sizeof(struct statistics_rx_non_phy) * 40 +
39 sizeof(struct statistics_rx_ht_phy) * 40 + 400;
40 ssize_t ret;
41 struct statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm;
42 struct statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
43 struct statistics_rx_non_phy *general, *accum_general;
44 struct statistics_rx_non_phy *delta_general, *max_general;
45 struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;
46
47 if (!iwl_is_alive(priv))
48 return -EAGAIN;
49
50 buf = kzalloc(bufsz, GFP_KERNEL);
51 if (!buf) {
52 IWL_ERR(priv, "Can not allocate Buffer\n");
53 return -ENOMEM;
54 }
55
56 /*
57 * the statistic information display here is based on
58 * the last statistics notification from uCode
59 * might not reflect the current uCode activity
60 */
61 ofdm = &priv->statistics.rx.ofdm;
62 cck = &priv->statistics.rx.cck;
63 general = &priv->statistics.rx.general;
64 ht = &priv->statistics.rx.ofdm_ht;
65 accum_ofdm = &priv->accum_statistics.rx.ofdm;
66 accum_cck = &priv->accum_statistics.rx.cck;
67 accum_general = &priv->accum_statistics.rx.general;
68 accum_ht = &priv->accum_statistics.rx.ofdm_ht;
69 delta_ofdm = &priv->delta_statistics.rx.ofdm;
70 delta_cck = &priv->delta_statistics.rx.cck;
71 delta_general = &priv->delta_statistics.rx.general;
72 delta_ht = &priv->delta_statistics.rx.ofdm_ht;
73 max_ofdm = &priv->max_delta.rx.ofdm;
74 max_cck = &priv->max_delta.rx.cck;
75 max_general = &priv->max_delta.rx.general;
76 max_ht = &priv->max_delta.rx.ofdm_ht;
77
78 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
79 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
80 "acumulative delta max\n",
81 "Statistics_Rx - OFDM:");
82 pos += scnprintf(buf + pos, bufsz - pos,
83 " %-30s %10u %10u %10u %10u\n",
84 "ina_cnt:", le32_to_cpu(ofdm->ina_cnt),
85 accum_ofdm->ina_cnt,
86 delta_ofdm->ina_cnt, max_ofdm->ina_cnt);
87 pos += scnprintf(buf + pos, bufsz - pos,
88 " %-30s %10u %10u %10u %10u\n",
89 "fina_cnt:",
90 le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt,
91 delta_ofdm->fina_cnt, max_ofdm->fina_cnt);
92 pos += scnprintf(buf + pos, bufsz - pos,
93 " %-30s %10u %10u %10u %10u\n",
94 "plcp_err:",
95 le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err,
96 delta_ofdm->plcp_err, max_ofdm->plcp_err);
97 pos += scnprintf(buf + pos, bufsz - pos,
98 " %-30s %10u %10u %10u %10u\n", "crc32_err:",
99 le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err,
100 delta_ofdm->crc32_err, max_ofdm->crc32_err);
101 pos += scnprintf(buf + pos, bufsz - pos,
102 " %-30s %10u %10u %10u %10u\n", "overrun_err:",
103 le32_to_cpu(ofdm->overrun_err),
104 accum_ofdm->overrun_err, delta_ofdm->overrun_err,
105 max_ofdm->overrun_err);
106 pos += scnprintf(buf + pos, bufsz - pos,
107 " %-30s %10u %10u %10u %10u\n",
108 "early_overrun_err:",
109 le32_to_cpu(ofdm->early_overrun_err),
110 accum_ofdm->early_overrun_err,
111 delta_ofdm->early_overrun_err,
112 max_ofdm->early_overrun_err);
113 pos += scnprintf(buf + pos, bufsz - pos,
114 " %-30s %10u %10u %10u %10u\n",
115 "crc32_good:", le32_to_cpu(ofdm->crc32_good),
116 accum_ofdm->crc32_good, delta_ofdm->crc32_good,
117 max_ofdm->crc32_good);
118 pos += scnprintf(buf + pos, bufsz - pos,
119 " %-30s %10u %10u %10u %10u\n", "false_alarm_cnt:",
120 le32_to_cpu(ofdm->false_alarm_cnt),
121 accum_ofdm->false_alarm_cnt,
122 delta_ofdm->false_alarm_cnt,
123 max_ofdm->false_alarm_cnt);
124 pos += scnprintf(buf + pos, bufsz - pos,
125 " %-30s %10u %10u %10u %10u\n",
126 "fina_sync_err_cnt:",
127 le32_to_cpu(ofdm->fina_sync_err_cnt),
128 accum_ofdm->fina_sync_err_cnt,
129 delta_ofdm->fina_sync_err_cnt,
130 max_ofdm->fina_sync_err_cnt);
131 pos += scnprintf(buf + pos, bufsz - pos,
132 " %-30s %10u %10u %10u %10u\n", "sfd_timeout:",
133 le32_to_cpu(ofdm->sfd_timeout),
134 accum_ofdm->sfd_timeout, delta_ofdm->sfd_timeout,
135 max_ofdm->sfd_timeout);
136 pos += scnprintf(buf + pos, bufsz - pos,
137 " %-30s %10u %10u %10u %10u\n", "fina_timeout:",
138 le32_to_cpu(ofdm->fina_timeout),
139 accum_ofdm->fina_timeout, delta_ofdm->fina_timeout,
140 max_ofdm->fina_timeout);
141 pos += scnprintf(buf + pos, bufsz - pos,
142 " %-30s %10u %10u %10u %10u\n",
143 "unresponded_rts:",
144 le32_to_cpu(ofdm->unresponded_rts),
145 accum_ofdm->unresponded_rts,
146 delta_ofdm->unresponded_rts,
147 max_ofdm->unresponded_rts);
148 pos += scnprintf(buf + pos, bufsz - pos,
149 " %-30s %10u %10u %10u %10u\n",
150 "rxe_frame_lmt_ovrun:",
151 le32_to_cpu(ofdm->rxe_frame_limit_overrun),
152 accum_ofdm->rxe_frame_limit_overrun,
153 delta_ofdm->rxe_frame_limit_overrun,
154 max_ofdm->rxe_frame_limit_overrun);
155 pos += scnprintf(buf + pos, bufsz - pos,
156 " %-30s %10u %10u %10u %10u\n", "sent_ack_cnt:",
157 le32_to_cpu(ofdm->sent_ack_cnt),
158 accum_ofdm->sent_ack_cnt, delta_ofdm->sent_ack_cnt,
159 max_ofdm->sent_ack_cnt);
160 pos += scnprintf(buf + pos, bufsz - pos,
161 " %-30s %10u %10u %10u %10u\n", "sent_cts_cnt:",
162 le32_to_cpu(ofdm->sent_cts_cnt),
163 accum_ofdm->sent_cts_cnt, delta_ofdm->sent_cts_cnt,
164 max_ofdm->sent_cts_cnt);
165 pos += scnprintf(buf + pos, bufsz - pos,
166 " %-30s %10u %10u %10u %10u\n",
167 "sent_ba_rsp_cnt:",
168 le32_to_cpu(ofdm->sent_ba_rsp_cnt),
169 accum_ofdm->sent_ba_rsp_cnt,
170 delta_ofdm->sent_ba_rsp_cnt,
171 max_ofdm->sent_ba_rsp_cnt);
172 pos += scnprintf(buf + pos, bufsz - pos,
173 " %-30s %10u %10u %10u %10u\n", "dsp_self_kill:",
174 le32_to_cpu(ofdm->dsp_self_kill),
175 accum_ofdm->dsp_self_kill,
176 delta_ofdm->dsp_self_kill,
177 max_ofdm->dsp_self_kill);
178 pos += scnprintf(buf + pos, bufsz - pos,
179 " %-30s %10u %10u %10u %10u\n",
180 "mh_format_err:",
181 le32_to_cpu(ofdm->mh_format_err),
182 accum_ofdm->mh_format_err,
183 delta_ofdm->mh_format_err,
184 max_ofdm->mh_format_err);
185 pos += scnprintf(buf + pos, bufsz - pos,
186 " %-30s %10u %10u %10u %10u\n",
187 "re_acq_main_rssi_sum:",
188 le32_to_cpu(ofdm->re_acq_main_rssi_sum),
189 accum_ofdm->re_acq_main_rssi_sum,
190 delta_ofdm->re_acq_main_rssi_sum,
191 max_ofdm->re_acq_main_rssi_sum);
192
193 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
194 "acumulative delta max\n",
195 "Statistics_Rx - CCK:");
196 pos += scnprintf(buf + pos, bufsz - pos,
197 " %-30s %10u %10u %10u %10u\n",
198 "ina_cnt:",
199 le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt,
200 delta_cck->ina_cnt, max_cck->ina_cnt);
201 pos += scnprintf(buf + pos, bufsz - pos,
202 " %-30s %10u %10u %10u %10u\n",
203 "fina_cnt:",
204 le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt,
205 delta_cck->fina_cnt, max_cck->fina_cnt);
206 pos += scnprintf(buf + pos, bufsz - pos,
207 " %-30s %10u %10u %10u %10u\n",
208 "plcp_err:",
209 le32_to_cpu(cck->plcp_err), accum_cck->plcp_err,
210 delta_cck->plcp_err, max_cck->plcp_err);
211 pos += scnprintf(buf + pos, bufsz - pos,
212 " %-30s %10u %10u %10u %10u\n",
213 "crc32_err:",
214 le32_to_cpu(cck->crc32_err), accum_cck->crc32_err,
215 delta_cck->crc32_err, max_cck->crc32_err);
216 pos += scnprintf(buf + pos, bufsz - pos,
217 " %-30s %10u %10u %10u %10u\n",
218 "overrun_err:",
219 le32_to_cpu(cck->overrun_err),
220 accum_cck->overrun_err, delta_cck->overrun_err,
221 max_cck->overrun_err);
222 pos += scnprintf(buf + pos, bufsz - pos,
223 " %-30s %10u %10u %10u %10u\n",
224 "early_overrun_err:",
225 le32_to_cpu(cck->early_overrun_err),
226 accum_cck->early_overrun_err,
227 delta_cck->early_overrun_err,
228 max_cck->early_overrun_err);
229 pos += scnprintf(buf + pos, bufsz - pos,
230 " %-30s %10u %10u %10u %10u\n",
231 "crc32_good:",
232 le32_to_cpu(cck->crc32_good), accum_cck->crc32_good,
233 delta_cck->crc32_good, max_cck->crc32_good);
234 pos += scnprintf(buf + pos, bufsz - pos,
235 " %-30s %10u %10u %10u %10u\n",
236 "false_alarm_cnt:",
237 le32_to_cpu(cck->false_alarm_cnt),
238 accum_cck->false_alarm_cnt,
239 delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt);
240 pos += scnprintf(buf + pos, bufsz - pos,
241 " %-30s %10u %10u %10u %10u\n",
242 "fina_sync_err_cnt:",
243 le32_to_cpu(cck->fina_sync_err_cnt),
244 accum_cck->fina_sync_err_cnt,
245 delta_cck->fina_sync_err_cnt,
246 max_cck->fina_sync_err_cnt);
247 pos += scnprintf(buf + pos, bufsz - pos,
248 " %-30s %10u %10u %10u %10u\n",
249 "sfd_timeout:",
250 le32_to_cpu(cck->sfd_timeout),
251 accum_cck->sfd_timeout, delta_cck->sfd_timeout,
252 max_cck->sfd_timeout);
253 pos += scnprintf(buf + pos, bufsz - pos,
254 " %-30s %10u %10u %10u %10u\n", "fina_timeout:",
255 le32_to_cpu(cck->fina_timeout),
256 accum_cck->fina_timeout, delta_cck->fina_timeout,
257 max_cck->fina_timeout);
258 pos += scnprintf(buf + pos, bufsz - pos,
259 " %-30s %10u %10u %10u %10u\n",
260 "unresponded_rts:",
261 le32_to_cpu(cck->unresponded_rts),
262 accum_cck->unresponded_rts, delta_cck->unresponded_rts,
263 max_cck->unresponded_rts);
264 pos += scnprintf(buf + pos, bufsz - pos,
265 " %-30s %10u %10u %10u %10u\n",
266 "rxe_frame_lmt_ovrun:",
267 le32_to_cpu(cck->rxe_frame_limit_overrun),
268 accum_cck->rxe_frame_limit_overrun,
269 delta_cck->rxe_frame_limit_overrun,
270 max_cck->rxe_frame_limit_overrun);
271 pos += scnprintf(buf + pos, bufsz - pos,
272 " %-30s %10u %10u %10u %10u\n", "sent_ack_cnt:",
273 le32_to_cpu(cck->sent_ack_cnt),
274 accum_cck->sent_ack_cnt, delta_cck->sent_ack_cnt,
275 max_cck->sent_ack_cnt);
276 pos += scnprintf(buf + pos, bufsz - pos,
277 " %-30s %10u %10u %10u %10u\n", "sent_cts_cnt:",
278 le32_to_cpu(cck->sent_cts_cnt),
279 accum_cck->sent_cts_cnt, delta_cck->sent_cts_cnt,
280 max_cck->sent_cts_cnt);
281 pos += scnprintf(buf + pos, bufsz - pos,
282 " %-30s %10u %10u %10u %10u\n", "sent_ba_rsp_cnt:",
283 le32_to_cpu(cck->sent_ba_rsp_cnt),
284 accum_cck->sent_ba_rsp_cnt,
285 delta_cck->sent_ba_rsp_cnt,
286 max_cck->sent_ba_rsp_cnt);
287 pos += scnprintf(buf + pos, bufsz - pos,
288 " %-30s %10u %10u %10u %10u\n", "dsp_self_kill:",
289 le32_to_cpu(cck->dsp_self_kill),
290 accum_cck->dsp_self_kill, delta_cck->dsp_self_kill,
291 max_cck->dsp_self_kill);
292 pos += scnprintf(buf + pos, bufsz - pos,
293 " %-30s %10u %10u %10u %10u\n", "mh_format_err:",
294 le32_to_cpu(cck->mh_format_err),
295 accum_cck->mh_format_err, delta_cck->mh_format_err,
296 max_cck->mh_format_err);
297 pos += scnprintf(buf + pos, bufsz - pos,
298 " %-30s %10u %10u %10u %10u\n",
299 "re_acq_main_rssi_sum:",
300 le32_to_cpu(cck->re_acq_main_rssi_sum),
301 accum_cck->re_acq_main_rssi_sum,
302 delta_cck->re_acq_main_rssi_sum,
303 max_cck->re_acq_main_rssi_sum);
304
305 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
306 "acumulative delta max\n",
307 "Statistics_Rx - GENERAL:");
308 pos += scnprintf(buf + pos, bufsz - pos,
309 " %-30s %10u %10u %10u %10u\n", "bogus_cts:",
310 le32_to_cpu(general->bogus_cts),
311 accum_general->bogus_cts, delta_general->bogus_cts,
312 max_general->bogus_cts);
313 pos += scnprintf(buf + pos, bufsz - pos,
314 " %-30s %10u %10u %10u %10u\n", "bogus_ack:",
315 le32_to_cpu(general->bogus_ack),
316 accum_general->bogus_ack, delta_general->bogus_ack,
317 max_general->bogus_ack);
318 pos += scnprintf(buf + pos, bufsz - pos,
319 " %-30s %10u %10u %10u %10u\n",
320 "non_bssid_frames:",
321 le32_to_cpu(general->non_bssid_frames),
322 accum_general->non_bssid_frames,
323 delta_general->non_bssid_frames,
324 max_general->non_bssid_frames);
325 pos += scnprintf(buf + pos, bufsz - pos,
326 " %-30s %10u %10u %10u %10u\n",
327 "filtered_frames:",
328 le32_to_cpu(general->filtered_frames),
329 accum_general->filtered_frames,
330 delta_general->filtered_frames,
331 max_general->filtered_frames);
332 pos += scnprintf(buf + pos, bufsz - pos,
333 " %-30s %10u %10u %10u %10u\n",
334 "non_channel_beacons:",
335 le32_to_cpu(general->non_channel_beacons),
336 accum_general->non_channel_beacons,
337 delta_general->non_channel_beacons,
338 max_general->non_channel_beacons);
339 pos += scnprintf(buf + pos, bufsz - pos,
340 " %-30s %10u %10u %10u %10u\n",
341 "channel_beacons:",
342 le32_to_cpu(general->channel_beacons),
343 accum_general->channel_beacons,
344 delta_general->channel_beacons,
345 max_general->channel_beacons);
346 pos += scnprintf(buf + pos, bufsz - pos,
347 " %-30s %10u %10u %10u %10u\n",
348 "num_missed_bcon:",
349 le32_to_cpu(general->num_missed_bcon),
350 accum_general->num_missed_bcon,
351 delta_general->num_missed_bcon,
352 max_general->num_missed_bcon);
353 pos += scnprintf(buf + pos, bufsz - pos,
354 " %-30s %10u %10u %10u %10u\n",
355 "adc_rx_saturation_time:",
356 le32_to_cpu(general->adc_rx_saturation_time),
357 accum_general->adc_rx_saturation_time,
358 delta_general->adc_rx_saturation_time,
359 max_general->adc_rx_saturation_time);
360 pos += scnprintf(buf + pos, bufsz - pos,
361 " %-30s %10u %10u %10u %10u\n",
362 "ina_detect_search_tm:",
363 le32_to_cpu(general->ina_detection_search_time),
364 accum_general->ina_detection_search_time,
365 delta_general->ina_detection_search_time,
366 max_general->ina_detection_search_time);
367 pos += scnprintf(buf + pos, bufsz - pos,
368 " %-30s %10u %10u %10u %10u\n",
369 "beacon_silence_rssi_a:",
370 le32_to_cpu(general->beacon_silence_rssi_a),
371 accum_general->beacon_silence_rssi_a,
372 delta_general->beacon_silence_rssi_a,
373 max_general->beacon_silence_rssi_a);
374 pos += scnprintf(buf + pos, bufsz - pos,
375 " %-30s %10u %10u %10u %10u\n",
376 "beacon_silence_rssi_b:",
377 le32_to_cpu(general->beacon_silence_rssi_b),
378 accum_general->beacon_silence_rssi_b,
379 delta_general->beacon_silence_rssi_b,
380 max_general->beacon_silence_rssi_b);
381 pos += scnprintf(buf + pos, bufsz - pos,
382 " %-30s %10u %10u %10u %10u\n",
383 "beacon_silence_rssi_c:",
384 le32_to_cpu(general->beacon_silence_rssi_c),
385 accum_general->beacon_silence_rssi_c,
386 delta_general->beacon_silence_rssi_c,
387 max_general->beacon_silence_rssi_c);
388 pos += scnprintf(buf + pos, bufsz - pos,
389 " %-30s %10u %10u %10u %10u\n",
390 "interference_data_flag:",
391 le32_to_cpu(general->interference_data_flag),
392 accum_general->interference_data_flag,
393 delta_general->interference_data_flag,
394 max_general->interference_data_flag);
395 pos += scnprintf(buf + pos, bufsz - pos,
396 " %-30s %10u %10u %10u %10u\n",
397 "channel_load:",
398 le32_to_cpu(general->channel_load),
399 accum_general->channel_load,
400 delta_general->channel_load,
401 max_general->channel_load);
402 pos += scnprintf(buf + pos, bufsz - pos,
403 " %-30s %10u %10u %10u %10u\n",
404 "dsp_false_alarms:",
405 le32_to_cpu(general->dsp_false_alarms),
406 accum_general->dsp_false_alarms,
407 delta_general->dsp_false_alarms,
408 max_general->dsp_false_alarms);
409 pos += scnprintf(buf + pos, bufsz - pos,
410 " %-30s %10u %10u %10u %10u\n",
411 "beacon_rssi_a:",
412 le32_to_cpu(general->beacon_rssi_a),
413 accum_general->beacon_rssi_a,
414 delta_general->beacon_rssi_a,
415 max_general->beacon_rssi_a);
416 pos += scnprintf(buf + pos, bufsz - pos,
417 " %-30s %10u %10u %10u %10u\n",
418 "beacon_rssi_b:",
419 le32_to_cpu(general->beacon_rssi_b),
420 accum_general->beacon_rssi_b,
421 delta_general->beacon_rssi_b,
422 max_general->beacon_rssi_b);
423 pos += scnprintf(buf + pos, bufsz - pos,
424 " %-30s %10u %10u %10u %10u\n",
425 "beacon_rssi_c:",
426 le32_to_cpu(general->beacon_rssi_c),
427 accum_general->beacon_rssi_c,
428 delta_general->beacon_rssi_c,
429 max_general->beacon_rssi_c);
430 pos += scnprintf(buf + pos, bufsz - pos,
431 " %-30s %10u %10u %10u %10u\n",
432 "beacon_energy_a:",
433 le32_to_cpu(general->beacon_energy_a),
434 accum_general->beacon_energy_a,
435 delta_general->beacon_energy_a,
436 max_general->beacon_energy_a);
437 pos += scnprintf(buf + pos, bufsz - pos,
438 " %-30s %10u %10u %10u %10u\n",
439 "beacon_energy_b:",
440 le32_to_cpu(general->beacon_energy_b),
441 accum_general->beacon_energy_b,
442 delta_general->beacon_energy_b,
443 max_general->beacon_energy_b);
444 pos += scnprintf(buf + pos, bufsz - pos,
445 " %-30s %10u %10u %10u %10u\n",
446 "beacon_energy_c:",
447 le32_to_cpu(general->beacon_energy_c),
448 accum_general->beacon_energy_c,
449 delta_general->beacon_energy_c,
450 max_general->beacon_energy_c);
451
452 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM_HT:\n");
453 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
454 "acumulative delta max\n",
455 "Statistics_Rx - OFDM_HT:");
456 pos += scnprintf(buf + pos, bufsz - pos,
457 " %-30s %10u %10u %10u %10u\n",
458 "plcp_err:",
459 le32_to_cpu(ht->plcp_err), accum_ht->plcp_err,
460 delta_ht->plcp_err, max_ht->plcp_err);
461 pos += scnprintf(buf + pos, bufsz - pos,
462 " %-30s %10u %10u %10u %10u\n",
463 "overrun_err:",
464 le32_to_cpu(ht->overrun_err), accum_ht->overrun_err,
465 delta_ht->overrun_err, max_ht->overrun_err);
466 pos += scnprintf(buf + pos, bufsz - pos,
467 " %-30s %10u %10u %10u %10u\n",
468 "early_overrun_err:",
469 le32_to_cpu(ht->early_overrun_err),
470 accum_ht->early_overrun_err,
471 delta_ht->early_overrun_err,
472 max_ht->early_overrun_err);
473 pos += scnprintf(buf + pos, bufsz - pos,
474 " %-30s %10u %10u %10u %10u\n",
475 "crc32_good:",
476 le32_to_cpu(ht->crc32_good), accum_ht->crc32_good,
477 delta_ht->crc32_good, max_ht->crc32_good);
478 pos += scnprintf(buf + pos, bufsz - pos,
479 " %-30s %10u %10u %10u %10u\n",
480 "crc32_err:",
481 le32_to_cpu(ht->crc32_err), accum_ht->crc32_err,
482 delta_ht->crc32_err, max_ht->crc32_err);
483 pos += scnprintf(buf + pos, bufsz - pos,
484 " %-30s %10u %10u %10u %10u\n",
485 "mh_format_err:",
486 le32_to_cpu(ht->mh_format_err),
487 accum_ht->mh_format_err,
488 delta_ht->mh_format_err, max_ht->mh_format_err);
489 pos += scnprintf(buf + pos, bufsz - pos,
490 " %-30s %10u %10u %10u %10u\n",
491 "agg_crc32_good:",
492 le32_to_cpu(ht->agg_crc32_good),
493 accum_ht->agg_crc32_good,
494 delta_ht->agg_crc32_good, max_ht->agg_crc32_good);
495 pos += scnprintf(buf + pos, bufsz - pos,
496 " %-30s %10u %10u %10u %10u\n",
497 "agg_mpdu_cnt:",
498 le32_to_cpu(ht->agg_mpdu_cnt),
499 accum_ht->agg_mpdu_cnt,
500 delta_ht->agg_mpdu_cnt, max_ht->agg_mpdu_cnt);
501 pos += scnprintf(buf + pos, bufsz - pos,
502 " %-30s %10u %10u %10u %10u\n",
503 "agg_cnt:",
504 le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt,
505 delta_ht->agg_cnt, max_ht->agg_cnt);
506 pos += scnprintf(buf + pos, bufsz - pos,
507 " %-30s %10u %10u %10u %10u\n",
508 "unsupport_mcs:",
509 le32_to_cpu(ht->unsupport_mcs),
510 accum_ht->unsupport_mcs,
511 delta_ht->unsupport_mcs, max_ht->unsupport_mcs);
512
513 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
514 kfree(buf);
515 return ret;
516}
517
518ssize_t iwl_ucode_tx_stats_read(struct file *file,
519 char __user *user_buf,
520 size_t count, loff_t *ppos)
521{
522 struct iwl_priv *priv = file->private_data;
523 int pos = 0;
524 char *buf;
525 int bufsz = (sizeof(struct statistics_tx) * 48) + 250;
526 ssize_t ret;
527 struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
528
529 if (!iwl_is_alive(priv))
530 return -EAGAIN;
531
532 buf = kzalloc(bufsz, GFP_KERNEL);
533 if (!buf) {
534 IWL_ERR(priv, "Can not allocate Buffer\n");
535 return -ENOMEM;
536 }
537
538 /* the statistic information display here is based on
539 * the last statistics notification from uCode
540 * might not reflect the current uCode activity
541 */
542 tx = &priv->statistics.tx;
543 accum_tx = &priv->accum_statistics.tx;
544 delta_tx = &priv->delta_statistics.tx;
545 max_tx = &priv->max_delta.tx;
546 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
547 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
548 "acumulative delta max\n",
549 "Statistics_Tx:");
550 pos += scnprintf(buf + pos, bufsz - pos,
551 " %-30s %10u %10u %10u %10u\n",
552 "preamble:",
553 le32_to_cpu(tx->preamble_cnt),
554 accum_tx->preamble_cnt,
555 delta_tx->preamble_cnt, max_tx->preamble_cnt);
556 pos += scnprintf(buf + pos, bufsz - pos,
557 " %-30s %10u %10u %10u %10u\n",
558 "rx_detected_cnt:",
559 le32_to_cpu(tx->rx_detected_cnt),
560 accum_tx->rx_detected_cnt,
561 delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt);
562 pos += scnprintf(buf + pos, bufsz - pos,
563 " %-30s %10u %10u %10u %10u\n",
564 "bt_prio_defer_cnt:",
565 le32_to_cpu(tx->bt_prio_defer_cnt),
566 accum_tx->bt_prio_defer_cnt,
567 delta_tx->bt_prio_defer_cnt,
568 max_tx->bt_prio_defer_cnt);
569 pos += scnprintf(buf + pos, bufsz - pos,
570 " %-30s %10u %10u %10u %10u\n",
571 "bt_prio_kill_cnt:",
572 le32_to_cpu(tx->bt_prio_kill_cnt),
573 accum_tx->bt_prio_kill_cnt,
574 delta_tx->bt_prio_kill_cnt,
575 max_tx->bt_prio_kill_cnt);
576 pos += scnprintf(buf + pos, bufsz - pos,
577 " %-30s %10u %10u %10u %10u\n",
578 "few_bytes_cnt:",
579 le32_to_cpu(tx->few_bytes_cnt),
580 accum_tx->few_bytes_cnt,
581 delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt);
582 pos += scnprintf(buf + pos, bufsz - pos,
583 " %-30s %10u %10u %10u %10u\n",
584 "cts_timeout:",
585 le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout,
586 delta_tx->cts_timeout, max_tx->cts_timeout);
587 pos += scnprintf(buf + pos, bufsz - pos,
588 " %-30s %10u %10u %10u %10u\n",
589 "ack_timeout:",
590 le32_to_cpu(tx->ack_timeout),
591 accum_tx->ack_timeout,
592 delta_tx->ack_timeout, max_tx->ack_timeout);
593 pos += scnprintf(buf + pos, bufsz - pos,
594 " %-30s %10u %10u %10u %10u\n",
595 "expected_ack_cnt:",
596 le32_to_cpu(tx->expected_ack_cnt),
597 accum_tx->expected_ack_cnt,
598 delta_tx->expected_ack_cnt,
599 max_tx->expected_ack_cnt);
600 pos += scnprintf(buf + pos, bufsz - pos,
601 " %-30s %10u %10u %10u %10u\n",
602 "actual_ack_cnt:",
603 le32_to_cpu(tx->actual_ack_cnt),
604 accum_tx->actual_ack_cnt,
605 delta_tx->actual_ack_cnt,
606 max_tx->actual_ack_cnt);
607 pos += scnprintf(buf + pos, bufsz - pos,
608 " %-30s %10u %10u %10u %10u\n",
609 "dump_msdu_cnt:",
610 le32_to_cpu(tx->dump_msdu_cnt),
611 accum_tx->dump_msdu_cnt,
612 delta_tx->dump_msdu_cnt,
613 max_tx->dump_msdu_cnt);
614 pos += scnprintf(buf + pos, bufsz - pos,
615 " %-30s %10u %10u %10u %10u\n",
616 "abort_nxt_frame_mismatch:",
617 le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt),
618 accum_tx->burst_abort_next_frame_mismatch_cnt,
619 delta_tx->burst_abort_next_frame_mismatch_cnt,
620 max_tx->burst_abort_next_frame_mismatch_cnt);
621 pos += scnprintf(buf + pos, bufsz - pos,
622 " %-30s %10u %10u %10u %10u\n",
623 "abort_missing_nxt_frame:",
624 le32_to_cpu(tx->burst_abort_missing_next_frame_cnt),
625 accum_tx->burst_abort_missing_next_frame_cnt,
626 delta_tx->burst_abort_missing_next_frame_cnt,
627 max_tx->burst_abort_missing_next_frame_cnt);
628 pos += scnprintf(buf + pos, bufsz - pos,
629 " %-30s %10u %10u %10u %10u\n",
630 "cts_timeout_collision:",
631 le32_to_cpu(tx->cts_timeout_collision),
632 accum_tx->cts_timeout_collision,
633 delta_tx->cts_timeout_collision,
634 max_tx->cts_timeout_collision);
635 pos += scnprintf(buf + pos, bufsz - pos,
636 " %-30s %10u %10u %10u %10u\n",
637 "ack_ba_timeout_collision:",
638 le32_to_cpu(tx->ack_or_ba_timeout_collision),
639 accum_tx->ack_or_ba_timeout_collision,
640 delta_tx->ack_or_ba_timeout_collision,
641 max_tx->ack_or_ba_timeout_collision);
642 pos += scnprintf(buf + pos, bufsz - pos,
643 " %-30s %10u %10u %10u %10u\n",
644 "agg ba_timeout:",
645 le32_to_cpu(tx->agg.ba_timeout),
646 accum_tx->agg.ba_timeout,
647 delta_tx->agg.ba_timeout,
648 max_tx->agg.ba_timeout);
649 pos += scnprintf(buf + pos, bufsz - pos,
650 " %-30s %10u %10u %10u %10u\n",
651 "agg ba_resched_frames:",
652 le32_to_cpu(tx->agg.ba_reschedule_frames),
653 accum_tx->agg.ba_reschedule_frames,
654 delta_tx->agg.ba_reschedule_frames,
655 max_tx->agg.ba_reschedule_frames);
656 pos += scnprintf(buf + pos, bufsz - pos,
657 " %-30s %10u %10u %10u %10u\n",
658 "agg scd_query_agg_frame:",
659 le32_to_cpu(tx->agg.scd_query_agg_frame_cnt),
660 accum_tx->agg.scd_query_agg_frame_cnt,
661 delta_tx->agg.scd_query_agg_frame_cnt,
662 max_tx->agg.scd_query_agg_frame_cnt);
663 pos += scnprintf(buf + pos, bufsz - pos,
664 " %-30s %10u %10u %10u %10u\n",
665 "agg scd_query_no_agg:",
666 le32_to_cpu(tx->agg.scd_query_no_agg),
667 accum_tx->agg.scd_query_no_agg,
668 delta_tx->agg.scd_query_no_agg,
669 max_tx->agg.scd_query_no_agg);
670 pos += scnprintf(buf + pos, bufsz - pos,
671 " %-30s %10u %10u %10u %10u\n",
672 "agg scd_query_agg:",
673 le32_to_cpu(tx->agg.scd_query_agg),
674 accum_tx->agg.scd_query_agg,
675 delta_tx->agg.scd_query_agg,
676 max_tx->agg.scd_query_agg);
677 pos += scnprintf(buf + pos, bufsz - pos,
678 " %-30s %10u %10u %10u %10u\n",
679 "agg scd_query_mismatch:",
680 le32_to_cpu(tx->agg.scd_query_mismatch),
681 accum_tx->agg.scd_query_mismatch,
682 delta_tx->agg.scd_query_mismatch,
683 max_tx->agg.scd_query_mismatch);
684 pos += scnprintf(buf + pos, bufsz - pos,
685 " %-30s %10u %10u %10u %10u\n",
686 "agg frame_not_ready:",
687 le32_to_cpu(tx->agg.frame_not_ready),
688 accum_tx->agg.frame_not_ready,
689 delta_tx->agg.frame_not_ready,
690 max_tx->agg.frame_not_ready);
691 pos += scnprintf(buf + pos, bufsz - pos,
692 " %-30s %10u %10u %10u %10u\n",
693 "agg underrun:",
694 le32_to_cpu(tx->agg.underrun),
695 accum_tx->agg.underrun,
696 delta_tx->agg.underrun, max_tx->agg.underrun);
697 pos += scnprintf(buf + pos, bufsz - pos,
698 " %-30s %10u %10u %10u %10u\n",
699 "agg bt_prio_kill:",
700 le32_to_cpu(tx->agg.bt_prio_kill),
701 accum_tx->agg.bt_prio_kill,
702 delta_tx->agg.bt_prio_kill,
703 max_tx->agg.bt_prio_kill);
704 pos += scnprintf(buf + pos, bufsz - pos,
705 " %-30s %10u %10u %10u %10u\n",
706 "agg rx_ba_rsp_cnt:",
707 le32_to_cpu(tx->agg.rx_ba_rsp_cnt),
708 accum_tx->agg.rx_ba_rsp_cnt,
709 delta_tx->agg.rx_ba_rsp_cnt,
710 max_tx->agg.rx_ba_rsp_cnt);
711
712 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
713 kfree(buf);
714 return ret;
715}
716
717ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf,
718 size_t count, loff_t *ppos)
719{
720 struct iwl_priv *priv = file->private_data;
721 int pos = 0;
722 char *buf;
723 int bufsz = sizeof(struct statistics_general) * 10 + 300;
724 ssize_t ret;
725 struct statistics_general *general, *accum_general;
726 struct statistics_general *delta_general, *max_general;
727 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
728 struct statistics_div *div, *accum_div, *delta_div, *max_div;
729
730 if (!iwl_is_alive(priv))
731 return -EAGAIN;
732
733 buf = kzalloc(bufsz, GFP_KERNEL);
734 if (!buf) {
735 IWL_ERR(priv, "Can not allocate Buffer\n");
736 return -ENOMEM;
737 }
738
739 /* the statistic information display here is based on
740 * the last statistics notification from uCode
741 * might not reflect the current uCode activity
742 */
743 general = &priv->statistics.general;
744 dbg = &priv->statistics.general.dbg;
745 div = &priv->statistics.general.div;
746 accum_general = &priv->accum_statistics.general;
747 delta_general = &priv->delta_statistics.general;
748 max_general = &priv->max_delta.general;
749 accum_dbg = &priv->accum_statistics.general.dbg;
750 delta_dbg = &priv->delta_statistics.general.dbg;
751 max_dbg = &priv->max_delta.general.dbg;
752 accum_div = &priv->accum_statistics.general.div;
753 delta_div = &priv->delta_statistics.general.div;
754 max_div = &priv->max_delta.general.div;
755 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
756 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
757 "acumulative delta max\n",
758 "Statistics_General:");
759 pos += scnprintf(buf + pos, bufsz - pos, " %-30s %10u\n",
760 "temperature:",
761 le32_to_cpu(general->temperature));
762 pos += scnprintf(buf + pos, bufsz - pos, " %-30s %10u\n",
763 "temperature_m:",
764 le32_to_cpu(general->temperature_m));
765 pos += scnprintf(buf + pos, bufsz - pos,
766 " %-30s %10u %10u %10u %10u\n",
767 "burst_check:",
768 le32_to_cpu(dbg->burst_check),
769 accum_dbg->burst_check,
770 delta_dbg->burst_check, max_dbg->burst_check);
771 pos += scnprintf(buf + pos, bufsz - pos,
772 " %-30s %10u %10u %10u %10u\n",
773 "burst_count:",
774 le32_to_cpu(dbg->burst_count),
775 accum_dbg->burst_count,
776 delta_dbg->burst_count, max_dbg->burst_count);
777 pos += scnprintf(buf + pos, bufsz - pos,
778 " %-30s %10u %10u %10u %10u\n",
779 "sleep_time:",
780 le32_to_cpu(general->sleep_time),
781 accum_general->sleep_time,
782 delta_general->sleep_time, max_general->sleep_time);
783 pos += scnprintf(buf + pos, bufsz - pos,
784 " %-30s %10u %10u %10u %10u\n",
785 "slots_out:",
786 le32_to_cpu(general->slots_out),
787 accum_general->slots_out,
788 delta_general->slots_out, max_general->slots_out);
789 pos += scnprintf(buf + pos, bufsz - pos,
790 " %-30s %10u %10u %10u %10u\n",
791 "slots_idle:",
792 le32_to_cpu(general->slots_idle),
793 accum_general->slots_idle,
794 delta_general->slots_idle, max_general->slots_idle);
795 pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp:\t\t\t%u\n",
796 le32_to_cpu(general->ttl_timestamp));
797 pos += scnprintf(buf + pos, bufsz - pos,
798 " %-30s %10u %10u %10u %10u\n",
799 "tx_on_a:",
800 le32_to_cpu(div->tx_on_a), accum_div->tx_on_a,
801 delta_div->tx_on_a, max_div->tx_on_a);
802 pos += scnprintf(buf + pos, bufsz - pos,
803 " %-30s %10u %10u %10u %10u\n",
804 "tx_on_b:",
805 le32_to_cpu(div->tx_on_b), accum_div->tx_on_b,
806 delta_div->tx_on_b, max_div->tx_on_b);
807 pos += scnprintf(buf + pos, bufsz - pos,
808 " %-30s %10u %10u %10u %10u\n",
809 "exec_time:",
810 le32_to_cpu(div->exec_time), accum_div->exec_time,
811 delta_div->exec_time, max_div->exec_time);
812 pos += scnprintf(buf + pos, bufsz - pos,
813 " %-30s %10u %10u %10u %10u\n",
814 "probe_time:",
815 le32_to_cpu(div->probe_time), accum_div->probe_time,
816 delta_div->probe_time, max_div->probe_time);
817 pos += scnprintf(buf + pos, bufsz - pos,
818 " %-30s %10u %10u %10u %10u\n",
819 "rx_enable_counter:",
820 le32_to_cpu(general->rx_enable_counter),
821 accum_general->rx_enable_counter,
822 delta_general->rx_enable_counter,
823 max_general->rx_enable_counter);
824 pos += scnprintf(buf + pos, bufsz - pos,
825 " %-30s %10u %10u %10u %10u\n",
826 "num_of_sos_states:",
827 le32_to_cpu(general->num_of_sos_states),
828 accum_general->num_of_sos_states,
829 delta_general->num_of_sos_states,
830 max_general->num_of_sos_states);
831 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
832 kfree(buf);
833 return ret;
834}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h
new file mode 100644
index 00000000000..59b1f25f0d8
--- /dev/null
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h
@@ -0,0 +1,56 @@
1/******************************************************************************
2 *
3 * GPL LICENSE SUMMARY
4 *
5 * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
19 * USA
20 *
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
23 *
24 * Contact Information:
25 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/
28
29#include "iwl-dev.h"
30#include "iwl-core.h"
31#include "iwl-debug.h"
32
33#ifdef CONFIG_IWLWIFI_DEBUGFS
34ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf,
35 size_t count, loff_t *ppos);
36ssize_t iwl_ucode_tx_stats_read(struct file *file, char __user *user_buf,
37 size_t count, loff_t *ppos);
38ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf,
39 size_t count, loff_t *ppos);
40#else
41static ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf,
42 size_t count, loff_t *ppos)
43{
44 return 0;
45}
46static ssize_t iwl_ucode_tx_stats_read(struct file *file, char __user *user_buf,
47 size_t count, loff_t *ppos)
48{
49 return 0;
50}
51static ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf,
52 size_t count, loff_t *ppos)
53{
54 return 0;
55}
56#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 1d91ffdd420..2a3b173e4db 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -115,6 +115,15 @@ struct iwl_apm_ops {
115 int (*set_pwr_src)(struct iwl_priv *priv, enum iwl_pwr_src src); 115 int (*set_pwr_src)(struct iwl_priv *priv, enum iwl_pwr_src src);
116}; 116};
117 117
118struct iwl_debugfs_ops {
119 ssize_t (*rx_stats_read)(struct file *file, char __user *user_buf,
120 size_t count, loff_t *ppos);
121 ssize_t (*tx_stats_read)(struct file *file, char __user *user_buf,
122 size_t count, loff_t *ppos);
123 ssize_t (*general_stats_read)(struct file *file, char __user *user_buf,
124 size_t count, loff_t *ppos);
125};
126
118struct iwl_temp_ops { 127struct iwl_temp_ops {
119 void (*temperature)(struct iwl_priv *priv); 128 void (*temperature)(struct iwl_priv *priv);
120 void (*set_ct_kill)(struct iwl_priv *priv); 129 void (*set_ct_kill)(struct iwl_priv *priv);
@@ -200,6 +209,7 @@ struct iwl_lib_ops {
200 /* check for ack health */ 209 /* check for ack health */
201 bool (*check_ack_health)(struct iwl_priv *priv, 210 bool (*check_ack_health)(struct iwl_priv *priv,
202 struct iwl_rx_packet *pkt); 211 struct iwl_rx_packet *pkt);
212 struct iwl_debugfs_ops debugfs_ops;
203}; 213};
204 214
205struct iwl_led_ops { 215struct iwl_led_ops {
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index 1c7b53d511c..5c2bcef5df0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -78,6 +78,8 @@ static inline void iwl_print_hex_dump(struct iwl_priv *priv, int level,
78#ifdef CONFIG_IWLWIFI_DEBUGFS 78#ifdef CONFIG_IWLWIFI_DEBUGFS
79int iwl_dbgfs_register(struct iwl_priv *priv, const char *name); 79int iwl_dbgfs_register(struct iwl_priv *priv, const char *name);
80void iwl_dbgfs_unregister(struct iwl_priv *priv); 80void iwl_dbgfs_unregister(struct iwl_priv *priv);
81extern int iwl_dbgfs_statistics_flag(struct iwl_priv *priv, char *buf,
82 int bufsz);
81#else 83#else
82static inline int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) 84static inline int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
83{ 85{
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 5f5820249a2..d789f8db448 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -25,11 +25,6 @@
25 * Intel Linux Wireless <ilw@linux.intel.com> 25 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/ 27 *****************************************************************************/
28
29#include <linux/kernel.h>
30#include <linux/module.h>
31#include <linux/debugfs.h>
32
33#include <linux/ieee80211.h> 28#include <linux/ieee80211.h>
34#include <net/mac80211.h> 29#include <net/mac80211.h>
35 30
@@ -105,6 +100,26 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
105 .open = iwl_dbgfs_open_file_generic, \ 100 .open = iwl_dbgfs_open_file_generic, \
106}; 101};
107 102
103int iwl_dbgfs_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
104{
105 int p = 0;
106
107 p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n",
108 le32_to_cpu(priv->statistics.flag));
109 if (le32_to_cpu(priv->statistics.flag) & UCODE_STATISTICS_CLEAR_MSK)
110 p += scnprintf(buf + p, bufsz - p,
111 "\tStatistics have been cleared\n");
112 p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n",
113 (le32_to_cpu(priv->statistics.flag) &
114 UCODE_STATISTICS_FREQUENCY_MSK)
115 ? "2.4 GHz" : "5.2 GHz");
116 p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n",
117 (le32_to_cpu(priv->statistics.flag) &
118 UCODE_STATISTICS_NARROW_BAND_MSK)
119 ? "enabled" : "disabled");
120 return p;
121}
122EXPORT_SYMBOL(iwl_dbgfs_statistics_flag);
108 123
109static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file, 124static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file,
110 char __user *user_buf, 125 char __user *user_buf,
@@ -1033,474 +1048,15 @@ static ssize_t iwl_dbgfs_rx_queue_read(struct file *file,
1033 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 1048 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1034} 1049}
1035 1050
1036static int iwl_dbgfs_statistics_flag(struct iwl_priv *priv, char *buf,
1037 int bufsz)
1038{
1039 int p = 0;
1040
1041 p += scnprintf(buf + p, bufsz - p,
1042 "Statistics Flag(0x%X):\n",
1043 le32_to_cpu(priv->statistics.flag));
1044 if (le32_to_cpu(priv->statistics.flag) & UCODE_STATISTICS_CLEAR_MSK)
1045 p += scnprintf(buf + p, bufsz - p,
1046 "\tStatistics have been cleared\n");
1047 p += scnprintf(buf + p, bufsz - p,
1048 "\tOperational Frequency: %s\n",
1049 (le32_to_cpu(priv->statistics.flag) &
1050 UCODE_STATISTICS_FREQUENCY_MSK)
1051 ? "2.4 GHz" : "5.2 GHz");
1052 p += scnprintf(buf + p, bufsz - p,
1053 "\tTGj Narrow Band: %s\n",
1054 (le32_to_cpu(priv->statistics.flag) &
1055 UCODE_STATISTICS_NARROW_BAND_MSK)
1056 ? "enabled" : "disabled");
1057 return p;
1058}
1059
1060static const char ucode_stats_header[] =
1061 "%-32s current acumulative delta max\n";
1062static const char ucode_stats_short_format[] =
1063 " %-30s %10u\n";
1064static const char ucode_stats_format[] =
1065 " %-30s %10u %10u %10u %10u\n";
1066
1067static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file, 1051static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file,
1068 char __user *user_buf, 1052 char __user *user_buf,
1069 size_t count, loff_t *ppos) 1053 size_t count, loff_t *ppos)
1070{ 1054{
1071 struct iwl_priv *priv = file->private_data; 1055 struct iwl_priv *priv = file->private_data;
1072 int pos = 0; 1056 if (priv->cfg->ops->lib->debugfs_ops.rx_stats_read)
1073 char *buf; 1057 return priv->cfg->ops->lib->debugfs_ops.rx_stats_read(file,
1074 int bufsz = sizeof(struct statistics_rx_phy) * 40 + 1058 user_buf, count, ppos);
1075 sizeof(struct statistics_rx_non_phy) * 40 + 1059 return 0;
1076 sizeof(struct statistics_rx_ht_phy) * 40 + 400;
1077 ssize_t ret;
1078 struct statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm;
1079 struct statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
1080 struct statistics_rx_non_phy *general, *accum_general;
1081 struct statistics_rx_non_phy *delta_general, *max_general;
1082 struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;
1083
1084 if (!iwl_is_alive(priv))
1085 return -EAGAIN;
1086
1087 buf = kzalloc(bufsz, GFP_KERNEL);
1088 if (!buf) {
1089 IWL_ERR(priv, "Can not allocate Buffer\n");
1090 return -ENOMEM;
1091 }
1092
1093 /* the statistic information display here is based on
1094 * the last statistics notification from uCode
1095 * might not reflect the current uCode activity
1096 */
1097 ofdm = &priv->statistics.rx.ofdm;
1098 cck = &priv->statistics.rx.cck;
1099 general = &priv->statistics.rx.general;
1100 ht = &priv->statistics.rx.ofdm_ht;
1101 accum_ofdm = &priv->accum_statistics.rx.ofdm;
1102 accum_cck = &priv->accum_statistics.rx.cck;
1103 accum_general = &priv->accum_statistics.rx.general;
1104 accum_ht = &priv->accum_statistics.rx.ofdm_ht;
1105 delta_ofdm = &priv->delta_statistics.rx.ofdm;
1106 delta_cck = &priv->delta_statistics.rx.cck;
1107 delta_general = &priv->delta_statistics.rx.general;
1108 delta_ht = &priv->delta_statistics.rx.ofdm_ht;
1109 max_ofdm = &priv->max_delta.rx.ofdm;
1110 max_cck = &priv->max_delta.rx.cck;
1111 max_general = &priv->max_delta.rx.general;
1112 max_ht = &priv->max_delta.rx.ofdm_ht;
1113
1114 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
1115 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1116 "Statistics_Rx - OFDM:");
1117 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1118 "ina_cnt:", le32_to_cpu(ofdm->ina_cnt),
1119 accum_ofdm->ina_cnt,
1120 delta_ofdm->ina_cnt, max_ofdm->ina_cnt);
1121 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1122 "fina_cnt:",
1123 le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt,
1124 delta_ofdm->fina_cnt, max_ofdm->fina_cnt);
1125 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1126 "plcp_err:",
1127 le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err,
1128 delta_ofdm->plcp_err, max_ofdm->plcp_err);
1129 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1130 "crc32_err:",
1131 le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err,
1132 delta_ofdm->crc32_err, max_ofdm->crc32_err);
1133 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1134 "overrun_err:",
1135 le32_to_cpu(ofdm->overrun_err),
1136 accum_ofdm->overrun_err,
1137 delta_ofdm->overrun_err, max_ofdm->overrun_err);
1138 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1139 "early_overrun_err:",
1140 le32_to_cpu(ofdm->early_overrun_err),
1141 accum_ofdm->early_overrun_err,
1142 delta_ofdm->early_overrun_err,
1143 max_ofdm->early_overrun_err);
1144 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1145 "crc32_good:",
1146 le32_to_cpu(ofdm->crc32_good),
1147 accum_ofdm->crc32_good,
1148 delta_ofdm->crc32_good, max_ofdm->crc32_good);
1149 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1150 "false_alarm_cnt:",
1151 le32_to_cpu(ofdm->false_alarm_cnt),
1152 accum_ofdm->false_alarm_cnt,
1153 delta_ofdm->false_alarm_cnt,
1154 max_ofdm->false_alarm_cnt);
1155 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1156 "fina_sync_err_cnt:",
1157 le32_to_cpu(ofdm->fina_sync_err_cnt),
1158 accum_ofdm->fina_sync_err_cnt,
1159 delta_ofdm->fina_sync_err_cnt,
1160 max_ofdm->fina_sync_err_cnt);
1161 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1162 "sfd_timeout:",
1163 le32_to_cpu(ofdm->sfd_timeout),
1164 accum_ofdm->sfd_timeout,
1165 delta_ofdm->sfd_timeout,
1166 max_ofdm->sfd_timeout);
1167 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1168 "fina_timeout:",
1169 le32_to_cpu(ofdm->fina_timeout),
1170 accum_ofdm->fina_timeout,
1171 delta_ofdm->fina_timeout,
1172 max_ofdm->fina_timeout);
1173 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1174 "unresponded_rts:",
1175 le32_to_cpu(ofdm->unresponded_rts),
1176 accum_ofdm->unresponded_rts,
1177 delta_ofdm->unresponded_rts,
1178 max_ofdm->unresponded_rts);
1179 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1180 "rxe_frame_lmt_ovrun:",
1181 le32_to_cpu(ofdm->rxe_frame_limit_overrun),
1182 accum_ofdm->rxe_frame_limit_overrun,
1183 delta_ofdm->rxe_frame_limit_overrun,
1184 max_ofdm->rxe_frame_limit_overrun);
1185 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1186 "sent_ack_cnt:",
1187 le32_to_cpu(ofdm->sent_ack_cnt),
1188 accum_ofdm->sent_ack_cnt,
1189 delta_ofdm->sent_ack_cnt,
1190 max_ofdm->sent_ack_cnt);
1191 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1192 "sent_cts_cnt:",
1193 le32_to_cpu(ofdm->sent_cts_cnt),
1194 accum_ofdm->sent_cts_cnt,
1195 delta_ofdm->sent_cts_cnt, max_ofdm->sent_cts_cnt);
1196 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1197 "sent_ba_rsp_cnt:",
1198 le32_to_cpu(ofdm->sent_ba_rsp_cnt),
1199 accum_ofdm->sent_ba_rsp_cnt,
1200 delta_ofdm->sent_ba_rsp_cnt,
1201 max_ofdm->sent_ba_rsp_cnt);
1202 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1203 "dsp_self_kill:",
1204 le32_to_cpu(ofdm->dsp_self_kill),
1205 accum_ofdm->dsp_self_kill,
1206 delta_ofdm->dsp_self_kill,
1207 max_ofdm->dsp_self_kill);
1208 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1209 "mh_format_err:",
1210 le32_to_cpu(ofdm->mh_format_err),
1211 accum_ofdm->mh_format_err,
1212 delta_ofdm->mh_format_err,
1213 max_ofdm->mh_format_err);
1214 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1215 "re_acq_main_rssi_sum:",
1216 le32_to_cpu(ofdm->re_acq_main_rssi_sum),
1217 accum_ofdm->re_acq_main_rssi_sum,
1218 delta_ofdm->re_acq_main_rssi_sum,
1219 max_ofdm->re_acq_main_rssi_sum);
1220
1221 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1222 "Statistics_Rx - CCK:");
1223 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1224 "ina_cnt:",
1225 le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt,
1226 delta_cck->ina_cnt, max_cck->ina_cnt);
1227 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1228 "fina_cnt:",
1229 le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt,
1230 delta_cck->fina_cnt, max_cck->fina_cnt);
1231 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1232 "plcp_err:",
1233 le32_to_cpu(cck->plcp_err), accum_cck->plcp_err,
1234 delta_cck->plcp_err, max_cck->plcp_err);
1235 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1236 "crc32_err:",
1237 le32_to_cpu(cck->crc32_err), accum_cck->crc32_err,
1238 delta_cck->crc32_err, max_cck->crc32_err);
1239 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1240 "overrun_err:",
1241 le32_to_cpu(cck->overrun_err),
1242 accum_cck->overrun_err,
1243 delta_cck->overrun_err, max_cck->overrun_err);
1244 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1245 "early_overrun_err:",
1246 le32_to_cpu(cck->early_overrun_err),
1247 accum_cck->early_overrun_err,
1248 delta_cck->early_overrun_err,
1249 max_cck->early_overrun_err);
1250 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1251 "crc32_good:",
1252 le32_to_cpu(cck->crc32_good), accum_cck->crc32_good,
1253 delta_cck->crc32_good,
1254 max_cck->crc32_good);
1255 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1256 "false_alarm_cnt:",
1257 le32_to_cpu(cck->false_alarm_cnt),
1258 accum_cck->false_alarm_cnt,
1259 delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt);
1260 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1261 "fina_sync_err_cnt:",
1262 le32_to_cpu(cck->fina_sync_err_cnt),
1263 accum_cck->fina_sync_err_cnt,
1264 delta_cck->fina_sync_err_cnt,
1265 max_cck->fina_sync_err_cnt);
1266 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1267 "sfd_timeout:",
1268 le32_to_cpu(cck->sfd_timeout),
1269 accum_cck->sfd_timeout,
1270 delta_cck->sfd_timeout, max_cck->sfd_timeout);
1271 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1272 "fina_timeout:",
1273 le32_to_cpu(cck->fina_timeout),
1274 accum_cck->fina_timeout,
1275 delta_cck->fina_timeout, max_cck->fina_timeout);
1276 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1277 "unresponded_rts:",
1278 le32_to_cpu(cck->unresponded_rts),
1279 accum_cck->unresponded_rts,
1280 delta_cck->unresponded_rts,
1281 max_cck->unresponded_rts);
1282 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1283 "rxe_frame_lmt_ovrun:",
1284 le32_to_cpu(cck->rxe_frame_limit_overrun),
1285 accum_cck->rxe_frame_limit_overrun,
1286 delta_cck->rxe_frame_limit_overrun,
1287 max_cck->rxe_frame_limit_overrun);
1288 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1289 "sent_ack_cnt:",
1290 le32_to_cpu(cck->sent_ack_cnt),
1291 accum_cck->sent_ack_cnt,
1292 delta_cck->sent_ack_cnt,
1293 max_cck->sent_ack_cnt);
1294 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1295 "sent_cts_cnt:",
1296 le32_to_cpu(cck->sent_cts_cnt),
1297 accum_cck->sent_cts_cnt,
1298 delta_cck->sent_cts_cnt,
1299 max_cck->sent_cts_cnt);
1300 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1301 "sent_ba_rsp_cnt:",
1302 le32_to_cpu(cck->sent_ba_rsp_cnt),
1303 accum_cck->sent_ba_rsp_cnt,
1304 delta_cck->sent_ba_rsp_cnt,
1305 max_cck->sent_ba_rsp_cnt);
1306 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1307 "dsp_self_kill:",
1308 le32_to_cpu(cck->dsp_self_kill),
1309 accum_cck->dsp_self_kill,
1310 delta_cck->dsp_self_kill,
1311 max_cck->dsp_self_kill);
1312 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1313 "mh_format_err:",
1314 le32_to_cpu(cck->mh_format_err),
1315 accum_cck->mh_format_err,
1316 delta_cck->mh_format_err, max_cck->mh_format_err);
1317 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1318 "re_acq_main_rssi_sum:",
1319 le32_to_cpu(cck->re_acq_main_rssi_sum),
1320 accum_cck->re_acq_main_rssi_sum,
1321 delta_cck->re_acq_main_rssi_sum,
1322 max_cck->re_acq_main_rssi_sum);
1323
1324 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1325 "Statistics_Rx - GENERAL:");
1326 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1327 "bogus_cts:",
1328 le32_to_cpu(general->bogus_cts),
1329 accum_general->bogus_cts,
1330 delta_general->bogus_cts, max_general->bogus_cts);
1331 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1332 "bogus_ack:",
1333 le32_to_cpu(general->bogus_ack),
1334 accum_general->bogus_ack,
1335 delta_general->bogus_ack, max_general->bogus_ack);
1336 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1337 "non_bssid_frames:",
1338 le32_to_cpu(general->non_bssid_frames),
1339 accum_general->non_bssid_frames,
1340 delta_general->non_bssid_frames,
1341 max_general->non_bssid_frames);
1342 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1343 "filtered_frames:",
1344 le32_to_cpu(general->filtered_frames),
1345 accum_general->filtered_frames,
1346 delta_general->filtered_frames,
1347 max_general->filtered_frames);
1348 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1349 "non_channel_beacons:",
1350 le32_to_cpu(general->non_channel_beacons),
1351 accum_general->non_channel_beacons,
1352 delta_general->non_channel_beacons,
1353 max_general->non_channel_beacons);
1354 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1355 "channel_beacons:",
1356 le32_to_cpu(general->channel_beacons),
1357 accum_general->channel_beacons,
1358 delta_general->channel_beacons,
1359 max_general->channel_beacons);
1360 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1361 "num_missed_bcon:",
1362 le32_to_cpu(general->num_missed_bcon),
1363 accum_general->num_missed_bcon,
1364 delta_general->num_missed_bcon,
1365 max_general->num_missed_bcon);
1366 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1367 "adc_rx_saturation_time:",
1368 le32_to_cpu(general->adc_rx_saturation_time),
1369 accum_general->adc_rx_saturation_time,
1370 delta_general->adc_rx_saturation_time,
1371 max_general->adc_rx_saturation_time);
1372 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1373 "ina_detect_search_tm:",
1374 le32_to_cpu(general->ina_detection_search_time),
1375 accum_general->ina_detection_search_time,
1376 delta_general->ina_detection_search_time,
1377 max_general->ina_detection_search_time);
1378 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1379 "beacon_silence_rssi_a:",
1380 le32_to_cpu(general->beacon_silence_rssi_a),
1381 accum_general->beacon_silence_rssi_a,
1382 delta_general->beacon_silence_rssi_a,
1383 max_general->beacon_silence_rssi_a);
1384 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1385 "beacon_silence_rssi_b:",
1386 le32_to_cpu(general->beacon_silence_rssi_b),
1387 accum_general->beacon_silence_rssi_b,
1388 delta_general->beacon_silence_rssi_b,
1389 max_general->beacon_silence_rssi_b);
1390 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1391 "beacon_silence_rssi_c:",
1392 le32_to_cpu(general->beacon_silence_rssi_c),
1393 accum_general->beacon_silence_rssi_c,
1394 delta_general->beacon_silence_rssi_c,
1395 max_general->beacon_silence_rssi_c);
1396 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1397 "interference_data_flag:",
1398 le32_to_cpu(general->interference_data_flag),
1399 accum_general->interference_data_flag,
1400 delta_general->interference_data_flag,
1401 max_general->interference_data_flag);
1402 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1403 "channel_load:",
1404 le32_to_cpu(general->channel_load),
1405 accum_general->channel_load,
1406 delta_general->channel_load,
1407 max_general->channel_load);
1408 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1409 "dsp_false_alarms:",
1410 le32_to_cpu(general->dsp_false_alarms),
1411 accum_general->dsp_false_alarms,
1412 delta_general->dsp_false_alarms,
1413 max_general->dsp_false_alarms);
1414 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1415 "beacon_rssi_a:",
1416 le32_to_cpu(general->beacon_rssi_a),
1417 accum_general->beacon_rssi_a,
1418 delta_general->beacon_rssi_a,
1419 max_general->beacon_rssi_a);
1420 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1421 "beacon_rssi_b:",
1422 le32_to_cpu(general->beacon_rssi_b),
1423 accum_general->beacon_rssi_b,
1424 delta_general->beacon_rssi_b,
1425 max_general->beacon_rssi_b);
1426 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1427 "beacon_rssi_c:",
1428 le32_to_cpu(general->beacon_rssi_c),
1429 accum_general->beacon_rssi_c,
1430 delta_general->beacon_rssi_c,
1431 max_general->beacon_rssi_c);
1432 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1433 "beacon_energy_a:",
1434 le32_to_cpu(general->beacon_energy_a),
1435 accum_general->beacon_energy_a,
1436 delta_general->beacon_energy_a,
1437 max_general->beacon_energy_a);
1438 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1439 "beacon_energy_b:",
1440 le32_to_cpu(general->beacon_energy_b),
1441 accum_general->beacon_energy_b,
1442 delta_general->beacon_energy_b,
1443 max_general->beacon_energy_b);
1444 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1445 "beacon_energy_c:",
1446 le32_to_cpu(general->beacon_energy_c),
1447 accum_general->beacon_energy_c,
1448 delta_general->beacon_energy_c,
1449 max_general->beacon_energy_c);
1450
1451 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM_HT:\n");
1452 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1453 "Statistics_Rx - OFDM_HT:");
1454 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1455 "plcp_err:",
1456 le32_to_cpu(ht->plcp_err), accum_ht->plcp_err,
1457 delta_ht->plcp_err, max_ht->plcp_err);
1458 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1459 "overrun_err:",
1460 le32_to_cpu(ht->overrun_err), accum_ht->overrun_err,
1461 delta_ht->overrun_err, max_ht->overrun_err);
1462 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1463 "early_overrun_err:",
1464 le32_to_cpu(ht->early_overrun_err),
1465 accum_ht->early_overrun_err,
1466 delta_ht->early_overrun_err,
1467 max_ht->early_overrun_err);
1468 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1469 "crc32_good:",
1470 le32_to_cpu(ht->crc32_good), accum_ht->crc32_good,
1471 delta_ht->crc32_good, max_ht->crc32_good);
1472 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1473 "crc32_err:",
1474 le32_to_cpu(ht->crc32_err), accum_ht->crc32_err,
1475 delta_ht->crc32_err, max_ht->crc32_err);
1476 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1477 "mh_format_err:",
1478 le32_to_cpu(ht->mh_format_err),
1479 accum_ht->mh_format_err,
1480 delta_ht->mh_format_err, max_ht->mh_format_err);
1481 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1482 "agg_crc32_good:",
1483 le32_to_cpu(ht->agg_crc32_good),
1484 accum_ht->agg_crc32_good,
1485 delta_ht->agg_crc32_good, max_ht->agg_crc32_good);
1486 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1487 "agg_mpdu_cnt:",
1488 le32_to_cpu(ht->agg_mpdu_cnt),
1489 accum_ht->agg_mpdu_cnt,
1490 delta_ht->agg_mpdu_cnt, max_ht->agg_mpdu_cnt);
1491 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1492 "agg_cnt:",
1493 le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt,
1494 delta_ht->agg_cnt, max_ht->agg_cnt);
1495 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1496 "unsupport_mcs:",
1497 le32_to_cpu(ht->unsupport_mcs),
1498 accum_ht->unsupport_mcs,
1499 delta_ht->unsupport_mcs, max_ht->unsupport_mcs);
1500
1501 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1502 kfree(buf);
1503 return ret;
1504} 1060}
1505 1061
1506static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file, 1062static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
@@ -1508,173 +1064,10 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
1508 size_t count, loff_t *ppos) 1064 size_t count, loff_t *ppos)
1509{ 1065{
1510 struct iwl_priv *priv = file->private_data; 1066 struct iwl_priv *priv = file->private_data;
1511 int pos = 0; 1067 if (priv->cfg->ops->lib->debugfs_ops.tx_stats_read)
1512 char *buf; 1068 return priv->cfg->ops->lib->debugfs_ops.tx_stats_read(file,
1513 int bufsz = (sizeof(struct statistics_tx) * 48) + 250; 1069 user_buf, count, ppos);
1514 ssize_t ret; 1070 return 0;
1515 struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
1516
1517 if (!iwl_is_alive(priv))
1518 return -EAGAIN;
1519
1520 buf = kzalloc(bufsz, GFP_KERNEL);
1521 if (!buf) {
1522 IWL_ERR(priv, "Can not allocate Buffer\n");
1523 return -ENOMEM;
1524 }
1525
1526 /* the statistic information display here is based on
1527 * the last statistics notification from uCode
1528 * might not reflect the current uCode activity
1529 */
1530 tx = &priv->statistics.tx;
1531 accum_tx = &priv->accum_statistics.tx;
1532 delta_tx = &priv->delta_statistics.tx;
1533 max_tx = &priv->max_delta.tx;
1534 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
1535 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1536 "Statistics_Tx:");
1537 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1538 "preamble:",
1539 le32_to_cpu(tx->preamble_cnt),
1540 accum_tx->preamble_cnt,
1541 delta_tx->preamble_cnt, max_tx->preamble_cnt);
1542 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1543 "rx_detected_cnt:",
1544 le32_to_cpu(tx->rx_detected_cnt),
1545 accum_tx->rx_detected_cnt,
1546 delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt);
1547 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1548 "bt_prio_defer_cnt:",
1549 le32_to_cpu(tx->bt_prio_defer_cnt),
1550 accum_tx->bt_prio_defer_cnt,
1551 delta_tx->bt_prio_defer_cnt,
1552 max_tx->bt_prio_defer_cnt);
1553 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1554 "bt_prio_kill_cnt:",
1555 le32_to_cpu(tx->bt_prio_kill_cnt),
1556 accum_tx->bt_prio_kill_cnt,
1557 delta_tx->bt_prio_kill_cnt,
1558 max_tx->bt_prio_kill_cnt);
1559 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1560 "few_bytes_cnt:",
1561 le32_to_cpu(tx->few_bytes_cnt),
1562 accum_tx->few_bytes_cnt,
1563 delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt);
1564 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1565 "cts_timeout:",
1566 le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout,
1567 delta_tx->cts_timeout, max_tx->cts_timeout);
1568 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1569 "ack_timeout:",
1570 le32_to_cpu(tx->ack_timeout),
1571 accum_tx->ack_timeout,
1572 delta_tx->ack_timeout, max_tx->ack_timeout);
1573 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1574 "expected_ack_cnt:",
1575 le32_to_cpu(tx->expected_ack_cnt),
1576 accum_tx->expected_ack_cnt,
1577 delta_tx->expected_ack_cnt,
1578 max_tx->expected_ack_cnt);
1579 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1580 "actual_ack_cnt:",
1581 le32_to_cpu(tx->actual_ack_cnt),
1582 accum_tx->actual_ack_cnt,
1583 delta_tx->actual_ack_cnt,
1584 max_tx->actual_ack_cnt);
1585 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1586 "dump_msdu_cnt:",
1587 le32_to_cpu(tx->dump_msdu_cnt),
1588 accum_tx->dump_msdu_cnt,
1589 delta_tx->dump_msdu_cnt,
1590 max_tx->dump_msdu_cnt);
1591 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1592 "abort_nxt_frame_mismatch:",
1593 le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt),
1594 accum_tx->burst_abort_next_frame_mismatch_cnt,
1595 delta_tx->burst_abort_next_frame_mismatch_cnt,
1596 max_tx->burst_abort_next_frame_mismatch_cnt);
1597 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1598 "abort_missing_nxt_frame:",
1599 le32_to_cpu(tx->burst_abort_missing_next_frame_cnt),
1600 accum_tx->burst_abort_missing_next_frame_cnt,
1601 delta_tx->burst_abort_missing_next_frame_cnt,
1602 max_tx->burst_abort_missing_next_frame_cnt);
1603 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1604 "cts_timeout_collision:",
1605 le32_to_cpu(tx->cts_timeout_collision),
1606 accum_tx->cts_timeout_collision,
1607 delta_tx->cts_timeout_collision,
1608 max_tx->cts_timeout_collision);
1609 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1610 "ack_ba_timeout_collision:",
1611 le32_to_cpu(tx->ack_or_ba_timeout_collision),
1612 accum_tx->ack_or_ba_timeout_collision,
1613 delta_tx->ack_or_ba_timeout_collision,
1614 max_tx->ack_or_ba_timeout_collision);
1615 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1616 "agg ba_timeout:",
1617 le32_to_cpu(tx->agg.ba_timeout),
1618 accum_tx->agg.ba_timeout,
1619 delta_tx->agg.ba_timeout,
1620 max_tx->agg.ba_timeout);
1621 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1622 "agg ba_resched_frames:",
1623 le32_to_cpu(tx->agg.ba_reschedule_frames),
1624 accum_tx->agg.ba_reschedule_frames,
1625 delta_tx->agg.ba_reschedule_frames,
1626 max_tx->agg.ba_reschedule_frames);
1627 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1628 "agg scd_query_agg_frame:",
1629 le32_to_cpu(tx->agg.scd_query_agg_frame_cnt),
1630 accum_tx->agg.scd_query_agg_frame_cnt,
1631 delta_tx->agg.scd_query_agg_frame_cnt,
1632 max_tx->agg.scd_query_agg_frame_cnt);
1633 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1634 "agg scd_query_no_agg:",
1635 le32_to_cpu(tx->agg.scd_query_no_agg),
1636 accum_tx->agg.scd_query_no_agg,
1637 delta_tx->agg.scd_query_no_agg,
1638 max_tx->agg.scd_query_no_agg);
1639 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1640 "agg scd_query_agg:",
1641 le32_to_cpu(tx->agg.scd_query_agg),
1642 accum_tx->agg.scd_query_agg,
1643 delta_tx->agg.scd_query_agg,
1644 max_tx->agg.scd_query_agg);
1645 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1646 "agg scd_query_mismatch:",
1647 le32_to_cpu(tx->agg.scd_query_mismatch),
1648 accum_tx->agg.scd_query_mismatch,
1649 delta_tx->agg.scd_query_mismatch,
1650 max_tx->agg.scd_query_mismatch);
1651 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1652 "agg frame_not_ready:",
1653 le32_to_cpu(tx->agg.frame_not_ready),
1654 accum_tx->agg.frame_not_ready,
1655 delta_tx->agg.frame_not_ready,
1656 max_tx->agg.frame_not_ready);
1657 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1658 "agg underrun:",
1659 le32_to_cpu(tx->agg.underrun),
1660 accum_tx->agg.underrun,
1661 delta_tx->agg.underrun, max_tx->agg.underrun);
1662 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1663 "agg bt_prio_kill:",
1664 le32_to_cpu(tx->agg.bt_prio_kill),
1665 accum_tx->agg.bt_prio_kill,
1666 delta_tx->agg.bt_prio_kill,
1667 max_tx->agg.bt_prio_kill);
1668 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1669 "agg rx_ba_rsp_cnt:",
1670 le32_to_cpu(tx->agg.rx_ba_rsp_cnt),
1671 accum_tx->agg.rx_ba_rsp_cnt,
1672 delta_tx->agg.rx_ba_rsp_cnt,
1673 max_tx->agg.rx_ba_rsp_cnt);
1674
1675 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1676 kfree(buf);
1677 return ret;
1678} 1071}
1679 1072
1680static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file, 1073static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
@@ -1682,107 +1075,10 @@ static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
1682 size_t count, loff_t *ppos) 1075 size_t count, loff_t *ppos)
1683{ 1076{
1684 struct iwl_priv *priv = file->private_data; 1077 struct iwl_priv *priv = file->private_data;
1685 int pos = 0; 1078 if (priv->cfg->ops->lib->debugfs_ops.general_stats_read)
1686 char *buf; 1079 return priv->cfg->ops->lib->debugfs_ops.general_stats_read(file,
1687 int bufsz = sizeof(struct statistics_general) * 10 + 300; 1080 user_buf, count, ppos);
1688 ssize_t ret; 1081 return 0;
1689 struct statistics_general *general, *accum_general;
1690 struct statistics_general *delta_general, *max_general;
1691 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
1692 struct statistics_div *div, *accum_div, *delta_div, *max_div;
1693
1694 if (!iwl_is_alive(priv))
1695 return -EAGAIN;
1696
1697 buf = kzalloc(bufsz, GFP_KERNEL);
1698 if (!buf) {
1699 IWL_ERR(priv, "Can not allocate Buffer\n");
1700 return -ENOMEM;
1701 }
1702
1703 /* the statistic information display here is based on
1704 * the last statistics notification from uCode
1705 * might not reflect the current uCode activity
1706 */
1707 general = &priv->statistics.general;
1708 dbg = &priv->statistics.general.dbg;
1709 div = &priv->statistics.general.div;
1710 accum_general = &priv->accum_statistics.general;
1711 delta_general = &priv->delta_statistics.general;
1712 max_general = &priv->max_delta.general;
1713 accum_dbg = &priv->accum_statistics.general.dbg;
1714 delta_dbg = &priv->delta_statistics.general.dbg;
1715 max_dbg = &priv->max_delta.general.dbg;
1716 accum_div = &priv->accum_statistics.general.div;
1717 delta_div = &priv->delta_statistics.general.div;
1718 max_div = &priv->max_delta.general.div;
1719 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
1720 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1721 "Statistics_General:");
1722 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_short_format,
1723 "temperature:",
1724 le32_to_cpu(general->temperature));
1725 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_short_format,
1726 "temperature_m:",
1727 le32_to_cpu(general->temperature_m));
1728 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1729 "burst_check:",
1730 le32_to_cpu(dbg->burst_check),
1731 accum_dbg->burst_check,
1732 delta_dbg->burst_check, max_dbg->burst_check);
1733 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1734 "burst_count:",
1735 le32_to_cpu(dbg->burst_count),
1736 accum_dbg->burst_count,
1737 delta_dbg->burst_count, max_dbg->burst_count);
1738 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1739 "sleep_time:",
1740 le32_to_cpu(general->sleep_time),
1741 accum_general->sleep_time,
1742 delta_general->sleep_time, max_general->sleep_time);
1743 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1744 "slots_out:",
1745 le32_to_cpu(general->slots_out),
1746 accum_general->slots_out,
1747 delta_general->slots_out, max_general->slots_out);
1748 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1749 "slots_idle:",
1750 le32_to_cpu(general->slots_idle),
1751 accum_general->slots_idle,
1752 delta_general->slots_idle, max_general->slots_idle);
1753 pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp:\t\t\t%u\n",
1754 le32_to_cpu(general->ttl_timestamp));
1755 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1756 "tx_on_a:",
1757 le32_to_cpu(div->tx_on_a), accum_div->tx_on_a,
1758 delta_div->tx_on_a, max_div->tx_on_a);
1759 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1760 "tx_on_b:",
1761 le32_to_cpu(div->tx_on_b), accum_div->tx_on_b,
1762 delta_div->tx_on_b, max_div->tx_on_b);
1763 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1764 "exec_time:",
1765 le32_to_cpu(div->exec_time), accum_div->exec_time,
1766 delta_div->exec_time, max_div->exec_time);
1767 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1768 "probe_time:",
1769 le32_to_cpu(div->probe_time), accum_div->probe_time,
1770 delta_div->probe_time, max_div->probe_time);
1771 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1772 "rx_enable_counter:",
1773 le32_to_cpu(general->rx_enable_counter),
1774 accum_general->rx_enable_counter,
1775 delta_general->rx_enable_counter,
1776 max_general->rx_enable_counter);
1777 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1778 "num_of_sos_states:",
1779 le32_to_cpu(general->num_of_sos_states),
1780 accum_general->num_of_sos_states,
1781 delta_general->num_of_sos_states,
1782 max_general->num_of_sos_states);
1783 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1784 kfree(buf);
1785 return ret;
1786} 1082}
1787 1083
1788static ssize_t iwl_dbgfs_sensitivity_read(struct file *file, 1084static ssize_t iwl_dbgfs_sensitivity_read(struct file *file,
@@ -2340,10 +1636,11 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
2340 DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); 1636 DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR);
2341 DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); 1637 DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR);
2342 DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR); 1638 DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR);
1639 DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR);
1640 DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR);
1641 DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR);
1642
2343 if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { 1643 if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) {
2344 DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR);
2345 DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR);
2346 DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR);
2347 DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); 1644 DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR);
2348 DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); 1645 DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR);
2349 DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); 1646 DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR);