iwlwifi: fix bugs in beacon configuration
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-debugfs.c
1 /******************************************************************************
2 *
3 * GPL LICENSE SUMMARY
4 *
5 * Copyright(c) 2008 - 2009 Intel Corporation. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
19 * USA
20 *
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
23 *
24 * Contact Information:
25 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/
28
29 #include <linux/kernel.h>
30 #include <linux/module.h>
31 #include <linux/debugfs.h>
32
33 #include <linux/ieee80211.h>
34 #include <net/mac80211.h>
35
36
37 #include "iwl-dev.h"
38 #include "iwl-debug.h"
39 #include "iwl-core.h"
40 #include "iwl-io.h"
41 #include "iwl-calib.h"
42
43 /* create and remove of files */
44 #define DEBUGFS_ADD_DIR(name, parent) do { \
45 dbgfs->dir_##name = debugfs_create_dir(#name, parent); \
46 if (!(dbgfs->dir_##name)) \
47 goto err; \
48 } while (0)
49
50 #define DEBUGFS_ADD_FILE(name, parent) do { \
51 dbgfs->dbgfs_##parent##_files.file_##name = \
52 debugfs_create_file(#name, S_IWUSR | S_IRUSR, \
53 dbgfs->dir_##parent, priv, \
54 &iwl_dbgfs_##name##_ops); \
55 if (!(dbgfs->dbgfs_##parent##_files.file_##name)) \
56 goto err; \
57 } while (0)
58
59 #define DEBUGFS_ADD_BOOL(name, parent, ptr) do { \
60 dbgfs->dbgfs_##parent##_files.file_##name = \
61 debugfs_create_bool(#name, S_IWUSR | S_IRUSR, \
62 dbgfs->dir_##parent, ptr); \
63 if (IS_ERR(dbgfs->dbgfs_##parent##_files.file_##name) \
64 || !dbgfs->dbgfs_##parent##_files.file_##name) \
65 goto err; \
66 } while (0)
67
68 #define DEBUGFS_ADD_X32(name, parent, ptr) do { \
69 dbgfs->dbgfs_##parent##_files.file_##name = \
70 debugfs_create_x32(#name, S_IRUSR, dbgfs->dir_##parent, ptr); \
71 if (IS_ERR(dbgfs->dbgfs_##parent##_files.file_##name) \
72 || !dbgfs->dbgfs_##parent##_files.file_##name) \
73 goto err; \
74 } while (0)
75
76 #define DEBUGFS_REMOVE(name) do { \
77 debugfs_remove(name); \
78 name = NULL; \
79 } while (0);
80
81 /* file operation */
82 #define DEBUGFS_READ_FUNC(name) \
83 static ssize_t iwl_dbgfs_##name##_read(struct file *file, \
84 char __user *user_buf, \
85 size_t count, loff_t *ppos);
86
87 #define DEBUGFS_WRITE_FUNC(name) \
88 static ssize_t iwl_dbgfs_##name##_write(struct file *file, \
89 const char __user *user_buf, \
90 size_t count, loff_t *ppos);
91
92
93 static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file)
94 {
95 file->private_data = inode->i_private;
96 return 0;
97 }
98
99 #define DEBUGFS_READ_FILE_OPS(name) \
100 DEBUGFS_READ_FUNC(name); \
101 static const struct file_operations iwl_dbgfs_##name##_ops = { \
102 .read = iwl_dbgfs_##name##_read, \
103 .open = iwl_dbgfs_open_file_generic, \
104 };
105
106 #define DEBUGFS_WRITE_FILE_OPS(name) \
107 DEBUGFS_WRITE_FUNC(name); \
108 static const struct file_operations iwl_dbgfs_##name##_ops = { \
109 .write = iwl_dbgfs_##name##_write, \
110 .open = iwl_dbgfs_open_file_generic, \
111 };
112
113
114 #define DEBUGFS_READ_WRITE_FILE_OPS(name) \
115 DEBUGFS_READ_FUNC(name); \
116 DEBUGFS_WRITE_FUNC(name); \
117 static const struct file_operations iwl_dbgfs_##name##_ops = { \
118 .write = iwl_dbgfs_##name##_write, \
119 .read = iwl_dbgfs_##name##_read, \
120 .open = iwl_dbgfs_open_file_generic, \
121 };
122
123
124 static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file,
125 char __user *user_buf,
126 size_t count, loff_t *ppos) {
127
128 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
129 char *buf;
130 int pos = 0;
131
132 int cnt;
133 ssize_t ret;
134 const size_t bufsz = 100 +
135 sizeof(char) * 50 * (MANAGEMENT_MAX + CONTROL_MAX);
136 buf = kzalloc(bufsz, GFP_KERNEL);
137 if (!buf)
138 return -ENOMEM;
139 pos += scnprintf(buf + pos, bufsz - pos, "Management:\n");
140 for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) {
141 pos += scnprintf(buf + pos, bufsz - pos,
142 "\t%25s\t\t: %u\n",
143 get_mgmt_string(cnt),
144 priv->tx_stats.mgmt[cnt]);
145 }
146 pos += scnprintf(buf + pos, bufsz - pos, "Control\n");
147 for (cnt = 0; cnt < CONTROL_MAX; cnt++) {
148 pos += scnprintf(buf + pos, bufsz - pos,
149 "\t%25s\t\t: %u\n",
150 get_ctrl_string(cnt),
151 priv->tx_stats.ctrl[cnt]);
152 }
153 pos += scnprintf(buf + pos, bufsz - pos, "Data:\n");
154 pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n",
155 priv->tx_stats.data_cnt);
156 pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n",
157 priv->tx_stats.data_bytes);
158 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
159 kfree(buf);
160 return ret;
161 }
162
163 static ssize_t iwl_dbgfs_tx_statistics_write(struct file *file,
164 const char __user *user_buf,
165 size_t count, loff_t *ppos)
166 {
167 struct iwl_priv *priv = file->private_data;
168 u32 clear_flag;
169 char buf[8];
170 int buf_size;
171
172 memset(buf, 0, sizeof(buf));
173 buf_size = min(count, sizeof(buf) - 1);
174 if (copy_from_user(buf, user_buf, buf_size))
175 return -EFAULT;
176 if (sscanf(buf, "%x", &clear_flag) != 1)
177 return -EFAULT;
178 if (clear_flag == 1)
179 iwl_clear_tx_stats(priv);
180
181 return count;
182 }
183
184 static ssize_t iwl_dbgfs_rx_statistics_read(struct file *file,
185 char __user *user_buf,
186 size_t count, loff_t *ppos) {
187
188 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
189 char *buf;
190 int pos = 0;
191 int cnt;
192 ssize_t ret;
193 const size_t bufsz = 100 +
194 sizeof(char) * 50 * (MANAGEMENT_MAX + CONTROL_MAX);
195 buf = kzalloc(bufsz, GFP_KERNEL);
196 if (!buf)
197 return -ENOMEM;
198
199 pos += scnprintf(buf + pos, bufsz - pos, "Management:\n");
200 for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) {
201 pos += scnprintf(buf + pos, bufsz - pos,
202 "\t%25s\t\t: %u\n",
203 get_mgmt_string(cnt),
204 priv->rx_stats.mgmt[cnt]);
205 }
206 pos += scnprintf(buf + pos, bufsz - pos, "Control:\n");
207 for (cnt = 0; cnt < CONTROL_MAX; cnt++) {
208 pos += scnprintf(buf + pos, bufsz - pos,
209 "\t%25s\t\t: %u\n",
210 get_ctrl_string(cnt),
211 priv->rx_stats.ctrl[cnt]);
212 }
213 pos += scnprintf(buf + pos, bufsz - pos, "Data:\n");
214 pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n",
215 priv->rx_stats.data_cnt);
216 pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n",
217 priv->rx_stats.data_bytes);
218
219 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
220 kfree(buf);
221 return ret;
222 }
223
224 static ssize_t iwl_dbgfs_rx_statistics_write(struct file *file,
225 const char __user *user_buf,
226 size_t count, loff_t *ppos)
227 {
228 struct iwl_priv *priv = file->private_data;
229 u32 clear_flag;
230 char buf[8];
231 int buf_size;
232
233 memset(buf, 0, sizeof(buf));
234 buf_size = min(count, sizeof(buf) - 1);
235 if (copy_from_user(buf, user_buf, buf_size))
236 return -EFAULT;
237 if (sscanf(buf, "%x", &clear_flag) != 1)
238 return -EFAULT;
239 if (clear_flag == 1)
240 iwl_clear_rx_stats(priv);
241 return count;
242 }
243
244 #define BYTE1_MASK 0x000000ff;
245 #define BYTE2_MASK 0x0000ffff;
246 #define BYTE3_MASK 0x00ffffff;
247 static ssize_t iwl_dbgfs_sram_read(struct file *file,
248 char __user *user_buf,
249 size_t count, loff_t *ppos)
250 {
251 u32 val;
252 char buf[1024];
253 ssize_t ret;
254 int i;
255 int pos = 0;
256 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
257 const size_t bufsz = sizeof(buf);
258
259 for (i = priv->dbgfs->sram_len; i > 0; i -= 4) {
260 val = iwl_read_targ_mem(priv, priv->dbgfs->sram_offset + \
261 priv->dbgfs->sram_len - i);
262 if (i < 4) {
263 switch (i) {
264 case 1:
265 val &= BYTE1_MASK;
266 break;
267 case 2:
268 val &= BYTE2_MASK;
269 break;
270 case 3:
271 val &= BYTE3_MASK;
272 break;
273 }
274 }
275 pos += scnprintf(buf + pos, bufsz - pos, "0x%08x ", val);
276 }
277 pos += scnprintf(buf + pos, bufsz - pos, "\n");
278
279 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
280 return ret;
281 }
282
283 static ssize_t iwl_dbgfs_sram_write(struct file *file,
284 const char __user *user_buf,
285 size_t count, loff_t *ppos)
286 {
287 struct iwl_priv *priv = file->private_data;
288 char buf[64];
289 int buf_size;
290 u32 offset, len;
291
292 memset(buf, 0, sizeof(buf));
293 buf_size = min(count, sizeof(buf) - 1);
294 if (copy_from_user(buf, user_buf, buf_size))
295 return -EFAULT;
296
297 if (sscanf(buf, "%x,%x", &offset, &len) == 2) {
298 priv->dbgfs->sram_offset = offset;
299 priv->dbgfs->sram_len = len;
300 } else {
301 priv->dbgfs->sram_offset = 0;
302 priv->dbgfs->sram_len = 0;
303 }
304
305 return count;
306 }
307
308 static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
309 size_t count, loff_t *ppos)
310 {
311 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
312 struct iwl_station_entry *station;
313 int max_sta = priv->hw_params.max_stations;
314 char *buf;
315 int i, j, pos = 0;
316 ssize_t ret;
317 /* Add 30 for initial string */
318 const size_t bufsz = 30 + sizeof(char) * 500 * (priv->num_stations);
319
320 buf = kmalloc(bufsz, GFP_KERNEL);
321 if (!buf)
322 return -ENOMEM;
323
324 pos += scnprintf(buf + pos, bufsz - pos, "num of stations: %d\n\n",
325 priv->num_stations);
326
327 for (i = 0; i < max_sta; i++) {
328 station = &priv->stations[i];
329 if (station->used) {
330 pos += scnprintf(buf + pos, bufsz - pos,
331 "station %d:\ngeneral data:\n", i+1);
332 pos += scnprintf(buf + pos, bufsz - pos, "id: %u\n",
333 station->sta.sta.sta_id);
334 pos += scnprintf(buf + pos, bufsz - pos, "mode: %u\n",
335 station->sta.mode);
336 pos += scnprintf(buf + pos, bufsz - pos,
337 "flags: 0x%x\n",
338 station->sta.station_flags_msk);
339 pos += scnprintf(buf + pos, bufsz - pos,
340 "ps_status: %u\n", station->ps_status);
341 pos += scnprintf(buf + pos, bufsz - pos, "tid data:\n");
342 pos += scnprintf(buf + pos, bufsz - pos,
343 "seq_num\t\ttxq_id");
344 pos += scnprintf(buf + pos, bufsz - pos,
345 "\tframe_count\twait_for_ba\t");
346 pos += scnprintf(buf + pos, bufsz - pos,
347 "start_idx\tbitmap0\t");
348 pos += scnprintf(buf + pos, bufsz - pos,
349 "bitmap1\trate_n_flags");
350 pos += scnprintf(buf + pos, bufsz - pos, "\n");
351
352 for (j = 0; j < MAX_TID_COUNT; j++) {
353 pos += scnprintf(buf + pos, bufsz - pos,
354 "[%d]:\t\t%u", j,
355 station->tid[j].seq_number);
356 pos += scnprintf(buf + pos, bufsz - pos,
357 "\t%u\t\t%u\t\t%u\t\t",
358 station->tid[j].agg.txq_id,
359 station->tid[j].agg.frame_count,
360 station->tid[j].agg.wait_for_ba);
361 pos += scnprintf(buf + pos, bufsz - pos,
362 "%u\t%llu\t%u",
363 station->tid[j].agg.start_idx,
364 (unsigned long long)station->tid[j].agg.bitmap,
365 station->tid[j].agg.rate_n_flags);
366 pos += scnprintf(buf + pos, bufsz - pos, "\n");
367 }
368 pos += scnprintf(buf + pos, bufsz - pos, "\n");
369 }
370 }
371
372 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
373 kfree(buf);
374 return ret;
375 }
376
377 static ssize_t iwl_dbgfs_nvm_read(struct file *file,
378 char __user *user_buf,
379 size_t count,
380 loff_t *ppos)
381 {
382 ssize_t ret;
383 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
384 int pos = 0, ofs = 0, buf_size = 0;
385 const u8 *ptr;
386 char *buf;
387 u16 eeprom_ver;
388 size_t eeprom_len = priv->cfg->eeprom_size;
389 buf_size = 4 * eeprom_len + 256;
390
391 if (eeprom_len % 16) {
392 IWL_ERR(priv, "NVM size is not multiple of 16.\n");
393 return -ENODATA;
394 }
395
396 ptr = priv->eeprom;
397 if (!ptr) {
398 IWL_ERR(priv, "Invalid EEPROM/OTP memory\n");
399 return -ENOMEM;
400 }
401
402 /* 4 characters for byte 0xYY */
403 buf = kzalloc(buf_size, GFP_KERNEL);
404 if (!buf) {
405 IWL_ERR(priv, "Can not allocate Buffer\n");
406 return -ENOMEM;
407 }
408 eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION);
409 pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, "
410 "version: 0x%x\n",
411 (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP)
412 ? "OTP" : "EEPROM", eeprom_ver);
413 for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) {
414 pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs);
415 hex_dump_to_buffer(ptr + ofs, 16 , 16, 2, buf + pos,
416 buf_size - pos, 0);
417 pos += strlen(buf + pos);
418 if (buf_size - pos > 0)
419 buf[pos++] = '\n';
420 }
421
422 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
423 kfree(buf);
424 return ret;
425 }
426
427 static ssize_t iwl_dbgfs_log_event_write(struct file *file,
428 const char __user *user_buf,
429 size_t count, loff_t *ppos)
430 {
431 struct iwl_priv *priv = file->private_data;
432 u32 event_log_flag;
433 char buf[8];
434 int buf_size;
435
436 memset(buf, 0, sizeof(buf));
437 buf_size = min(count, sizeof(buf) - 1);
438 if (copy_from_user(buf, user_buf, buf_size))
439 return -EFAULT;
440 if (sscanf(buf, "%d", &event_log_flag) != 1)
441 return -EFAULT;
442 if (event_log_flag == 1)
443 priv->cfg->ops->lib->dump_nic_event_log(priv);
444
445 return count;
446 }
447
448
449
450 static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
451 size_t count, loff_t *ppos)
452 {
453 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
454 struct ieee80211_channel *channels = NULL;
455 const struct ieee80211_supported_band *supp_band = NULL;
456 int pos = 0, i, bufsz = PAGE_SIZE;
457 char *buf;
458 ssize_t ret;
459
460 if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status))
461 return -EAGAIN;
462
463 buf = kzalloc(bufsz, GFP_KERNEL);
464 if (!buf) {
465 IWL_ERR(priv, "Can not allocate Buffer\n");
466 return -ENOMEM;
467 }
468
469 supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ);
470 if (supp_band) {
471 channels = supp_band->channels;
472
473 pos += scnprintf(buf + pos, bufsz - pos,
474 "Displaying %d channels in 2.4GHz band 802.11bg):\n",
475 supp_band->n_channels);
476
477 for (i = 0; i < supp_band->n_channels; i++)
478 pos += scnprintf(buf + pos, bufsz - pos,
479 "%d: %ddBm: BSS%s%s, %s.\n",
480 ieee80211_frequency_to_channel(
481 channels[i].center_freq),
482 channels[i].max_power,
483 channels[i].flags & IEEE80211_CHAN_RADAR ?
484 " (IEEE 802.11h required)" : "",
485 ((channels[i].flags & IEEE80211_CHAN_NO_IBSS)
486 || (channels[i].flags &
487 IEEE80211_CHAN_RADAR)) ? "" :
488 ", IBSS",
489 channels[i].flags &
490 IEEE80211_CHAN_PASSIVE_SCAN ?
491 "passive only" : "active/passive");
492 }
493 supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ);
494 if (supp_band) {
495 channels = supp_band->channels;
496
497 pos += scnprintf(buf + pos, bufsz - pos,
498 "Displaying %d channels in 5.2GHz band (802.11a)\n",
499 supp_band->n_channels);
500
501 for (i = 0; i < supp_band->n_channels; i++)
502 pos += scnprintf(buf + pos, bufsz - pos,
503 "%d: %ddBm: BSS%s%s, %s.\n",
504 ieee80211_frequency_to_channel(
505 channels[i].center_freq),
506 channels[i].max_power,
507 channels[i].flags & IEEE80211_CHAN_RADAR ?
508 " (IEEE 802.11h required)" : "",
509 ((channels[i].flags & IEEE80211_CHAN_NO_IBSS)
510 || (channels[i].flags &
511 IEEE80211_CHAN_RADAR)) ? "" :
512 ", IBSS",
513 channels[i].flags &
514 IEEE80211_CHAN_PASSIVE_SCAN ?
515 "passive only" : "active/passive");
516 }
517 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
518 kfree(buf);
519 return ret;
520 }
521
522 static ssize_t iwl_dbgfs_status_read(struct file *file,
523 char __user *user_buf,
524 size_t count, loff_t *ppos) {
525
526 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
527 char buf[512];
528 int pos = 0;
529 const size_t bufsz = sizeof(buf);
530
531 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n",
532 test_bit(STATUS_HCMD_ACTIVE, &priv->status));
533 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_SYNC_ACTIVE: %d\n",
534 test_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status));
535 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n",
536 test_bit(STATUS_INT_ENABLED, &priv->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_INIT:\t\t %d\n",
542 test_bit(STATUS_INIT, &priv->status));
543 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n",
544 test_bit(STATUS_ALIVE, &priv->status));
545 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n",
546 test_bit(STATUS_READY, &priv->status));
547 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_TEMPERATURE:\t %d\n",
548 test_bit(STATUS_TEMPERATURE, &priv->status));
549 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_GEO_CONFIGURED:\t %d\n",
550 test_bit(STATUS_GEO_CONFIGURED, &priv->status));
551 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n",
552 test_bit(STATUS_EXIT_PENDING, &priv->status));
553 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n",
554 test_bit(STATUS_STATISTICS, &priv->status));
555 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n",
556 test_bit(STATUS_SCANNING, &priv->status));
557 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_ABORTING:\t %d\n",
558 test_bit(STATUS_SCAN_ABORTING, &priv->status));
559 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_HW:\t\t %d\n",
560 test_bit(STATUS_SCAN_HW, &priv->status));
561 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_POWER_PMI:\t %d\n",
562 test_bit(STATUS_POWER_PMI, &priv->status));
563 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n",
564 test_bit(STATUS_FW_ERROR, &priv->status));
565 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_MODE_PENDING:\t %d\n",
566 test_bit(STATUS_MODE_PENDING, &priv->status));
567 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
568 }
569
570 static ssize_t iwl_dbgfs_interrupt_read(struct file *file,
571 char __user *user_buf,
572 size_t count, loff_t *ppos) {
573
574 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
575 int pos = 0;
576 int cnt = 0;
577 char *buf;
578 int bufsz = 24 * 64; /* 24 items * 64 char per item */
579 ssize_t ret;
580
581 buf = kzalloc(bufsz, GFP_KERNEL);
582 if (!buf) {
583 IWL_ERR(priv, "Can not allocate Buffer\n");
584 return -ENOMEM;
585 }
586
587 pos += scnprintf(buf + pos, bufsz - pos,
588 "Interrupt Statistics Report:\n");
589
590 pos += scnprintf(buf + pos, bufsz - pos, "HW Error:\t\t\t %u\n",
591 priv->isr_stats.hw);
592 pos += scnprintf(buf + pos, bufsz - pos, "SW Error:\t\t\t %u\n",
593 priv->isr_stats.sw);
594 if (priv->isr_stats.sw > 0) {
595 pos += scnprintf(buf + pos, bufsz - pos,
596 "\tLast Restarting Code: 0x%X\n",
597 priv->isr_stats.sw_err);
598 }
599 #ifdef CONFIG_IWLWIFI_DEBUG
600 pos += scnprintf(buf + pos, bufsz - pos, "Frame transmitted:\t\t %u\n",
601 priv->isr_stats.sch);
602 pos += scnprintf(buf + pos, bufsz - pos, "Alive interrupt:\t\t %u\n",
603 priv->isr_stats.alive);
604 #endif
605 pos += scnprintf(buf + pos, bufsz - pos,
606 "HW RF KILL switch toggled:\t %u\n",
607 priv->isr_stats.rfkill);
608
609 pos += scnprintf(buf + pos, bufsz - pos, "CT KILL:\t\t\t %u\n",
610 priv->isr_stats.ctkill);
611
612 pos += scnprintf(buf + pos, bufsz - pos, "Wakeup Interrupt:\t\t %u\n",
613 priv->isr_stats.wakeup);
614
615 pos += scnprintf(buf + pos, bufsz - pos,
616 "Rx command responses:\t\t %u\n",
617 priv->isr_stats.rx);
618 for (cnt = 0; cnt < REPLY_MAX; cnt++) {
619 if (priv->isr_stats.rx_handlers[cnt] > 0)
620 pos += scnprintf(buf + pos, bufsz - pos,
621 "\tRx handler[%36s]:\t\t %u\n",
622 get_cmd_string(cnt),
623 priv->isr_stats.rx_handlers[cnt]);
624 }
625
626 pos += scnprintf(buf + pos, bufsz - pos, "Tx/FH interrupt:\t\t %u\n",
627 priv->isr_stats.tx);
628
629 pos += scnprintf(buf + pos, bufsz - pos, "Unexpected INTA:\t\t %u\n",
630 priv->isr_stats.unhandled);
631
632 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
633 kfree(buf);
634 return ret;
635 }
636
637 static ssize_t iwl_dbgfs_interrupt_write(struct file *file,
638 const char __user *user_buf,
639 size_t count, loff_t *ppos)
640 {
641 struct iwl_priv *priv = file->private_data;
642 char buf[8];
643 int buf_size;
644 u32 reset_flag;
645
646 memset(buf, 0, sizeof(buf));
647 buf_size = min(count, sizeof(buf) - 1);
648 if (copy_from_user(buf, user_buf, buf_size))
649 return -EFAULT;
650 if (sscanf(buf, "%x", &reset_flag) != 1)
651 return -EFAULT;
652 if (reset_flag == 0)
653 iwl_clear_isr_stats(priv);
654
655 return count;
656 }
657
658 static ssize_t iwl_dbgfs_qos_read(struct file *file, char __user *user_buf,
659 size_t count, loff_t *ppos)
660 {
661 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
662 int pos = 0, i;
663 char buf[256];
664 const size_t bufsz = sizeof(buf);
665 ssize_t ret;
666
667 for (i = 0; i < AC_NUM; i++) {
668 pos += scnprintf(buf + pos, bufsz - pos,
669 "\tcw_min\tcw_max\taifsn\ttxop\n");
670 pos += scnprintf(buf + pos, bufsz - pos,
671 "AC[%d]\t%u\t%u\t%u\t%u\n", i,
672 priv->qos_data.def_qos_parm.ac[i].cw_min,
673 priv->qos_data.def_qos_parm.ac[i].cw_max,
674 priv->qos_data.def_qos_parm.ac[i].aifsn,
675 priv->qos_data.def_qos_parm.ac[i].edca_txop);
676 }
677 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
678 return ret;
679 }
680
681 static ssize_t iwl_dbgfs_led_read(struct file *file, char __user *user_buf,
682 size_t count, loff_t *ppos)
683 {
684 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
685 int pos = 0;
686 char buf[256];
687 const size_t bufsz = sizeof(buf);
688 ssize_t ret;
689
690 pos += scnprintf(buf + pos, bufsz - pos,
691 "allow blinking: %s\n",
692 (priv->allow_blinking) ? "True" : "False");
693 if (priv->allow_blinking) {
694 pos += scnprintf(buf + pos, bufsz - pos,
695 "Led blinking rate: %u\n",
696 priv->last_blink_rate);
697 pos += scnprintf(buf + pos, bufsz - pos,
698 "Last blink time: %lu\n",
699 priv->last_blink_time);
700 }
701
702 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
703 return ret;
704 }
705
706 static ssize_t iwl_dbgfs_thermal_throttling_read(struct file *file,
707 char __user *user_buf,
708 size_t count, loff_t *ppos)
709 {
710 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
711 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
712 struct iwl_tt_restriction *restriction;
713 char buf[100];
714 int pos = 0;
715 const size_t bufsz = sizeof(buf);
716 ssize_t ret;
717
718 pos += scnprintf(buf + pos, bufsz - pos,
719 "Thermal Throttling Mode: %s\n",
720 tt->advanced_tt ? "Advance" : "Legacy");
721 pos += scnprintf(buf + pos, bufsz - pos,
722 "Thermal Throttling State: %d\n",
723 tt->state);
724 if (tt->advanced_tt) {
725 restriction = tt->restriction + tt->state;
726 pos += scnprintf(buf + pos, bufsz - pos,
727 "Tx mode: %d\n",
728 restriction->tx_stream);
729 pos += scnprintf(buf + pos, bufsz - pos,
730 "Rx mode: %d\n",
731 restriction->rx_stream);
732 pos += scnprintf(buf + pos, bufsz - pos,
733 "HT mode: %d\n",
734 restriction->is_ht);
735 }
736 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
737 return ret;
738 }
739
740 static ssize_t iwl_dbgfs_disable_ht40_write(struct file *file,
741 const char __user *user_buf,
742 size_t count, loff_t *ppos)
743 {
744 struct iwl_priv *priv = file->private_data;
745 char buf[8];
746 int buf_size;
747 int ht40;
748
749 memset(buf, 0, sizeof(buf));
750 buf_size = min(count, sizeof(buf) - 1);
751 if (copy_from_user(buf, user_buf, buf_size))
752 return -EFAULT;
753 if (sscanf(buf, "%d", &ht40) != 1)
754 return -EFAULT;
755 if (!iwl_is_associated(priv))
756 priv->disable_ht40 = ht40 ? true : false;
757 else {
758 IWL_ERR(priv, "Sta associated with AP - "
759 "Change to 40MHz channel support is not allowed\n");
760 return -EINVAL;
761 }
762
763 return count;
764 }
765
766 static ssize_t iwl_dbgfs_disable_ht40_read(struct file *file,
767 char __user *user_buf,
768 size_t count, loff_t *ppos)
769 {
770 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
771 char buf[100];
772 int pos = 0;
773 const size_t bufsz = sizeof(buf);
774 ssize_t ret;
775
776 pos += scnprintf(buf + pos, bufsz - pos,
777 "11n 40MHz Mode: %s\n",
778 priv->disable_ht40 ? "Disabled" : "Enabled");
779 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
780 return ret;
781 }
782
783 static ssize_t iwl_dbgfs_sleep_level_override_write(struct file *file,
784 const char __user *user_buf,
785 size_t count, loff_t *ppos)
786 {
787 struct iwl_priv *priv = file->private_data;
788 char buf[8];
789 int buf_size;
790 int value;
791
792 memset(buf, 0, sizeof(buf));
793 buf_size = min(count, sizeof(buf) - 1);
794 if (copy_from_user(buf, user_buf, buf_size))
795 return -EFAULT;
796
797 if (sscanf(buf, "%d", &value) != 1)
798 return -EINVAL;
799
800 /*
801 * Our users expect 0 to be "CAM", but 0 isn't actually
802 * valid here. However, let's not confuse them and present
803 * IWL_POWER_INDEX_1 as "1", not "0".
804 */
805 if (value == 0)
806 return -EINVAL;
807 else if (value > 0)
808 value -= 1;
809
810 if (value != -1 && (value < 0 || value >= IWL_POWER_NUM))
811 return -EINVAL;
812
813 if (!iwl_is_ready_rf(priv))
814 return -EAGAIN;
815
816 priv->power_data.debug_sleep_level_override = value;
817
818 iwl_power_update_mode(priv, true);
819
820 return count;
821 }
822
823 static ssize_t iwl_dbgfs_sleep_level_override_read(struct file *file,
824 char __user *user_buf,
825 size_t count, loff_t *ppos)
826 {
827 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
828 char buf[10];
829 int pos, value;
830 const size_t bufsz = sizeof(buf);
831
832 /* see the write function */
833 value = priv->power_data.debug_sleep_level_override;
834 if (value >= 0)
835 value += 1;
836
837 pos = scnprintf(buf, bufsz, "%d\n", value);
838 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
839 }
840
841 static ssize_t iwl_dbgfs_current_sleep_command_read(struct file *file,
842 char __user *user_buf,
843 size_t count, loff_t *ppos)
844 {
845 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
846 char buf[200];
847 int pos = 0, i;
848 const size_t bufsz = sizeof(buf);
849 struct iwl_powertable_cmd *cmd = &priv->power_data.sleep_cmd;
850
851 pos += scnprintf(buf + pos, bufsz - pos,
852 "flags: %#.2x\n", le16_to_cpu(cmd->flags));
853 pos += scnprintf(buf + pos, bufsz - pos,
854 "RX/TX timeout: %d/%d usec\n",
855 le32_to_cpu(cmd->rx_data_timeout),
856 le32_to_cpu(cmd->tx_data_timeout));
857 for (i = 0; i < IWL_POWER_VEC_SIZE; i++)
858 pos += scnprintf(buf + pos, bufsz - pos,
859 "sleep_interval[%d]: %d\n", i,
860 le32_to_cpu(cmd->sleep_interval[i]));
861
862 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
863 }
864
865 DEBUGFS_READ_WRITE_FILE_OPS(sram);
866 DEBUGFS_WRITE_FILE_OPS(log_event);
867 DEBUGFS_READ_FILE_OPS(nvm);
868 DEBUGFS_READ_FILE_OPS(stations);
869 DEBUGFS_READ_FILE_OPS(channels);
870 DEBUGFS_READ_FILE_OPS(status);
871 DEBUGFS_READ_WRITE_FILE_OPS(interrupt);
872 DEBUGFS_READ_FILE_OPS(qos);
873 DEBUGFS_READ_FILE_OPS(led);
874 DEBUGFS_READ_FILE_OPS(thermal_throttling);
875 DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40);
876 DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override);
877 DEBUGFS_READ_FILE_OPS(current_sleep_command);
878
879 static ssize_t iwl_dbgfs_traffic_log_read(struct file *file,
880 char __user *user_buf,
881 size_t count, loff_t *ppos)
882 {
883 struct iwl_priv *priv = file->private_data;
884 int pos = 0, ofs = 0;
885 int cnt = 0, entry;
886 struct iwl_tx_queue *txq;
887 struct iwl_queue *q;
888 struct iwl_rx_queue *rxq = &priv->rxq;
889 char *buf;
890 int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) +
891 (priv->cfg->num_of_queues * 32 * 8) + 400;
892 const u8 *ptr;
893 ssize_t ret;
894
895 if (!priv->txq) {
896 IWL_ERR(priv, "txq not ready\n");
897 return -EAGAIN;
898 }
899 buf = kzalloc(bufsz, GFP_KERNEL);
900 if (!buf) {
901 IWL_ERR(priv, "Can not allocate buffer\n");
902 return -ENOMEM;
903 }
904 pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n");
905 for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) {
906 txq = &priv->txq[cnt];
907 q = &txq->q;
908 pos += scnprintf(buf + pos, bufsz - pos,
909 "q[%d]: read_ptr: %u, write_ptr: %u\n",
910 cnt, q->read_ptr, q->write_ptr);
911 }
912 if (priv->tx_traffic && (iwl_debug_level & IWL_DL_TX)) {
913 ptr = priv->tx_traffic;
914 pos += scnprintf(buf + pos, bufsz - pos,
915 "Tx Traffic idx: %u\n", priv->tx_traffic_idx);
916 for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) {
917 for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16;
918 entry++, ofs += 16) {
919 pos += scnprintf(buf + pos, bufsz - pos,
920 "0x%.4x ", ofs);
921 hex_dump_to_buffer(ptr + ofs, 16, 16, 2,
922 buf + pos, bufsz - pos, 0);
923 pos += strlen(buf + pos);
924 if (bufsz - pos > 0)
925 buf[pos++] = '\n';
926 }
927 }
928 }
929
930 pos += scnprintf(buf + pos, bufsz - pos, "Rx Queue\n");
931 pos += scnprintf(buf + pos, bufsz - pos,
932 "read: %u, write: %u\n",
933 rxq->read, rxq->write);
934
935 if (priv->rx_traffic && (iwl_debug_level & IWL_DL_RX)) {
936 ptr = priv->rx_traffic;
937 pos += scnprintf(buf + pos, bufsz - pos,
938 "Rx Traffic idx: %u\n", priv->rx_traffic_idx);
939 for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) {
940 for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16;
941 entry++, ofs += 16) {
942 pos += scnprintf(buf + pos, bufsz - pos,
943 "0x%.4x ", ofs);
944 hex_dump_to_buffer(ptr + ofs, 16, 16, 2,
945 buf + pos, bufsz - pos, 0);
946 pos += strlen(buf + pos);
947 if (bufsz - pos > 0)
948 buf[pos++] = '\n';
949 }
950 }
951 }
952
953 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
954 kfree(buf);
955 return ret;
956 }
957
958 static ssize_t iwl_dbgfs_traffic_log_write(struct file *file,
959 const char __user *user_buf,
960 size_t count, loff_t *ppos)
961 {
962 struct iwl_priv *priv = file->private_data;
963 char buf[8];
964 int buf_size;
965 int traffic_log;
966
967 memset(buf, 0, sizeof(buf));
968 buf_size = min(count, sizeof(buf) - 1);
969 if (copy_from_user(buf, user_buf, buf_size))
970 return -EFAULT;
971 if (sscanf(buf, "%d", &traffic_log) != 1)
972 return -EFAULT;
973 if (traffic_log == 0)
974 iwl_reset_traffic_log(priv);
975
976 return count;
977 }
978
979 static ssize_t iwl_dbgfs_tx_queue_read(struct file *file,
980 char __user *user_buf,
981 size_t count, loff_t *ppos) {
982
983 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
984 struct iwl_tx_queue *txq;
985 struct iwl_queue *q;
986 char *buf;
987 int pos = 0;
988 int cnt;
989 int ret;
990 const size_t bufsz = sizeof(char) * 60 * priv->cfg->num_of_queues;
991
992 if (!priv->txq) {
993 IWL_ERR(priv, "txq not ready\n");
994 return -EAGAIN;
995 }
996 buf = kzalloc(bufsz, GFP_KERNEL);
997 if (!buf)
998 return -ENOMEM;
999
1000 for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) {
1001 txq = &priv->txq[cnt];
1002 q = &txq->q;
1003 pos += scnprintf(buf + pos, bufsz - pos,
1004 "hwq %.2d: read=%u write=%u stop=%d"
1005 " swq_id=%#.2x (ac %d/hwq %d)\n",
1006 cnt, q->read_ptr, q->write_ptr,
1007 !!test_bit(cnt, priv->queue_stopped),
1008 txq->swq_id,
1009 txq->swq_id & 0x80 ? txq->swq_id & 3 :
1010 txq->swq_id,
1011 txq->swq_id & 0x80 ? (txq->swq_id >> 2) &
1012 0x1f : txq->swq_id);
1013 if (cnt >= 4)
1014 continue;
1015 /* for the ACs, display the stop count too */
1016 pos += scnprintf(buf + pos, bufsz - pos,
1017 " stop-count: %d\n",
1018 atomic_read(&priv->queue_stop_count[cnt]));
1019 }
1020 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1021 kfree(buf);
1022 return ret;
1023 }
1024
1025 static ssize_t iwl_dbgfs_rx_queue_read(struct file *file,
1026 char __user *user_buf,
1027 size_t count, loff_t *ppos) {
1028
1029 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
1030 struct iwl_rx_queue *rxq = &priv->rxq;
1031 char buf[256];
1032 int pos = 0;
1033 const size_t bufsz = sizeof(buf);
1034
1035 pos += scnprintf(buf + pos, bufsz - pos, "read: %u\n",
1036 rxq->read);
1037 pos += scnprintf(buf + pos, bufsz - pos, "write: %u\n",
1038 rxq->write);
1039 pos += scnprintf(buf + pos, bufsz - pos, "free_count: %u\n",
1040 rxq->free_count);
1041 pos += scnprintf(buf + pos, bufsz - pos, "closed_rb_num: %u\n",
1042 le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF);
1043 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1044 }
1045
1046 static int iwl_dbgfs_statistics_flag(struct iwl_priv *priv, char *buf,
1047 int bufsz)
1048 {
1049 int p = 0;
1050
1051 p += scnprintf(buf + p, bufsz - p,
1052 "Statistics Flag(0x%X):\n",
1053 le32_to_cpu(priv->statistics.flag));
1054 if (le32_to_cpu(priv->statistics.flag) & UCODE_STATISTICS_CLEAR_MSK)
1055 p += scnprintf(buf + p, bufsz - p,
1056 "\tStatistics have been cleared\n");
1057 p += scnprintf(buf + p, bufsz - p,
1058 "\tOperational Frequency: %s\n",
1059 (le32_to_cpu(priv->statistics.flag) &
1060 UCODE_STATISTICS_FREQUENCY_MSK)
1061 ? "2.4 GHz" : "5.2 GHz");
1062 p += scnprintf(buf + p, bufsz - p,
1063 "\tTGj Narrow Band: %s\n",
1064 (le32_to_cpu(priv->statistics.flag) &
1065 UCODE_STATISTICS_NARROW_BAND_MSK)
1066 ? "enabled" : "disabled");
1067 return p;
1068 }
1069
1070
1071 static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file,
1072 char __user *user_buf,
1073 size_t count, loff_t *ppos)
1074 {
1075 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
1076 int pos = 0;
1077 char *buf;
1078 int bufsz = sizeof(struct statistics_rx_phy) * 20 +
1079 sizeof(struct statistics_rx_non_phy) * 20 +
1080 sizeof(struct statistics_rx_ht_phy) * 20 + 400;
1081 ssize_t ret;
1082 struct statistics_rx_phy *ofdm, *accum_ofdm;
1083 struct statistics_rx_phy *cck, *accum_cck;
1084 struct statistics_rx_non_phy *general, *accum_general;
1085 struct statistics_rx_ht_phy *ht, *accum_ht;
1086
1087 if (!iwl_is_alive(priv))
1088 return -EAGAIN;
1089
1090 /* make request to uCode to retrieve statistics information */
1091 mutex_lock(&priv->mutex);
1092 ret = iwl_send_statistics_request(priv, CMD_SYNC, false);
1093 mutex_unlock(&priv->mutex);
1094
1095 if (ret) {
1096 IWL_ERR(priv,
1097 "Error sending statistics request: %zd\n", ret);
1098 return -EAGAIN;
1099 }
1100 buf = kzalloc(bufsz, GFP_KERNEL);
1101 if (!buf) {
1102 IWL_ERR(priv, "Can not allocate Buffer\n");
1103 return -ENOMEM;
1104 }
1105
1106 /* the statistic information display here is based on
1107 * the last statistics notification from uCode
1108 * might not reflect the current uCode activity
1109 */
1110 ofdm = &priv->statistics.rx.ofdm;
1111 cck = &priv->statistics.rx.cck;
1112 general = &priv->statistics.rx.general;
1113 ht = &priv->statistics.rx.ofdm_ht;
1114 accum_ofdm = &priv->accum_statistics.rx.ofdm;
1115 accum_cck = &priv->accum_statistics.rx.cck;
1116 accum_general = &priv->accum_statistics.rx.general;
1117 accum_ht = &priv->accum_statistics.rx.ofdm_ht;
1118 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
1119 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM:\n");
1120 pos += scnprintf(buf + pos, bufsz - pos,
1121 "\t\t\tcurrent\t\t\taccumulative\n");
1122 pos += scnprintf(buf + pos, bufsz - pos, "ina_cnt:\t\t%u\t\t\t%u\n",
1123 le32_to_cpu(ofdm->ina_cnt), accum_ofdm->ina_cnt);
1124 pos += scnprintf(buf + pos, bufsz - pos, "fina_cnt:\t\t%u\t\t\t%u\n",
1125 le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt);
1126 pos += scnprintf(buf + pos, bufsz - pos, "plcp_err:\t\t%u\t\t\t%u\n",
1127 le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err);
1128 pos += scnprintf(buf + pos, bufsz - pos, "crc32_err:\t\t%u\t\t\t%u\n",
1129 le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err);
1130 pos += scnprintf(buf + pos, bufsz - pos,
1131 "overrun_err:\t\t%u\t\t\t%u\n",
1132 le32_to_cpu(ofdm->overrun_err),
1133 accum_ofdm->overrun_err);
1134 pos += scnprintf(buf + pos, bufsz - pos,
1135 "early_overrun_err:\t%u\t\t\t%u\n",
1136 le32_to_cpu(ofdm->early_overrun_err),
1137 accum_ofdm->early_overrun_err);
1138 pos += scnprintf(buf + pos, bufsz - pos, "crc32_good:\t\t%u\t\t\t%u\n",
1139 le32_to_cpu(ofdm->crc32_good),
1140 accum_ofdm->crc32_good);
1141 pos += scnprintf(buf + pos, bufsz - pos,
1142 "false_alarm_cnt:\t%u\t\t\t%u\n",
1143 le32_to_cpu(ofdm->false_alarm_cnt),
1144 accum_ofdm->false_alarm_cnt);
1145 pos += scnprintf(buf + pos, bufsz - pos,
1146 "fina_sync_err_cnt:\t%u\t\t\t%u\n",
1147 le32_to_cpu(ofdm->fina_sync_err_cnt),
1148 accum_ofdm->fina_sync_err_cnt);
1149 pos += scnprintf(buf + pos, bufsz - pos,
1150 "sfd_timeout:\t\t%u\t\t\t%u\n",
1151 le32_to_cpu(ofdm->sfd_timeout),
1152 accum_ofdm->sfd_timeout);
1153 pos += scnprintf(buf + pos, bufsz - pos,
1154 "fina_timeout:\t\t%u\t\t\t%u\n",
1155 le32_to_cpu(ofdm->fina_timeout),
1156 accum_ofdm->fina_timeout);
1157 pos += scnprintf(buf + pos, bufsz - pos,
1158 "unresponded_rts:\t%u\t\t\t%u\n",
1159 le32_to_cpu(ofdm->unresponded_rts),
1160 accum_ofdm->unresponded_rts);
1161 pos += scnprintf(buf + pos, bufsz - pos,
1162 "rxe_frame_lmt_ovrun:\t%u\t\t\t%u\n",
1163 le32_to_cpu(ofdm->rxe_frame_limit_overrun),
1164 accum_ofdm->rxe_frame_limit_overrun);
1165 pos += scnprintf(buf + pos, bufsz - pos,
1166 "sent_ack_cnt:\t\t%u\t\t\t%u\n",
1167 le32_to_cpu(ofdm->sent_ack_cnt),
1168 accum_ofdm->sent_ack_cnt);
1169 pos += scnprintf(buf + pos, bufsz - pos,
1170 "sent_cts_cnt:\t\t%u\t\t\t%u\n",
1171 le32_to_cpu(ofdm->sent_cts_cnt),
1172 accum_ofdm->sent_cts_cnt);
1173 pos += scnprintf(buf + pos, bufsz - pos,
1174 "sent_ba_rsp_cnt:\t%u\t\t\t%u\n",
1175 le32_to_cpu(ofdm->sent_ba_rsp_cnt),
1176 accum_ofdm->sent_ba_rsp_cnt);
1177 pos += scnprintf(buf + pos, bufsz - pos,
1178 "dsp_self_kill:\t\t%u\t\t\t%u\n",
1179 le32_to_cpu(ofdm->dsp_self_kill),
1180 accum_ofdm->dsp_self_kill);
1181 pos += scnprintf(buf + pos, bufsz - pos,
1182 "mh_format_err:\t\t%u\t\t\t%u\n",
1183 le32_to_cpu(ofdm->mh_format_err),
1184 accum_ofdm->mh_format_err);
1185 pos += scnprintf(buf + pos, bufsz - pos,
1186 "re_acq_main_rssi_sum:\t%u\t\t\t%u\n",
1187 le32_to_cpu(ofdm->re_acq_main_rssi_sum),
1188 accum_ofdm->re_acq_main_rssi_sum);
1189
1190 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - CCK:\n");
1191 pos += scnprintf(buf + pos, bufsz - pos,
1192 "\t\t\tcurrent\t\t\taccumulative\n");
1193 pos += scnprintf(buf + pos, bufsz - pos, "ina_cnt:\t\t%u\t\t\t%u\n",
1194 le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt);
1195 pos += scnprintf(buf + pos, bufsz - pos, "fina_cnt:\t\t%u\t\t\t%u\n",
1196 le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt);
1197 pos += scnprintf(buf + pos, bufsz - pos, "plcp_err:\t\t%u\t\t\t%u\n",
1198 le32_to_cpu(cck->plcp_err), accum_cck->plcp_err);
1199 pos += scnprintf(buf + pos, bufsz - pos, "crc32_err:\t\t%u\t\t\t%u\n",
1200 le32_to_cpu(cck->crc32_err), accum_cck->crc32_err);
1201 pos += scnprintf(buf + pos, bufsz - pos,
1202 "overrun_err:\t\t%u\t\t\t%u\n",
1203 le32_to_cpu(cck->overrun_err),
1204 accum_cck->overrun_err);
1205 pos += scnprintf(buf + pos, bufsz - pos,
1206 "early_overrun_err:\t%u\t\t\t%u\n",
1207 le32_to_cpu(cck->early_overrun_err),
1208 accum_cck->early_overrun_err);
1209 pos += scnprintf(buf + pos, bufsz - pos, "crc32_good:\t\t%u\t\t\t%u\n",
1210 le32_to_cpu(cck->crc32_good), accum_cck->crc32_good);
1211 pos += scnprintf(buf + pos, bufsz - pos,
1212 "false_alarm_cnt:\t%u\t\t\t%u\n",
1213 le32_to_cpu(cck->false_alarm_cnt),
1214 accum_cck->false_alarm_cnt);
1215 pos += scnprintf(buf + pos, bufsz - pos,
1216 "fina_sync_err_cnt:\t%u\t\t\t%u\n",
1217 le32_to_cpu(cck->fina_sync_err_cnt),
1218 accum_cck->fina_sync_err_cnt);
1219 pos += scnprintf(buf + pos, bufsz - pos,
1220 "sfd_timeout:\t\t%u\t\t\t%u\n",
1221 le32_to_cpu(cck->sfd_timeout),
1222 accum_cck->sfd_timeout);
1223 pos += scnprintf(buf + pos, bufsz - pos,
1224 "fina_timeout:\t\t%u\t\t\t%u\n",
1225 le32_to_cpu(cck->fina_timeout),
1226 accum_cck->fina_timeout);
1227 pos += scnprintf(buf + pos, bufsz - pos,
1228 "unresponded_rts:\t%u\t\t\t%u\n",
1229 le32_to_cpu(cck->unresponded_rts),
1230 accum_cck->unresponded_rts);
1231 pos += scnprintf(buf + pos, bufsz - pos,
1232 "rxe_frame_lmt_ovrun:\t%u\t\t\t%u\n",
1233 le32_to_cpu(cck->rxe_frame_limit_overrun),
1234 accum_cck->rxe_frame_limit_overrun);
1235 pos += scnprintf(buf + pos, bufsz - pos,
1236 "sent_ack_cnt:\t\t%u\t\t\t%u\n",
1237 le32_to_cpu(cck->sent_ack_cnt),
1238 accum_cck->sent_ack_cnt);
1239 pos += scnprintf(buf + pos, bufsz - pos,
1240 "sent_cts_cnt:\t\t%u\t\t\t%u\n",
1241 le32_to_cpu(cck->sent_cts_cnt),
1242 accum_cck->sent_cts_cnt);
1243 pos += scnprintf(buf + pos, bufsz - pos,
1244 "sent_ba_rsp_cnt:\t%u\t\t\t%u\n",
1245 le32_to_cpu(cck->sent_ba_rsp_cnt),
1246 accum_cck->sent_ba_rsp_cnt);
1247 pos += scnprintf(buf + pos, bufsz - pos,
1248 "dsp_self_kill:\t\t%u\t\t\t%u\n",
1249 le32_to_cpu(cck->dsp_self_kill),
1250 accum_cck->dsp_self_kill);
1251 pos += scnprintf(buf + pos, bufsz - pos,
1252 "mh_format_err:\t\t%u\t\t\t%u\n",
1253 le32_to_cpu(cck->mh_format_err),
1254 accum_cck->mh_format_err);
1255 pos += scnprintf(buf + pos, bufsz - pos,
1256 "re_acq_main_rssi_sum:\t%u\t\t\t%u\n",
1257 le32_to_cpu(cck->re_acq_main_rssi_sum),
1258 accum_cck->re_acq_main_rssi_sum);
1259
1260 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - GENERAL:\n");
1261 pos += scnprintf(buf + pos, bufsz - pos,
1262 "\t\t\tcurrent\t\t\taccumulative\n");
1263 pos += scnprintf(buf + pos, bufsz - pos, "bogus_cts:\t\t%u\t\t\t%u\n",
1264 le32_to_cpu(general->bogus_cts),
1265 accum_general->bogus_cts);
1266 pos += scnprintf(buf + pos, bufsz - pos, "bogus_ack:\t\t%u\t\t\t%u\n",
1267 le32_to_cpu(general->bogus_ack),
1268 accum_general->bogus_ack);
1269 pos += scnprintf(buf + pos, bufsz - pos,
1270 "non_bssid_frames:\t%u\t\t\t%u\n",
1271 le32_to_cpu(general->non_bssid_frames),
1272 accum_general->non_bssid_frames);
1273 pos += scnprintf(buf + pos, bufsz - pos,
1274 "filtered_frames:\t%u\t\t\t%u\n",
1275 le32_to_cpu(general->filtered_frames),
1276 accum_general->filtered_frames);
1277 pos += scnprintf(buf + pos, bufsz - pos,
1278 "non_channel_beacons:\t%u\t\t\t%u\n",
1279 le32_to_cpu(general->non_channel_beacons),
1280 accum_general->non_channel_beacons);
1281 pos += scnprintf(buf + pos, bufsz - pos,
1282 "channel_beacons:\t%u\t\t\t%u\n",
1283 le32_to_cpu(general->channel_beacons),
1284 accum_general->channel_beacons);
1285 pos += scnprintf(buf + pos, bufsz - pos,
1286 "num_missed_bcon:\t%u\t\t\t%u\n",
1287 le32_to_cpu(general->num_missed_bcon),
1288 accum_general->num_missed_bcon);
1289 pos += scnprintf(buf + pos, bufsz - pos,
1290 "adc_rx_saturation_time:\t%u\t\t\t%u\n",
1291 le32_to_cpu(general->adc_rx_saturation_time),
1292 accum_general->adc_rx_saturation_time);
1293 pos += scnprintf(buf + pos, bufsz - pos,
1294 "ina_detect_search_tm:\t%u\t\t\t%u\n",
1295 le32_to_cpu(general->ina_detection_search_time),
1296 accum_general->ina_detection_search_time);
1297 pos += scnprintf(buf + pos, bufsz - pos,
1298 "beacon_silence_rssi_a:\t%u\t\t\t%u\n",
1299 le32_to_cpu(general->beacon_silence_rssi_a),
1300 accum_general->beacon_silence_rssi_a);
1301 pos += scnprintf(buf + pos, bufsz - pos,
1302 "beacon_silence_rssi_b:\t%u\t\t\t%u\n",
1303 le32_to_cpu(general->beacon_silence_rssi_b),
1304 accum_general->beacon_silence_rssi_b);
1305 pos += scnprintf(buf + pos, bufsz - pos,
1306 "beacon_silence_rssi_c:\t%u\t\t\t%u\n",
1307 le32_to_cpu(general->beacon_silence_rssi_c),
1308 accum_general->beacon_silence_rssi_c);
1309 pos += scnprintf(buf + pos, bufsz - pos,
1310 "interference_data_flag:\t%u\t\t\t%u\n",
1311 le32_to_cpu(general->interference_data_flag),
1312 accum_general->interference_data_flag);
1313 pos += scnprintf(buf + pos, bufsz - pos,
1314 "channel_load:\t\t%u\t\t\t%u\n",
1315 le32_to_cpu(general->channel_load),
1316 accum_general->channel_load);
1317 pos += scnprintf(buf + pos, bufsz - pos,
1318 "dsp_false_alarms:\t%u\t\t\t%u\n",
1319 le32_to_cpu(general->dsp_false_alarms),
1320 accum_general->dsp_false_alarms);
1321 pos += scnprintf(buf + pos, bufsz - pos,
1322 "beacon_rssi_a:\t\t%u\t\t\t%u\n",
1323 le32_to_cpu(general->beacon_rssi_a),
1324 accum_general->beacon_rssi_a);
1325 pos += scnprintf(buf + pos, bufsz - pos,
1326 "beacon_rssi_b:\t\t%u\t\t\t%u\n",
1327 le32_to_cpu(general->beacon_rssi_b),
1328 accum_general->beacon_rssi_b);
1329 pos += scnprintf(buf + pos, bufsz - pos,
1330 "beacon_rssi_c:\t\t%u\t\t\t%u\n",
1331 le32_to_cpu(general->beacon_rssi_c),
1332 accum_general->beacon_rssi_c);
1333 pos += scnprintf(buf + pos, bufsz - pos,
1334 "beacon_energy_a:\t%u\t\t\t%u\n",
1335 le32_to_cpu(general->beacon_energy_a),
1336 accum_general->beacon_energy_a);
1337 pos += scnprintf(buf + pos, bufsz - pos,
1338 "beacon_energy_b:\t%u\t\t\t%u\n",
1339 le32_to_cpu(general->beacon_energy_b),
1340 accum_general->beacon_energy_b);
1341 pos += scnprintf(buf + pos, bufsz - pos,
1342 "beacon_energy_c:\t%u\t\t\t%u\n",
1343 le32_to_cpu(general->beacon_energy_c),
1344 accum_general->beacon_energy_c);
1345
1346 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM_HT:\n");
1347 pos += scnprintf(buf + pos, bufsz - pos,
1348 "\t\t\tcurrent\t\t\taccumulative\n");
1349 pos += scnprintf(buf + pos, bufsz - pos, "plcp_err:\t\t%u\t\t\t%u\n",
1350 le32_to_cpu(ht->plcp_err), accum_ht->plcp_err);
1351 pos += scnprintf(buf + pos, bufsz - pos,
1352 "overrun_err:\t\t%u\t\t\t%u\n",
1353 le32_to_cpu(ht->overrun_err), accum_ht->overrun_err);
1354 pos += scnprintf(buf + pos, bufsz - pos,
1355 "early_overrun_err:\t%u\t\t\t%u\n",
1356 le32_to_cpu(ht->early_overrun_err),
1357 accum_ht->early_overrun_err);
1358 pos += scnprintf(buf + pos, bufsz - pos, "crc32_good:\t\t%u\t\t\t%u\n",
1359 le32_to_cpu(ht->crc32_good), accum_ht->crc32_good);
1360 pos += scnprintf(buf + pos, bufsz - pos, "crc32_err:\t\t%u\t\t\t%u\n",
1361 le32_to_cpu(ht->crc32_err), accum_ht->crc32_err);
1362 pos += scnprintf(buf + pos, bufsz - pos,
1363 "mh_format_err:\t\t%u\t\t\t%u\n",
1364 le32_to_cpu(ht->mh_format_err),
1365 accum_ht->mh_format_err);
1366 pos += scnprintf(buf + pos, bufsz - pos,
1367 "agg_crc32_good:\t\t%u\t\t\t%u\n",
1368 le32_to_cpu(ht->agg_crc32_good),
1369 accum_ht->agg_crc32_good);
1370 pos += scnprintf(buf + pos, bufsz - pos,
1371 "agg_mpdu_cnt:\t\t%u\t\t\t%u\n",
1372 le32_to_cpu(ht->agg_mpdu_cnt),
1373 accum_ht->agg_mpdu_cnt);
1374 pos += scnprintf(buf + pos, bufsz - pos, "agg_cnt:\t\t%u\t\t\t%u\n",
1375 le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt);
1376
1377 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1378 kfree(buf);
1379 return ret;
1380 }
1381
1382 static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
1383 char __user *user_buf,
1384 size_t count, loff_t *ppos)
1385 {
1386 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
1387 int pos = 0;
1388 char *buf;
1389 int bufsz = (sizeof(struct statistics_tx) * 24) + 250;
1390 ssize_t ret;
1391 struct statistics_tx *tx, *accum_tx;
1392
1393 if (!iwl_is_alive(priv))
1394 return -EAGAIN;
1395
1396 /* make request to uCode to retrieve statistics information */
1397 mutex_lock(&priv->mutex);
1398 ret = iwl_send_statistics_request(priv, CMD_SYNC, false);
1399 mutex_unlock(&priv->mutex);
1400
1401 if (ret) {
1402 IWL_ERR(priv,
1403 "Error sending statistics request: %zd\n", ret);
1404 return -EAGAIN;
1405 }
1406 buf = kzalloc(bufsz, GFP_KERNEL);
1407 if (!buf) {
1408 IWL_ERR(priv, "Can not allocate Buffer\n");
1409 return -ENOMEM;
1410 }
1411
1412 /* the statistic information display here is based on
1413 * the last statistics notification from uCode
1414 * might not reflect the current uCode activity
1415 */
1416 tx = &priv->statistics.tx;
1417 accum_tx = &priv->accum_statistics.tx;
1418 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
1419 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Tx:\n");
1420 pos += scnprintf(buf + pos, bufsz - pos,
1421 "\t\t\tcurrent\t\t\taccumulative\n");
1422 pos += scnprintf(buf + pos, bufsz - pos, "preamble:\t\t\t%u\t\t\t%u\n",
1423 le32_to_cpu(tx->preamble_cnt),
1424 accum_tx->preamble_cnt);
1425 pos += scnprintf(buf + pos, bufsz - pos,
1426 "rx_detected_cnt:\t\t%u\t\t\t%u\n",
1427 le32_to_cpu(tx->rx_detected_cnt),
1428 accum_tx->rx_detected_cnt);
1429 pos += scnprintf(buf + pos, bufsz - pos,
1430 "bt_prio_defer_cnt:\t\t%u\t\t\t%u\n",
1431 le32_to_cpu(tx->bt_prio_defer_cnt),
1432 accum_tx->bt_prio_defer_cnt);
1433 pos += scnprintf(buf + pos, bufsz - pos,
1434 "bt_prio_kill_cnt:\t\t%u\t\t\t%u\n",
1435 le32_to_cpu(tx->bt_prio_kill_cnt),
1436 accum_tx->bt_prio_kill_cnt);
1437 pos += scnprintf(buf + pos, bufsz - pos,
1438 "few_bytes_cnt:\t\t\t%u\t\t\t%u\n",
1439 le32_to_cpu(tx->few_bytes_cnt),
1440 accum_tx->few_bytes_cnt);
1441 pos += scnprintf(buf + pos, bufsz - pos,
1442 "cts_timeout:\t\t\t%u\t\t\t%u\n",
1443 le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout);
1444 pos += scnprintf(buf + pos, bufsz - pos,
1445 "ack_timeout:\t\t\t%u\t\t\t%u\n",
1446 le32_to_cpu(tx->ack_timeout),
1447 accum_tx->ack_timeout);
1448 pos += scnprintf(buf + pos, bufsz - pos,
1449 "expected_ack_cnt:\t\t%u\t\t\t%u\n",
1450 le32_to_cpu(tx->expected_ack_cnt),
1451 accum_tx->expected_ack_cnt);
1452 pos += scnprintf(buf + pos, bufsz - pos,
1453 "actual_ack_cnt:\t\t\t%u\t\t\t%u\n",
1454 le32_to_cpu(tx->actual_ack_cnt),
1455 accum_tx->actual_ack_cnt);
1456 pos += scnprintf(buf + pos, bufsz - pos,
1457 "dump_msdu_cnt:\t\t\t%u\t\t\t%u\n",
1458 le32_to_cpu(tx->dump_msdu_cnt),
1459 accum_tx->dump_msdu_cnt);
1460 pos += scnprintf(buf + pos, bufsz - pos,
1461 "abort_nxt_frame_mismatch:"
1462 "\t%u\t\t\t%u\n",
1463 le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt),
1464 accum_tx->burst_abort_next_frame_mismatch_cnt);
1465 pos += scnprintf(buf + pos, bufsz - pos,
1466 "abort_missing_nxt_frame:"
1467 "\t%u\t\t\t%u\n",
1468 le32_to_cpu(tx->burst_abort_missing_next_frame_cnt),
1469 accum_tx->burst_abort_missing_next_frame_cnt);
1470 pos += scnprintf(buf + pos, bufsz - pos,
1471 "cts_timeout_collision:\t\t%u\t\t\t%u\n",
1472 le32_to_cpu(tx->cts_timeout_collision),
1473 accum_tx->cts_timeout_collision);
1474 pos += scnprintf(buf + pos, bufsz - pos,
1475 "ack_ba_timeout_collision:\t%u\t\t\t%u\n",
1476 le32_to_cpu(tx->ack_or_ba_timeout_collision),
1477 accum_tx->ack_or_ba_timeout_collision);
1478 pos += scnprintf(buf + pos, bufsz - pos,
1479 "agg ba_timeout:\t\t\t%u\t\t\t%u\n",
1480 le32_to_cpu(tx->agg.ba_timeout),
1481 accum_tx->agg.ba_timeout);
1482 pos += scnprintf(buf + pos, bufsz - pos,
1483 "agg ba_resched_frames:\t\t%u\t\t\t%u\n",
1484 le32_to_cpu(tx->agg.ba_reschedule_frames),
1485 accum_tx->agg.ba_reschedule_frames);
1486 pos += scnprintf(buf + pos, bufsz - pos,
1487 "agg scd_query_agg_frame:\t%u\t\t\t%u\n",
1488 le32_to_cpu(tx->agg.scd_query_agg_frame_cnt),
1489 accum_tx->agg.scd_query_agg_frame_cnt);
1490 pos += scnprintf(buf + pos, bufsz - pos,
1491 "agg scd_query_no_agg:\t\t%u\t\t\t%u\n",
1492 le32_to_cpu(tx->agg.scd_query_no_agg),
1493 accum_tx->agg.scd_query_no_agg);
1494 pos += scnprintf(buf + pos, bufsz - pos,
1495 "agg scd_query_agg:\t\t%u\t\t\t%u\n",
1496 le32_to_cpu(tx->agg.scd_query_agg),
1497 accum_tx->agg.scd_query_agg);
1498 pos += scnprintf(buf + pos, bufsz - pos,
1499 "agg scd_query_mismatch:\t\t%u\t\t\t%u\n",
1500 le32_to_cpu(tx->agg.scd_query_mismatch),
1501 accum_tx->agg.scd_query_mismatch);
1502 pos += scnprintf(buf + pos, bufsz - pos,
1503 "agg frame_not_ready:\t\t%u\t\t\t%u\n",
1504 le32_to_cpu(tx->agg.frame_not_ready),
1505 accum_tx->agg.frame_not_ready);
1506 pos += scnprintf(buf + pos, bufsz - pos,
1507 "agg underrun:\t\t\t%u\t\t\t%u\n",
1508 le32_to_cpu(tx->agg.underrun),
1509 accum_tx->agg.underrun);
1510 pos += scnprintf(buf + pos, bufsz - pos,
1511 "agg bt_prio_kill:\t\t%u\t\t\t%u\n",
1512 le32_to_cpu(tx->agg.bt_prio_kill),
1513 accum_tx->agg.bt_prio_kill);
1514 pos += scnprintf(buf + pos, bufsz - pos,
1515 "agg rx_ba_rsp_cnt:\t\t%u\t\t\t%u\n",
1516 le32_to_cpu(tx->agg.rx_ba_rsp_cnt),
1517 accum_tx->agg.rx_ba_rsp_cnt);
1518
1519 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1520 kfree(buf);
1521 return ret;
1522 }
1523
1524 static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
1525 char __user *user_buf,
1526 size_t count, loff_t *ppos)
1527 {
1528 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
1529 int pos = 0;
1530 char *buf;
1531 int bufsz = sizeof(struct statistics_general) * 4 + 250;
1532 ssize_t ret;
1533 struct statistics_general *general, *accum_general;
1534 struct statistics_dbg *dbg, *accum_dbg;
1535 struct statistics_div *div, *accum_div;
1536
1537 if (!iwl_is_alive(priv))
1538 return -EAGAIN;
1539
1540 /* make request to uCode to retrieve statistics information */
1541 mutex_lock(&priv->mutex);
1542 ret = iwl_send_statistics_request(priv, CMD_SYNC, false);
1543 mutex_unlock(&priv->mutex);
1544
1545 if (ret) {
1546 IWL_ERR(priv,
1547 "Error sending statistics request: %zd\n", ret);
1548 return -EAGAIN;
1549 }
1550 buf = kzalloc(bufsz, GFP_KERNEL);
1551 if (!buf) {
1552 IWL_ERR(priv, "Can not allocate Buffer\n");
1553 return -ENOMEM;
1554 }
1555
1556 /* the statistic information display here is based on
1557 * the last statistics notification from uCode
1558 * might not reflect the current uCode activity
1559 */
1560 general = &priv->statistics.general;
1561 dbg = &priv->statistics.general.dbg;
1562 div = &priv->statistics.general.div;
1563 accum_general = &priv->accum_statistics.general;
1564 accum_dbg = &priv->accum_statistics.general.dbg;
1565 accum_div = &priv->accum_statistics.general.div;
1566 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
1567 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_General:\n");
1568 pos += scnprintf(buf + pos, bufsz - pos,
1569 "\t\t\tcurrent\t\t\taccumulative\n");
1570 pos += scnprintf(buf + pos, bufsz - pos, "temperature:\t\t\t%u\n",
1571 le32_to_cpu(general->temperature));
1572 pos += scnprintf(buf + pos, bufsz - pos, "temperature_m:\t\t\t%u\n",
1573 le32_to_cpu(general->temperature_m));
1574 pos += scnprintf(buf + pos, bufsz - pos,
1575 "burst_check:\t\t\t%u\t\t\t%u\n",
1576 le32_to_cpu(dbg->burst_check),
1577 accum_dbg->burst_check);
1578 pos += scnprintf(buf + pos, bufsz - pos,
1579 "burst_count:\t\t\t%u\t\t\t%u\n",
1580 le32_to_cpu(dbg->burst_count),
1581 accum_dbg->burst_count);
1582 pos += scnprintf(buf + pos, bufsz - pos,
1583 "sleep_time:\t\t\t%u\t\t\t%u\n",
1584 le32_to_cpu(general->sleep_time),
1585 accum_general->sleep_time);
1586 pos += scnprintf(buf + pos, bufsz - pos,
1587 "slots_out:\t\t\t%u\t\t\t%u\n",
1588 le32_to_cpu(general->slots_out),
1589 accum_general->slots_out);
1590 pos += scnprintf(buf + pos, bufsz - pos,
1591 "slots_idle:\t\t\t%u\t\t\t%u\n",
1592 le32_to_cpu(general->slots_idle),
1593 accum_general->slots_idle);
1594 pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp:\t\t\t%u\n",
1595 le32_to_cpu(general->ttl_timestamp));
1596 pos += scnprintf(buf + pos, bufsz - pos, "tx_on_a:\t\t\t%u\t\t\t%u\n",
1597 le32_to_cpu(div->tx_on_a), accum_div->tx_on_a);
1598 pos += scnprintf(buf + pos, bufsz - pos, "tx_on_b:\t\t\t%u\t\t\t%u\n",
1599 le32_to_cpu(div->tx_on_b), accum_div->tx_on_b);
1600 pos += scnprintf(buf + pos, bufsz - pos,
1601 "exec_time:\t\t\t%u\t\t\t%u\n",
1602 le32_to_cpu(div->exec_time), accum_div->exec_time);
1603 pos += scnprintf(buf + pos, bufsz - pos,
1604 "probe_time:\t\t\t%u\t\t\t%u\n",
1605 le32_to_cpu(div->probe_time), accum_div->probe_time);
1606 pos += scnprintf(buf + pos, bufsz - pos,
1607 "rx_enable_counter:\t\t%u\t\t\t%u\n",
1608 le32_to_cpu(general->rx_enable_counter),
1609 accum_general->rx_enable_counter);
1610 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1611 kfree(buf);
1612 return ret;
1613 }
1614
1615 static ssize_t iwl_dbgfs_sensitivity_read(struct file *file,
1616 char __user *user_buf,
1617 size_t count, loff_t *ppos) {
1618
1619 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
1620 int pos = 0;
1621 int cnt = 0;
1622 char *buf;
1623 int bufsz = sizeof(struct iwl_sensitivity_data) * 4 + 100;
1624 ssize_t ret;
1625 struct iwl_sensitivity_data *data;
1626
1627 data = &priv->sensitivity_data;
1628 buf = kzalloc(bufsz, GFP_KERNEL);
1629 if (!buf) {
1630 IWL_ERR(priv, "Can not allocate Buffer\n");
1631 return -ENOMEM;
1632 }
1633
1634 pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm:\t\t\t %u\n",
1635 data->auto_corr_ofdm);
1636 pos += scnprintf(buf + pos, bufsz - pos,
1637 "auto_corr_ofdm_mrc:\t\t %u\n",
1638 data->auto_corr_ofdm_mrc);
1639 pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm_x1:\t\t %u\n",
1640 data->auto_corr_ofdm_x1);
1641 pos += scnprintf(buf + pos, bufsz - pos,
1642 "auto_corr_ofdm_mrc_x1:\t\t %u\n",
1643 data->auto_corr_ofdm_mrc_x1);
1644 pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_cck:\t\t\t %u\n",
1645 data->auto_corr_cck);
1646 pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_cck_mrc:\t\t %u\n",
1647 data->auto_corr_cck_mrc);
1648 pos += scnprintf(buf + pos, bufsz - pos,
1649 "last_bad_plcp_cnt_ofdm:\t\t %u\n",
1650 data->last_bad_plcp_cnt_ofdm);
1651 pos += scnprintf(buf + pos, bufsz - pos, "last_fa_cnt_ofdm:\t\t %u\n",
1652 data->last_fa_cnt_ofdm);
1653 pos += scnprintf(buf + pos, bufsz - pos,
1654 "last_bad_plcp_cnt_cck:\t\t %u\n",
1655 data->last_bad_plcp_cnt_cck);
1656 pos += scnprintf(buf + pos, bufsz - pos, "last_fa_cnt_cck:\t\t %u\n",
1657 data->last_fa_cnt_cck);
1658 pos += scnprintf(buf + pos, bufsz - pos, "nrg_curr_state:\t\t\t %u\n",
1659 data->nrg_curr_state);
1660 pos += scnprintf(buf + pos, bufsz - pos, "nrg_prev_state:\t\t\t %u\n",
1661 data->nrg_prev_state);
1662 pos += scnprintf(buf + pos, bufsz - pos, "nrg_value:\t\t\t");
1663 for (cnt = 0; cnt < 10; cnt++) {
1664 pos += scnprintf(buf + pos, bufsz - pos, " %u",
1665 data->nrg_value[cnt]);
1666 }
1667 pos += scnprintf(buf + pos, bufsz - pos, "\n");
1668 pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_rssi:\t\t");
1669 for (cnt = 0; cnt < NRG_NUM_PREV_STAT_L; cnt++) {
1670 pos += scnprintf(buf + pos, bufsz - pos, " %u",
1671 data->nrg_silence_rssi[cnt]);
1672 }
1673 pos += scnprintf(buf + pos, bufsz - pos, "\n");
1674 pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_ref:\t\t %u\n",
1675 data->nrg_silence_ref);
1676 pos += scnprintf(buf + pos, bufsz - pos, "nrg_energy_idx:\t\t\t %u\n",
1677 data->nrg_energy_idx);
1678 pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_idx:\t\t %u\n",
1679 data->nrg_silence_idx);
1680 pos += scnprintf(buf + pos, bufsz - pos, "nrg_th_cck:\t\t\t %u\n",
1681 data->nrg_th_cck);
1682 pos += scnprintf(buf + pos, bufsz - pos,
1683 "nrg_auto_corr_silence_diff:\t %u\n",
1684 data->nrg_auto_corr_silence_diff);
1685 pos += scnprintf(buf + pos, bufsz - pos, "num_in_cck_no_fa:\t\t %u\n",
1686 data->num_in_cck_no_fa);
1687 pos += scnprintf(buf + pos, bufsz - pos, "nrg_th_ofdm:\t\t\t %u\n",
1688 data->nrg_th_ofdm);
1689
1690 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1691 kfree(buf);
1692 return ret;
1693 }
1694
1695
1696 static ssize_t iwl_dbgfs_chain_noise_read(struct file *file,
1697 char __user *user_buf,
1698 size_t count, loff_t *ppos) {
1699
1700 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
1701 int pos = 0;
1702 int cnt = 0;
1703 char *buf;
1704 int bufsz = sizeof(struct iwl_chain_noise_data) * 4 + 100;
1705 ssize_t ret;
1706 struct iwl_chain_noise_data *data;
1707
1708 data = &priv->chain_noise_data;
1709 buf = kzalloc(bufsz, GFP_KERNEL);
1710 if (!buf) {
1711 IWL_ERR(priv, "Can not allocate Buffer\n");
1712 return -ENOMEM;
1713 }
1714
1715 pos += scnprintf(buf + pos, bufsz - pos, "active_chains:\t\t\t %u\n",
1716 data->active_chains);
1717 pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_a:\t\t\t %u\n",
1718 data->chain_noise_a);
1719 pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_b:\t\t\t %u\n",
1720 data->chain_noise_b);
1721 pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_c:\t\t\t %u\n",
1722 data->chain_noise_c);
1723 pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_a:\t\t\t %u\n",
1724 data->chain_signal_a);
1725 pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_b:\t\t\t %u\n",
1726 data->chain_signal_b);
1727 pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_c:\t\t\t %u\n",
1728 data->chain_signal_c);
1729 pos += scnprintf(buf + pos, bufsz - pos, "beacon_count:\t\t\t %u\n",
1730 data->beacon_count);
1731
1732 pos += scnprintf(buf + pos, bufsz - pos, "disconn_array:\t\t\t");
1733 for (cnt = 0; cnt < NUM_RX_CHAINS; cnt++) {
1734 pos += scnprintf(buf + pos, bufsz - pos, " %u",
1735 data->disconn_array[cnt]);
1736 }
1737 pos += scnprintf(buf + pos, bufsz - pos, "\n");
1738 pos += scnprintf(buf + pos, bufsz - pos, "delta_gain_code:\t\t");
1739 for (cnt = 0; cnt < NUM_RX_CHAINS; cnt++) {
1740 pos += scnprintf(buf + pos, bufsz - pos, " %u",
1741 data->delta_gain_code[cnt]);
1742 }
1743 pos += scnprintf(buf + pos, bufsz - pos, "\n");
1744 pos += scnprintf(buf + pos, bufsz - pos, "radio_write:\t\t\t %u\n",
1745 data->radio_write);
1746 pos += scnprintf(buf + pos, bufsz - pos, "state:\t\t\t\t %u\n",
1747 data->state);
1748
1749 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1750 kfree(buf);
1751 return ret;
1752 }
1753
1754 static ssize_t iwl_dbgfs_tx_power_read(struct file *file,
1755 char __user *user_buf,
1756 size_t count, loff_t *ppos) {
1757
1758 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
1759 char buf[128];
1760 int pos = 0;
1761 ssize_t ret;
1762 const size_t bufsz = sizeof(buf);
1763 struct statistics_tx *tx;
1764
1765 if (!iwl_is_alive(priv))
1766 pos += scnprintf(buf + pos, bufsz - pos, "N/A\n");
1767 else {
1768 /* make request to uCode to retrieve statistics information */
1769 mutex_lock(&priv->mutex);
1770 ret = iwl_send_statistics_request(priv, CMD_SYNC, false);
1771 mutex_unlock(&priv->mutex);
1772
1773 if (ret) {
1774 IWL_ERR(priv, "Error sending statistics request: %zd\n",
1775 ret);
1776 return -EAGAIN;
1777 }
1778 tx = &priv->statistics.tx;
1779 if (tx->tx_power.ant_a ||
1780 tx->tx_power.ant_b ||
1781 tx->tx_power.ant_c) {
1782 pos += scnprintf(buf + pos, bufsz - pos,
1783 "tx power: (1/2 dB step)\n");
1784 if ((priv->cfg->valid_tx_ant & ANT_A) &&
1785 tx->tx_power.ant_a)
1786 pos += scnprintf(buf + pos, bufsz - pos,
1787 "\tantenna A: 0x%X\n",
1788 tx->tx_power.ant_a);
1789 if ((priv->cfg->valid_tx_ant & ANT_B) &&
1790 tx->tx_power.ant_b)
1791 pos += scnprintf(buf + pos, bufsz - pos,
1792 "\tantenna B: 0x%X\n",
1793 tx->tx_power.ant_b);
1794 if ((priv->cfg->valid_tx_ant & ANT_C) &&
1795 tx->tx_power.ant_c)
1796 pos += scnprintf(buf + pos, bufsz - pos,
1797 "\tantenna C: 0x%X\n",
1798 tx->tx_power.ant_c);
1799 } else
1800 pos += scnprintf(buf + pos, bufsz - pos, "N/A\n");
1801 }
1802 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1803 }
1804
1805 static ssize_t iwl_dbgfs_power_save_status_read(struct file *file,
1806 char __user *user_buf,
1807 size_t count, loff_t *ppos)
1808 {
1809 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
1810 char buf[60];
1811 int pos = 0;
1812 const size_t bufsz = sizeof(buf);
1813 u32 pwrsave_status;
1814
1815 pwrsave_status = iwl_read32(priv, CSR_GP_CNTRL) &
1816 CSR_GP_REG_POWER_SAVE_STATUS_MSK;
1817
1818 pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: ");
1819 pos += scnprintf(buf + pos, bufsz - pos, "%s\n",
1820 (pwrsave_status == CSR_GP_REG_NO_POWER_SAVE) ? "none" :
1821 (pwrsave_status == CSR_GP_REG_MAC_POWER_SAVE) ? "MAC" :
1822 (pwrsave_status == CSR_GP_REG_PHY_POWER_SAVE) ? "PHY" :
1823 "error");
1824
1825 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1826 }
1827
1828 static ssize_t iwl_dbgfs_clear_statistics_write(struct file *file,
1829 const char __user *user_buf,
1830 size_t count, loff_t *ppos)
1831 {
1832 struct iwl_priv *priv = file->private_data;
1833 char buf[8];
1834 int buf_size;
1835 int clear;
1836
1837 memset(buf, 0, sizeof(buf));
1838 buf_size = min(count, sizeof(buf) - 1);
1839 if (copy_from_user(buf, user_buf, buf_size))
1840 return -EFAULT;
1841 if (sscanf(buf, "%d", &clear) != 1)
1842 return -EFAULT;
1843
1844 /* make request to uCode to retrieve statistics information */
1845 mutex_lock(&priv->mutex);
1846 iwl_send_statistics_request(priv, CMD_SYNC, true);
1847 mutex_unlock(&priv->mutex);
1848
1849 return count;
1850 }
1851
1852 DEBUGFS_READ_WRITE_FILE_OPS(rx_statistics);
1853 DEBUGFS_READ_WRITE_FILE_OPS(tx_statistics);
1854 DEBUGFS_READ_WRITE_FILE_OPS(traffic_log);
1855 DEBUGFS_READ_FILE_OPS(rx_queue);
1856 DEBUGFS_READ_FILE_OPS(tx_queue);
1857 DEBUGFS_READ_FILE_OPS(ucode_rx_stats);
1858 DEBUGFS_READ_FILE_OPS(ucode_tx_stats);
1859 DEBUGFS_READ_FILE_OPS(ucode_general_stats);
1860 DEBUGFS_READ_FILE_OPS(sensitivity);
1861 DEBUGFS_READ_FILE_OPS(chain_noise);
1862 DEBUGFS_READ_FILE_OPS(tx_power);
1863 DEBUGFS_READ_FILE_OPS(power_save_status);
1864 DEBUGFS_WRITE_FILE_OPS(clear_statistics);
1865
1866 /*
1867 * Create the debugfs files and directories
1868 *
1869 */
1870 int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
1871 {
1872 struct iwl_debugfs *dbgfs;
1873 struct dentry *phyd = priv->hw->wiphy->debugfsdir;
1874 int ret = 0;
1875
1876 dbgfs = kzalloc(sizeof(struct iwl_debugfs), GFP_KERNEL);
1877 if (!dbgfs) {
1878 ret = -ENOMEM;
1879 goto err;
1880 }
1881
1882 priv->dbgfs = dbgfs;
1883 dbgfs->name = name;
1884 dbgfs->dir_drv = debugfs_create_dir(name, phyd);
1885 if (!dbgfs->dir_drv || IS_ERR(dbgfs->dir_drv)) {
1886 ret = -ENOENT;
1887 goto err;
1888 }
1889
1890 DEBUGFS_ADD_DIR(data, dbgfs->dir_drv);
1891 DEBUGFS_ADD_DIR(rf, dbgfs->dir_drv);
1892 DEBUGFS_ADD_DIR(debug, dbgfs->dir_drv);
1893 DEBUGFS_ADD_FILE(nvm, data);
1894 DEBUGFS_ADD_FILE(sram, data);
1895 DEBUGFS_ADD_FILE(log_event, data);
1896 DEBUGFS_ADD_FILE(stations, data);
1897 DEBUGFS_ADD_FILE(channels, data);
1898 DEBUGFS_ADD_FILE(status, data);
1899 DEBUGFS_ADD_FILE(interrupt, data);
1900 DEBUGFS_ADD_FILE(qos, data);
1901 DEBUGFS_ADD_FILE(led, data);
1902 DEBUGFS_ADD_FILE(sleep_level_override, data);
1903 DEBUGFS_ADD_FILE(current_sleep_command, data);
1904 DEBUGFS_ADD_FILE(thermal_throttling, data);
1905 DEBUGFS_ADD_FILE(disable_ht40, data);
1906 DEBUGFS_ADD_FILE(rx_statistics, debug);
1907 DEBUGFS_ADD_FILE(tx_statistics, debug);
1908 DEBUGFS_ADD_FILE(traffic_log, debug);
1909 DEBUGFS_ADD_FILE(rx_queue, debug);
1910 DEBUGFS_ADD_FILE(tx_queue, debug);
1911 DEBUGFS_ADD_FILE(tx_power, debug);
1912 DEBUGFS_ADD_FILE(power_save_status, debug);
1913 DEBUGFS_ADD_FILE(clear_statistics, debug);
1914 if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) {
1915 DEBUGFS_ADD_FILE(ucode_rx_stats, debug);
1916 DEBUGFS_ADD_FILE(ucode_tx_stats, debug);
1917 DEBUGFS_ADD_FILE(ucode_general_stats, debug);
1918 DEBUGFS_ADD_FILE(sensitivity, debug);
1919 DEBUGFS_ADD_FILE(chain_noise, debug);
1920 }
1921 DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal);
1922 DEBUGFS_ADD_BOOL(disable_chain_noise, rf,
1923 &priv->disable_chain_noise_cal);
1924 if (((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965) ||
1925 ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_3945))
1926 DEBUGFS_ADD_BOOL(disable_tx_power, rf,
1927 &priv->disable_tx_power_cal);
1928 return 0;
1929
1930 err:
1931 IWL_ERR(priv, "Can't open the debugfs directory\n");
1932 iwl_dbgfs_unregister(priv);
1933 return ret;
1934 }
1935 EXPORT_SYMBOL(iwl_dbgfs_register);
1936
1937 /**
1938 * Remove the debugfs files and directories
1939 *
1940 */
1941 void iwl_dbgfs_unregister(struct iwl_priv *priv)
1942 {
1943 if (!priv->dbgfs)
1944 return;
1945
1946 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_sleep_level_override);
1947 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_current_sleep_command);
1948 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_nvm);
1949 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_sram);
1950 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_log_event);
1951 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_stations);
1952 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_channels);
1953 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_status);
1954 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_interrupt);
1955 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_qos);
1956 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_led);
1957 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_thermal_throttling);
1958 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_disable_ht40);
1959 DEBUGFS_REMOVE(priv->dbgfs->dir_data);
1960 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_rx_statistics);
1961 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_statistics);
1962 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_traffic_log);
1963 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_rx_queue);
1964 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_queue);
1965 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_power);
1966 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_power_save_status);
1967 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_clear_statistics);
1968 if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) {
1969 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.
1970 file_ucode_rx_stats);
1971 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.
1972 file_ucode_tx_stats);
1973 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.
1974 file_ucode_general_stats);
1975 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.
1976 file_sensitivity);
1977 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.
1978 file_chain_noise);
1979 }
1980 DEBUGFS_REMOVE(priv->dbgfs->dir_debug);
1981 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity);
1982 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise);
1983 if (((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965) ||
1984 ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_3945))
1985 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_tx_power);
1986 DEBUGFS_REMOVE(priv->dbgfs->dir_rf);
1987 DEBUGFS_REMOVE(priv->dbgfs->dir_drv);
1988 kfree(priv->dbgfs);
1989 priv->dbgfs = NULL;
1990 }
1991 EXPORT_SYMBOL(iwl_dbgfs_unregister);
1992
1993
1994
This page took 0.160698 seconds and 5 git commands to generate.