iwl-agn-debugfs.c 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834
  1. /******************************************************************************
  2. *
  3. * GPL LICENSE SUMMARY
  4. *
  5. * Copyright(c) 2008 - 2010 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 "iwl-agn-debugfs.h"
  29. ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf,
  30. size_t count, loff_t *ppos)
  31. {
  32. struct iwl_priv *priv = file->private_data;
  33. int pos = 0;
  34. char *buf;
  35. int bufsz = sizeof(struct statistics_rx_phy) * 40 +
  36. sizeof(struct statistics_rx_non_phy) * 40 +
  37. sizeof(struct statistics_rx_ht_phy) * 40 + 400;
  38. ssize_t ret;
  39. struct statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm;
  40. struct statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
  41. struct statistics_rx_non_phy *general, *accum_general;
  42. struct statistics_rx_non_phy *delta_general, *max_general;
  43. struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;
  44. if (!iwl_is_alive(priv))
  45. return -EAGAIN;
  46. buf = kzalloc(bufsz, GFP_KERNEL);
  47. if (!buf) {
  48. IWL_ERR(priv, "Can not allocate Buffer\n");
  49. return -ENOMEM;
  50. }
  51. /*
  52. * the statistic information display here is based on
  53. * the last statistics notification from uCode
  54. * might not reflect the current uCode activity
  55. */
  56. ofdm = &priv->statistics.rx.ofdm;
  57. cck = &priv->statistics.rx.cck;
  58. general = &priv->statistics.rx.general;
  59. ht = &priv->statistics.rx.ofdm_ht;
  60. accum_ofdm = &priv->accum_statistics.rx.ofdm;
  61. accum_cck = &priv->accum_statistics.rx.cck;
  62. accum_general = &priv->accum_statistics.rx.general;
  63. accum_ht = &priv->accum_statistics.rx.ofdm_ht;
  64. delta_ofdm = &priv->delta_statistics.rx.ofdm;
  65. delta_cck = &priv->delta_statistics.rx.cck;
  66. delta_general = &priv->delta_statistics.rx.general;
  67. delta_ht = &priv->delta_statistics.rx.ofdm_ht;
  68. max_ofdm = &priv->max_delta.rx.ofdm;
  69. max_cck = &priv->max_delta.rx.cck;
  70. max_general = &priv->max_delta.rx.general;
  71. max_ht = &priv->max_delta.rx.ofdm_ht;
  72. pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
  73. pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
  74. "acumulative delta max\n",
  75. "Statistics_Rx - OFDM:");
  76. pos += scnprintf(buf + pos, bufsz - pos,
  77. " %-30s %10u %10u %10u %10u\n",
  78. "ina_cnt:", le32_to_cpu(ofdm->ina_cnt),
  79. accum_ofdm->ina_cnt,
  80. delta_ofdm->ina_cnt, max_ofdm->ina_cnt);
  81. pos += scnprintf(buf + pos, bufsz - pos,
  82. " %-30s %10u %10u %10u %10u\n",
  83. "fina_cnt:",
  84. le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt,
  85. delta_ofdm->fina_cnt, max_ofdm->fina_cnt);
  86. pos += scnprintf(buf + pos, bufsz - pos,
  87. " %-30s %10u %10u %10u %10u\n",
  88. "plcp_err:",
  89. le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err,
  90. delta_ofdm->plcp_err, max_ofdm->plcp_err);
  91. pos += scnprintf(buf + pos, bufsz - pos,
  92. " %-30s %10u %10u %10u %10u\n", "crc32_err:",
  93. le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err,
  94. delta_ofdm->crc32_err, max_ofdm->crc32_err);
  95. pos += scnprintf(buf + pos, bufsz - pos,
  96. " %-30s %10u %10u %10u %10u\n", "overrun_err:",
  97. le32_to_cpu(ofdm->overrun_err),
  98. accum_ofdm->overrun_err, delta_ofdm->overrun_err,
  99. max_ofdm->overrun_err);
  100. pos += scnprintf(buf + pos, bufsz - pos,
  101. " %-30s %10u %10u %10u %10u\n",
  102. "early_overrun_err:",
  103. le32_to_cpu(ofdm->early_overrun_err),
  104. accum_ofdm->early_overrun_err,
  105. delta_ofdm->early_overrun_err,
  106. max_ofdm->early_overrun_err);
  107. pos += scnprintf(buf + pos, bufsz - pos,
  108. " %-30s %10u %10u %10u %10u\n",
  109. "crc32_good:", le32_to_cpu(ofdm->crc32_good),
  110. accum_ofdm->crc32_good, delta_ofdm->crc32_good,
  111. max_ofdm->crc32_good);
  112. pos += scnprintf(buf + pos, bufsz - pos,
  113. " %-30s %10u %10u %10u %10u\n", "false_alarm_cnt:",
  114. le32_to_cpu(ofdm->false_alarm_cnt),
  115. accum_ofdm->false_alarm_cnt,
  116. delta_ofdm->false_alarm_cnt,
  117. max_ofdm->false_alarm_cnt);
  118. pos += scnprintf(buf + pos, bufsz - pos,
  119. " %-30s %10u %10u %10u %10u\n",
  120. "fina_sync_err_cnt:",
  121. le32_to_cpu(ofdm->fina_sync_err_cnt),
  122. accum_ofdm->fina_sync_err_cnt,
  123. delta_ofdm->fina_sync_err_cnt,
  124. max_ofdm->fina_sync_err_cnt);
  125. pos += scnprintf(buf + pos, bufsz - pos,
  126. " %-30s %10u %10u %10u %10u\n", "sfd_timeout:",
  127. le32_to_cpu(ofdm->sfd_timeout),
  128. accum_ofdm->sfd_timeout, delta_ofdm->sfd_timeout,
  129. max_ofdm->sfd_timeout);
  130. pos += scnprintf(buf + pos, bufsz - pos,
  131. " %-30s %10u %10u %10u %10u\n", "fina_timeout:",
  132. le32_to_cpu(ofdm->fina_timeout),
  133. accum_ofdm->fina_timeout, delta_ofdm->fina_timeout,
  134. max_ofdm->fina_timeout);
  135. pos += scnprintf(buf + pos, bufsz - pos,
  136. " %-30s %10u %10u %10u %10u\n",
  137. "unresponded_rts:",
  138. le32_to_cpu(ofdm->unresponded_rts),
  139. accum_ofdm->unresponded_rts,
  140. delta_ofdm->unresponded_rts,
  141. max_ofdm->unresponded_rts);
  142. pos += scnprintf(buf + pos, bufsz - pos,
  143. " %-30s %10u %10u %10u %10u\n",
  144. "rxe_frame_lmt_ovrun:",
  145. le32_to_cpu(ofdm->rxe_frame_limit_overrun),
  146. accum_ofdm->rxe_frame_limit_overrun,
  147. delta_ofdm->rxe_frame_limit_overrun,
  148. max_ofdm->rxe_frame_limit_overrun);
  149. pos += scnprintf(buf + pos, bufsz - pos,
  150. " %-30s %10u %10u %10u %10u\n", "sent_ack_cnt:",
  151. le32_to_cpu(ofdm->sent_ack_cnt),
  152. accum_ofdm->sent_ack_cnt, delta_ofdm->sent_ack_cnt,
  153. max_ofdm->sent_ack_cnt);
  154. pos += scnprintf(buf + pos, bufsz - pos,
  155. " %-30s %10u %10u %10u %10u\n", "sent_cts_cnt:",
  156. le32_to_cpu(ofdm->sent_cts_cnt),
  157. accum_ofdm->sent_cts_cnt, delta_ofdm->sent_cts_cnt,
  158. max_ofdm->sent_cts_cnt);
  159. pos += scnprintf(buf + pos, bufsz - pos,
  160. " %-30s %10u %10u %10u %10u\n",
  161. "sent_ba_rsp_cnt:",
  162. le32_to_cpu(ofdm->sent_ba_rsp_cnt),
  163. accum_ofdm->sent_ba_rsp_cnt,
  164. delta_ofdm->sent_ba_rsp_cnt,
  165. max_ofdm->sent_ba_rsp_cnt);
  166. pos += scnprintf(buf + pos, bufsz - pos,
  167. " %-30s %10u %10u %10u %10u\n", "dsp_self_kill:",
  168. le32_to_cpu(ofdm->dsp_self_kill),
  169. accum_ofdm->dsp_self_kill,
  170. delta_ofdm->dsp_self_kill,
  171. max_ofdm->dsp_self_kill);
  172. pos += scnprintf(buf + pos, bufsz - pos,
  173. " %-30s %10u %10u %10u %10u\n",
  174. "mh_format_err:",
  175. le32_to_cpu(ofdm->mh_format_err),
  176. accum_ofdm->mh_format_err,
  177. delta_ofdm->mh_format_err,
  178. max_ofdm->mh_format_err);
  179. pos += scnprintf(buf + pos, bufsz - pos,
  180. " %-30s %10u %10u %10u %10u\n",
  181. "re_acq_main_rssi_sum:",
  182. le32_to_cpu(ofdm->re_acq_main_rssi_sum),
  183. accum_ofdm->re_acq_main_rssi_sum,
  184. delta_ofdm->re_acq_main_rssi_sum,
  185. max_ofdm->re_acq_main_rssi_sum);
  186. pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
  187. "acumulative delta max\n",
  188. "Statistics_Rx - CCK:");
  189. pos += scnprintf(buf + pos, bufsz - pos,
  190. " %-30s %10u %10u %10u %10u\n",
  191. "ina_cnt:",
  192. le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt,
  193. delta_cck->ina_cnt, max_cck->ina_cnt);
  194. pos += scnprintf(buf + pos, bufsz - pos,
  195. " %-30s %10u %10u %10u %10u\n",
  196. "fina_cnt:",
  197. le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt,
  198. delta_cck->fina_cnt, max_cck->fina_cnt);
  199. pos += scnprintf(buf + pos, bufsz - pos,
  200. " %-30s %10u %10u %10u %10u\n",
  201. "plcp_err:",
  202. le32_to_cpu(cck->plcp_err), accum_cck->plcp_err,
  203. delta_cck->plcp_err, max_cck->plcp_err);
  204. pos += scnprintf(buf + pos, bufsz - pos,
  205. " %-30s %10u %10u %10u %10u\n",
  206. "crc32_err:",
  207. le32_to_cpu(cck->crc32_err), accum_cck->crc32_err,
  208. delta_cck->crc32_err, max_cck->crc32_err);
  209. pos += scnprintf(buf + pos, bufsz - pos,
  210. " %-30s %10u %10u %10u %10u\n",
  211. "overrun_err:",
  212. le32_to_cpu(cck->overrun_err),
  213. accum_cck->overrun_err, delta_cck->overrun_err,
  214. max_cck->overrun_err);
  215. pos += scnprintf(buf + pos, bufsz - pos,
  216. " %-30s %10u %10u %10u %10u\n",
  217. "early_overrun_err:",
  218. le32_to_cpu(cck->early_overrun_err),
  219. accum_cck->early_overrun_err,
  220. delta_cck->early_overrun_err,
  221. max_cck->early_overrun_err);
  222. pos += scnprintf(buf + pos, bufsz - pos,
  223. " %-30s %10u %10u %10u %10u\n",
  224. "crc32_good:",
  225. le32_to_cpu(cck->crc32_good), accum_cck->crc32_good,
  226. delta_cck->crc32_good, max_cck->crc32_good);
  227. pos += scnprintf(buf + pos, bufsz - pos,
  228. " %-30s %10u %10u %10u %10u\n",
  229. "false_alarm_cnt:",
  230. le32_to_cpu(cck->false_alarm_cnt),
  231. accum_cck->false_alarm_cnt,
  232. delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt);
  233. pos += scnprintf(buf + pos, bufsz - pos,
  234. " %-30s %10u %10u %10u %10u\n",
  235. "fina_sync_err_cnt:",
  236. le32_to_cpu(cck->fina_sync_err_cnt),
  237. accum_cck->fina_sync_err_cnt,
  238. delta_cck->fina_sync_err_cnt,
  239. max_cck->fina_sync_err_cnt);
  240. pos += scnprintf(buf + pos, bufsz - pos,
  241. " %-30s %10u %10u %10u %10u\n",
  242. "sfd_timeout:",
  243. le32_to_cpu(cck->sfd_timeout),
  244. accum_cck->sfd_timeout, delta_cck->sfd_timeout,
  245. max_cck->sfd_timeout);
  246. pos += scnprintf(buf + pos, bufsz - pos,
  247. " %-30s %10u %10u %10u %10u\n", "fina_timeout:",
  248. le32_to_cpu(cck->fina_timeout),
  249. accum_cck->fina_timeout, delta_cck->fina_timeout,
  250. max_cck->fina_timeout);
  251. pos += scnprintf(buf + pos, bufsz - pos,
  252. " %-30s %10u %10u %10u %10u\n",
  253. "unresponded_rts:",
  254. le32_to_cpu(cck->unresponded_rts),
  255. accum_cck->unresponded_rts, delta_cck->unresponded_rts,
  256. max_cck->unresponded_rts);
  257. pos += scnprintf(buf + pos, bufsz - pos,
  258. " %-30s %10u %10u %10u %10u\n",
  259. "rxe_frame_lmt_ovrun:",
  260. le32_to_cpu(cck->rxe_frame_limit_overrun),
  261. accum_cck->rxe_frame_limit_overrun,
  262. delta_cck->rxe_frame_limit_overrun,
  263. max_cck->rxe_frame_limit_overrun);
  264. pos += scnprintf(buf + pos, bufsz - pos,
  265. " %-30s %10u %10u %10u %10u\n", "sent_ack_cnt:",
  266. le32_to_cpu(cck->sent_ack_cnt),
  267. accum_cck->sent_ack_cnt, delta_cck->sent_ack_cnt,
  268. max_cck->sent_ack_cnt);
  269. pos += scnprintf(buf + pos, bufsz - pos,
  270. " %-30s %10u %10u %10u %10u\n", "sent_cts_cnt:",
  271. le32_to_cpu(cck->sent_cts_cnt),
  272. accum_cck->sent_cts_cnt, delta_cck->sent_cts_cnt,
  273. max_cck->sent_cts_cnt);
  274. pos += scnprintf(buf + pos, bufsz - pos,
  275. " %-30s %10u %10u %10u %10u\n", "sent_ba_rsp_cnt:",
  276. le32_to_cpu(cck->sent_ba_rsp_cnt),
  277. accum_cck->sent_ba_rsp_cnt,
  278. delta_cck->sent_ba_rsp_cnt,
  279. max_cck->sent_ba_rsp_cnt);
  280. pos += scnprintf(buf + pos, bufsz - pos,
  281. " %-30s %10u %10u %10u %10u\n", "dsp_self_kill:",
  282. le32_to_cpu(cck->dsp_self_kill),
  283. accum_cck->dsp_self_kill, delta_cck->dsp_self_kill,
  284. max_cck->dsp_self_kill);
  285. pos += scnprintf(buf + pos, bufsz - pos,
  286. " %-30s %10u %10u %10u %10u\n", "mh_format_err:",
  287. le32_to_cpu(cck->mh_format_err),
  288. accum_cck->mh_format_err, delta_cck->mh_format_err,
  289. max_cck->mh_format_err);
  290. pos += scnprintf(buf + pos, bufsz - pos,
  291. " %-30s %10u %10u %10u %10u\n",
  292. "re_acq_main_rssi_sum:",
  293. le32_to_cpu(cck->re_acq_main_rssi_sum),
  294. accum_cck->re_acq_main_rssi_sum,
  295. delta_cck->re_acq_main_rssi_sum,
  296. max_cck->re_acq_main_rssi_sum);
  297. pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
  298. "acumulative delta max\n",
  299. "Statistics_Rx - GENERAL:");
  300. pos += scnprintf(buf + pos, bufsz - pos,
  301. " %-30s %10u %10u %10u %10u\n", "bogus_cts:",
  302. le32_to_cpu(general->bogus_cts),
  303. accum_general->bogus_cts, delta_general->bogus_cts,
  304. max_general->bogus_cts);
  305. pos += scnprintf(buf + pos, bufsz - pos,
  306. " %-30s %10u %10u %10u %10u\n", "bogus_ack:",
  307. le32_to_cpu(general->bogus_ack),
  308. accum_general->bogus_ack, delta_general->bogus_ack,
  309. max_general->bogus_ack);
  310. pos += scnprintf(buf + pos, bufsz - pos,
  311. " %-30s %10u %10u %10u %10u\n",
  312. "non_bssid_frames:",
  313. le32_to_cpu(general->non_bssid_frames),
  314. accum_general->non_bssid_frames,
  315. delta_general->non_bssid_frames,
  316. max_general->non_bssid_frames);
  317. pos += scnprintf(buf + pos, bufsz - pos,
  318. " %-30s %10u %10u %10u %10u\n",
  319. "filtered_frames:",
  320. le32_to_cpu(general->filtered_frames),
  321. accum_general->filtered_frames,
  322. delta_general->filtered_frames,
  323. max_general->filtered_frames);
  324. pos += scnprintf(buf + pos, bufsz - pos,
  325. " %-30s %10u %10u %10u %10u\n",
  326. "non_channel_beacons:",
  327. le32_to_cpu(general->non_channel_beacons),
  328. accum_general->non_channel_beacons,
  329. delta_general->non_channel_beacons,
  330. max_general->non_channel_beacons);
  331. pos += scnprintf(buf + pos, bufsz - pos,
  332. " %-30s %10u %10u %10u %10u\n",
  333. "channel_beacons:",
  334. le32_to_cpu(general->channel_beacons),
  335. accum_general->channel_beacons,
  336. delta_general->channel_beacons,
  337. max_general->channel_beacons);
  338. pos += scnprintf(buf + pos, bufsz - pos,
  339. " %-30s %10u %10u %10u %10u\n",
  340. "num_missed_bcon:",
  341. le32_to_cpu(general->num_missed_bcon),
  342. accum_general->num_missed_bcon,
  343. delta_general->num_missed_bcon,
  344. max_general->num_missed_bcon);
  345. pos += scnprintf(buf + pos, bufsz - pos,
  346. " %-30s %10u %10u %10u %10u\n",
  347. "adc_rx_saturation_time:",
  348. le32_to_cpu(general->adc_rx_saturation_time),
  349. accum_general->adc_rx_saturation_time,
  350. delta_general->adc_rx_saturation_time,
  351. max_general->adc_rx_saturation_time);
  352. pos += scnprintf(buf + pos, bufsz - pos,
  353. " %-30s %10u %10u %10u %10u\n",
  354. "ina_detect_search_tm:",
  355. le32_to_cpu(general->ina_detection_search_time),
  356. accum_general->ina_detection_search_time,
  357. delta_general->ina_detection_search_time,
  358. max_general->ina_detection_search_time);
  359. pos += scnprintf(buf + pos, bufsz - pos,
  360. " %-30s %10u %10u %10u %10u\n",
  361. "beacon_silence_rssi_a:",
  362. le32_to_cpu(general->beacon_silence_rssi_a),
  363. accum_general->beacon_silence_rssi_a,
  364. delta_general->beacon_silence_rssi_a,
  365. max_general->beacon_silence_rssi_a);
  366. pos += scnprintf(buf + pos, bufsz - pos,
  367. " %-30s %10u %10u %10u %10u\n",
  368. "beacon_silence_rssi_b:",
  369. le32_to_cpu(general->beacon_silence_rssi_b),
  370. accum_general->beacon_silence_rssi_b,
  371. delta_general->beacon_silence_rssi_b,
  372. max_general->beacon_silence_rssi_b);
  373. pos += scnprintf(buf + pos, bufsz - pos,
  374. " %-30s %10u %10u %10u %10u\n",
  375. "beacon_silence_rssi_c:",
  376. le32_to_cpu(general->beacon_silence_rssi_c),
  377. accum_general->beacon_silence_rssi_c,
  378. delta_general->beacon_silence_rssi_c,
  379. max_general->beacon_silence_rssi_c);
  380. pos += scnprintf(buf + pos, bufsz - pos,
  381. " %-30s %10u %10u %10u %10u\n",
  382. "interference_data_flag:",
  383. le32_to_cpu(general->interference_data_flag),
  384. accum_general->interference_data_flag,
  385. delta_general->interference_data_flag,
  386. max_general->interference_data_flag);
  387. pos += scnprintf(buf + pos, bufsz - pos,
  388. " %-30s %10u %10u %10u %10u\n",
  389. "channel_load:",
  390. le32_to_cpu(general->channel_load),
  391. accum_general->channel_load,
  392. delta_general->channel_load,
  393. max_general->channel_load);
  394. pos += scnprintf(buf + pos, bufsz - pos,
  395. " %-30s %10u %10u %10u %10u\n",
  396. "dsp_false_alarms:",
  397. le32_to_cpu(general->dsp_false_alarms),
  398. accum_general->dsp_false_alarms,
  399. delta_general->dsp_false_alarms,
  400. max_general->dsp_false_alarms);
  401. pos += scnprintf(buf + pos, bufsz - pos,
  402. " %-30s %10u %10u %10u %10u\n",
  403. "beacon_rssi_a:",
  404. le32_to_cpu(general->beacon_rssi_a),
  405. accum_general->beacon_rssi_a,
  406. delta_general->beacon_rssi_a,
  407. max_general->beacon_rssi_a);
  408. pos += scnprintf(buf + pos, bufsz - pos,
  409. " %-30s %10u %10u %10u %10u\n",
  410. "beacon_rssi_b:",
  411. le32_to_cpu(general->beacon_rssi_b),
  412. accum_general->beacon_rssi_b,
  413. delta_general->beacon_rssi_b,
  414. max_general->beacon_rssi_b);
  415. pos += scnprintf(buf + pos, bufsz - pos,
  416. " %-30s %10u %10u %10u %10u\n",
  417. "beacon_rssi_c:",
  418. le32_to_cpu(general->beacon_rssi_c),
  419. accum_general->beacon_rssi_c,
  420. delta_general->beacon_rssi_c,
  421. max_general->beacon_rssi_c);
  422. pos += scnprintf(buf + pos, bufsz - pos,
  423. " %-30s %10u %10u %10u %10u\n",
  424. "beacon_energy_a:",
  425. le32_to_cpu(general->beacon_energy_a),
  426. accum_general->beacon_energy_a,
  427. delta_general->beacon_energy_a,
  428. max_general->beacon_energy_a);
  429. pos += scnprintf(buf + pos, bufsz - pos,
  430. " %-30s %10u %10u %10u %10u\n",
  431. "beacon_energy_b:",
  432. le32_to_cpu(general->beacon_energy_b),
  433. accum_general->beacon_energy_b,
  434. delta_general->beacon_energy_b,
  435. max_general->beacon_energy_b);
  436. pos += scnprintf(buf + pos, bufsz - pos,
  437. " %-30s %10u %10u %10u %10u\n",
  438. "beacon_energy_c:",
  439. le32_to_cpu(general->beacon_energy_c),
  440. accum_general->beacon_energy_c,
  441. delta_general->beacon_energy_c,
  442. max_general->beacon_energy_c);
  443. pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM_HT:\n");
  444. pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
  445. "acumulative delta max\n",
  446. "Statistics_Rx - OFDM_HT:");
  447. pos += scnprintf(buf + pos, bufsz - pos,
  448. " %-30s %10u %10u %10u %10u\n",
  449. "plcp_err:",
  450. le32_to_cpu(ht->plcp_err), accum_ht->plcp_err,
  451. delta_ht->plcp_err, max_ht->plcp_err);
  452. pos += scnprintf(buf + pos, bufsz - pos,
  453. " %-30s %10u %10u %10u %10u\n",
  454. "overrun_err:",
  455. le32_to_cpu(ht->overrun_err), accum_ht->overrun_err,
  456. delta_ht->overrun_err, max_ht->overrun_err);
  457. pos += scnprintf(buf + pos, bufsz - pos,
  458. " %-30s %10u %10u %10u %10u\n",
  459. "early_overrun_err:",
  460. le32_to_cpu(ht->early_overrun_err),
  461. accum_ht->early_overrun_err,
  462. delta_ht->early_overrun_err,
  463. max_ht->early_overrun_err);
  464. pos += scnprintf(buf + pos, bufsz - pos,
  465. " %-30s %10u %10u %10u %10u\n",
  466. "crc32_good:",
  467. le32_to_cpu(ht->crc32_good), accum_ht->crc32_good,
  468. delta_ht->crc32_good, max_ht->crc32_good);
  469. pos += scnprintf(buf + pos, bufsz - pos,
  470. " %-30s %10u %10u %10u %10u\n",
  471. "crc32_err:",
  472. le32_to_cpu(ht->crc32_err), accum_ht->crc32_err,
  473. delta_ht->crc32_err, max_ht->crc32_err);
  474. pos += scnprintf(buf + pos, bufsz - pos,
  475. " %-30s %10u %10u %10u %10u\n",
  476. "mh_format_err:",
  477. le32_to_cpu(ht->mh_format_err),
  478. accum_ht->mh_format_err,
  479. delta_ht->mh_format_err, max_ht->mh_format_err);
  480. pos += scnprintf(buf + pos, bufsz - pos,
  481. " %-30s %10u %10u %10u %10u\n",
  482. "agg_crc32_good:",
  483. le32_to_cpu(ht->agg_crc32_good),
  484. accum_ht->agg_crc32_good,
  485. delta_ht->agg_crc32_good, max_ht->agg_crc32_good);
  486. pos += scnprintf(buf + pos, bufsz - pos,
  487. " %-30s %10u %10u %10u %10u\n",
  488. "agg_mpdu_cnt:",
  489. le32_to_cpu(ht->agg_mpdu_cnt),
  490. accum_ht->agg_mpdu_cnt,
  491. delta_ht->agg_mpdu_cnt, max_ht->agg_mpdu_cnt);
  492. pos += scnprintf(buf + pos, bufsz - pos,
  493. " %-30s %10u %10u %10u %10u\n",
  494. "agg_cnt:",
  495. le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt,
  496. delta_ht->agg_cnt, max_ht->agg_cnt);
  497. pos += scnprintf(buf + pos, bufsz - pos,
  498. " %-30s %10u %10u %10u %10u\n",
  499. "unsupport_mcs:",
  500. le32_to_cpu(ht->unsupport_mcs),
  501. accum_ht->unsupport_mcs,
  502. delta_ht->unsupport_mcs, max_ht->unsupport_mcs);
  503. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  504. kfree(buf);
  505. return ret;
  506. }
  507. ssize_t iwl_ucode_tx_stats_read(struct file *file,
  508. char __user *user_buf,
  509. size_t count, loff_t *ppos)
  510. {
  511. struct iwl_priv *priv = file->private_data;
  512. int pos = 0;
  513. char *buf;
  514. int bufsz = (sizeof(struct statistics_tx) * 48) + 250;
  515. ssize_t ret;
  516. struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
  517. if (!iwl_is_alive(priv))
  518. return -EAGAIN;
  519. buf = kzalloc(bufsz, GFP_KERNEL);
  520. if (!buf) {
  521. IWL_ERR(priv, "Can not allocate Buffer\n");
  522. return -ENOMEM;
  523. }
  524. /* the statistic information display here is based on
  525. * the last statistics notification from uCode
  526. * might not reflect the current uCode activity
  527. */
  528. tx = &priv->statistics.tx;
  529. accum_tx = &priv->accum_statistics.tx;
  530. delta_tx = &priv->delta_statistics.tx;
  531. max_tx = &priv->max_delta.tx;
  532. pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
  533. pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
  534. "acumulative delta max\n",
  535. "Statistics_Tx:");
  536. pos += scnprintf(buf + pos, bufsz - pos,
  537. " %-30s %10u %10u %10u %10u\n",
  538. "preamble:",
  539. le32_to_cpu(tx->preamble_cnt),
  540. accum_tx->preamble_cnt,
  541. delta_tx->preamble_cnt, max_tx->preamble_cnt);
  542. pos += scnprintf(buf + pos, bufsz - pos,
  543. " %-30s %10u %10u %10u %10u\n",
  544. "rx_detected_cnt:",
  545. le32_to_cpu(tx->rx_detected_cnt),
  546. accum_tx->rx_detected_cnt,
  547. delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt);
  548. pos += scnprintf(buf + pos, bufsz - pos,
  549. " %-30s %10u %10u %10u %10u\n",
  550. "bt_prio_defer_cnt:",
  551. le32_to_cpu(tx->bt_prio_defer_cnt),
  552. accum_tx->bt_prio_defer_cnt,
  553. delta_tx->bt_prio_defer_cnt,
  554. max_tx->bt_prio_defer_cnt);
  555. pos += scnprintf(buf + pos, bufsz - pos,
  556. " %-30s %10u %10u %10u %10u\n",
  557. "bt_prio_kill_cnt:",
  558. le32_to_cpu(tx->bt_prio_kill_cnt),
  559. accum_tx->bt_prio_kill_cnt,
  560. delta_tx->bt_prio_kill_cnt,
  561. max_tx->bt_prio_kill_cnt);
  562. pos += scnprintf(buf + pos, bufsz - pos,
  563. " %-30s %10u %10u %10u %10u\n",
  564. "few_bytes_cnt:",
  565. le32_to_cpu(tx->few_bytes_cnt),
  566. accum_tx->few_bytes_cnt,
  567. delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt);
  568. pos += scnprintf(buf + pos, bufsz - pos,
  569. " %-30s %10u %10u %10u %10u\n",
  570. "cts_timeout:",
  571. le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout,
  572. delta_tx->cts_timeout, max_tx->cts_timeout);
  573. pos += scnprintf(buf + pos, bufsz - pos,
  574. " %-30s %10u %10u %10u %10u\n",
  575. "ack_timeout:",
  576. le32_to_cpu(tx->ack_timeout),
  577. accum_tx->ack_timeout,
  578. delta_tx->ack_timeout, max_tx->ack_timeout);
  579. pos += scnprintf(buf + pos, bufsz - pos,
  580. " %-30s %10u %10u %10u %10u\n",
  581. "expected_ack_cnt:",
  582. le32_to_cpu(tx->expected_ack_cnt),
  583. accum_tx->expected_ack_cnt,
  584. delta_tx->expected_ack_cnt,
  585. max_tx->expected_ack_cnt);
  586. pos += scnprintf(buf + pos, bufsz - pos,
  587. " %-30s %10u %10u %10u %10u\n",
  588. "actual_ack_cnt:",
  589. le32_to_cpu(tx->actual_ack_cnt),
  590. accum_tx->actual_ack_cnt,
  591. delta_tx->actual_ack_cnt,
  592. max_tx->actual_ack_cnt);
  593. pos += scnprintf(buf + pos, bufsz - pos,
  594. " %-30s %10u %10u %10u %10u\n",
  595. "dump_msdu_cnt:",
  596. le32_to_cpu(tx->dump_msdu_cnt),
  597. accum_tx->dump_msdu_cnt,
  598. delta_tx->dump_msdu_cnt,
  599. max_tx->dump_msdu_cnt);
  600. pos += scnprintf(buf + pos, bufsz - pos,
  601. " %-30s %10u %10u %10u %10u\n",
  602. "abort_nxt_frame_mismatch:",
  603. le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt),
  604. accum_tx->burst_abort_next_frame_mismatch_cnt,
  605. delta_tx->burst_abort_next_frame_mismatch_cnt,
  606. max_tx->burst_abort_next_frame_mismatch_cnt);
  607. pos += scnprintf(buf + pos, bufsz - pos,
  608. " %-30s %10u %10u %10u %10u\n",
  609. "abort_missing_nxt_frame:",
  610. le32_to_cpu(tx->burst_abort_missing_next_frame_cnt),
  611. accum_tx->burst_abort_missing_next_frame_cnt,
  612. delta_tx->burst_abort_missing_next_frame_cnt,
  613. max_tx->burst_abort_missing_next_frame_cnt);
  614. pos += scnprintf(buf + pos, bufsz - pos,
  615. " %-30s %10u %10u %10u %10u\n",
  616. "cts_timeout_collision:",
  617. le32_to_cpu(tx->cts_timeout_collision),
  618. accum_tx->cts_timeout_collision,
  619. delta_tx->cts_timeout_collision,
  620. max_tx->cts_timeout_collision);
  621. pos += scnprintf(buf + pos, bufsz - pos,
  622. " %-30s %10u %10u %10u %10u\n",
  623. "ack_ba_timeout_collision:",
  624. le32_to_cpu(tx->ack_or_ba_timeout_collision),
  625. accum_tx->ack_or_ba_timeout_collision,
  626. delta_tx->ack_or_ba_timeout_collision,
  627. max_tx->ack_or_ba_timeout_collision);
  628. pos += scnprintf(buf + pos, bufsz - pos,
  629. " %-30s %10u %10u %10u %10u\n",
  630. "agg ba_timeout:",
  631. le32_to_cpu(tx->agg.ba_timeout),
  632. accum_tx->agg.ba_timeout,
  633. delta_tx->agg.ba_timeout,
  634. max_tx->agg.ba_timeout);
  635. pos += scnprintf(buf + pos, bufsz - pos,
  636. " %-30s %10u %10u %10u %10u\n",
  637. "agg ba_resched_frames:",
  638. le32_to_cpu(tx->agg.ba_reschedule_frames),
  639. accum_tx->agg.ba_reschedule_frames,
  640. delta_tx->agg.ba_reschedule_frames,
  641. max_tx->agg.ba_reschedule_frames);
  642. pos += scnprintf(buf + pos, bufsz - pos,
  643. " %-30s %10u %10u %10u %10u\n",
  644. "agg scd_query_agg_frame:",
  645. le32_to_cpu(tx->agg.scd_query_agg_frame_cnt),
  646. accum_tx->agg.scd_query_agg_frame_cnt,
  647. delta_tx->agg.scd_query_agg_frame_cnt,
  648. max_tx->agg.scd_query_agg_frame_cnt);
  649. pos += scnprintf(buf + pos, bufsz - pos,
  650. " %-30s %10u %10u %10u %10u\n",
  651. "agg scd_query_no_agg:",
  652. le32_to_cpu(tx->agg.scd_query_no_agg),
  653. accum_tx->agg.scd_query_no_agg,
  654. delta_tx->agg.scd_query_no_agg,
  655. max_tx->agg.scd_query_no_agg);
  656. pos += scnprintf(buf + pos, bufsz - pos,
  657. " %-30s %10u %10u %10u %10u\n",
  658. "agg scd_query_agg:",
  659. le32_to_cpu(tx->agg.scd_query_agg),
  660. accum_tx->agg.scd_query_agg,
  661. delta_tx->agg.scd_query_agg,
  662. max_tx->agg.scd_query_agg);
  663. pos += scnprintf(buf + pos, bufsz - pos,
  664. " %-30s %10u %10u %10u %10u\n",
  665. "agg scd_query_mismatch:",
  666. le32_to_cpu(tx->agg.scd_query_mismatch),
  667. accum_tx->agg.scd_query_mismatch,
  668. delta_tx->agg.scd_query_mismatch,
  669. max_tx->agg.scd_query_mismatch);
  670. pos += scnprintf(buf + pos, bufsz - pos,
  671. " %-30s %10u %10u %10u %10u\n",
  672. "agg frame_not_ready:",
  673. le32_to_cpu(tx->agg.frame_not_ready),
  674. accum_tx->agg.frame_not_ready,
  675. delta_tx->agg.frame_not_ready,
  676. max_tx->agg.frame_not_ready);
  677. pos += scnprintf(buf + pos, bufsz - pos,
  678. " %-30s %10u %10u %10u %10u\n",
  679. "agg underrun:",
  680. le32_to_cpu(tx->agg.underrun),
  681. accum_tx->agg.underrun,
  682. delta_tx->agg.underrun, max_tx->agg.underrun);
  683. pos += scnprintf(buf + pos, bufsz - pos,
  684. " %-30s %10u %10u %10u %10u\n",
  685. "agg bt_prio_kill:",
  686. le32_to_cpu(tx->agg.bt_prio_kill),
  687. accum_tx->agg.bt_prio_kill,
  688. delta_tx->agg.bt_prio_kill,
  689. max_tx->agg.bt_prio_kill);
  690. pos += scnprintf(buf + pos, bufsz - pos,
  691. " %-30s %10u %10u %10u %10u\n",
  692. "agg rx_ba_rsp_cnt:",
  693. le32_to_cpu(tx->agg.rx_ba_rsp_cnt),
  694. accum_tx->agg.rx_ba_rsp_cnt,
  695. delta_tx->agg.rx_ba_rsp_cnt,
  696. max_tx->agg.rx_ba_rsp_cnt);
  697. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  698. kfree(buf);
  699. return ret;
  700. }
  701. ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf,
  702. size_t count, loff_t *ppos)
  703. {
  704. struct iwl_priv *priv = file->private_data;
  705. int pos = 0;
  706. char *buf;
  707. int bufsz = sizeof(struct statistics_general) * 10 + 300;
  708. ssize_t ret;
  709. struct statistics_general *general, *accum_general;
  710. struct statistics_general *delta_general, *max_general;
  711. struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
  712. struct statistics_div *div, *accum_div, *delta_div, *max_div;
  713. if (!iwl_is_alive(priv))
  714. return -EAGAIN;
  715. buf = kzalloc(bufsz, GFP_KERNEL);
  716. if (!buf) {
  717. IWL_ERR(priv, "Can not allocate Buffer\n");
  718. return -ENOMEM;
  719. }
  720. /* the statistic information display here is based on
  721. * the last statistics notification from uCode
  722. * might not reflect the current uCode activity
  723. */
  724. general = &priv->statistics.general;
  725. dbg = &priv->statistics.general.dbg;
  726. div = &priv->statistics.general.div;
  727. accum_general = &priv->accum_statistics.general;
  728. delta_general = &priv->delta_statistics.general;
  729. max_general = &priv->max_delta.general;
  730. accum_dbg = &priv->accum_statistics.general.dbg;
  731. delta_dbg = &priv->delta_statistics.general.dbg;
  732. max_dbg = &priv->max_delta.general.dbg;
  733. accum_div = &priv->accum_statistics.general.div;
  734. delta_div = &priv->delta_statistics.general.div;
  735. max_div = &priv->max_delta.general.div;
  736. pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
  737. pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
  738. "acumulative delta max\n",
  739. "Statistics_General:");
  740. pos += scnprintf(buf + pos, bufsz - pos, " %-30s %10u\n",
  741. "temperature:",
  742. le32_to_cpu(general->temperature));
  743. pos += scnprintf(buf + pos, bufsz - pos, " %-30s %10u\n",
  744. "temperature_m:",
  745. le32_to_cpu(general->temperature_m));
  746. pos += scnprintf(buf + pos, bufsz - pos,
  747. " %-30s %10u %10u %10u %10u\n",
  748. "burst_check:",
  749. le32_to_cpu(dbg->burst_check),
  750. accum_dbg->burst_check,
  751. delta_dbg->burst_check, max_dbg->burst_check);
  752. pos += scnprintf(buf + pos, bufsz - pos,
  753. " %-30s %10u %10u %10u %10u\n",
  754. "burst_count:",
  755. le32_to_cpu(dbg->burst_count),
  756. accum_dbg->burst_count,
  757. delta_dbg->burst_count, max_dbg->burst_count);
  758. pos += scnprintf(buf + pos, bufsz - pos,
  759. " %-30s %10u %10u %10u %10u\n",
  760. "sleep_time:",
  761. le32_to_cpu(general->sleep_time),
  762. accum_general->sleep_time,
  763. delta_general->sleep_time, max_general->sleep_time);
  764. pos += scnprintf(buf + pos, bufsz - pos,
  765. " %-30s %10u %10u %10u %10u\n",
  766. "slots_out:",
  767. le32_to_cpu(general->slots_out),
  768. accum_general->slots_out,
  769. delta_general->slots_out, max_general->slots_out);
  770. pos += scnprintf(buf + pos, bufsz - pos,
  771. " %-30s %10u %10u %10u %10u\n",
  772. "slots_idle:",
  773. le32_to_cpu(general->slots_idle),
  774. accum_general->slots_idle,
  775. delta_general->slots_idle, max_general->slots_idle);
  776. pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp:\t\t\t%u\n",
  777. le32_to_cpu(general->ttl_timestamp));
  778. pos += scnprintf(buf + pos, bufsz - pos,
  779. " %-30s %10u %10u %10u %10u\n",
  780. "tx_on_a:",
  781. le32_to_cpu(div->tx_on_a), accum_div->tx_on_a,
  782. delta_div->tx_on_a, max_div->tx_on_a);
  783. pos += scnprintf(buf + pos, bufsz - pos,
  784. " %-30s %10u %10u %10u %10u\n",
  785. "tx_on_b:",
  786. le32_to_cpu(div->tx_on_b), accum_div->tx_on_b,
  787. delta_div->tx_on_b, max_div->tx_on_b);
  788. pos += scnprintf(buf + pos, bufsz - pos,
  789. " %-30s %10u %10u %10u %10u\n",
  790. "exec_time:",
  791. le32_to_cpu(div->exec_time), accum_div->exec_time,
  792. delta_div->exec_time, max_div->exec_time);
  793. pos += scnprintf(buf + pos, bufsz - pos,
  794. " %-30s %10u %10u %10u %10u\n",
  795. "probe_time:",
  796. le32_to_cpu(div->probe_time), accum_div->probe_time,
  797. delta_div->probe_time, max_div->probe_time);
  798. pos += scnprintf(buf + pos, bufsz - pos,
  799. " %-30s %10u %10u %10u %10u\n",
  800. "rx_enable_counter:",
  801. le32_to_cpu(general->rx_enable_counter),
  802. accum_general->rx_enable_counter,
  803. delta_general->rx_enable_counter,
  804. max_general->rx_enable_counter);
  805. pos += scnprintf(buf + pos, bufsz - pos,
  806. " %-30s %10u %10u %10u %10u\n",
  807. "num_of_sos_states:",
  808. le32_to_cpu(general->num_of_sos_states),
  809. accum_general->num_of_sos_states,
  810. delta_general->num_of_sos_states,
  811. max_general->num_of_sos_states);
  812. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  813. kfree(buf);
  814. return ret;
  815. }