/kern_2.6.32/drivers/net/wireless/iwlwifi/iwl-debugfs.c

http://omnia2droid.googlecode.com/ · C · 1757 lines · 1524 code · 171 blank · 62 comment · 141 complexity · a24c2b1643cc49d63682bd3180c78d3d MD5 · raw file

Large files are truncated click here to view the full file

  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. #include <linux/kernel.h>
  29. #include <linux/module.h>
  30. #include <linux/debugfs.h>
  31. #include <linux/ieee80211.h>
  32. #include <net/mac80211.h>
  33. #include "iwl-dev.h"
  34. #include "iwl-debug.h"
  35. #include "iwl-core.h"
  36. #include "iwl-io.h"
  37. #include "iwl-calib.h"
  38. /* create and remove of files */
  39. #define DEBUGFS_ADD_DIR(name, parent) do { \
  40. dbgfs->dir_##name = debugfs_create_dir(#name, parent); \
  41. if (!(dbgfs->dir_##name)) \
  42. goto err; \
  43. } while (0)
  44. #define DEBUGFS_ADD_FILE(name, parent) do { \
  45. dbgfs->dbgfs_##parent##_files.file_##name = \
  46. debugfs_create_file(#name, S_IWUSR | S_IRUSR, \
  47. dbgfs->dir_##parent, priv, \
  48. &iwl_dbgfs_##name##_ops); \
  49. if (!(dbgfs->dbgfs_##parent##_files.file_##name)) \
  50. goto err; \
  51. } while (0)
  52. #define DEBUGFS_ADD_BOOL(name, parent, ptr) do { \
  53. dbgfs->dbgfs_##parent##_files.file_##name = \
  54. debugfs_create_bool(#name, S_IWUSR | S_IRUSR, \
  55. dbgfs->dir_##parent, ptr); \
  56. if (IS_ERR(dbgfs->dbgfs_##parent##_files.file_##name) \
  57. || !dbgfs->dbgfs_##parent##_files.file_##name) \
  58. goto err; \
  59. } while (0)
  60. #define DEBUGFS_ADD_X32(name, parent, ptr) do { \
  61. dbgfs->dbgfs_##parent##_files.file_##name = \
  62. debugfs_create_x32(#name, S_IRUSR, 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. #define DEBUGFS_REMOVE(name) do { \
  68. debugfs_remove(name); \
  69. name = NULL; \
  70. } while (0);
  71. /* file operation */
  72. #define DEBUGFS_READ_FUNC(name) \
  73. static ssize_t iwl_dbgfs_##name##_read(struct file *file, \
  74. char __user *user_buf, \
  75. size_t count, loff_t *ppos);
  76. #define DEBUGFS_WRITE_FUNC(name) \
  77. static ssize_t iwl_dbgfs_##name##_write(struct file *file, \
  78. const char __user *user_buf, \
  79. size_t count, loff_t *ppos);
  80. static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file)
  81. {
  82. file->private_data = inode->i_private;
  83. return 0;
  84. }
  85. #define DEBUGFS_READ_FILE_OPS(name) \
  86. DEBUGFS_READ_FUNC(name); \
  87. static const struct file_operations iwl_dbgfs_##name##_ops = { \
  88. .read = iwl_dbgfs_##name##_read, \
  89. .open = iwl_dbgfs_open_file_generic, \
  90. };
  91. #define DEBUGFS_WRITE_FILE_OPS(name) \
  92. DEBUGFS_WRITE_FUNC(name); \
  93. static const struct file_operations iwl_dbgfs_##name##_ops = { \
  94. .write = iwl_dbgfs_##name##_write, \
  95. .open = iwl_dbgfs_open_file_generic, \
  96. };
  97. #define DEBUGFS_READ_WRITE_FILE_OPS(name) \
  98. DEBUGFS_READ_FUNC(name); \
  99. DEBUGFS_WRITE_FUNC(name); \
  100. static const struct file_operations iwl_dbgfs_##name##_ops = { \
  101. .write = iwl_dbgfs_##name##_write, \
  102. .read = iwl_dbgfs_##name##_read, \
  103. .open = iwl_dbgfs_open_file_generic, \
  104. };
  105. static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file,
  106. char __user *user_buf,
  107. size_t count, loff_t *ppos) {
  108. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  109. char *buf;
  110. int pos = 0;
  111. int cnt;
  112. ssize_t ret;
  113. const size_t bufsz = 100 + sizeof(char) * 24 * (MANAGEMENT_MAX + CONTROL_MAX);
  114. buf = kzalloc(bufsz, GFP_KERNEL);
  115. if (!buf)
  116. return -ENOMEM;
  117. pos += scnprintf(buf + pos, bufsz - pos, "Management:\n");
  118. for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) {
  119. pos += scnprintf(buf + pos, bufsz - pos,
  120. "\t%s\t\t: %u\n",
  121. get_mgmt_string(cnt),
  122. priv->tx_stats.mgmt[cnt]);
  123. }
  124. pos += scnprintf(buf + pos, bufsz - pos, "Control\n");
  125. for (cnt = 0; cnt < CONTROL_MAX; cnt++) {
  126. pos += scnprintf(buf + pos, bufsz - pos,
  127. "\t%s\t\t: %u\n",
  128. get_ctrl_string(cnt),
  129. priv->tx_stats.ctrl[cnt]);
  130. }
  131. pos += scnprintf(buf + pos, bufsz - pos, "Data:\n");
  132. pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n",
  133. priv->tx_stats.data_cnt);
  134. pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n",
  135. priv->tx_stats.data_bytes);
  136. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  137. kfree(buf);
  138. return ret;
  139. }
  140. static ssize_t iwl_dbgfs_tx_statistics_write(struct file *file,
  141. const char __user *user_buf,
  142. size_t count, loff_t *ppos)
  143. {
  144. struct iwl_priv *priv = file->private_data;
  145. u32 clear_flag;
  146. char buf[8];
  147. int buf_size;
  148. memset(buf, 0, sizeof(buf));
  149. buf_size = min(count, sizeof(buf) - 1);
  150. if (copy_from_user(buf, user_buf, buf_size))
  151. return -EFAULT;
  152. if (sscanf(buf, "%x", &clear_flag) != 1)
  153. return -EFAULT;
  154. if (clear_flag == 1)
  155. iwl_clear_tx_stats(priv);
  156. return count;
  157. }
  158. static ssize_t iwl_dbgfs_rx_statistics_read(struct file *file,
  159. char __user *user_buf,
  160. size_t count, loff_t *ppos) {
  161. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  162. char *buf;
  163. int pos = 0;
  164. int cnt;
  165. ssize_t ret;
  166. const size_t bufsz = 100 +
  167. sizeof(char) * 24 * (MANAGEMENT_MAX + CONTROL_MAX);
  168. buf = kzalloc(bufsz, GFP_KERNEL);
  169. if (!buf)
  170. return -ENOMEM;
  171. pos += scnprintf(buf + pos, bufsz - pos, "Management:\n");
  172. for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) {
  173. pos += scnprintf(buf + pos, bufsz - pos,
  174. "\t%s\t\t: %u\n",
  175. get_mgmt_string(cnt),
  176. priv->rx_stats.mgmt[cnt]);
  177. }
  178. pos += scnprintf(buf + pos, bufsz - pos, "Control:\n");
  179. for (cnt = 0; cnt < CONTROL_MAX; cnt++) {
  180. pos += scnprintf(buf + pos, bufsz - pos,
  181. "\t%s\t\t: %u\n",
  182. get_ctrl_string(cnt),
  183. priv->rx_stats.ctrl[cnt]);
  184. }
  185. pos += scnprintf(buf + pos, bufsz - pos, "Data:\n");
  186. pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n",
  187. priv->rx_stats.data_cnt);
  188. pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n",
  189. priv->rx_stats.data_bytes);
  190. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  191. kfree(buf);
  192. return ret;
  193. }
  194. static ssize_t iwl_dbgfs_rx_statistics_write(struct file *file,
  195. const char __user *user_buf,
  196. size_t count, loff_t *ppos)
  197. {
  198. struct iwl_priv *priv = file->private_data;
  199. u32 clear_flag;
  200. char buf[8];
  201. int buf_size;
  202. memset(buf, 0, sizeof(buf));
  203. buf_size = min(count, sizeof(buf) - 1);
  204. if (copy_from_user(buf, user_buf, buf_size))
  205. return -EFAULT;
  206. if (sscanf(buf, "%x", &clear_flag) != 1)
  207. return -EFAULT;
  208. if (clear_flag == 1)
  209. iwl_clear_rx_stats(priv);
  210. return count;
  211. }
  212. #define BYTE1_MASK 0x000000ff;
  213. #define BYTE2_MASK 0x0000ffff;
  214. #define BYTE3_MASK 0x00ffffff;
  215. static ssize_t iwl_dbgfs_sram_read(struct file *file,
  216. char __user *user_buf,
  217. size_t count, loff_t *ppos)
  218. {
  219. u32 val;
  220. char buf[1024];
  221. ssize_t ret;
  222. int i;
  223. int pos = 0;
  224. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  225. const size_t bufsz = sizeof(buf);
  226. for (i = priv->dbgfs->sram_len; i > 0; i -= 4) {
  227. val = iwl_read_targ_mem(priv, priv->dbgfs->sram_offset + \
  228. priv->dbgfs->sram_len - i);
  229. if (i < 4) {
  230. switch (i) {
  231. case 1:
  232. val &= BYTE1_MASK;
  233. break;
  234. case 2:
  235. val &= BYTE2_MASK;
  236. break;
  237. case 3:
  238. val &= BYTE3_MASK;
  239. break;
  240. }
  241. }
  242. pos += scnprintf(buf + pos, bufsz - pos, "0x%08x ", val);
  243. }
  244. pos += scnprintf(buf + pos, bufsz - pos, "\n");
  245. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  246. return ret;
  247. }
  248. static ssize_t iwl_dbgfs_sram_write(struct file *file,
  249. const char __user *user_buf,
  250. size_t count, loff_t *ppos)
  251. {
  252. struct iwl_priv *priv = file->private_data;
  253. char buf[64];
  254. int buf_size;
  255. u32 offset, len;
  256. memset(buf, 0, sizeof(buf));
  257. buf_size = min(count, sizeof(buf) - 1);
  258. if (copy_from_user(buf, user_buf, buf_size))
  259. return -EFAULT;
  260. if (sscanf(buf, "%x,%x", &offset, &len) == 2) {
  261. priv->dbgfs->sram_offset = offset;
  262. priv->dbgfs->sram_len = len;
  263. } else {
  264. priv->dbgfs->sram_offset = 0;
  265. priv->dbgfs->sram_len = 0;
  266. }
  267. return count;
  268. }
  269. static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
  270. size_t count, loff_t *ppos)
  271. {
  272. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  273. struct iwl_station_entry *station;
  274. int max_sta = priv->hw_params.max_stations;
  275. char *buf;
  276. int i, j, pos = 0;
  277. ssize_t ret;
  278. /* Add 30 for initial string */
  279. const size_t bufsz = 30 + sizeof(char) * 500 * (priv->num_stations);
  280. buf = kmalloc(bufsz, GFP_KERNEL);
  281. if (!buf)
  282. return -ENOMEM;
  283. pos += scnprintf(buf + pos, bufsz - pos, "num of stations: %d\n\n",
  284. priv->num_stations);
  285. for (i = 0; i < max_sta; i++) {
  286. station = &priv->stations[i];
  287. if (station->used) {
  288. pos += scnprintf(buf + pos, bufsz - pos,
  289. "station %d:\ngeneral data:\n", i+1);
  290. pos += scnprintf(buf + pos, bufsz - pos, "id: %u\n",
  291. station->sta.sta.sta_id);
  292. pos += scnprintf(buf + pos, bufsz - pos, "mode: %u\n",
  293. station->sta.mode);
  294. pos += scnprintf(buf + pos, bufsz - pos,
  295. "flags: 0x%x\n",
  296. station->sta.station_flags_msk);
  297. pos += scnprintf(buf + pos, bufsz - pos,
  298. "ps_status: %u\n", station->ps_status);
  299. pos += scnprintf(buf + pos, bufsz - pos, "tid data:\n");
  300. pos += scnprintf(buf + pos, bufsz - pos,
  301. "seq_num\t\ttxq_id");
  302. pos += scnprintf(buf + pos, bufsz - pos,
  303. "\tframe_count\twait_for_ba\t");
  304. pos += scnprintf(buf + pos, bufsz - pos,
  305. "start_idx\tbitmap0\t");
  306. pos += scnprintf(buf + pos, bufsz - pos,
  307. "bitmap1\trate_n_flags");
  308. pos += scnprintf(buf + pos, bufsz - pos, "\n");
  309. for (j = 0; j < MAX_TID_COUNT; j++) {
  310. pos += scnprintf(buf + pos, bufsz - pos,
  311. "[%d]:\t\t%u", j,
  312. station->tid[j].seq_number);
  313. pos += scnprintf(buf + pos, bufsz - pos,
  314. "\t%u\t\t%u\t\t%u\t\t",
  315. station->tid[j].agg.txq_id,
  316. station->tid[j].agg.frame_count,
  317. station->tid[j].agg.wait_for_ba);
  318. pos += scnprintf(buf + pos, bufsz - pos,
  319. "%u\t%llu\t%u",
  320. station->tid[j].agg.start_idx,
  321. (unsigned long long)station->tid[j].agg.bitmap,
  322. station->tid[j].agg.rate_n_flags);
  323. pos += scnprintf(buf + pos, bufsz - pos, "\n");
  324. }
  325. pos += scnprintf(buf + pos, bufsz - pos, "\n");
  326. }
  327. }
  328. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  329. kfree(buf);
  330. return ret;
  331. }
  332. static ssize_t iwl_dbgfs_nvm_read(struct file *file,
  333. char __user *user_buf,
  334. size_t count,
  335. loff_t *ppos)
  336. {
  337. ssize_t ret;
  338. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  339. int pos = 0, ofs = 0, buf_size = 0;
  340. const u8 *ptr;
  341. char *buf;
  342. size_t eeprom_len = priv->cfg->eeprom_size;
  343. buf_size = 4 * eeprom_len + 256;
  344. if (eeprom_len % 16) {
  345. IWL_ERR(priv, "NVM size is not multiple of 16.\n");
  346. return -ENODATA;
  347. }
  348. ptr = priv->eeprom;
  349. if (!ptr) {
  350. IWL_ERR(priv, "Invalid EEPROM/OTP memory\n");
  351. return -ENOMEM;
  352. }
  353. /* 4 characters for byte 0xYY */
  354. buf = kzalloc(buf_size, GFP_KERNEL);
  355. if (!buf) {
  356. IWL_ERR(priv, "Can not allocate Buffer\n");
  357. return -ENOMEM;
  358. }
  359. pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s\n",
  360. (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP)
  361. ? "OTP" : "EEPROM");
  362. for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) {
  363. pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs);
  364. hex_dump_to_buffer(ptr + ofs, 16 , 16, 2, buf + pos,
  365. buf_size - pos, 0);
  366. pos += strlen(buf + pos);
  367. if (buf_size - pos > 0)
  368. buf[pos++] = '\n';
  369. }
  370. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  371. kfree(buf);
  372. return ret;
  373. }
  374. static ssize_t iwl_dbgfs_log_event_write(struct file *file,
  375. const char __user *user_buf,
  376. size_t count, loff_t *ppos)
  377. {
  378. struct iwl_priv *priv = file->private_data;
  379. u32 event_log_flag;
  380. char buf[8];
  381. int buf_size;
  382. memset(buf, 0, sizeof(buf));
  383. buf_size = min(count, sizeof(buf) - 1);
  384. if (copy_from_user(buf, user_buf, buf_size))
  385. return -EFAULT;
  386. if (sscanf(buf, "%d", &event_log_flag) != 1)
  387. return -EFAULT;
  388. if (event_log_flag == 1)
  389. priv->cfg->ops->lib->dump_nic_event_log(priv);
  390. return count;
  391. }
  392. static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
  393. size_t count, loff_t *ppos)
  394. {
  395. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  396. struct ieee80211_channel *channels = NULL;
  397. const struct ieee80211_supported_band *supp_band = NULL;
  398. int pos = 0, i, bufsz = PAGE_SIZE;
  399. char *buf;
  400. ssize_t ret;
  401. if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status))
  402. return -EAGAIN;
  403. buf = kzalloc(bufsz, GFP_KERNEL);
  404. if (!buf) {
  405. IWL_ERR(priv, "Can not allocate Buffer\n");
  406. return -ENOMEM;
  407. }
  408. supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ);
  409. if (supp_band) {
  410. channels = supp_band->channels;
  411. pos += scnprintf(buf + pos, bufsz - pos,
  412. "Displaying %d channels in 2.4GHz band 802.11bg):\n",
  413. supp_band->n_channels);
  414. for (i = 0; i < supp_band->n_channels; i++)
  415. pos += scnprintf(buf + pos, bufsz - pos,
  416. "%d: %ddBm: BSS%s%s, %s.\n",
  417. ieee80211_frequency_to_channel(
  418. channels[i].center_freq),
  419. channels[i].max_power,
  420. channels[i].flags & IEEE80211_CHAN_RADAR ?
  421. " (IEEE 802.11h required)" : "",
  422. ((channels[i].flags & IEEE80211_CHAN_NO_IBSS)
  423. || (channels[i].flags &
  424. IEEE80211_CHAN_RADAR)) ? "" :
  425. ", IBSS",
  426. channels[i].flags &
  427. IEEE80211_CHAN_PASSIVE_SCAN ?
  428. "passive only" : "active/passive");
  429. }
  430. supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ);
  431. if (supp_band) {
  432. channels = supp_band->channels;
  433. pos += scnprintf(buf + pos, bufsz - pos,
  434. "Displaying %d channels in 5.2GHz band (802.11a)\n",
  435. supp_band->n_channels);
  436. for (i = 0; i < supp_band->n_channels; i++)
  437. pos += scnprintf(buf + pos, bufsz - pos,
  438. "%d: %ddBm: BSS%s%s, %s.\n",
  439. ieee80211_frequency_to_channel(
  440. channels[i].center_freq),
  441. channels[i].max_power,
  442. channels[i].flags & IEEE80211_CHAN_RADAR ?
  443. " (IEEE 802.11h required)" : "",
  444. ((channels[i].flags & IEEE80211_CHAN_NO_IBSS)
  445. || (channels[i].flags &
  446. IEEE80211_CHAN_RADAR)) ? "" :
  447. ", IBSS",
  448. channels[i].flags &
  449. IEEE80211_CHAN_PASSIVE_SCAN ?
  450. "passive only" : "active/passive");
  451. }
  452. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  453. kfree(buf);
  454. return ret;
  455. }
  456. static ssize_t iwl_dbgfs_status_read(struct file *file,
  457. char __user *user_buf,
  458. size_t count, loff_t *ppos) {
  459. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  460. char buf[512];
  461. int pos = 0;
  462. const size_t bufsz = sizeof(buf);
  463. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n",
  464. test_bit(STATUS_HCMD_ACTIVE, &priv->status));
  465. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_SYNC_ACTIVE: %d\n",
  466. test_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status));
  467. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n",
  468. test_bit(STATUS_INT_ENABLED, &priv->status));
  469. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n",
  470. test_bit(STATUS_RF_KILL_HW, &priv->status));
  471. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INIT:\t\t %d\n",
  472. test_bit(STATUS_INIT, &priv->status));
  473. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n",
  474. test_bit(STATUS_ALIVE, &priv->status));
  475. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n",
  476. test_bit(STATUS_READY, &priv->status));
  477. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_TEMPERATURE:\t %d\n",
  478. test_bit(STATUS_TEMPERATURE, &priv->status));
  479. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_GEO_CONFIGURED:\t %d\n",
  480. test_bit(STATUS_GEO_CONFIGURED, &priv->status));
  481. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n",
  482. test_bit(STATUS_EXIT_PENDING, &priv->status));
  483. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n",
  484. test_bit(STATUS_STATISTICS, &priv->status));
  485. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n",
  486. test_bit(STATUS_SCANNING, &priv->status));
  487. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_ABORTING:\t %d\n",
  488. test_bit(STATUS_SCAN_ABORTING, &priv->status));
  489. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_HW:\t\t %d\n",
  490. test_bit(STATUS_SCAN_HW, &priv->status));
  491. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_POWER_PMI:\t %d\n",
  492. test_bit(STATUS_POWER_PMI, &priv->status));
  493. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n",
  494. test_bit(STATUS_FW_ERROR, &priv->status));
  495. pos += scnprintf(buf + pos, bufsz - pos, "STATUS_MODE_PENDING:\t %d\n",
  496. test_bit(STATUS_MODE_PENDING, &priv->status));
  497. return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  498. }
  499. static ssize_t iwl_dbgfs_interrupt_read(struct file *file,
  500. char __user *user_buf,
  501. size_t count, loff_t *ppos) {
  502. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  503. int pos = 0;
  504. int cnt = 0;
  505. char *buf;
  506. int bufsz = 24 * 64; /* 24 items * 64 char per item */
  507. ssize_t ret;
  508. buf = kzalloc(bufsz, GFP_KERNEL);
  509. if (!buf) {
  510. IWL_ERR(priv, "Can not allocate Buffer\n");
  511. return -ENOMEM;
  512. }
  513. pos += scnprintf(buf + pos, bufsz - pos,
  514. "Interrupt Statistics Report:\n");
  515. pos += scnprintf(buf + pos, bufsz - pos, "HW Error:\t\t\t %u\n",
  516. priv->isr_stats.hw);
  517. pos += scnprintf(buf + pos, bufsz - pos, "SW Error:\t\t\t %u\n",
  518. priv->isr_stats.sw);
  519. if (priv->isr_stats.sw > 0) {
  520. pos += scnprintf(buf + pos, bufsz - pos,
  521. "\tLast Restarting Code: 0x%X\n",
  522. priv->isr_stats.sw_err);
  523. }
  524. #ifdef CONFIG_IWLWIFI_DEBUG
  525. pos += scnprintf(buf + pos, bufsz - pos, "Frame transmitted:\t\t %u\n",
  526. priv->isr_stats.sch);
  527. pos += scnprintf(buf + pos, bufsz - pos, "Alive interrupt:\t\t %u\n",
  528. priv->isr_stats.alive);
  529. #endif
  530. pos += scnprintf(buf + pos, bufsz - pos,
  531. "HW RF KILL switch toggled:\t %u\n",
  532. priv->isr_stats.rfkill);
  533. pos += scnprintf(buf + pos, bufsz - pos, "CT KILL:\t\t\t %u\n",
  534. priv->isr_stats.ctkill);
  535. pos += scnprintf(buf + pos, bufsz - pos, "Wakeup Interrupt:\t\t %u\n",
  536. priv->isr_stats.wakeup);
  537. pos += scnprintf(buf + pos, bufsz - pos,
  538. "Rx command responses:\t\t %u\n",
  539. priv->isr_stats.rx);
  540. for (cnt = 0; cnt < REPLY_MAX; cnt++) {
  541. if (priv->isr_stats.rx_handlers[cnt] > 0)
  542. pos += scnprintf(buf + pos, bufsz - pos,
  543. "\tRx handler[%36s]:\t\t %u\n",
  544. get_cmd_string(cnt),
  545. priv->isr_stats.rx_handlers[cnt]);
  546. }
  547. pos += scnprintf(buf + pos, bufsz - pos, "Tx/FH interrupt:\t\t %u\n",
  548. priv->isr_stats.tx);
  549. pos += scnprintf(buf + pos, bufsz - pos, "Unexpected INTA:\t\t %u\n",
  550. priv->isr_stats.unhandled);
  551. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  552. kfree(buf);
  553. return ret;
  554. }
  555. static ssize_t iwl_dbgfs_interrupt_write(struct file *file,
  556. const char __user *user_buf,
  557. size_t count, loff_t *ppos)
  558. {
  559. struct iwl_priv *priv = file->private_data;
  560. char buf[8];
  561. int buf_size;
  562. u32 reset_flag;
  563. memset(buf, 0, sizeof(buf));
  564. buf_size = min(count, sizeof(buf) - 1);
  565. if (copy_from_user(buf, user_buf, buf_size))
  566. return -EFAULT;
  567. if (sscanf(buf, "%x", &reset_flag) != 1)
  568. return -EFAULT;
  569. if (reset_flag == 0)
  570. iwl_clear_isr_stats(priv);
  571. return count;
  572. }
  573. static ssize_t iwl_dbgfs_qos_read(struct file *file, char __user *user_buf,
  574. size_t count, loff_t *ppos)
  575. {
  576. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  577. int pos = 0, i;
  578. char buf[256];
  579. const size_t bufsz = sizeof(buf);
  580. ssize_t ret;
  581. for (i = 0; i < AC_NUM; i++) {
  582. pos += scnprintf(buf + pos, bufsz - pos,
  583. "\tcw_min\tcw_max\taifsn\ttxop\n");
  584. pos += scnprintf(buf + pos, bufsz - pos,
  585. "AC[%d]\t%u\t%u\t%u\t%u\n", i,
  586. priv->qos_data.def_qos_parm.ac[i].cw_min,
  587. priv->qos_data.def_qos_parm.ac[i].cw_max,
  588. priv->qos_data.def_qos_parm.ac[i].aifsn,
  589. priv->qos_data.def_qos_parm.ac[i].edca_txop);
  590. }
  591. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  592. return ret;
  593. }
  594. #ifdef CONFIG_IWLWIFI_LEDS
  595. static ssize_t iwl_dbgfs_led_read(struct file *file, char __user *user_buf,
  596. size_t count, loff_t *ppos)
  597. {
  598. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  599. int pos = 0;
  600. char buf[256];
  601. const size_t bufsz = sizeof(buf);
  602. ssize_t ret;
  603. pos += scnprintf(buf + pos, bufsz - pos,
  604. "allow blinking: %s\n",
  605. (priv->allow_blinking) ? "True" : "False");
  606. if (priv->allow_blinking) {
  607. pos += scnprintf(buf + pos, bufsz - pos,
  608. "Led blinking rate: %u\n",
  609. priv->last_blink_rate);
  610. pos += scnprintf(buf + pos, bufsz - pos,
  611. "Last blink time: %lu\n",
  612. priv->last_blink_time);
  613. }
  614. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  615. return ret;
  616. }
  617. #endif
  618. static ssize_t iwl_dbgfs_thermal_throttling_read(struct file *file,
  619. char __user *user_buf,
  620. size_t count, loff_t *ppos)
  621. {
  622. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  623. struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
  624. struct iwl_tt_restriction *restriction;
  625. char buf[100];
  626. int pos = 0;
  627. const size_t bufsz = sizeof(buf);
  628. ssize_t ret;
  629. pos += scnprintf(buf + pos, bufsz - pos,
  630. "Thermal Throttling Mode: %s\n",
  631. tt->advanced_tt ? "Advance" : "Legacy");
  632. pos += scnprintf(buf + pos, bufsz - pos,
  633. "Thermal Throttling State: %d\n",
  634. tt->state);
  635. if (tt->advanced_tt) {
  636. restriction = tt->restriction + tt->state;
  637. pos += scnprintf(buf + pos, bufsz - pos,
  638. "Tx mode: %d\n",
  639. restriction->tx_stream);
  640. pos += scnprintf(buf + pos, bufsz - pos,
  641. "Rx mode: %d\n",
  642. restriction->rx_stream);
  643. pos += scnprintf(buf + pos, bufsz - pos,
  644. "HT mode: %d\n",
  645. restriction->is_ht);
  646. }
  647. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  648. return ret;
  649. }
  650. static ssize_t iwl_dbgfs_disable_ht40_write(struct file *file,
  651. const char __user *user_buf,
  652. size_t count, loff_t *ppos)
  653. {
  654. struct iwl_priv *priv = file->private_data;
  655. char buf[8];
  656. int buf_size;
  657. int ht40;
  658. memset(buf, 0, sizeof(buf));
  659. buf_size = min(count, sizeof(buf) - 1);
  660. if (copy_from_user(buf, user_buf, buf_size))
  661. return -EFAULT;
  662. if (sscanf(buf, "%d", &ht40) != 1)
  663. return -EFAULT;
  664. if (!iwl_is_associated(priv))
  665. priv->disable_ht40 = ht40 ? true : false;
  666. else {
  667. IWL_ERR(priv, "Sta associated with AP - "
  668. "Change to 40MHz channel support is not allowed\n");
  669. return -EINVAL;
  670. }
  671. return count;
  672. }
  673. static ssize_t iwl_dbgfs_disable_ht40_read(struct file *file,
  674. char __user *user_buf,
  675. size_t count, loff_t *ppos)
  676. {
  677. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  678. char buf[100];
  679. int pos = 0;
  680. const size_t bufsz = sizeof(buf);
  681. ssize_t ret;
  682. pos += scnprintf(buf + pos, bufsz - pos,
  683. "11n 40MHz Mode: %s\n",
  684. priv->disable_ht40 ? "Disabled" : "Enabled");
  685. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  686. return ret;
  687. }
  688. static ssize_t iwl_dbgfs_sleep_level_override_write(struct file *file,
  689. const char __user *user_buf,
  690. size_t count, loff_t *ppos)
  691. {
  692. struct iwl_priv *priv = file->private_data;
  693. char buf[8];
  694. int buf_size;
  695. int value;
  696. memset(buf, 0, sizeof(buf));
  697. buf_size = min(count, sizeof(buf) - 1);
  698. if (copy_from_user(buf, user_buf, buf_size))
  699. return -EFAULT;
  700. if (sscanf(buf, "%d", &value) != 1)
  701. return -EINVAL;
  702. /*
  703. * Our users expect 0 to be "CAM", but 0 isn't actually
  704. * valid here. However, let's not confuse them and present
  705. * IWL_POWER_INDEX_1 as "1", not "0".
  706. */
  707. if (value > 0)
  708. value -= 1;
  709. if (value != -1 && (value < 0 || value >= IWL_POWER_NUM))
  710. return -EINVAL;
  711. priv->power_data.debug_sleep_level_override = value;
  712. iwl_power_update_mode(priv, false);
  713. return count;
  714. }
  715. static ssize_t iwl_dbgfs_sleep_level_override_read(struct file *file,
  716. char __user *user_buf,
  717. size_t count, loff_t *ppos)
  718. {
  719. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  720. char buf[10];
  721. int pos, value;
  722. const size_t bufsz = sizeof(buf);
  723. /* see the write function */
  724. value = priv->power_data.debug_sleep_level_override;
  725. if (value >= 0)
  726. value += 1;
  727. pos = scnprintf(buf, bufsz, "%d\n", value);
  728. return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  729. }
  730. static ssize_t iwl_dbgfs_current_sleep_command_read(struct file *file,
  731. char __user *user_buf,
  732. size_t count, loff_t *ppos)
  733. {
  734. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  735. char buf[200];
  736. int pos = 0, i;
  737. const size_t bufsz = sizeof(buf);
  738. struct iwl_powertable_cmd *cmd = &priv->power_data.sleep_cmd;
  739. pos += scnprintf(buf + pos, bufsz - pos,
  740. "flags: %#.2x\n", le16_to_cpu(cmd->flags));
  741. pos += scnprintf(buf + pos, bufsz - pos,
  742. "RX/TX timeout: %d/%d usec\n",
  743. le32_to_cpu(cmd->rx_data_timeout),
  744. le32_to_cpu(cmd->tx_data_timeout));
  745. for (i = 0; i < IWL_POWER_VEC_SIZE; i++)
  746. pos += scnprintf(buf + pos, bufsz - pos,
  747. "sleep_interval[%d]: %d\n", i,
  748. le32_to_cpu(cmd->sleep_interval[i]));
  749. return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  750. }
  751. DEBUGFS_READ_WRITE_FILE_OPS(sram);
  752. DEBUGFS_WRITE_FILE_OPS(log_event);
  753. DEBUGFS_READ_FILE_OPS(nvm);
  754. DEBUGFS_READ_FILE_OPS(stations);
  755. DEBUGFS_READ_FILE_OPS(channels);
  756. DEBUGFS_READ_FILE_OPS(status);
  757. DEBUGFS_READ_WRITE_FILE_OPS(interrupt);
  758. DEBUGFS_READ_FILE_OPS(qos);
  759. #ifdef CONFIG_IWLWIFI_LEDS
  760. DEBUGFS_READ_FILE_OPS(led);
  761. #endif
  762. DEBUGFS_READ_FILE_OPS(thermal_throttling);
  763. DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40);
  764. DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override);
  765. DEBUGFS_READ_FILE_OPS(current_sleep_command);
  766. static ssize_t iwl_dbgfs_traffic_log_read(struct file *file,
  767. char __user *user_buf,
  768. size_t count, loff_t *ppos)
  769. {
  770. struct iwl_priv *priv = file->private_data;
  771. int pos = 0, ofs = 0;
  772. int cnt = 0, entry;
  773. struct iwl_tx_queue *txq;
  774. struct iwl_queue *q;
  775. struct iwl_rx_queue *rxq = &priv->rxq;
  776. char *buf;
  777. int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) +
  778. (IWL_MAX_NUM_QUEUES * 32 * 8) + 400;
  779. const u8 *ptr;
  780. ssize_t ret;
  781. buf = kzalloc(bufsz, GFP_KERNEL);
  782. if (!buf) {
  783. IWL_ERR(priv, "Can not allocate buffer\n");
  784. return -ENOMEM;
  785. }
  786. pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n");
  787. for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) {
  788. txq = &priv->txq[cnt];
  789. q = &txq->q;
  790. pos += scnprintf(buf + pos, bufsz - pos,
  791. "q[%d]: read_ptr: %u, write_ptr: %u\n",
  792. cnt, q->read_ptr, q->write_ptr);
  793. }
  794. if (priv->tx_traffic && (iwl_debug_level & IWL_DL_TX)) {
  795. ptr = priv->tx_traffic;
  796. pos += scnprintf(buf + pos, bufsz - pos,
  797. "Tx Traffic idx: %u\n", priv->tx_traffic_idx);
  798. for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) {
  799. for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16;
  800. entry++, ofs += 16) {
  801. pos += scnprintf(buf + pos, bufsz - pos,
  802. "0x%.4x ", ofs);
  803. hex_dump_to_buffer(ptr + ofs, 16, 16, 2,
  804. buf + pos, bufsz - pos, 0);
  805. pos += strlen(buf + pos);
  806. if (bufsz - pos > 0)
  807. buf[pos++] = '\n';
  808. }
  809. }
  810. }
  811. pos += scnprintf(buf + pos, bufsz - pos, "Rx Queue\n");
  812. pos += scnprintf(buf + pos, bufsz - pos,
  813. "read: %u, write: %u\n",
  814. rxq->read, rxq->write);
  815. if (priv->rx_traffic && (iwl_debug_level & IWL_DL_RX)) {
  816. ptr = priv->rx_traffic;
  817. pos += scnprintf(buf + pos, bufsz - pos,
  818. "Rx Traffic idx: %u\n", priv->rx_traffic_idx);
  819. for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) {
  820. for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16;
  821. entry++, ofs += 16) {
  822. pos += scnprintf(buf + pos, bufsz - pos,
  823. "0x%.4x ", ofs);
  824. hex_dump_to_buffer(ptr + ofs, 16, 16, 2,
  825. buf + pos, bufsz - pos, 0);
  826. pos += strlen(buf + pos);
  827. if (bufsz - pos > 0)
  828. buf[pos++] = '\n';
  829. }
  830. }
  831. }
  832. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  833. kfree(buf);
  834. return ret;
  835. }
  836. static ssize_t iwl_dbgfs_traffic_log_write(struct file *file,
  837. const char __user *user_buf,
  838. size_t count, loff_t *ppos)
  839. {
  840. struct iwl_priv *priv = file->private_data;
  841. char buf[8];
  842. int buf_size;
  843. int traffic_log;
  844. memset(buf, 0, sizeof(buf));
  845. buf_size = min(count, sizeof(buf) - 1);
  846. if (copy_from_user(buf, user_buf, buf_size))
  847. return -EFAULT;
  848. if (sscanf(buf, "%d", &traffic_log) != 1)
  849. return -EFAULT;
  850. if (traffic_log == 0)
  851. iwl_reset_traffic_log(priv);
  852. return count;
  853. }
  854. static ssize_t iwl_dbgfs_tx_queue_read(struct file *file,
  855. char __user *user_buf,
  856. size_t count, loff_t *ppos) {
  857. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  858. struct iwl_tx_queue *txq;
  859. struct iwl_queue *q;
  860. char *buf;
  861. int pos = 0;
  862. int cnt;
  863. int ret;
  864. const size_t bufsz = sizeof(char) * 60 * IWL_MAX_NUM_QUEUES;
  865. buf = kzalloc(bufsz, GFP_KERNEL);
  866. if (!buf)
  867. return -ENOMEM;
  868. for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) {
  869. txq = &priv->txq[cnt];
  870. q = &txq->q;
  871. pos += scnprintf(buf + pos, bufsz - pos,
  872. "hwq %.2d: read=%u write=%u stop=%d"
  873. " swq_id=%#.2x (ac %d/hwq %d)\n",
  874. cnt, q->read_ptr, q->write_ptr,
  875. !!test_bit(cnt, priv->queue_stopped),
  876. txq->swq_id,
  877. txq->swq_id & 0x80 ? txq->swq_id & 3 :
  878. txq->swq_id,
  879. txq->swq_id & 0x80 ? (txq->swq_id >> 2) &
  880. 0x1f : txq->swq_id);
  881. if (cnt >= 4)
  882. continue;
  883. /* for the ACs, display the stop count too */
  884. pos += scnprintf(buf + pos, bufsz - pos,
  885. " stop-count: %d\n",
  886. atomic_read(&priv->queue_stop_count[cnt]));
  887. }
  888. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  889. kfree(buf);
  890. return ret;
  891. }
  892. static ssize_t iwl_dbgfs_rx_queue_read(struct file *file,
  893. char __user *user_buf,
  894. size_t count, loff_t *ppos) {
  895. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  896. struct iwl_rx_queue *rxq = &priv->rxq;
  897. char buf[256];
  898. int pos = 0;
  899. const size_t bufsz = sizeof(buf);
  900. pos += scnprintf(buf + pos, bufsz - pos, "read: %u\n",
  901. rxq->read);
  902. pos += scnprintf(buf + pos, bufsz - pos, "write: %u\n",
  903. rxq->write);
  904. pos += scnprintf(buf + pos, bufsz - pos, "free_count: %u\n",
  905. rxq->free_count);
  906. pos += scnprintf(buf + pos, bufsz - pos, "closed_rb_num: %u\n",
  907. le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF);
  908. return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  909. }
  910. #define UCODE_STATISTICS_CLEAR_MSK (0x1 << 0)
  911. #define UCODE_STATISTICS_FREQUENCY_MSK (0x1 << 1)
  912. #define UCODE_STATISTICS_NARROW_BAND_MSK (0x1 << 2)
  913. static int iwl_dbgfs_statistics_flag(struct iwl_priv *priv, char *buf,
  914. int bufsz)
  915. {
  916. int p = 0;
  917. p += scnprintf(buf + p, bufsz - p,
  918. "Statistics Flag(0x%X):\n",
  919. le32_to_cpu(priv->statistics.flag));
  920. if (le32_to_cpu(priv->statistics.flag) & UCODE_STATISTICS_CLEAR_MSK)
  921. p += scnprintf(buf + p, bufsz - p,
  922. "\tStatistics have been cleared\n");
  923. p += scnprintf(buf + p, bufsz - p,
  924. "\tOperational Frequency: %s\n",
  925. (le32_to_cpu(priv->statistics.flag) &
  926. UCODE_STATISTICS_FREQUENCY_MSK)
  927. ? "2.4 GHz" : "5.2 GHz");
  928. p += scnprintf(buf + p, bufsz - p,
  929. "\tTGj Narrow Band: %s\n",
  930. (le32_to_cpu(priv->statistics.flag) &
  931. UCODE_STATISTICS_NARROW_BAND_MSK)
  932. ? "enabled" : "disabled");
  933. return p;
  934. }
  935. static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file,
  936. char __user *user_buf,
  937. size_t count, loff_t *ppos)
  938. {
  939. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  940. int pos = 0;
  941. char *buf;
  942. int bufsz = sizeof(struct statistics_rx_phy) * 20 +
  943. sizeof(struct statistics_rx_non_phy) * 20 +
  944. sizeof(struct statistics_rx_ht_phy) * 20 + 400;
  945. ssize_t ret;
  946. struct statistics_rx_phy *ofdm;
  947. struct statistics_rx_phy *cck;
  948. struct statistics_rx_non_phy *general;
  949. struct statistics_rx_ht_phy *ht;
  950. if (!iwl_is_alive(priv))
  951. return -EAGAIN;
  952. /* make request to uCode to retrieve statistics information */
  953. mutex_lock(&priv->mutex);
  954. ret = iwl_send_statistics_request(priv, 0);
  955. mutex_unlock(&priv->mutex);
  956. if (ret) {
  957. IWL_ERR(priv,
  958. "Error sending statistics request: %zd\n", ret);
  959. return -EAGAIN;
  960. }
  961. buf = kzalloc(bufsz, GFP_KERNEL);
  962. if (!buf) {
  963. IWL_ERR(priv, "Can not allocate Buffer\n");
  964. return -ENOMEM;
  965. }
  966. /* the statistic information display here is based on
  967. * the last statistics notification from uCode
  968. * might not reflect the current uCode activity
  969. */
  970. ofdm = &priv->statistics.rx.ofdm;
  971. cck = &priv->statistics.rx.cck;
  972. general = &priv->statistics.rx.general;
  973. ht = &priv->statistics.rx.ofdm_ht;
  974. pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
  975. pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM:\n");
  976. pos += scnprintf(buf + pos, bufsz - pos, "ina_cnt: %u\n",
  977. le32_to_cpu(ofdm->ina_cnt));
  978. pos += scnprintf(buf + pos, bufsz - pos, "fina_cnt: %u\n",
  979. le32_to_cpu(ofdm->fina_cnt));
  980. pos += scnprintf(buf + pos, bufsz - pos, "plcp_err: %u\n",
  981. le32_to_cpu(ofdm->plcp_err));
  982. pos += scnprintf(buf + pos, bufsz - pos, "crc32_err: %u\n",
  983. le32_to_cpu(ofdm->crc32_err));
  984. pos += scnprintf(buf + pos, bufsz - pos, "overrun_err: %u\n",
  985. le32_to_cpu(ofdm->overrun_err));
  986. pos += scnprintf(buf + pos, bufsz - pos, "early_overrun_err: %u\n",
  987. le32_to_cpu(ofdm->early_overrun_err));
  988. pos += scnprintf(buf + pos, bufsz - pos, "crc32_good: %u\n",
  989. le32_to_cpu(ofdm->crc32_good));
  990. pos += scnprintf(buf + pos, bufsz - pos, "false_alarm_cnt: %u\n",
  991. le32_to_cpu(ofdm->false_alarm_cnt));
  992. pos += scnprintf(buf + pos, bufsz - pos, "fina_sync_err_cnt: %u\n",
  993. le32_to_cpu(ofdm->fina_sync_err_cnt));
  994. pos += scnprintf(buf + pos, bufsz - pos, "sfd_timeout: %u\n",
  995. le32_to_cpu(ofdm->sfd_timeout));
  996. pos += scnprintf(buf + pos, bufsz - pos, "fina_timeout: %u\n",
  997. le32_to_cpu(ofdm->fina_timeout));
  998. pos += scnprintf(buf + pos, bufsz - pos, "unresponded_rts: %u\n",
  999. le32_to_cpu(ofdm->unresponded_rts));
  1000. pos += scnprintf(buf + pos, bufsz - pos,
  1001. "rxe_frame_limit_overrun: %u\n",
  1002. le32_to_cpu(ofdm->rxe_frame_limit_overrun));
  1003. pos += scnprintf(buf + pos, bufsz - pos, "sent_ack_cnt: %u\n",
  1004. le32_to_cpu(ofdm->sent_ack_cnt));
  1005. pos += scnprintf(buf + pos, bufsz - pos, "sent_cts_cnt: %u\n",
  1006. le32_to_cpu(ofdm->sent_cts_cnt));
  1007. pos += scnprintf(buf + pos, bufsz - pos, "sent_ba_rsp_cnt: %u\n",
  1008. le32_to_cpu(ofdm->sent_ba_rsp_cnt));
  1009. pos += scnprintf(buf + pos, bufsz - pos, "dsp_self_kill: %u\n",
  1010. le32_to_cpu(ofdm->dsp_self_kill));
  1011. pos += scnprintf(buf + pos, bufsz - pos, "mh_format_err: %u\n",
  1012. le32_to_cpu(ofdm->mh_format_err));
  1013. pos += scnprintf(buf + pos, bufsz - pos, "re_acq_main_rssi_sum: %u\n",
  1014. le32_to_cpu(ofdm->re_acq_main_rssi_sum));
  1015. pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - CCK:\n");
  1016. pos += scnprintf(buf + pos, bufsz - pos, "ina_cnt: %u\n",
  1017. le32_to_cpu(cck->ina_cnt));
  1018. pos += scnprintf(buf + pos, bufsz - pos, "fina_cnt: %u\n",
  1019. le32_to_cpu(cck->fina_cnt));
  1020. pos += scnprintf(buf + pos, bufsz - pos, "plcp_err: %u\n",
  1021. le32_to_cpu(cck->plcp_err));
  1022. pos += scnprintf(buf + pos, bufsz - pos, "crc32_err: %u\n",
  1023. le32_to_cpu(cck->crc32_err));
  1024. pos += scnprintf(buf + pos, bufsz - pos, "overrun_err: %u\n",
  1025. le32_to_cpu(cck->overrun_err));
  1026. pos += scnprintf(buf + pos, bufsz - pos, "early_overrun_err: %u\n",
  1027. le32_to_cpu(cck->early_overrun_err));
  1028. pos += scnprintf(buf + pos, bufsz - pos, "crc32_good: %u\n",
  1029. le32_to_cpu(cck->crc32_good));
  1030. pos += scnprintf(buf + pos, bufsz - pos, "false_alarm_cnt: %u\n",
  1031. le32_to_cpu(cck->false_alarm_cnt));
  1032. pos += scnprintf(buf + pos, bufsz - pos, "fina_sync_err_cnt: %u\n",
  1033. le32_to_cpu(cck->fina_sync_err_cnt));
  1034. pos += scnprintf(buf + pos, bufsz - pos, "sfd_timeout: %u\n",
  1035. le32_to_cpu(cck->sfd_timeout));
  1036. pos += scnprintf(buf + pos, bufsz - pos, "fina_timeout: %u\n",
  1037. le32_to_cpu(cck->fina_timeout));
  1038. pos += scnprintf(buf + pos, bufsz - pos, "unresponded_rts: %u\n",
  1039. le32_to_cpu(cck->unresponded_rts));
  1040. pos += scnprintf(buf + pos, bufsz - pos,
  1041. "rxe_frame_limit_overrun: %u\n",
  1042. le32_to_cpu(cck->rxe_frame_limit_overrun));
  1043. pos += scnprintf(buf + pos, bufsz - pos, "sent_ack_cnt: %u\n",
  1044. le32_to_cpu(cck->sent_ack_cnt));
  1045. pos += scnprintf(buf + pos, bufsz - pos, "sent_cts_cnt: %u\n",
  1046. le32_to_cpu(cck->sent_cts_cnt));
  1047. pos += scnprintf(buf + pos, bufsz - pos, "sent_ba_rsp_cnt: %u\n",
  1048. le32_to_cpu(cck->sent_ba_rsp_cnt));
  1049. pos += scnprintf(buf + pos, bufsz - pos, "dsp_self_kill: %u\n",
  1050. le32_to_cpu(cck->dsp_self_kill));
  1051. pos += scnprintf(buf + pos, bufsz - pos, "mh_format_err: %u\n",
  1052. le32_to_cpu(cck->mh_format_err));
  1053. pos += scnprintf(buf + pos, bufsz - pos, "re_acq_main_rssi_sum: %u\n",
  1054. le32_to_cpu(cck->re_acq_main_rssi_sum));
  1055. pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - GENERAL:\n");
  1056. pos += scnprintf(buf + pos, bufsz - pos, "bogus_cts: %u\n",
  1057. le32_to_cpu(general->bogus_cts));
  1058. pos += scnprintf(buf + pos, bufsz - pos, "bogus_ack: %u\n",
  1059. le32_to_cpu(general->bogus_ack));
  1060. pos += scnprintf(buf + pos, bufsz - pos, "non_bssid_frames: %u\n",
  1061. le32_to_cpu(general->non_bssid_frames));
  1062. pos += scnprintf(buf + pos, bufsz - pos, "filtered_frames: %u\n",
  1063. le32_to_cpu(general->filtered_frames));
  1064. pos += scnprintf(buf + pos, bufsz - pos, "non_channel_beacons: %u\n",
  1065. le32_to_cpu(general->non_channel_beacons));
  1066. pos += scnprintf(buf + pos, bufsz - pos, "channel_beacons: %u\n",
  1067. le32_to_cpu(general->channel_beacons));
  1068. pos += scnprintf(buf + pos, bufsz - pos, "num_missed_bcon: %u\n",
  1069. le32_to_cpu(general->num_missed_bcon));
  1070. pos += scnprintf(buf + pos, bufsz - pos,
  1071. "adc_rx_saturation_time: %u\n",
  1072. le32_to_cpu(general->adc_rx_saturation_time));
  1073. pos += scnprintf(buf + pos, bufsz - pos,
  1074. "ina_detection_search_time: %u\n",
  1075. le32_to_cpu(general->ina_detection_search_time));
  1076. pos += scnprintf(buf + pos, bufsz - pos, "beacon_silence_rssi_a: %u\n",
  1077. le32_to_cpu(general->beacon_silence_rssi_a));
  1078. pos += scnprintf(buf + pos, bufsz - pos, "beacon_silence_rssi_b: %u\n",
  1079. le32_to_cpu(general->beacon_silence_rssi_b));
  1080. pos += scnprintf(buf + pos, bufsz - pos, "beacon_silence_rssi_c: %u\n",
  1081. le32_to_cpu(general->beacon_silence_rssi_c));
  1082. pos += scnprintf(buf + pos, bufsz - pos,
  1083. "interference_data_flag: %u\n",
  1084. le32_to_cpu(general->interference_data_flag));
  1085. pos += scnprintf(buf + pos, bufsz - pos, "channel_load: %u\n",
  1086. le32_to_cpu(general->channel_load));
  1087. pos += scnprintf(buf + pos, bufsz - pos, "dsp_false_alarms: %u\n",
  1088. le32_to_cpu(general->dsp_false_alarms));
  1089. pos += scnprintf(buf + pos, bufsz - pos, "beacon_rssi_a: %u\n",
  1090. le32_to_cpu(general->beacon_rssi_a));
  1091. pos += scnprintf(buf + pos, bufsz - pos, "beacon_rssi_b: %u\n",
  1092. le32_to_cpu(general->beacon_rssi_b));
  1093. pos += scnprintf(buf + pos, bufsz - pos, "beacon_rssi_c: %u\n",
  1094. le32_to_cpu(general->beacon_rssi_c));
  1095. pos += scnprintf(buf + pos, bufsz - pos, "beacon_energy_a: %u\n",
  1096. le32_to_cpu(general->beacon_energy_a));
  1097. pos += scnprintf(buf + pos, bufsz - pos, "beacon_energy_b: %u\n",
  1098. le32_to_cpu(general->beacon_energy_b));
  1099. pos += scnprintf(buf + pos, bufsz - pos, "beacon_energy_c: %u\n",
  1100. le32_to_cpu(general->beacon_energy_c));
  1101. pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM_HT:\n");
  1102. pos += scnprintf(buf + pos, bufsz - pos, "plcp_err: %u\n",
  1103. le32_to_cpu(ht->plcp_err));
  1104. pos += scnprintf(buf + pos, bufsz - pos, "overrun_err: %u\n",
  1105. le32_to_cpu(ht->overrun_err));
  1106. pos += scnprintf(buf + pos, bufsz - pos, "early_overrun_err: %u\n",
  1107. le32_to_cpu(ht->early_overrun_err));
  1108. pos += scnprintf(buf + pos, bufsz - pos, "crc32_good: %u\n",
  1109. le32_to_cpu(ht->crc32_good));
  1110. pos += scnprintf(buf + pos, bufsz - pos, "crc32_err: %u\n",
  1111. le32_to_cpu(ht->crc32_err));
  1112. pos += scnprintf(buf + pos, bufsz - pos, "mh_format_err: %u\n",
  1113. le32_to_cpu(ht->mh_format_err));
  1114. pos += scnprintf(buf + pos, bufsz - pos, "agg_crc32_good: %u\n",
  1115. le32_to_cpu(ht->agg_crc32_good));
  1116. pos += scnprintf(buf + pos, bufsz - pos, "agg_mpdu_cnt: %u\n",
  1117. le32_to_cpu(ht->agg_mpdu_cnt));
  1118. pos += scnprintf(buf + pos, bufsz - pos, "agg_cnt: %u\n",
  1119. le32_to_cpu(ht->agg_cnt));
  1120. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  1121. kfree(buf);
  1122. return ret;
  1123. }
  1124. static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
  1125. char __user *user_buf,
  1126. size_t count, loff_t *ppos)
  1127. {
  1128. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  1129. int pos = 0;
  1130. char *buf;
  1131. int bufsz = (sizeof(struct statistics_tx) * 24) + 250;
  1132. ssize_t ret;
  1133. struct statistics_tx *tx;
  1134. if (!iwl_is_alive(priv))
  1135. return -EAGAIN;
  1136. /* make request to uCode to retrieve statistics information */
  1137. mutex_lock(&priv->mutex);
  1138. ret = iwl_send_statistics_request(priv, 0);
  1139. mutex_unlock(&priv->mutex);
  1140. if (ret) {
  1141. IWL_ERR(priv,
  1142. "Error sending statistics request: %zd\n", ret);
  1143. return -EAGAIN;
  1144. }
  1145. buf = kzalloc(bufsz, GFP_KERNEL);
  1146. if (!buf) {
  1147. IWL_ERR(priv, "Can not allocate Buffer\n");
  1148. return -ENOMEM;
  1149. }
  1150. /* the statistic information display here is based on
  1151. * the last statistics notification from uCode
  1152. * might not reflect the current uCode activity
  1153. */
  1154. tx = &priv->statistics.tx;
  1155. pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
  1156. pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Tx:\n");
  1157. pos += scnprintf(buf + pos, bufsz - pos, "preamble: %u\n",
  1158. le32_to_cpu(tx->preamble_cnt));
  1159. pos += scnprintf(buf + pos, bufsz - pos, "rx_detected_cnt: %u\n",
  1160. le32_to_cpu(tx->rx_detected_cnt));
  1161. pos += scnprintf(buf + pos, bufsz - pos, "bt_prio_defer_cnt: %u\n",
  1162. le32_to_cpu(tx->bt_prio_defer_cnt));
  1163. pos += scnprintf(buf + pos, bufsz - pos, "bt_prio_kill_cnt: %u\n",
  1164. le32_to_cpu(tx->bt_prio_kill_cnt));
  1165. pos += scnprintf(buf + pos, bufsz - pos, "few_bytes_cnt: %u\n",
  1166. le32_to_cpu(tx->few_bytes_cnt));
  1167. pos += scnprintf(buf + pos, bufsz - pos, "cts_timeout: %u\n",
  1168. le32_to_cpu(tx->cts_timeout));
  1169. pos += scnprintf(buf + pos, bufsz - pos, "ack_timeout: %u\n",
  1170. le32_to_cpu(tx->ack_timeout));
  1171. pos += scnprintf(buf + pos, bufsz - pos, "expected_ack_cnt: %u\n",
  1172. le32_to_cpu(tx->expected_ack_cnt));
  1173. pos += scnprintf(buf + pos, bufsz - pos, "actual_ack_cnt: %u\n",
  1174. le32_to_cpu(tx->actual_ack_cnt));
  1175. pos += scnprintf(buf + pos, bufsz - pos, "dump_msdu_cnt: %u\n",
  1176. le32_to_cpu(tx->dump_msdu_cnt));
  1177. pos += scnprintf(buf + pos, bufsz - pos,
  1178. "burst_abort_next_frame_mismatch_cnt: %u\n",
  1179. le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt));
  1180. pos += scnprintf(buf + pos, bufsz - pos,
  1181. "burst_abort_missing_next_frame_cnt: %u\n",
  1182. le32_to_cpu(tx->burst_abort_missing_next_frame_cnt));
  1183. pos += scnprintf(buf + pos, bufsz - pos, "cts_timeout_collision: %u\n",
  1184. le32_to_cpu(tx->cts_timeout_collision));
  1185. pos += scnprintf(buf + pos, bufsz - pos,
  1186. "ack_or_ba_timeout_collision: %u\n",
  1187. le32_to_cpu(tx->ack_or_ba_timeout_collision));
  1188. pos += scnprintf(buf + pos, bufsz - pos, "agg ba_timeout: %u\n",
  1189. le32_to_cpu(tx->agg.ba_timeout));
  1190. pos += scnprintf(buf + pos, bufsz - pos,
  1191. "agg ba_reschedule_frames: %u\n",
  1192. le32_to_cpu(tx->agg.ba_reschedule_frames));
  1193. pos += scnprintf(buf + pos, bufsz - pos,
  1194. "agg scd_query_agg_frame_cnt: %u\n",
  1195. le32_to_cpu(tx->agg.scd_query_agg_frame_cnt));
  1196. pos += scnprintf(buf + pos, bufsz - pos, "agg scd_query_no_agg: %u\n",
  1197. le32_to_cpu(tx->agg.scd_query_no_agg));
  1198. pos += scnprintf(buf + pos, bufsz - pos, "agg scd_query_agg: %u\n",
  1199. le32_to_cpu(tx->agg.scd_query_agg));
  1200. pos += scnprintf(buf + pos, bufsz - pos,
  1201. "agg scd_query_mismatch: %u\n",
  1202. le32_to_cpu(tx->agg.scd_query_mismatch));
  1203. pos += scnprintf(buf + pos, bufsz - pos, "agg frame_not_ready: %u\n",
  1204. le32_to_cpu(tx->agg.frame_not_ready));
  1205. pos += scnprintf(buf + pos, bufsz - pos, "agg underrun: %u\n",
  1206. le32_to_cpu(tx->agg.underrun));
  1207. pos += scnprintf(buf + pos, bufsz - pos, "agg bt_prio_kill: %u\n",
  1208. le32_to_cpu(tx->agg.bt_prio_kill));
  1209. pos += scnprintf(buf + pos, bufsz - pos, "agg rx_ba_rsp_cnt: %u\n",
  1210. le32_to_cpu(tx->agg.rx_ba_rsp_cnt));
  1211. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  1212. kfree(buf);
  1213. return ret;
  1214. }
  1215. static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
  1216. char __user *user_buf,
  1217. size_t count, loff_t *ppos)
  1218. {
  1219. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  1220. int pos = 0;
  1221. char *buf;
  1222. int bufsz = sizeof(struct statistics_general) * 4 + 250;
  1223. ssize_t ret;
  1224. struct statistics_general *general;
  1225. struct statistics_dbg *dbg;
  1226. struct statistics_div *div;
  1227. if (!iwl_is_alive(priv))
  1228. return -EAGAIN;
  1229. /* make request to uCode to retrieve statistics information */
  1230. mutex_lock(&priv->mutex);
  1231. ret = iwl_send_statistics_request(priv, 0);
  1232. mutex_unlock(&priv->mutex);
  1233. if (ret) {
  1234. IWL_ERR(priv,
  1235. "Error sending statistics request: %zd\n", ret);
  1236. return -EAGAIN;
  1237. }
  1238. buf = kzalloc(bufsz, GFP_KERNEL);
  1239. if (!buf) {
  1240. IWL_ERR(priv, "Can not allocate Buffer\n");
  1241. return -ENOMEM;
  1242. }
  1243. /* the statistic information display here is based on
  1244. * the last statistics notification from uCode
  1245. * might not reflect the current uCode activity
  1246. */
  1247. general = &priv->statistics.general;
  1248. dbg = &priv->statistics.general.dbg;
  1249. div = &priv->statistics.general.div;
  1250. pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
  1251. pos += scnprintf(buf + pos, bufsz - pos, "Statistics_General:\n");
  1252. pos += scnprintf(buf + pos, bufsz - pos, "temperature: %u\n",
  1253. le32_to_cpu(general->temperature));
  1254. pos += scnprintf(buf + pos, bufsz - pos, "temperature_m: %u\n",
  1255. le32_to_cpu(general->temperature_m));
  1256. pos += scnprintf(buf + pos, bufsz - pos, "burst_check: %u\n",
  1257. le32_to_cpu(dbg->burst_check));
  1258. pos += scnprintf(buf + pos, bufsz - pos, "burst_count: %u\n",
  1259. le32_to_cpu(dbg->burst_count));
  1260. pos += scnprintf(buf + pos, bufsz - pos, "sleep_time: %u\n",
  1261. le32_to_cpu(general->sleep_time));
  1262. pos += scnprintf(buf + pos, bufsz - pos, "slots_out: %u\n",
  1263. le32_to_cpu(general->slots_out));
  1264. pos += scnprintf(buf + pos, bufsz - pos, "slots_idle: %u\n",
  1265. le32_to_cpu(general->slots_idle));
  1266. pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp: %u\n",
  1267. le32_to_cpu(general->ttl_timestamp));
  1268. pos += scnprintf(buf + pos, bufsz - pos, "tx_on_a: %u\n",
  1269. le32_to_cpu(div->tx_on_a));
  1270. pos += scnprintf(buf + pos, bufsz - pos, "tx_on_b: %u\n",
  1271. le32_to_cpu(div->tx_on_b));
  1272. pos += scnprintf(buf + pos, bufsz - pos, "exec_time: %u\n",
  1273. le32_to_cpu(div->exec_time));
  1274. pos += scnprintf(buf + pos, bufsz - pos, "probe_time: %u\n",
  1275. le32_to_cpu(div->probe_time));
  1276. pos += scnprintf(buf + pos, bufsz - pos, "rx_enable_counter: %u\n",
  1277. le32_to_cpu(general->rx_enable_counter));
  1278. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  1279. kfree(buf);
  1280. return ret;
  1281. }
  1282. static ssize_t iwl_dbgfs_sensitivity_read(struct file *file,
  1283. char __user *user_buf,
  1284. size_t count, loff_t *ppos) {
  1285. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  1286. int pos = 0;
  1287. int cnt = 0;
  1288. char *buf;
  1289. int bufsz = sizeof(struct iwl_sensitivity_data) * 4 + 100;
  1290. ssize_t ret;
  1291. struct iwl_sensitivity_data *data;
  1292. data = &priv->sensitivity_data;
  1293. buf = kzalloc(bufsz, GFP_KERNEL);
  1294. if (!buf) {
  1295. IWL_ERR(priv, "Can not allocate Buffer\n");
  1296. return -ENOMEM;
  1297. }
  1298. pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm:\t\t\t %u\n",
  1299. data->auto_corr_ofdm);
  1300. pos += scnprintf(buf + pos, bufsz - pos,
  1301. "auto_corr_ofdm_mrc:\t\t %u\n",
  1302. data->auto_corr_ofdm_mrc);
  1303. pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm_x1:\t\t %u\n",
  1304. data->auto_corr_ofdm_x1);
  1305. pos += scnprintf(buf + pos, bufsz - pos,
  1306. "auto_corr_ofdm_mrc_x1:\t\t %u\n",
  1307. data->auto_corr_ofdm_mrc_x1);
  1308. pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_cck:\t\t\t %u\n",
  1309. data->auto_corr_cck);
  1310. pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_cck_mrc:\t\t %u\n",
  1311. data->auto_corr_cck_mrc);
  1312. pos += scnprintf(buf + pos, bufsz - pos,
  1313. "last_bad_plcp_cnt_ofdm:\t\t %u\n",
  1314. data->last_bad_plcp_cnt_ofdm);
  1315. pos += scnprintf(buf + pos, bufsz - pos, "last_fa_cnt_ofdm:\t\t %u\n",
  1316. data->last_fa_cnt_ofdm);
  1317. pos += scnprintf(buf + pos, bufsz - pos,
  1318. "last_bad_plcp_cnt_cck:\t\t %u\n",
  1319. data->last_bad_plcp_cnt_cck);
  1320. pos += scnprintf(buf + pos, bufsz - pos, "last_fa_cnt_cck:\t\t %u\n",
  1321. data->last_fa_cnt_cck);
  1322. pos += scnprintf(buf + pos, bufsz - pos, "nrg_curr_state:\t\t\t %u\n",
  1323. data->nrg_curr_state);
  1324. pos += scnprintf(buf + pos, bufsz - pos, "nrg_prev_state:\t\t\t %u\n",
  1325. data->nrg_prev_state);
  1326. pos += scnprintf(buf + pos, bufsz - pos, "nrg_value:\t\t\t");
  1327. for (cnt = 0; cnt < 10; cnt++) {
  1328. pos += scnprintf(buf + pos, bufsz - pos, " %u",
  1329. data->nrg_value[cnt]);
  1330. }
  1331. pos += scnprintf(buf + pos, bufsz - pos, "\n");
  1332. pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_rssi:\t\t");
  1333. for (cnt = 0; cnt < NRG_NUM_PREV_STAT_L; cnt++) {
  1334. pos += scnprintf(buf + pos, bufsz - pos, " %u",
  1335. data->nrg_silence_rssi[cnt]);
  1336. }
  1337. pos += scnprintf(buf + pos, bufsz - pos, "\n");
  1338. pos += scnprintf(buf + pos, bufsz - pos, "nrg_silen…