1 /******************************************************************************
5 * Copyright(c) 2008 - 2012 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 <linux/slab.h>
30 #include <linux/kernel.h>
31 #include <linux/module.h>
32 #include <linux/debugfs.h>
34 #include <linux/ieee80211.h>
35 #include <net/mac80211.h>
39 #include "iwl-debug.h"
44 /* create and remove of files */
45 #define DEBUGFS_ADD_FILE(name, parent, mode) do { \
46 if (!debugfs_create_file(#name, mode, parent, priv, \
47 &iwl_dbgfs_##name##_ops)) \
51 #define DEBUGFS_ADD_BOOL(name, parent, ptr) do { \
52 struct dentry *__tmp; \
53 __tmp = debugfs_create_bool(#name, S_IWUSR | S_IRUSR, \
55 if (IS_ERR(__tmp) || !__tmp) \
59 #define DEBUGFS_ADD_X32(name, parent, ptr) do { \
60 struct dentry *__tmp; \
61 __tmp = debugfs_create_x32(#name, S_IWUSR | S_IRUSR, \
63 if (IS_ERR(__tmp) || !__tmp) \
67 #define DEBUGFS_ADD_U32(name, parent, ptr, mode) do { \
68 struct dentry *__tmp; \
69 __tmp = debugfs_create_u32(#name, mode, \
71 if (IS_ERR(__tmp) || !__tmp) \
76 #define DEBUGFS_READ_FUNC(name) \
77 static ssize_t iwl_dbgfs_##name##_read(struct file *file, \
78 char __user *user_buf, \
79 size_t count, loff_t *ppos);
81 #define DEBUGFS_WRITE_FUNC(name) \
82 static ssize_t iwl_dbgfs_##name##_write(struct file *file, \
83 const char __user *user_buf, \
84 size_t count, loff_t *ppos);
87 static int iwl_dbgfs_open_file_generic(struct inode
*inode
, struct file
*file
)
89 file
->private_data
= inode
->i_private
;
93 #define DEBUGFS_READ_FILE_OPS(name) \
94 DEBUGFS_READ_FUNC(name); \
95 static const struct file_operations iwl_dbgfs_##name##_ops = { \
96 .read = iwl_dbgfs_##name##_read, \
97 .open = iwl_dbgfs_open_file_generic, \
98 .llseek = generic_file_llseek, \
101 #define DEBUGFS_WRITE_FILE_OPS(name) \
102 DEBUGFS_WRITE_FUNC(name); \
103 static const struct file_operations iwl_dbgfs_##name##_ops = { \
104 .write = iwl_dbgfs_##name##_write, \
105 .open = iwl_dbgfs_open_file_generic, \
106 .llseek = generic_file_llseek, \
110 #define DEBUGFS_READ_WRITE_FILE_OPS(name) \
111 DEBUGFS_READ_FUNC(name); \
112 DEBUGFS_WRITE_FUNC(name); \
113 static const struct file_operations iwl_dbgfs_##name##_ops = { \
114 .write = iwl_dbgfs_##name##_write, \
115 .read = iwl_dbgfs_##name##_read, \
116 .open = iwl_dbgfs_open_file_generic, \
117 .llseek = generic_file_llseek, \
120 static ssize_t
iwl_dbgfs_tx_statistics_read(struct file
*file
,
121 char __user
*user_buf
,
122 size_t count
, loff_t
*ppos
) {
124 struct iwl_priv
*priv
= file
->private_data
;
130 const size_t bufsz
= 100 +
131 sizeof(char) * 50 * (MANAGEMENT_MAX
+ CONTROL_MAX
);
132 buf
= kzalloc(bufsz
, GFP_KERNEL
);
135 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Management:\n");
136 for (cnt
= 0; cnt
< MANAGEMENT_MAX
; cnt
++) {
137 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
139 get_mgmt_string(cnt
),
140 priv
->tx_stats
.mgmt
[cnt
]);
142 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Control\n");
143 for (cnt
= 0; cnt
< CONTROL_MAX
; cnt
++) {
144 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
146 get_ctrl_string(cnt
),
147 priv
->tx_stats
.ctrl
[cnt
]);
149 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Data:\n");
150 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\tcnt: %u\n",
151 priv
->tx_stats
.data_cnt
);
152 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\tbytes: %llu\n",
153 priv
->tx_stats
.data_bytes
);
154 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
159 static ssize_t
iwl_dbgfs_clear_traffic_statistics_write(struct file
*file
,
160 const char __user
*user_buf
,
161 size_t count
, loff_t
*ppos
)
163 struct iwl_priv
*priv
= file
->private_data
;
168 memset(buf
, 0, sizeof(buf
));
169 buf_size
= min(count
, sizeof(buf
) - 1);
170 if (copy_from_user(buf
, user_buf
, buf_size
))
172 if (sscanf(buf
, "%x", &clear_flag
) != 1)
174 iwl_clear_traffic_stats(priv
);
179 static ssize_t
iwl_dbgfs_rx_statistics_read(struct file
*file
,
180 char __user
*user_buf
,
181 size_t count
, loff_t
*ppos
) {
183 struct iwl_priv
*priv
= file
->private_data
;
188 const size_t bufsz
= 100 +
189 sizeof(char) * 50 * (MANAGEMENT_MAX
+ CONTROL_MAX
);
190 buf
= kzalloc(bufsz
, GFP_KERNEL
);
194 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Management:\n");
195 for (cnt
= 0; cnt
< MANAGEMENT_MAX
; cnt
++) {
196 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
198 get_mgmt_string(cnt
),
199 priv
->rx_stats
.mgmt
[cnt
]);
201 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Control:\n");
202 for (cnt
= 0; cnt
< CONTROL_MAX
; cnt
++) {
203 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
205 get_ctrl_string(cnt
),
206 priv
->rx_stats
.ctrl
[cnt
]);
208 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Data:\n");
209 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\tcnt: %u\n",
210 priv
->rx_stats
.data_cnt
);
211 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\tbytes: %llu\n",
212 priv
->rx_stats
.data_bytes
);
214 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
219 static ssize_t
iwl_dbgfs_sram_read(struct file
*file
,
220 char __user
*user_buf
,
221 size_t count
, loff_t
*ppos
)
227 bool device_format
= false;
232 struct iwl_priv
*priv
= file
->private_data
;
233 const struct fw_img
*img
;
236 /* default is to dump the entire data segment */
237 if (!priv
->dbgfs_sram_offset
&& !priv
->dbgfs_sram_len
) {
238 priv
->dbgfs_sram_offset
= 0x800000;
239 if (!priv
->ucode_loaded
) {
240 IWL_ERR(priv
, "No uCode has been loadded.\n");
243 img
= &priv
->fw
->img
[priv
->cur_ucode
];
244 priv
->dbgfs_sram_len
= img
->sec
[IWL_UCODE_SECTION_DATA
].len
;
246 len
= priv
->dbgfs_sram_len
;
249 device_format
= true;
253 bufsz
= 50 + len
* 4;
254 buf
= kmalloc(bufsz
, GFP_KERNEL
);
258 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "sram_len: 0x%x\n",
260 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "sram_offset: 0x%x\n",
261 priv
->dbgfs_sram_offset
);
263 /* adjust sram address since reads are only on even u32 boundaries */
264 offset
= priv
->dbgfs_sram_offset
& 0x3;
265 sram
= priv
->dbgfs_sram_offset
& ~0x3;
267 /* read the first u32 from sram */
268 val
= iwl_read_targ_mem(trans(priv
), sram
);
271 /* put the address at the start of every line */
273 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
274 "%08X: ", sram
+ offset
);
277 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
278 "%02x", (val
>> (8 * (3 - offset
))) & 0xff);
280 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
281 "%02x ", (val
>> (8 * offset
)) & 0xff);
283 /* if all bytes processed, read the next u32 from sram */
287 val
= iwl_read_targ_mem(trans(priv
), sram
);
290 /* put in extra spaces and split lines for human readability */
293 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
294 } else if (!(i
& 7)) {
295 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, " ");
296 } else if (!(i
& 3)) {
297 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, " ");
301 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
303 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
308 static ssize_t
iwl_dbgfs_sram_write(struct file
*file
,
309 const char __user
*user_buf
,
310 size_t count
, loff_t
*ppos
)
312 struct iwl_priv
*priv
= file
->private_data
;
317 memset(buf
, 0, sizeof(buf
));
318 buf_size
= min(count
, sizeof(buf
) - 1);
319 if (copy_from_user(buf
, user_buf
, buf_size
))
322 if (sscanf(buf
, "%x,%x", &offset
, &len
) == 2) {
323 priv
->dbgfs_sram_offset
= offset
;
324 priv
->dbgfs_sram_len
= len
;
325 } else if (sscanf(buf
, "%x", &offset
) == 1) {
326 priv
->dbgfs_sram_offset
= offset
;
327 priv
->dbgfs_sram_len
= -4;
329 priv
->dbgfs_sram_offset
= 0;
330 priv
->dbgfs_sram_len
= 0;
336 static ssize_t
iwl_dbgfs_wowlan_sram_read(struct file
*file
,
337 char __user
*user_buf
,
338 size_t count
, loff_t
*ppos
)
340 struct iwl_priv
*priv
= file
->private_data
;
341 const struct fw_img
*img
= &priv
->fw
->img
[IWL_UCODE_WOWLAN
];
343 if (!priv
->wowlan_sram
)
346 return simple_read_from_buffer(user_buf
, count
, ppos
,
348 img
->sec
[IWL_UCODE_SECTION_DATA
].len
);
350 static ssize_t
iwl_dbgfs_stations_read(struct file
*file
, char __user
*user_buf
,
351 size_t count
, loff_t
*ppos
)
353 struct iwl_priv
*priv
= file
->private_data
;
354 struct iwl_station_entry
*station
;
355 struct iwl_tid_data
*tid_data
;
359 /* Add 30 for initial string */
360 const size_t bufsz
= 30 + sizeof(char) * 500 * (priv
->num_stations
);
362 buf
= kmalloc(bufsz
, GFP_KERNEL
);
366 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "num of stations: %d\n\n",
369 for (i
= 0; i
< IWLAGN_STATION_COUNT
; i
++) {
370 station
= &priv
->stations
[i
];
373 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
374 "station %d - addr: %pM, flags: %#x\n",
375 i
, station
->sta
.sta
.addr
,
376 station
->sta
.station_flags_msk
);
377 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
378 "TID seqno next_rclmd "
379 "rate_n_flags state txq\n");
381 for (j
= 0; j
< IWL_MAX_TID_COUNT
; j
++) {
382 tid_data
= &priv
->tid_data
[i
][j
];
383 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
384 "%d: 0x%.4x 0x%.4x 0x%.8x "
386 j
, tid_data
->seq_number
,
387 tid_data
->next_reclaimed
,
388 tid_data
->agg
.rate_n_flags
,
390 tid_data
->agg
.txq_id
);
392 if (tid_data
->agg
.wait_for_ba
)
393 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
395 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
398 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
401 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
406 static ssize_t
iwl_dbgfs_nvm_read(struct file
*file
,
407 char __user
*user_buf
,
412 struct iwl_priv
*priv
= file
->private_data
;
413 int pos
= 0, ofs
= 0, buf_size
= 0;
417 size_t eeprom_len
= cfg(priv
)->base_params
->eeprom_size
;
418 buf_size
= 4 * eeprom_len
+ 256;
420 if (eeprom_len
% 16) {
421 IWL_ERR(priv
, "NVM size is not multiple of 16.\n");
425 ptr
= priv
->shrd
->eeprom
;
427 IWL_ERR(priv
, "Invalid EEPROM/OTP memory\n");
431 /* 4 characters for byte 0xYY */
432 buf
= kzalloc(buf_size
, GFP_KERNEL
);
434 IWL_ERR(priv
, "Can not allocate Buffer\n");
437 eeprom_ver
= iwl_eeprom_query16(priv
->shrd
, EEPROM_VERSION
);
438 pos
+= scnprintf(buf
+ pos
, buf_size
- pos
, "NVM Type: %s, "
440 (trans(priv
)->nvm_device_type
== NVM_DEVICE_TYPE_OTP
)
441 ? "OTP" : "EEPROM", eeprom_ver
);
442 for (ofs
= 0 ; ofs
< eeprom_len
; ofs
+= 16) {
443 pos
+= scnprintf(buf
+ pos
, buf_size
- pos
, "0x%.4x ", ofs
);
444 hex_dump_to_buffer(ptr
+ ofs
, 16 , 16, 2, buf
+ pos
,
446 pos
+= strlen(buf
+ pos
);
447 if (buf_size
- pos
> 0)
451 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
456 static ssize_t
iwl_dbgfs_channels_read(struct file
*file
, char __user
*user_buf
,
457 size_t count
, loff_t
*ppos
)
459 struct iwl_priv
*priv
= file
->private_data
;
460 struct ieee80211_channel
*channels
= NULL
;
461 const struct ieee80211_supported_band
*supp_band
= NULL
;
462 int pos
= 0, i
, bufsz
= PAGE_SIZE
;
466 if (!test_bit(STATUS_GEO_CONFIGURED
, &priv
->status
))
469 buf
= kzalloc(bufsz
, GFP_KERNEL
);
471 IWL_ERR(priv
, "Can not allocate Buffer\n");
475 supp_band
= iwl_get_hw_mode(priv
, IEEE80211_BAND_2GHZ
);
477 channels
= supp_band
->channels
;
479 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
480 "Displaying %d channels in 2.4GHz band 802.11bg):\n",
481 supp_band
->n_channels
);
483 for (i
= 0; i
< supp_band
->n_channels
; i
++)
484 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
485 "%d: %ddBm: BSS%s%s, %s.\n",
486 channels
[i
].hw_value
,
487 channels
[i
].max_power
,
488 channels
[i
].flags
& IEEE80211_CHAN_RADAR
?
489 " (IEEE 802.11h required)" : "",
490 ((channels
[i
].flags
& IEEE80211_CHAN_NO_IBSS
)
491 || (channels
[i
].flags
&
492 IEEE80211_CHAN_RADAR
)) ? "" :
495 IEEE80211_CHAN_PASSIVE_SCAN
?
496 "passive only" : "active/passive");
498 supp_band
= iwl_get_hw_mode(priv
, IEEE80211_BAND_5GHZ
);
500 channels
= supp_band
->channels
;
502 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
503 "Displaying %d channels in 5.2GHz band (802.11a)\n",
504 supp_band
->n_channels
);
506 for (i
= 0; i
< supp_band
->n_channels
; i
++)
507 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
508 "%d: %ddBm: BSS%s%s, %s.\n",
509 channels
[i
].hw_value
,
510 channels
[i
].max_power
,
511 channels
[i
].flags
& IEEE80211_CHAN_RADAR
?
512 " (IEEE 802.11h required)" : "",
513 ((channels
[i
].flags
& IEEE80211_CHAN_NO_IBSS
)
514 || (channels
[i
].flags
&
515 IEEE80211_CHAN_RADAR
)) ? "" :
518 IEEE80211_CHAN_PASSIVE_SCAN
?
519 "passive only" : "active/passive");
521 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
526 static ssize_t
iwl_dbgfs_status_read(struct file
*file
,
527 char __user
*user_buf
,
528 size_t count
, loff_t
*ppos
) {
530 struct iwl_priv
*priv
= file
->private_data
;
533 const size_t bufsz
= sizeof(buf
);
535 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_HCMD_ACTIVE:\t %d\n",
536 test_bit(STATUS_HCMD_ACTIVE
, &priv
->shrd
->status
));
537 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_RF_KILL_HW:\t %d\n",
538 test_bit(STATUS_RF_KILL_HW
, &priv
->status
));
539 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_CT_KILL:\t\t %d\n",
540 test_bit(STATUS_CT_KILL
, &priv
->status
));
541 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_ALIVE:\t\t %d\n",
542 test_bit(STATUS_ALIVE
, &priv
->status
));
543 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_READY:\t\t %d\n",
544 test_bit(STATUS_READY
, &priv
->status
));
545 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_GEO_CONFIGURED:\t %d\n",
546 test_bit(STATUS_GEO_CONFIGURED
, &priv
->status
));
547 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_EXIT_PENDING:\t %d\n",
548 test_bit(STATUS_EXIT_PENDING
, &priv
->status
));
549 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_STATISTICS:\t %d\n",
550 test_bit(STATUS_STATISTICS
, &priv
->status
));
551 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_SCANNING:\t %d\n",
552 test_bit(STATUS_SCANNING
, &priv
->status
));
553 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_SCAN_ABORTING:\t %d\n",
554 test_bit(STATUS_SCAN_ABORTING
, &priv
->status
));
555 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_SCAN_HW:\t\t %d\n",
556 test_bit(STATUS_SCAN_HW
, &priv
->status
));
557 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_POWER_PMI:\t %d\n",
558 test_bit(STATUS_POWER_PMI
, &priv
->shrd
->status
));
559 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_FW_ERROR:\t %d\n",
560 test_bit(STATUS_FW_ERROR
, &priv
->shrd
->status
));
561 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
564 static ssize_t
iwl_dbgfs_rx_handlers_read(struct file
*file
,
565 char __user
*user_buf
,
566 size_t count
, loff_t
*ppos
) {
568 struct iwl_priv
*priv
= file
->private_data
;
573 int bufsz
= 24 * 64; /* 24 items * 64 char per item */
576 buf
= kzalloc(bufsz
, GFP_KERNEL
);
578 IWL_ERR(priv
, "Can not allocate Buffer\n");
582 for (cnt
= 0; cnt
< REPLY_MAX
; cnt
++) {
583 if (priv
->rx_handlers_stats
[cnt
] > 0)
584 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
585 "\tRx handler[%36s]:\t\t %u\n",
587 priv
->rx_handlers_stats
[cnt
]);
590 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
595 static ssize_t
iwl_dbgfs_rx_handlers_write(struct file
*file
,
596 const char __user
*user_buf
,
597 size_t count
, loff_t
*ppos
)
599 struct iwl_priv
*priv
= file
->private_data
;
605 memset(buf
, 0, sizeof(buf
));
606 buf_size
= min(count
, sizeof(buf
) - 1);
607 if (copy_from_user(buf
, user_buf
, buf_size
))
609 if (sscanf(buf
, "%x", &reset_flag
) != 1)
612 memset(&priv
->rx_handlers_stats
[0], 0,
613 sizeof(priv
->rx_handlers_stats
));
618 static ssize_t
iwl_dbgfs_qos_read(struct file
*file
, char __user
*user_buf
,
619 size_t count
, loff_t
*ppos
)
621 struct iwl_priv
*priv
= file
->private_data
;
622 struct iwl_rxon_context
*ctx
;
624 char buf
[256 * NUM_IWL_RXON_CTX
];
625 const size_t bufsz
= sizeof(buf
);
627 for_each_context(priv
, ctx
) {
628 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "context %d:\n",
630 for (i
= 0; i
< AC_NUM
; i
++) {
631 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
632 "\tcw_min\tcw_max\taifsn\ttxop\n");
633 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
634 "AC[%d]\t%u\t%u\t%u\t%u\n", i
,
635 ctx
->qos_data
.def_qos_parm
.ac
[i
].cw_min
,
636 ctx
->qos_data
.def_qos_parm
.ac
[i
].cw_max
,
637 ctx
->qos_data
.def_qos_parm
.ac
[i
].aifsn
,
638 ctx
->qos_data
.def_qos_parm
.ac
[i
].edca_txop
);
640 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
642 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
645 static ssize_t
iwl_dbgfs_thermal_throttling_read(struct file
*file
,
646 char __user
*user_buf
,
647 size_t count
, loff_t
*ppos
)
649 struct iwl_priv
*priv
= file
->private_data
;
650 struct iwl_tt_mgmt
*tt
= &priv
->thermal_throttle
;
651 struct iwl_tt_restriction
*restriction
;
654 const size_t bufsz
= sizeof(buf
);
656 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
657 "Thermal Throttling Mode: %s\n",
658 tt
->advanced_tt
? "Advance" : "Legacy");
659 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
660 "Thermal Throttling State: %d\n",
662 if (tt
->advanced_tt
) {
663 restriction
= tt
->restriction
+ tt
->state
;
664 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
666 restriction
->tx_stream
);
667 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
669 restriction
->rx_stream
);
670 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
674 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
677 static ssize_t
iwl_dbgfs_disable_ht40_write(struct file
*file
,
678 const char __user
*user_buf
,
679 size_t count
, loff_t
*ppos
)
681 struct iwl_priv
*priv
= file
->private_data
;
686 memset(buf
, 0, sizeof(buf
));
687 buf_size
= min(count
, sizeof(buf
) - 1);
688 if (copy_from_user(buf
, user_buf
, buf_size
))
690 if (sscanf(buf
, "%d", &ht40
) != 1)
692 if (!iwl_is_any_associated(priv
))
693 priv
->disable_ht40
= ht40
? true : false;
695 IWL_ERR(priv
, "Sta associated with AP - "
696 "Change to 40MHz channel support is not allowed\n");
703 static ssize_t
iwl_dbgfs_disable_ht40_read(struct file
*file
,
704 char __user
*user_buf
,
705 size_t count
, loff_t
*ppos
)
707 struct iwl_priv
*priv
= file
->private_data
;
710 const size_t bufsz
= sizeof(buf
);
712 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
713 "11n 40MHz Mode: %s\n",
714 priv
->disable_ht40
? "Disabled" : "Enabled");
715 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
718 static ssize_t
iwl_dbgfs_temperature_read(struct file
*file
,
719 char __user
*user_buf
,
720 size_t count
, loff_t
*ppos
)
722 struct iwl_priv
*priv
= file
->private_data
;
725 const size_t bufsz
= sizeof(buf
);
727 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%d\n", priv
->temperature
);
728 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
732 static ssize_t
iwl_dbgfs_sleep_level_override_write(struct file
*file
,
733 const char __user
*user_buf
,
734 size_t count
, loff_t
*ppos
)
736 struct iwl_priv
*priv
= file
->private_data
;
741 memset(buf
, 0, sizeof(buf
));
742 buf_size
= min(count
, sizeof(buf
) - 1);
743 if (copy_from_user(buf
, user_buf
, buf_size
))
746 if (sscanf(buf
, "%d", &value
) != 1)
750 * Our users expect 0 to be "CAM", but 0 isn't actually
751 * valid here. However, let's not confuse them and present
752 * IWL_POWER_INDEX_1 as "1", not "0".
759 if (value
!= -1 && (value
< 0 || value
>= IWL_POWER_NUM
))
762 if (!iwl_is_ready_rf(priv
))
765 priv
->power_data
.debug_sleep_level_override
= value
;
767 mutex_lock(&priv
->mutex
);
768 iwl_power_update_mode(priv
, true);
769 mutex_unlock(&priv
->mutex
);
774 static ssize_t
iwl_dbgfs_sleep_level_override_read(struct file
*file
,
775 char __user
*user_buf
,
776 size_t count
, loff_t
*ppos
)
778 struct iwl_priv
*priv
= file
->private_data
;
781 const size_t bufsz
= sizeof(buf
);
783 /* see the write function */
784 value
= priv
->power_data
.debug_sleep_level_override
;
788 pos
= scnprintf(buf
, bufsz
, "%d\n", value
);
789 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
792 static ssize_t
iwl_dbgfs_current_sleep_command_read(struct file
*file
,
793 char __user
*user_buf
,
794 size_t count
, loff_t
*ppos
)
796 struct iwl_priv
*priv
= file
->private_data
;
799 const size_t bufsz
= sizeof(buf
);
800 struct iwl_powertable_cmd
*cmd
= &priv
->power_data
.sleep_cmd
;
802 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
803 "flags: %#.2x\n", le16_to_cpu(cmd
->flags
));
804 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
805 "RX/TX timeout: %d/%d usec\n",
806 le32_to_cpu(cmd
->rx_data_timeout
),
807 le32_to_cpu(cmd
->tx_data_timeout
));
808 for (i
= 0; i
< IWL_POWER_VEC_SIZE
; i
++)
809 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
810 "sleep_interval[%d]: %d\n", i
,
811 le32_to_cpu(cmd
->sleep_interval
[i
]));
813 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
816 DEBUGFS_READ_WRITE_FILE_OPS(sram
);
817 DEBUGFS_READ_FILE_OPS(wowlan_sram
);
818 DEBUGFS_READ_FILE_OPS(nvm
);
819 DEBUGFS_READ_FILE_OPS(stations
);
820 DEBUGFS_READ_FILE_OPS(channels
);
821 DEBUGFS_READ_FILE_OPS(status
);
822 DEBUGFS_READ_WRITE_FILE_OPS(rx_handlers
);
823 DEBUGFS_READ_FILE_OPS(qos
);
824 DEBUGFS_READ_FILE_OPS(thermal_throttling
);
825 DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40
);
826 DEBUGFS_READ_FILE_OPS(temperature
);
827 DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override
);
828 DEBUGFS_READ_FILE_OPS(current_sleep_command
);
830 static ssize_t
iwl_dbgfs_traffic_log_read(struct file
*file
,
831 char __user
*user_buf
,
832 size_t count
, loff_t
*ppos
)
834 struct iwl_priv
*priv
= file
->private_data
;
835 int pos
= 0, ofs
= 0;
839 int bufsz
= ((IWL_TRAFFIC_ENTRIES
* IWL_TRAFFIC_ENTRY_SIZE
* 64) * 2) +
840 (cfg(priv
)->base_params
->num_of_queues
* 32 * 8) + 400;
844 buf
= kzalloc(bufsz
, GFP_KERNEL
);
846 IWL_ERR(priv
, "Can not allocate buffer\n");
849 if (priv
->tx_traffic
&& iwl_have_debug_level(IWL_DL_TX
)) {
850 ptr
= priv
->tx_traffic
;
851 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
852 "Tx Traffic idx: %u\n", priv
->tx_traffic_idx
);
853 for (cnt
= 0, ofs
= 0; cnt
< IWL_TRAFFIC_ENTRIES
; cnt
++) {
854 for (entry
= 0; entry
< IWL_TRAFFIC_ENTRY_SIZE
/ 16;
855 entry
++, ofs
+= 16) {
856 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
858 hex_dump_to_buffer(ptr
+ ofs
, 16, 16, 2,
859 buf
+ pos
, bufsz
- pos
, 0);
860 pos
+= strlen(buf
+ pos
);
867 if (priv
->rx_traffic
&& iwl_have_debug_level(IWL_DL_RX
)) {
868 ptr
= priv
->rx_traffic
;
869 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
870 "Rx Traffic idx: %u\n", priv
->rx_traffic_idx
);
871 for (cnt
= 0, ofs
= 0; cnt
< IWL_TRAFFIC_ENTRIES
; cnt
++) {
872 for (entry
= 0; entry
< IWL_TRAFFIC_ENTRY_SIZE
/ 16;
873 entry
++, ofs
+= 16) {
874 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
876 hex_dump_to_buffer(ptr
+ ofs
, 16, 16, 2,
877 buf
+ pos
, bufsz
- pos
, 0);
878 pos
+= strlen(buf
+ pos
);
885 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
890 static ssize_t
iwl_dbgfs_traffic_log_write(struct file
*file
,
891 const char __user
*user_buf
,
892 size_t count
, loff_t
*ppos
)
894 struct iwl_priv
*priv
= file
->private_data
;
899 memset(buf
, 0, sizeof(buf
));
900 buf_size
= min(count
, sizeof(buf
) - 1);
901 if (copy_from_user(buf
, user_buf
, buf_size
))
903 if (sscanf(buf
, "%d", &traffic_log
) != 1)
905 if (traffic_log
== 0)
906 iwl_reset_traffic_log(priv
);
911 static const char *fmt_value
= " %-30s %10u\n";
912 static const char *fmt_hex
= " %-30s 0x%02X\n";
913 static const char *fmt_table
= " %-30s %10u %10u %10u %10u\n";
914 static const char *fmt_header
=
915 "%-32s current cumulative delta max\n";
917 static int iwl_statistics_flag(struct iwl_priv
*priv
, char *buf
, int bufsz
)
922 lockdep_assert_held(&priv
->statistics
.lock
);
924 flag
= le32_to_cpu(priv
->statistics
.flag
);
926 p
+= scnprintf(buf
+ p
, bufsz
- p
, "Statistics Flag(0x%X):\n", flag
);
927 if (flag
& UCODE_STATISTICS_CLEAR_MSK
)
928 p
+= scnprintf(buf
+ p
, bufsz
- p
,
929 "\tStatistics have been cleared\n");
930 p
+= scnprintf(buf
+ p
, bufsz
- p
, "\tOperational Frequency: %s\n",
931 (flag
& UCODE_STATISTICS_FREQUENCY_MSK
)
932 ? "2.4 GHz" : "5.2 GHz");
933 p
+= scnprintf(buf
+ p
, bufsz
- p
, "\tTGj Narrow Band: %s\n",
934 (flag
& UCODE_STATISTICS_NARROW_BAND_MSK
)
935 ? "enabled" : "disabled");
940 static ssize_t
iwl_dbgfs_ucode_rx_stats_read(struct file
*file
,
941 char __user
*user_buf
,
942 size_t count
, loff_t
*ppos
)
944 struct iwl_priv
*priv
= file
->private_data
;
947 int bufsz
= sizeof(struct statistics_rx_phy
) * 40 +
948 sizeof(struct statistics_rx_non_phy
) * 40 +
949 sizeof(struct statistics_rx_ht_phy
) * 40 + 400;
951 struct statistics_rx_phy
*ofdm
, *accum_ofdm
, *delta_ofdm
, *max_ofdm
;
952 struct statistics_rx_phy
*cck
, *accum_cck
, *delta_cck
, *max_cck
;
953 struct statistics_rx_non_phy
*general
, *accum_general
;
954 struct statistics_rx_non_phy
*delta_general
, *max_general
;
955 struct statistics_rx_ht_phy
*ht
, *accum_ht
, *delta_ht
, *max_ht
;
957 if (!iwl_is_alive(priv
))
960 buf
= kzalloc(bufsz
, GFP_KERNEL
);
962 IWL_ERR(priv
, "Can not allocate Buffer\n");
967 * the statistic information display here is based on
968 * the last statistics notification from uCode
969 * might not reflect the current uCode activity
971 spin_lock_bh(&priv
->statistics
.lock
);
972 ofdm
= &priv
->statistics
.rx_ofdm
;
973 cck
= &priv
->statistics
.rx_cck
;
974 general
= &priv
->statistics
.rx_non_phy
;
975 ht
= &priv
->statistics
.rx_ofdm_ht
;
976 accum_ofdm
= &priv
->accum_stats
.rx_ofdm
;
977 accum_cck
= &priv
->accum_stats
.rx_cck
;
978 accum_general
= &priv
->accum_stats
.rx_non_phy
;
979 accum_ht
= &priv
->accum_stats
.rx_ofdm_ht
;
980 delta_ofdm
= &priv
->delta_stats
.rx_ofdm
;
981 delta_cck
= &priv
->delta_stats
.rx_cck
;
982 delta_general
= &priv
->delta_stats
.rx_non_phy
;
983 delta_ht
= &priv
->delta_stats
.rx_ofdm_ht
;
984 max_ofdm
= &priv
->max_delta_stats
.rx_ofdm
;
985 max_cck
= &priv
->max_delta_stats
.rx_cck
;
986 max_general
= &priv
->max_delta_stats
.rx_non_phy
;
987 max_ht
= &priv
->max_delta_stats
.rx_ofdm_ht
;
989 pos
+= iwl_statistics_flag(priv
, buf
, bufsz
);
990 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
991 fmt_header
, "Statistics_Rx - OFDM:");
992 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
993 fmt_table
, "ina_cnt:",
994 le32_to_cpu(ofdm
->ina_cnt
),
996 delta_ofdm
->ina_cnt
, max_ofdm
->ina_cnt
);
997 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
998 fmt_table
, "fina_cnt:",
999 le32_to_cpu(ofdm
->fina_cnt
), accum_ofdm
->fina_cnt
,
1000 delta_ofdm
->fina_cnt
, max_ofdm
->fina_cnt
);
1001 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1002 fmt_table
, "plcp_err:",
1003 le32_to_cpu(ofdm
->plcp_err
), accum_ofdm
->plcp_err
,
1004 delta_ofdm
->plcp_err
, max_ofdm
->plcp_err
);
1005 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1006 fmt_table
, "crc32_err:",
1007 le32_to_cpu(ofdm
->crc32_err
), accum_ofdm
->crc32_err
,
1008 delta_ofdm
->crc32_err
, max_ofdm
->crc32_err
);
1009 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1010 fmt_table
, "overrun_err:",
1011 le32_to_cpu(ofdm
->overrun_err
),
1012 accum_ofdm
->overrun_err
, delta_ofdm
->overrun_err
,
1013 max_ofdm
->overrun_err
);
1014 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1015 fmt_table
, "early_overrun_err:",
1016 le32_to_cpu(ofdm
->early_overrun_err
),
1017 accum_ofdm
->early_overrun_err
,
1018 delta_ofdm
->early_overrun_err
,
1019 max_ofdm
->early_overrun_err
);
1020 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1021 fmt_table
, "crc32_good:",
1022 le32_to_cpu(ofdm
->crc32_good
),
1023 accum_ofdm
->crc32_good
, delta_ofdm
->crc32_good
,
1024 max_ofdm
->crc32_good
);
1025 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1026 fmt_table
, "false_alarm_cnt:",
1027 le32_to_cpu(ofdm
->false_alarm_cnt
),
1028 accum_ofdm
->false_alarm_cnt
,
1029 delta_ofdm
->false_alarm_cnt
,
1030 max_ofdm
->false_alarm_cnt
);
1031 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1032 fmt_table
, "fina_sync_err_cnt:",
1033 le32_to_cpu(ofdm
->fina_sync_err_cnt
),
1034 accum_ofdm
->fina_sync_err_cnt
,
1035 delta_ofdm
->fina_sync_err_cnt
,
1036 max_ofdm
->fina_sync_err_cnt
);
1037 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1038 fmt_table
, "sfd_timeout:",
1039 le32_to_cpu(ofdm
->sfd_timeout
),
1040 accum_ofdm
->sfd_timeout
, delta_ofdm
->sfd_timeout
,
1041 max_ofdm
->sfd_timeout
);
1042 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1043 fmt_table
, "fina_timeout:",
1044 le32_to_cpu(ofdm
->fina_timeout
),
1045 accum_ofdm
->fina_timeout
, delta_ofdm
->fina_timeout
,
1046 max_ofdm
->fina_timeout
);
1047 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1048 fmt_table
, "unresponded_rts:",
1049 le32_to_cpu(ofdm
->unresponded_rts
),
1050 accum_ofdm
->unresponded_rts
,
1051 delta_ofdm
->unresponded_rts
,
1052 max_ofdm
->unresponded_rts
);
1053 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1054 fmt_table
, "rxe_frame_lmt_ovrun:",
1055 le32_to_cpu(ofdm
->rxe_frame_limit_overrun
),
1056 accum_ofdm
->rxe_frame_limit_overrun
,
1057 delta_ofdm
->rxe_frame_limit_overrun
,
1058 max_ofdm
->rxe_frame_limit_overrun
);
1059 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1060 fmt_table
, "sent_ack_cnt:",
1061 le32_to_cpu(ofdm
->sent_ack_cnt
),
1062 accum_ofdm
->sent_ack_cnt
, delta_ofdm
->sent_ack_cnt
,
1063 max_ofdm
->sent_ack_cnt
);
1064 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1065 fmt_table
, "sent_cts_cnt:",
1066 le32_to_cpu(ofdm
->sent_cts_cnt
),
1067 accum_ofdm
->sent_cts_cnt
, delta_ofdm
->sent_cts_cnt
,
1068 max_ofdm
->sent_cts_cnt
);
1069 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1070 fmt_table
, "sent_ba_rsp_cnt:",
1071 le32_to_cpu(ofdm
->sent_ba_rsp_cnt
),
1072 accum_ofdm
->sent_ba_rsp_cnt
,
1073 delta_ofdm
->sent_ba_rsp_cnt
,
1074 max_ofdm
->sent_ba_rsp_cnt
);
1075 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1076 fmt_table
, "dsp_self_kill:",
1077 le32_to_cpu(ofdm
->dsp_self_kill
),
1078 accum_ofdm
->dsp_self_kill
,
1079 delta_ofdm
->dsp_self_kill
,
1080 max_ofdm
->dsp_self_kill
);
1081 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1082 fmt_table
, "mh_format_err:",
1083 le32_to_cpu(ofdm
->mh_format_err
),
1084 accum_ofdm
->mh_format_err
,
1085 delta_ofdm
->mh_format_err
,
1086 max_ofdm
->mh_format_err
);
1087 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1088 fmt_table
, "re_acq_main_rssi_sum:",
1089 le32_to_cpu(ofdm
->re_acq_main_rssi_sum
),
1090 accum_ofdm
->re_acq_main_rssi_sum
,
1091 delta_ofdm
->re_acq_main_rssi_sum
,
1092 max_ofdm
->re_acq_main_rssi_sum
);
1094 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1095 fmt_header
, "Statistics_Rx - CCK:");
1096 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1097 fmt_table
, "ina_cnt:",
1098 le32_to_cpu(cck
->ina_cnt
), accum_cck
->ina_cnt
,
1099 delta_cck
->ina_cnt
, max_cck
->ina_cnt
);
1100 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1101 fmt_table
, "fina_cnt:",
1102 le32_to_cpu(cck
->fina_cnt
), accum_cck
->fina_cnt
,
1103 delta_cck
->fina_cnt
, max_cck
->fina_cnt
);
1104 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1105 fmt_table
, "plcp_err:",
1106 le32_to_cpu(cck
->plcp_err
), accum_cck
->plcp_err
,
1107 delta_cck
->plcp_err
, max_cck
->plcp_err
);
1108 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1109 fmt_table
, "crc32_err:",
1110 le32_to_cpu(cck
->crc32_err
), accum_cck
->crc32_err
,
1111 delta_cck
->crc32_err
, max_cck
->crc32_err
);
1112 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1113 fmt_table
, "overrun_err:",
1114 le32_to_cpu(cck
->overrun_err
),
1115 accum_cck
->overrun_err
, delta_cck
->overrun_err
,
1116 max_cck
->overrun_err
);
1117 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1118 fmt_table
, "early_overrun_err:",
1119 le32_to_cpu(cck
->early_overrun_err
),
1120 accum_cck
->early_overrun_err
,
1121 delta_cck
->early_overrun_err
,
1122 max_cck
->early_overrun_err
);
1123 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1124 fmt_table
, "crc32_good:",
1125 le32_to_cpu(cck
->crc32_good
), accum_cck
->crc32_good
,
1126 delta_cck
->crc32_good
, max_cck
->crc32_good
);
1127 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1128 fmt_table
, "false_alarm_cnt:",
1129 le32_to_cpu(cck
->false_alarm_cnt
),
1130 accum_cck
->false_alarm_cnt
,
1131 delta_cck
->false_alarm_cnt
, max_cck
->false_alarm_cnt
);
1132 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1133 fmt_table
, "fina_sync_err_cnt:",
1134 le32_to_cpu(cck
->fina_sync_err_cnt
),
1135 accum_cck
->fina_sync_err_cnt
,
1136 delta_cck
->fina_sync_err_cnt
,
1137 max_cck
->fina_sync_err_cnt
);
1138 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1139 fmt_table
, "sfd_timeout:",
1140 le32_to_cpu(cck
->sfd_timeout
),
1141 accum_cck
->sfd_timeout
, delta_cck
->sfd_timeout
,
1142 max_cck
->sfd_timeout
);
1143 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1144 fmt_table
, "fina_timeout:",
1145 le32_to_cpu(cck
->fina_timeout
),
1146 accum_cck
->fina_timeout
, delta_cck
->fina_timeout
,
1147 max_cck
->fina_timeout
);
1148 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1149 fmt_table
, "unresponded_rts:",
1150 le32_to_cpu(cck
->unresponded_rts
),
1151 accum_cck
->unresponded_rts
, delta_cck
->unresponded_rts
,
1152 max_cck
->unresponded_rts
);
1153 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1154 fmt_table
, "rxe_frame_lmt_ovrun:",
1155 le32_to_cpu(cck
->rxe_frame_limit_overrun
),
1156 accum_cck
->rxe_frame_limit_overrun
,
1157 delta_cck
->rxe_frame_limit_overrun
,
1158 max_cck
->rxe_frame_limit_overrun
);
1159 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1160 fmt_table
, "sent_ack_cnt:",
1161 le32_to_cpu(cck
->sent_ack_cnt
),
1162 accum_cck
->sent_ack_cnt
, delta_cck
->sent_ack_cnt
,
1163 max_cck
->sent_ack_cnt
);
1164 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1165 fmt_table
, "sent_cts_cnt:",
1166 le32_to_cpu(cck
->sent_cts_cnt
),
1167 accum_cck
->sent_cts_cnt
, delta_cck
->sent_cts_cnt
,
1168 max_cck
->sent_cts_cnt
);
1169 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1170 fmt_table
, "sent_ba_rsp_cnt:",
1171 le32_to_cpu(cck
->sent_ba_rsp_cnt
),
1172 accum_cck
->sent_ba_rsp_cnt
,
1173 delta_cck
->sent_ba_rsp_cnt
,
1174 max_cck
->sent_ba_rsp_cnt
);
1175 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1176 fmt_table
, "dsp_self_kill:",
1177 le32_to_cpu(cck
->dsp_self_kill
),
1178 accum_cck
->dsp_self_kill
, delta_cck
->dsp_self_kill
,
1179 max_cck
->dsp_self_kill
);
1180 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1181 fmt_table
, "mh_format_err:",
1182 le32_to_cpu(cck
->mh_format_err
),
1183 accum_cck
->mh_format_err
, delta_cck
->mh_format_err
,
1184 max_cck
->mh_format_err
);
1185 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1186 fmt_table
, "re_acq_main_rssi_sum:",
1187 le32_to_cpu(cck
->re_acq_main_rssi_sum
),
1188 accum_cck
->re_acq_main_rssi_sum
,
1189 delta_cck
->re_acq_main_rssi_sum
,
1190 max_cck
->re_acq_main_rssi_sum
);
1192 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1193 fmt_header
, "Statistics_Rx - GENERAL:");
1194 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1195 fmt_table
, "bogus_cts:",
1196 le32_to_cpu(general
->bogus_cts
),
1197 accum_general
->bogus_cts
, delta_general
->bogus_cts
,
1198 max_general
->bogus_cts
);
1199 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1200 fmt_table
, "bogus_ack:",
1201 le32_to_cpu(general
->bogus_ack
),
1202 accum_general
->bogus_ack
, delta_general
->bogus_ack
,
1203 max_general
->bogus_ack
);
1204 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1205 fmt_table
, "non_bssid_frames:",
1206 le32_to_cpu(general
->non_bssid_frames
),
1207 accum_general
->non_bssid_frames
,
1208 delta_general
->non_bssid_frames
,
1209 max_general
->non_bssid_frames
);
1210 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1211 fmt_table
, "filtered_frames:",
1212 le32_to_cpu(general
->filtered_frames
),
1213 accum_general
->filtered_frames
,
1214 delta_general
->filtered_frames
,
1215 max_general
->filtered_frames
);
1216 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1217 fmt_table
, "non_channel_beacons:",
1218 le32_to_cpu(general
->non_channel_beacons
),
1219 accum_general
->non_channel_beacons
,
1220 delta_general
->non_channel_beacons
,
1221 max_general
->non_channel_beacons
);
1222 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1223 fmt_table
, "channel_beacons:",
1224 le32_to_cpu(general
->channel_beacons
),
1225 accum_general
->channel_beacons
,
1226 delta_general
->channel_beacons
,
1227 max_general
->channel_beacons
);
1228 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1229 fmt_table
, "num_missed_bcon:",
1230 le32_to_cpu(general
->num_missed_bcon
),
1231 accum_general
->num_missed_bcon
,
1232 delta_general
->num_missed_bcon
,
1233 max_general
->num_missed_bcon
);
1234 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1235 fmt_table
, "adc_rx_saturation_time:",
1236 le32_to_cpu(general
->adc_rx_saturation_time
),
1237 accum_general
->adc_rx_saturation_time
,
1238 delta_general
->adc_rx_saturation_time
,
1239 max_general
->adc_rx_saturation_time
);
1240 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1241 fmt_table
, "ina_detect_search_tm:",
1242 le32_to_cpu(general
->ina_detection_search_time
),
1243 accum_general
->ina_detection_search_time
,
1244 delta_general
->ina_detection_search_time
,
1245 max_general
->ina_detection_search_time
);
1246 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1247 fmt_table
, "beacon_silence_rssi_a:",
1248 le32_to_cpu(general
->beacon_silence_rssi_a
),
1249 accum_general
->beacon_silence_rssi_a
,
1250 delta_general
->beacon_silence_rssi_a
,
1251 max_general
->beacon_silence_rssi_a
);
1252 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1253 fmt_table
, "beacon_silence_rssi_b:",
1254 le32_to_cpu(general
->beacon_silence_rssi_b
),
1255 accum_general
->beacon_silence_rssi_b
,
1256 delta_general
->beacon_silence_rssi_b
,
1257 max_general
->beacon_silence_rssi_b
);
1258 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1259 fmt_table
, "beacon_silence_rssi_c:",
1260 le32_to_cpu(general
->beacon_silence_rssi_c
),
1261 accum_general
->beacon_silence_rssi_c
,
1262 delta_general
->beacon_silence_rssi_c
,
1263 max_general
->beacon_silence_rssi_c
);
1264 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1265 fmt_table
, "interference_data_flag:",
1266 le32_to_cpu(general
->interference_data_flag
),
1267 accum_general
->interference_data_flag
,
1268 delta_general
->interference_data_flag
,
1269 max_general
->interference_data_flag
);
1270 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1271 fmt_table
, "channel_load:",
1272 le32_to_cpu(general
->channel_load
),
1273 accum_general
->channel_load
,
1274 delta_general
->channel_load
,
1275 max_general
->channel_load
);
1276 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1277 fmt_table
, "dsp_false_alarms:",
1278 le32_to_cpu(general
->dsp_false_alarms
),
1279 accum_general
->dsp_false_alarms
,
1280 delta_general
->dsp_false_alarms
,
1281 max_general
->dsp_false_alarms
);
1282 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1283 fmt_table
, "beacon_rssi_a:",
1284 le32_to_cpu(general
->beacon_rssi_a
),
1285 accum_general
->beacon_rssi_a
,
1286 delta_general
->beacon_rssi_a
,
1287 max_general
->beacon_rssi_a
);
1288 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1289 fmt_table
, "beacon_rssi_b:",
1290 le32_to_cpu(general
->beacon_rssi_b
),
1291 accum_general
->beacon_rssi_b
,
1292 delta_general
->beacon_rssi_b
,
1293 max_general
->beacon_rssi_b
);
1294 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1295 fmt_table
, "beacon_rssi_c:",
1296 le32_to_cpu(general
->beacon_rssi_c
),
1297 accum_general
->beacon_rssi_c
,
1298 delta_general
->beacon_rssi_c
,
1299 max_general
->beacon_rssi_c
);
1300 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1301 fmt_table
, "beacon_energy_a:",
1302 le32_to_cpu(general
->beacon_energy_a
),
1303 accum_general
->beacon_energy_a
,
1304 delta_general
->beacon_energy_a
,
1305 max_general
->beacon_energy_a
);
1306 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1307 fmt_table
, "beacon_energy_b:",
1308 le32_to_cpu(general
->beacon_energy_b
),
1309 accum_general
->beacon_energy_b
,
1310 delta_general
->beacon_energy_b
,
1311 max_general
->beacon_energy_b
);
1312 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1313 fmt_table
, "beacon_energy_c:",
1314 le32_to_cpu(general
->beacon_energy_c
),
1315 accum_general
->beacon_energy_c
,
1316 delta_general
->beacon_energy_c
,
1317 max_general
->beacon_energy_c
);
1319 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1320 fmt_header
, "Statistics_Rx - OFDM_HT:");
1321 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1322 fmt_table
, "plcp_err:",
1323 le32_to_cpu(ht
->plcp_err
), accum_ht
->plcp_err
,
1324 delta_ht
->plcp_err
, max_ht
->plcp_err
);
1325 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1326 fmt_table
, "overrun_err:",
1327 le32_to_cpu(ht
->overrun_err
), accum_ht
->overrun_err
,
1328 delta_ht
->overrun_err
, max_ht
->overrun_err
);
1329 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1330 fmt_table
, "early_overrun_err:",
1331 le32_to_cpu(ht
->early_overrun_err
),
1332 accum_ht
->early_overrun_err
,
1333 delta_ht
->early_overrun_err
,
1334 max_ht
->early_overrun_err
);
1335 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1336 fmt_table
, "crc32_good:",
1337 le32_to_cpu(ht
->crc32_good
), accum_ht
->crc32_good
,
1338 delta_ht
->crc32_good
, max_ht
->crc32_good
);
1339 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1340 fmt_table
, "crc32_err:",
1341 le32_to_cpu(ht
->crc32_err
), accum_ht
->crc32_err
,
1342 delta_ht
->crc32_err
, max_ht
->crc32_err
);
1343 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1344 fmt_table
, "mh_format_err:",
1345 le32_to_cpu(ht
->mh_format_err
),
1346 accum_ht
->mh_format_err
,
1347 delta_ht
->mh_format_err
, max_ht
->mh_format_err
);
1348 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1349 fmt_table
, "agg_crc32_good:",
1350 le32_to_cpu(ht
->agg_crc32_good
),
1351 accum_ht
->agg_crc32_good
,
1352 delta_ht
->agg_crc32_good
, max_ht
->agg_crc32_good
);
1353 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1354 fmt_table
, "agg_mpdu_cnt:",
1355 le32_to_cpu(ht
->agg_mpdu_cnt
),
1356 accum_ht
->agg_mpdu_cnt
,
1357 delta_ht
->agg_mpdu_cnt
, max_ht
->agg_mpdu_cnt
);
1358 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1359 fmt_table
, "agg_cnt:",
1360 le32_to_cpu(ht
->agg_cnt
), accum_ht
->agg_cnt
,
1361 delta_ht
->agg_cnt
, max_ht
->agg_cnt
);
1362 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1363 fmt_table
, "unsupport_mcs:",
1364 le32_to_cpu(ht
->unsupport_mcs
),
1365 accum_ht
->unsupport_mcs
,
1366 delta_ht
->unsupport_mcs
, max_ht
->unsupport_mcs
);
1368 spin_unlock_bh(&priv
->statistics
.lock
);
1370 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1375 static ssize_t
iwl_dbgfs_ucode_tx_stats_read(struct file
*file
,
1376 char __user
*user_buf
,
1377 size_t count
, loff_t
*ppos
)
1379 struct iwl_priv
*priv
= file
->private_data
;
1382 int bufsz
= (sizeof(struct statistics_tx
) * 48) + 250;
1384 struct statistics_tx
*tx
, *accum_tx
, *delta_tx
, *max_tx
;
1386 if (!iwl_is_alive(priv
))
1389 buf
= kzalloc(bufsz
, GFP_KERNEL
);
1391 IWL_ERR(priv
, "Can not allocate Buffer\n");
1395 /* the statistic information display here is based on
1396 * the last statistics notification from uCode
1397 * might not reflect the current uCode activity
1399 spin_lock_bh(&priv
->statistics
.lock
);
1401 tx
= &priv
->statistics
.tx
;
1402 accum_tx
= &priv
->accum_stats
.tx
;
1403 delta_tx
= &priv
->delta_stats
.tx
;
1404 max_tx
= &priv
->max_delta_stats
.tx
;
1406 pos
+= iwl_statistics_flag(priv
, buf
, bufsz
);
1407 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1408 fmt_header
, "Statistics_Tx:");
1409 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1410 fmt_table
, "preamble:",
1411 le32_to_cpu(tx
->preamble_cnt
),
1412 accum_tx
->preamble_cnt
,
1413 delta_tx
->preamble_cnt
, max_tx
->preamble_cnt
);
1414 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1415 fmt_table
, "rx_detected_cnt:",
1416 le32_to_cpu(tx
->rx_detected_cnt
),
1417 accum_tx
->rx_detected_cnt
,
1418 delta_tx
->rx_detected_cnt
, max_tx
->rx_detected_cnt
);
1419 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1420 fmt_table
, "bt_prio_defer_cnt:",
1421 le32_to_cpu(tx
->bt_prio_defer_cnt
),
1422 accum_tx
->bt_prio_defer_cnt
,
1423 delta_tx
->bt_prio_defer_cnt
,
1424 max_tx
->bt_prio_defer_cnt
);
1425 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1426 fmt_table
, "bt_prio_kill_cnt:",
1427 le32_to_cpu(tx
->bt_prio_kill_cnt
),
1428 accum_tx
->bt_prio_kill_cnt
,
1429 delta_tx
->bt_prio_kill_cnt
,
1430 max_tx
->bt_prio_kill_cnt
);
1431 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1432 fmt_table
, "few_bytes_cnt:",
1433 le32_to_cpu(tx
->few_bytes_cnt
),
1434 accum_tx
->few_bytes_cnt
,
1435 delta_tx
->few_bytes_cnt
, max_tx
->few_bytes_cnt
);
1436 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1437 fmt_table
, "cts_timeout:",
1438 le32_to_cpu(tx
->cts_timeout
), accum_tx
->cts_timeout
,
1439 delta_tx
->cts_timeout
, max_tx
->cts_timeout
);
1440 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1441 fmt_table
, "ack_timeout:",
1442 le32_to_cpu(tx
->ack_timeout
),
1443 accum_tx
->ack_timeout
,
1444 delta_tx
->ack_timeout
, max_tx
->ack_timeout
);
1445 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1446 fmt_table
, "expected_ack_cnt:",
1447 le32_to_cpu(tx
->expected_ack_cnt
),
1448 accum_tx
->expected_ack_cnt
,
1449 delta_tx
->expected_ack_cnt
,
1450 max_tx
->expected_ack_cnt
);
1451 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1452 fmt_table
, "actual_ack_cnt:",
1453 le32_to_cpu(tx
->actual_ack_cnt
),
1454 accum_tx
->actual_ack_cnt
,
1455 delta_tx
->actual_ack_cnt
,
1456 max_tx
->actual_ack_cnt
);
1457 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1458 fmt_table
, "dump_msdu_cnt:",
1459 le32_to_cpu(tx
->dump_msdu_cnt
),
1460 accum_tx
->dump_msdu_cnt
,
1461 delta_tx
->dump_msdu_cnt
,
1462 max_tx
->dump_msdu_cnt
);
1463 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1464 fmt_table
, "abort_nxt_frame_mismatch:",
1465 le32_to_cpu(tx
->burst_abort_next_frame_mismatch_cnt
),
1466 accum_tx
->burst_abort_next_frame_mismatch_cnt
,
1467 delta_tx
->burst_abort_next_frame_mismatch_cnt
,
1468 max_tx
->burst_abort_next_frame_mismatch_cnt
);
1469 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1470 fmt_table
, "abort_missing_nxt_frame:",
1471 le32_to_cpu(tx
->burst_abort_missing_next_frame_cnt
),
1472 accum_tx
->burst_abort_missing_next_frame_cnt
,
1473 delta_tx
->burst_abort_missing_next_frame_cnt
,
1474 max_tx
->burst_abort_missing_next_frame_cnt
);
1475 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1476 fmt_table
, "cts_timeout_collision:",
1477 le32_to_cpu(tx
->cts_timeout_collision
),
1478 accum_tx
->cts_timeout_collision
,
1479 delta_tx
->cts_timeout_collision
,
1480 max_tx
->cts_timeout_collision
);
1481 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1482 fmt_table
, "ack_ba_timeout_collision:",
1483 le32_to_cpu(tx
->ack_or_ba_timeout_collision
),
1484 accum_tx
->ack_or_ba_timeout_collision
,
1485 delta_tx
->ack_or_ba_timeout_collision
,
1486 max_tx
->ack_or_ba_timeout_collision
);
1487 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1488 fmt_table
, "agg ba_timeout:",
1489 le32_to_cpu(tx
->agg
.ba_timeout
),
1490 accum_tx
->agg
.ba_timeout
,
1491 delta_tx
->agg
.ba_timeout
,
1492 max_tx
->agg
.ba_timeout
);
1493 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1494 fmt_table
, "agg ba_resched_frames:",
1495 le32_to_cpu(tx
->agg
.ba_reschedule_frames
),
1496 accum_tx
->agg
.ba_reschedule_frames
,
1497 delta_tx
->agg
.ba_reschedule_frames
,
1498 max_tx
->agg
.ba_reschedule_frames
);
1499 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1500 fmt_table
, "agg scd_query_agg_frame:",
1501 le32_to_cpu(tx
->agg
.scd_query_agg_frame_cnt
),
1502 accum_tx
->agg
.scd_query_agg_frame_cnt
,
1503 delta_tx
->agg
.scd_query_agg_frame_cnt
,
1504 max_tx
->agg
.scd_query_agg_frame_cnt
);
1505 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1506 fmt_table
, "agg scd_query_no_agg:",
1507 le32_to_cpu(tx
->agg
.scd_query_no_agg
),
1508 accum_tx
->agg
.scd_query_no_agg
,
1509 delta_tx
->agg
.scd_query_no_agg
,
1510 max_tx
->agg
.scd_query_no_agg
);
1511 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1512 fmt_table
, "agg scd_query_agg:",
1513 le32_to_cpu(tx
->agg
.scd_query_agg
),
1514 accum_tx
->agg
.scd_query_agg
,
1515 delta_tx
->agg
.scd_query_agg
,
1516 max_tx
->agg
.scd_query_agg
);
1517 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1518 fmt_table
, "agg scd_query_mismatch:",
1519 le32_to_cpu(tx
->agg
.scd_query_mismatch
),
1520 accum_tx
->agg
.scd_query_mismatch
,
1521 delta_tx
->agg
.scd_query_mismatch
,
1522 max_tx
->agg
.scd_query_mismatch
);
1523 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1524 fmt_table
, "agg frame_not_ready:",
1525 le32_to_cpu(tx
->agg
.frame_not_ready
),
1526 accum_tx
->agg
.frame_not_ready
,
1527 delta_tx
->agg
.frame_not_ready
,
1528 max_tx
->agg
.frame_not_ready
);
1529 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1530 fmt_table
, "agg underrun:",
1531 le32_to_cpu(tx
->agg
.underrun
),
1532 accum_tx
->agg
.underrun
,
1533 delta_tx
->agg
.underrun
, max_tx
->agg
.underrun
);
1534 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1535 fmt_table
, "agg bt_prio_kill:",
1536 le32_to_cpu(tx
->agg
.bt_prio_kill
),
1537 accum_tx
->agg
.bt_prio_kill
,
1538 delta_tx
->agg
.bt_prio_kill
,
1539 max_tx
->agg
.bt_prio_kill
);
1540 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1541 fmt_table
, "agg rx_ba_rsp_cnt:",
1542 le32_to_cpu(tx
->agg
.rx_ba_rsp_cnt
),
1543 accum_tx
->agg
.rx_ba_rsp_cnt
,
1544 delta_tx
->agg
.rx_ba_rsp_cnt
,
1545 max_tx
->agg
.rx_ba_rsp_cnt
);
1547 if (tx
->tx_power
.ant_a
|| tx
->tx_power
.ant_b
|| tx
->tx_power
.ant_c
) {
1548 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1549 "tx power: (1/2 dB step)\n");
1550 if ((hw_params(priv
).valid_tx_ant
& ANT_A
) &&
1552 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1553 fmt_hex
, "antenna A:",
1554 tx
->tx_power
.ant_a
);
1555 if ((hw_params(priv
).valid_tx_ant
& ANT_B
) &&
1557 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1558 fmt_hex
, "antenna B:",
1559 tx
->tx_power
.ant_b
);
1560 if ((hw_params(priv
).valid_tx_ant
& ANT_C
) &&
1562 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1563 fmt_hex
, "antenna C:",
1564 tx
->tx_power
.ant_c
);
1567 spin_unlock_bh(&priv
->statistics
.lock
);
1569 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1574 static ssize_t
iwl_dbgfs_ucode_general_stats_read(struct file
*file
,
1575 char __user
*user_buf
,
1576 size_t count
, loff_t
*ppos
)
1578 struct iwl_priv
*priv
= file
->private_data
;
1581 int bufsz
= sizeof(struct statistics_general
) * 10 + 300;
1583 struct statistics_general_common
*general
, *accum_general
;
1584 struct statistics_general_common
*delta_general
, *max_general
;
1585 struct statistics_dbg
*dbg
, *accum_dbg
, *delta_dbg
, *max_dbg
;
1586 struct statistics_div
*div
, *accum_div
, *delta_div
, *max_div
;
1588 if (!iwl_is_alive(priv
))
1591 buf
= kzalloc(bufsz
, GFP_KERNEL
);
1593 IWL_ERR(priv
, "Can not allocate Buffer\n");
1597 /* the statistic information display here is based on
1598 * the last statistics notification from uCode
1599 * might not reflect the current uCode activity
1602 spin_lock_bh(&priv
->statistics
.lock
);
1604 general
= &priv
->statistics
.common
;
1605 dbg
= &priv
->statistics
.common
.dbg
;
1606 div
= &priv
->statistics
.common
.div
;
1607 accum_general
= &priv
->accum_stats
.common
;
1608 accum_dbg
= &priv
->accum_stats
.common
.dbg
;
1609 accum_div
= &priv
->accum_stats
.common
.div
;
1610 delta_general
= &priv
->delta_stats
.common
;
1611 max_general
= &priv
->max_delta_stats
.common
;
1612 delta_dbg
= &priv
->delta_stats
.common
.dbg
;
1613 max_dbg
= &priv
->max_delta_stats
.common
.dbg
;
1614 delta_div
= &priv
->delta_stats
.common
.div
;
1615 max_div
= &priv
->max_delta_stats
.common
.div
;
1617 pos
+= iwl_statistics_flag(priv
, buf
, bufsz
);
1618 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1619 fmt_header
, "Statistics_General:");
1620 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1621 fmt_value
, "temperature:",
1622 le32_to_cpu(general
->temperature
));
1623 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1624 fmt_value
, "temperature_m:",
1625 le32_to_cpu(general
->temperature_m
));
1626 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1627 fmt_value
, "ttl_timestamp:",
1628 le32_to_cpu(general
->ttl_timestamp
));
1629 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1630 fmt_table
, "burst_check:",
1631 le32_to_cpu(dbg
->burst_check
),
1632 accum_dbg
->burst_check
,
1633 delta_dbg
->burst_check
, max_dbg
->burst_check
);
1634 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1635 fmt_table
, "burst_count:",
1636 le32_to_cpu(dbg
->burst_count
),
1637 accum_dbg
->burst_count
,
1638 delta_dbg
->burst_count
, max_dbg
->burst_count
);
1639 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1640 fmt_table
, "wait_for_silence_timeout_count:",
1641 le32_to_cpu(dbg
->wait_for_silence_timeout_cnt
),
1642 accum_dbg
->wait_for_silence_timeout_cnt
,
1643 delta_dbg
->wait_for_silence_timeout_cnt
,
1644 max_dbg
->wait_for_silence_timeout_cnt
);
1645 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1646 fmt_table
, "sleep_time:",
1647 le32_to_cpu(general
->sleep_time
),
1648 accum_general
->sleep_time
,
1649 delta_general
->sleep_time
, max_general
->sleep_time
);
1650 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1651 fmt_table
, "slots_out:",
1652 le32_to_cpu(general
->slots_out
),
1653 accum_general
->slots_out
,
1654 delta_general
->slots_out
, max_general
->slots_out
);
1655 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1656 fmt_table
, "slots_idle:",
1657 le32_to_cpu(general
->slots_idle
),
1658 accum_general
->slots_idle
,
1659 delta_general
->slots_idle
, max_general
->slots_idle
);
1660 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1661 fmt_table
, "tx_on_a:",
1662 le32_to_cpu(div
->tx_on_a
), accum_div
->tx_on_a
,
1663 delta_div
->tx_on_a
, max_div
->tx_on_a
);
1664 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1665 fmt_table
, "tx_on_b:",
1666 le32_to_cpu(div
->tx_on_b
), accum_div
->tx_on_b
,
1667 delta_div
->tx_on_b
, max_div
->tx_on_b
);
1668 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1669 fmt_table
, "exec_time:",
1670 le32_to_cpu(div
->exec_time
), accum_div
->exec_time
,
1671 delta_div
->exec_time
, max_div
->exec_time
);
1672 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1673 fmt_table
, "probe_time:",
1674 le32_to_cpu(div
->probe_time
), accum_div
->probe_time
,
1675 delta_div
->probe_time
, max_div
->probe_time
);
1676 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1677 fmt_table
, "rx_enable_counter:",
1678 le32_to_cpu(general
->rx_enable_counter
),
1679 accum_general
->rx_enable_counter
,
1680 delta_general
->rx_enable_counter
,
1681 max_general
->rx_enable_counter
);
1682 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1683 fmt_table
, "num_of_sos_states:",
1684 le32_to_cpu(general
->num_of_sos_states
),
1685 accum_general
->num_of_sos_states
,
1686 delta_general
->num_of_sos_states
,
1687 max_general
->num_of_sos_states
);
1689 spin_unlock_bh(&priv
->statistics
.lock
);
1691 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1696 static ssize_t
iwl_dbgfs_ucode_bt_stats_read(struct file
*file
,
1697 char __user
*user_buf
,
1698 size_t count
, loff_t
*ppos
)
1700 struct iwl_priv
*priv
= (struct iwl_priv
*)file
->private_data
;
1703 int bufsz
= (sizeof(struct statistics_bt_activity
) * 24) + 200;
1705 struct statistics_bt_activity
*bt
, *accum_bt
;
1707 if (!iwl_is_alive(priv
))
1710 if (!priv
->bt_enable_flag
)
1713 /* make request to uCode to retrieve statistics information */
1714 mutex_lock(&priv
->mutex
);
1715 ret
= iwl_send_statistics_request(priv
, CMD_SYNC
, false);
1716 mutex_unlock(&priv
->mutex
);
1720 "Error sending statistics request: %zd\n", ret
);
1723 buf
= kzalloc(bufsz
, GFP_KERNEL
);
1725 IWL_ERR(priv
, "Can not allocate Buffer\n");
1730 * the statistic information display here is based on
1731 * the last statistics notification from uCode
1732 * might not reflect the current uCode activity
1735 spin_lock_bh(&priv
->statistics
.lock
);
1737 bt
= &priv
->statistics
.bt_activity
;
1738 accum_bt
= &priv
->accum_stats
.bt_activity
;
1740 pos
+= iwl_statistics_flag(priv
, buf
, bufsz
);
1741 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Statistics_BT:\n");
1742 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1743 "\t\t\tcurrent\t\t\taccumulative\n");
1744 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1745 "hi_priority_tx_req_cnt:\t\t%u\t\t\t%u\n",
1746 le32_to_cpu(bt
->hi_priority_tx_req_cnt
),
1747 accum_bt
->hi_priority_tx_req_cnt
);
1748 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1749 "hi_priority_tx_denied_cnt:\t%u\t\t\t%u\n",
1750 le32_to_cpu(bt
->hi_priority_tx_denied_cnt
),
1751 accum_bt
->hi_priority_tx_denied_cnt
);
1752 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1753 "lo_priority_tx_req_cnt:\t\t%u\t\t\t%u\n",
1754 le32_to_cpu(bt
->lo_priority_tx_req_cnt
),
1755 accum_bt
->lo_priority_tx_req_cnt
);
1756 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1757 "lo_priority_tx_denied_cnt:\t%u\t\t\t%u\n",
1758 le32_to_cpu(bt
->lo_priority_tx_denied_cnt
),
1759 accum_bt
->lo_priority_tx_denied_cnt
);
1760 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1761 "hi_priority_rx_req_cnt:\t\t%u\t\t\t%u\n",
1762 le32_to_cpu(bt
->hi_priority_rx_req_cnt
),
1763 accum_bt
->hi_priority_rx_req_cnt
);
1764 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1765 "hi_priority_rx_denied_cnt:\t%u\t\t\t%u\n",
1766 le32_to_cpu(bt
->hi_priority_rx_denied_cnt
),
1767 accum_bt
->hi_priority_rx_denied_cnt
);
1768 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1769 "lo_priority_rx_req_cnt:\t\t%u\t\t\t%u\n",
1770 le32_to_cpu(bt
->lo_priority_rx_req_cnt
),
1771 accum_bt
->lo_priority_rx_req_cnt
);
1772 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1773 "lo_priority_rx_denied_cnt:\t%u\t\t\t%u\n",
1774 le32_to_cpu(bt
->lo_priority_rx_denied_cnt
),
1775 accum_bt
->lo_priority_rx_denied_cnt
);
1777 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1778 "(rx)num_bt_kills:\t\t%u\t\t\t%u\n",
1779 le32_to_cpu(priv
->statistics
.num_bt_kills
),
1780 priv
->statistics
.accum_num_bt_kills
);
1782 spin_unlock_bh(&priv
->statistics
.lock
);
1784 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1789 static ssize_t
iwl_dbgfs_reply_tx_error_read(struct file
*file
,
1790 char __user
*user_buf
,
1791 size_t count
, loff_t
*ppos
)
1793 struct iwl_priv
*priv
= (struct iwl_priv
*)file
->private_data
;
1796 int bufsz
= (sizeof(struct reply_tx_error_statistics
) * 24) +
1797 (sizeof(struct reply_agg_tx_error_statistics
) * 24) + 200;
1800 if (!iwl_is_alive(priv
))
1803 buf
= kzalloc(bufsz
, GFP_KERNEL
);
1805 IWL_ERR(priv
, "Can not allocate Buffer\n");
1809 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Statistics_TX_Error:\n");
1810 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t\t%u\n",
1811 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_DELAY
),
1812 priv
->reply_tx_stats
.pp_delay
);
1813 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1814 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_FEW_BYTES
),
1815 priv
->reply_tx_stats
.pp_few_bytes
);
1816 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1817 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_BT_PRIO
),
1818 priv
->reply_tx_stats
.pp_bt_prio
);
1819 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1820 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_QUIET_PERIOD
),
1821 priv
->reply_tx_stats
.pp_quiet_period
);
1822 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1823 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_CALC_TTAK
),
1824 priv
->reply_tx_stats
.pp_calc_ttak
);
1825 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t%u\n",
1826 iwl_get_tx_fail_reason(
1827 TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY
),
1828 priv
->reply_tx_stats
.int_crossed_retry
);
1829 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1830 iwl_get_tx_fail_reason(TX_STATUS_FAIL_SHORT_LIMIT
),
1831 priv
->reply_tx_stats
.short_limit
);
1832 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1833 iwl_get_tx_fail_reason(TX_STATUS_FAIL_LONG_LIMIT
),
1834 priv
->reply_tx_stats
.long_limit
);
1835 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1836 iwl_get_tx_fail_reason(TX_STATUS_FAIL_FIFO_UNDERRUN
),
1837 priv
->reply_tx_stats
.fifo_underrun
);
1838 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1839 iwl_get_tx_fail_reason(TX_STATUS_FAIL_DRAIN_FLOW
),
1840 priv
->reply_tx_stats
.drain_flow
);
1841 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1842 iwl_get_tx_fail_reason(TX_STATUS_FAIL_RFKILL_FLUSH
),
1843 priv
->reply_tx_stats
.rfkill_flush
);
1844 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1845 iwl_get_tx_fail_reason(TX_STATUS_FAIL_LIFE_EXPIRE
),
1846 priv
->reply_tx_stats
.life_expire
);
1847 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1848 iwl_get_tx_fail_reason(TX_STATUS_FAIL_DEST_PS
),
1849 priv
->reply_tx_stats
.dest_ps
);
1850 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1851 iwl_get_tx_fail_reason(TX_STATUS_FAIL_HOST_ABORTED
),
1852 priv
->reply_tx_stats
.host_abort
);
1853 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1854 iwl_get_tx_fail_reason(TX_STATUS_FAIL_BT_RETRY
),
1855 priv
->reply_tx_stats
.pp_delay
);
1856 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1857 iwl_get_tx_fail_reason(TX_STATUS_FAIL_STA_INVALID
),
1858 priv
->reply_tx_stats
.sta_invalid
);
1859 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1860 iwl_get_tx_fail_reason(TX_STATUS_FAIL_FRAG_DROPPED
),
1861 priv
->reply_tx_stats
.frag_drop
);
1862 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1863 iwl_get_tx_fail_reason(TX_STATUS_FAIL_TID_DISABLE
),
1864 priv
->reply_tx_stats
.tid_disable
);
1865 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1866 iwl_get_tx_fail_reason(TX_STATUS_FAIL_FIFO_FLUSHED
),
1867 priv
->reply_tx_stats
.fifo_flush
);
1868 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t%u\n",
1869 iwl_get_tx_fail_reason(
1870 TX_STATUS_FAIL_INSUFFICIENT_CF_POLL
),
1871 priv
->reply_tx_stats
.insuff_cf_poll
);
1872 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1873 iwl_get_tx_fail_reason(TX_STATUS_FAIL_PASSIVE_NO_RX
),
1874 priv
->reply_tx_stats
.fail_hw_drop
);
1875 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t%u\n",
1876 iwl_get_tx_fail_reason(
1877 TX_STATUS_FAIL_NO_BEACON_ON_RADAR
),
1878 priv
->reply_tx_stats
.sta_color_mismatch
);
1879 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "UNKNOWN:\t\t\t%u\n",
1880 priv
->reply_tx_stats
.unknown
);
1882 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1883 "\nStatistics_Agg_TX_Error:\n");
1885 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1886 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_UNDERRUN_MSK
),
1887 priv
->reply_agg_tx_stats
.underrun
);
1888 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1889 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_BT_PRIO_MSK
),
1890 priv
->reply_agg_tx_stats
.bt_prio
);
1891 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1892 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_FEW_BYTES_MSK
),
1893 priv
->reply_agg_tx_stats
.few_bytes
);
1894 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1895 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_ABORT_MSK
),
1896 priv
->reply_agg_tx_stats
.abort
);
1897 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t%u\n",
1898 iwl_get_agg_tx_fail_reason(
1899 AGG_TX_STATE_LAST_SENT_TTL_MSK
),
1900 priv
->reply_agg_tx_stats
.last_sent_ttl
);
1901 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t%u\n",
1902 iwl_get_agg_tx_fail_reason(
1903 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK
),
1904 priv
->reply_agg_tx_stats
.last_sent_try
);
1905 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t%u\n",
1906 iwl_get_agg_tx_fail_reason(
1907 AGG_TX_STATE_LAST_SENT_BT_KILL_MSK
),
1908 priv
->reply_agg_tx_stats
.last_sent_bt_kill
);
1909 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1910 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_SCD_QUERY_MSK
),
1911 priv
->reply_agg_tx_stats
.scd_query
);
1912 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t%u\n",
1913 iwl_get_agg_tx_fail_reason(
1914 AGG_TX_STATE_TEST_BAD_CRC32_MSK
),
1915 priv
->reply_agg_tx_stats
.bad_crc32
);
1916 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1917 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_RESPONSE_MSK
),
1918 priv
->reply_agg_tx_stats
.response
);
1919 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1920 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_DUMP_TX_MSK
),
1921 priv
->reply_agg_tx_stats
.dump_tx
);
1922 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1923 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_DELAY_TX_MSK
),
1924 priv
->reply_agg_tx_stats
.delay_tx
);
1925 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "UNKNOWN:\t\t\t%u\n",
1926 priv
->reply_agg_tx_stats
.unknown
);
1928 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1933 static ssize_t
iwl_dbgfs_sensitivity_read(struct file
*file
,
1934 char __user
*user_buf
,
1935 size_t count
, loff_t
*ppos
) {
1937 struct iwl_priv
*priv
= file
->private_data
;
1941 int bufsz
= sizeof(struct iwl_sensitivity_data
) * 4 + 100;
1943 struct iwl_sensitivity_data
*data
;
1945 data
= &priv
->sensitivity_data
;
1946 buf
= kzalloc(bufsz
, GFP_KERNEL
);
1948 IWL_ERR(priv
, "Can not allocate Buffer\n");
1952 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "auto_corr_ofdm:\t\t\t %u\n",
1953 data
->auto_corr_ofdm
);
1954 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1955 "auto_corr_ofdm_mrc:\t\t %u\n",
1956 data
->auto_corr_ofdm_mrc
);
1957 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "auto_corr_ofdm_x1:\t\t %u\n",
1958 data
->auto_corr_ofdm_x1
);
1959 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1960 "auto_corr_ofdm_mrc_x1:\t\t %u\n",
1961 data
->auto_corr_ofdm_mrc_x1
);
1962 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "auto_corr_cck:\t\t\t %u\n",
1963 data
->auto_corr_cck
);
1964 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "auto_corr_cck_mrc:\t\t %u\n",
1965 data
->auto_corr_cck_mrc
);
1966 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1967 "last_bad_plcp_cnt_ofdm:\t\t %u\n",
1968 data
->last_bad_plcp_cnt_ofdm
);
1969 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "last_fa_cnt_ofdm:\t\t %u\n",
1970 data
->last_fa_cnt_ofdm
);
1971 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1972 "last_bad_plcp_cnt_cck:\t\t %u\n",
1973 data
->last_bad_plcp_cnt_cck
);
1974 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "last_fa_cnt_cck:\t\t %u\n",
1975 data
->last_fa_cnt_cck
);
1976 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_curr_state:\t\t\t %u\n",
1977 data
->nrg_curr_state
);
1978 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_prev_state:\t\t\t %u\n",
1979 data
->nrg_prev_state
);
1980 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_value:\t\t\t");
1981 for (cnt
= 0; cnt
< 10; cnt
++) {
1982 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, " %u",
1983 data
->nrg_value
[cnt
]);
1985 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
1986 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_silence_rssi:\t\t");
1987 for (cnt
= 0; cnt
< NRG_NUM_PREV_STAT_L
; cnt
++) {
1988 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, " %u",
1989 data
->nrg_silence_rssi
[cnt
]);
1991 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
1992 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_silence_ref:\t\t %u\n",
1993 data
->nrg_silence_ref
);
1994 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_energy_idx:\t\t\t %u\n",
1995 data
->nrg_energy_idx
);
1996 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_silence_idx:\t\t %u\n",
1997 data
->nrg_silence_idx
);
1998 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_th_cck:\t\t\t %u\n",
2000 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
2001 "nrg_auto_corr_silence_diff:\t %u\n",
2002 data
->nrg_auto_corr_silence_diff
);
2003 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "num_in_cck_no_fa:\t\t %u\n",
2004 data
->num_in_cck_no_fa
);
2005 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_th_ofdm:\t\t\t %u\n",
2008 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2014 static ssize_t
iwl_dbgfs_chain_noise_read(struct file
*file
,
2015 char __user
*user_buf
,
2016 size_t count
, loff_t
*ppos
) {
2018 struct iwl_priv
*priv
= file
->private_data
;
2022 int bufsz
= sizeof(struct iwl_chain_noise_data
) * 4 + 100;
2024 struct iwl_chain_noise_data
*data
;
2026 data
= &priv
->chain_noise_data
;
2027 buf
= kzalloc(bufsz
, GFP_KERNEL
);
2029 IWL_ERR(priv
, "Can not allocate Buffer\n");
2033 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "active_chains:\t\t\t %u\n",
2034 data
->active_chains
);
2035 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_noise_a:\t\t\t %u\n",
2036 data
->chain_noise_a
);
2037 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_noise_b:\t\t\t %u\n",
2038 data
->chain_noise_b
);
2039 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_noise_c:\t\t\t %u\n",
2040 data
->chain_noise_c
);
2041 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_signal_a:\t\t\t %u\n",
2042 data
->chain_signal_a
);
2043 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_signal_b:\t\t\t %u\n",
2044 data
->chain_signal_b
);
2045 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_signal_c:\t\t\t %u\n",
2046 data
->chain_signal_c
);
2047 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "beacon_count:\t\t\t %u\n",
2048 data
->beacon_count
);
2050 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "disconn_array:\t\t\t");
2051 for (cnt
= 0; cnt
< NUM_RX_CHAINS
; cnt
++) {
2052 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, " %u",
2053 data
->disconn_array
[cnt
]);
2055 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
2056 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "delta_gain_code:\t\t");
2057 for (cnt
= 0; cnt
< NUM_RX_CHAINS
; cnt
++) {
2058 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, " %u",
2059 data
->delta_gain_code
[cnt
]);
2061 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
2062 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "radio_write:\t\t\t %u\n",
2064 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "state:\t\t\t\t %u\n",
2067 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2072 static ssize_t
iwl_dbgfs_power_save_status_read(struct file
*file
,
2073 char __user
*user_buf
,
2074 size_t count
, loff_t
*ppos
)
2076 struct iwl_priv
*priv
= file
->private_data
;
2079 const size_t bufsz
= sizeof(buf
);
2082 pwrsave_status
= iwl_read32(trans(priv
), CSR_GP_CNTRL
) &
2083 CSR_GP_REG_POWER_SAVE_STATUS_MSK
;
2085 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Power Save Status: ");
2086 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s\n",
2087 (pwrsave_status
== CSR_GP_REG_NO_POWER_SAVE
) ? "none" :
2088 (pwrsave_status
== CSR_GP_REG_MAC_POWER_SAVE
) ? "MAC" :
2089 (pwrsave_status
== CSR_GP_REG_PHY_POWER_SAVE
) ? "PHY" :
2092 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2095 static ssize_t
iwl_dbgfs_clear_ucode_statistics_write(struct file
*file
,
2096 const char __user
*user_buf
,
2097 size_t count
, loff_t
*ppos
)
2099 struct iwl_priv
*priv
= file
->private_data
;
2104 memset(buf
, 0, sizeof(buf
));
2105 buf_size
= min(count
, sizeof(buf
) - 1);
2106 if (copy_from_user(buf
, user_buf
, buf_size
))
2108 if (sscanf(buf
, "%d", &clear
) != 1)
2111 /* make request to uCode to retrieve statistics information */
2112 mutex_lock(&priv
->mutex
);
2113 iwl_send_statistics_request(priv
, CMD_SYNC
, true);
2114 mutex_unlock(&priv
->mutex
);
2119 static ssize_t
iwl_dbgfs_ucode_tracing_read(struct file
*file
,
2120 char __user
*user_buf
,
2121 size_t count
, loff_t
*ppos
) {
2123 struct iwl_priv
*priv
= file
->private_data
;
2126 const size_t bufsz
= sizeof(buf
);
2128 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "ucode trace timer is %s\n",
2129 priv
->event_log
.ucode_trace
? "On" : "Off");
2130 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "non_wraps_count:\t\t %u\n",
2131 priv
->event_log
.non_wraps_count
);
2132 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "wraps_once_count:\t\t %u\n",
2133 priv
->event_log
.wraps_once_count
);
2134 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "wraps_more_count:\t\t %u\n",
2135 priv
->event_log
.wraps_more_count
);
2137 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2140 static ssize_t
iwl_dbgfs_ucode_tracing_write(struct file
*file
,
2141 const char __user
*user_buf
,
2142 size_t count
, loff_t
*ppos
)
2144 struct iwl_priv
*priv
= file
->private_data
;
2149 memset(buf
, 0, sizeof(buf
));
2150 buf_size
= min(count
, sizeof(buf
) - 1);
2151 if (copy_from_user(buf
, user_buf
, buf_size
))
2153 if (sscanf(buf
, "%d", &trace
) != 1)
2157 priv
->event_log
.ucode_trace
= true;
2158 if (iwl_is_alive(priv
)) {
2159 /* start collecting data now */
2160 mod_timer(&priv
->ucode_trace
, jiffies
);
2163 priv
->event_log
.ucode_trace
= false;
2164 del_timer_sync(&priv
->ucode_trace
);
2170 static ssize_t
iwl_dbgfs_rxon_flags_read(struct file
*file
,
2171 char __user
*user_buf
,
2172 size_t count
, loff_t
*ppos
) {
2174 struct iwl_priv
*priv
= file
->private_data
;
2178 len
= sprintf(buf
, "0x%04X\n",
2179 le32_to_cpu(priv
->contexts
[IWL_RXON_CTX_BSS
].active
.flags
));
2180 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
2183 static ssize_t
iwl_dbgfs_rxon_filter_flags_read(struct file
*file
,
2184 char __user
*user_buf
,
2185 size_t count
, loff_t
*ppos
) {
2187 struct iwl_priv
*priv
= file
->private_data
;
2191 len
= sprintf(buf
, "0x%04X\n",
2192 le32_to_cpu(priv
->contexts
[IWL_RXON_CTX_BSS
].active
.filter_flags
));
2193 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
2196 static ssize_t
iwl_dbgfs_missed_beacon_read(struct file
*file
,
2197 char __user
*user_buf
,
2198 size_t count
, loff_t
*ppos
) {
2200 struct iwl_priv
*priv
= file
->private_data
;
2203 const size_t bufsz
= sizeof(buf
);
2205 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%d\n",
2206 priv
->missed_beacon_threshold
);
2208 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2211 static ssize_t
iwl_dbgfs_missed_beacon_write(struct file
*file
,
2212 const char __user
*user_buf
,
2213 size_t count
, loff_t
*ppos
)
2215 struct iwl_priv
*priv
= file
->private_data
;
2220 memset(buf
, 0, sizeof(buf
));
2221 buf_size
= min(count
, sizeof(buf
) - 1);
2222 if (copy_from_user(buf
, user_buf
, buf_size
))
2224 if (sscanf(buf
, "%d", &missed
) != 1)
2227 if (missed
< IWL_MISSED_BEACON_THRESHOLD_MIN
||
2228 missed
> IWL_MISSED_BEACON_THRESHOLD_MAX
)
2229 priv
->missed_beacon_threshold
=
2230 IWL_MISSED_BEACON_THRESHOLD_DEF
;
2232 priv
->missed_beacon_threshold
= missed
;
2237 static ssize_t
iwl_dbgfs_plcp_delta_read(struct file
*file
,
2238 char __user
*user_buf
,
2239 size_t count
, loff_t
*ppos
) {
2241 struct iwl_priv
*priv
= file
->private_data
;
2244 const size_t bufsz
= sizeof(buf
);
2246 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%u\n",
2247 priv
->plcp_delta_threshold
);
2249 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2252 static ssize_t
iwl_dbgfs_plcp_delta_write(struct file
*file
,
2253 const char __user
*user_buf
,
2254 size_t count
, loff_t
*ppos
) {
2256 struct iwl_priv
*priv
= file
->private_data
;
2261 memset(buf
, 0, sizeof(buf
));
2262 buf_size
= min(count
, sizeof(buf
) - 1);
2263 if (copy_from_user(buf
, user_buf
, buf_size
))
2265 if (sscanf(buf
, "%d", &plcp
) != 1)
2267 if ((plcp
< IWL_MAX_PLCP_ERR_THRESHOLD_MIN
) ||
2268 (plcp
> IWL_MAX_PLCP_ERR_THRESHOLD_MAX
))
2269 priv
->plcp_delta_threshold
=
2270 IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE
;
2272 priv
->plcp_delta_threshold
= plcp
;
2276 static ssize_t
iwl_dbgfs_force_reset_read(struct file
*file
,
2277 char __user
*user_buf
,
2278 size_t count
, loff_t
*ppos
)
2280 struct iwl_priv
*priv
= file
->private_data
;
2283 const size_t bufsz
= sizeof(buf
);
2284 struct iwl_force_reset
*force_reset
;
2286 for (i
= 0; i
< IWL_MAX_FORCE_RESET
; i
++) {
2287 force_reset
= &priv
->force_reset
[i
];
2288 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
2289 "Force reset method %d\n", i
);
2290 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
2291 "\tnumber of reset request: %d\n",
2292 force_reset
->reset_request_count
);
2293 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
2294 "\tnumber of reset request success: %d\n",
2295 force_reset
->reset_success_count
);
2296 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
2297 "\tnumber of reset request reject: %d\n",
2298 force_reset
->reset_reject_count
);
2299 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
2300 "\treset duration: %lu\n",
2301 force_reset
->reset_duration
);
2303 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2306 static ssize_t
iwl_dbgfs_force_reset_write(struct file
*file
,
2307 const char __user
*user_buf
,
2308 size_t count
, loff_t
*ppos
) {
2310 struct iwl_priv
*priv
= file
->private_data
;
2315 memset(buf
, 0, sizeof(buf
));
2316 buf_size
= min(count
, sizeof(buf
) - 1);
2317 if (copy_from_user(buf
, user_buf
, buf_size
))
2319 if (sscanf(buf
, "%d", &reset
) != 1)
2324 ret
= iwl_force_reset(priv
, reset
, true);
2329 return ret
? ret
: count
;
2332 static ssize_t
iwl_dbgfs_txfifo_flush_write(struct file
*file
,
2333 const char __user
*user_buf
,
2334 size_t count
, loff_t
*ppos
) {
2336 struct iwl_priv
*priv
= file
->private_data
;
2341 memset(buf
, 0, sizeof(buf
));
2342 buf_size
= min(count
, sizeof(buf
) - 1);
2343 if (copy_from_user(buf
, user_buf
, buf_size
))
2345 if (sscanf(buf
, "%d", &flush
) != 1)
2348 if (iwl_is_rfkill(priv
))
2351 iwlagn_dev_txfifo_flush(priv
, IWL_DROP_ALL
);
2356 static ssize_t
iwl_dbgfs_wd_timeout_write(struct file
*file
,
2357 const char __user
*user_buf
,
2358 size_t count
, loff_t
*ppos
)
2360 struct iwl_priv
*priv
= file
->private_data
;
2365 memset(buf
, 0, sizeof(buf
));
2366 buf_size
= min(count
, sizeof(buf
) - 1);
2367 if (copy_from_user(buf
, user_buf
, buf_size
))
2369 if (sscanf(buf
, "%d", &timeout
) != 1)
2371 if (timeout
< 0 || timeout
> IWL_MAX_WD_TIMEOUT
)
2372 timeout
= IWL_DEF_WD_TIMEOUT
;
2374 hw_params(priv
).wd_timeout
= timeout
;
2375 iwl_setup_watchdog(priv
);
2379 static ssize_t
iwl_dbgfs_bt_traffic_read(struct file
*file
,
2380 char __user
*user_buf
,
2381 size_t count
, loff_t
*ppos
) {
2383 struct iwl_priv
*priv
= (struct iwl_priv
*)file
->private_data
;
2386 const size_t bufsz
= sizeof(buf
);
2388 if (!priv
->bt_enable_flag
) {
2389 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "BT coex disabled\n");
2390 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2392 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "BT enable flag: 0x%x\n",
2393 priv
->bt_enable_flag
);
2394 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "BT in %s mode\n",
2395 priv
->bt_full_concurrent
? "full concurrency" : "3-wire");
2396 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "BT status: %s, "
2397 "last traffic notif: %d\n",
2398 priv
->bt_status
? "On" : "Off", priv
->last_bt_traffic_load
);
2399 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "ch_announcement: %d, "
2400 "kill_ack_mask: %x, kill_cts_mask: %x\n",
2401 priv
->bt_ch_announce
, priv
->kill_ack_mask
,
2402 priv
->kill_cts_mask
);
2404 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "bluetooth traffic load: ");
2405 switch (priv
->bt_traffic_load
) {
2406 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS
:
2407 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Continuous\n");
2409 case IWL_BT_COEX_TRAFFIC_LOAD_HIGH
:
2410 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "High\n");
2412 case IWL_BT_COEX_TRAFFIC_LOAD_LOW
:
2413 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Low\n");
2415 case IWL_BT_COEX_TRAFFIC_LOAD_NONE
:
2417 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "None\n");
2421 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2424 static ssize_t
iwl_dbgfs_protection_mode_read(struct file
*file
,
2425 char __user
*user_buf
,
2426 size_t count
, loff_t
*ppos
)
2428 struct iwl_priv
*priv
= (struct iwl_priv
*)file
->private_data
;
2432 const size_t bufsz
= sizeof(buf
);
2434 if (cfg(priv
)->ht_params
)
2435 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
2436 "use %s for aggregation\n",
2437 (hw_params(priv
).use_rts_for_aggregation
) ?
2438 "rts/cts" : "cts-to-self");
2440 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "N/A");
2442 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2445 static ssize_t
iwl_dbgfs_protection_mode_write(struct file
*file
,
2446 const char __user
*user_buf
,
2447 size_t count
, loff_t
*ppos
) {
2449 struct iwl_priv
*priv
= file
->private_data
;
2454 if (!cfg(priv
)->ht_params
)
2457 memset(buf
, 0, sizeof(buf
));
2458 buf_size
= min(count
, sizeof(buf
) - 1);
2459 if (copy_from_user(buf
, user_buf
, buf_size
))
2461 if (sscanf(buf
, "%d", &rts
) != 1)
2464 hw_params(priv
).use_rts_for_aggregation
= true;
2466 hw_params(priv
).use_rts_for_aggregation
= false;
2470 static ssize_t
iwl_dbgfs_echo_test_write(struct file
*file
,
2471 const char __user
*user_buf
,
2472 size_t count
, loff_t
*ppos
)
2474 struct iwl_priv
*priv
= file
->private_data
;
2478 memset(buf
, 0, sizeof(buf
));
2479 buf_size
= min(count
, sizeof(buf
) - 1);
2480 if (copy_from_user(buf
, user_buf
, buf_size
))
2483 iwl_cmd_echo_test(priv
);
2487 static ssize_t
iwl_dbgfs_log_event_read(struct file
*file
,
2488 char __user
*user_buf
,
2489 size_t count
, loff_t
*ppos
)
2491 struct iwl_priv
*priv
= file
->private_data
;
2494 ssize_t ret
= -ENOMEM
;
2496 ret
= pos
= iwl_dump_nic_event_log(priv
, true, &buf
, true);
2498 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2504 static ssize_t
iwl_dbgfs_log_event_write(struct file
*file
,
2505 const char __user
*user_buf
,
2506 size_t count
, loff_t
*ppos
)
2508 struct iwl_priv
*priv
= file
->private_data
;
2513 memset(buf
, 0, sizeof(buf
));
2514 buf_size
= min(count
, sizeof(buf
) - 1);
2515 if (copy_from_user(buf
, user_buf
, buf_size
))
2517 if (sscanf(buf
, "%d", &event_log_flag
) != 1)
2519 if (event_log_flag
== 1)
2520 iwl_dump_nic_event_log(priv
, true, NULL
, false);
2525 DEBUGFS_READ_FILE_OPS(rx_statistics
);
2526 DEBUGFS_READ_FILE_OPS(tx_statistics
);
2527 DEBUGFS_READ_WRITE_FILE_OPS(traffic_log
);
2528 DEBUGFS_READ_FILE_OPS(ucode_rx_stats
);
2529 DEBUGFS_READ_FILE_OPS(ucode_tx_stats
);
2530 DEBUGFS_READ_FILE_OPS(ucode_general_stats
);
2531 DEBUGFS_READ_FILE_OPS(sensitivity
);
2532 DEBUGFS_READ_FILE_OPS(chain_noise
);
2533 DEBUGFS_READ_FILE_OPS(power_save_status
);
2534 DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics
);
2535 DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics
);
2536 DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing
);
2537 DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon
);
2538 DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta
);
2539 DEBUGFS_READ_WRITE_FILE_OPS(force_reset
);
2540 DEBUGFS_READ_FILE_OPS(rxon_flags
);
2541 DEBUGFS_READ_FILE_OPS(rxon_filter_flags
);
2542 DEBUGFS_WRITE_FILE_OPS(txfifo_flush
);
2543 DEBUGFS_READ_FILE_OPS(ucode_bt_stats
);
2544 DEBUGFS_WRITE_FILE_OPS(wd_timeout
);
2545 DEBUGFS_READ_FILE_OPS(bt_traffic
);
2546 DEBUGFS_READ_WRITE_FILE_OPS(protection_mode
);
2547 DEBUGFS_READ_FILE_OPS(reply_tx_error
);
2548 DEBUGFS_WRITE_FILE_OPS(echo_test
);
2549 DEBUGFS_READ_WRITE_FILE_OPS(log_event
);
2552 * Create the debugfs files and directories
2555 int iwl_dbgfs_register(struct iwl_priv
*priv
, const char *name
)
2557 struct dentry
*phyd
= priv
->hw
->wiphy
->debugfsdir
;
2558 struct dentry
*dir_drv
, *dir_data
, *dir_rf
, *dir_debug
;
2560 dir_drv
= debugfs_create_dir(name
, phyd
);
2564 priv
->debugfs_dir
= dir_drv
;
2566 dir_data
= debugfs_create_dir("data", dir_drv
);
2569 dir_rf
= debugfs_create_dir("rf", dir_drv
);
2572 dir_debug
= debugfs_create_dir("debug", dir_drv
);
2576 DEBUGFS_ADD_FILE(nvm
, dir_data
, S_IRUSR
);
2577 DEBUGFS_ADD_FILE(sram
, dir_data
, S_IWUSR
| S_IRUSR
);
2578 DEBUGFS_ADD_FILE(wowlan_sram
, dir_data
, S_IRUSR
);
2579 DEBUGFS_ADD_FILE(stations
, dir_data
, S_IRUSR
);
2580 DEBUGFS_ADD_FILE(channels
, dir_data
, S_IRUSR
);
2581 DEBUGFS_ADD_FILE(status
, dir_data
, S_IRUSR
);
2582 DEBUGFS_ADD_FILE(rx_handlers
, dir_data
, S_IWUSR
| S_IRUSR
);
2583 DEBUGFS_ADD_FILE(qos
, dir_data
, S_IRUSR
);
2584 DEBUGFS_ADD_FILE(sleep_level_override
, dir_data
, S_IWUSR
| S_IRUSR
);
2585 DEBUGFS_ADD_FILE(current_sleep_command
, dir_data
, S_IRUSR
);
2586 DEBUGFS_ADD_FILE(thermal_throttling
, dir_data
, S_IRUSR
);
2587 DEBUGFS_ADD_FILE(disable_ht40
, dir_data
, S_IWUSR
| S_IRUSR
);
2588 DEBUGFS_ADD_FILE(temperature
, dir_data
, S_IRUSR
);
2590 DEBUGFS_ADD_FILE(rx_statistics
, dir_debug
, S_IRUSR
);
2591 DEBUGFS_ADD_FILE(tx_statistics
, dir_debug
, S_IRUSR
);
2592 DEBUGFS_ADD_FILE(traffic_log
, dir_debug
, S_IWUSR
| S_IRUSR
);
2593 DEBUGFS_ADD_FILE(power_save_status
, dir_debug
, S_IRUSR
);
2594 DEBUGFS_ADD_FILE(clear_ucode_statistics
, dir_debug
, S_IWUSR
);
2595 DEBUGFS_ADD_FILE(clear_traffic_statistics
, dir_debug
, S_IWUSR
);
2596 DEBUGFS_ADD_FILE(missed_beacon
, dir_debug
, S_IWUSR
);
2597 DEBUGFS_ADD_FILE(plcp_delta
, dir_debug
, S_IWUSR
| S_IRUSR
);
2598 DEBUGFS_ADD_FILE(force_reset
, dir_debug
, S_IWUSR
| S_IRUSR
);
2599 DEBUGFS_ADD_FILE(ucode_rx_stats
, dir_debug
, S_IRUSR
);
2600 DEBUGFS_ADD_FILE(ucode_tx_stats
, dir_debug
, S_IRUSR
);
2601 DEBUGFS_ADD_FILE(ucode_general_stats
, dir_debug
, S_IRUSR
);
2602 DEBUGFS_ADD_FILE(txfifo_flush
, dir_debug
, S_IWUSR
);
2603 DEBUGFS_ADD_FILE(protection_mode
, dir_debug
, S_IWUSR
| S_IRUSR
);
2604 DEBUGFS_ADD_FILE(sensitivity
, dir_debug
, S_IRUSR
);
2605 DEBUGFS_ADD_FILE(chain_noise
, dir_debug
, S_IRUSR
);
2606 DEBUGFS_ADD_FILE(ucode_tracing
, dir_debug
, S_IWUSR
| S_IRUSR
);
2607 DEBUGFS_ADD_FILE(ucode_bt_stats
, dir_debug
, S_IRUSR
);
2608 DEBUGFS_ADD_FILE(reply_tx_error
, dir_debug
, S_IRUSR
);
2609 DEBUGFS_ADD_FILE(rxon_flags
, dir_debug
, S_IWUSR
);
2610 DEBUGFS_ADD_FILE(rxon_filter_flags
, dir_debug
, S_IWUSR
);
2611 DEBUGFS_ADD_FILE(wd_timeout
, dir_debug
, S_IWUSR
);
2612 DEBUGFS_ADD_FILE(echo_test
, dir_debug
, S_IWUSR
);
2613 DEBUGFS_ADD_FILE(log_event
, dir_debug
, S_IWUSR
| S_IRUSR
);
2615 if (iwl_advanced_bt_coexist(priv
))
2616 DEBUGFS_ADD_FILE(bt_traffic
, dir_debug
, S_IRUSR
);
2618 DEBUGFS_ADD_BOOL(disable_sensitivity
, dir_rf
,
2619 &priv
->disable_sens_cal
);
2620 DEBUGFS_ADD_BOOL(disable_chain_noise
, dir_rf
,
2621 &priv
->disable_chain_noise_cal
);
2623 if (iwl_trans_dbgfs_register(trans(priv
), dir_debug
))
2628 IWL_ERR(priv
, "Can't create the debugfs directory\n");
2629 iwl_dbgfs_unregister(priv
);
2634 * Remove the debugfs files and directories
2637 void iwl_dbgfs_unregister(struct iwl_priv
*priv
)
2639 if (!priv
->debugfs_dir
)
2642 debugfs_remove_recursive(priv
->debugfs_dir
);
2643 priv
->debugfs_dir
= NULL
;