diff options
author | John W. Linville <linville@tuxdriver.com> | 2012-04-26 15:03:48 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-04-26 15:03:48 -0400 |
commit | d9b8ae6bd8c3304569a25079fcdbebaa28a48ee4 (patch) | |
tree | 9ce3e4eb355685f970dd7333a0a935109aff0583 /drivers/net/wireless/iwlwifi/iwl-debugfs.c | |
parent | 872f24dbc604ef585ea7eec73020dcdfaffd1956 (diff) | |
parent | 94c514fe240fc0dd02187b78facefde8b6744634 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Conflicts:
drivers/net/wireless/iwlwifi/iwl-testmode.c
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debugfs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debugfs.c | 309 |
1 files changed, 64 insertions, 245 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 32834a797d11..e7c157e5ebeb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -37,9 +37,9 @@ | |||
37 | 37 | ||
38 | #include "iwl-dev.h" | 38 | #include "iwl-dev.h" |
39 | #include "iwl-debug.h" | 39 | #include "iwl-debug.h" |
40 | #include "iwl-core.h" | ||
41 | #include "iwl-io.h" | 40 | #include "iwl-io.h" |
42 | #include "iwl-agn.h" | 41 | #include "iwl-agn.h" |
42 | #include "iwl-modparams.h" | ||
43 | 43 | ||
44 | /* create and remove of files */ | 44 | /* create and remove of files */ |
45 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ | 45 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ |
@@ -111,105 +111,6 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \ | |||
111 | .llseek = generic_file_llseek, \ | 111 | .llseek = generic_file_llseek, \ |
112 | }; | 112 | }; |
113 | 113 | ||
114 | static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file, | ||
115 | char __user *user_buf, | ||
116 | size_t count, loff_t *ppos) { | ||
117 | |||
118 | struct iwl_priv *priv = file->private_data; | ||
119 | char *buf; | ||
120 | int pos = 0; | ||
121 | |||
122 | int cnt; | ||
123 | ssize_t ret; | ||
124 | const size_t bufsz = 100 + | ||
125 | sizeof(char) * 50 * (MANAGEMENT_MAX + CONTROL_MAX); | ||
126 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
127 | if (!buf) | ||
128 | return -ENOMEM; | ||
129 | pos += scnprintf(buf + pos, bufsz - pos, "Management:\n"); | ||
130 | for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) { | ||
131 | pos += scnprintf(buf + pos, bufsz - pos, | ||
132 | "\t%25s\t\t: %u\n", | ||
133 | get_mgmt_string(cnt), | ||
134 | priv->tx_stats.mgmt[cnt]); | ||
135 | } | ||
136 | pos += scnprintf(buf + pos, bufsz - pos, "Control\n"); | ||
137 | for (cnt = 0; cnt < CONTROL_MAX; cnt++) { | ||
138 | pos += scnprintf(buf + pos, bufsz - pos, | ||
139 | "\t%25s\t\t: %u\n", | ||
140 | get_ctrl_string(cnt), | ||
141 | priv->tx_stats.ctrl[cnt]); | ||
142 | } | ||
143 | pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); | ||
144 | pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n", | ||
145 | priv->tx_stats.data_cnt); | ||
146 | pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n", | ||
147 | priv->tx_stats.data_bytes); | ||
148 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
149 | kfree(buf); | ||
150 | return ret; | ||
151 | } | ||
152 | |||
153 | static ssize_t iwl_dbgfs_clear_traffic_statistics_write(struct file *file, | ||
154 | const char __user *user_buf, | ||
155 | size_t count, loff_t *ppos) | ||
156 | { | ||
157 | struct iwl_priv *priv = file->private_data; | ||
158 | u32 clear_flag; | ||
159 | char buf[8]; | ||
160 | int buf_size; | ||
161 | |||
162 | memset(buf, 0, sizeof(buf)); | ||
163 | buf_size = min(count, sizeof(buf) - 1); | ||
164 | if (copy_from_user(buf, user_buf, buf_size)) | ||
165 | return -EFAULT; | ||
166 | if (sscanf(buf, "%x", &clear_flag) != 1) | ||
167 | return -EFAULT; | ||
168 | iwl_clear_traffic_stats(priv); | ||
169 | |||
170 | return count; | ||
171 | } | ||
172 | |||
173 | static ssize_t iwl_dbgfs_rx_statistics_read(struct file *file, | ||
174 | char __user *user_buf, | ||
175 | size_t count, loff_t *ppos) { | ||
176 | |||
177 | struct iwl_priv *priv = file->private_data; | ||
178 | char *buf; | ||
179 | int pos = 0; | ||
180 | int cnt; | ||
181 | ssize_t ret; | ||
182 | const size_t bufsz = 100 + | ||
183 | sizeof(char) * 50 * (MANAGEMENT_MAX + CONTROL_MAX); | ||
184 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
185 | if (!buf) | ||
186 | return -ENOMEM; | ||
187 | |||
188 | pos += scnprintf(buf + pos, bufsz - pos, "Management:\n"); | ||
189 | for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) { | ||
190 | pos += scnprintf(buf + pos, bufsz - pos, | ||
191 | "\t%25s\t\t: %u\n", | ||
192 | get_mgmt_string(cnt), | ||
193 | priv->rx_stats.mgmt[cnt]); | ||
194 | } | ||
195 | pos += scnprintf(buf + pos, bufsz - pos, "Control:\n"); | ||
196 | for (cnt = 0; cnt < CONTROL_MAX; cnt++) { | ||
197 | pos += scnprintf(buf + pos, bufsz - pos, | ||
198 | "\t%25s\t\t: %u\n", | ||
199 | get_ctrl_string(cnt), | ||
200 | priv->rx_stats.ctrl[cnt]); | ||
201 | } | ||
202 | pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); | ||
203 | pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n", | ||
204 | priv->rx_stats.data_cnt); | ||
205 | pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n", | ||
206 | priv->rx_stats.data_bytes); | ||
207 | |||
208 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
209 | kfree(buf); | ||
210 | return ret; | ||
211 | } | ||
212 | |||
213 | static ssize_t iwl_dbgfs_sram_read(struct file *file, | 114 | static ssize_t iwl_dbgfs_sram_read(struct file *file, |
214 | char __user *user_buf, | 115 | char __user *user_buf, |
215 | size_t count, loff_t *ppos) | 116 | size_t count, loff_t *ppos) |
@@ -230,10 +131,8 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file, | |||
230 | /* default is to dump the entire data segment */ | 131 | /* default is to dump the entire data segment */ |
231 | if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { | 132 | if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { |
232 | priv->dbgfs_sram_offset = 0x800000; | 133 | priv->dbgfs_sram_offset = 0x800000; |
233 | if (!priv->ucode_loaded) { | 134 | if (!priv->ucode_loaded) |
234 | IWL_ERR(priv, "No uCode has been loadded.\n"); | ||
235 | return -EINVAL; | 135 | return -EINVAL; |
236 | } | ||
237 | img = &priv->fw->img[priv->cur_ucode]; | 136 | img = &priv->fw->img[priv->cur_ucode]; |
238 | priv->dbgfs_sram_len = img->sec[IWL_UCODE_SECTION_DATA].len; | 137 | priv->dbgfs_sram_len = img->sec[IWL_UCODE_SECTION_DATA].len; |
239 | } | 138 | } |
@@ -259,7 +158,7 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file, | |||
259 | sram = priv->dbgfs_sram_offset & ~0x3; | 158 | sram = priv->dbgfs_sram_offset & ~0x3; |
260 | 159 | ||
261 | /* read the first u32 from sram */ | 160 | /* read the first u32 from sram */ |
262 | val = iwl_read_targ_mem(trans(priv), sram); | 161 | val = iwl_read_targ_mem(priv->trans, sram); |
263 | 162 | ||
264 | for (; len; len--) { | 163 | for (; len; len--) { |
265 | /* put the address at the start of every line */ | 164 | /* put the address at the start of every line */ |
@@ -278,7 +177,7 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file, | |||
278 | if (++offset == 4) { | 177 | if (++offset == 4) { |
279 | sram += 4; | 178 | sram += 4; |
280 | offset = 0; | 179 | offset = 0; |
281 | val = iwl_read_targ_mem(trans(priv), sram); | 180 | val = iwl_read_targ_mem(priv->trans, sram); |
282 | } | 181 | } |
283 | 182 | ||
284 | /* put in extra spaces and split lines for human readability */ | 183 | /* put in extra spaces and split lines for human readability */ |
@@ -408,26 +307,21 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file, | |||
408 | const u8 *ptr; | 307 | const u8 *ptr; |
409 | char *buf; | 308 | char *buf; |
410 | u16 eeprom_ver; | 309 | u16 eeprom_ver; |
411 | size_t eeprom_len = cfg(priv)->base_params->eeprom_size; | 310 | size_t eeprom_len = priv->cfg->base_params->eeprom_size; |
412 | buf_size = 4 * eeprom_len + 256; | 311 | buf_size = 4 * eeprom_len + 256; |
413 | 312 | ||
414 | if (eeprom_len % 16) { | 313 | if (eeprom_len % 16) |
415 | IWL_ERR(priv, "NVM size is not multiple of 16.\n"); | ||
416 | return -ENODATA; | 314 | return -ENODATA; |
417 | } | ||
418 | 315 | ||
419 | ptr = priv->eeprom; | 316 | ptr = priv->eeprom; |
420 | if (!ptr) { | 317 | if (!ptr) |
421 | IWL_ERR(priv, "Invalid EEPROM/OTP memory\n"); | ||
422 | return -ENOMEM; | 318 | return -ENOMEM; |
423 | } | ||
424 | 319 | ||
425 | /* 4 characters for byte 0xYY */ | 320 | /* 4 characters for byte 0xYY */ |
426 | buf = kzalloc(buf_size, GFP_KERNEL); | 321 | buf = kzalloc(buf_size, GFP_KERNEL); |
427 | if (!buf) { | 322 | if (!buf) |
428 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
429 | return -ENOMEM; | 323 | return -ENOMEM; |
430 | } | 324 | |
431 | eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); | 325 | eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); |
432 | pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, " | 326 | pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, " |
433 | "version: 0x%x\n", | 327 | "version: 0x%x\n", |
@@ -461,10 +355,8 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf, | |||
461 | return -EAGAIN; | 355 | return -EAGAIN; |
462 | 356 | ||
463 | buf = kzalloc(bufsz, GFP_KERNEL); | 357 | buf = kzalloc(bufsz, GFP_KERNEL); |
464 | if (!buf) { | 358 | if (!buf) |
465 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
466 | return -ENOMEM; | 359 | return -ENOMEM; |
467 | } | ||
468 | 360 | ||
469 | supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ); | 361 | supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ); |
470 | if (supp_band) { | 362 | if (supp_band) { |
@@ -566,10 +458,8 @@ static ssize_t iwl_dbgfs_rx_handlers_read(struct file *file, | |||
566 | ssize_t ret; | 458 | ssize_t ret; |
567 | 459 | ||
568 | buf = kzalloc(bufsz, GFP_KERNEL); | 460 | buf = kzalloc(bufsz, GFP_KERNEL); |
569 | if (!buf) { | 461 | if (!buf) |
570 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
571 | return -ENOMEM; | 462 | return -ENOMEM; |
572 | } | ||
573 | 463 | ||
574 | for (cnt = 0; cnt < REPLY_MAX; cnt++) { | 464 | for (cnt = 0; cnt < REPLY_MAX; cnt++) { |
575 | if (priv->rx_handlers_stats[cnt] > 0) | 465 | if (priv->rx_handlers_stats[cnt] > 0) |
@@ -683,11 +573,8 @@ static ssize_t iwl_dbgfs_disable_ht40_write(struct file *file, | |||
683 | return -EFAULT; | 573 | return -EFAULT; |
684 | if (!iwl_is_any_associated(priv)) | 574 | if (!iwl_is_any_associated(priv)) |
685 | priv->disable_ht40 = ht40 ? true : false; | 575 | priv->disable_ht40 = ht40 ? true : false; |
686 | else { | 576 | else |
687 | IWL_ERR(priv, "Sta associated with AP - " | ||
688 | "Change to 40MHz channel support is not allowed\n"); | ||
689 | return -EINVAL; | 577 | return -EINVAL; |
690 | } | ||
691 | 578 | ||
692 | return count; | 579 | return count; |
693 | } | 580 | } |
@@ -819,87 +706,6 @@ DEBUGFS_READ_FILE_OPS(temperature); | |||
819 | DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override); | 706 | DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override); |
820 | DEBUGFS_READ_FILE_OPS(current_sleep_command); | 707 | DEBUGFS_READ_FILE_OPS(current_sleep_command); |
821 | 708 | ||
822 | static ssize_t iwl_dbgfs_traffic_log_read(struct file *file, | ||
823 | char __user *user_buf, | ||
824 | size_t count, loff_t *ppos) | ||
825 | { | ||
826 | struct iwl_priv *priv = file->private_data; | ||
827 | int pos = 0, ofs = 0; | ||
828 | int cnt = 0, entry; | ||
829 | |||
830 | char *buf; | ||
831 | int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) + | ||
832 | (cfg(priv)->base_params->num_of_queues * 32 * 8) + 400; | ||
833 | const u8 *ptr; | ||
834 | ssize_t ret; | ||
835 | |||
836 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
837 | if (!buf) { | ||
838 | IWL_ERR(priv, "Can not allocate buffer\n"); | ||
839 | return -ENOMEM; | ||
840 | } | ||
841 | if (priv->tx_traffic && iwl_have_debug_level(IWL_DL_TX)) { | ||
842 | ptr = priv->tx_traffic; | ||
843 | pos += scnprintf(buf + pos, bufsz - pos, | ||
844 | "Tx Traffic idx: %u\n", priv->tx_traffic_idx); | ||
845 | for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) { | ||
846 | for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16; | ||
847 | entry++, ofs += 16) { | ||
848 | pos += scnprintf(buf + pos, bufsz - pos, | ||
849 | "0x%.4x ", ofs); | ||
850 | hex_dump_to_buffer(ptr + ofs, 16, 16, 2, | ||
851 | buf + pos, bufsz - pos, 0); | ||
852 | pos += strlen(buf + pos); | ||
853 | if (bufsz - pos > 0) | ||
854 | buf[pos++] = '\n'; | ||
855 | } | ||
856 | } | ||
857 | } | ||
858 | |||
859 | if (priv->rx_traffic && iwl_have_debug_level(IWL_DL_RX)) { | ||
860 | ptr = priv->rx_traffic; | ||
861 | pos += scnprintf(buf + pos, bufsz - pos, | ||
862 | "Rx Traffic idx: %u\n", priv->rx_traffic_idx); | ||
863 | for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) { | ||
864 | for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16; | ||
865 | entry++, ofs += 16) { | ||
866 | pos += scnprintf(buf + pos, bufsz - pos, | ||
867 | "0x%.4x ", ofs); | ||
868 | hex_dump_to_buffer(ptr + ofs, 16, 16, 2, | ||
869 | buf + pos, bufsz - pos, 0); | ||
870 | pos += strlen(buf + pos); | ||
871 | if (bufsz - pos > 0) | ||
872 | buf[pos++] = '\n'; | ||
873 | } | ||
874 | } | ||
875 | } | ||
876 | |||
877 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
878 | kfree(buf); | ||
879 | return ret; | ||
880 | } | ||
881 | |||
882 | static ssize_t iwl_dbgfs_traffic_log_write(struct file *file, | ||
883 | const char __user *user_buf, | ||
884 | size_t count, loff_t *ppos) | ||
885 | { | ||
886 | struct iwl_priv *priv = file->private_data; | ||
887 | char buf[8]; | ||
888 | int buf_size; | ||
889 | int traffic_log; | ||
890 | |||
891 | memset(buf, 0, sizeof(buf)); | ||
892 | buf_size = min(count, sizeof(buf) - 1); | ||
893 | if (copy_from_user(buf, user_buf, buf_size)) | ||
894 | return -EFAULT; | ||
895 | if (sscanf(buf, "%d", &traffic_log) != 1) | ||
896 | return -EFAULT; | ||
897 | if (traffic_log == 0) | ||
898 | iwl_reset_traffic_log(priv); | ||
899 | |||
900 | return count; | ||
901 | } | ||
902 | |||
903 | static const char *fmt_value = " %-30s %10u\n"; | 709 | static const char *fmt_value = " %-30s %10u\n"; |
904 | static const char *fmt_hex = " %-30s 0x%02X\n"; | 710 | static const char *fmt_hex = " %-30s 0x%02X\n"; |
905 | static const char *fmt_table = " %-30s %10u %10u %10u %10u\n"; | 711 | static const char *fmt_table = " %-30s %10u %10u %10u %10u\n"; |
@@ -950,10 +756,8 @@ static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file, | |||
950 | return -EAGAIN; | 756 | return -EAGAIN; |
951 | 757 | ||
952 | buf = kzalloc(bufsz, GFP_KERNEL); | 758 | buf = kzalloc(bufsz, GFP_KERNEL); |
953 | if (!buf) { | 759 | if (!buf) |
954 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
955 | return -ENOMEM; | 760 | return -ENOMEM; |
956 | } | ||
957 | 761 | ||
958 | /* | 762 | /* |
959 | * the statistic information display here is based on | 763 | * the statistic information display here is based on |
@@ -1379,10 +1183,8 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file, | |||
1379 | return -EAGAIN; | 1183 | return -EAGAIN; |
1380 | 1184 | ||
1381 | buf = kzalloc(bufsz, GFP_KERNEL); | 1185 | buf = kzalloc(bufsz, GFP_KERNEL); |
1382 | if (!buf) { | 1186 | if (!buf) |
1383 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
1384 | return -ENOMEM; | 1187 | return -ENOMEM; |
1385 | } | ||
1386 | 1188 | ||
1387 | /* the statistic information display here is based on | 1189 | /* the statistic information display here is based on |
1388 | * the last statistics notification from uCode | 1190 | * the last statistics notification from uCode |
@@ -1581,10 +1383,8 @@ static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file, | |||
1581 | return -EAGAIN; | 1383 | return -EAGAIN; |
1582 | 1384 | ||
1583 | buf = kzalloc(bufsz, GFP_KERNEL); | 1385 | buf = kzalloc(bufsz, GFP_KERNEL); |
1584 | if (!buf) { | 1386 | if (!buf) |
1585 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
1586 | return -ENOMEM; | 1387 | return -ENOMEM; |
1587 | } | ||
1588 | 1388 | ||
1589 | /* the statistic information display here is based on | 1389 | /* the statistic information display here is based on |
1590 | * the last statistics notification from uCode | 1390 | * the last statistics notification from uCode |
@@ -1707,16 +1507,11 @@ static ssize_t iwl_dbgfs_ucode_bt_stats_read(struct file *file, | |||
1707 | ret = iwl_send_statistics_request(priv, CMD_SYNC, false); | 1507 | ret = iwl_send_statistics_request(priv, CMD_SYNC, false); |
1708 | mutex_unlock(&priv->mutex); | 1508 | mutex_unlock(&priv->mutex); |
1709 | 1509 | ||
1710 | if (ret) { | 1510 | if (ret) |
1711 | IWL_ERR(priv, | ||
1712 | "Error sending statistics request: %zd\n", ret); | ||
1713 | return -EAGAIN; | 1511 | return -EAGAIN; |
1714 | } | ||
1715 | buf = kzalloc(bufsz, GFP_KERNEL); | 1512 | buf = kzalloc(bufsz, GFP_KERNEL); |
1716 | if (!buf) { | 1513 | if (!buf) |
1717 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
1718 | return -ENOMEM; | 1514 | return -ENOMEM; |
1719 | } | ||
1720 | 1515 | ||
1721 | /* | 1516 | /* |
1722 | * the statistic information display here is based on | 1517 | * the statistic information display here is based on |
@@ -1793,10 +1588,8 @@ static ssize_t iwl_dbgfs_reply_tx_error_read(struct file *file, | |||
1793 | return -EAGAIN; | 1588 | return -EAGAIN; |
1794 | 1589 | ||
1795 | buf = kzalloc(bufsz, GFP_KERNEL); | 1590 | buf = kzalloc(bufsz, GFP_KERNEL); |
1796 | if (!buf) { | 1591 | if (!buf) |
1797 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
1798 | return -ENOMEM; | 1592 | return -ENOMEM; |
1799 | } | ||
1800 | 1593 | ||
1801 | pos += scnprintf(buf + pos, bufsz - pos, "Statistics_TX_Error:\n"); | 1594 | pos += scnprintf(buf + pos, bufsz - pos, "Statistics_TX_Error:\n"); |
1802 | pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t\t%u\n", | 1595 | pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t\t%u\n", |
@@ -1936,10 +1729,8 @@ static ssize_t iwl_dbgfs_sensitivity_read(struct file *file, | |||
1936 | 1729 | ||
1937 | data = &priv->sensitivity_data; | 1730 | data = &priv->sensitivity_data; |
1938 | buf = kzalloc(bufsz, GFP_KERNEL); | 1731 | buf = kzalloc(bufsz, GFP_KERNEL); |
1939 | if (!buf) { | 1732 | if (!buf) |
1940 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
1941 | return -ENOMEM; | 1733 | return -ENOMEM; |
1942 | } | ||
1943 | 1734 | ||
1944 | pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm:\t\t\t %u\n", | 1735 | pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm:\t\t\t %u\n", |
1945 | data->auto_corr_ofdm); | 1736 | data->auto_corr_ofdm); |
@@ -2017,10 +1808,8 @@ static ssize_t iwl_dbgfs_chain_noise_read(struct file *file, | |||
2017 | 1808 | ||
2018 | data = &priv->chain_noise_data; | 1809 | data = &priv->chain_noise_data; |
2019 | buf = kzalloc(bufsz, GFP_KERNEL); | 1810 | buf = kzalloc(bufsz, GFP_KERNEL); |
2020 | if (!buf) { | 1811 | if (!buf) |
2021 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
2022 | return -ENOMEM; | 1812 | return -ENOMEM; |
2023 | } | ||
2024 | 1813 | ||
2025 | pos += scnprintf(buf + pos, bufsz - pos, "active_chains:\t\t\t %u\n", | 1814 | pos += scnprintf(buf + pos, bufsz - pos, "active_chains:\t\t\t %u\n", |
2026 | data->active_chains); | 1815 | data->active_chains); |
@@ -2071,7 +1860,7 @@ static ssize_t iwl_dbgfs_power_save_status_read(struct file *file, | |||
2071 | const size_t bufsz = sizeof(buf); | 1860 | const size_t bufsz = sizeof(buf); |
2072 | u32 pwrsave_status; | 1861 | u32 pwrsave_status; |
2073 | 1862 | ||
2074 | pwrsave_status = iwl_read32(trans(priv), CSR_GP_CNTRL) & | 1863 | pwrsave_status = iwl_read32(priv->trans, CSR_GP_CNTRL) & |
2075 | CSR_GP_REG_POWER_SAVE_STATUS_MSK; | 1864 | CSR_GP_REG_POWER_SAVE_STATUS_MSK; |
2076 | 1865 | ||
2077 | pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: "); | 1866 | pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: "); |
@@ -2380,7 +2169,7 @@ static ssize_t iwl_dbgfs_protection_mode_read(struct file *file, | |||
2380 | char buf[40]; | 2169 | char buf[40]; |
2381 | const size_t bufsz = sizeof(buf); | 2170 | const size_t bufsz = sizeof(buf); |
2382 | 2171 | ||
2383 | if (cfg(priv)->ht_params) | 2172 | if (priv->cfg->ht_params) |
2384 | pos += scnprintf(buf + pos, bufsz - pos, | 2173 | pos += scnprintf(buf + pos, bufsz - pos, |
2385 | "use %s for aggregation\n", | 2174 | "use %s for aggregation\n", |
2386 | (priv->hw_params.use_rts_for_aggregation) ? | 2175 | (priv->hw_params.use_rts_for_aggregation) ? |
@@ -2400,7 +2189,7 @@ static ssize_t iwl_dbgfs_protection_mode_write(struct file *file, | |||
2400 | int buf_size; | 2189 | int buf_size; |
2401 | int rts; | 2190 | int rts; |
2402 | 2191 | ||
2403 | if (!cfg(priv)->ht_params) | 2192 | if (!priv->cfg->ht_params) |
2404 | return -EINVAL; | 2193 | return -EINVAL; |
2405 | 2194 | ||
2406 | memset(buf, 0, sizeof(buf)); | 2195 | memset(buf, 0, sizeof(buf)); |
@@ -2416,6 +2205,23 @@ static ssize_t iwl_dbgfs_protection_mode_write(struct file *file, | |||
2416 | return count; | 2205 | return count; |
2417 | } | 2206 | } |
2418 | 2207 | ||
2208 | static int iwl_cmd_echo_test(struct iwl_priv *priv) | ||
2209 | { | ||
2210 | int ret; | ||
2211 | struct iwl_host_cmd cmd = { | ||
2212 | .id = REPLY_ECHO, | ||
2213 | .len = { 0 }, | ||
2214 | .flags = CMD_SYNC, | ||
2215 | }; | ||
2216 | |||
2217 | ret = iwl_dvm_send_cmd(priv, &cmd); | ||
2218 | if (ret) | ||
2219 | IWL_ERR(priv, "echo testing fail: 0X%x\n", ret); | ||
2220 | else | ||
2221 | IWL_DEBUG_INFO(priv, "echo testing pass\n"); | ||
2222 | return ret; | ||
2223 | } | ||
2224 | |||
2419 | static ssize_t iwl_dbgfs_echo_test_write(struct file *file, | 2225 | static ssize_t iwl_dbgfs_echo_test_write(struct file *file, |
2420 | const char __user *user_buf, | 2226 | const char __user *user_buf, |
2421 | size_t count, loff_t *ppos) | 2227 | size_t count, loff_t *ppos) |
@@ -2499,9 +2305,27 @@ static ssize_t iwl_dbgfs_calib_disabled_read(struct file *file, | |||
2499 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 2305 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
2500 | } | 2306 | } |
2501 | 2307 | ||
2502 | DEBUGFS_READ_FILE_OPS(rx_statistics); | 2308 | static ssize_t iwl_dbgfs_calib_disabled_write(struct file *file, |
2503 | DEBUGFS_READ_FILE_OPS(tx_statistics); | 2309 | const char __user *user_buf, |
2504 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); | 2310 | size_t count, loff_t *ppos) |
2311 | { | ||
2312 | struct iwl_priv *priv = file->private_data; | ||
2313 | char buf[8]; | ||
2314 | u32 calib_disabled; | ||
2315 | int buf_size; | ||
2316 | |||
2317 | memset(buf, 0, sizeof(buf)); | ||
2318 | buf_size = min(count, sizeof(buf) - 1); | ||
2319 | if (copy_from_user(buf, user_buf, buf_size)) | ||
2320 | return -EFAULT; | ||
2321 | if (sscanf(buf, "%x", &calib_disabled) != 1) | ||
2322 | return -EFAULT; | ||
2323 | |||
2324 | priv->calib_disabled = calib_disabled; | ||
2325 | |||
2326 | return count; | ||
2327 | } | ||
2328 | |||
2505 | DEBUGFS_READ_FILE_OPS(ucode_rx_stats); | 2329 | DEBUGFS_READ_FILE_OPS(ucode_rx_stats); |
2506 | DEBUGFS_READ_FILE_OPS(ucode_tx_stats); | 2330 | DEBUGFS_READ_FILE_OPS(ucode_tx_stats); |
2507 | DEBUGFS_READ_FILE_OPS(ucode_general_stats); | 2331 | DEBUGFS_READ_FILE_OPS(ucode_general_stats); |
@@ -2509,7 +2333,6 @@ DEBUGFS_READ_FILE_OPS(sensitivity); | |||
2509 | DEBUGFS_READ_FILE_OPS(chain_noise); | 2333 | DEBUGFS_READ_FILE_OPS(chain_noise); |
2510 | DEBUGFS_READ_FILE_OPS(power_save_status); | 2334 | DEBUGFS_READ_FILE_OPS(power_save_status); |
2511 | DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics); | 2335 | DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics); |
2512 | DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics); | ||
2513 | DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing); | 2336 | DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing); |
2514 | DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); | 2337 | DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); |
2515 | DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta); | 2338 | DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta); |
@@ -2523,7 +2346,7 @@ DEBUGFS_READ_WRITE_FILE_OPS(protection_mode); | |||
2523 | DEBUGFS_READ_FILE_OPS(reply_tx_error); | 2346 | DEBUGFS_READ_FILE_OPS(reply_tx_error); |
2524 | DEBUGFS_WRITE_FILE_OPS(echo_test); | 2347 | DEBUGFS_WRITE_FILE_OPS(echo_test); |
2525 | DEBUGFS_READ_WRITE_FILE_OPS(log_event); | 2348 | DEBUGFS_READ_WRITE_FILE_OPS(log_event); |
2526 | DEBUGFS_READ_FILE_OPS(calib_disabled); | 2349 | DEBUGFS_READ_WRITE_FILE_OPS(calib_disabled); |
2527 | 2350 | ||
2528 | /* | 2351 | /* |
2529 | * Create the debugfs files and directories | 2352 | * Create the debugfs files and directories |
@@ -2564,12 +2387,8 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
2564 | DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); | 2387 | DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); |
2565 | DEBUGFS_ADD_FILE(temperature, dir_data, S_IRUSR); | 2388 | DEBUGFS_ADD_FILE(temperature, dir_data, S_IRUSR); |
2566 | 2389 | ||
2567 | DEBUGFS_ADD_FILE(rx_statistics, dir_debug, S_IRUSR); | ||
2568 | DEBUGFS_ADD_FILE(tx_statistics, dir_debug, S_IRUSR); | ||
2569 | DEBUGFS_ADD_FILE(traffic_log, dir_debug, S_IWUSR | S_IRUSR); | ||
2570 | DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); | 2390 | DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); |
2571 | DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR); | 2391 | DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR); |
2572 | DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR); | ||
2573 | DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); | 2392 | DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); |
2574 | DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); | 2393 | DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); |
2575 | DEBUGFS_ADD_FILE(rf_reset, dir_debug, S_IWUSR | S_IRUSR); | 2394 | DEBUGFS_ADD_FILE(rf_reset, dir_debug, S_IWUSR | S_IRUSR); |
@@ -2592,9 +2411,9 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
2592 | DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); | 2411 | DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); |
2593 | 2412 | ||
2594 | /* Calibrations disabled/enabled status*/ | 2413 | /* Calibrations disabled/enabled status*/ |
2595 | DEBUGFS_ADD_FILE(calib_disabled, dir_rf, S_IRUSR); | 2414 | DEBUGFS_ADD_FILE(calib_disabled, dir_rf, S_IWUSR | S_IRUSR); |
2596 | 2415 | ||
2597 | if (iwl_trans_dbgfs_register(trans(priv), dir_debug)) | 2416 | if (iwl_trans_dbgfs_register(priv->trans, dir_debug)) |
2598 | goto err; | 2417 | goto err; |
2599 | return 0; | 2418 | return 0; |
2600 | 2419 | ||