1
/******************************************************************************
5
* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
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.
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.
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,
21
* The full GNU General Public License is included in this distribution
22
* in the file called LICENSE.GPL.
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
*****************************************************************************/
29
#include "iwl-3945-debugfs.h"
32
static int iwl3945_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
36
p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n",
37
le32_to_cpu(priv->_3945.statistics.flag));
38
if (le32_to_cpu(priv->_3945.statistics.flag) &
39
UCODE_STATISTICS_CLEAR_MSK)
40
p += scnprintf(buf + p, bufsz - p,
41
"\tStatistics have been cleared\n");
42
p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n",
43
(le32_to_cpu(priv->_3945.statistics.flag) &
44
UCODE_STATISTICS_FREQUENCY_MSK)
45
? "2.4 GHz" : "5.2 GHz");
46
p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n",
47
(le32_to_cpu(priv->_3945.statistics.flag) &
48
UCODE_STATISTICS_NARROW_BAND_MSK)
49
? "enabled" : "disabled");
53
ssize_t iwl3945_ucode_rx_stats_read(struct file *file,
54
char __user *user_buf,
55
size_t count, loff_t *ppos)
57
struct iwl_priv *priv = file->private_data;
60
int bufsz = sizeof(struct iwl39_statistics_rx_phy) * 40 +
61
sizeof(struct iwl39_statistics_rx_non_phy) * 40 + 400;
63
struct iwl39_statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm,
65
struct iwl39_statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
66
struct iwl39_statistics_rx_non_phy *general, *accum_general;
67
struct iwl39_statistics_rx_non_phy *delta_general, *max_general;
69
if (!iwl_legacy_is_alive(priv))
72
buf = kzalloc(bufsz, GFP_KERNEL);
74
IWL_ERR(priv, "Can not allocate Buffer\n");
79
* The statistic information display here is based on
80
* the last statistics notification from uCode
81
* might not reflect the current uCode activity
83
ofdm = &priv->_3945.statistics.rx.ofdm;
84
cck = &priv->_3945.statistics.rx.cck;
85
general = &priv->_3945.statistics.rx.general;
86
accum_ofdm = &priv->_3945.accum_statistics.rx.ofdm;
87
accum_cck = &priv->_3945.accum_statistics.rx.cck;
88
accum_general = &priv->_3945.accum_statistics.rx.general;
89
delta_ofdm = &priv->_3945.delta_statistics.rx.ofdm;
90
delta_cck = &priv->_3945.delta_statistics.rx.cck;
91
delta_general = &priv->_3945.delta_statistics.rx.general;
92
max_ofdm = &priv->_3945.max_delta.rx.ofdm;
93
max_cck = &priv->_3945.max_delta.rx.cck;
94
max_general = &priv->_3945.max_delta.rx.general;
96
pos += iwl3945_statistics_flag(priv, buf, bufsz);
97
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
98
"acumulative delta max\n",
99
"Statistics_Rx - OFDM:");
100
pos += scnprintf(buf + pos, bufsz - pos,
101
" %-30s %10u %10u %10u %10u\n",
102
"ina_cnt:", le32_to_cpu(ofdm->ina_cnt),
104
delta_ofdm->ina_cnt, max_ofdm->ina_cnt);
105
pos += scnprintf(buf + pos, bufsz - pos,
106
" %-30s %10u %10u %10u %10u\n",
108
le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt,
109
delta_ofdm->fina_cnt, max_ofdm->fina_cnt);
110
pos += scnprintf(buf + pos, bufsz - pos,
111
" %-30s %10u %10u %10u %10u\n", "plcp_err:",
112
le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err,
113
delta_ofdm->plcp_err, max_ofdm->plcp_err);
114
pos += scnprintf(buf + pos, bufsz - pos,
115
" %-30s %10u %10u %10u %10u\n", "crc32_err:",
116
le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err,
117
delta_ofdm->crc32_err, max_ofdm->crc32_err);
118
pos += scnprintf(buf + pos, bufsz - pos,
119
" %-30s %10u %10u %10u %10u\n", "overrun_err:",
120
le32_to_cpu(ofdm->overrun_err),
121
accum_ofdm->overrun_err, delta_ofdm->overrun_err,
122
max_ofdm->overrun_err);
123
pos += scnprintf(buf + pos, bufsz - pos,
124
" %-30s %10u %10u %10u %10u\n",
125
"early_overrun_err:",
126
le32_to_cpu(ofdm->early_overrun_err),
127
accum_ofdm->early_overrun_err,
128
delta_ofdm->early_overrun_err,
129
max_ofdm->early_overrun_err);
130
pos += scnprintf(buf + pos, bufsz - pos,
131
" %-30s %10u %10u %10u %10u\n",
132
"crc32_good:", le32_to_cpu(ofdm->crc32_good),
133
accum_ofdm->crc32_good, delta_ofdm->crc32_good,
134
max_ofdm->crc32_good);
135
pos += scnprintf(buf + pos, bufsz - pos,
136
" %-30s %10u %10u %10u %10u\n", "false_alarm_cnt:",
137
le32_to_cpu(ofdm->false_alarm_cnt),
138
accum_ofdm->false_alarm_cnt,
139
delta_ofdm->false_alarm_cnt,
140
max_ofdm->false_alarm_cnt);
141
pos += scnprintf(buf + pos, bufsz - pos,
142
" %-30s %10u %10u %10u %10u\n",
143
"fina_sync_err_cnt:",
144
le32_to_cpu(ofdm->fina_sync_err_cnt),
145
accum_ofdm->fina_sync_err_cnt,
146
delta_ofdm->fina_sync_err_cnt,
147
max_ofdm->fina_sync_err_cnt);
148
pos += scnprintf(buf + pos, bufsz - pos,
149
" %-30s %10u %10u %10u %10u\n",
151
le32_to_cpu(ofdm->sfd_timeout),
152
accum_ofdm->sfd_timeout,
153
delta_ofdm->sfd_timeout,
154
max_ofdm->sfd_timeout);
155
pos += scnprintf(buf + pos, bufsz - pos,
156
" %-30s %10u %10u %10u %10u\n",
158
le32_to_cpu(ofdm->fina_timeout),
159
accum_ofdm->fina_timeout,
160
delta_ofdm->fina_timeout,
161
max_ofdm->fina_timeout);
162
pos += scnprintf(buf + pos, bufsz - pos,
163
" %-30s %10u %10u %10u %10u\n",
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
" %-30s %10u %10u %10u %10u\n",
171
"rxe_frame_lmt_ovrun:",
172
le32_to_cpu(ofdm->rxe_frame_limit_overrun),
173
accum_ofdm->rxe_frame_limit_overrun,
174
delta_ofdm->rxe_frame_limit_overrun,
175
max_ofdm->rxe_frame_limit_overrun);
176
pos += scnprintf(buf + pos, bufsz - pos,
177
" %-30s %10u %10u %10u %10u\n",
179
le32_to_cpu(ofdm->sent_ack_cnt),
180
accum_ofdm->sent_ack_cnt,
181
delta_ofdm->sent_ack_cnt,
182
max_ofdm->sent_ack_cnt);
183
pos += scnprintf(buf + pos, bufsz - pos,
184
" %-30s %10u %10u %10u %10u\n",
186
le32_to_cpu(ofdm->sent_cts_cnt),
187
accum_ofdm->sent_cts_cnt,
188
delta_ofdm->sent_cts_cnt, max_ofdm->sent_cts_cnt);
190
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
191
"acumulative delta max\n",
192
"Statistics_Rx - CCK:");
193
pos += scnprintf(buf + pos, bufsz - pos,
194
" %-30s %10u %10u %10u %10u\n",
196
le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt,
197
delta_cck->ina_cnt, max_cck->ina_cnt);
198
pos += scnprintf(buf + pos, bufsz - pos,
199
" %-30s %10u %10u %10u %10u\n",
201
le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt,
202
delta_cck->fina_cnt, max_cck->fina_cnt);
203
pos += scnprintf(buf + pos, bufsz - pos,
204
" %-30s %10u %10u %10u %10u\n",
206
le32_to_cpu(cck->plcp_err), accum_cck->plcp_err,
207
delta_cck->plcp_err, max_cck->plcp_err);
208
pos += scnprintf(buf + pos, bufsz - pos,
209
" %-30s %10u %10u %10u %10u\n",
211
le32_to_cpu(cck->crc32_err), accum_cck->crc32_err,
212
delta_cck->crc32_err, max_cck->crc32_err);
213
pos += scnprintf(buf + pos, bufsz - pos,
214
" %-30s %10u %10u %10u %10u\n",
216
le32_to_cpu(cck->overrun_err),
217
accum_cck->overrun_err,
218
delta_cck->overrun_err, max_cck->overrun_err);
219
pos += scnprintf(buf + pos, bufsz - pos,
220
" %-30s %10u %10u %10u %10u\n",
221
"early_overrun_err:",
222
le32_to_cpu(cck->early_overrun_err),
223
accum_cck->early_overrun_err,
224
delta_cck->early_overrun_err,
225
max_cck->early_overrun_err);
226
pos += scnprintf(buf + pos, bufsz - pos,
227
" %-30s %10u %10u %10u %10u\n",
229
le32_to_cpu(cck->crc32_good), accum_cck->crc32_good,
230
delta_cck->crc32_good,
231
max_cck->crc32_good);
232
pos += scnprintf(buf + pos, bufsz - pos,
233
" %-30s %10u %10u %10u %10u\n",
235
le32_to_cpu(cck->false_alarm_cnt),
236
accum_cck->false_alarm_cnt,
237
delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt);
238
pos += scnprintf(buf + pos, bufsz - pos,
239
" %-30s %10u %10u %10u %10u\n",
240
"fina_sync_err_cnt:",
241
le32_to_cpu(cck->fina_sync_err_cnt),
242
accum_cck->fina_sync_err_cnt,
243
delta_cck->fina_sync_err_cnt,
244
max_cck->fina_sync_err_cnt);
245
pos += scnprintf(buf + pos, bufsz - pos,
246
" %-30s %10u %10u %10u %10u\n",
248
le32_to_cpu(cck->sfd_timeout),
249
accum_cck->sfd_timeout,
250
delta_cck->sfd_timeout, max_cck->sfd_timeout);
251
pos += scnprintf(buf + pos, bufsz - pos,
252
" %-30s %10u %10u %10u %10u\n",
254
le32_to_cpu(cck->fina_timeout),
255
accum_cck->fina_timeout,
256
delta_cck->fina_timeout, max_cck->fina_timeout);
257
pos += scnprintf(buf + pos, bufsz - pos,
258
" %-30s %10u %10u %10u %10u\n",
260
le32_to_cpu(cck->unresponded_rts),
261
accum_cck->unresponded_rts,
262
delta_cck->unresponded_rts,
263
max_cck->unresponded_rts);
264
pos += scnprintf(buf + pos, bufsz - pos,
265
" %-30s %10u %10u %10u %10u\n",
266
"rxe_frame_lmt_ovrun:",
267
le32_to_cpu(cck->rxe_frame_limit_overrun),
268
accum_cck->rxe_frame_limit_overrun,
269
delta_cck->rxe_frame_limit_overrun,
270
max_cck->rxe_frame_limit_overrun);
271
pos += scnprintf(buf + pos, bufsz - pos,
272
" %-30s %10u %10u %10u %10u\n",
274
le32_to_cpu(cck->sent_ack_cnt),
275
accum_cck->sent_ack_cnt,
276
delta_cck->sent_ack_cnt,
277
max_cck->sent_ack_cnt);
278
pos += scnprintf(buf + pos, bufsz - pos,
279
" %-30s %10u %10u %10u %10u\n",
281
le32_to_cpu(cck->sent_cts_cnt),
282
accum_cck->sent_cts_cnt,
283
delta_cck->sent_cts_cnt,
284
max_cck->sent_cts_cnt);
286
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
287
"acumulative delta max\n",
288
"Statistics_Rx - GENERAL:");
289
pos += scnprintf(buf + pos, bufsz - pos,
290
" %-30s %10u %10u %10u %10u\n",
292
le32_to_cpu(general->bogus_cts),
293
accum_general->bogus_cts,
294
delta_general->bogus_cts, max_general->bogus_cts);
295
pos += scnprintf(buf + pos, bufsz - pos,
296
" %-30s %10u %10u %10u %10u\n",
298
le32_to_cpu(general->bogus_ack),
299
accum_general->bogus_ack,
300
delta_general->bogus_ack, max_general->bogus_ack);
301
pos += scnprintf(buf + pos, bufsz - pos,
302
" %-30s %10u %10u %10u %10u\n",
304
le32_to_cpu(general->non_bssid_frames),
305
accum_general->non_bssid_frames,
306
delta_general->non_bssid_frames,
307
max_general->non_bssid_frames);
308
pos += scnprintf(buf + pos, bufsz - pos,
309
" %-30s %10u %10u %10u %10u\n",
311
le32_to_cpu(general->filtered_frames),
312
accum_general->filtered_frames,
313
delta_general->filtered_frames,
314
max_general->filtered_frames);
315
pos += scnprintf(buf + pos, bufsz - pos,
316
" %-30s %10u %10u %10u %10u\n",
317
"non_channel_beacons:",
318
le32_to_cpu(general->non_channel_beacons),
319
accum_general->non_channel_beacons,
320
delta_general->non_channel_beacons,
321
max_general->non_channel_beacons);
323
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
328
ssize_t iwl3945_ucode_tx_stats_read(struct file *file,
329
char __user *user_buf,
330
size_t count, loff_t *ppos)
332
struct iwl_priv *priv = file->private_data;
335
int bufsz = (sizeof(struct iwl39_statistics_tx) * 48) + 250;
337
struct iwl39_statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
339
if (!iwl_legacy_is_alive(priv))
342
buf = kzalloc(bufsz, GFP_KERNEL);
344
IWL_ERR(priv, "Can not allocate Buffer\n");
349
* The statistic information display here is based on
350
* the last statistics notification from uCode
351
* might not reflect the current uCode activity
353
tx = &priv->_3945.statistics.tx;
354
accum_tx = &priv->_3945.accum_statistics.tx;
355
delta_tx = &priv->_3945.delta_statistics.tx;
356
max_tx = &priv->_3945.max_delta.tx;
357
pos += iwl3945_statistics_flag(priv, buf, bufsz);
358
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
359
"acumulative delta max\n",
361
pos += scnprintf(buf + pos, bufsz - pos,
362
" %-30s %10u %10u %10u %10u\n",
364
le32_to_cpu(tx->preamble_cnt),
365
accum_tx->preamble_cnt,
366
delta_tx->preamble_cnt, max_tx->preamble_cnt);
367
pos += scnprintf(buf + pos, bufsz - pos,
368
" %-30s %10u %10u %10u %10u\n",
370
le32_to_cpu(tx->rx_detected_cnt),
371
accum_tx->rx_detected_cnt,
372
delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt);
373
pos += scnprintf(buf + pos, bufsz - pos,
374
" %-30s %10u %10u %10u %10u\n",
375
"bt_prio_defer_cnt:",
376
le32_to_cpu(tx->bt_prio_defer_cnt),
377
accum_tx->bt_prio_defer_cnt,
378
delta_tx->bt_prio_defer_cnt,
379
max_tx->bt_prio_defer_cnt);
380
pos += scnprintf(buf + pos, bufsz - pos,
381
" %-30s %10u %10u %10u %10u\n",
383
le32_to_cpu(tx->bt_prio_kill_cnt),
384
accum_tx->bt_prio_kill_cnt,
385
delta_tx->bt_prio_kill_cnt,
386
max_tx->bt_prio_kill_cnt);
387
pos += scnprintf(buf + pos, bufsz - pos,
388
" %-30s %10u %10u %10u %10u\n",
390
le32_to_cpu(tx->few_bytes_cnt),
391
accum_tx->few_bytes_cnt,
392
delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt);
393
pos += scnprintf(buf + pos, bufsz - pos,
394
" %-30s %10u %10u %10u %10u\n",
396
le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout,
397
delta_tx->cts_timeout, max_tx->cts_timeout);
398
pos += scnprintf(buf + pos, bufsz - pos,
399
" %-30s %10u %10u %10u %10u\n",
401
le32_to_cpu(tx->ack_timeout),
402
accum_tx->ack_timeout,
403
delta_tx->ack_timeout, max_tx->ack_timeout);
404
pos += scnprintf(buf + pos, bufsz - pos,
405
" %-30s %10u %10u %10u %10u\n",
407
le32_to_cpu(tx->expected_ack_cnt),
408
accum_tx->expected_ack_cnt,
409
delta_tx->expected_ack_cnt,
410
max_tx->expected_ack_cnt);
411
pos += scnprintf(buf + pos, bufsz - pos,
412
" %-30s %10u %10u %10u %10u\n",
414
le32_to_cpu(tx->actual_ack_cnt),
415
accum_tx->actual_ack_cnt,
416
delta_tx->actual_ack_cnt,
417
max_tx->actual_ack_cnt);
419
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
424
ssize_t iwl3945_ucode_general_stats_read(struct file *file,
425
char __user *user_buf,
426
size_t count, loff_t *ppos)
428
struct iwl_priv *priv = file->private_data;
431
int bufsz = sizeof(struct iwl39_statistics_general) * 10 + 300;
433
struct iwl39_statistics_general *general, *accum_general;
434
struct iwl39_statistics_general *delta_general, *max_general;
435
struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
436
struct iwl39_statistics_div *div, *accum_div, *delta_div, *max_div;
438
if (!iwl_legacy_is_alive(priv))
441
buf = kzalloc(bufsz, GFP_KERNEL);
443
IWL_ERR(priv, "Can not allocate Buffer\n");
448
* The statistic information display here is based on
449
* the last statistics notification from uCode
450
* might not reflect the current uCode activity
452
general = &priv->_3945.statistics.general;
453
dbg = &priv->_3945.statistics.general.dbg;
454
div = &priv->_3945.statistics.general.div;
455
accum_general = &priv->_3945.accum_statistics.general;
456
delta_general = &priv->_3945.delta_statistics.general;
457
max_general = &priv->_3945.max_delta.general;
458
accum_dbg = &priv->_3945.accum_statistics.general.dbg;
459
delta_dbg = &priv->_3945.delta_statistics.general.dbg;
460
max_dbg = &priv->_3945.max_delta.general.dbg;
461
accum_div = &priv->_3945.accum_statistics.general.div;
462
delta_div = &priv->_3945.delta_statistics.general.div;
463
max_div = &priv->_3945.max_delta.general.div;
464
pos += iwl3945_statistics_flag(priv, buf, bufsz);
465
pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
466
"acumulative delta max\n",
467
"Statistics_General:");
468
pos += scnprintf(buf + pos, bufsz - pos,
469
" %-30s %10u %10u %10u %10u\n",
471
le32_to_cpu(dbg->burst_check),
472
accum_dbg->burst_check,
473
delta_dbg->burst_check, max_dbg->burst_check);
474
pos += scnprintf(buf + pos, bufsz - pos,
475
" %-30s %10u %10u %10u %10u\n",
477
le32_to_cpu(dbg->burst_count),
478
accum_dbg->burst_count,
479
delta_dbg->burst_count, max_dbg->burst_count);
480
pos += scnprintf(buf + pos, bufsz - pos,
481
" %-30s %10u %10u %10u %10u\n",
483
le32_to_cpu(general->sleep_time),
484
accum_general->sleep_time,
485
delta_general->sleep_time, max_general->sleep_time);
486
pos += scnprintf(buf + pos, bufsz - pos,
487
" %-30s %10u %10u %10u %10u\n",
489
le32_to_cpu(general->slots_out),
490
accum_general->slots_out,
491
delta_general->slots_out, max_general->slots_out);
492
pos += scnprintf(buf + pos, bufsz - pos,
493
" %-30s %10u %10u %10u %10u\n",
495
le32_to_cpu(general->slots_idle),
496
accum_general->slots_idle,
497
delta_general->slots_idle, max_general->slots_idle);
498
pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp:\t\t\t%u\n",
499
le32_to_cpu(general->ttl_timestamp));
500
pos += scnprintf(buf + pos, bufsz - pos,
501
" %-30s %10u %10u %10u %10u\n",
503
le32_to_cpu(div->tx_on_a), accum_div->tx_on_a,
504
delta_div->tx_on_a, max_div->tx_on_a);
505
pos += scnprintf(buf + pos, bufsz - pos,
506
" %-30s %10u %10u %10u %10u\n",
508
le32_to_cpu(div->tx_on_b), accum_div->tx_on_b,
509
delta_div->tx_on_b, max_div->tx_on_b);
510
pos += scnprintf(buf + pos, bufsz - pos,
511
" %-30s %10u %10u %10u %10u\n",
513
le32_to_cpu(div->exec_time), accum_div->exec_time,
514
delta_div->exec_time, max_div->exec_time);
515
pos += scnprintf(buf + pos, bufsz - pos,
516
" %-30s %10u %10u %10u %10u\n",
518
le32_to_cpu(div->probe_time), accum_div->probe_time,
519
delta_div->probe_time, max_div->probe_time);
520
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);