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 <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) \
68 #define DEBUGFS_READ_FUNC(name) \
69 static ssize_t iwl_dbgfs_##name##_read(struct file *file, \
70 char __user *user_buf, \
71 size_t count, loff_t *ppos);
73 #define DEBUGFS_WRITE_FUNC(name) \
74 static ssize_t iwl_dbgfs_##name##_write(struct file *file, \
75 const char __user *user_buf, \
76 size_t count, loff_t *ppos);
79 static int iwl_dbgfs_open_file_generic(struct inode
*inode
, struct file
*file
)
81 file
->private_data
= inode
->i_private
;
85 #define DEBUGFS_READ_FILE_OPS(name) \
86 DEBUGFS_READ_FUNC(name); \
87 static const struct file_operations iwl_dbgfs_##name##_ops = { \
88 .read = iwl_dbgfs_##name##_read, \
89 .open = iwl_dbgfs_open_file_generic, \
90 .llseek = generic_file_llseek, \
93 #define DEBUGFS_WRITE_FILE_OPS(name) \
94 DEBUGFS_WRITE_FUNC(name); \
95 static const struct file_operations iwl_dbgfs_##name##_ops = { \
96 .write = iwl_dbgfs_##name##_write, \
97 .open = iwl_dbgfs_open_file_generic, \
98 .llseek = generic_file_llseek, \
102 #define DEBUGFS_READ_WRITE_FILE_OPS(name) \
103 DEBUGFS_READ_FUNC(name); \
104 DEBUGFS_WRITE_FUNC(name); \
105 static const struct file_operations iwl_dbgfs_##name##_ops = { \
106 .write = iwl_dbgfs_##name##_write, \
107 .read = iwl_dbgfs_##name##_read, \
108 .open = iwl_dbgfs_open_file_generic, \
109 .llseek = generic_file_llseek, \
112 static ssize_t
iwl_dbgfs_tx_statistics_read(struct file
*file
,
113 char __user
*user_buf
,
114 size_t count
, loff_t
*ppos
) {
116 struct iwl_priv
*priv
= file
->private_data
;
122 const size_t bufsz
= 100 +
123 sizeof(char) * 50 * (MANAGEMENT_MAX
+ CONTROL_MAX
);
124 buf
= kzalloc(bufsz
, GFP_KERNEL
);
127 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Management:\n");
128 for (cnt
= 0; cnt
< MANAGEMENT_MAX
; cnt
++) {
129 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
131 get_mgmt_string(cnt
),
132 priv
->tx_stats
.mgmt
[cnt
]);
134 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Control\n");
135 for (cnt
= 0; cnt
< CONTROL_MAX
; cnt
++) {
136 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
138 get_ctrl_string(cnt
),
139 priv
->tx_stats
.ctrl
[cnt
]);
141 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Data:\n");
142 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\tcnt: %u\n",
143 priv
->tx_stats
.data_cnt
);
144 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\tbytes: %llu\n",
145 priv
->tx_stats
.data_bytes
);
146 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
151 static ssize_t
iwl_dbgfs_clear_traffic_statistics_write(struct file
*file
,
152 const char __user
*user_buf
,
153 size_t count
, loff_t
*ppos
)
155 struct iwl_priv
*priv
= file
->private_data
;
160 memset(buf
, 0, sizeof(buf
));
161 buf_size
= min(count
, sizeof(buf
) - 1);
162 if (copy_from_user(buf
, user_buf
, buf_size
))
164 if (sscanf(buf
, "%x", &clear_flag
) != 1)
166 iwl_clear_traffic_stats(priv
);
171 static ssize_t
iwl_dbgfs_rx_statistics_read(struct file
*file
,
172 char __user
*user_buf
,
173 size_t count
, loff_t
*ppos
) {
175 struct iwl_priv
*priv
= file
->private_data
;
180 const size_t bufsz
= 100 +
181 sizeof(char) * 50 * (MANAGEMENT_MAX
+ CONTROL_MAX
);
182 buf
= kzalloc(bufsz
, GFP_KERNEL
);
186 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Management:\n");
187 for (cnt
= 0; cnt
< MANAGEMENT_MAX
; cnt
++) {
188 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
190 get_mgmt_string(cnt
),
191 priv
->rx_stats
.mgmt
[cnt
]);
193 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Control:\n");
194 for (cnt
= 0; cnt
< CONTROL_MAX
; cnt
++) {
195 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
197 get_ctrl_string(cnt
),
198 priv
->rx_stats
.ctrl
[cnt
]);
200 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Data:\n");
201 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\tcnt: %u\n",
202 priv
->rx_stats
.data_cnt
);
203 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\tbytes: %llu\n",
204 priv
->rx_stats
.data_bytes
);
206 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
211 static ssize_t
iwl_dbgfs_sram_read(struct file
*file
,
212 char __user
*user_buf
,
213 size_t count
, loff_t
*ppos
)
219 bool device_format
= false;
224 struct iwl_priv
*priv
= file
->private_data
;
227 /* default is to dump the entire data segment */
228 if (!priv
->dbgfs_sram_offset
&& !priv
->dbgfs_sram_len
) {
229 priv
->dbgfs_sram_offset
= 0x800000;
230 if (priv
->ucode_type
== IWL_UCODE_INIT
)
231 priv
->dbgfs_sram_len
= priv
->ucode_init
.data
.len
;
233 priv
->dbgfs_sram_len
= priv
->ucode_rt
.data
.len
;
235 len
= priv
->dbgfs_sram_len
;
238 device_format
= true;
242 bufsz
= 50 + len
* 4;
243 buf
= kmalloc(bufsz
, GFP_KERNEL
);
247 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "sram_len: 0x%x\n",
249 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "sram_offset: 0x%x\n",
250 priv
->dbgfs_sram_offset
);
252 /* adjust sram address since reads are only on even u32 boundaries */
253 offset
= priv
->dbgfs_sram_offset
& 0x3;
254 sram
= priv
->dbgfs_sram_offset
& ~0x3;
256 /* read the first u32 from sram */
257 val
= iwl_read_targ_mem(priv
, sram
);
260 /* put the address at the start of every line */
262 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
263 "%08X: ", sram
+ offset
);
266 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
267 "%02x", (val
>> (8 * (3 - offset
))) & 0xff);
269 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
270 "%02x ", (val
>> (8 * offset
)) & 0xff);
272 /* if all bytes processed, read the next u32 from sram */
276 val
= iwl_read_targ_mem(priv
, sram
);
279 /* put in extra spaces and split lines for human readability */
282 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
283 } else if (!(i
& 7)) {
284 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, " ");
285 } else if (!(i
& 3)) {
286 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, " ");
290 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
292 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
297 static ssize_t
iwl_dbgfs_sram_write(struct file
*file
,
298 const char __user
*user_buf
,
299 size_t count
, loff_t
*ppos
)
301 struct iwl_priv
*priv
= file
->private_data
;
306 memset(buf
, 0, sizeof(buf
));
307 buf_size
= min(count
, sizeof(buf
) - 1);
308 if (copy_from_user(buf
, user_buf
, buf_size
))
311 if (sscanf(buf
, "%x,%x", &offset
, &len
) == 2) {
312 priv
->dbgfs_sram_offset
= offset
;
313 priv
->dbgfs_sram_len
= len
;
314 } else if (sscanf(buf
, "%x", &offset
) == 1) {
315 priv
->dbgfs_sram_offset
= offset
;
316 priv
->dbgfs_sram_len
= -4;
318 priv
->dbgfs_sram_offset
= 0;
319 priv
->dbgfs_sram_len
= 0;
325 static ssize_t
iwl_dbgfs_wowlan_sram_read(struct file
*file
,
326 char __user
*user_buf
,
327 size_t count
, loff_t
*ppos
)
329 struct iwl_priv
*priv
= file
->private_data
;
331 if (!priv
->wowlan_sram
)
334 return simple_read_from_buffer(user_buf
, count
, ppos
,
336 priv
->ucode_wowlan
.data
.len
);
338 static ssize_t
iwl_dbgfs_stations_read(struct file
*file
, char __user
*user_buf
,
339 size_t count
, loff_t
*ppos
)
341 struct iwl_priv
*priv
= file
->private_data
;
342 struct iwl_station_entry
*station
;
343 int max_sta
= hw_params(priv
).max_stations
;
347 /* Add 30 for initial string */
348 const size_t bufsz
= 30 + sizeof(char) * 500 * (priv
->num_stations
);
350 buf
= kmalloc(bufsz
, GFP_KERNEL
);
354 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "num of stations: %d\n\n",
357 for (i
= 0; i
< max_sta
; i
++) {
358 station
= &priv
->stations
[i
];
361 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
362 "station %d - addr: %pM, flags: %#x\n",
363 i
, station
->sta
.sta
.addr
,
364 station
->sta
.station_flags_msk
);
365 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
366 "TID\tseq_num\ttxq_id\tframes\ttfds\t");
367 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
368 "start_idx\tbitmap\t\t\trate_n_flags\n");
370 for (j
= 0; j
< MAX_TID_COUNT
; j
++) {
371 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
372 "%d:\t%#x\t%#x\t%u\t%u\t%u\t\t%#.16llx\t%#x",
373 j
, station
->tid
[j
].seq_number
,
374 station
->tid
[j
].agg
.txq_id
,
375 station
->tid
[j
].agg
.frame_count
,
376 station
->tid
[j
].tfds_in_queue
,
377 station
->tid
[j
].agg
.start_idx
,
378 station
->tid
[j
].agg
.bitmap
,
379 station
->tid
[j
].agg
.rate_n_flags
);
381 if (station
->tid
[j
].agg
.wait_for_ba
)
382 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
384 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
387 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
390 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
395 static ssize_t
iwl_dbgfs_nvm_read(struct file
*file
,
396 char __user
*user_buf
,
401 struct iwl_priv
*priv
= file
->private_data
;
402 int pos
= 0, ofs
= 0, buf_size
= 0;
406 size_t eeprom_len
= priv
->cfg
->base_params
->eeprom_size
;
407 buf_size
= 4 * eeprom_len
+ 256;
409 if (eeprom_len
% 16) {
410 IWL_ERR(priv
, "NVM size is not multiple of 16.\n");
416 IWL_ERR(priv
, "Invalid EEPROM/OTP memory\n");
420 /* 4 characters for byte 0xYY */
421 buf
= kzalloc(buf_size
, GFP_KERNEL
);
423 IWL_ERR(priv
, "Can not allocate Buffer\n");
426 eeprom_ver
= iwl_eeprom_query16(priv
, EEPROM_VERSION
);
427 pos
+= scnprintf(buf
+ pos
, buf_size
- pos
, "NVM Type: %s, "
429 (priv
->nvm_device_type
== NVM_DEVICE_TYPE_OTP
)
430 ? "OTP" : "EEPROM", eeprom_ver
);
431 for (ofs
= 0 ; ofs
< eeprom_len
; ofs
+= 16) {
432 pos
+= scnprintf(buf
+ pos
, buf_size
- pos
, "0x%.4x ", ofs
);
433 hex_dump_to_buffer(ptr
+ ofs
, 16 , 16, 2, buf
+ pos
,
435 pos
+= strlen(buf
+ pos
);
436 if (buf_size
- pos
> 0)
440 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
445 static ssize_t
iwl_dbgfs_channels_read(struct file
*file
, char __user
*user_buf
,
446 size_t count
, loff_t
*ppos
)
448 struct iwl_priv
*priv
= file
->private_data
;
449 struct ieee80211_channel
*channels
= NULL
;
450 const struct ieee80211_supported_band
*supp_band
= NULL
;
451 int pos
= 0, i
, bufsz
= PAGE_SIZE
;
455 if (!test_bit(STATUS_GEO_CONFIGURED
, &priv
->shrd
->status
))
458 buf
= kzalloc(bufsz
, GFP_KERNEL
);
460 IWL_ERR(priv
, "Can not allocate Buffer\n");
464 supp_band
= iwl_get_hw_mode(priv
, IEEE80211_BAND_2GHZ
);
466 channels
= supp_band
->channels
;
468 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
469 "Displaying %d channels in 2.4GHz band 802.11bg):\n",
470 supp_band
->n_channels
);
472 for (i
= 0; i
< supp_band
->n_channels
; i
++)
473 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
474 "%d: %ddBm: BSS%s%s, %s.\n",
475 channels
[i
].hw_value
,
476 channels
[i
].max_power
,
477 channels
[i
].flags
& IEEE80211_CHAN_RADAR
?
478 " (IEEE 802.11h required)" : "",
479 ((channels
[i
].flags
& IEEE80211_CHAN_NO_IBSS
)
480 || (channels
[i
].flags
&
481 IEEE80211_CHAN_RADAR
)) ? "" :
484 IEEE80211_CHAN_PASSIVE_SCAN
?
485 "passive only" : "active/passive");
487 supp_band
= iwl_get_hw_mode(priv
, IEEE80211_BAND_5GHZ
);
489 channels
= supp_band
->channels
;
491 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
492 "Displaying %d channels in 5.2GHz band (802.11a)\n",
493 supp_band
->n_channels
);
495 for (i
= 0; i
< supp_band
->n_channels
; i
++)
496 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
497 "%d: %ddBm: BSS%s%s, %s.\n",
498 channels
[i
].hw_value
,
499 channels
[i
].max_power
,
500 channels
[i
].flags
& IEEE80211_CHAN_RADAR
?
501 " (IEEE 802.11h required)" : "",
502 ((channels
[i
].flags
& IEEE80211_CHAN_NO_IBSS
)
503 || (channels
[i
].flags
&
504 IEEE80211_CHAN_RADAR
)) ? "" :
507 IEEE80211_CHAN_PASSIVE_SCAN
?
508 "passive only" : "active/passive");
510 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
515 static ssize_t
iwl_dbgfs_status_read(struct file
*file
,
516 char __user
*user_buf
,
517 size_t count
, loff_t
*ppos
) {
519 struct iwl_priv
*priv
= file
->private_data
;
522 const size_t bufsz
= sizeof(buf
);
524 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_HCMD_ACTIVE:\t %d\n",
525 test_bit(STATUS_HCMD_ACTIVE
, &priv
->shrd
->status
));
526 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_INT_ENABLED:\t %d\n",
527 test_bit(STATUS_INT_ENABLED
, &priv
->shrd
->status
));
528 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_RF_KILL_HW:\t %d\n",
529 test_bit(STATUS_RF_KILL_HW
, &priv
->shrd
->status
));
530 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_CT_KILL:\t\t %d\n",
531 test_bit(STATUS_CT_KILL
, &priv
->shrd
->status
));
532 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_INIT:\t\t %d\n",
533 test_bit(STATUS_INIT
, &priv
->shrd
->status
));
534 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_ALIVE:\t\t %d\n",
535 test_bit(STATUS_ALIVE
, &priv
->shrd
->status
));
536 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_READY:\t\t %d\n",
537 test_bit(STATUS_READY
, &priv
->shrd
->status
));
538 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_TEMPERATURE:\t %d\n",
539 test_bit(STATUS_TEMPERATURE
, &priv
->shrd
->status
));
540 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_GEO_CONFIGURED:\t %d\n",
541 test_bit(STATUS_GEO_CONFIGURED
, &priv
->shrd
->status
));
542 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_EXIT_PENDING:\t %d\n",
543 test_bit(STATUS_EXIT_PENDING
, &priv
->shrd
->status
));
544 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_STATISTICS:\t %d\n",
545 test_bit(STATUS_STATISTICS
, &priv
->shrd
->status
));
546 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_SCANNING:\t %d\n",
547 test_bit(STATUS_SCANNING
, &priv
->shrd
->status
));
548 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_SCAN_ABORTING:\t %d\n",
549 test_bit(STATUS_SCAN_ABORTING
, &priv
->shrd
->status
));
550 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_SCAN_HW:\t\t %d\n",
551 test_bit(STATUS_SCAN_HW
, &priv
->shrd
->status
));
552 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_POWER_PMI:\t %d\n",
553 test_bit(STATUS_POWER_PMI
, &priv
->shrd
->status
));
554 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "STATUS_FW_ERROR:\t %d\n",
555 test_bit(STATUS_FW_ERROR
, &priv
->shrd
->status
));
556 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
559 static ssize_t
iwl_dbgfs_rx_handlers_read(struct file
*file
,
560 char __user
*user_buf
,
561 size_t count
, loff_t
*ppos
) {
563 struct iwl_priv
*priv
= file
->private_data
;
568 int bufsz
= 24 * 64; /* 24 items * 64 char per item */
571 buf
= kzalloc(bufsz
, GFP_KERNEL
);
573 IWL_ERR(priv
, "Can not allocate Buffer\n");
577 for (cnt
= 0; cnt
< REPLY_MAX
; cnt
++) {
578 if (priv
->rx_handlers_stats
[cnt
] > 0)
579 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
580 "\tRx handler[%36s]:\t\t %u\n",
582 priv
->rx_handlers_stats
[cnt
]);
585 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
590 static ssize_t
iwl_dbgfs_rx_handlers_write(struct file
*file
,
591 const char __user
*user_buf
,
592 size_t count
, loff_t
*ppos
)
594 struct iwl_priv
*priv
= file
->private_data
;
600 memset(buf
, 0, sizeof(buf
));
601 buf_size
= min(count
, sizeof(buf
) - 1);
602 if (copy_from_user(buf
, user_buf
, buf_size
))
604 if (sscanf(buf
, "%x", &reset_flag
) != 1)
607 memset(&priv
->rx_handlers_stats
[0], 0,
608 sizeof(priv
->rx_handlers_stats
));
613 static ssize_t
iwl_dbgfs_qos_read(struct file
*file
, char __user
*user_buf
,
614 size_t count
, loff_t
*ppos
)
616 struct iwl_priv
*priv
= file
->private_data
;
617 struct iwl_rxon_context
*ctx
;
619 char buf
[256 * NUM_IWL_RXON_CTX
];
620 const size_t bufsz
= sizeof(buf
);
622 for_each_context(priv
, ctx
) {
623 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "context %d:\n",
625 for (i
= 0; i
< AC_NUM
; i
++) {
626 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
627 "\tcw_min\tcw_max\taifsn\ttxop\n");
628 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
629 "AC[%d]\t%u\t%u\t%u\t%u\n", i
,
630 ctx
->qos_data
.def_qos_parm
.ac
[i
].cw_min
,
631 ctx
->qos_data
.def_qos_parm
.ac
[i
].cw_max
,
632 ctx
->qos_data
.def_qos_parm
.ac
[i
].aifsn
,
633 ctx
->qos_data
.def_qos_parm
.ac
[i
].edca_txop
);
635 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
637 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
640 static ssize_t
iwl_dbgfs_thermal_throttling_read(struct file
*file
,
641 char __user
*user_buf
,
642 size_t count
, loff_t
*ppos
)
644 struct iwl_priv
*priv
= file
->private_data
;
645 struct iwl_tt_mgmt
*tt
= &priv
->thermal_throttle
;
646 struct iwl_tt_restriction
*restriction
;
649 const size_t bufsz
= sizeof(buf
);
651 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
652 "Thermal Throttling Mode: %s\n",
653 tt
->advanced_tt
? "Advance" : "Legacy");
654 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
655 "Thermal Throttling State: %d\n",
657 if (tt
->advanced_tt
) {
658 restriction
= tt
->restriction
+ tt
->state
;
659 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
661 restriction
->tx_stream
);
662 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
664 restriction
->rx_stream
);
665 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
669 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
672 static ssize_t
iwl_dbgfs_disable_ht40_write(struct file
*file
,
673 const char __user
*user_buf
,
674 size_t count
, loff_t
*ppos
)
676 struct iwl_priv
*priv
= file
->private_data
;
681 memset(buf
, 0, sizeof(buf
));
682 buf_size
= min(count
, sizeof(buf
) - 1);
683 if (copy_from_user(buf
, user_buf
, buf_size
))
685 if (sscanf(buf
, "%d", &ht40
) != 1)
687 if (!iwl_is_any_associated(priv
))
688 priv
->disable_ht40
= ht40
? true : false;
690 IWL_ERR(priv
, "Sta associated with AP - "
691 "Change to 40MHz channel support is not allowed\n");
698 static ssize_t
iwl_dbgfs_disable_ht40_read(struct file
*file
,
699 char __user
*user_buf
,
700 size_t count
, loff_t
*ppos
)
702 struct iwl_priv
*priv
= file
->private_data
;
705 const size_t bufsz
= sizeof(buf
);
707 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
708 "11n 40MHz Mode: %s\n",
709 priv
->disable_ht40
? "Disabled" : "Enabled");
710 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
713 static ssize_t
iwl_dbgfs_sleep_level_override_write(struct file
*file
,
714 const char __user
*user_buf
,
715 size_t count
, loff_t
*ppos
)
717 struct iwl_priv
*priv
= file
->private_data
;
722 memset(buf
, 0, sizeof(buf
));
723 buf_size
= min(count
, sizeof(buf
) - 1);
724 if (copy_from_user(buf
, user_buf
, buf_size
))
727 if (sscanf(buf
, "%d", &value
) != 1)
731 * Our users expect 0 to be "CAM", but 0 isn't actually
732 * valid here. However, let's not confuse them and present
733 * IWL_POWER_INDEX_1 as "1", not "0".
740 if (value
!= -1 && (value
< 0 || value
>= IWL_POWER_NUM
))
743 if (!iwl_is_ready_rf(priv
->shrd
))
746 priv
->power_data
.debug_sleep_level_override
= value
;
748 mutex_lock(&priv
->shrd
->mutex
);
749 iwl_power_update_mode(priv
, true);
750 mutex_unlock(&priv
->shrd
->mutex
);
755 static ssize_t
iwl_dbgfs_sleep_level_override_read(struct file
*file
,
756 char __user
*user_buf
,
757 size_t count
, loff_t
*ppos
)
759 struct iwl_priv
*priv
= file
->private_data
;
762 const size_t bufsz
= sizeof(buf
);
764 /* see the write function */
765 value
= priv
->power_data
.debug_sleep_level_override
;
769 pos
= scnprintf(buf
, bufsz
, "%d\n", value
);
770 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
773 static ssize_t
iwl_dbgfs_current_sleep_command_read(struct file
*file
,
774 char __user
*user_buf
,
775 size_t count
, loff_t
*ppos
)
777 struct iwl_priv
*priv
= file
->private_data
;
780 const size_t bufsz
= sizeof(buf
);
781 struct iwl_powertable_cmd
*cmd
= &priv
->power_data
.sleep_cmd
;
783 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
784 "flags: %#.2x\n", le16_to_cpu(cmd
->flags
));
785 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
786 "RX/TX timeout: %d/%d usec\n",
787 le32_to_cpu(cmd
->rx_data_timeout
),
788 le32_to_cpu(cmd
->tx_data_timeout
));
789 for (i
= 0; i
< IWL_POWER_VEC_SIZE
; i
++)
790 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
791 "sleep_interval[%d]: %d\n", i
,
792 le32_to_cpu(cmd
->sleep_interval
[i
]));
794 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
797 DEBUGFS_READ_WRITE_FILE_OPS(sram
);
798 DEBUGFS_READ_FILE_OPS(wowlan_sram
);
799 DEBUGFS_READ_FILE_OPS(nvm
);
800 DEBUGFS_READ_FILE_OPS(stations
);
801 DEBUGFS_READ_FILE_OPS(channels
);
802 DEBUGFS_READ_FILE_OPS(status
);
803 DEBUGFS_READ_WRITE_FILE_OPS(rx_handlers
);
804 DEBUGFS_READ_FILE_OPS(qos
);
805 DEBUGFS_READ_FILE_OPS(thermal_throttling
);
806 DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40
);
807 DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override
);
808 DEBUGFS_READ_FILE_OPS(current_sleep_command
);
810 static const char *fmt_value
= " %-30s %10u\n";
811 static const char *fmt_hex
= " %-30s 0x%02X\n";
812 static const char *fmt_table
= " %-30s %10u %10u %10u %10u\n";
813 static const char *fmt_header
=
814 "%-32s current cumulative delta max\n";
816 static int iwl_statistics_flag(struct iwl_priv
*priv
, char *buf
, int bufsz
)
821 flag
= le32_to_cpu(priv
->statistics
.flag
);
823 p
+= scnprintf(buf
+ p
, bufsz
- p
, "Statistics Flag(0x%X):\n", flag
);
824 if (flag
& UCODE_STATISTICS_CLEAR_MSK
)
825 p
+= scnprintf(buf
+ p
, bufsz
- p
,
826 "\tStatistics have been cleared\n");
827 p
+= scnprintf(buf
+ p
, bufsz
- p
, "\tOperational Frequency: %s\n",
828 (flag
& UCODE_STATISTICS_FREQUENCY_MSK
)
829 ? "2.4 GHz" : "5.2 GHz");
830 p
+= scnprintf(buf
+ p
, bufsz
- p
, "\tTGj Narrow Band: %s\n",
831 (flag
& UCODE_STATISTICS_NARROW_BAND_MSK
)
832 ? "enabled" : "disabled");
837 static ssize_t
iwl_dbgfs_ucode_rx_stats_read(struct file
*file
,
838 char __user
*user_buf
,
839 size_t count
, loff_t
*ppos
)
841 struct iwl_priv
*priv
= file
->private_data
;
844 int bufsz
= sizeof(struct statistics_rx_phy
) * 40 +
845 sizeof(struct statistics_rx_non_phy
) * 40 +
846 sizeof(struct statistics_rx_ht_phy
) * 40 + 400;
848 struct statistics_rx_phy
*ofdm
, *accum_ofdm
, *delta_ofdm
, *max_ofdm
;
849 struct statistics_rx_phy
*cck
, *accum_cck
, *delta_cck
, *max_cck
;
850 struct statistics_rx_non_phy
*general
, *accum_general
;
851 struct statistics_rx_non_phy
*delta_general
, *max_general
;
852 struct statistics_rx_ht_phy
*ht
, *accum_ht
, *delta_ht
, *max_ht
;
854 if (!iwl_is_alive(priv
->shrd
))
857 buf
= kzalloc(bufsz
, GFP_KERNEL
);
859 IWL_ERR(priv
, "Can not allocate Buffer\n");
864 * the statistic information display here is based on
865 * the last statistics notification from uCode
866 * might not reflect the current uCode activity
868 ofdm
= &priv
->statistics
.rx_ofdm
;
869 cck
= &priv
->statistics
.rx_cck
;
870 general
= &priv
->statistics
.rx_non_phy
;
871 ht
= &priv
->statistics
.rx_ofdm_ht
;
872 accum_ofdm
= &priv
->accum_stats
.rx_ofdm
;
873 accum_cck
= &priv
->accum_stats
.rx_cck
;
874 accum_general
= &priv
->accum_stats
.rx_non_phy
;
875 accum_ht
= &priv
->accum_stats
.rx_ofdm_ht
;
876 delta_ofdm
= &priv
->delta_stats
.rx_ofdm
;
877 delta_cck
= &priv
->delta_stats
.rx_cck
;
878 delta_general
= &priv
->delta_stats
.rx_non_phy
;
879 delta_ht
= &priv
->delta_stats
.rx_ofdm_ht
;
880 max_ofdm
= &priv
->max_delta_stats
.rx_ofdm
;
881 max_cck
= &priv
->max_delta_stats
.rx_cck
;
882 max_general
= &priv
->max_delta_stats
.rx_non_phy
;
883 max_ht
= &priv
->max_delta_stats
.rx_ofdm_ht
;
885 pos
+= iwl_statistics_flag(priv
, buf
, bufsz
);
886 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
887 fmt_header
, "Statistics_Rx - OFDM:");
888 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
889 fmt_table
, "ina_cnt:",
890 le32_to_cpu(ofdm
->ina_cnt
),
892 delta_ofdm
->ina_cnt
, max_ofdm
->ina_cnt
);
893 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
894 fmt_table
, "fina_cnt:",
895 le32_to_cpu(ofdm
->fina_cnt
), accum_ofdm
->fina_cnt
,
896 delta_ofdm
->fina_cnt
, max_ofdm
->fina_cnt
);
897 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
898 fmt_table
, "plcp_err:",
899 le32_to_cpu(ofdm
->plcp_err
), accum_ofdm
->plcp_err
,
900 delta_ofdm
->plcp_err
, max_ofdm
->plcp_err
);
901 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
902 fmt_table
, "crc32_err:",
903 le32_to_cpu(ofdm
->crc32_err
), accum_ofdm
->crc32_err
,
904 delta_ofdm
->crc32_err
, max_ofdm
->crc32_err
);
905 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
906 fmt_table
, "overrun_err:",
907 le32_to_cpu(ofdm
->overrun_err
),
908 accum_ofdm
->overrun_err
, delta_ofdm
->overrun_err
,
909 max_ofdm
->overrun_err
);
910 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
911 fmt_table
, "early_overrun_err:",
912 le32_to_cpu(ofdm
->early_overrun_err
),
913 accum_ofdm
->early_overrun_err
,
914 delta_ofdm
->early_overrun_err
,
915 max_ofdm
->early_overrun_err
);
916 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
917 fmt_table
, "crc32_good:",
918 le32_to_cpu(ofdm
->crc32_good
),
919 accum_ofdm
->crc32_good
, delta_ofdm
->crc32_good
,
920 max_ofdm
->crc32_good
);
921 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
922 fmt_table
, "false_alarm_cnt:",
923 le32_to_cpu(ofdm
->false_alarm_cnt
),
924 accum_ofdm
->false_alarm_cnt
,
925 delta_ofdm
->false_alarm_cnt
,
926 max_ofdm
->false_alarm_cnt
);
927 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
928 fmt_table
, "fina_sync_err_cnt:",
929 le32_to_cpu(ofdm
->fina_sync_err_cnt
),
930 accum_ofdm
->fina_sync_err_cnt
,
931 delta_ofdm
->fina_sync_err_cnt
,
932 max_ofdm
->fina_sync_err_cnt
);
933 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
934 fmt_table
, "sfd_timeout:",
935 le32_to_cpu(ofdm
->sfd_timeout
),
936 accum_ofdm
->sfd_timeout
, delta_ofdm
->sfd_timeout
,
937 max_ofdm
->sfd_timeout
);
938 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
939 fmt_table
, "fina_timeout:",
940 le32_to_cpu(ofdm
->fina_timeout
),
941 accum_ofdm
->fina_timeout
, delta_ofdm
->fina_timeout
,
942 max_ofdm
->fina_timeout
);
943 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
944 fmt_table
, "unresponded_rts:",
945 le32_to_cpu(ofdm
->unresponded_rts
),
946 accum_ofdm
->unresponded_rts
,
947 delta_ofdm
->unresponded_rts
,
948 max_ofdm
->unresponded_rts
);
949 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
950 fmt_table
, "rxe_frame_lmt_ovrun:",
951 le32_to_cpu(ofdm
->rxe_frame_limit_overrun
),
952 accum_ofdm
->rxe_frame_limit_overrun
,
953 delta_ofdm
->rxe_frame_limit_overrun
,
954 max_ofdm
->rxe_frame_limit_overrun
);
955 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
956 fmt_table
, "sent_ack_cnt:",
957 le32_to_cpu(ofdm
->sent_ack_cnt
),
958 accum_ofdm
->sent_ack_cnt
, delta_ofdm
->sent_ack_cnt
,
959 max_ofdm
->sent_ack_cnt
);
960 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
961 fmt_table
, "sent_cts_cnt:",
962 le32_to_cpu(ofdm
->sent_cts_cnt
),
963 accum_ofdm
->sent_cts_cnt
, delta_ofdm
->sent_cts_cnt
,
964 max_ofdm
->sent_cts_cnt
);
965 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
966 fmt_table
, "sent_ba_rsp_cnt:",
967 le32_to_cpu(ofdm
->sent_ba_rsp_cnt
),
968 accum_ofdm
->sent_ba_rsp_cnt
,
969 delta_ofdm
->sent_ba_rsp_cnt
,
970 max_ofdm
->sent_ba_rsp_cnt
);
971 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
972 fmt_table
, "dsp_self_kill:",
973 le32_to_cpu(ofdm
->dsp_self_kill
),
974 accum_ofdm
->dsp_self_kill
,
975 delta_ofdm
->dsp_self_kill
,
976 max_ofdm
->dsp_self_kill
);
977 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
978 fmt_table
, "mh_format_err:",
979 le32_to_cpu(ofdm
->mh_format_err
),
980 accum_ofdm
->mh_format_err
,
981 delta_ofdm
->mh_format_err
,
982 max_ofdm
->mh_format_err
);
983 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
984 fmt_table
, "re_acq_main_rssi_sum:",
985 le32_to_cpu(ofdm
->re_acq_main_rssi_sum
),
986 accum_ofdm
->re_acq_main_rssi_sum
,
987 delta_ofdm
->re_acq_main_rssi_sum
,
988 max_ofdm
->re_acq_main_rssi_sum
);
990 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
991 fmt_header
, "Statistics_Rx - CCK:");
992 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
993 fmt_table
, "ina_cnt:",
994 le32_to_cpu(cck
->ina_cnt
), accum_cck
->ina_cnt
,
995 delta_cck
->ina_cnt
, max_cck
->ina_cnt
);
996 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
997 fmt_table
, "fina_cnt:",
998 le32_to_cpu(cck
->fina_cnt
), accum_cck
->fina_cnt
,
999 delta_cck
->fina_cnt
, max_cck
->fina_cnt
);
1000 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1001 fmt_table
, "plcp_err:",
1002 le32_to_cpu(cck
->plcp_err
), accum_cck
->plcp_err
,
1003 delta_cck
->plcp_err
, max_cck
->plcp_err
);
1004 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1005 fmt_table
, "crc32_err:",
1006 le32_to_cpu(cck
->crc32_err
), accum_cck
->crc32_err
,
1007 delta_cck
->crc32_err
, max_cck
->crc32_err
);
1008 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1009 fmt_table
, "overrun_err:",
1010 le32_to_cpu(cck
->overrun_err
),
1011 accum_cck
->overrun_err
, delta_cck
->overrun_err
,
1012 max_cck
->overrun_err
);
1013 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1014 fmt_table
, "early_overrun_err:",
1015 le32_to_cpu(cck
->early_overrun_err
),
1016 accum_cck
->early_overrun_err
,
1017 delta_cck
->early_overrun_err
,
1018 max_cck
->early_overrun_err
);
1019 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1020 fmt_table
, "crc32_good:",
1021 le32_to_cpu(cck
->crc32_good
), accum_cck
->crc32_good
,
1022 delta_cck
->crc32_good
, max_cck
->crc32_good
);
1023 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1024 fmt_table
, "false_alarm_cnt:",
1025 le32_to_cpu(cck
->false_alarm_cnt
),
1026 accum_cck
->false_alarm_cnt
,
1027 delta_cck
->false_alarm_cnt
, max_cck
->false_alarm_cnt
);
1028 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1029 fmt_table
, "fina_sync_err_cnt:",
1030 le32_to_cpu(cck
->fina_sync_err_cnt
),
1031 accum_cck
->fina_sync_err_cnt
,
1032 delta_cck
->fina_sync_err_cnt
,
1033 max_cck
->fina_sync_err_cnt
);
1034 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1035 fmt_table
, "sfd_timeout:",
1036 le32_to_cpu(cck
->sfd_timeout
),
1037 accum_cck
->sfd_timeout
, delta_cck
->sfd_timeout
,
1038 max_cck
->sfd_timeout
);
1039 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1040 fmt_table
, "fina_timeout:",
1041 le32_to_cpu(cck
->fina_timeout
),
1042 accum_cck
->fina_timeout
, delta_cck
->fina_timeout
,
1043 max_cck
->fina_timeout
);
1044 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1045 fmt_table
, "unresponded_rts:",
1046 le32_to_cpu(cck
->unresponded_rts
),
1047 accum_cck
->unresponded_rts
, delta_cck
->unresponded_rts
,
1048 max_cck
->unresponded_rts
);
1049 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1050 fmt_table
, "rxe_frame_lmt_ovrun:",
1051 le32_to_cpu(cck
->rxe_frame_limit_overrun
),
1052 accum_cck
->rxe_frame_limit_overrun
,
1053 delta_cck
->rxe_frame_limit_overrun
,
1054 max_cck
->rxe_frame_limit_overrun
);
1055 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1056 fmt_table
, "sent_ack_cnt:",
1057 le32_to_cpu(cck
->sent_ack_cnt
),
1058 accum_cck
->sent_ack_cnt
, delta_cck
->sent_ack_cnt
,
1059 max_cck
->sent_ack_cnt
);
1060 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1061 fmt_table
, "sent_cts_cnt:",
1062 le32_to_cpu(cck
->sent_cts_cnt
),
1063 accum_cck
->sent_cts_cnt
, delta_cck
->sent_cts_cnt
,
1064 max_cck
->sent_cts_cnt
);
1065 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1066 fmt_table
, "sent_ba_rsp_cnt:",
1067 le32_to_cpu(cck
->sent_ba_rsp_cnt
),
1068 accum_cck
->sent_ba_rsp_cnt
,
1069 delta_cck
->sent_ba_rsp_cnt
,
1070 max_cck
->sent_ba_rsp_cnt
);
1071 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1072 fmt_table
, "dsp_self_kill:",
1073 le32_to_cpu(cck
->dsp_self_kill
),
1074 accum_cck
->dsp_self_kill
, delta_cck
->dsp_self_kill
,
1075 max_cck
->dsp_self_kill
);
1076 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1077 fmt_table
, "mh_format_err:",
1078 le32_to_cpu(cck
->mh_format_err
),
1079 accum_cck
->mh_format_err
, delta_cck
->mh_format_err
,
1080 max_cck
->mh_format_err
);
1081 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1082 fmt_table
, "re_acq_main_rssi_sum:",
1083 le32_to_cpu(cck
->re_acq_main_rssi_sum
),
1084 accum_cck
->re_acq_main_rssi_sum
,
1085 delta_cck
->re_acq_main_rssi_sum
,
1086 max_cck
->re_acq_main_rssi_sum
);
1088 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1089 fmt_header
, "Statistics_Rx - GENERAL:");
1090 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1091 fmt_table
, "bogus_cts:",
1092 le32_to_cpu(general
->bogus_cts
),
1093 accum_general
->bogus_cts
, delta_general
->bogus_cts
,
1094 max_general
->bogus_cts
);
1095 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1096 fmt_table
, "bogus_ack:",
1097 le32_to_cpu(general
->bogus_ack
),
1098 accum_general
->bogus_ack
, delta_general
->bogus_ack
,
1099 max_general
->bogus_ack
);
1100 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1101 fmt_table
, "non_bssid_frames:",
1102 le32_to_cpu(general
->non_bssid_frames
),
1103 accum_general
->non_bssid_frames
,
1104 delta_general
->non_bssid_frames
,
1105 max_general
->non_bssid_frames
);
1106 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1107 fmt_table
, "filtered_frames:",
1108 le32_to_cpu(general
->filtered_frames
),
1109 accum_general
->filtered_frames
,
1110 delta_general
->filtered_frames
,
1111 max_general
->filtered_frames
);
1112 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1113 fmt_table
, "non_channel_beacons:",
1114 le32_to_cpu(general
->non_channel_beacons
),
1115 accum_general
->non_channel_beacons
,
1116 delta_general
->non_channel_beacons
,
1117 max_general
->non_channel_beacons
);
1118 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1119 fmt_table
, "channel_beacons:",
1120 le32_to_cpu(general
->channel_beacons
),
1121 accum_general
->channel_beacons
,
1122 delta_general
->channel_beacons
,
1123 max_general
->channel_beacons
);
1124 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1125 fmt_table
, "num_missed_bcon:",
1126 le32_to_cpu(general
->num_missed_bcon
),
1127 accum_general
->num_missed_bcon
,
1128 delta_general
->num_missed_bcon
,
1129 max_general
->num_missed_bcon
);
1130 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1131 fmt_table
, "adc_rx_saturation_time:",
1132 le32_to_cpu(general
->adc_rx_saturation_time
),
1133 accum_general
->adc_rx_saturation_time
,
1134 delta_general
->adc_rx_saturation_time
,
1135 max_general
->adc_rx_saturation_time
);
1136 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1137 fmt_table
, "ina_detect_search_tm:",
1138 le32_to_cpu(general
->ina_detection_search_time
),
1139 accum_general
->ina_detection_search_time
,
1140 delta_general
->ina_detection_search_time
,
1141 max_general
->ina_detection_search_time
);
1142 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1143 fmt_table
, "beacon_silence_rssi_a:",
1144 le32_to_cpu(general
->beacon_silence_rssi_a
),
1145 accum_general
->beacon_silence_rssi_a
,
1146 delta_general
->beacon_silence_rssi_a
,
1147 max_general
->beacon_silence_rssi_a
);
1148 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1149 fmt_table
, "beacon_silence_rssi_b:",
1150 le32_to_cpu(general
->beacon_silence_rssi_b
),
1151 accum_general
->beacon_silence_rssi_b
,
1152 delta_general
->beacon_silence_rssi_b
,
1153 max_general
->beacon_silence_rssi_b
);
1154 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1155 fmt_table
, "beacon_silence_rssi_c:",
1156 le32_to_cpu(general
->beacon_silence_rssi_c
),
1157 accum_general
->beacon_silence_rssi_c
,
1158 delta_general
->beacon_silence_rssi_c
,
1159 max_general
->beacon_silence_rssi_c
);
1160 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1161 fmt_table
, "interference_data_flag:",
1162 le32_to_cpu(general
->interference_data_flag
),
1163 accum_general
->interference_data_flag
,
1164 delta_general
->interference_data_flag
,
1165 max_general
->interference_data_flag
);
1166 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1167 fmt_table
, "channel_load:",
1168 le32_to_cpu(general
->channel_load
),
1169 accum_general
->channel_load
,
1170 delta_general
->channel_load
,
1171 max_general
->channel_load
);
1172 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1173 fmt_table
, "dsp_false_alarms:",
1174 le32_to_cpu(general
->dsp_false_alarms
),
1175 accum_general
->dsp_false_alarms
,
1176 delta_general
->dsp_false_alarms
,
1177 max_general
->dsp_false_alarms
);
1178 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1179 fmt_table
, "beacon_rssi_a:",
1180 le32_to_cpu(general
->beacon_rssi_a
),
1181 accum_general
->beacon_rssi_a
,
1182 delta_general
->beacon_rssi_a
,
1183 max_general
->beacon_rssi_a
);
1184 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1185 fmt_table
, "beacon_rssi_b:",
1186 le32_to_cpu(general
->beacon_rssi_b
),
1187 accum_general
->beacon_rssi_b
,
1188 delta_general
->beacon_rssi_b
,
1189 max_general
->beacon_rssi_b
);
1190 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1191 fmt_table
, "beacon_rssi_c:",
1192 le32_to_cpu(general
->beacon_rssi_c
),
1193 accum_general
->beacon_rssi_c
,
1194 delta_general
->beacon_rssi_c
,
1195 max_general
->beacon_rssi_c
);
1196 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1197 fmt_table
, "beacon_energy_a:",
1198 le32_to_cpu(general
->beacon_energy_a
),
1199 accum_general
->beacon_energy_a
,
1200 delta_general
->beacon_energy_a
,
1201 max_general
->beacon_energy_a
);
1202 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1203 fmt_table
, "beacon_energy_b:",
1204 le32_to_cpu(general
->beacon_energy_b
),
1205 accum_general
->beacon_energy_b
,
1206 delta_general
->beacon_energy_b
,
1207 max_general
->beacon_energy_b
);
1208 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1209 fmt_table
, "beacon_energy_c:",
1210 le32_to_cpu(general
->beacon_energy_c
),
1211 accum_general
->beacon_energy_c
,
1212 delta_general
->beacon_energy_c
,
1213 max_general
->beacon_energy_c
);
1215 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1216 fmt_header
, "Statistics_Rx - OFDM_HT:");
1217 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1218 fmt_table
, "plcp_err:",
1219 le32_to_cpu(ht
->plcp_err
), accum_ht
->plcp_err
,
1220 delta_ht
->plcp_err
, max_ht
->plcp_err
);
1221 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1222 fmt_table
, "overrun_err:",
1223 le32_to_cpu(ht
->overrun_err
), accum_ht
->overrun_err
,
1224 delta_ht
->overrun_err
, max_ht
->overrun_err
);
1225 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1226 fmt_table
, "early_overrun_err:",
1227 le32_to_cpu(ht
->early_overrun_err
),
1228 accum_ht
->early_overrun_err
,
1229 delta_ht
->early_overrun_err
,
1230 max_ht
->early_overrun_err
);
1231 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1232 fmt_table
, "crc32_good:",
1233 le32_to_cpu(ht
->crc32_good
), accum_ht
->crc32_good
,
1234 delta_ht
->crc32_good
, max_ht
->crc32_good
);
1235 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1236 fmt_table
, "crc32_err:",
1237 le32_to_cpu(ht
->crc32_err
), accum_ht
->crc32_err
,
1238 delta_ht
->crc32_err
, max_ht
->crc32_err
);
1239 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1240 fmt_table
, "mh_format_err:",
1241 le32_to_cpu(ht
->mh_format_err
),
1242 accum_ht
->mh_format_err
,
1243 delta_ht
->mh_format_err
, max_ht
->mh_format_err
);
1244 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1245 fmt_table
, "agg_crc32_good:",
1246 le32_to_cpu(ht
->agg_crc32_good
),
1247 accum_ht
->agg_crc32_good
,
1248 delta_ht
->agg_crc32_good
, max_ht
->agg_crc32_good
);
1249 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1250 fmt_table
, "agg_mpdu_cnt:",
1251 le32_to_cpu(ht
->agg_mpdu_cnt
),
1252 accum_ht
->agg_mpdu_cnt
,
1253 delta_ht
->agg_mpdu_cnt
, max_ht
->agg_mpdu_cnt
);
1254 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1255 fmt_table
, "agg_cnt:",
1256 le32_to_cpu(ht
->agg_cnt
), accum_ht
->agg_cnt
,
1257 delta_ht
->agg_cnt
, max_ht
->agg_cnt
);
1258 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1259 fmt_table
, "unsupport_mcs:",
1260 le32_to_cpu(ht
->unsupport_mcs
),
1261 accum_ht
->unsupport_mcs
,
1262 delta_ht
->unsupport_mcs
, max_ht
->unsupport_mcs
);
1264 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1269 static ssize_t
iwl_dbgfs_ucode_tx_stats_read(struct file
*file
,
1270 char __user
*user_buf
,
1271 size_t count
, loff_t
*ppos
)
1273 struct iwl_priv
*priv
= file
->private_data
;
1276 int bufsz
= (sizeof(struct statistics_tx
) * 48) + 250;
1278 struct statistics_tx
*tx
, *accum_tx
, *delta_tx
, *max_tx
;
1280 if (!iwl_is_alive(priv
->shrd
))
1283 buf
= kzalloc(bufsz
, GFP_KERNEL
);
1285 IWL_ERR(priv
, "Can not allocate Buffer\n");
1289 /* the statistic information display here is based on
1290 * the last statistics notification from uCode
1291 * might not reflect the current uCode activity
1293 tx
= &priv
->statistics
.tx
;
1294 accum_tx
= &priv
->accum_stats
.tx
;
1295 delta_tx
= &priv
->delta_stats
.tx
;
1296 max_tx
= &priv
->max_delta_stats
.tx
;
1298 pos
+= iwl_statistics_flag(priv
, buf
, bufsz
);
1299 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1300 fmt_header
, "Statistics_Tx:");
1301 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1302 fmt_table
, "preamble:",
1303 le32_to_cpu(tx
->preamble_cnt
),
1304 accum_tx
->preamble_cnt
,
1305 delta_tx
->preamble_cnt
, max_tx
->preamble_cnt
);
1306 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1307 fmt_table
, "rx_detected_cnt:",
1308 le32_to_cpu(tx
->rx_detected_cnt
),
1309 accum_tx
->rx_detected_cnt
,
1310 delta_tx
->rx_detected_cnt
, max_tx
->rx_detected_cnt
);
1311 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1312 fmt_table
, "bt_prio_defer_cnt:",
1313 le32_to_cpu(tx
->bt_prio_defer_cnt
),
1314 accum_tx
->bt_prio_defer_cnt
,
1315 delta_tx
->bt_prio_defer_cnt
,
1316 max_tx
->bt_prio_defer_cnt
);
1317 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1318 fmt_table
, "bt_prio_kill_cnt:",
1319 le32_to_cpu(tx
->bt_prio_kill_cnt
),
1320 accum_tx
->bt_prio_kill_cnt
,
1321 delta_tx
->bt_prio_kill_cnt
,
1322 max_tx
->bt_prio_kill_cnt
);
1323 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1324 fmt_table
, "few_bytes_cnt:",
1325 le32_to_cpu(tx
->few_bytes_cnt
),
1326 accum_tx
->few_bytes_cnt
,
1327 delta_tx
->few_bytes_cnt
, max_tx
->few_bytes_cnt
);
1328 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1329 fmt_table
, "cts_timeout:",
1330 le32_to_cpu(tx
->cts_timeout
), accum_tx
->cts_timeout
,
1331 delta_tx
->cts_timeout
, max_tx
->cts_timeout
);
1332 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1333 fmt_table
, "ack_timeout:",
1334 le32_to_cpu(tx
->ack_timeout
),
1335 accum_tx
->ack_timeout
,
1336 delta_tx
->ack_timeout
, max_tx
->ack_timeout
);
1337 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1338 fmt_table
, "expected_ack_cnt:",
1339 le32_to_cpu(tx
->expected_ack_cnt
),
1340 accum_tx
->expected_ack_cnt
,
1341 delta_tx
->expected_ack_cnt
,
1342 max_tx
->expected_ack_cnt
);
1343 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1344 fmt_table
, "actual_ack_cnt:",
1345 le32_to_cpu(tx
->actual_ack_cnt
),
1346 accum_tx
->actual_ack_cnt
,
1347 delta_tx
->actual_ack_cnt
,
1348 max_tx
->actual_ack_cnt
);
1349 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1350 fmt_table
, "dump_msdu_cnt:",
1351 le32_to_cpu(tx
->dump_msdu_cnt
),
1352 accum_tx
->dump_msdu_cnt
,
1353 delta_tx
->dump_msdu_cnt
,
1354 max_tx
->dump_msdu_cnt
);
1355 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1356 fmt_table
, "abort_nxt_frame_mismatch:",
1357 le32_to_cpu(tx
->burst_abort_next_frame_mismatch_cnt
),
1358 accum_tx
->burst_abort_next_frame_mismatch_cnt
,
1359 delta_tx
->burst_abort_next_frame_mismatch_cnt
,
1360 max_tx
->burst_abort_next_frame_mismatch_cnt
);
1361 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1362 fmt_table
, "abort_missing_nxt_frame:",
1363 le32_to_cpu(tx
->burst_abort_missing_next_frame_cnt
),
1364 accum_tx
->burst_abort_missing_next_frame_cnt
,
1365 delta_tx
->burst_abort_missing_next_frame_cnt
,
1366 max_tx
->burst_abort_missing_next_frame_cnt
);
1367 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1368 fmt_table
, "cts_timeout_collision:",
1369 le32_to_cpu(tx
->cts_timeout_collision
),
1370 accum_tx
->cts_timeout_collision
,
1371 delta_tx
->cts_timeout_collision
,
1372 max_tx
->cts_timeout_collision
);
1373 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1374 fmt_table
, "ack_ba_timeout_collision:",
1375 le32_to_cpu(tx
->ack_or_ba_timeout_collision
),
1376 accum_tx
->ack_or_ba_timeout_collision
,
1377 delta_tx
->ack_or_ba_timeout_collision
,
1378 max_tx
->ack_or_ba_timeout_collision
);
1379 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1380 fmt_table
, "agg ba_timeout:",
1381 le32_to_cpu(tx
->agg
.ba_timeout
),
1382 accum_tx
->agg
.ba_timeout
,
1383 delta_tx
->agg
.ba_timeout
,
1384 max_tx
->agg
.ba_timeout
);
1385 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1386 fmt_table
, "agg ba_resched_frames:",
1387 le32_to_cpu(tx
->agg
.ba_reschedule_frames
),
1388 accum_tx
->agg
.ba_reschedule_frames
,
1389 delta_tx
->agg
.ba_reschedule_frames
,
1390 max_tx
->agg
.ba_reschedule_frames
);
1391 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1392 fmt_table
, "agg scd_query_agg_frame:",
1393 le32_to_cpu(tx
->agg
.scd_query_agg_frame_cnt
),
1394 accum_tx
->agg
.scd_query_agg_frame_cnt
,
1395 delta_tx
->agg
.scd_query_agg_frame_cnt
,
1396 max_tx
->agg
.scd_query_agg_frame_cnt
);
1397 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1398 fmt_table
, "agg scd_query_no_agg:",
1399 le32_to_cpu(tx
->agg
.scd_query_no_agg
),
1400 accum_tx
->agg
.scd_query_no_agg
,
1401 delta_tx
->agg
.scd_query_no_agg
,
1402 max_tx
->agg
.scd_query_no_agg
);
1403 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1404 fmt_table
, "agg scd_query_agg:",
1405 le32_to_cpu(tx
->agg
.scd_query_agg
),
1406 accum_tx
->agg
.scd_query_agg
,
1407 delta_tx
->agg
.scd_query_agg
,
1408 max_tx
->agg
.scd_query_agg
);
1409 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1410 fmt_table
, "agg scd_query_mismatch:",
1411 le32_to_cpu(tx
->agg
.scd_query_mismatch
),
1412 accum_tx
->agg
.scd_query_mismatch
,
1413 delta_tx
->agg
.scd_query_mismatch
,
1414 max_tx
->agg
.scd_query_mismatch
);
1415 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1416 fmt_table
, "agg frame_not_ready:",
1417 le32_to_cpu(tx
->agg
.frame_not_ready
),
1418 accum_tx
->agg
.frame_not_ready
,
1419 delta_tx
->agg
.frame_not_ready
,
1420 max_tx
->agg
.frame_not_ready
);
1421 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1422 fmt_table
, "agg underrun:",
1423 le32_to_cpu(tx
->agg
.underrun
),
1424 accum_tx
->agg
.underrun
,
1425 delta_tx
->agg
.underrun
, max_tx
->agg
.underrun
);
1426 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1427 fmt_table
, "agg bt_prio_kill:",
1428 le32_to_cpu(tx
->agg
.bt_prio_kill
),
1429 accum_tx
->agg
.bt_prio_kill
,
1430 delta_tx
->agg
.bt_prio_kill
,
1431 max_tx
->agg
.bt_prio_kill
);
1432 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1433 fmt_table
, "agg rx_ba_rsp_cnt:",
1434 le32_to_cpu(tx
->agg
.rx_ba_rsp_cnt
),
1435 accum_tx
->agg
.rx_ba_rsp_cnt
,
1436 delta_tx
->agg
.rx_ba_rsp_cnt
,
1437 max_tx
->agg
.rx_ba_rsp_cnt
);
1439 if (tx
->tx_power
.ant_a
|| tx
->tx_power
.ant_b
|| tx
->tx_power
.ant_c
) {
1440 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1441 "tx power: (1/2 dB step)\n");
1442 if ((priv
->cfg
->valid_tx_ant
& ANT_A
) && tx
->tx_power
.ant_a
)
1443 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1444 fmt_hex
, "antenna A:",
1445 tx
->tx_power
.ant_a
);
1446 if ((priv
->cfg
->valid_tx_ant
& ANT_B
) && tx
->tx_power
.ant_b
)
1447 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1448 fmt_hex
, "antenna B:",
1449 tx
->tx_power
.ant_b
);
1450 if ((priv
->cfg
->valid_tx_ant
& ANT_C
) && tx
->tx_power
.ant_c
)
1451 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1452 fmt_hex
, "antenna C:",
1453 tx
->tx_power
.ant_c
);
1455 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1460 static ssize_t
iwl_dbgfs_ucode_general_stats_read(struct file
*file
,
1461 char __user
*user_buf
,
1462 size_t count
, loff_t
*ppos
)
1464 struct iwl_priv
*priv
= file
->private_data
;
1467 int bufsz
= sizeof(struct statistics_general
) * 10 + 300;
1469 struct statistics_general_common
*general
, *accum_general
;
1470 struct statistics_general_common
*delta_general
, *max_general
;
1471 struct statistics_dbg
*dbg
, *accum_dbg
, *delta_dbg
, *max_dbg
;
1472 struct statistics_div
*div
, *accum_div
, *delta_div
, *max_div
;
1474 if (!iwl_is_alive(priv
->shrd
))
1477 buf
= kzalloc(bufsz
, GFP_KERNEL
);
1479 IWL_ERR(priv
, "Can not allocate Buffer\n");
1483 /* the statistic information display here is based on
1484 * the last statistics notification from uCode
1485 * might not reflect the current uCode activity
1487 general
= &priv
->statistics
.common
;
1488 dbg
= &priv
->statistics
.common
.dbg
;
1489 div
= &priv
->statistics
.common
.div
;
1490 accum_general
= &priv
->accum_stats
.common
;
1491 accum_dbg
= &priv
->accum_stats
.common
.dbg
;
1492 accum_div
= &priv
->accum_stats
.common
.div
;
1493 delta_general
= &priv
->delta_stats
.common
;
1494 max_general
= &priv
->max_delta_stats
.common
;
1495 delta_dbg
= &priv
->delta_stats
.common
.dbg
;
1496 max_dbg
= &priv
->max_delta_stats
.common
.dbg
;
1497 delta_div
= &priv
->delta_stats
.common
.div
;
1498 max_div
= &priv
->max_delta_stats
.common
.div
;
1500 pos
+= iwl_statistics_flag(priv
, buf
, bufsz
);
1501 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1502 fmt_header
, "Statistics_General:");
1503 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1504 fmt_value
, "temperature:",
1505 le32_to_cpu(general
->temperature
));
1506 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1507 fmt_value
, "temperature_m:",
1508 le32_to_cpu(general
->temperature_m
));
1509 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1510 fmt_value
, "ttl_timestamp:",
1511 le32_to_cpu(general
->ttl_timestamp
));
1512 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1513 fmt_table
, "burst_check:",
1514 le32_to_cpu(dbg
->burst_check
),
1515 accum_dbg
->burst_check
,
1516 delta_dbg
->burst_check
, max_dbg
->burst_check
);
1517 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1518 fmt_table
, "burst_count:",
1519 le32_to_cpu(dbg
->burst_count
),
1520 accum_dbg
->burst_count
,
1521 delta_dbg
->burst_count
, max_dbg
->burst_count
);
1522 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1523 fmt_table
, "wait_for_silence_timeout_count:",
1524 le32_to_cpu(dbg
->wait_for_silence_timeout_cnt
),
1525 accum_dbg
->wait_for_silence_timeout_cnt
,
1526 delta_dbg
->wait_for_silence_timeout_cnt
,
1527 max_dbg
->wait_for_silence_timeout_cnt
);
1528 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1529 fmt_table
, "sleep_time:",
1530 le32_to_cpu(general
->sleep_time
),
1531 accum_general
->sleep_time
,
1532 delta_general
->sleep_time
, max_general
->sleep_time
);
1533 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1534 fmt_table
, "slots_out:",
1535 le32_to_cpu(general
->slots_out
),
1536 accum_general
->slots_out
,
1537 delta_general
->slots_out
, max_general
->slots_out
);
1538 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1539 fmt_table
, "slots_idle:",
1540 le32_to_cpu(general
->slots_idle
),
1541 accum_general
->slots_idle
,
1542 delta_general
->slots_idle
, max_general
->slots_idle
);
1543 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1544 fmt_table
, "tx_on_a:",
1545 le32_to_cpu(div
->tx_on_a
), accum_div
->tx_on_a
,
1546 delta_div
->tx_on_a
, max_div
->tx_on_a
);
1547 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1548 fmt_table
, "tx_on_b:",
1549 le32_to_cpu(div
->tx_on_b
), accum_div
->tx_on_b
,
1550 delta_div
->tx_on_b
, max_div
->tx_on_b
);
1551 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1552 fmt_table
, "exec_time:",
1553 le32_to_cpu(div
->exec_time
), accum_div
->exec_time
,
1554 delta_div
->exec_time
, max_div
->exec_time
);
1555 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1556 fmt_table
, "probe_time:",
1557 le32_to_cpu(div
->probe_time
), accum_div
->probe_time
,
1558 delta_div
->probe_time
, max_div
->probe_time
);
1559 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1560 fmt_table
, "rx_enable_counter:",
1561 le32_to_cpu(general
->rx_enable_counter
),
1562 accum_general
->rx_enable_counter
,
1563 delta_general
->rx_enable_counter
,
1564 max_general
->rx_enable_counter
);
1565 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1566 fmt_table
, "num_of_sos_states:",
1567 le32_to_cpu(general
->num_of_sos_states
),
1568 accum_general
->num_of_sos_states
,
1569 delta_general
->num_of_sos_states
,
1570 max_general
->num_of_sos_states
);
1571 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1576 static ssize_t
iwl_dbgfs_ucode_bt_stats_read(struct file
*file
,
1577 char __user
*user_buf
,
1578 size_t count
, loff_t
*ppos
)
1580 struct iwl_priv
*priv
= (struct iwl_priv
*)file
->private_data
;
1583 int bufsz
= (sizeof(struct statistics_bt_activity
) * 24) + 200;
1585 struct statistics_bt_activity
*bt
, *accum_bt
;
1587 if (!iwl_is_alive(priv
->shrd
))
1590 if (!priv
->bt_enable_flag
)
1593 /* make request to uCode to retrieve statistics information */
1594 mutex_lock(&priv
->shrd
->mutex
);
1595 ret
= iwl_send_statistics_request(priv
, CMD_SYNC
, false);
1596 mutex_unlock(&priv
->shrd
->mutex
);
1600 "Error sending statistics request: %zd\n", ret
);
1603 buf
= kzalloc(bufsz
, GFP_KERNEL
);
1605 IWL_ERR(priv
, "Can not allocate Buffer\n");
1610 * the statistic information display here is based on
1611 * the last statistics notification from uCode
1612 * might not reflect the current uCode activity
1614 bt
= &priv
->statistics
.bt_activity
;
1615 accum_bt
= &priv
->accum_stats
.bt_activity
;
1617 pos
+= iwl_statistics_flag(priv
, buf
, bufsz
);
1618 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Statistics_BT:\n");
1619 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1620 "\t\t\tcurrent\t\t\taccumulative\n");
1621 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1622 "hi_priority_tx_req_cnt:\t\t%u\t\t\t%u\n",
1623 le32_to_cpu(bt
->hi_priority_tx_req_cnt
),
1624 accum_bt
->hi_priority_tx_req_cnt
);
1625 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1626 "hi_priority_tx_denied_cnt:\t%u\t\t\t%u\n",
1627 le32_to_cpu(bt
->hi_priority_tx_denied_cnt
),
1628 accum_bt
->hi_priority_tx_denied_cnt
);
1629 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1630 "lo_priority_tx_req_cnt:\t\t%u\t\t\t%u\n",
1631 le32_to_cpu(bt
->lo_priority_tx_req_cnt
),
1632 accum_bt
->lo_priority_tx_req_cnt
);
1633 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1634 "lo_priority_tx_denied_cnt:\t%u\t\t\t%u\n",
1635 le32_to_cpu(bt
->lo_priority_tx_denied_cnt
),
1636 accum_bt
->lo_priority_tx_denied_cnt
);
1637 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1638 "hi_priority_rx_req_cnt:\t\t%u\t\t\t%u\n",
1639 le32_to_cpu(bt
->hi_priority_rx_req_cnt
),
1640 accum_bt
->hi_priority_rx_req_cnt
);
1641 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1642 "hi_priority_rx_denied_cnt:\t%u\t\t\t%u\n",
1643 le32_to_cpu(bt
->hi_priority_rx_denied_cnt
),
1644 accum_bt
->hi_priority_rx_denied_cnt
);
1645 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1646 "lo_priority_rx_req_cnt:\t\t%u\t\t\t%u\n",
1647 le32_to_cpu(bt
->lo_priority_rx_req_cnt
),
1648 accum_bt
->lo_priority_rx_req_cnt
);
1649 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1650 "lo_priority_rx_denied_cnt:\t%u\t\t\t%u\n",
1651 le32_to_cpu(bt
->lo_priority_rx_denied_cnt
),
1652 accum_bt
->lo_priority_rx_denied_cnt
);
1654 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1655 "(rx)num_bt_kills:\t\t%u\t\t\t%u\n",
1656 le32_to_cpu(priv
->statistics
.num_bt_kills
),
1657 priv
->statistics
.accum_num_bt_kills
);
1659 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1664 static ssize_t
iwl_dbgfs_reply_tx_error_read(struct file
*file
,
1665 char __user
*user_buf
,
1666 size_t count
, loff_t
*ppos
)
1668 struct iwl_priv
*priv
= (struct iwl_priv
*)file
->private_data
;
1671 int bufsz
= (sizeof(struct reply_tx_error_statistics
) * 24) +
1672 (sizeof(struct reply_agg_tx_error_statistics
) * 24) + 200;
1675 if (!iwl_is_alive(priv
->shrd
))
1678 buf
= kzalloc(bufsz
, GFP_KERNEL
);
1680 IWL_ERR(priv
, "Can not allocate Buffer\n");
1684 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Statistics_TX_Error:\n");
1685 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t\t%u\n",
1686 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_DELAY
),
1687 priv
->reply_tx_stats
.pp_delay
);
1688 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1689 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_FEW_BYTES
),
1690 priv
->reply_tx_stats
.pp_few_bytes
);
1691 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1692 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_BT_PRIO
),
1693 priv
->reply_tx_stats
.pp_bt_prio
);
1694 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1695 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_QUIET_PERIOD
),
1696 priv
->reply_tx_stats
.pp_quiet_period
);
1697 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1698 iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_CALC_TTAK
),
1699 priv
->reply_tx_stats
.pp_calc_ttak
);
1700 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t%u\n",
1701 iwl_get_tx_fail_reason(
1702 TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY
),
1703 priv
->reply_tx_stats
.int_crossed_retry
);
1704 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1705 iwl_get_tx_fail_reason(TX_STATUS_FAIL_SHORT_LIMIT
),
1706 priv
->reply_tx_stats
.short_limit
);
1707 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1708 iwl_get_tx_fail_reason(TX_STATUS_FAIL_LONG_LIMIT
),
1709 priv
->reply_tx_stats
.long_limit
);
1710 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1711 iwl_get_tx_fail_reason(TX_STATUS_FAIL_FIFO_UNDERRUN
),
1712 priv
->reply_tx_stats
.fifo_underrun
);
1713 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1714 iwl_get_tx_fail_reason(TX_STATUS_FAIL_DRAIN_FLOW
),
1715 priv
->reply_tx_stats
.drain_flow
);
1716 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1717 iwl_get_tx_fail_reason(TX_STATUS_FAIL_RFKILL_FLUSH
),
1718 priv
->reply_tx_stats
.rfkill_flush
);
1719 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1720 iwl_get_tx_fail_reason(TX_STATUS_FAIL_LIFE_EXPIRE
),
1721 priv
->reply_tx_stats
.life_expire
);
1722 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1723 iwl_get_tx_fail_reason(TX_STATUS_FAIL_DEST_PS
),
1724 priv
->reply_tx_stats
.dest_ps
);
1725 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1726 iwl_get_tx_fail_reason(TX_STATUS_FAIL_HOST_ABORTED
),
1727 priv
->reply_tx_stats
.host_abort
);
1728 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1729 iwl_get_tx_fail_reason(TX_STATUS_FAIL_BT_RETRY
),
1730 priv
->reply_tx_stats
.pp_delay
);
1731 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1732 iwl_get_tx_fail_reason(TX_STATUS_FAIL_STA_INVALID
),
1733 priv
->reply_tx_stats
.sta_invalid
);
1734 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1735 iwl_get_tx_fail_reason(TX_STATUS_FAIL_FRAG_DROPPED
),
1736 priv
->reply_tx_stats
.frag_drop
);
1737 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1738 iwl_get_tx_fail_reason(TX_STATUS_FAIL_TID_DISABLE
),
1739 priv
->reply_tx_stats
.tid_disable
);
1740 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1741 iwl_get_tx_fail_reason(TX_STATUS_FAIL_FIFO_FLUSHED
),
1742 priv
->reply_tx_stats
.fifo_flush
);
1743 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t%u\n",
1744 iwl_get_tx_fail_reason(
1745 TX_STATUS_FAIL_INSUFFICIENT_CF_POLL
),
1746 priv
->reply_tx_stats
.insuff_cf_poll
);
1747 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1748 iwl_get_tx_fail_reason(TX_STATUS_FAIL_PASSIVE_NO_RX
),
1749 priv
->reply_tx_stats
.fail_hw_drop
);
1750 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t%u\n",
1751 iwl_get_tx_fail_reason(
1752 TX_STATUS_FAIL_NO_BEACON_ON_RADAR
),
1753 priv
->reply_tx_stats
.sta_color_mismatch
);
1754 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "UNKNOWN:\t\t\t%u\n",
1755 priv
->reply_tx_stats
.unknown
);
1757 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1758 "\nStatistics_Agg_TX_Error:\n");
1760 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1761 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_UNDERRUN_MSK
),
1762 priv
->reply_agg_tx_stats
.underrun
);
1763 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1764 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_BT_PRIO_MSK
),
1765 priv
->reply_agg_tx_stats
.bt_prio
);
1766 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1767 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_FEW_BYTES_MSK
),
1768 priv
->reply_agg_tx_stats
.few_bytes
);
1769 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1770 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_ABORT_MSK
),
1771 priv
->reply_agg_tx_stats
.abort
);
1772 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t%u\n",
1773 iwl_get_agg_tx_fail_reason(
1774 AGG_TX_STATE_LAST_SENT_TTL_MSK
),
1775 priv
->reply_agg_tx_stats
.last_sent_ttl
);
1776 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t%u\n",
1777 iwl_get_agg_tx_fail_reason(
1778 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK
),
1779 priv
->reply_agg_tx_stats
.last_sent_try
);
1780 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t%u\n",
1781 iwl_get_agg_tx_fail_reason(
1782 AGG_TX_STATE_LAST_SENT_BT_KILL_MSK
),
1783 priv
->reply_agg_tx_stats
.last_sent_bt_kill
);
1784 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1785 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_SCD_QUERY_MSK
),
1786 priv
->reply_agg_tx_stats
.scd_query
);
1787 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t%u\n",
1788 iwl_get_agg_tx_fail_reason(
1789 AGG_TX_STATE_TEST_BAD_CRC32_MSK
),
1790 priv
->reply_agg_tx_stats
.bad_crc32
);
1791 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1792 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_RESPONSE_MSK
),
1793 priv
->reply_agg_tx_stats
.response
);
1794 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1795 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_DUMP_TX_MSK
),
1796 priv
->reply_agg_tx_stats
.dump_tx
);
1797 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s:\t\t\t%u\n",
1798 iwl_get_agg_tx_fail_reason(AGG_TX_STATE_DELAY_TX_MSK
),
1799 priv
->reply_agg_tx_stats
.delay_tx
);
1800 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "UNKNOWN:\t\t\t%u\n",
1801 priv
->reply_agg_tx_stats
.unknown
);
1803 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1808 static ssize_t
iwl_dbgfs_sensitivity_read(struct file
*file
,
1809 char __user
*user_buf
,
1810 size_t count
, loff_t
*ppos
) {
1812 struct iwl_priv
*priv
= file
->private_data
;
1816 int bufsz
= sizeof(struct iwl_sensitivity_data
) * 4 + 100;
1818 struct iwl_sensitivity_data
*data
;
1820 data
= &priv
->sensitivity_data
;
1821 buf
= kzalloc(bufsz
, GFP_KERNEL
);
1823 IWL_ERR(priv
, "Can not allocate Buffer\n");
1827 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "auto_corr_ofdm:\t\t\t %u\n",
1828 data
->auto_corr_ofdm
);
1829 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1830 "auto_corr_ofdm_mrc:\t\t %u\n",
1831 data
->auto_corr_ofdm_mrc
);
1832 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "auto_corr_ofdm_x1:\t\t %u\n",
1833 data
->auto_corr_ofdm_x1
);
1834 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1835 "auto_corr_ofdm_mrc_x1:\t\t %u\n",
1836 data
->auto_corr_ofdm_mrc_x1
);
1837 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "auto_corr_cck:\t\t\t %u\n",
1838 data
->auto_corr_cck
);
1839 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "auto_corr_cck_mrc:\t\t %u\n",
1840 data
->auto_corr_cck_mrc
);
1841 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1842 "last_bad_plcp_cnt_ofdm:\t\t %u\n",
1843 data
->last_bad_plcp_cnt_ofdm
);
1844 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "last_fa_cnt_ofdm:\t\t %u\n",
1845 data
->last_fa_cnt_ofdm
);
1846 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1847 "last_bad_plcp_cnt_cck:\t\t %u\n",
1848 data
->last_bad_plcp_cnt_cck
);
1849 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "last_fa_cnt_cck:\t\t %u\n",
1850 data
->last_fa_cnt_cck
);
1851 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_curr_state:\t\t\t %u\n",
1852 data
->nrg_curr_state
);
1853 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_prev_state:\t\t\t %u\n",
1854 data
->nrg_prev_state
);
1855 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_value:\t\t\t");
1856 for (cnt
= 0; cnt
< 10; cnt
++) {
1857 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, " %u",
1858 data
->nrg_value
[cnt
]);
1860 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
1861 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_silence_rssi:\t\t");
1862 for (cnt
= 0; cnt
< NRG_NUM_PREV_STAT_L
; cnt
++) {
1863 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, " %u",
1864 data
->nrg_silence_rssi
[cnt
]);
1866 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
1867 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_silence_ref:\t\t %u\n",
1868 data
->nrg_silence_ref
);
1869 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_energy_idx:\t\t\t %u\n",
1870 data
->nrg_energy_idx
);
1871 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_silence_idx:\t\t %u\n",
1872 data
->nrg_silence_idx
);
1873 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_th_cck:\t\t\t %u\n",
1875 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
1876 "nrg_auto_corr_silence_diff:\t %u\n",
1877 data
->nrg_auto_corr_silence_diff
);
1878 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "num_in_cck_no_fa:\t\t %u\n",
1879 data
->num_in_cck_no_fa
);
1880 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "nrg_th_ofdm:\t\t\t %u\n",
1883 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1889 static ssize_t
iwl_dbgfs_chain_noise_read(struct file
*file
,
1890 char __user
*user_buf
,
1891 size_t count
, loff_t
*ppos
) {
1893 struct iwl_priv
*priv
= file
->private_data
;
1897 int bufsz
= sizeof(struct iwl_chain_noise_data
) * 4 + 100;
1899 struct iwl_chain_noise_data
*data
;
1901 data
= &priv
->chain_noise_data
;
1902 buf
= kzalloc(bufsz
, GFP_KERNEL
);
1904 IWL_ERR(priv
, "Can not allocate Buffer\n");
1908 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "active_chains:\t\t\t %u\n",
1909 data
->active_chains
);
1910 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_noise_a:\t\t\t %u\n",
1911 data
->chain_noise_a
);
1912 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_noise_b:\t\t\t %u\n",
1913 data
->chain_noise_b
);
1914 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_noise_c:\t\t\t %u\n",
1915 data
->chain_noise_c
);
1916 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_signal_a:\t\t\t %u\n",
1917 data
->chain_signal_a
);
1918 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_signal_b:\t\t\t %u\n",
1919 data
->chain_signal_b
);
1920 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "chain_signal_c:\t\t\t %u\n",
1921 data
->chain_signal_c
);
1922 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "beacon_count:\t\t\t %u\n",
1923 data
->beacon_count
);
1925 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "disconn_array:\t\t\t");
1926 for (cnt
= 0; cnt
< NUM_RX_CHAINS
; cnt
++) {
1927 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, " %u",
1928 data
->disconn_array
[cnt
]);
1930 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
1931 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "delta_gain_code:\t\t");
1932 for (cnt
= 0; cnt
< NUM_RX_CHAINS
; cnt
++) {
1933 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, " %u",
1934 data
->delta_gain_code
[cnt
]);
1936 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "\n");
1937 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "radio_write:\t\t\t %u\n",
1939 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "state:\t\t\t\t %u\n",
1942 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1947 static ssize_t
iwl_dbgfs_power_save_status_read(struct file
*file
,
1948 char __user
*user_buf
,
1949 size_t count
, loff_t
*ppos
)
1951 struct iwl_priv
*priv
= file
->private_data
;
1954 const size_t bufsz
= sizeof(buf
);
1957 pwrsave_status
= iwl_read32(priv
, CSR_GP_CNTRL
) &
1958 CSR_GP_REG_POWER_SAVE_STATUS_MSK
;
1960 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Power Save Status: ");
1961 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%s\n",
1962 (pwrsave_status
== CSR_GP_REG_NO_POWER_SAVE
) ? "none" :
1963 (pwrsave_status
== CSR_GP_REG_MAC_POWER_SAVE
) ? "MAC" :
1964 (pwrsave_status
== CSR_GP_REG_PHY_POWER_SAVE
) ? "PHY" :
1967 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
1970 static ssize_t
iwl_dbgfs_clear_ucode_statistics_write(struct file
*file
,
1971 const char __user
*user_buf
,
1972 size_t count
, loff_t
*ppos
)
1974 struct iwl_priv
*priv
= file
->private_data
;
1979 memset(buf
, 0, sizeof(buf
));
1980 buf_size
= min(count
, sizeof(buf
) - 1);
1981 if (copy_from_user(buf
, user_buf
, buf_size
))
1983 if (sscanf(buf
, "%d", &clear
) != 1)
1986 /* make request to uCode to retrieve statistics information */
1987 mutex_lock(&priv
->shrd
->mutex
);
1988 iwl_send_statistics_request(priv
, CMD_SYNC
, true);
1989 mutex_unlock(&priv
->shrd
->mutex
);
1994 static ssize_t
iwl_dbgfs_csr_write(struct file
*file
,
1995 const char __user
*user_buf
,
1996 size_t count
, loff_t
*ppos
)
1998 struct iwl_priv
*priv
= file
->private_data
;
2003 memset(buf
, 0, sizeof(buf
));
2004 buf_size
= min(count
, sizeof(buf
) - 1);
2005 if (copy_from_user(buf
, user_buf
, buf_size
))
2007 if (sscanf(buf
, "%d", &csr
) != 1)
2015 static ssize_t
iwl_dbgfs_ucode_tracing_read(struct file
*file
,
2016 char __user
*user_buf
,
2017 size_t count
, loff_t
*ppos
) {
2019 struct iwl_priv
*priv
= file
->private_data
;
2022 const size_t bufsz
= sizeof(buf
);
2024 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "ucode trace timer is %s\n",
2025 priv
->event_log
.ucode_trace
? "On" : "Off");
2026 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "non_wraps_count:\t\t %u\n",
2027 priv
->event_log
.non_wraps_count
);
2028 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "wraps_once_count:\t\t %u\n",
2029 priv
->event_log
.wraps_once_count
);
2030 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "wraps_more_count:\t\t %u\n",
2031 priv
->event_log
.wraps_more_count
);
2033 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2036 static ssize_t
iwl_dbgfs_ucode_tracing_write(struct file
*file
,
2037 const char __user
*user_buf
,
2038 size_t count
, loff_t
*ppos
)
2040 struct iwl_priv
*priv
= file
->private_data
;
2045 memset(buf
, 0, sizeof(buf
));
2046 buf_size
= min(count
, sizeof(buf
) - 1);
2047 if (copy_from_user(buf
, user_buf
, buf_size
))
2049 if (sscanf(buf
, "%d", &trace
) != 1)
2053 priv
->event_log
.ucode_trace
= true;
2054 /* schedule the ucode timer to occur in UCODE_TRACE_PERIOD */
2055 mod_timer(&priv
->ucode_trace
,
2056 jiffies
+ msecs_to_jiffies(UCODE_TRACE_PERIOD
));
2058 priv
->event_log
.ucode_trace
= false;
2059 del_timer_sync(&priv
->ucode_trace
);
2065 static ssize_t
iwl_dbgfs_rxon_flags_read(struct file
*file
,
2066 char __user
*user_buf
,
2067 size_t count
, loff_t
*ppos
) {
2069 struct iwl_priv
*priv
= file
->private_data
;
2073 len
= sprintf(buf
, "0x%04X\n",
2074 le32_to_cpu(priv
->contexts
[IWL_RXON_CTX_BSS
].active
.flags
));
2075 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
2078 static ssize_t
iwl_dbgfs_rxon_filter_flags_read(struct file
*file
,
2079 char __user
*user_buf
,
2080 size_t count
, loff_t
*ppos
) {
2082 struct iwl_priv
*priv
= file
->private_data
;
2086 len
= sprintf(buf
, "0x%04X\n",
2087 le32_to_cpu(priv
->contexts
[IWL_RXON_CTX_BSS
].active
.filter_flags
));
2088 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
2091 static ssize_t
iwl_dbgfs_fh_reg_read(struct file
*file
,
2092 char __user
*user_buf
,
2093 size_t count
, loff_t
*ppos
)
2095 struct iwl_priv
*priv
= file
->private_data
;
2098 ssize_t ret
= -EFAULT
;
2100 ret
= pos
= iwl_dump_fh(priv
, &buf
, true);
2102 ret
= simple_read_from_buffer(user_buf
,
2103 count
, ppos
, buf
, pos
);
2110 static ssize_t
iwl_dbgfs_missed_beacon_read(struct file
*file
,
2111 char __user
*user_buf
,
2112 size_t count
, loff_t
*ppos
) {
2114 struct iwl_priv
*priv
= file
->private_data
;
2117 const size_t bufsz
= sizeof(buf
);
2119 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%d\n",
2120 priv
->missed_beacon_threshold
);
2122 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2125 static ssize_t
iwl_dbgfs_missed_beacon_write(struct file
*file
,
2126 const char __user
*user_buf
,
2127 size_t count
, loff_t
*ppos
)
2129 struct iwl_priv
*priv
= file
->private_data
;
2134 memset(buf
, 0, sizeof(buf
));
2135 buf_size
= min(count
, sizeof(buf
) - 1);
2136 if (copy_from_user(buf
, user_buf
, buf_size
))
2138 if (sscanf(buf
, "%d", &missed
) != 1)
2141 if (missed
< IWL_MISSED_BEACON_THRESHOLD_MIN
||
2142 missed
> IWL_MISSED_BEACON_THRESHOLD_MAX
)
2143 priv
->missed_beacon_threshold
=
2144 IWL_MISSED_BEACON_THRESHOLD_DEF
;
2146 priv
->missed_beacon_threshold
= missed
;
2151 static ssize_t
iwl_dbgfs_plcp_delta_read(struct file
*file
,
2152 char __user
*user_buf
,
2153 size_t count
, loff_t
*ppos
) {
2155 struct iwl_priv
*priv
= file
->private_data
;
2158 const size_t bufsz
= sizeof(buf
);
2160 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "%u\n",
2161 priv
->cfg
->base_params
->plcp_delta_threshold
);
2163 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2166 static ssize_t
iwl_dbgfs_plcp_delta_write(struct file
*file
,
2167 const char __user
*user_buf
,
2168 size_t count
, loff_t
*ppos
) {
2170 struct iwl_priv
*priv
= file
->private_data
;
2175 memset(buf
, 0, sizeof(buf
));
2176 buf_size
= min(count
, sizeof(buf
) - 1);
2177 if (copy_from_user(buf
, user_buf
, buf_size
))
2179 if (sscanf(buf
, "%d", &plcp
) != 1)
2181 if ((plcp
< IWL_MAX_PLCP_ERR_THRESHOLD_MIN
) ||
2182 (plcp
> IWL_MAX_PLCP_ERR_THRESHOLD_MAX
))
2183 priv
->cfg
->base_params
->plcp_delta_threshold
=
2184 IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE
;
2186 priv
->cfg
->base_params
->plcp_delta_threshold
= plcp
;
2190 static ssize_t
iwl_dbgfs_force_reset_read(struct file
*file
,
2191 char __user
*user_buf
,
2192 size_t count
, loff_t
*ppos
) {
2194 struct iwl_priv
*priv
= file
->private_data
;
2197 const size_t bufsz
= sizeof(buf
);
2198 struct iwl_force_reset
*force_reset
;
2200 for (i
= 0; i
< IWL_MAX_FORCE_RESET
; i
++) {
2201 force_reset
= &priv
->force_reset
[i
];
2202 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
2203 "Force reset method %d\n", i
);
2204 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
2205 "\tnumber of reset request: %d\n",
2206 force_reset
->reset_request_count
);
2207 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
2208 "\tnumber of reset request success: %d\n",
2209 force_reset
->reset_success_count
);
2210 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
2211 "\tnumber of reset request reject: %d\n",
2212 force_reset
->reset_reject_count
);
2213 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
2214 "\treset duration: %lu\n",
2215 force_reset
->reset_duration
);
2217 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2220 static ssize_t
iwl_dbgfs_force_reset_write(struct file
*file
,
2221 const char __user
*user_buf
,
2222 size_t count
, loff_t
*ppos
) {
2224 struct iwl_priv
*priv
= file
->private_data
;
2229 memset(buf
, 0, sizeof(buf
));
2230 buf_size
= min(count
, sizeof(buf
) - 1);
2231 if (copy_from_user(buf
, user_buf
, buf_size
))
2233 if (sscanf(buf
, "%d", &reset
) != 1)
2238 ret
= iwl_force_reset(priv
, reset
, true);
2243 return ret
? ret
: count
;
2246 static ssize_t
iwl_dbgfs_txfifo_flush_write(struct file
*file
,
2247 const char __user
*user_buf
,
2248 size_t count
, loff_t
*ppos
) {
2250 struct iwl_priv
*priv
= file
->private_data
;
2255 memset(buf
, 0, sizeof(buf
));
2256 buf_size
= min(count
, sizeof(buf
) - 1);
2257 if (copy_from_user(buf
, user_buf
, buf_size
))
2259 if (sscanf(buf
, "%d", &flush
) != 1)
2262 if (iwl_is_rfkill(priv
->shrd
))
2265 iwlagn_dev_txfifo_flush(priv
, IWL_DROP_ALL
);
2270 static ssize_t
iwl_dbgfs_wd_timeout_write(struct file
*file
,
2271 const char __user
*user_buf
,
2272 size_t count
, loff_t
*ppos
) {
2274 struct iwl_priv
*priv
= file
->private_data
;
2279 memset(buf
, 0, sizeof(buf
));
2280 buf_size
= min(count
, sizeof(buf
) - 1);
2281 if (copy_from_user(buf
, user_buf
, buf_size
))
2283 if (sscanf(buf
, "%d", &timeout
) != 1)
2285 if (timeout
< 0 || timeout
> IWL_MAX_WD_TIMEOUT
)
2286 timeout
= IWL_DEF_WD_TIMEOUT
;
2288 priv
->cfg
->base_params
->wd_timeout
= timeout
;
2289 iwl_setup_watchdog(priv
);
2293 static ssize_t
iwl_dbgfs_bt_traffic_read(struct file
*file
,
2294 char __user
*user_buf
,
2295 size_t count
, loff_t
*ppos
) {
2297 struct iwl_priv
*priv
= (struct iwl_priv
*)file
->private_data
;
2300 const size_t bufsz
= sizeof(buf
);
2302 if (!priv
->bt_enable_flag
) {
2303 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "BT coex disabled\n");
2304 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2306 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "BT enable flag: 0x%x\n",
2307 priv
->bt_enable_flag
);
2308 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "BT in %s mode\n",
2309 priv
->bt_full_concurrent
? "full concurrency" : "3-wire");
2310 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "BT status: %s, "
2311 "last traffic notif: %d\n",
2312 priv
->bt_status
? "On" : "Off", priv
->last_bt_traffic_load
);
2313 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "ch_announcement: %d, "
2314 "kill_ack_mask: %x, kill_cts_mask: %x\n",
2315 priv
->bt_ch_announce
, priv
->kill_ack_mask
,
2316 priv
->kill_cts_mask
);
2318 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "bluetooth traffic load: ");
2319 switch (priv
->bt_traffic_load
) {
2320 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS
:
2321 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Continuous\n");
2323 case IWL_BT_COEX_TRAFFIC_LOAD_HIGH
:
2324 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "High\n");
2326 case IWL_BT_COEX_TRAFFIC_LOAD_LOW
:
2327 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "Low\n");
2329 case IWL_BT_COEX_TRAFFIC_LOAD_NONE
:
2331 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "None\n");
2335 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2338 static ssize_t
iwl_dbgfs_protection_mode_read(struct file
*file
,
2339 char __user
*user_buf
,
2340 size_t count
, loff_t
*ppos
)
2342 struct iwl_priv
*priv
= (struct iwl_priv
*)file
->private_data
;
2346 const size_t bufsz
= sizeof(buf
);
2348 if (priv
->cfg
->ht_params
)
2349 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
,
2350 "use %s for aggregation\n",
2351 (priv
->cfg
->ht_params
->use_rts_for_aggregation
) ?
2352 "rts/cts" : "cts-to-self");
2354 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, "N/A");
2356 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
2359 static ssize_t
iwl_dbgfs_protection_mode_write(struct file
*file
,
2360 const char __user
*user_buf
,
2361 size_t count
, loff_t
*ppos
) {
2363 struct iwl_priv
*priv
= file
->private_data
;
2368 if (!priv
->cfg
->ht_params
)
2371 memset(buf
, 0, sizeof(buf
));
2372 buf_size
= min(count
, sizeof(buf
) - 1);
2373 if (copy_from_user(buf
, user_buf
, buf_size
))
2375 if (sscanf(buf
, "%d", &rts
) != 1)
2378 priv
->cfg
->ht_params
->use_rts_for_aggregation
= true;
2380 priv
->cfg
->ht_params
->use_rts_for_aggregation
= false;
2384 DEBUGFS_READ_FILE_OPS(rx_statistics
);
2385 DEBUGFS_READ_FILE_OPS(tx_statistics
);
2386 DEBUGFS_READ_FILE_OPS(ucode_rx_stats
);
2387 DEBUGFS_READ_FILE_OPS(ucode_tx_stats
);
2388 DEBUGFS_READ_FILE_OPS(ucode_general_stats
);
2389 DEBUGFS_READ_FILE_OPS(sensitivity
);
2390 DEBUGFS_READ_FILE_OPS(chain_noise
);
2391 DEBUGFS_READ_FILE_OPS(power_save_status
);
2392 DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics
);
2393 DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics
);
2394 DEBUGFS_WRITE_FILE_OPS(csr
);
2395 DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing
);
2396 DEBUGFS_READ_FILE_OPS(fh_reg
);
2397 DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon
);
2398 DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta
);
2399 DEBUGFS_READ_WRITE_FILE_OPS(force_reset
);
2400 DEBUGFS_READ_FILE_OPS(rxon_flags
);
2401 DEBUGFS_READ_FILE_OPS(rxon_filter_flags
);
2402 DEBUGFS_WRITE_FILE_OPS(txfifo_flush
);
2403 DEBUGFS_READ_FILE_OPS(ucode_bt_stats
);
2404 DEBUGFS_WRITE_FILE_OPS(wd_timeout
);
2405 DEBUGFS_READ_FILE_OPS(bt_traffic
);
2406 DEBUGFS_READ_WRITE_FILE_OPS(protection_mode
);
2407 DEBUGFS_READ_FILE_OPS(reply_tx_error
);
2410 * Create the debugfs files and directories
2413 int iwl_dbgfs_register(struct iwl_priv
*priv
, const char *name
)
2415 struct dentry
*phyd
= priv
->hw
->wiphy
->debugfsdir
;
2416 struct dentry
*dir_drv
, *dir_data
, *dir_rf
, *dir_debug
;
2418 dir_drv
= debugfs_create_dir(name
, phyd
);
2422 priv
->debugfs_dir
= dir_drv
;
2424 dir_data
= debugfs_create_dir("data", dir_drv
);
2427 dir_rf
= debugfs_create_dir("rf", dir_drv
);
2430 dir_debug
= debugfs_create_dir("debug", dir_drv
);
2434 DEBUGFS_ADD_FILE(nvm
, dir_data
, S_IRUSR
);
2435 DEBUGFS_ADD_FILE(sram
, dir_data
, S_IWUSR
| S_IRUSR
);
2436 DEBUGFS_ADD_FILE(wowlan_sram
, dir_data
, S_IRUSR
);
2437 DEBUGFS_ADD_FILE(stations
, dir_data
, S_IRUSR
);
2438 DEBUGFS_ADD_FILE(channels
, dir_data
, S_IRUSR
);
2439 DEBUGFS_ADD_FILE(status
, dir_data
, S_IRUSR
);
2440 DEBUGFS_ADD_FILE(rx_handlers
, dir_data
, S_IWUSR
| S_IRUSR
);
2441 DEBUGFS_ADD_FILE(qos
, dir_data
, S_IRUSR
);
2442 DEBUGFS_ADD_FILE(sleep_level_override
, dir_data
, S_IWUSR
| S_IRUSR
);
2443 DEBUGFS_ADD_FILE(current_sleep_command
, dir_data
, S_IRUSR
);
2444 DEBUGFS_ADD_FILE(thermal_throttling
, dir_data
, S_IRUSR
);
2445 DEBUGFS_ADD_FILE(disable_ht40
, dir_data
, S_IWUSR
| S_IRUSR
);
2446 DEBUGFS_ADD_FILE(rx_statistics
, dir_debug
, S_IRUSR
);
2447 DEBUGFS_ADD_FILE(tx_statistics
, dir_debug
, S_IRUSR
);
2448 DEBUGFS_ADD_FILE(power_save_status
, dir_debug
, S_IRUSR
);
2449 DEBUGFS_ADD_FILE(clear_ucode_statistics
, dir_debug
, S_IWUSR
);
2450 DEBUGFS_ADD_FILE(clear_traffic_statistics
, dir_debug
, S_IWUSR
);
2451 DEBUGFS_ADD_FILE(csr
, dir_debug
, S_IWUSR
);
2452 DEBUGFS_ADD_FILE(fh_reg
, dir_debug
, S_IRUSR
);
2453 DEBUGFS_ADD_FILE(missed_beacon
, dir_debug
, S_IWUSR
);
2454 DEBUGFS_ADD_FILE(plcp_delta
, dir_debug
, S_IWUSR
| S_IRUSR
);
2455 DEBUGFS_ADD_FILE(force_reset
, dir_debug
, S_IWUSR
| S_IRUSR
);
2456 DEBUGFS_ADD_FILE(ucode_rx_stats
, dir_debug
, S_IRUSR
);
2457 DEBUGFS_ADD_FILE(ucode_tx_stats
, dir_debug
, S_IRUSR
);
2458 DEBUGFS_ADD_FILE(ucode_general_stats
, dir_debug
, S_IRUSR
);
2459 DEBUGFS_ADD_FILE(txfifo_flush
, dir_debug
, S_IWUSR
);
2460 DEBUGFS_ADD_FILE(protection_mode
, dir_debug
, S_IWUSR
| S_IRUSR
);
2462 DEBUGFS_ADD_FILE(sensitivity
, dir_debug
, S_IRUSR
);
2463 DEBUGFS_ADD_FILE(chain_noise
, dir_debug
, S_IRUSR
);
2464 DEBUGFS_ADD_FILE(ucode_tracing
, dir_debug
, S_IWUSR
| S_IRUSR
);
2465 DEBUGFS_ADD_FILE(ucode_bt_stats
, dir_debug
, S_IRUSR
);
2466 DEBUGFS_ADD_FILE(reply_tx_error
, dir_debug
, S_IRUSR
);
2467 DEBUGFS_ADD_FILE(rxon_flags
, dir_debug
, S_IWUSR
);
2468 DEBUGFS_ADD_FILE(rxon_filter_flags
, dir_debug
, S_IWUSR
);
2469 DEBUGFS_ADD_FILE(wd_timeout
, dir_debug
, S_IWUSR
);
2470 if (iwl_advanced_bt_coexist(priv
))
2471 DEBUGFS_ADD_FILE(bt_traffic
, dir_debug
, S_IRUSR
);
2472 DEBUGFS_ADD_BOOL(disable_sensitivity
, dir_rf
,
2473 &priv
->disable_sens_cal
);
2474 DEBUGFS_ADD_BOOL(disable_chain_noise
, dir_rf
,
2475 &priv
->disable_chain_noise_cal
);
2477 if (iwl_trans_dbgfs_register(trans(priv
), dir_debug
))
2482 IWL_ERR(priv
, "Can't create the debugfs directory\n");
2483 iwl_dbgfs_unregister(priv
);
2488 * Remove the debugfs files and directories
2491 void iwl_dbgfs_unregister(struct iwl_priv
*priv
)
2493 if (!priv
->debugfs_dir
)
2496 debugfs_remove_recursive(priv
->debugfs_dir
);
2497 priv
->debugfs_dir
= NULL
;