aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2011-04-30 12:10:53 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2011-04-30 12:10:53 -0400
commitd6d023a1948d13652d719238f8039c09acceda8c (patch)
tree24e0c08f0ce607bdab2c35aa9d97e9b8728eb306 /drivers
parentebf8dc8060e4b10e8e13abbf98544f5c6cc8b25e (diff)
iwlagn: remove un-necessary debugfs callback
After driver split, no need for debugfs callback, remove those Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/Makefile1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-2000.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c15
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c15
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c1025
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h70
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c1006
9 files changed, 978 insertions, 1184 deletions
diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile
index bb6a737de61f..89a41d320c36 100644
--- a/drivers/net/wireless/iwlwifi/Makefile
+++ b/drivers/net/wireless/iwlwifi/Makefile
@@ -14,7 +14,6 @@ iwlagn-objs += iwl-6000.o
14iwlagn-objs += iwl-1000.o 14iwlagn-objs += iwl-1000.o
15iwlagn-objs += iwl-2000.o 15iwlagn-objs += iwl-2000.o
16 16
17iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-agn-debugfs.o
18iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o 17iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
19iwlagn-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o 18iwlagn-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o
20 19
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 4767edfa451d..3da8cf27dcb9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -45,7 +45,6 @@
45#include "iwl-agn.h" 45#include "iwl-agn.h"
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-debugfs.h"
49 48
50/* Highest firmware API version supported */ 49/* Highest firmware API version supported */
51#define IWL1000_UCODE_API_MAX 5 50#define IWL1000_UCODE_API_MAX 5
@@ -202,13 +201,6 @@ static struct iwl_lib_ops iwl1000_lib = {
202 .temp_ops = { 201 .temp_ops = {
203 .temperature = iwlagn_temperature, 202 .temperature = iwlagn_temperature,
204 }, 203 },
205 .debugfs_ops = {
206 .rx_stats_read = iwl_ucode_rx_stats_read,
207 .tx_stats_read = iwl_ucode_tx_stats_read,
208 .general_stats_read = iwl_ucode_general_stats_read,
209 .bt_stats_read = iwl_ucode_bt_stats_read,
210 .reply_tx_error = iwl_reply_tx_error_read,
211 },
212 .txfifo_flush = iwlagn_txfifo_flush, 204 .txfifo_flush = iwlagn_txfifo_flush,
213 .dev_txfifo_flush = iwlagn_dev_txfifo_flush, 205 .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
214}; 206};
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c
index 80137ed5b34a..bca462c47e37 100644
--- a/drivers/net/wireless/iwlwifi/iwl-2000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-2000.c
@@ -46,7 +46,6 @@
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-6000-hw.h" 48#include "iwl-6000-hw.h"
49#include "iwl-agn-debugfs.h"
50 49
51/* Highest firmware API version supported */ 50/* Highest firmware API version supported */
52#define IWL2030_UCODE_API_MAX 5 51#define IWL2030_UCODE_API_MAX 5
@@ -286,13 +285,6 @@ static struct iwl_lib_ops iwl2000_lib = {
286 .temp_ops = { 285 .temp_ops = {
287 .temperature = iwlagn_temperature, 286 .temperature = iwlagn_temperature,
288 }, 287 },
289 .debugfs_ops = {
290 .rx_stats_read = iwl_ucode_rx_stats_read,
291 .tx_stats_read = iwl_ucode_tx_stats_read,
292 .general_stats_read = iwl_ucode_general_stats_read,
293 .bt_stats_read = iwl_ucode_bt_stats_read,
294 .reply_tx_error = iwl_reply_tx_error_read,
295 },
296 .txfifo_flush = iwlagn_txfifo_flush, 288 .txfifo_flush = iwlagn_txfifo_flush,
297 .dev_txfifo_flush = iwlagn_dev_txfifo_flush, 289 .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
298}; 290};
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index cc25351fb5dc..561f2cd65dd4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -47,7 +47,6 @@
47#include "iwl-agn.h" 47#include "iwl-agn.h"
48#include "iwl-agn-hw.h" 48#include "iwl-agn-hw.h"
49#include "iwl-5000-hw.h" 49#include "iwl-5000-hw.h"
50#include "iwl-agn-debugfs.h"
51 50
52/* Highest firmware API version supported */ 51/* Highest firmware API version supported */
53#define IWL5000_UCODE_API_MAX 5 52#define IWL5000_UCODE_API_MAX 5
@@ -371,13 +370,6 @@ static struct iwl_lib_ops iwl5000_lib = {
371 .temp_ops = { 370 .temp_ops = {
372 .temperature = iwlagn_temperature, 371 .temperature = iwlagn_temperature,
373 }, 372 },
374 .debugfs_ops = {
375 .rx_stats_read = iwl_ucode_rx_stats_read,
376 .tx_stats_read = iwl_ucode_tx_stats_read,
377 .general_stats_read = iwl_ucode_general_stats_read,
378 .bt_stats_read = iwl_ucode_bt_stats_read,
379 .reply_tx_error = iwl_reply_tx_error_read,
380 },
381 .txfifo_flush = iwlagn_txfifo_flush, 373 .txfifo_flush = iwlagn_txfifo_flush,
382 .dev_txfifo_flush = iwlagn_dev_txfifo_flush, 374 .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
383}; 375};
@@ -415,13 +407,6 @@ static struct iwl_lib_ops iwl5150_lib = {
415 .temp_ops = { 407 .temp_ops = {
416 .temperature = iwl5150_temperature, 408 .temperature = iwl5150_temperature,
417 }, 409 },
418 .debugfs_ops = {
419 .rx_stats_read = iwl_ucode_rx_stats_read,
420 .tx_stats_read = iwl_ucode_tx_stats_read,
421 .general_stats_read = iwl_ucode_general_stats_read,
422 .bt_stats_read = iwl_ucode_bt_stats_read,
423 .reply_tx_error = iwl_reply_tx_error_read,
424 },
425 .txfifo_flush = iwlagn_txfifo_flush, 410 .txfifo_flush = iwlagn_txfifo_flush,
426 .dev_txfifo_flush = iwlagn_dev_txfifo_flush, 411 .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
427}; 412};
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index f9ef22721312..6045457cc722 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -46,7 +46,6 @@
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-6000-hw.h" 48#include "iwl-6000-hw.h"
49#include "iwl-agn-debugfs.h"
50 49
51/* Highest firmware API version supported */ 50/* Highest firmware API version supported */
52#define IWL6000_UCODE_API_MAX 4 51#define IWL6000_UCODE_API_MAX 4
@@ -311,13 +310,6 @@ static struct iwl_lib_ops iwl6000_lib = {
311 .temp_ops = { 310 .temp_ops = {
312 .temperature = iwlagn_temperature, 311 .temperature = iwlagn_temperature,
313 }, 312 },
314 .debugfs_ops = {
315 .rx_stats_read = iwl_ucode_rx_stats_read,
316 .tx_stats_read = iwl_ucode_tx_stats_read,
317 .general_stats_read = iwl_ucode_general_stats_read,
318 .bt_stats_read = iwl_ucode_bt_stats_read,
319 .reply_tx_error = iwl_reply_tx_error_read,
320 },
321 .txfifo_flush = iwlagn_txfifo_flush, 313 .txfifo_flush = iwlagn_txfifo_flush,
322 .dev_txfifo_flush = iwlagn_dev_txfifo_flush, 314 .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
323}; 315};
@@ -357,13 +349,6 @@ static struct iwl_lib_ops iwl6030_lib = {
357 .temp_ops = { 349 .temp_ops = {
358 .temperature = iwlagn_temperature, 350 .temperature = iwlagn_temperature,
359 }, 351 },
360 .debugfs_ops = {
361 .rx_stats_read = iwl_ucode_rx_stats_read,
362 .tx_stats_read = iwl_ucode_tx_stats_read,
363 .general_stats_read = iwl_ucode_general_stats_read,
364 .bt_stats_read = iwl_ucode_bt_stats_read,
365 .reply_tx_error = iwl_reply_tx_error_read,
366 },
367 .txfifo_flush = iwlagn_txfifo_flush, 352 .txfifo_flush = iwlagn_txfifo_flush,
368 .dev_txfifo_flush = iwlagn_dev_txfifo_flush, 353 .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
369}; 354};
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c
deleted file mode 100644
index 71a5f31cd7cc..000000000000
--- a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c
+++ /dev/null
@@ -1,1025 +0,0 @@
1/******************************************************************************
2 *
3 * GPL LICENSE SUMMARY
4 *
5 * Copyright(c) 2008 - 2011 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#include "iwl-agn.h"
29#include "iwl-agn-debugfs.h"
30
31static const char *fmt_value = " %-30s %10u\n";
32static const char *fmt_hex = " %-30s 0x%02X\n";
33static const char *fmt_table = " %-30s %10u %10u %10u %10u\n";
34static const char *fmt_header =
35 "%-32s current cumulative delta max\n";
36
37static int iwl_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
38{
39 int p = 0;
40 u32 flag;
41
42 flag = le32_to_cpu(priv->statistics.flag);
43
44 p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", flag);
45 if (flag & UCODE_STATISTICS_CLEAR_MSK)
46 p += scnprintf(buf + p, bufsz - p,
47 "\tStatistics have been cleared\n");
48 p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n",
49 (flag & UCODE_STATISTICS_FREQUENCY_MSK)
50 ? "2.4 GHz" : "5.2 GHz");
51 p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n",
52 (flag & UCODE_STATISTICS_NARROW_BAND_MSK)
53 ? "enabled" : "disabled");
54
55 return p;
56}
57
58ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf,
59 size_t count, loff_t *ppos)
60 {
61 struct iwl_priv *priv = file->private_data;
62 int pos = 0;
63 char *buf;
64 int bufsz = sizeof(struct statistics_rx_phy) * 40 +
65 sizeof(struct statistics_rx_non_phy) * 40 +
66 sizeof(struct statistics_rx_ht_phy) * 40 + 400;
67 ssize_t ret;
68 struct statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm;
69 struct statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
70 struct statistics_rx_non_phy *general, *accum_general;
71 struct statistics_rx_non_phy *delta_general, *max_general;
72 struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;
73
74 if (!iwl_is_alive(priv))
75 return -EAGAIN;
76
77 buf = kzalloc(bufsz, GFP_KERNEL);
78 if (!buf) {
79 IWL_ERR(priv, "Can not allocate Buffer\n");
80 return -ENOMEM;
81 }
82
83 /*
84 * the statistic information display here is based on
85 * the last statistics notification from uCode
86 * might not reflect the current uCode activity
87 */
88 ofdm = &priv->statistics.rx_ofdm;
89 cck = &priv->statistics.rx_cck;
90 general = &priv->statistics.rx_non_phy;
91 ht = &priv->statistics.rx_ofdm_ht;
92 accum_ofdm = &priv->accum_stats.rx_ofdm;
93 accum_cck = &priv->accum_stats.rx_cck;
94 accum_general = &priv->accum_stats.rx_non_phy;
95 accum_ht = &priv->accum_stats.rx_ofdm_ht;
96 delta_ofdm = &priv->delta_stats.rx_ofdm;
97 delta_cck = &priv->delta_stats.rx_cck;
98 delta_general = &priv->delta_stats.rx_non_phy;
99 delta_ht = &priv->delta_stats.rx_ofdm_ht;
100 max_ofdm = &priv->max_delta_stats.rx_ofdm;
101 max_cck = &priv->max_delta_stats.rx_cck;
102 max_general = &priv->max_delta_stats.rx_non_phy;
103 max_ht = &priv->max_delta_stats.rx_ofdm_ht;
104
105 pos += iwl_statistics_flag(priv, buf, bufsz);
106 pos += scnprintf(buf + pos, bufsz - pos,
107 fmt_header, "Statistics_Rx - OFDM:");
108 pos += scnprintf(buf + pos, bufsz - pos,
109 fmt_table, "ina_cnt:",
110 le32_to_cpu(ofdm->ina_cnt),
111 accum_ofdm->ina_cnt,
112 delta_ofdm->ina_cnt, max_ofdm->ina_cnt);
113 pos += scnprintf(buf + pos, bufsz - pos,
114 fmt_table, "fina_cnt:",
115 le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt,
116 delta_ofdm->fina_cnt, max_ofdm->fina_cnt);
117 pos += scnprintf(buf + pos, bufsz - pos,
118 fmt_table, "plcp_err:",
119 le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err,
120 delta_ofdm->plcp_err, max_ofdm->plcp_err);
121 pos += scnprintf(buf + pos, bufsz - pos,
122 fmt_table, "crc32_err:",
123 le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err,
124 delta_ofdm->crc32_err, max_ofdm->crc32_err);
125 pos += scnprintf(buf + pos, bufsz - pos,
126 fmt_table, "overrun_err:",
127 le32_to_cpu(ofdm->overrun_err),
128 accum_ofdm->overrun_err, delta_ofdm->overrun_err,
129 max_ofdm->overrun_err);
130 pos += scnprintf(buf + pos, bufsz - pos,
131 fmt_table, "early_overrun_err:",
132 le32_to_cpu(ofdm->early_overrun_err),
133 accum_ofdm->early_overrun_err,
134 delta_ofdm->early_overrun_err,
135 max_ofdm->early_overrun_err);
136 pos += scnprintf(buf + pos, bufsz - pos,
137 fmt_table, "crc32_good:",
138 le32_to_cpu(ofdm->crc32_good),
139 accum_ofdm->crc32_good, delta_ofdm->crc32_good,
140 max_ofdm->crc32_good);
141 pos += scnprintf(buf + pos, bufsz - pos,
142 fmt_table, "false_alarm_cnt:",
143 le32_to_cpu(ofdm->false_alarm_cnt),
144 accum_ofdm->false_alarm_cnt,
145 delta_ofdm->false_alarm_cnt,
146 max_ofdm->false_alarm_cnt);
147 pos += scnprintf(buf + pos, bufsz - pos,
148 fmt_table, "fina_sync_err_cnt:",
149 le32_to_cpu(ofdm->fina_sync_err_cnt),
150 accum_ofdm->fina_sync_err_cnt,
151 delta_ofdm->fina_sync_err_cnt,
152 max_ofdm->fina_sync_err_cnt);
153 pos += scnprintf(buf + pos, bufsz - pos,
154 fmt_table, "sfd_timeout:",
155 le32_to_cpu(ofdm->sfd_timeout),
156 accum_ofdm->sfd_timeout, delta_ofdm->sfd_timeout,
157 max_ofdm->sfd_timeout);
158 pos += scnprintf(buf + pos, bufsz - pos,
159 fmt_table, "fina_timeout:",
160 le32_to_cpu(ofdm->fina_timeout),
161 accum_ofdm->fina_timeout, delta_ofdm->fina_timeout,
162 max_ofdm->fina_timeout);
163 pos += scnprintf(buf + pos, bufsz - pos,
164 fmt_table, "unresponded_rts:",
165 le32_to_cpu(ofdm->unresponded_rts),
166 accum_ofdm->unresponded_rts,
167 delta_ofdm->unresponded_rts,
168 max_ofdm->unresponded_rts);
169 pos += scnprintf(buf + pos, bufsz - pos,
170 fmt_table, "rxe_frame_lmt_ovrun:",
171 le32_to_cpu(ofdm->rxe_frame_limit_overrun),
172 accum_ofdm->rxe_frame_limit_overrun,
173 delta_ofdm->rxe_frame_limit_overrun,
174 max_ofdm->rxe_frame_limit_overrun);
175 pos += scnprintf(buf + pos, bufsz - pos,
176 fmt_table, "sent_ack_cnt:",
177 le32_to_cpu(ofdm->sent_ack_cnt),
178 accum_ofdm->sent_ack_cnt, delta_ofdm->sent_ack_cnt,
179 max_ofdm->sent_ack_cnt);
180 pos += scnprintf(buf + pos, bufsz - pos,
181 fmt_table, "sent_cts_cnt:",
182 le32_to_cpu(ofdm->sent_cts_cnt),
183 accum_ofdm->sent_cts_cnt, delta_ofdm->sent_cts_cnt,
184 max_ofdm->sent_cts_cnt);
185 pos += scnprintf(buf + pos, bufsz - pos,
186 fmt_table, "sent_ba_rsp_cnt:",
187 le32_to_cpu(ofdm->sent_ba_rsp_cnt),
188 accum_ofdm->sent_ba_rsp_cnt,
189 delta_ofdm->sent_ba_rsp_cnt,
190 max_ofdm->sent_ba_rsp_cnt);
191 pos += scnprintf(buf + pos, bufsz - pos,
192 fmt_table, "dsp_self_kill:",
193 le32_to_cpu(ofdm->dsp_self_kill),
194 accum_ofdm->dsp_self_kill,
195 delta_ofdm->dsp_self_kill,
196 max_ofdm->dsp_self_kill);
197 pos += scnprintf(buf + pos, bufsz - pos,
198 fmt_table, "mh_format_err:",
199 le32_to_cpu(ofdm->mh_format_err),
200 accum_ofdm->mh_format_err,
201 delta_ofdm->mh_format_err,
202 max_ofdm->mh_format_err);
203 pos += scnprintf(buf + pos, bufsz - pos,
204 fmt_table, "re_acq_main_rssi_sum:",
205 le32_to_cpu(ofdm->re_acq_main_rssi_sum),
206 accum_ofdm->re_acq_main_rssi_sum,
207 delta_ofdm->re_acq_main_rssi_sum,
208 max_ofdm->re_acq_main_rssi_sum);
209
210 pos += scnprintf(buf + pos, bufsz - pos,
211 fmt_header, "Statistics_Rx - CCK:");
212 pos += scnprintf(buf + pos, bufsz - pos,
213 fmt_table, "ina_cnt:",
214 le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt,
215 delta_cck->ina_cnt, max_cck->ina_cnt);
216 pos += scnprintf(buf + pos, bufsz - pos,
217 fmt_table, "fina_cnt:",
218 le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt,
219 delta_cck->fina_cnt, max_cck->fina_cnt);
220 pos += scnprintf(buf + pos, bufsz - pos,
221 fmt_table, "plcp_err:",
222 le32_to_cpu(cck->plcp_err), accum_cck->plcp_err,
223 delta_cck->plcp_err, max_cck->plcp_err);
224 pos += scnprintf(buf + pos, bufsz - pos,
225 fmt_table, "crc32_err:",
226 le32_to_cpu(cck->crc32_err), accum_cck->crc32_err,
227 delta_cck->crc32_err, max_cck->crc32_err);
228 pos += scnprintf(buf + pos, bufsz - pos,
229 fmt_table, "overrun_err:",
230 le32_to_cpu(cck->overrun_err),
231 accum_cck->overrun_err, delta_cck->overrun_err,
232 max_cck->overrun_err);
233 pos += scnprintf(buf + pos, bufsz - pos,
234 fmt_table, "early_overrun_err:",
235 le32_to_cpu(cck->early_overrun_err),
236 accum_cck->early_overrun_err,
237 delta_cck->early_overrun_err,
238 max_cck->early_overrun_err);
239 pos += scnprintf(buf + pos, bufsz - pos,
240 fmt_table, "crc32_good:",
241 le32_to_cpu(cck->crc32_good), accum_cck->crc32_good,
242 delta_cck->crc32_good, max_cck->crc32_good);
243 pos += scnprintf(buf + pos, bufsz - pos,
244 fmt_table, "false_alarm_cnt:",
245 le32_to_cpu(cck->false_alarm_cnt),
246 accum_cck->false_alarm_cnt,
247 delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt);
248 pos += scnprintf(buf + pos, bufsz - pos,
249 fmt_table, "fina_sync_err_cnt:",
250 le32_to_cpu(cck->fina_sync_err_cnt),
251 accum_cck->fina_sync_err_cnt,
252 delta_cck->fina_sync_err_cnt,
253 max_cck->fina_sync_err_cnt);
254 pos += scnprintf(buf + pos, bufsz - pos,
255 fmt_table, "sfd_timeout:",
256 le32_to_cpu(cck->sfd_timeout),
257 accum_cck->sfd_timeout, delta_cck->sfd_timeout,
258 max_cck->sfd_timeout);
259 pos += scnprintf(buf + pos, bufsz - pos,
260 fmt_table, "fina_timeout:",
261 le32_to_cpu(cck->fina_timeout),
262 accum_cck->fina_timeout, delta_cck->fina_timeout,
263 max_cck->fina_timeout);
264 pos += scnprintf(buf + pos, bufsz - pos,
265 fmt_table, "unresponded_rts:",
266 le32_to_cpu(cck->unresponded_rts),
267 accum_cck->unresponded_rts, delta_cck->unresponded_rts,
268 max_cck->unresponded_rts);
269 pos += scnprintf(buf + pos, bufsz - pos,
270 fmt_table, "rxe_frame_lmt_ovrun:",
271 le32_to_cpu(cck->rxe_frame_limit_overrun),
272 accum_cck->rxe_frame_limit_overrun,
273 delta_cck->rxe_frame_limit_overrun,
274 max_cck->rxe_frame_limit_overrun);
275 pos += scnprintf(buf + pos, bufsz - pos,
276 fmt_table, "sent_ack_cnt:",
277 le32_to_cpu(cck->sent_ack_cnt),
278 accum_cck->sent_ack_cnt, delta_cck->sent_ack_cnt,
279 max_cck->sent_ack_cnt);
280 pos += scnprintf(buf + pos, bufsz - pos,
281 fmt_table, "sent_cts_cnt:",
282 le32_to_cpu(cck->sent_cts_cnt),
283 accum_cck->sent_cts_cnt, delta_cck->sent_cts_cnt,
284 max_cck->sent_cts_cnt);
285 pos += scnprintf(buf + pos, bufsz - pos,
286 fmt_table, "sent_ba_rsp_cnt:",
287 le32_to_cpu(cck->sent_ba_rsp_cnt),
288 accum_cck->sent_ba_rsp_cnt,
289 delta_cck->sent_ba_rsp_cnt,
290 max_cck->sent_ba_rsp_cnt);
291 pos += scnprintf(buf + pos, bufsz - pos,
292 fmt_table, "dsp_self_kill:",
293 le32_to_cpu(cck->dsp_self_kill),
294 accum_cck->dsp_self_kill, delta_cck->dsp_self_kill,
295 max_cck->dsp_self_kill);
296 pos += scnprintf(buf + pos, bufsz - pos,
297 fmt_table, "mh_format_err:",
298 le32_to_cpu(cck->mh_format_err),
299 accum_cck->mh_format_err, delta_cck->mh_format_err,
300 max_cck->mh_format_err);
301 pos += scnprintf(buf + pos, bufsz - pos,
302 fmt_table, "re_acq_main_rssi_sum:",
303 le32_to_cpu(cck->re_acq_main_rssi_sum),
304 accum_cck->re_acq_main_rssi_sum,
305 delta_cck->re_acq_main_rssi_sum,
306 max_cck->re_acq_main_rssi_sum);
307
308 pos += scnprintf(buf + pos, bufsz - pos,
309 fmt_header, "Statistics_Rx - GENERAL:");
310 pos += scnprintf(buf + pos, bufsz - pos,
311 fmt_table, "bogus_cts:",
312 le32_to_cpu(general->bogus_cts),
313 accum_general->bogus_cts, delta_general->bogus_cts,
314 max_general->bogus_cts);
315 pos += scnprintf(buf + pos, bufsz - pos,
316 fmt_table, "bogus_ack:",
317 le32_to_cpu(general->bogus_ack),
318 accum_general->bogus_ack, delta_general->bogus_ack,
319 max_general->bogus_ack);
320 pos += scnprintf(buf + pos, bufsz - pos,
321 fmt_table, "non_bssid_frames:",
322 le32_to_cpu(general->non_bssid_frames),
323 accum_general->non_bssid_frames,
324 delta_general->non_bssid_frames,
325 max_general->non_bssid_frames);
326 pos += scnprintf(buf + pos, bufsz - pos,
327 fmt_table, "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 fmt_table, "non_channel_beacons:",
334 le32_to_cpu(general->non_channel_beacons),
335 accum_general->non_channel_beacons,
336 delta_general->non_channel_beacons,
337 max_general->non_channel_beacons);
338 pos += scnprintf(buf + pos, bufsz - pos,
339 fmt_table, "channel_beacons:",
340 le32_to_cpu(general->channel_beacons),
341 accum_general->channel_beacons,
342 delta_general->channel_beacons,
343 max_general->channel_beacons);
344 pos += scnprintf(buf + pos, bufsz - pos,
345 fmt_table, "num_missed_bcon:",
346 le32_to_cpu(general->num_missed_bcon),
347 accum_general->num_missed_bcon,
348 delta_general->num_missed_bcon,
349 max_general->num_missed_bcon);
350 pos += scnprintf(buf + pos, bufsz - pos,
351 fmt_table, "adc_rx_saturation_time:",
352 le32_to_cpu(general->adc_rx_saturation_time),
353 accum_general->adc_rx_saturation_time,
354 delta_general->adc_rx_saturation_time,
355 max_general->adc_rx_saturation_time);
356 pos += scnprintf(buf + pos, bufsz - pos,
357 fmt_table, "ina_detect_search_tm:",
358 le32_to_cpu(general->ina_detection_search_time),
359 accum_general->ina_detection_search_time,
360 delta_general->ina_detection_search_time,
361 max_general->ina_detection_search_time);
362 pos += scnprintf(buf + pos, bufsz - pos,
363 fmt_table, "beacon_silence_rssi_a:",
364 le32_to_cpu(general->beacon_silence_rssi_a),
365 accum_general->beacon_silence_rssi_a,
366 delta_general->beacon_silence_rssi_a,
367 max_general->beacon_silence_rssi_a);
368 pos += scnprintf(buf + pos, bufsz - pos,
369 fmt_table, "beacon_silence_rssi_b:",
370 le32_to_cpu(general->beacon_silence_rssi_b),
371 accum_general->beacon_silence_rssi_b,
372 delta_general->beacon_silence_rssi_b,
373 max_general->beacon_silence_rssi_b);
374 pos += scnprintf(buf + pos, bufsz - pos,
375 fmt_table, "beacon_silence_rssi_c:",
376 le32_to_cpu(general->beacon_silence_rssi_c),
377 accum_general->beacon_silence_rssi_c,
378 delta_general->beacon_silence_rssi_c,
379 max_general->beacon_silence_rssi_c);
380 pos += scnprintf(buf + pos, bufsz - pos,
381 fmt_table, "interference_data_flag:",
382 le32_to_cpu(general->interference_data_flag),
383 accum_general->interference_data_flag,
384 delta_general->interference_data_flag,
385 max_general->interference_data_flag);
386 pos += scnprintf(buf + pos, bufsz - pos,
387 fmt_table, "channel_load:",
388 le32_to_cpu(general->channel_load),
389 accum_general->channel_load,
390 delta_general->channel_load,
391 max_general->channel_load);
392 pos += scnprintf(buf + pos, bufsz - pos,
393 fmt_table, "dsp_false_alarms:",
394 le32_to_cpu(general->dsp_false_alarms),
395 accum_general->dsp_false_alarms,
396 delta_general->dsp_false_alarms,
397 max_general->dsp_false_alarms);
398 pos += scnprintf(buf + pos, bufsz - pos,
399 fmt_table, "beacon_rssi_a:",
400 le32_to_cpu(general->beacon_rssi_a),
401 accum_general->beacon_rssi_a,
402 delta_general->beacon_rssi_a,
403 max_general->beacon_rssi_a);
404 pos += scnprintf(buf + pos, bufsz - pos,
405 fmt_table, "beacon_rssi_b:",
406 le32_to_cpu(general->beacon_rssi_b),
407 accum_general->beacon_rssi_b,
408 delta_general->beacon_rssi_b,
409 max_general->beacon_rssi_b);
410 pos += scnprintf(buf + pos, bufsz - pos,
411 fmt_table, "beacon_rssi_c:",
412 le32_to_cpu(general->beacon_rssi_c),
413 accum_general->beacon_rssi_c,
414 delta_general->beacon_rssi_c,
415 max_general->beacon_rssi_c);
416 pos += scnprintf(buf + pos, bufsz - pos,
417 fmt_table, "beacon_energy_a:",
418 le32_to_cpu(general->beacon_energy_a),
419 accum_general->beacon_energy_a,
420 delta_general->beacon_energy_a,
421 max_general->beacon_energy_a);
422 pos += scnprintf(buf + pos, bufsz - pos,
423 fmt_table, "beacon_energy_b:",
424 le32_to_cpu(general->beacon_energy_b),
425 accum_general->beacon_energy_b,
426 delta_general->beacon_energy_b,
427 max_general->beacon_energy_b);
428 pos += scnprintf(buf + pos, bufsz - pos,
429 fmt_table, "beacon_energy_c:",
430 le32_to_cpu(general->beacon_energy_c),
431 accum_general->beacon_energy_c,
432 delta_general->beacon_energy_c,
433 max_general->beacon_energy_c);
434
435 pos += scnprintf(buf + pos, bufsz - pos,
436 fmt_header, "Statistics_Rx - OFDM_HT:");
437 pos += scnprintf(buf + pos, bufsz - pos,
438 fmt_table, "plcp_err:",
439 le32_to_cpu(ht->plcp_err), accum_ht->plcp_err,
440 delta_ht->plcp_err, max_ht->plcp_err);
441 pos += scnprintf(buf + pos, bufsz - pos,
442 fmt_table, "overrun_err:",
443 le32_to_cpu(ht->overrun_err), accum_ht->overrun_err,
444 delta_ht->overrun_err, max_ht->overrun_err);
445 pos += scnprintf(buf + pos, bufsz - pos,
446 fmt_table, "early_overrun_err:",
447 le32_to_cpu(ht->early_overrun_err),
448 accum_ht->early_overrun_err,
449 delta_ht->early_overrun_err,
450 max_ht->early_overrun_err);
451 pos += scnprintf(buf + pos, bufsz - pos,
452 fmt_table, "crc32_good:",
453 le32_to_cpu(ht->crc32_good), accum_ht->crc32_good,
454 delta_ht->crc32_good, max_ht->crc32_good);
455 pos += scnprintf(buf + pos, bufsz - pos,
456 fmt_table, "crc32_err:",
457 le32_to_cpu(ht->crc32_err), accum_ht->crc32_err,
458 delta_ht->crc32_err, max_ht->crc32_err);
459 pos += scnprintf(buf + pos, bufsz - pos,
460 fmt_table, "mh_format_err:",
461 le32_to_cpu(ht->mh_format_err),
462 accum_ht->mh_format_err,
463 delta_ht->mh_format_err, max_ht->mh_format_err);
464 pos += scnprintf(buf + pos, bufsz - pos,
465 fmt_table, "agg_crc32_good:",
466 le32_to_cpu(ht->agg_crc32_good),
467 accum_ht->agg_crc32_good,
468 delta_ht->agg_crc32_good, max_ht->agg_crc32_good);
469 pos += scnprintf(buf + pos, bufsz - pos,
470 fmt_table, "agg_mpdu_cnt:",
471 le32_to_cpu(ht->agg_mpdu_cnt),
472 accum_ht->agg_mpdu_cnt,
473 delta_ht->agg_mpdu_cnt, max_ht->agg_mpdu_cnt);
474 pos += scnprintf(buf + pos, bufsz - pos,
475 fmt_table, "agg_cnt:",
476 le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt,
477 delta_ht->agg_cnt, max_ht->agg_cnt);
478 pos += scnprintf(buf + pos, bufsz - pos,
479 fmt_table, "unsupport_mcs:",
480 le32_to_cpu(ht->unsupport_mcs),
481 accum_ht->unsupport_mcs,
482 delta_ht->unsupport_mcs, max_ht->unsupport_mcs);
483
484 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
485 kfree(buf);
486 return ret;
487}
488
489ssize_t iwl_ucode_tx_stats_read(struct file *file,
490 char __user *user_buf,
491 size_t count, loff_t *ppos)
492{
493 struct iwl_priv *priv = file->private_data;
494 int pos = 0;
495 char *buf;
496 int bufsz = (sizeof(struct statistics_tx) * 48) + 250;
497 ssize_t ret;
498 struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
499
500 if (!iwl_is_alive(priv))
501 return -EAGAIN;
502
503 buf = kzalloc(bufsz, GFP_KERNEL);
504 if (!buf) {
505 IWL_ERR(priv, "Can not allocate Buffer\n");
506 return -ENOMEM;
507 }
508
509 /* the statistic information display here is based on
510 * the last statistics notification from uCode
511 * might not reflect the current uCode activity
512 */
513 tx = &priv->statistics.tx;
514 accum_tx = &priv->accum_stats.tx;
515 delta_tx = &priv->delta_stats.tx;
516 max_tx = &priv->max_delta_stats.tx;
517
518 pos += iwl_statistics_flag(priv, buf, bufsz);
519 pos += scnprintf(buf + pos, bufsz - pos,
520 fmt_header, "Statistics_Tx:");
521 pos += scnprintf(buf + pos, bufsz - pos,
522 fmt_table, "preamble:",
523 le32_to_cpu(tx->preamble_cnt),
524 accum_tx->preamble_cnt,
525 delta_tx->preamble_cnt, max_tx->preamble_cnt);
526 pos += scnprintf(buf + pos, bufsz - pos,
527 fmt_table, "rx_detected_cnt:",
528 le32_to_cpu(tx->rx_detected_cnt),
529 accum_tx->rx_detected_cnt,
530 delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt);
531 pos += scnprintf(buf + pos, bufsz - pos,
532 fmt_table, "bt_prio_defer_cnt:",
533 le32_to_cpu(tx->bt_prio_defer_cnt),
534 accum_tx->bt_prio_defer_cnt,
535 delta_tx->bt_prio_defer_cnt,
536 max_tx->bt_prio_defer_cnt);
537 pos += scnprintf(buf + pos, bufsz - pos,
538 fmt_table, "bt_prio_kill_cnt:",
539 le32_to_cpu(tx->bt_prio_kill_cnt),
540 accum_tx->bt_prio_kill_cnt,
541 delta_tx->bt_prio_kill_cnt,
542 max_tx->bt_prio_kill_cnt);
543 pos += scnprintf(buf + pos, bufsz - pos,
544 fmt_table, "few_bytes_cnt:",
545 le32_to_cpu(tx->few_bytes_cnt),
546 accum_tx->few_bytes_cnt,
547 delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt);
548 pos += scnprintf(buf + pos, bufsz - pos,
549 fmt_table, "cts_timeout:",
550 le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout,
551 delta_tx->cts_timeout, max_tx->cts_timeout);
552 pos += scnprintf(buf + pos, bufsz - pos,
553 fmt_table, "ack_timeout:",
554 le32_to_cpu(tx->ack_timeout),
555 accum_tx->ack_timeout,
556 delta_tx->ack_timeout, max_tx->ack_timeout);
557 pos += scnprintf(buf + pos, bufsz - pos,
558 fmt_table, "expected_ack_cnt:",
559 le32_to_cpu(tx->expected_ack_cnt),
560 accum_tx->expected_ack_cnt,
561 delta_tx->expected_ack_cnt,
562 max_tx->expected_ack_cnt);
563 pos += scnprintf(buf + pos, bufsz - pos,
564 fmt_table, "actual_ack_cnt:",
565 le32_to_cpu(tx->actual_ack_cnt),
566 accum_tx->actual_ack_cnt,
567 delta_tx->actual_ack_cnt,
568 max_tx->actual_ack_cnt);
569 pos += scnprintf(buf + pos, bufsz - pos,
570 fmt_table, "dump_msdu_cnt:",
571 le32_to_cpu(tx->dump_msdu_cnt),
572 accum_tx->dump_msdu_cnt,
573 delta_tx->dump_msdu_cnt,
574 max_tx->dump_msdu_cnt);
575 pos += scnprintf(buf + pos, bufsz - pos,
576 fmt_table, "abort_nxt_frame_mismatch:",
577 le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt),
578 accum_tx->burst_abort_next_frame_mismatch_cnt,
579 delta_tx->burst_abort_next_frame_mismatch_cnt,
580 max_tx->burst_abort_next_frame_mismatch_cnt);
581 pos += scnprintf(buf + pos, bufsz - pos,
582 fmt_table, "abort_missing_nxt_frame:",
583 le32_to_cpu(tx->burst_abort_missing_next_frame_cnt),
584 accum_tx->burst_abort_missing_next_frame_cnt,
585 delta_tx->burst_abort_missing_next_frame_cnt,
586 max_tx->burst_abort_missing_next_frame_cnt);
587 pos += scnprintf(buf + pos, bufsz - pos,
588 fmt_table, "cts_timeout_collision:",
589 le32_to_cpu(tx->cts_timeout_collision),
590 accum_tx->cts_timeout_collision,
591 delta_tx->cts_timeout_collision,
592 max_tx->cts_timeout_collision);
593 pos += scnprintf(buf + pos, bufsz - pos,
594 fmt_table, "ack_ba_timeout_collision:",
595 le32_to_cpu(tx->ack_or_ba_timeout_collision),
596 accum_tx->ack_or_ba_timeout_collision,
597 delta_tx->ack_or_ba_timeout_collision,
598 max_tx->ack_or_ba_timeout_collision);
599 pos += scnprintf(buf + pos, bufsz - pos,
600 fmt_table, "agg ba_timeout:",
601 le32_to_cpu(tx->agg.ba_timeout),
602 accum_tx->agg.ba_timeout,
603 delta_tx->agg.ba_timeout,
604 max_tx->agg.ba_timeout);
605 pos += scnprintf(buf + pos, bufsz - pos,
606 fmt_table, "agg ba_resched_frames:",
607 le32_to_cpu(tx->agg.ba_reschedule_frames),
608 accum_tx->agg.ba_reschedule_frames,
609 delta_tx->agg.ba_reschedule_frames,
610 max_tx->agg.ba_reschedule_frames);
611 pos += scnprintf(buf + pos, bufsz - pos,
612 fmt_table, "agg scd_query_agg_frame:",
613 le32_to_cpu(tx->agg.scd_query_agg_frame_cnt),
614 accum_tx->agg.scd_query_agg_frame_cnt,
615 delta_tx->agg.scd_query_agg_frame_cnt,
616 max_tx->agg.scd_query_agg_frame_cnt);
617 pos += scnprintf(buf + pos, bufsz - pos,
618 fmt_table, "agg scd_query_no_agg:",
619 le32_to_cpu(tx->agg.scd_query_no_agg),
620 accum_tx->agg.scd_query_no_agg,
621 delta_tx->agg.scd_query_no_agg,
622 max_tx->agg.scd_query_no_agg);
623 pos += scnprintf(buf + pos, bufsz - pos,
624 fmt_table, "agg scd_query_agg:",
625 le32_to_cpu(tx->agg.scd_query_agg),
626 accum_tx->agg.scd_query_agg,
627 delta_tx->agg.scd_query_agg,
628 max_tx->agg.scd_query_agg);
629 pos += scnprintf(buf + pos, bufsz - pos,
630 fmt_table, "agg scd_query_mismatch:",
631 le32_to_cpu(tx->agg.scd_query_mismatch),
632 accum_tx->agg.scd_query_mismatch,
633 delta_tx->agg.scd_query_mismatch,
634 max_tx->agg.scd_query_mismatch);
635 pos += scnprintf(buf + pos, bufsz - pos,
636 fmt_table, "agg frame_not_ready:",
637 le32_to_cpu(tx->agg.frame_not_ready),
638 accum_tx->agg.frame_not_ready,
639 delta_tx->agg.frame_not_ready,
640 max_tx->agg.frame_not_ready);
641 pos += scnprintf(buf + pos, bufsz - pos,
642 fmt_table, "agg underrun:",
643 le32_to_cpu(tx->agg.underrun),
644 accum_tx->agg.underrun,
645 delta_tx->agg.underrun, max_tx->agg.underrun);
646 pos += scnprintf(buf + pos, bufsz - pos,
647 fmt_table, "agg bt_prio_kill:",
648 le32_to_cpu(tx->agg.bt_prio_kill),
649 accum_tx->agg.bt_prio_kill,
650 delta_tx->agg.bt_prio_kill,
651 max_tx->agg.bt_prio_kill);
652 pos += scnprintf(buf + pos, bufsz - pos,
653 fmt_table, "agg rx_ba_rsp_cnt:",
654 le32_to_cpu(tx->agg.rx_ba_rsp_cnt),
655 accum_tx->agg.rx_ba_rsp_cnt,
656 delta_tx->agg.rx_ba_rsp_cnt,
657 max_tx->agg.rx_ba_rsp_cnt);
658
659 if (tx->tx_power.ant_a || tx->tx_power.ant_b || tx->tx_power.ant_c) {
660 pos += scnprintf(buf + pos, bufsz - pos,
661 "tx power: (1/2 dB step)\n");
662 if ((priv->cfg->valid_tx_ant & ANT_A) && tx->tx_power.ant_a)
663 pos += scnprintf(buf + pos, bufsz - pos,
664 fmt_hex, "antenna A:",
665 tx->tx_power.ant_a);
666 if ((priv->cfg->valid_tx_ant & ANT_B) && tx->tx_power.ant_b)
667 pos += scnprintf(buf + pos, bufsz - pos,
668 fmt_hex, "antenna B:",
669 tx->tx_power.ant_b);
670 if ((priv->cfg->valid_tx_ant & ANT_C) && tx->tx_power.ant_c)
671 pos += scnprintf(buf + pos, bufsz - pos,
672 fmt_hex, "antenna C:",
673 tx->tx_power.ant_c);
674 }
675 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
676 kfree(buf);
677 return ret;
678}
679
680ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf,
681 size_t count, loff_t *ppos)
682{
683 struct iwl_priv *priv = file->private_data;
684 int pos = 0;
685 char *buf;
686 int bufsz = sizeof(struct statistics_general) * 10 + 300;
687 ssize_t ret;
688 struct statistics_general_common *general, *accum_general;
689 struct statistics_general_common *delta_general, *max_general;
690 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
691 struct statistics_div *div, *accum_div, *delta_div, *max_div;
692
693 if (!iwl_is_alive(priv))
694 return -EAGAIN;
695
696 buf = kzalloc(bufsz, GFP_KERNEL);
697 if (!buf) {
698 IWL_ERR(priv, "Can not allocate Buffer\n");
699 return -ENOMEM;
700 }
701
702 /* the statistic information display here is based on
703 * the last statistics notification from uCode
704 * might not reflect the current uCode activity
705 */
706 general = &priv->statistics.common;
707 dbg = &priv->statistics.common.dbg;
708 div = &priv->statistics.common.div;
709 accum_general = &priv->accum_stats.common;
710 accum_dbg = &priv->accum_stats.common.dbg;
711 accum_div = &priv->accum_stats.common.div;
712 delta_general = &priv->delta_stats.common;
713 max_general = &priv->max_delta_stats.common;
714 delta_dbg = &priv->delta_stats.common.dbg;
715 max_dbg = &priv->max_delta_stats.common.dbg;
716 delta_div = &priv->delta_stats.common.div;
717 max_div = &priv->max_delta_stats.common.div;
718
719 pos += iwl_statistics_flag(priv, buf, bufsz);
720 pos += scnprintf(buf + pos, bufsz - pos,
721 fmt_header, "Statistics_General:");
722 pos += scnprintf(buf + pos, bufsz - pos,
723 fmt_value, "temperature:",
724 le32_to_cpu(general->temperature));
725 pos += scnprintf(buf + pos, bufsz - pos,
726 fmt_value, "temperature_m:",
727 le32_to_cpu(general->temperature_m));
728 pos += scnprintf(buf + pos, bufsz - pos,
729 fmt_value, "ttl_timestamp:",
730 le32_to_cpu(general->ttl_timestamp));
731 pos += scnprintf(buf + pos, bufsz - pos,
732 fmt_table, "burst_check:",
733 le32_to_cpu(dbg->burst_check),
734 accum_dbg->burst_check,
735 delta_dbg->burst_check, max_dbg->burst_check);
736 pos += scnprintf(buf + pos, bufsz - pos,
737 fmt_table, "burst_count:",
738 le32_to_cpu(dbg->burst_count),
739 accum_dbg->burst_count,
740 delta_dbg->burst_count, max_dbg->burst_count);
741 pos += scnprintf(buf + pos, bufsz - pos,
742 fmt_table, "wait_for_silence_timeout_count:",
743 le32_to_cpu(dbg->wait_for_silence_timeout_cnt),
744 accum_dbg->wait_for_silence_timeout_cnt,
745 delta_dbg->wait_for_silence_timeout_cnt,
746 max_dbg->wait_for_silence_timeout_cnt);
747 pos += scnprintf(buf + pos, bufsz - pos,
748 fmt_table, "sleep_time:",
749 le32_to_cpu(general->sleep_time),
750 accum_general->sleep_time,
751 delta_general->sleep_time, max_general->sleep_time);
752 pos += scnprintf(buf + pos, bufsz - pos,
753 fmt_table, "slots_out:",
754 le32_to_cpu(general->slots_out),
755 accum_general->slots_out,
756 delta_general->slots_out, max_general->slots_out);
757 pos += scnprintf(buf + pos, bufsz - pos,
758 fmt_table, "slots_idle:",
759 le32_to_cpu(general->slots_idle),
760 accum_general->slots_idle,
761 delta_general->slots_idle, max_general->slots_idle);
762 pos += scnprintf(buf + pos, bufsz - pos,
763 fmt_table, "tx_on_a:",
764 le32_to_cpu(div->tx_on_a), accum_div->tx_on_a,
765 delta_div->tx_on_a, max_div->tx_on_a);
766 pos += scnprintf(buf + pos, bufsz - pos,
767 fmt_table, "tx_on_b:",
768 le32_to_cpu(div->tx_on_b), accum_div->tx_on_b,
769 delta_div->tx_on_b, max_div->tx_on_b);
770 pos += scnprintf(buf + pos, bufsz - pos,
771 fmt_table, "exec_time:",
772 le32_to_cpu(div->exec_time), accum_div->exec_time,
773 delta_div->exec_time, max_div->exec_time);
774 pos += scnprintf(buf + pos, bufsz - pos,
775 fmt_table, "probe_time:",
776 le32_to_cpu(div->probe_time), accum_div->probe_time,
777 delta_div->probe_time, max_div->probe_time);
778 pos += scnprintf(buf + pos, bufsz - pos,
779 fmt_table, "rx_enable_counter:",
780 le32_to_cpu(general->rx_enable_counter),
781 accum_general->rx_enable_counter,
782 delta_general->rx_enable_counter,
783 max_general->rx_enable_counter);
784 pos += scnprintf(buf + pos, bufsz - pos,
785 fmt_table, "num_of_sos_states:",
786 le32_to_cpu(general->num_of_sos_states),
787 accum_general->num_of_sos_states,
788 delta_general->num_of_sos_states,
789 max_general->num_of_sos_states);
790 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
791 kfree(buf);
792 return ret;
793}
794
795ssize_t iwl_ucode_bt_stats_read(struct file *file,
796 char __user *user_buf,
797 size_t count, loff_t *ppos)
798{
799 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
800 int pos = 0;
801 char *buf;
802 int bufsz = (sizeof(struct statistics_bt_activity) * 24) + 200;
803 ssize_t ret;
804 struct statistics_bt_activity *bt, *accum_bt;
805
806 if (!iwl_is_alive(priv))
807 return -EAGAIN;
808
809 if (!priv->bt_enable_flag)
810 return -EINVAL;
811
812 /* make request to uCode to retrieve statistics information */
813 mutex_lock(&priv->mutex);
814 ret = iwl_send_statistics_request(priv, CMD_SYNC, false);
815 mutex_unlock(&priv->mutex);
816
817 if (ret) {
818 IWL_ERR(priv,
819 "Error sending statistics request: %zd\n", ret);
820 return -EAGAIN;
821 }
822 buf = kzalloc(bufsz, GFP_KERNEL);
823 if (!buf) {
824 IWL_ERR(priv, "Can not allocate Buffer\n");
825 return -ENOMEM;
826 }
827
828 /*
829 * the statistic information display here is based on
830 * the last statistics notification from uCode
831 * might not reflect the current uCode activity
832 */
833 bt = &priv->statistics.bt_activity;
834 accum_bt = &priv->accum_stats.bt_activity;
835
836 pos += iwl_statistics_flag(priv, buf, bufsz);
837 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_BT:\n");
838 pos += scnprintf(buf + pos, bufsz - pos,
839 "\t\t\tcurrent\t\t\taccumulative\n");
840 pos += scnprintf(buf + pos, bufsz - pos,
841 "hi_priority_tx_req_cnt:\t\t%u\t\t\t%u\n",
842 le32_to_cpu(bt->hi_priority_tx_req_cnt),
843 accum_bt->hi_priority_tx_req_cnt);
844 pos += scnprintf(buf + pos, bufsz - pos,
845 "hi_priority_tx_denied_cnt:\t%u\t\t\t%u\n",
846 le32_to_cpu(bt->hi_priority_tx_denied_cnt),
847 accum_bt->hi_priority_tx_denied_cnt);
848 pos += scnprintf(buf + pos, bufsz - pos,
849 "lo_priority_tx_req_cnt:\t\t%u\t\t\t%u\n",
850 le32_to_cpu(bt->lo_priority_tx_req_cnt),
851 accum_bt->lo_priority_tx_req_cnt);
852 pos += scnprintf(buf + pos, bufsz - pos,
853 "lo_priority_tx_denied_cnt:\t%u\t\t\t%u\n",
854 le32_to_cpu(bt->lo_priority_tx_denied_cnt),
855 accum_bt->lo_priority_tx_denied_cnt);
856 pos += scnprintf(buf + pos, bufsz - pos,
857 "hi_priority_rx_req_cnt:\t\t%u\t\t\t%u\n",
858 le32_to_cpu(bt->hi_priority_rx_req_cnt),
859 accum_bt->hi_priority_rx_req_cnt);
860 pos += scnprintf(buf + pos, bufsz - pos,
861 "hi_priority_rx_denied_cnt:\t%u\t\t\t%u\n",
862 le32_to_cpu(bt->hi_priority_rx_denied_cnt),
863 accum_bt->hi_priority_rx_denied_cnt);
864 pos += scnprintf(buf + pos, bufsz - pos,
865 "lo_priority_rx_req_cnt:\t\t%u\t\t\t%u\n",
866 le32_to_cpu(bt->lo_priority_rx_req_cnt),
867 accum_bt->lo_priority_rx_req_cnt);
868 pos += scnprintf(buf + pos, bufsz - pos,
869 "lo_priority_rx_denied_cnt:\t%u\t\t\t%u\n",
870 le32_to_cpu(bt->lo_priority_rx_denied_cnt),
871 accum_bt->lo_priority_rx_denied_cnt);
872
873 pos += scnprintf(buf + pos, bufsz - pos,
874 "(rx)num_bt_kills:\t\t%u\t\t\t%u\n",
875 le32_to_cpu(priv->statistics.num_bt_kills),
876 priv->statistics.accum_num_bt_kills);
877
878 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
879 kfree(buf);
880 return ret;
881}
882
883ssize_t iwl_reply_tx_error_read(struct file *file,
884 char __user *user_buf,
885 size_t count, loff_t *ppos)
886{
887 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
888 int pos = 0;
889 char *buf;
890 int bufsz = (sizeof(struct reply_tx_error_statistics) * 24) +
891 (sizeof(struct reply_agg_tx_error_statistics) * 24) + 200;
892 ssize_t ret;
893
894 if (!iwl_is_alive(priv))
895 return -EAGAIN;
896
897 buf = kzalloc(bufsz, GFP_KERNEL);
898 if (!buf) {
899 IWL_ERR(priv, "Can not allocate Buffer\n");
900 return -ENOMEM;
901 }
902
903 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_TX_Error:\n");
904 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t\t%u\n",
905 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_DELAY),
906 priv->_agn.reply_tx_stats.pp_delay);
907 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
908 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_FEW_BYTES),
909 priv->_agn.reply_tx_stats.pp_few_bytes);
910 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
911 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_BT_PRIO),
912 priv->_agn.reply_tx_stats.pp_bt_prio);
913 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
914 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_QUIET_PERIOD),
915 priv->_agn.reply_tx_stats.pp_quiet_period);
916 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
917 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_CALC_TTAK),
918 priv->_agn.reply_tx_stats.pp_calc_ttak);
919 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n",
920 iwl_get_tx_fail_reason(
921 TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY),
922 priv->_agn.reply_tx_stats.int_crossed_retry);
923 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
924 iwl_get_tx_fail_reason(TX_STATUS_FAIL_SHORT_LIMIT),
925 priv->_agn.reply_tx_stats.short_limit);
926 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
927 iwl_get_tx_fail_reason(TX_STATUS_FAIL_LONG_LIMIT),
928 priv->_agn.reply_tx_stats.long_limit);
929 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
930 iwl_get_tx_fail_reason(TX_STATUS_FAIL_FIFO_UNDERRUN),
931 priv->_agn.reply_tx_stats.fifo_underrun);
932 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
933 iwl_get_tx_fail_reason(TX_STATUS_FAIL_DRAIN_FLOW),
934 priv->_agn.reply_tx_stats.drain_flow);
935 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
936 iwl_get_tx_fail_reason(TX_STATUS_FAIL_RFKILL_FLUSH),
937 priv->_agn.reply_tx_stats.rfkill_flush);
938 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
939 iwl_get_tx_fail_reason(TX_STATUS_FAIL_LIFE_EXPIRE),
940 priv->_agn.reply_tx_stats.life_expire);
941 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
942 iwl_get_tx_fail_reason(TX_STATUS_FAIL_DEST_PS),
943 priv->_agn.reply_tx_stats.dest_ps);
944 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
945 iwl_get_tx_fail_reason(TX_STATUS_FAIL_HOST_ABORTED),
946 priv->_agn.reply_tx_stats.host_abort);
947 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
948 iwl_get_tx_fail_reason(TX_STATUS_FAIL_BT_RETRY),
949 priv->_agn.reply_tx_stats.pp_delay);
950 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
951 iwl_get_tx_fail_reason(TX_STATUS_FAIL_STA_INVALID),
952 priv->_agn.reply_tx_stats.sta_invalid);
953 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
954 iwl_get_tx_fail_reason(TX_STATUS_FAIL_FRAG_DROPPED),
955 priv->_agn.reply_tx_stats.frag_drop);
956 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
957 iwl_get_tx_fail_reason(TX_STATUS_FAIL_TID_DISABLE),
958 priv->_agn.reply_tx_stats.tid_disable);
959 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
960 iwl_get_tx_fail_reason(TX_STATUS_FAIL_FIFO_FLUSHED),
961 priv->_agn.reply_tx_stats.fifo_flush);
962 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n",
963 iwl_get_tx_fail_reason(
964 TX_STATUS_FAIL_INSUFFICIENT_CF_POLL),
965 priv->_agn.reply_tx_stats.insuff_cf_poll);
966 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
967 iwl_get_tx_fail_reason(TX_STATUS_FAIL_PASSIVE_NO_RX),
968 priv->_agn.reply_tx_stats.fail_hw_drop);
969 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n",
970 iwl_get_tx_fail_reason(
971 TX_STATUS_FAIL_NO_BEACON_ON_RADAR),
972 priv->_agn.reply_tx_stats.sta_color_mismatch);
973 pos += scnprintf(buf + pos, bufsz - pos, "UNKNOWN:\t\t\t%u\n",
974 priv->_agn.reply_tx_stats.unknown);
975
976 pos += scnprintf(buf + pos, bufsz - pos,
977 "\nStatistics_Agg_TX_Error:\n");
978
979 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
980 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_UNDERRUN_MSK),
981 priv->_agn.reply_agg_tx_stats.underrun);
982 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
983 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_BT_PRIO_MSK),
984 priv->_agn.reply_agg_tx_stats.bt_prio);
985 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
986 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_FEW_BYTES_MSK),
987 priv->_agn.reply_agg_tx_stats.few_bytes);
988 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
989 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_ABORT_MSK),
990 priv->_agn.reply_agg_tx_stats.abort);
991 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n",
992 iwl_get_agg_tx_fail_reason(
993 AGG_TX_STATE_LAST_SENT_TTL_MSK),
994 priv->_agn.reply_agg_tx_stats.last_sent_ttl);
995 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n",
996 iwl_get_agg_tx_fail_reason(
997 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK),
998 priv->_agn.reply_agg_tx_stats.last_sent_try);
999 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n",
1000 iwl_get_agg_tx_fail_reason(
1001 AGG_TX_STATE_LAST_SENT_BT_KILL_MSK),
1002 priv->_agn.reply_agg_tx_stats.last_sent_bt_kill);
1003 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1004 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_SCD_QUERY_MSK),
1005 priv->_agn.reply_agg_tx_stats.scd_query);
1006 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n",
1007 iwl_get_agg_tx_fail_reason(
1008 AGG_TX_STATE_TEST_BAD_CRC32_MSK),
1009 priv->_agn.reply_agg_tx_stats.bad_crc32);
1010 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1011 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_RESPONSE_MSK),
1012 priv->_agn.reply_agg_tx_stats.response);
1013 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1014 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_DUMP_TX_MSK),
1015 priv->_agn.reply_agg_tx_stats.dump_tx);
1016 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1017 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_DELAY_TX_MSK),
1018 priv->_agn.reply_agg_tx_stats.delay_tx);
1019 pos += scnprintf(buf + pos, bufsz - pos, "UNKNOWN:\t\t\t%u\n",
1020 priv->_agn.reply_agg_tx_stats.unknown);
1021
1022 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1023 kfree(buf);
1024 return ret;
1025}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h
deleted file mode 100644
index 9a3f329e508f..000000000000
--- a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h
+++ /dev/null
@@ -1,70 +0,0 @@
1/******************************************************************************
2 *
3 * GPL LICENSE SUMMARY
4 *
5 * Copyright(c) 2008 - 2011 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);
40ssize_t iwl_ucode_bt_stats_read(struct file *file, char __user *user_buf,
41 size_t count, loff_t *ppos);
42ssize_t iwl_reply_tx_error_read(struct file *file, char __user *user_buf,
43 size_t count, loff_t *ppos);
44#else
45static ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf,
46 size_t count, loff_t *ppos)
47{
48 return 0;
49}
50static ssize_t iwl_ucode_tx_stats_read(struct file *file, char __user *user_buf,
51 size_t count, loff_t *ppos)
52{
53 return 0;
54}
55static ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf,
56 size_t count, loff_t *ppos)
57{
58 return 0;
59}
60static ssize_t iwl_ucode_bt_stats_read(struct file *file, char __user *user_buf,
61 size_t count, loff_t *ppos)
62{
63 return 0;
64}
65static ssize_t iwl_reply_tx_error_read(struct file *file, char __user *user_buf,
66 size_t count, loff_t *ppos)
67{
68 return 0;
69}
70#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index ca6bd07f4765..dec9820753f8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -121,19 +121,6 @@ struct iwl_apm_ops {
121 void (*config)(struct iwl_priv *priv); 121 void (*config)(struct iwl_priv *priv);
122}; 122};
123 123
124struct iwl_debugfs_ops {
125 ssize_t (*rx_stats_read)(struct file *file, char __user *user_buf,
126 size_t count, loff_t *ppos);
127 ssize_t (*tx_stats_read)(struct file *file, char __user *user_buf,
128 size_t count, loff_t *ppos);
129 ssize_t (*general_stats_read)(struct file *file, char __user *user_buf,
130 size_t count, loff_t *ppos);
131 ssize_t (*bt_stats_read)(struct file *file, char __user *user_buf,
132 size_t count, loff_t *ppos);
133 ssize_t (*reply_tx_error)(struct file *file, char __user *user_buf,
134 size_t count, loff_t *ppos);
135};
136
137struct iwl_temp_ops { 124struct iwl_temp_ops {
138 void (*temperature)(struct iwl_priv *priv); 125 void (*temperature)(struct iwl_priv *priv);
139}; 126};
@@ -182,7 +169,6 @@ struct iwl_lib_ops {
182 int (*txfifo_flush)(struct iwl_priv *priv, u16 flush_control); 169 int (*txfifo_flush)(struct iwl_priv *priv, u16 flush_control);
183 void (*dev_txfifo_flush)(struct iwl_priv *priv, u16 flush_control); 170 void (*dev_txfifo_flush)(struct iwl_priv *priv, u16 flush_control);
184 171
185 struct iwl_debugfs_ops debugfs_ops;
186}; 172};
187 173
188/* NIC specific ops */ 174/* NIC specific ops */
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 7bd4f5af5b0d..0e6a04b739ad 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -39,6 +39,7 @@
39#include "iwl-debug.h" 39#include "iwl-debug.h"
40#include "iwl-core.h" 40#include "iwl-core.h"
41#include "iwl-io.h" 41#include "iwl-io.h"
42#include "iwl-agn.h"
42 43
43/* create and remove of files */ 44/* create and remove of files */
44#define DEBUGFS_ADD_FILE(name, parent, mode) do { \ 45#define DEBUGFS_ADD_FILE(name, parent, mode) do { \
@@ -1037,13 +1038,463 @@ static ssize_t iwl_dbgfs_rx_queue_read(struct file *file,
1037 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 1038 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1038} 1039}
1039 1040
1041static const char *fmt_value = " %-30s %10u\n";
1042static const char *fmt_hex = " %-30s 0x%02X\n";
1043static const char *fmt_table = " %-30s %10u %10u %10u %10u\n";
1044static const char *fmt_header =
1045 "%-32s current cumulative delta max\n";
1046
1047static int iwl_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
1048{
1049 int p = 0;
1050 u32 flag;
1051
1052 flag = le32_to_cpu(priv->statistics.flag);
1053
1054 p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", flag);
1055 if (flag & UCODE_STATISTICS_CLEAR_MSK)
1056 p += scnprintf(buf + p, bufsz - p,
1057 "\tStatistics have been cleared\n");
1058 p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n",
1059 (flag & UCODE_STATISTICS_FREQUENCY_MSK)
1060 ? "2.4 GHz" : "5.2 GHz");
1061 p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n",
1062 (flag & UCODE_STATISTICS_NARROW_BAND_MSK)
1063 ? "enabled" : "disabled");
1064
1065 return p;
1066}
1067
1040static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file, 1068static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file,
1041 char __user *user_buf, 1069 char __user *user_buf,
1042 size_t count, loff_t *ppos) 1070 size_t count, loff_t *ppos)
1043{ 1071{
1044 struct iwl_priv *priv = file->private_data; 1072 struct iwl_priv *priv = file->private_data;
1045 return priv->cfg->ops->lib->debugfs_ops.rx_stats_read(file, 1073 int pos = 0;
1046 user_buf, count, ppos); 1074 char *buf;
1075 int bufsz = sizeof(struct statistics_rx_phy) * 40 +
1076 sizeof(struct statistics_rx_non_phy) * 40 +
1077 sizeof(struct statistics_rx_ht_phy) * 40 + 400;
1078 ssize_t ret;
1079 struct statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm;
1080 struct statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
1081 struct statistics_rx_non_phy *general, *accum_general;
1082 struct statistics_rx_non_phy *delta_general, *max_general;
1083 struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;
1084
1085 if (!iwl_is_alive(priv))
1086 return -EAGAIN;
1087
1088 buf = kzalloc(bufsz, GFP_KERNEL);
1089 if (!buf) {
1090 IWL_ERR(priv, "Can not allocate Buffer\n");
1091 return -ENOMEM;
1092 }
1093
1094 /*
1095 * the statistic information display here is based on
1096 * the last statistics notification from uCode
1097 * might not reflect the current uCode activity
1098 */
1099 ofdm = &priv->statistics.rx_ofdm;
1100 cck = &priv->statistics.rx_cck;
1101 general = &priv->statistics.rx_non_phy;
1102 ht = &priv->statistics.rx_ofdm_ht;
1103 accum_ofdm = &priv->accum_stats.rx_ofdm;
1104 accum_cck = &priv->accum_stats.rx_cck;
1105 accum_general = &priv->accum_stats.rx_non_phy;
1106 accum_ht = &priv->accum_stats.rx_ofdm_ht;
1107 delta_ofdm = &priv->delta_stats.rx_ofdm;
1108 delta_cck = &priv->delta_stats.rx_cck;
1109 delta_general = &priv->delta_stats.rx_non_phy;
1110 delta_ht = &priv->delta_stats.rx_ofdm_ht;
1111 max_ofdm = &priv->max_delta_stats.rx_ofdm;
1112 max_cck = &priv->max_delta_stats.rx_cck;
1113 max_general = &priv->max_delta_stats.rx_non_phy;
1114 max_ht = &priv->max_delta_stats.rx_ofdm_ht;
1115
1116 pos += iwl_statistics_flag(priv, buf, bufsz);
1117 pos += scnprintf(buf + pos, bufsz - pos,
1118 fmt_header, "Statistics_Rx - OFDM:");
1119 pos += scnprintf(buf + pos, bufsz - pos,
1120 fmt_table, "ina_cnt:",
1121 le32_to_cpu(ofdm->ina_cnt),
1122 accum_ofdm->ina_cnt,
1123 delta_ofdm->ina_cnt, max_ofdm->ina_cnt);
1124 pos += scnprintf(buf + pos, bufsz - pos,
1125 fmt_table, "fina_cnt:",
1126 le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt,
1127 delta_ofdm->fina_cnt, max_ofdm->fina_cnt);
1128 pos += scnprintf(buf + pos, bufsz - pos,
1129 fmt_table, "plcp_err:",
1130 le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err,
1131 delta_ofdm->plcp_err, max_ofdm->plcp_err);
1132 pos += scnprintf(buf + pos, bufsz - pos,
1133 fmt_table, "crc32_err:",
1134 le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err,
1135 delta_ofdm->crc32_err, max_ofdm->crc32_err);
1136 pos += scnprintf(buf + pos, bufsz - pos,
1137 fmt_table, "overrun_err:",
1138 le32_to_cpu(ofdm->overrun_err),
1139 accum_ofdm->overrun_err, delta_ofdm->overrun_err,
1140 max_ofdm->overrun_err);
1141 pos += scnprintf(buf + pos, bufsz - pos,
1142 fmt_table, "early_overrun_err:",
1143 le32_to_cpu(ofdm->early_overrun_err),
1144 accum_ofdm->early_overrun_err,
1145 delta_ofdm->early_overrun_err,
1146 max_ofdm->early_overrun_err);
1147 pos += scnprintf(buf + pos, bufsz - pos,
1148 fmt_table, "crc32_good:",
1149 le32_to_cpu(ofdm->crc32_good),
1150 accum_ofdm->crc32_good, delta_ofdm->crc32_good,
1151 max_ofdm->crc32_good);
1152 pos += scnprintf(buf + pos, bufsz - pos,
1153 fmt_table, "false_alarm_cnt:",
1154 le32_to_cpu(ofdm->false_alarm_cnt),
1155 accum_ofdm->false_alarm_cnt,
1156 delta_ofdm->false_alarm_cnt,
1157 max_ofdm->false_alarm_cnt);
1158 pos += scnprintf(buf + pos, bufsz - pos,
1159 fmt_table, "fina_sync_err_cnt:",
1160 le32_to_cpu(ofdm->fina_sync_err_cnt),
1161 accum_ofdm->fina_sync_err_cnt,
1162 delta_ofdm->fina_sync_err_cnt,
1163 max_ofdm->fina_sync_err_cnt);
1164 pos += scnprintf(buf + pos, bufsz - pos,
1165 fmt_table, "sfd_timeout:",
1166 le32_to_cpu(ofdm->sfd_timeout),
1167 accum_ofdm->sfd_timeout, delta_ofdm->sfd_timeout,
1168 max_ofdm->sfd_timeout);
1169 pos += scnprintf(buf + pos, bufsz - pos,
1170 fmt_table, "fina_timeout:",
1171 le32_to_cpu(ofdm->fina_timeout),
1172 accum_ofdm->fina_timeout, delta_ofdm->fina_timeout,
1173 max_ofdm->fina_timeout);
1174 pos += scnprintf(buf + pos, bufsz - pos,
1175 fmt_table, "unresponded_rts:",
1176 le32_to_cpu(ofdm->unresponded_rts),
1177 accum_ofdm->unresponded_rts,
1178 delta_ofdm->unresponded_rts,
1179 max_ofdm->unresponded_rts);
1180 pos += scnprintf(buf + pos, bufsz - pos,
1181 fmt_table, "rxe_frame_lmt_ovrun:",
1182 le32_to_cpu(ofdm->rxe_frame_limit_overrun),
1183 accum_ofdm->rxe_frame_limit_overrun,
1184 delta_ofdm->rxe_frame_limit_overrun,
1185 max_ofdm->rxe_frame_limit_overrun);
1186 pos += scnprintf(buf + pos, bufsz - pos,
1187 fmt_table, "sent_ack_cnt:",
1188 le32_to_cpu(ofdm->sent_ack_cnt),
1189 accum_ofdm->sent_ack_cnt, delta_ofdm->sent_ack_cnt,
1190 max_ofdm->sent_ack_cnt);
1191 pos += scnprintf(buf + pos, bufsz - pos,
1192 fmt_table, "sent_cts_cnt:",
1193 le32_to_cpu(ofdm->sent_cts_cnt),
1194 accum_ofdm->sent_cts_cnt, delta_ofdm->sent_cts_cnt,
1195 max_ofdm->sent_cts_cnt);
1196 pos += scnprintf(buf + pos, bufsz - pos,
1197 fmt_table, "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,
1203 fmt_table, "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,
1209 fmt_table, "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,
1215 fmt_table, "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,
1222 fmt_header, "Statistics_Rx - CCK:");
1223 pos += scnprintf(buf + pos, bufsz - pos,
1224 fmt_table, "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,
1228 fmt_table, "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,
1232 fmt_table, "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,
1236 fmt_table, "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,
1240 fmt_table, "overrun_err:",
1241 le32_to_cpu(cck->overrun_err),
1242 accum_cck->overrun_err, delta_cck->overrun_err,
1243 max_cck->overrun_err);
1244 pos += scnprintf(buf + pos, bufsz - pos,
1245 fmt_table, "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,
1251 fmt_table, "crc32_good:",
1252 le32_to_cpu(cck->crc32_good), accum_cck->crc32_good,
1253 delta_cck->crc32_good, max_cck->crc32_good);
1254 pos += scnprintf(buf + pos, bufsz - pos,
1255 fmt_table, "false_alarm_cnt:",
1256 le32_to_cpu(cck->false_alarm_cnt),
1257 accum_cck->false_alarm_cnt,
1258 delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt);
1259 pos += scnprintf(buf + pos, bufsz - pos,
1260 fmt_table, "fina_sync_err_cnt:",
1261 le32_to_cpu(cck->fina_sync_err_cnt),
1262 accum_cck->fina_sync_err_cnt,
1263 delta_cck->fina_sync_err_cnt,
1264 max_cck->fina_sync_err_cnt);
1265 pos += scnprintf(buf + pos, bufsz - pos,
1266 fmt_table, "sfd_timeout:",
1267 le32_to_cpu(cck->sfd_timeout),
1268 accum_cck->sfd_timeout, delta_cck->sfd_timeout,
1269 max_cck->sfd_timeout);
1270 pos += scnprintf(buf + pos, bufsz - pos,
1271 fmt_table, "fina_timeout:",
1272 le32_to_cpu(cck->fina_timeout),
1273 accum_cck->fina_timeout, delta_cck->fina_timeout,
1274 max_cck->fina_timeout);
1275 pos += scnprintf(buf + pos, bufsz - pos,
1276 fmt_table, "unresponded_rts:",
1277 le32_to_cpu(cck->unresponded_rts),
1278 accum_cck->unresponded_rts, delta_cck->unresponded_rts,
1279 max_cck->unresponded_rts);
1280 pos += scnprintf(buf + pos, bufsz - pos,
1281 fmt_table, "rxe_frame_lmt_ovrun:",
1282 le32_to_cpu(cck->rxe_frame_limit_overrun),
1283 accum_cck->rxe_frame_limit_overrun,
1284 delta_cck->rxe_frame_limit_overrun,
1285 max_cck->rxe_frame_limit_overrun);
1286 pos += scnprintf(buf + pos, bufsz - pos,
1287 fmt_table, "sent_ack_cnt:",
1288 le32_to_cpu(cck->sent_ack_cnt),
1289 accum_cck->sent_ack_cnt, delta_cck->sent_ack_cnt,
1290 max_cck->sent_ack_cnt);
1291 pos += scnprintf(buf + pos, bufsz - pos,
1292 fmt_table, "sent_cts_cnt:",
1293 le32_to_cpu(cck->sent_cts_cnt),
1294 accum_cck->sent_cts_cnt, delta_cck->sent_cts_cnt,
1295 max_cck->sent_cts_cnt);
1296 pos += scnprintf(buf + pos, bufsz - pos,
1297 fmt_table, "sent_ba_rsp_cnt:",
1298 le32_to_cpu(cck->sent_ba_rsp_cnt),
1299 accum_cck->sent_ba_rsp_cnt,
1300 delta_cck->sent_ba_rsp_cnt,
1301 max_cck->sent_ba_rsp_cnt);
1302 pos += scnprintf(buf + pos, bufsz - pos,
1303 fmt_table, "dsp_self_kill:",
1304 le32_to_cpu(cck->dsp_self_kill),
1305 accum_cck->dsp_self_kill, delta_cck->dsp_self_kill,
1306 max_cck->dsp_self_kill);
1307 pos += scnprintf(buf + pos, bufsz - pos,
1308 fmt_table, "mh_format_err:",
1309 le32_to_cpu(cck->mh_format_err),
1310 accum_cck->mh_format_err, delta_cck->mh_format_err,
1311 max_cck->mh_format_err);
1312 pos += scnprintf(buf + pos, bufsz - pos,
1313 fmt_table, "re_acq_main_rssi_sum:",
1314 le32_to_cpu(cck->re_acq_main_rssi_sum),
1315 accum_cck->re_acq_main_rssi_sum,
1316 delta_cck->re_acq_main_rssi_sum,
1317 max_cck->re_acq_main_rssi_sum);
1318
1319 pos += scnprintf(buf + pos, bufsz - pos,
1320 fmt_header, "Statistics_Rx - GENERAL:");
1321 pos += scnprintf(buf + pos, bufsz - pos,
1322 fmt_table, "bogus_cts:",
1323 le32_to_cpu(general->bogus_cts),
1324 accum_general->bogus_cts, delta_general->bogus_cts,
1325 max_general->bogus_cts);
1326 pos += scnprintf(buf + pos, bufsz - pos,
1327 fmt_table, "bogus_ack:",
1328 le32_to_cpu(general->bogus_ack),
1329 accum_general->bogus_ack, delta_general->bogus_ack,
1330 max_general->bogus_ack);
1331 pos += scnprintf(buf + pos, bufsz - pos,
1332 fmt_table, "non_bssid_frames:",
1333 le32_to_cpu(general->non_bssid_frames),
1334 accum_general->non_bssid_frames,
1335 delta_general->non_bssid_frames,
1336 max_general->non_bssid_frames);
1337 pos += scnprintf(buf + pos, bufsz - pos,
1338 fmt_table, "filtered_frames:",
1339 le32_to_cpu(general->filtered_frames),
1340 accum_general->filtered_frames,
1341 delta_general->filtered_frames,
1342 max_general->filtered_frames);
1343 pos += scnprintf(buf + pos, bufsz - pos,
1344 fmt_table, "non_channel_beacons:",
1345 le32_to_cpu(general->non_channel_beacons),
1346 accum_general->non_channel_beacons,
1347 delta_general->non_channel_beacons,
1348 max_general->non_channel_beacons);
1349 pos += scnprintf(buf + pos, bufsz - pos,
1350 fmt_table, "channel_beacons:",
1351 le32_to_cpu(general->channel_beacons),
1352 accum_general->channel_beacons,
1353 delta_general->channel_beacons,
1354 max_general->channel_beacons);
1355 pos += scnprintf(buf + pos, bufsz - pos,
1356 fmt_table, "num_missed_bcon:",
1357 le32_to_cpu(general->num_missed_bcon),
1358 accum_general->num_missed_bcon,
1359 delta_general->num_missed_bcon,
1360 max_general->num_missed_bcon);
1361 pos += scnprintf(buf + pos, bufsz - pos,
1362 fmt_table, "adc_rx_saturation_time:",
1363 le32_to_cpu(general->adc_rx_saturation_time),
1364 accum_general->adc_rx_saturation_time,
1365 delta_general->adc_rx_saturation_time,
1366 max_general->adc_rx_saturation_time);
1367 pos += scnprintf(buf + pos, bufsz - pos,
1368 fmt_table, "ina_detect_search_tm:",
1369 le32_to_cpu(general->ina_detection_search_time),
1370 accum_general->ina_detection_search_time,
1371 delta_general->ina_detection_search_time,
1372 max_general->ina_detection_search_time);
1373 pos += scnprintf(buf + pos, bufsz - pos,
1374 fmt_table, "beacon_silence_rssi_a:",
1375 le32_to_cpu(general->beacon_silence_rssi_a),
1376 accum_general->beacon_silence_rssi_a,
1377 delta_general->beacon_silence_rssi_a,
1378 max_general->beacon_silence_rssi_a);
1379 pos += scnprintf(buf + pos, bufsz - pos,
1380 fmt_table, "beacon_silence_rssi_b:",
1381 le32_to_cpu(general->beacon_silence_rssi_b),
1382 accum_general->beacon_silence_rssi_b,
1383 delta_general->beacon_silence_rssi_b,
1384 max_general->beacon_silence_rssi_b);
1385 pos += scnprintf(buf + pos, bufsz - pos,
1386 fmt_table, "beacon_silence_rssi_c:",
1387 le32_to_cpu(general->beacon_silence_rssi_c),
1388 accum_general->beacon_silence_rssi_c,
1389 delta_general->beacon_silence_rssi_c,
1390 max_general->beacon_silence_rssi_c);
1391 pos += scnprintf(buf + pos, bufsz - pos,
1392 fmt_table, "interference_data_flag:",
1393 le32_to_cpu(general->interference_data_flag),
1394 accum_general->interference_data_flag,
1395 delta_general->interference_data_flag,
1396 max_general->interference_data_flag);
1397 pos += scnprintf(buf + pos, bufsz - pos,
1398 fmt_table, "channel_load:",
1399 le32_to_cpu(general->channel_load),
1400 accum_general->channel_load,
1401 delta_general->channel_load,
1402 max_general->channel_load);
1403 pos += scnprintf(buf + pos, bufsz - pos,
1404 fmt_table, "dsp_false_alarms:",
1405 le32_to_cpu(general->dsp_false_alarms),
1406 accum_general->dsp_false_alarms,
1407 delta_general->dsp_false_alarms,
1408 max_general->dsp_false_alarms);
1409 pos += scnprintf(buf + pos, bufsz - pos,
1410 fmt_table, "beacon_rssi_a:",
1411 le32_to_cpu(general->beacon_rssi_a),
1412 accum_general->beacon_rssi_a,
1413 delta_general->beacon_rssi_a,
1414 max_general->beacon_rssi_a);
1415 pos += scnprintf(buf + pos, bufsz - pos,
1416 fmt_table, "beacon_rssi_b:",
1417 le32_to_cpu(general->beacon_rssi_b),
1418 accum_general->beacon_rssi_b,
1419 delta_general->beacon_rssi_b,
1420 max_general->beacon_rssi_b);
1421 pos += scnprintf(buf + pos, bufsz - pos,
1422 fmt_table, "beacon_rssi_c:",
1423 le32_to_cpu(general->beacon_rssi_c),
1424 accum_general->beacon_rssi_c,
1425 delta_general->beacon_rssi_c,
1426 max_general->beacon_rssi_c);
1427 pos += scnprintf(buf + pos, bufsz - pos,
1428 fmt_table, "beacon_energy_a:",
1429 le32_to_cpu(general->beacon_energy_a),
1430 accum_general->beacon_energy_a,
1431 delta_general->beacon_energy_a,
1432 max_general->beacon_energy_a);
1433 pos += scnprintf(buf + pos, bufsz - pos,
1434 fmt_table, "beacon_energy_b:",
1435 le32_to_cpu(general->beacon_energy_b),
1436 accum_general->beacon_energy_b,
1437 delta_general->beacon_energy_b,
1438 max_general->beacon_energy_b);
1439 pos += scnprintf(buf + pos, bufsz - pos,
1440 fmt_table, "beacon_energy_c:",
1441 le32_to_cpu(general->beacon_energy_c),
1442 accum_general->beacon_energy_c,
1443 delta_general->beacon_energy_c,
1444 max_general->beacon_energy_c);
1445
1446 pos += scnprintf(buf + pos, bufsz - pos,
1447 fmt_header, "Statistics_Rx - OFDM_HT:");
1448 pos += scnprintf(buf + pos, bufsz - pos,
1449 fmt_table, "plcp_err:",
1450 le32_to_cpu(ht->plcp_err), accum_ht->plcp_err,
1451 delta_ht->plcp_err, max_ht->plcp_err);
1452 pos += scnprintf(buf + pos, bufsz - pos,
1453 fmt_table, "overrun_err:",
1454 le32_to_cpu(ht->overrun_err), accum_ht->overrun_err,
1455 delta_ht->overrun_err, max_ht->overrun_err);
1456 pos += scnprintf(buf + pos, bufsz - pos,
1457 fmt_table, "early_overrun_err:",
1458 le32_to_cpu(ht->early_overrun_err),
1459 accum_ht->early_overrun_err,
1460 delta_ht->early_overrun_err,
1461 max_ht->early_overrun_err);
1462 pos += scnprintf(buf + pos, bufsz - pos,
1463 fmt_table, "crc32_good:",
1464 le32_to_cpu(ht->crc32_good), accum_ht->crc32_good,
1465 delta_ht->crc32_good, max_ht->crc32_good);
1466 pos += scnprintf(buf + pos, bufsz - pos,
1467 fmt_table, "crc32_err:",
1468 le32_to_cpu(ht->crc32_err), accum_ht->crc32_err,
1469 delta_ht->crc32_err, max_ht->crc32_err);
1470 pos += scnprintf(buf + pos, bufsz - pos,
1471 fmt_table, "mh_format_err:",
1472 le32_to_cpu(ht->mh_format_err),
1473 accum_ht->mh_format_err,
1474 delta_ht->mh_format_err, max_ht->mh_format_err);
1475 pos += scnprintf(buf + pos, bufsz - pos,
1476 fmt_table, "agg_crc32_good:",
1477 le32_to_cpu(ht->agg_crc32_good),
1478 accum_ht->agg_crc32_good,
1479 delta_ht->agg_crc32_good, max_ht->agg_crc32_good);
1480 pos += scnprintf(buf + pos, bufsz - pos,
1481 fmt_table, "agg_mpdu_cnt:",
1482 le32_to_cpu(ht->agg_mpdu_cnt),
1483 accum_ht->agg_mpdu_cnt,
1484 delta_ht->agg_mpdu_cnt, max_ht->agg_mpdu_cnt);
1485 pos += scnprintf(buf + pos, bufsz - pos,
1486 fmt_table, "agg_cnt:",
1487 le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt,
1488 delta_ht->agg_cnt, max_ht->agg_cnt);
1489 pos += scnprintf(buf + pos, bufsz - pos,
1490 fmt_table, "unsupport_mcs:",
1491 le32_to_cpu(ht->unsupport_mcs),
1492 accum_ht->unsupport_mcs,
1493 delta_ht->unsupport_mcs, max_ht->unsupport_mcs);
1494
1495 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1496 kfree(buf);
1497 return ret;
1047} 1498}
1048 1499
1049static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file, 1500static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
@@ -1051,8 +1502,190 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
1051 size_t count, loff_t *ppos) 1502 size_t count, loff_t *ppos)
1052{ 1503{
1053 struct iwl_priv *priv = file->private_data; 1504 struct iwl_priv *priv = file->private_data;
1054 return priv->cfg->ops->lib->debugfs_ops.tx_stats_read(file, 1505 int pos = 0;
1055 user_buf, count, ppos); 1506 char *buf;
1507 int bufsz = (sizeof(struct statistics_tx) * 48) + 250;
1508 ssize_t ret;
1509 struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
1510
1511 if (!iwl_is_alive(priv))
1512 return -EAGAIN;
1513
1514 buf = kzalloc(bufsz, GFP_KERNEL);
1515 if (!buf) {
1516 IWL_ERR(priv, "Can not allocate Buffer\n");
1517 return -ENOMEM;
1518 }
1519
1520 /* the statistic information display here is based on
1521 * the last statistics notification from uCode
1522 * might not reflect the current uCode activity
1523 */
1524 tx = &priv->statistics.tx;
1525 accum_tx = &priv->accum_stats.tx;
1526 delta_tx = &priv->delta_stats.tx;
1527 max_tx = &priv->max_delta_stats.tx;
1528
1529 pos += iwl_statistics_flag(priv, buf, bufsz);
1530 pos += scnprintf(buf + pos, bufsz - pos,
1531 fmt_header, "Statistics_Tx:");
1532 pos += scnprintf(buf + pos, bufsz - pos,
1533 fmt_table, "preamble:",
1534 le32_to_cpu(tx->preamble_cnt),
1535 accum_tx->preamble_cnt,
1536 delta_tx->preamble_cnt, max_tx->preamble_cnt);
1537 pos += scnprintf(buf + pos, bufsz - pos,
1538 fmt_table, "rx_detected_cnt:",
1539 le32_to_cpu(tx->rx_detected_cnt),
1540 accum_tx->rx_detected_cnt,
1541 delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt);
1542 pos += scnprintf(buf + pos, bufsz - pos,
1543 fmt_table, "bt_prio_defer_cnt:",
1544 le32_to_cpu(tx->bt_prio_defer_cnt),
1545 accum_tx->bt_prio_defer_cnt,
1546 delta_tx->bt_prio_defer_cnt,
1547 max_tx->bt_prio_defer_cnt);
1548 pos += scnprintf(buf + pos, bufsz - pos,
1549 fmt_table, "bt_prio_kill_cnt:",
1550 le32_to_cpu(tx->bt_prio_kill_cnt),
1551 accum_tx->bt_prio_kill_cnt,
1552 delta_tx->bt_prio_kill_cnt,
1553 max_tx->bt_prio_kill_cnt);
1554 pos += scnprintf(buf + pos, bufsz - pos,
1555 fmt_table, "few_bytes_cnt:",
1556 le32_to_cpu(tx->few_bytes_cnt),
1557 accum_tx->few_bytes_cnt,
1558 delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt);
1559 pos += scnprintf(buf + pos, bufsz - pos,
1560 fmt_table, "cts_timeout:",
1561 le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout,
1562 delta_tx->cts_timeout, max_tx->cts_timeout);
1563 pos += scnprintf(buf + pos, bufsz - pos,
1564 fmt_table, "ack_timeout:",
1565 le32_to_cpu(tx->ack_timeout),
1566 accum_tx->ack_timeout,
1567 delta_tx->ack_timeout, max_tx->ack_timeout);
1568 pos += scnprintf(buf + pos, bufsz - pos,
1569 fmt_table, "expected_ack_cnt:",
1570 le32_to_cpu(tx->expected_ack_cnt),
1571 accum_tx->expected_ack_cnt,
1572 delta_tx->expected_ack_cnt,
1573 max_tx->expected_ack_cnt);
1574 pos += scnprintf(buf + pos, bufsz - pos,
1575 fmt_table, "actual_ack_cnt:",
1576 le32_to_cpu(tx->actual_ack_cnt),
1577 accum_tx->actual_ack_cnt,
1578 delta_tx->actual_ack_cnt,
1579 max_tx->actual_ack_cnt);
1580 pos += scnprintf(buf + pos, bufsz - pos,
1581 fmt_table, "dump_msdu_cnt:",
1582 le32_to_cpu(tx->dump_msdu_cnt),
1583 accum_tx->dump_msdu_cnt,
1584 delta_tx->dump_msdu_cnt,
1585 max_tx->dump_msdu_cnt);
1586 pos += scnprintf(buf + pos, bufsz - pos,
1587 fmt_table, "abort_nxt_frame_mismatch:",
1588 le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt),
1589 accum_tx->burst_abort_next_frame_mismatch_cnt,
1590 delta_tx->burst_abort_next_frame_mismatch_cnt,
1591 max_tx->burst_abort_next_frame_mismatch_cnt);
1592 pos += scnprintf(buf + pos, bufsz - pos,
1593 fmt_table, "abort_missing_nxt_frame:",
1594 le32_to_cpu(tx->burst_abort_missing_next_frame_cnt),
1595 accum_tx->burst_abort_missing_next_frame_cnt,
1596 delta_tx->burst_abort_missing_next_frame_cnt,
1597 max_tx->burst_abort_missing_next_frame_cnt);
1598 pos += scnprintf(buf + pos, bufsz - pos,
1599 fmt_table, "cts_timeout_collision:",
1600 le32_to_cpu(tx->cts_timeout_collision),
1601 accum_tx->cts_timeout_collision,
1602 delta_tx->cts_timeout_collision,
1603 max_tx->cts_timeout_collision);
1604 pos += scnprintf(buf + pos, bufsz - pos,
1605 fmt_table, "ack_ba_timeout_collision:",
1606 le32_to_cpu(tx->ack_or_ba_timeout_collision),
1607 accum_tx->ack_or_ba_timeout_collision,
1608 delta_tx->ack_or_ba_timeout_collision,
1609 max_tx->ack_or_ba_timeout_collision);
1610 pos += scnprintf(buf + pos, bufsz - pos,
1611 fmt_table, "agg ba_timeout:",
1612 le32_to_cpu(tx->agg.ba_timeout),
1613 accum_tx->agg.ba_timeout,
1614 delta_tx->agg.ba_timeout,
1615 max_tx->agg.ba_timeout);
1616 pos += scnprintf(buf + pos, bufsz - pos,
1617 fmt_table, "agg ba_resched_frames:",
1618 le32_to_cpu(tx->agg.ba_reschedule_frames),
1619 accum_tx->agg.ba_reschedule_frames,
1620 delta_tx->agg.ba_reschedule_frames,
1621 max_tx->agg.ba_reschedule_frames);
1622 pos += scnprintf(buf + pos, bufsz - pos,
1623 fmt_table, "agg scd_query_agg_frame:",
1624 le32_to_cpu(tx->agg.scd_query_agg_frame_cnt),
1625 accum_tx->agg.scd_query_agg_frame_cnt,
1626 delta_tx->agg.scd_query_agg_frame_cnt,
1627 max_tx->agg.scd_query_agg_frame_cnt);
1628 pos += scnprintf(buf + pos, bufsz - pos,
1629 fmt_table, "agg scd_query_no_agg:",
1630 le32_to_cpu(tx->agg.scd_query_no_agg),
1631 accum_tx->agg.scd_query_no_agg,
1632 delta_tx->agg.scd_query_no_agg,
1633 max_tx->agg.scd_query_no_agg);
1634 pos += scnprintf(buf + pos, bufsz - pos,
1635 fmt_table, "agg scd_query_agg:",
1636 le32_to_cpu(tx->agg.scd_query_agg),
1637 accum_tx->agg.scd_query_agg,
1638 delta_tx->agg.scd_query_agg,
1639 max_tx->agg.scd_query_agg);
1640 pos += scnprintf(buf + pos, bufsz - pos,
1641 fmt_table, "agg scd_query_mismatch:",
1642 le32_to_cpu(tx->agg.scd_query_mismatch),
1643 accum_tx->agg.scd_query_mismatch,
1644 delta_tx->agg.scd_query_mismatch,
1645 max_tx->agg.scd_query_mismatch);
1646 pos += scnprintf(buf + pos, bufsz - pos,
1647 fmt_table, "agg frame_not_ready:",
1648 le32_to_cpu(tx->agg.frame_not_ready),
1649 accum_tx->agg.frame_not_ready,
1650 delta_tx->agg.frame_not_ready,
1651 max_tx->agg.frame_not_ready);
1652 pos += scnprintf(buf + pos, bufsz - pos,
1653 fmt_table, "agg underrun:",
1654 le32_to_cpu(tx->agg.underrun),
1655 accum_tx->agg.underrun,
1656 delta_tx->agg.underrun, max_tx->agg.underrun);
1657 pos += scnprintf(buf + pos, bufsz - pos,
1658 fmt_table, "agg bt_prio_kill:",
1659 le32_to_cpu(tx->agg.bt_prio_kill),
1660 accum_tx->agg.bt_prio_kill,
1661 delta_tx->agg.bt_prio_kill,
1662 max_tx->agg.bt_prio_kill);
1663 pos += scnprintf(buf + pos, bufsz - pos,
1664 fmt_table, "agg rx_ba_rsp_cnt:",
1665 le32_to_cpu(tx->agg.rx_ba_rsp_cnt),
1666 accum_tx->agg.rx_ba_rsp_cnt,
1667 delta_tx->agg.rx_ba_rsp_cnt,
1668 max_tx->agg.rx_ba_rsp_cnt);
1669
1670 if (tx->tx_power.ant_a || tx->tx_power.ant_b || tx->tx_power.ant_c) {
1671 pos += scnprintf(buf + pos, bufsz - pos,
1672 "tx power: (1/2 dB step)\n");
1673 if ((priv->cfg->valid_tx_ant & ANT_A) && tx->tx_power.ant_a)
1674 pos += scnprintf(buf + pos, bufsz - pos,
1675 fmt_hex, "antenna A:",
1676 tx->tx_power.ant_a);
1677 if ((priv->cfg->valid_tx_ant & ANT_B) && tx->tx_power.ant_b)
1678 pos += scnprintf(buf + pos, bufsz - pos,
1679 fmt_hex, "antenna B:",
1680 tx->tx_power.ant_b);
1681 if ((priv->cfg->valid_tx_ant & ANT_C) && tx->tx_power.ant_c)
1682 pos += scnprintf(buf + pos, bufsz - pos,
1683 fmt_hex, "antenna C:",
1684 tx->tx_power.ant_c);
1685 }
1686 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1687 kfree(buf);
1688 return ret;
1056} 1689}
1057 1690
1058static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file, 1691static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
@@ -1060,8 +1693,347 @@ static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
1060 size_t count, loff_t *ppos) 1693 size_t count, loff_t *ppos)
1061{ 1694{
1062 struct iwl_priv *priv = file->private_data; 1695 struct iwl_priv *priv = file->private_data;
1063 return priv->cfg->ops->lib->debugfs_ops.general_stats_read(file, 1696 int pos = 0;
1064 user_buf, count, ppos); 1697 char *buf;
1698 int bufsz = sizeof(struct statistics_general) * 10 + 300;
1699 ssize_t ret;
1700 struct statistics_general_common *general, *accum_general;
1701 struct statistics_general_common *delta_general, *max_general;
1702 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
1703 struct statistics_div *div, *accum_div, *delta_div, *max_div;
1704
1705 if (!iwl_is_alive(priv))
1706 return -EAGAIN;
1707
1708 buf = kzalloc(bufsz, GFP_KERNEL);
1709 if (!buf) {
1710 IWL_ERR(priv, "Can not allocate Buffer\n");
1711 return -ENOMEM;
1712 }
1713
1714 /* the statistic information display here is based on
1715 * the last statistics notification from uCode
1716 * might not reflect the current uCode activity
1717 */
1718 general = &priv->statistics.common;
1719 dbg = &priv->statistics.common.dbg;
1720 div = &priv->statistics.common.div;
1721 accum_general = &priv->accum_stats.common;
1722 accum_dbg = &priv->accum_stats.common.dbg;
1723 accum_div = &priv->accum_stats.common.div;
1724 delta_general = &priv->delta_stats.common;
1725 max_general = &priv->max_delta_stats.common;
1726 delta_dbg = &priv->delta_stats.common.dbg;
1727 max_dbg = &priv->max_delta_stats.common.dbg;
1728 delta_div = &priv->delta_stats.common.div;
1729 max_div = &priv->max_delta_stats.common.div;
1730
1731 pos += iwl_statistics_flag(priv, buf, bufsz);
1732 pos += scnprintf(buf + pos, bufsz - pos,
1733 fmt_header, "Statistics_General:");
1734 pos += scnprintf(buf + pos, bufsz - pos,
1735 fmt_value, "temperature:",
1736 le32_to_cpu(general->temperature));
1737 pos += scnprintf(buf + pos, bufsz - pos,
1738 fmt_value, "temperature_m:",
1739 le32_to_cpu(general->temperature_m));
1740 pos += scnprintf(buf + pos, bufsz - pos,
1741 fmt_value, "ttl_timestamp:",
1742 le32_to_cpu(general->ttl_timestamp));
1743 pos += scnprintf(buf + pos, bufsz - pos,
1744 fmt_table, "burst_check:",
1745 le32_to_cpu(dbg->burst_check),
1746 accum_dbg->burst_check,
1747 delta_dbg->burst_check, max_dbg->burst_check);
1748 pos += scnprintf(buf + pos, bufsz - pos,
1749 fmt_table, "burst_count:",
1750 le32_to_cpu(dbg->burst_count),
1751 accum_dbg->burst_count,
1752 delta_dbg->burst_count, max_dbg->burst_count);
1753 pos += scnprintf(buf + pos, bufsz - pos,
1754 fmt_table, "wait_for_silence_timeout_count:",
1755 le32_to_cpu(dbg->wait_for_silence_timeout_cnt),
1756 accum_dbg->wait_for_silence_timeout_cnt,
1757 delta_dbg->wait_for_silence_timeout_cnt,
1758 max_dbg->wait_for_silence_timeout_cnt);
1759 pos += scnprintf(buf + pos, bufsz - pos,
1760 fmt_table, "sleep_time:",
1761 le32_to_cpu(general->sleep_time),
1762 accum_general->sleep_time,
1763 delta_general->sleep_time, max_general->sleep_time);
1764 pos += scnprintf(buf + pos, bufsz - pos,
1765 fmt_table, "slots_out:",
1766 le32_to_cpu(general->slots_out),
1767 accum_general->slots_out,
1768 delta_general->slots_out, max_general->slots_out);
1769 pos += scnprintf(buf + pos, bufsz - pos,
1770 fmt_table, "slots_idle:",
1771 le32_to_cpu(general->slots_idle),
1772 accum_general->slots_idle,
1773 delta_general->slots_idle, max_general->slots_idle);
1774 pos += scnprintf(buf + pos, bufsz - pos,
1775 fmt_table, "tx_on_a:",
1776 le32_to_cpu(div->tx_on_a), accum_div->tx_on_a,
1777 delta_div->tx_on_a, max_div->tx_on_a);
1778 pos += scnprintf(buf + pos, bufsz - pos,
1779 fmt_table, "tx_on_b:",
1780 le32_to_cpu(div->tx_on_b), accum_div->tx_on_b,
1781 delta_div->tx_on_b, max_div->tx_on_b);
1782 pos += scnprintf(buf + pos, bufsz - pos,
1783 fmt_table, "exec_time:",
1784 le32_to_cpu(div->exec_time), accum_div->exec_time,
1785 delta_div->exec_time, max_div->exec_time);
1786 pos += scnprintf(buf + pos, bufsz - pos,
1787 fmt_table, "probe_time:",
1788 le32_to_cpu(div->probe_time), accum_div->probe_time,
1789 delta_div->probe_time, max_div->probe_time);
1790 pos += scnprintf(buf + pos, bufsz - pos,
1791 fmt_table, "rx_enable_counter:",
1792 le32_to_cpu(general->rx_enable_counter),
1793 accum_general->rx_enable_counter,
1794 delta_general->rx_enable_counter,
1795 max_general->rx_enable_counter);
1796 pos += scnprintf(buf + pos, bufsz - pos,
1797 fmt_table, "num_of_sos_states:",
1798 le32_to_cpu(general->num_of_sos_states),
1799 accum_general->num_of_sos_states,
1800 delta_general->num_of_sos_states,
1801 max_general->num_of_sos_states);
1802 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1803 kfree(buf);
1804 return ret;
1805}
1806
1807static ssize_t iwl_dbgfs_ucode_bt_stats_read(struct file *file,
1808 char __user *user_buf,
1809 size_t count, loff_t *ppos)
1810{
1811 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
1812 int pos = 0;
1813 char *buf;
1814 int bufsz = (sizeof(struct statistics_bt_activity) * 24) + 200;
1815 ssize_t ret;
1816 struct statistics_bt_activity *bt, *accum_bt;
1817
1818 if (!iwl_is_alive(priv))
1819 return -EAGAIN;
1820
1821 if (!priv->bt_enable_flag)
1822 return -EINVAL;
1823
1824 /* make request to uCode to retrieve statistics information */
1825 mutex_lock(&priv->mutex);
1826 ret = iwl_send_statistics_request(priv, CMD_SYNC, false);
1827 mutex_unlock(&priv->mutex);
1828
1829 if (ret) {
1830 IWL_ERR(priv,
1831 "Error sending statistics request: %zd\n", ret);
1832 return -EAGAIN;
1833 }
1834 buf = kzalloc(bufsz, GFP_KERNEL);
1835 if (!buf) {
1836 IWL_ERR(priv, "Can not allocate Buffer\n");
1837 return -ENOMEM;
1838 }
1839
1840 /*
1841 * the statistic information display here is based on
1842 * the last statistics notification from uCode
1843 * might not reflect the current uCode activity
1844 */
1845 bt = &priv->statistics.bt_activity;
1846 accum_bt = &priv->accum_stats.bt_activity;
1847
1848 pos += iwl_statistics_flag(priv, buf, bufsz);
1849 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_BT:\n");
1850 pos += scnprintf(buf + pos, bufsz - pos,
1851 "\t\t\tcurrent\t\t\taccumulative\n");
1852 pos += scnprintf(buf + pos, bufsz - pos,
1853 "hi_priority_tx_req_cnt:\t\t%u\t\t\t%u\n",
1854 le32_to_cpu(bt->hi_priority_tx_req_cnt),
1855 accum_bt->hi_priority_tx_req_cnt);
1856 pos += scnprintf(buf + pos, bufsz - pos,
1857 "hi_priority_tx_denied_cnt:\t%u\t\t\t%u\n",
1858 le32_to_cpu(bt->hi_priority_tx_denied_cnt),
1859 accum_bt->hi_priority_tx_denied_cnt);
1860 pos += scnprintf(buf + pos, bufsz - pos,
1861 "lo_priority_tx_req_cnt:\t\t%u\t\t\t%u\n",
1862 le32_to_cpu(bt->lo_priority_tx_req_cnt),
1863 accum_bt->lo_priority_tx_req_cnt);
1864 pos += scnprintf(buf + pos, bufsz - pos,
1865 "lo_priority_tx_denied_cnt:\t%u\t\t\t%u\n",
1866 le32_to_cpu(bt->lo_priority_tx_denied_cnt),
1867 accum_bt->lo_priority_tx_denied_cnt);
1868 pos += scnprintf(buf + pos, bufsz - pos,
1869 "hi_priority_rx_req_cnt:\t\t%u\t\t\t%u\n",
1870 le32_to_cpu(bt->hi_priority_rx_req_cnt),
1871 accum_bt->hi_priority_rx_req_cnt);
1872 pos += scnprintf(buf + pos, bufsz - pos,
1873 "hi_priority_rx_denied_cnt:\t%u\t\t\t%u\n",
1874 le32_to_cpu(bt->hi_priority_rx_denied_cnt),
1875 accum_bt->hi_priority_rx_denied_cnt);
1876 pos += scnprintf(buf + pos, bufsz - pos,
1877 "lo_priority_rx_req_cnt:\t\t%u\t\t\t%u\n",
1878 le32_to_cpu(bt->lo_priority_rx_req_cnt),
1879 accum_bt->lo_priority_rx_req_cnt);
1880 pos += scnprintf(buf + pos, bufsz - pos,
1881 "lo_priority_rx_denied_cnt:\t%u\t\t\t%u\n",
1882 le32_to_cpu(bt->lo_priority_rx_denied_cnt),
1883 accum_bt->lo_priority_rx_denied_cnt);
1884
1885 pos += scnprintf(buf + pos, bufsz - pos,
1886 "(rx)num_bt_kills:\t\t%u\t\t\t%u\n",
1887 le32_to_cpu(priv->statistics.num_bt_kills),
1888 priv->statistics.accum_num_bt_kills);
1889
1890 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1891 kfree(buf);
1892 return ret;
1893}
1894
1895static ssize_t iwl_dbgfs_reply_tx_error_read(struct file *file,
1896 char __user *user_buf,
1897 size_t count, loff_t *ppos)
1898{
1899 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
1900 int pos = 0;
1901 char *buf;
1902 int bufsz = (sizeof(struct reply_tx_error_statistics) * 24) +
1903 (sizeof(struct reply_agg_tx_error_statistics) * 24) + 200;
1904 ssize_t ret;
1905
1906 if (!iwl_is_alive(priv))
1907 return -EAGAIN;
1908
1909 buf = kzalloc(bufsz, GFP_KERNEL);
1910 if (!buf) {
1911 IWL_ERR(priv, "Can not allocate Buffer\n");
1912 return -ENOMEM;
1913 }
1914
1915 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_TX_Error:\n");
1916 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t\t%u\n",
1917 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_DELAY),
1918 priv->_agn.reply_tx_stats.pp_delay);
1919 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1920 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_FEW_BYTES),
1921 priv->_agn.reply_tx_stats.pp_few_bytes);
1922 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1923 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_BT_PRIO),
1924 priv->_agn.reply_tx_stats.pp_bt_prio);
1925 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1926 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_QUIET_PERIOD),
1927 priv->_agn.reply_tx_stats.pp_quiet_period);
1928 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1929 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_CALC_TTAK),
1930 priv->_agn.reply_tx_stats.pp_calc_ttak);
1931 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n",
1932 iwl_get_tx_fail_reason(
1933 TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY),
1934 priv->_agn.reply_tx_stats.int_crossed_retry);
1935 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1936 iwl_get_tx_fail_reason(TX_STATUS_FAIL_SHORT_LIMIT),
1937 priv->_agn.reply_tx_stats.short_limit);
1938 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1939 iwl_get_tx_fail_reason(TX_STATUS_FAIL_LONG_LIMIT),
1940 priv->_agn.reply_tx_stats.long_limit);
1941 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1942 iwl_get_tx_fail_reason(TX_STATUS_FAIL_FIFO_UNDERRUN),
1943 priv->_agn.reply_tx_stats.fifo_underrun);
1944 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1945 iwl_get_tx_fail_reason(TX_STATUS_FAIL_DRAIN_FLOW),
1946 priv->_agn.reply_tx_stats.drain_flow);
1947 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1948 iwl_get_tx_fail_reason(TX_STATUS_FAIL_RFKILL_FLUSH),
1949 priv->_agn.reply_tx_stats.rfkill_flush);
1950 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1951 iwl_get_tx_fail_reason(TX_STATUS_FAIL_LIFE_EXPIRE),
1952 priv->_agn.reply_tx_stats.life_expire);
1953 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1954 iwl_get_tx_fail_reason(TX_STATUS_FAIL_DEST_PS),
1955 priv->_agn.reply_tx_stats.dest_ps);
1956 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1957 iwl_get_tx_fail_reason(TX_STATUS_FAIL_HOST_ABORTED),
1958 priv->_agn.reply_tx_stats.host_abort);
1959 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1960 iwl_get_tx_fail_reason(TX_STATUS_FAIL_BT_RETRY),
1961 priv->_agn.reply_tx_stats.pp_delay);
1962 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1963 iwl_get_tx_fail_reason(TX_STATUS_FAIL_STA_INVALID),
1964 priv->_agn.reply_tx_stats.sta_invalid);
1965 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1966 iwl_get_tx_fail_reason(TX_STATUS_FAIL_FRAG_DROPPED),
1967 priv->_agn.reply_tx_stats.frag_drop);
1968 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1969 iwl_get_tx_fail_reason(TX_STATUS_FAIL_TID_DISABLE),
1970 priv->_agn.reply_tx_stats.tid_disable);
1971 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1972 iwl_get_tx_fail_reason(TX_STATUS_FAIL_FIFO_FLUSHED),
1973 priv->_agn.reply_tx_stats.fifo_flush);
1974 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n",
1975 iwl_get_tx_fail_reason(
1976 TX_STATUS_FAIL_INSUFFICIENT_CF_POLL),
1977 priv->_agn.reply_tx_stats.insuff_cf_poll);
1978 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1979 iwl_get_tx_fail_reason(TX_STATUS_FAIL_PASSIVE_NO_RX),
1980 priv->_agn.reply_tx_stats.fail_hw_drop);
1981 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n",
1982 iwl_get_tx_fail_reason(
1983 TX_STATUS_FAIL_NO_BEACON_ON_RADAR),
1984 priv->_agn.reply_tx_stats.sta_color_mismatch);
1985 pos += scnprintf(buf + pos, bufsz - pos, "UNKNOWN:\t\t\t%u\n",
1986 priv->_agn.reply_tx_stats.unknown);
1987
1988 pos += scnprintf(buf + pos, bufsz - pos,
1989 "\nStatistics_Agg_TX_Error:\n");
1990
1991 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1992 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_UNDERRUN_MSK),
1993 priv->_agn.reply_agg_tx_stats.underrun);
1994 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1995 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_BT_PRIO_MSK),
1996 priv->_agn.reply_agg_tx_stats.bt_prio);
1997 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
1998 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_FEW_BYTES_MSK),
1999 priv->_agn.reply_agg_tx_stats.few_bytes);
2000 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
2001 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_ABORT_MSK),
2002 priv->_agn.reply_agg_tx_stats.abort);
2003 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n",
2004 iwl_get_agg_tx_fail_reason(
2005 AGG_TX_STATE_LAST_SENT_TTL_MSK),
2006 priv->_agn.reply_agg_tx_stats.last_sent_ttl);
2007 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n",
2008 iwl_get_agg_tx_fail_reason(
2009 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK),
2010 priv->_agn.reply_agg_tx_stats.last_sent_try);
2011 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n",
2012 iwl_get_agg_tx_fail_reason(
2013 AGG_TX_STATE_LAST_SENT_BT_KILL_MSK),
2014 priv->_agn.reply_agg_tx_stats.last_sent_bt_kill);
2015 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
2016 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_SCD_QUERY_MSK),
2017 priv->_agn.reply_agg_tx_stats.scd_query);
2018 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n",
2019 iwl_get_agg_tx_fail_reason(
2020 AGG_TX_STATE_TEST_BAD_CRC32_MSK),
2021 priv->_agn.reply_agg_tx_stats.bad_crc32);
2022 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
2023 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_RESPONSE_MSK),
2024 priv->_agn.reply_agg_tx_stats.response);
2025 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
2026 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_DUMP_TX_MSK),
2027 priv->_agn.reply_agg_tx_stats.dump_tx);
2028 pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n",
2029 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_DELAY_TX_MSK),
2030 priv->_agn.reply_agg_tx_stats.delay_tx);
2031 pos += scnprintf(buf + pos, bufsz - pos, "UNKNOWN:\t\t\t%u\n",
2032 priv->_agn.reply_agg_tx_stats.unknown);
2033
2034 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
2035 kfree(buf);
2036 return ret;
1065} 2037}
1066 2038
1067static ssize_t iwl_dbgfs_sensitivity_read(struct file *file, 2039static ssize_t iwl_dbgfs_sensitivity_read(struct file *file,
@@ -1526,16 +2498,6 @@ static ssize_t iwl_dbgfs_txfifo_flush_write(struct file *file,
1526 return count; 2498 return count;
1527} 2499}
1528 2500
1529static ssize_t iwl_dbgfs_ucode_bt_stats_read(struct file *file,
1530 char __user *user_buf,
1531 size_t count, loff_t *ppos)
1532{
1533 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
1534
1535 return priv->cfg->ops->lib->debugfs_ops.bt_stats_read(file,
1536 user_buf, count, ppos);
1537}
1538
1539static ssize_t iwl_dbgfs_wd_timeout_write(struct file *file, 2501static ssize_t iwl_dbgfs_wd_timeout_write(struct file *file,
1540 const char __user *user_buf, 2502 const char __user *user_buf,
1541 size_t count, loff_t *ppos) { 2503 size_t count, loff_t *ppos) {
@@ -1650,18 +2612,6 @@ static ssize_t iwl_dbgfs_protection_mode_write(struct file *file,
1650 return count; 2612 return count;
1651} 2613}
1652 2614
1653static ssize_t iwl_dbgfs_reply_tx_error_read(struct file *file,
1654 char __user *user_buf,
1655 size_t count, loff_t *ppos)
1656{
1657 struct iwl_priv *priv = file->private_data;
1658
1659 if (priv->cfg->ops->lib->debugfs_ops.reply_tx_error)
1660 return priv->cfg->ops->lib->debugfs_ops.reply_tx_error(
1661 file, user_buf, count, ppos);
1662 else
1663 return -ENODATA;
1664}
1665DEBUGFS_READ_FILE_OPS(rx_statistics); 2615DEBUGFS_READ_FILE_OPS(rx_statistics);
1666DEBUGFS_READ_FILE_OPS(tx_statistics); 2616DEBUGFS_READ_FILE_OPS(tx_statistics);
1667DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); 2617DEBUGFS_READ_WRITE_FILE_OPS(traffic_log);