iwl-4965-debugfs.c 29 KB

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