iwl-agn-debugfs.c 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013
  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. static int iwl_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
  30. {
  31. int p = 0;
  32. u32 flag;
  33. if (priv->cfg->bt_statistics)
  34. flag = le32_to_cpu(priv->_agn.statistics_bt.flag);
  35. else
  36. flag = le32_to_cpu(priv->_agn.statistics.flag);
  37. p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", flag);
  38. if (flag & UCODE_STATISTICS_CLEAR_MSK)
  39. p += scnprintf(buf + p, bufsz - p,
  40. "\tStatistics have been cleared\n");
  41. p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n",
  42. (flag & UCODE_STATISTICS_FREQUENCY_MSK)
  43. ? "2.4 GHz" : "5.2 GHz");
  44. p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n",
  45. (flag & UCODE_STATISTICS_NARROW_BAND_MSK)
  46. ? "enabled" : "disabled");
  47. return p;
  48. }
  49. ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf,
  50. size_t count, loff_t *ppos)
  51. {
  52. struct iwl_priv *priv = file->private_data;
  53. int pos = 0;
  54. char *buf;
  55. int bufsz = sizeof(struct statistics_rx_phy) * 40 +
  56. sizeof(struct statistics_rx_non_phy) * 40 +
  57. sizeof(struct statistics_rx_ht_phy) * 40 + 400;
  58. ssize_t ret;
  59. struct statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm;
  60. struct statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
  61. struct statistics_rx_non_phy *general, *accum_general;
  62. struct statistics_rx_non_phy *delta_general, *max_general;
  63. struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;
  64. if (!iwl_is_alive(priv))
  65. return -EAGAIN;
  66. buf = kzalloc(bufsz, GFP_KERNEL);
  67. if (!buf) {
  68. IWL_ERR(priv, "Can not allocate Buffer\n");
  69. return -ENOMEM;
  70. }
  71. /*
  72. * the statistic information display here is based on
  73. * the last statistics notification from uCode
  74. * might not reflect the current uCode activity
  75. */
  76. if (priv->cfg->bt_statistics) {
  77. ofdm = &priv->_agn.statistics_bt.rx.ofdm;
  78. cck = &priv->_agn.statistics_bt.rx.cck;
  79. general = &priv->_agn.statistics_bt.rx.general.common;
  80. ht = &priv->_agn.statistics_bt.rx.ofdm_ht;
  81. accum_ofdm = &priv->_agn.accum_statistics_bt.rx.ofdm;
  82. accum_cck = &priv->_agn.accum_statistics_bt.rx.cck;
  83. accum_general =
  84. &priv->_agn.accum_statistics_bt.rx.general.common;
  85. accum_ht = &priv->_agn.accum_statistics_bt.rx.ofdm_ht;
  86. delta_ofdm = &priv->_agn.delta_statistics_bt.rx.ofdm;
  87. delta_cck = &priv->_agn.delta_statistics_bt.rx.cck;
  88. delta_general =
  89. &priv->_agn.delta_statistics_bt.rx.general.common;
  90. delta_ht = &priv->_agn.delta_statistics_bt.rx.ofdm_ht;
  91. max_ofdm = &priv->_agn.max_delta_bt.rx.ofdm;
  92. max_cck = &priv->_agn.max_delta_bt.rx.cck;
  93. max_general = &priv->_agn.max_delta_bt.rx.general.common;
  94. max_ht = &priv->_agn.max_delta_bt.rx.ofdm_ht;
  95. } else {
  96. ofdm = &priv->_agn.statistics.rx.ofdm;
  97. cck = &priv->_agn.statistics.rx.cck;
  98. general = &priv->_agn.statistics.rx.general;
  99. ht = &priv->_agn.statistics.rx.ofdm_ht;
  100. accum_ofdm = &priv->_agn.accum_statistics.rx.ofdm;
  101. accum_cck = &priv->_agn.accum_statistics.rx.cck;
  102. accum_general = &priv->_agn.accum_statistics.rx.general;
  103. accum_ht = &priv->_agn.accum_statistics.rx.ofdm_ht;
  104. delta_ofdm = &priv->_agn.delta_statistics.rx.ofdm;
  105. delta_cck = &priv->_agn.delta_statistics.rx.cck;
  106. delta_general = &priv->_agn.delta_statistics.rx.general;
  107. delta_ht = &priv->_agn.delta_statistics.rx.ofdm_ht;
  108. max_ofdm = &priv->_agn.max_delta.rx.ofdm;
  109. max_cck = &priv->_agn.max_delta.rx.cck;
  110. max_general = &priv->_agn.max_delta.rx.general;
  111. max_ht = &priv->_agn.max_delta.rx.ofdm_ht;
  112. }
  113. pos += iwl_statistics_flag(priv, buf, bufsz);
  114. pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
  115. "acumulative delta max\n",
  116. "Statistics_Rx - OFDM:");
  117. pos += scnprintf(buf + pos, bufsz - pos,
  118. " %-30s %10u %10u %10u %10u\n",
  119. "ina_cnt:", le32_to_cpu(ofdm->ina_cnt),
  120. accum_ofdm->ina_cnt,
  121. delta_ofdm->ina_cnt, max_ofdm->ina_cnt);
  122. pos += scnprintf(buf + pos, bufsz - pos,
  123. " %-30s %10u %10u %10u %10u\n",
  124. "fina_cnt:",
  125. le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt,
  126. delta_ofdm->fina_cnt, max_ofdm->fina_cnt);
  127. pos += scnprintf(buf + pos, bufsz - pos,
  128. " %-30s %10u %10u %10u %10u\n",
  129. "plcp_err:",
  130. le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err,
  131. delta_ofdm->plcp_err, max_ofdm->plcp_err);
  132. pos += scnprintf(buf + pos, bufsz - pos,
  133. " %-30s %10u %10u %10u %10u\n", "crc32_err:",
  134. le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err,
  135. delta_ofdm->crc32_err, max_ofdm->crc32_err);
  136. pos += scnprintf(buf + pos, bufsz - pos,
  137. " %-30s %10u %10u %10u %10u\n", "overrun_err:",
  138. le32_to_cpu(ofdm->overrun_err),
  139. accum_ofdm->overrun_err, delta_ofdm->overrun_err,
  140. max_ofdm->overrun_err);
  141. pos += scnprintf(buf + pos, bufsz - pos,
  142. " %-30s %10u %10u %10u %10u\n",
  143. "early_overrun_err:",
  144. le32_to_cpu(ofdm->early_overrun_err),
  145. accum_ofdm->early_overrun_err,
  146. delta_ofdm->early_overrun_err,
  147. max_ofdm->early_overrun_err);
  148. pos += scnprintf(buf + pos, bufsz - pos,
  149. " %-30s %10u %10u %10u %10u\n",
  150. "crc32_good:", le32_to_cpu(ofdm->crc32_good),
  151. accum_ofdm->crc32_good, delta_ofdm->crc32_good,
  152. max_ofdm->crc32_good);
  153. pos += scnprintf(buf + pos, bufsz - pos,
  154. " %-30s %10u %10u %10u %10u\n", "false_alarm_cnt:",
  155. le32_to_cpu(ofdm->false_alarm_cnt),
  156. accum_ofdm->false_alarm_cnt,
  157. delta_ofdm->false_alarm_cnt,
  158. max_ofdm->false_alarm_cnt);
  159. pos += scnprintf(buf + pos, bufsz - pos,
  160. " %-30s %10u %10u %10u %10u\n",
  161. "fina_sync_err_cnt:",
  162. le32_to_cpu(ofdm->fina_sync_err_cnt),
  163. accum_ofdm->fina_sync_err_cnt,
  164. delta_ofdm->fina_sync_err_cnt,
  165. max_ofdm->fina_sync_err_cnt);
  166. pos += scnprintf(buf + pos, bufsz - pos,
  167. " %-30s %10u %10u %10u %10u\n", "sfd_timeout:",
  168. le32_to_cpu(ofdm->sfd_timeout),
  169. accum_ofdm->sfd_timeout, delta_ofdm->sfd_timeout,
  170. max_ofdm->sfd_timeout);
  171. pos += scnprintf(buf + pos, bufsz - pos,
  172. " %-30s %10u %10u %10u %10u\n", "fina_timeout:",
  173. le32_to_cpu(ofdm->fina_timeout),
  174. accum_ofdm->fina_timeout, delta_ofdm->fina_timeout,
  175. max_ofdm->fina_timeout);
  176. pos += scnprintf(buf + pos, bufsz - pos,
  177. " %-30s %10u %10u %10u %10u\n",
  178. "unresponded_rts:",
  179. le32_to_cpu(ofdm->unresponded_rts),
  180. accum_ofdm->unresponded_rts,
  181. delta_ofdm->unresponded_rts,
  182. max_ofdm->unresponded_rts);
  183. pos += scnprintf(buf + pos, bufsz - pos,
  184. " %-30s %10u %10u %10u %10u\n",
  185. "rxe_frame_lmt_ovrun:",
  186. le32_to_cpu(ofdm->rxe_frame_limit_overrun),
  187. accum_ofdm->rxe_frame_limit_overrun,
  188. delta_ofdm->rxe_frame_limit_overrun,
  189. max_ofdm->rxe_frame_limit_overrun);
  190. pos += scnprintf(buf + pos, bufsz - pos,
  191. " %-30s %10u %10u %10u %10u\n", "sent_ack_cnt:",
  192. le32_to_cpu(ofdm->sent_ack_cnt),
  193. accum_ofdm->sent_ack_cnt, delta_ofdm->sent_ack_cnt,
  194. max_ofdm->sent_ack_cnt);
  195. pos += scnprintf(buf + pos, bufsz - pos,
  196. " %-30s %10u %10u %10u %10u\n", "sent_cts_cnt:",
  197. le32_to_cpu(ofdm->sent_cts_cnt),
  198. accum_ofdm->sent_cts_cnt, delta_ofdm->sent_cts_cnt,
  199. max_ofdm->sent_cts_cnt);
  200. pos += scnprintf(buf + pos, bufsz - pos,
  201. " %-30s %10u %10u %10u %10u\n",
  202. "sent_ba_rsp_cnt:",
  203. le32_to_cpu(ofdm->sent_ba_rsp_cnt),
  204. accum_ofdm->sent_ba_rsp_cnt,
  205. delta_ofdm->sent_ba_rsp_cnt,
  206. max_ofdm->sent_ba_rsp_cnt);
  207. pos += scnprintf(buf + pos, bufsz - pos,
  208. " %-30s %10u %10u %10u %10u\n", "dsp_self_kill:",
  209. le32_to_cpu(ofdm->dsp_self_kill),
  210. accum_ofdm->dsp_self_kill,
  211. delta_ofdm->dsp_self_kill,
  212. max_ofdm->dsp_self_kill);
  213. pos += scnprintf(buf + pos, bufsz - pos,
  214. " %-30s %10u %10u %10u %10u\n",
  215. "mh_format_err:",
  216. le32_to_cpu(ofdm->mh_format_err),
  217. accum_ofdm->mh_format_err,
  218. delta_ofdm->mh_format_err,
  219. max_ofdm->mh_format_err);
  220. pos += scnprintf(buf + pos, bufsz - pos,
  221. " %-30s %10u %10u %10u %10u\n",
  222. "re_acq_main_rssi_sum:",
  223. le32_to_cpu(ofdm->re_acq_main_rssi_sum),
  224. accum_ofdm->re_acq_main_rssi_sum,
  225. delta_ofdm->re_acq_main_rssi_sum,
  226. max_ofdm->re_acq_main_rssi_sum);
  227. pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
  228. "acumulative delta max\n",
  229. "Statistics_Rx - CCK:");
  230. pos += scnprintf(buf + pos, bufsz - pos,
  231. " %-30s %10u %10u %10u %10u\n",
  232. "ina_cnt:",
  233. le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt,
  234. delta_cck->ina_cnt, max_cck->ina_cnt);
  235. pos += scnprintf(buf + pos, bufsz - pos,
  236. " %-30s %10u %10u %10u %10u\n",
  237. "fina_cnt:",
  238. le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt,
  239. delta_cck->fina_cnt, max_cck->fina_cnt);
  240. pos += scnprintf(buf + pos, bufsz - pos,
  241. " %-30s %10u %10u %10u %10u\n",
  242. "plcp_err:",
  243. le32_to_cpu(cck->plcp_err), accum_cck->plcp_err,
  244. delta_cck->plcp_err, max_cck->plcp_err);
  245. pos += scnprintf(buf + pos, bufsz - pos,
  246. " %-30s %10u %10u %10u %10u\n",
  247. "crc32_err:",
  248. le32_to_cpu(cck->crc32_err), accum_cck->crc32_err,
  249. delta_cck->crc32_err, max_cck->crc32_err);
  250. pos += scnprintf(buf + pos, bufsz - pos,
  251. " %-30s %10u %10u %10u %10u\n",
  252. "overrun_err:",
  253. le32_to_cpu(cck->overrun_err),
  254. accum_cck->overrun_err, delta_cck->overrun_err,
  255. max_cck->overrun_err);
  256. pos += scnprintf(buf + pos, bufsz - pos,
  257. " %-30s %10u %10u %10u %10u\n",
  258. "early_overrun_err:",
  259. le32_to_cpu(cck->early_overrun_err),
  260. accum_cck->early_overrun_err,
  261. delta_cck->early_overrun_err,
  262. max_cck->early_overrun_err);
  263. pos += scnprintf(buf + pos, bufsz - pos,
  264. " %-30s %10u %10u %10u %10u\n",
  265. "crc32_good:",
  266. le32_to_cpu(cck->crc32_good), accum_cck->crc32_good,
  267. delta_cck->crc32_good, max_cck->crc32_good);
  268. pos += scnprintf(buf + pos, bufsz - pos,
  269. " %-30s %10u %10u %10u %10u\n",
  270. "false_alarm_cnt:",
  271. le32_to_cpu(cck->false_alarm_cnt),
  272. accum_cck->false_alarm_cnt,
  273. delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt);
  274. pos += scnprintf(buf + pos, bufsz - pos,
  275. " %-30s %10u %10u %10u %10u\n",
  276. "fina_sync_err_cnt:",
  277. le32_to_cpu(cck->fina_sync_err_cnt),
  278. accum_cck->fina_sync_err_cnt,
  279. delta_cck->fina_sync_err_cnt,
  280. max_cck->fina_sync_err_cnt);
  281. pos += scnprintf(buf + pos, bufsz - pos,
  282. " %-30s %10u %10u %10u %10u\n",
  283. "sfd_timeout:",
  284. le32_to_cpu(cck->sfd_timeout),
  285. accum_cck->sfd_timeout, delta_cck->sfd_timeout,
  286. max_cck->sfd_timeout);
  287. pos += scnprintf(buf + pos, bufsz - pos,
  288. " %-30s %10u %10u %10u %10u\n", "fina_timeout:",
  289. le32_to_cpu(cck->fina_timeout),
  290. accum_cck->fina_timeout, delta_cck->fina_timeout,
  291. max_cck->fina_timeout);
  292. pos += scnprintf(buf + pos, bufsz - pos,
  293. " %-30s %10u %10u %10u %10u\n",
  294. "unresponded_rts:",
  295. le32_to_cpu(cck->unresponded_rts),
  296. accum_cck->unresponded_rts, delta_cck->unresponded_rts,
  297. max_cck->unresponded_rts);
  298. pos += scnprintf(buf + pos, bufsz - pos,
  299. " %-30s %10u %10u %10u %10u\n",
  300. "rxe_frame_lmt_ovrun:",
  301. le32_to_cpu(cck->rxe_frame_limit_overrun),
  302. accum_cck->rxe_frame_limit_overrun,
  303. delta_cck->rxe_frame_limit_overrun,
  304. max_cck->rxe_frame_limit_overrun);
  305. pos += scnprintf(buf + pos, bufsz - pos,
  306. " %-30s %10u %10u %10u %10u\n", "sent_ack_cnt:",
  307. le32_to_cpu(cck->sent_ack_cnt),
  308. accum_cck->sent_ack_cnt, delta_cck->sent_ack_cnt,
  309. max_cck->sent_ack_cnt);
  310. pos += scnprintf(buf + pos, bufsz - pos,
  311. " %-30s %10u %10u %10u %10u\n", "sent_cts_cnt:",
  312. le32_to_cpu(cck->sent_cts_cnt),
  313. accum_cck->sent_cts_cnt, delta_cck->sent_cts_cnt,
  314. max_cck->sent_cts_cnt);
  315. pos += scnprintf(buf + pos, bufsz - pos,
  316. " %-30s %10u %10u %10u %10u\n", "sent_ba_rsp_cnt:",
  317. le32_to_cpu(cck->sent_ba_rsp_cnt),
  318. accum_cck->sent_ba_rsp_cnt,
  319. delta_cck->sent_ba_rsp_cnt,
  320. max_cck->sent_ba_rsp_cnt);
  321. pos += scnprintf(buf + pos, bufsz - pos,
  322. " %-30s %10u %10u %10u %10u\n", "dsp_self_kill:",
  323. le32_to_cpu(cck->dsp_self_kill),
  324. accum_cck->dsp_self_kill, delta_cck->dsp_self_kill,
  325. max_cck->dsp_self_kill);
  326. pos += scnprintf(buf + pos, bufsz - pos,
  327. " %-30s %10u %10u %10u %10u\n", "mh_format_err:",
  328. le32_to_cpu(cck->mh_format_err),
  329. accum_cck->mh_format_err, delta_cck->mh_format_err,
  330. max_cck->mh_format_err);
  331. pos += scnprintf(buf + pos, bufsz - pos,
  332. " %-30s %10u %10u %10u %10u\n",
  333. "re_acq_main_rssi_sum:",
  334. le32_to_cpu(cck->re_acq_main_rssi_sum),
  335. accum_cck->re_acq_main_rssi_sum,
  336. delta_cck->re_acq_main_rssi_sum,
  337. max_cck->re_acq_main_rssi_sum);
  338. pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
  339. "acumulative delta max\n",
  340. "Statistics_Rx - GENERAL:");
  341. pos += scnprintf(buf + pos, bufsz - pos,
  342. " %-30s %10u %10u %10u %10u\n", "bogus_cts:",
  343. le32_to_cpu(general->bogus_cts),
  344. accum_general->bogus_cts, delta_general->bogus_cts,
  345. max_general->bogus_cts);
  346. pos += scnprintf(buf + pos, bufsz - pos,
  347. " %-30s %10u %10u %10u %10u\n", "bogus_ack:",
  348. le32_to_cpu(general->bogus_ack),
  349. accum_general->bogus_ack, delta_general->bogus_ack,
  350. max_general->bogus_ack);
  351. pos += scnprintf(buf + pos, bufsz - pos,
  352. " %-30s %10u %10u %10u %10u\n",
  353. "non_bssid_frames:",
  354. le32_to_cpu(general->non_bssid_frames),
  355. accum_general->non_bssid_frames,
  356. delta_general->non_bssid_frames,
  357. max_general->non_bssid_frames);
  358. pos += scnprintf(buf + pos, bufsz - pos,
  359. " %-30s %10u %10u %10u %10u\n",
  360. "filtered_frames:",
  361. le32_to_cpu(general->filtered_frames),
  362. accum_general->filtered_frames,
  363. delta_general->filtered_frames,
  364. max_general->filtered_frames);
  365. pos += scnprintf(buf + pos, bufsz - pos,
  366. " %-30s %10u %10u %10u %10u\n",
  367. "non_channel_beacons:",
  368. le32_to_cpu(general->non_channel_beacons),
  369. accum_general->non_channel_beacons,
  370. delta_general->non_channel_beacons,
  371. max_general->non_channel_beacons);
  372. pos += scnprintf(buf + pos, bufsz - pos,
  373. " %-30s %10u %10u %10u %10u\n",
  374. "channel_beacons:",
  375. le32_to_cpu(general->channel_beacons),
  376. accum_general->channel_beacons,
  377. delta_general->channel_beacons,
  378. max_general->channel_beacons);
  379. pos += scnprintf(buf + pos, bufsz - pos,
  380. " %-30s %10u %10u %10u %10u\n",
  381. "num_missed_bcon:",
  382. le32_to_cpu(general->num_missed_bcon),
  383. accum_general->num_missed_bcon,
  384. delta_general->num_missed_bcon,
  385. max_general->num_missed_bcon);
  386. pos += scnprintf(buf + pos, bufsz - pos,
  387. " %-30s %10u %10u %10u %10u\n",
  388. "adc_rx_saturation_time:",
  389. le32_to_cpu(general->adc_rx_saturation_time),
  390. accum_general->adc_rx_saturation_time,
  391. delta_general->adc_rx_saturation_time,
  392. max_general->adc_rx_saturation_time);
  393. pos += scnprintf(buf + pos, bufsz - pos,
  394. " %-30s %10u %10u %10u %10u\n",
  395. "ina_detect_search_tm:",
  396. le32_to_cpu(general->ina_detection_search_time),
  397. accum_general->ina_detection_search_time,
  398. delta_general->ina_detection_search_time,
  399. max_general->ina_detection_search_time);
  400. pos += scnprintf(buf + pos, bufsz - pos,
  401. " %-30s %10u %10u %10u %10u\n",
  402. "beacon_silence_rssi_a:",
  403. le32_to_cpu(general->beacon_silence_rssi_a),
  404. accum_general->beacon_silence_rssi_a,
  405. delta_general->beacon_silence_rssi_a,
  406. max_general->beacon_silence_rssi_a);
  407. pos += scnprintf(buf + pos, bufsz - pos,
  408. " %-30s %10u %10u %10u %10u\n",
  409. "beacon_silence_rssi_b:",
  410. le32_to_cpu(general->beacon_silence_rssi_b),
  411. accum_general->beacon_silence_rssi_b,
  412. delta_general->beacon_silence_rssi_b,
  413. max_general->beacon_silence_rssi_b);
  414. pos += scnprintf(buf + pos, bufsz - pos,
  415. " %-30s %10u %10u %10u %10u\n",
  416. "beacon_silence_rssi_c:",
  417. le32_to_cpu(general->beacon_silence_rssi_c),
  418. accum_general->beacon_silence_rssi_c,
  419. delta_general->beacon_silence_rssi_c,
  420. max_general->beacon_silence_rssi_c);
  421. pos += scnprintf(buf + pos, bufsz - pos,
  422. " %-30s %10u %10u %10u %10u\n",
  423. "interference_data_flag:",
  424. le32_to_cpu(general->interference_data_flag),
  425. accum_general->interference_data_flag,
  426. delta_general->interference_data_flag,
  427. max_general->interference_data_flag);
  428. pos += scnprintf(buf + pos, bufsz - pos,
  429. " %-30s %10u %10u %10u %10u\n",
  430. "channel_load:",
  431. le32_to_cpu(general->channel_load),
  432. accum_general->channel_load,
  433. delta_general->channel_load,
  434. max_general->channel_load);
  435. pos += scnprintf(buf + pos, bufsz - pos,
  436. " %-30s %10u %10u %10u %10u\n",
  437. "dsp_false_alarms:",
  438. le32_to_cpu(general->dsp_false_alarms),
  439. accum_general->dsp_false_alarms,
  440. delta_general->dsp_false_alarms,
  441. max_general->dsp_false_alarms);
  442. pos += scnprintf(buf + pos, bufsz - pos,
  443. " %-30s %10u %10u %10u %10u\n",
  444. "beacon_rssi_a:",
  445. le32_to_cpu(general->beacon_rssi_a),
  446. accum_general->beacon_rssi_a,
  447. delta_general->beacon_rssi_a,
  448. max_general->beacon_rssi_a);
  449. pos += scnprintf(buf + pos, bufsz - pos,
  450. " %-30s %10u %10u %10u %10u\n",
  451. "beacon_rssi_b:",
  452. le32_to_cpu(general->beacon_rssi_b),
  453. accum_general->beacon_rssi_b,
  454. delta_general->beacon_rssi_b,
  455. max_general->beacon_rssi_b);
  456. pos += scnprintf(buf + pos, bufsz - pos,
  457. " %-30s %10u %10u %10u %10u\n",
  458. "beacon_rssi_c:",
  459. le32_to_cpu(general->beacon_rssi_c),
  460. accum_general->beacon_rssi_c,
  461. delta_general->beacon_rssi_c,
  462. max_general->beacon_rssi_c);
  463. pos += scnprintf(buf + pos, bufsz - pos,
  464. " %-30s %10u %10u %10u %10u\n",
  465. "beacon_energy_a:",
  466. le32_to_cpu(general->beacon_energy_a),
  467. accum_general->beacon_energy_a,
  468. delta_general->beacon_energy_a,
  469. max_general->beacon_energy_a);
  470. pos += scnprintf(buf + pos, bufsz - pos,
  471. " %-30s %10u %10u %10u %10u\n",
  472. "beacon_energy_b:",
  473. le32_to_cpu(general->beacon_energy_b),
  474. accum_general->beacon_energy_b,
  475. delta_general->beacon_energy_b,
  476. max_general->beacon_energy_b);
  477. pos += scnprintf(buf + pos, bufsz - pos,
  478. " %-30s %10u %10u %10u %10u\n",
  479. "beacon_energy_c:",
  480. le32_to_cpu(general->beacon_energy_c),
  481. accum_general->beacon_energy_c,
  482. delta_general->beacon_energy_c,
  483. max_general->beacon_energy_c);
  484. pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM_HT:\n");
  485. pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
  486. "acumulative delta max\n",
  487. "Statistics_Rx - OFDM_HT:");
  488. pos += scnprintf(buf + pos, bufsz - pos,
  489. " %-30s %10u %10u %10u %10u\n",
  490. "plcp_err:",
  491. le32_to_cpu(ht->plcp_err), accum_ht->plcp_err,
  492. delta_ht->plcp_err, max_ht->plcp_err);
  493. pos += scnprintf(buf + pos, bufsz - pos,
  494. " %-30s %10u %10u %10u %10u\n",
  495. "overrun_err:",
  496. le32_to_cpu(ht->overrun_err), accum_ht->overrun_err,
  497. delta_ht->overrun_err, max_ht->overrun_err);
  498. pos += scnprintf(buf + pos, bufsz - pos,
  499. " %-30s %10u %10u %10u %10u\n",
  500. "early_overrun_err:",
  501. le32_to_cpu(ht->early_overrun_err),
  502. accum_ht->early_overrun_err,
  503. delta_ht->early_overrun_err,
  504. max_ht->early_overrun_err);
  505. pos += scnprintf(buf + pos, bufsz - pos,
  506. " %-30s %10u %10u %10u %10u\n",
  507. "crc32_good:",
  508. le32_to_cpu(ht->crc32_good), accum_ht->crc32_good,
  509. delta_ht->crc32_good, max_ht->crc32_good);
  510. pos += scnprintf(buf + pos, bufsz - pos,
  511. " %-30s %10u %10u %10u %10u\n",
  512. "crc32_err:",
  513. le32_to_cpu(ht->crc32_err), accum_ht->crc32_err,
  514. delta_ht->crc32_err, max_ht->crc32_err);
  515. pos += scnprintf(buf + pos, bufsz - pos,
  516. " %-30s %10u %10u %10u %10u\n",
  517. "mh_format_err:",
  518. le32_to_cpu(ht->mh_format_err),
  519. accum_ht->mh_format_err,
  520. delta_ht->mh_format_err, max_ht->mh_format_err);
  521. pos += scnprintf(buf + pos, bufsz - pos,
  522. " %-30s %10u %10u %10u %10u\n",
  523. "agg_crc32_good:",
  524. le32_to_cpu(ht->agg_crc32_good),
  525. accum_ht->agg_crc32_good,
  526. delta_ht->agg_crc32_good, max_ht->agg_crc32_good);
  527. pos += scnprintf(buf + pos, bufsz - pos,
  528. " %-30s %10u %10u %10u %10u\n",
  529. "agg_mpdu_cnt:",
  530. le32_to_cpu(ht->agg_mpdu_cnt),
  531. accum_ht->agg_mpdu_cnt,
  532. delta_ht->agg_mpdu_cnt, max_ht->agg_mpdu_cnt);
  533. pos += scnprintf(buf + pos, bufsz - pos,
  534. " %-30s %10u %10u %10u %10u\n",
  535. "agg_cnt:",
  536. le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt,
  537. delta_ht->agg_cnt, max_ht->agg_cnt);
  538. pos += scnprintf(buf + pos, bufsz - pos,
  539. " %-30s %10u %10u %10u %10u\n",
  540. "unsupport_mcs:",
  541. le32_to_cpu(ht->unsupport_mcs),
  542. accum_ht->unsupport_mcs,
  543. delta_ht->unsupport_mcs, max_ht->unsupport_mcs);
  544. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  545. kfree(buf);
  546. return ret;
  547. }
  548. ssize_t iwl_ucode_tx_stats_read(struct file *file,
  549. char __user *user_buf,
  550. size_t count, loff_t *ppos)
  551. {
  552. struct iwl_priv *priv = file->private_data;
  553. int pos = 0;
  554. char *buf;
  555. int bufsz = (sizeof(struct statistics_tx) * 48) + 250;
  556. ssize_t ret;
  557. struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
  558. if (!iwl_is_alive(priv))
  559. return -EAGAIN;
  560. buf = kzalloc(bufsz, GFP_KERNEL);
  561. if (!buf) {
  562. IWL_ERR(priv, "Can not allocate Buffer\n");
  563. return -ENOMEM;
  564. }
  565. /* the statistic information display here is based on
  566. * the last statistics notification from uCode
  567. * might not reflect the current uCode activity
  568. */
  569. if (priv->cfg->bt_statistics) {
  570. tx = &priv->_agn.statistics_bt.tx;
  571. accum_tx = &priv->_agn.accum_statistics_bt.tx;
  572. delta_tx = &priv->_agn.delta_statistics_bt.tx;
  573. max_tx = &priv->_agn.max_delta_bt.tx;
  574. } else {
  575. tx = &priv->_agn.statistics.tx;
  576. accum_tx = &priv->_agn.accum_statistics.tx;
  577. delta_tx = &priv->_agn.delta_statistics.tx;
  578. max_tx = &priv->_agn.max_delta.tx;
  579. }
  580. pos += iwl_statistics_flag(priv, buf, bufsz);
  581. pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
  582. "acumulative delta max\n",
  583. "Statistics_Tx:");
  584. pos += scnprintf(buf + pos, bufsz - pos,
  585. " %-30s %10u %10u %10u %10u\n",
  586. "preamble:",
  587. le32_to_cpu(tx->preamble_cnt),
  588. accum_tx->preamble_cnt,
  589. delta_tx->preamble_cnt, max_tx->preamble_cnt);
  590. pos += scnprintf(buf + pos, bufsz - pos,
  591. " %-30s %10u %10u %10u %10u\n",
  592. "rx_detected_cnt:",
  593. le32_to_cpu(tx->rx_detected_cnt),
  594. accum_tx->rx_detected_cnt,
  595. delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt);
  596. pos += scnprintf(buf + pos, bufsz - pos,
  597. " %-30s %10u %10u %10u %10u\n",
  598. "bt_prio_defer_cnt:",
  599. le32_to_cpu(tx->bt_prio_defer_cnt),
  600. accum_tx->bt_prio_defer_cnt,
  601. delta_tx->bt_prio_defer_cnt,
  602. max_tx->bt_prio_defer_cnt);
  603. pos += scnprintf(buf + pos, bufsz - pos,
  604. " %-30s %10u %10u %10u %10u\n",
  605. "bt_prio_kill_cnt:",
  606. le32_to_cpu(tx->bt_prio_kill_cnt),
  607. accum_tx->bt_prio_kill_cnt,
  608. delta_tx->bt_prio_kill_cnt,
  609. max_tx->bt_prio_kill_cnt);
  610. pos += scnprintf(buf + pos, bufsz - pos,
  611. " %-30s %10u %10u %10u %10u\n",
  612. "few_bytes_cnt:",
  613. le32_to_cpu(tx->few_bytes_cnt),
  614. accum_tx->few_bytes_cnt,
  615. delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt);
  616. pos += scnprintf(buf + pos, bufsz - pos,
  617. " %-30s %10u %10u %10u %10u\n",
  618. "cts_timeout:",
  619. le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout,
  620. delta_tx->cts_timeout, max_tx->cts_timeout);
  621. pos += scnprintf(buf + pos, bufsz - pos,
  622. " %-30s %10u %10u %10u %10u\n",
  623. "ack_timeout:",
  624. le32_to_cpu(tx->ack_timeout),
  625. accum_tx->ack_timeout,
  626. delta_tx->ack_timeout, max_tx->ack_timeout);
  627. pos += scnprintf(buf + pos, bufsz - pos,
  628. " %-30s %10u %10u %10u %10u\n",
  629. "expected_ack_cnt:",
  630. le32_to_cpu(tx->expected_ack_cnt),
  631. accum_tx->expected_ack_cnt,
  632. delta_tx->expected_ack_cnt,
  633. max_tx->expected_ack_cnt);
  634. pos += scnprintf(buf + pos, bufsz - pos,
  635. " %-30s %10u %10u %10u %10u\n",
  636. "actual_ack_cnt:",
  637. le32_to_cpu(tx->actual_ack_cnt),
  638. accum_tx->actual_ack_cnt,
  639. delta_tx->actual_ack_cnt,
  640. max_tx->actual_ack_cnt);
  641. pos += scnprintf(buf + pos, bufsz - pos,
  642. " %-30s %10u %10u %10u %10u\n",
  643. "dump_msdu_cnt:",
  644. le32_to_cpu(tx->dump_msdu_cnt),
  645. accum_tx->dump_msdu_cnt,
  646. delta_tx->dump_msdu_cnt,
  647. max_tx->dump_msdu_cnt);
  648. pos += scnprintf(buf + pos, bufsz - pos,
  649. " %-30s %10u %10u %10u %10u\n",
  650. "abort_nxt_frame_mismatch:",
  651. le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt),
  652. accum_tx->burst_abort_next_frame_mismatch_cnt,
  653. delta_tx->burst_abort_next_frame_mismatch_cnt,
  654. max_tx->burst_abort_next_frame_mismatch_cnt);
  655. pos += scnprintf(buf + pos, bufsz - pos,
  656. " %-30s %10u %10u %10u %10u\n",
  657. "abort_missing_nxt_frame:",
  658. le32_to_cpu(tx->burst_abort_missing_next_frame_cnt),
  659. accum_tx->burst_abort_missing_next_frame_cnt,
  660. delta_tx->burst_abort_missing_next_frame_cnt,
  661. max_tx->burst_abort_missing_next_frame_cnt);
  662. pos += scnprintf(buf + pos, bufsz - pos,
  663. " %-30s %10u %10u %10u %10u\n",
  664. "cts_timeout_collision:",
  665. le32_to_cpu(tx->cts_timeout_collision),
  666. accum_tx->cts_timeout_collision,
  667. delta_tx->cts_timeout_collision,
  668. max_tx->cts_timeout_collision);
  669. pos += scnprintf(buf + pos, bufsz - pos,
  670. " %-30s %10u %10u %10u %10u\n",
  671. "ack_ba_timeout_collision:",
  672. le32_to_cpu(tx->ack_or_ba_timeout_collision),
  673. accum_tx->ack_or_ba_timeout_collision,
  674. delta_tx->ack_or_ba_timeout_collision,
  675. max_tx->ack_or_ba_timeout_collision);
  676. pos += scnprintf(buf + pos, bufsz - pos,
  677. " %-30s %10u %10u %10u %10u\n",
  678. "agg ba_timeout:",
  679. le32_to_cpu(tx->agg.ba_timeout),
  680. accum_tx->agg.ba_timeout,
  681. delta_tx->agg.ba_timeout,
  682. max_tx->agg.ba_timeout);
  683. pos += scnprintf(buf + pos, bufsz - pos,
  684. " %-30s %10u %10u %10u %10u\n",
  685. "agg ba_resched_frames:",
  686. le32_to_cpu(tx->agg.ba_reschedule_frames),
  687. accum_tx->agg.ba_reschedule_frames,
  688. delta_tx->agg.ba_reschedule_frames,
  689. max_tx->agg.ba_reschedule_frames);
  690. pos += scnprintf(buf + pos, bufsz - pos,
  691. " %-30s %10u %10u %10u %10u\n",
  692. "agg scd_query_agg_frame:",
  693. le32_to_cpu(tx->agg.scd_query_agg_frame_cnt),
  694. accum_tx->agg.scd_query_agg_frame_cnt,
  695. delta_tx->agg.scd_query_agg_frame_cnt,
  696. max_tx->agg.scd_query_agg_frame_cnt);
  697. pos += scnprintf(buf + pos, bufsz - pos,
  698. " %-30s %10u %10u %10u %10u\n",
  699. "agg scd_query_no_agg:",
  700. le32_to_cpu(tx->agg.scd_query_no_agg),
  701. accum_tx->agg.scd_query_no_agg,
  702. delta_tx->agg.scd_query_no_agg,
  703. max_tx->agg.scd_query_no_agg);
  704. pos += scnprintf(buf + pos, bufsz - pos,
  705. " %-30s %10u %10u %10u %10u\n",
  706. "agg scd_query_agg:",
  707. le32_to_cpu(tx->agg.scd_query_agg),
  708. accum_tx->agg.scd_query_agg,
  709. delta_tx->agg.scd_query_agg,
  710. max_tx->agg.scd_query_agg);
  711. pos += scnprintf(buf + pos, bufsz - pos,
  712. " %-30s %10u %10u %10u %10u\n",
  713. "agg scd_query_mismatch:",
  714. le32_to_cpu(tx->agg.scd_query_mismatch),
  715. accum_tx->agg.scd_query_mismatch,
  716. delta_tx->agg.scd_query_mismatch,
  717. max_tx->agg.scd_query_mismatch);
  718. pos += scnprintf(buf + pos, bufsz - pos,
  719. " %-30s %10u %10u %10u %10u\n",
  720. "agg frame_not_ready:",
  721. le32_to_cpu(tx->agg.frame_not_ready),
  722. accum_tx->agg.frame_not_ready,
  723. delta_tx->agg.frame_not_ready,
  724. max_tx->agg.frame_not_ready);
  725. pos += scnprintf(buf + pos, bufsz - pos,
  726. " %-30s %10u %10u %10u %10u\n",
  727. "agg underrun:",
  728. le32_to_cpu(tx->agg.underrun),
  729. accum_tx->agg.underrun,
  730. delta_tx->agg.underrun, max_tx->agg.underrun);
  731. pos += scnprintf(buf + pos, bufsz - pos,
  732. " %-30s %10u %10u %10u %10u\n",
  733. "agg bt_prio_kill:",
  734. le32_to_cpu(tx->agg.bt_prio_kill),
  735. accum_tx->agg.bt_prio_kill,
  736. delta_tx->agg.bt_prio_kill,
  737. max_tx->agg.bt_prio_kill);
  738. pos += scnprintf(buf + pos, bufsz - pos,
  739. " %-30s %10u %10u %10u %10u\n",
  740. "agg rx_ba_rsp_cnt:",
  741. le32_to_cpu(tx->agg.rx_ba_rsp_cnt),
  742. accum_tx->agg.rx_ba_rsp_cnt,
  743. delta_tx->agg.rx_ba_rsp_cnt,
  744. max_tx->agg.rx_ba_rsp_cnt);
  745. if (tx->tx_power.ant_a || tx->tx_power.ant_b || tx->tx_power.ant_c) {
  746. pos += scnprintf(buf + pos, bufsz - pos,
  747. "tx power: (1/2 dB step)\n");
  748. if ((priv->cfg->valid_tx_ant & ANT_A) && tx->tx_power.ant_a)
  749. pos += scnprintf(buf + pos, bufsz - pos,
  750. "\tantenna A: 0x%X\n",
  751. tx->tx_power.ant_a);
  752. if ((priv->cfg->valid_tx_ant & ANT_B) && tx->tx_power.ant_b)
  753. pos += scnprintf(buf + pos, bufsz - pos,
  754. "\tantenna B: 0x%X\n",
  755. tx->tx_power.ant_b);
  756. if ((priv->cfg->valid_tx_ant & ANT_C) && tx->tx_power.ant_c)
  757. pos += scnprintf(buf + pos, bufsz - pos,
  758. "\tantenna C: 0x%X\n",
  759. tx->tx_power.ant_c);
  760. }
  761. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  762. kfree(buf);
  763. return ret;
  764. }
  765. ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf,
  766. size_t count, loff_t *ppos)
  767. {
  768. struct iwl_priv *priv = file->private_data;
  769. int pos = 0;
  770. char *buf;
  771. int bufsz = sizeof(struct statistics_general) * 10 + 300;
  772. ssize_t ret;
  773. struct statistics_general_common *general, *accum_general;
  774. struct statistics_general_common *delta_general, *max_general;
  775. struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
  776. struct statistics_div *div, *accum_div, *delta_div, *max_div;
  777. if (!iwl_is_alive(priv))
  778. return -EAGAIN;
  779. buf = kzalloc(bufsz, GFP_KERNEL);
  780. if (!buf) {
  781. IWL_ERR(priv, "Can not allocate Buffer\n");
  782. return -ENOMEM;
  783. }
  784. /* the statistic information display here is based on
  785. * the last statistics notification from uCode
  786. * might not reflect the current uCode activity
  787. */
  788. if (priv->cfg->bt_statistics) {
  789. general = &priv->_agn.statistics_bt.general.common;
  790. dbg = &priv->_agn.statistics_bt.general.common.dbg;
  791. div = &priv->_agn.statistics_bt.general.common.div;
  792. accum_general = &priv->_agn.accum_statistics_bt.general.common;
  793. accum_dbg = &priv->_agn.accum_statistics_bt.general.common.dbg;
  794. accum_div = &priv->_agn.accum_statistics_bt.general.common.div;
  795. delta_general = &priv->_agn.delta_statistics_bt.general.common;
  796. max_general = &priv->_agn.max_delta_bt.general.common;
  797. delta_dbg = &priv->_agn.delta_statistics_bt.general.common.dbg;
  798. max_dbg = &priv->_agn.max_delta_bt.general.common.dbg;
  799. delta_div = &priv->_agn.delta_statistics_bt.general.common.div;
  800. max_div = &priv->_agn.max_delta_bt.general.common.div;
  801. } else {
  802. general = &priv->_agn.statistics.general.common;
  803. dbg = &priv->_agn.statistics.general.common.dbg;
  804. div = &priv->_agn.statistics.general.common.div;
  805. accum_general = &priv->_agn.accum_statistics.general.common;
  806. accum_dbg = &priv->_agn.accum_statistics.general.common.dbg;
  807. accum_div = &priv->_agn.accum_statistics.general.common.div;
  808. delta_general = &priv->_agn.delta_statistics.general.common;
  809. max_general = &priv->_agn.max_delta.general.common;
  810. delta_dbg = &priv->_agn.delta_statistics.general.common.dbg;
  811. max_dbg = &priv->_agn.max_delta.general.common.dbg;
  812. delta_div = &priv->_agn.delta_statistics.general.common.div;
  813. max_div = &priv->_agn.max_delta.general.common.div;
  814. }
  815. pos += iwl_statistics_flag(priv, buf, bufsz);
  816. pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
  817. "acumulative delta max\n",
  818. "Statistics_General:");
  819. pos += scnprintf(buf + pos, bufsz - pos, " %-30s %10u\n",
  820. "temperature:",
  821. le32_to_cpu(general->temperature));
  822. pos += scnprintf(buf + pos, bufsz - pos, " %-30s %10u\n",
  823. "temperature_m:",
  824. le32_to_cpu(general->temperature_m));
  825. pos += scnprintf(buf + pos, bufsz - pos,
  826. " %-30s %10u %10u %10u %10u\n",
  827. "burst_check:",
  828. le32_to_cpu(dbg->burst_check),
  829. accum_dbg->burst_check,
  830. delta_dbg->burst_check, max_dbg->burst_check);
  831. pos += scnprintf(buf + pos, bufsz - pos,
  832. " %-30s %10u %10u %10u %10u\n",
  833. "burst_count:",
  834. le32_to_cpu(dbg->burst_count),
  835. accum_dbg->burst_count,
  836. delta_dbg->burst_count, max_dbg->burst_count);
  837. pos += scnprintf(buf + pos, bufsz - pos,
  838. " %-30s %10u %10u %10u %10u\n",
  839. "wait_for_silence_timeout_count:",
  840. le32_to_cpu(dbg->wait_for_silence_timeout_cnt),
  841. accum_dbg->wait_for_silence_timeout_cnt,
  842. delta_dbg->wait_for_silence_timeout_cnt,
  843. max_dbg->wait_for_silence_timeout_cnt);
  844. pos += scnprintf(buf + pos, bufsz - pos,
  845. " %-30s %10u %10u %10u %10u\n",
  846. "sleep_time:",
  847. le32_to_cpu(general->sleep_time),
  848. accum_general->sleep_time,
  849. delta_general->sleep_time, max_general->sleep_time);
  850. pos += scnprintf(buf + pos, bufsz - pos,
  851. " %-30s %10u %10u %10u %10u\n",
  852. "slots_out:",
  853. le32_to_cpu(general->slots_out),
  854. accum_general->slots_out,
  855. delta_general->slots_out, max_general->slots_out);
  856. pos += scnprintf(buf + pos, bufsz - pos,
  857. " %-30s %10u %10u %10u %10u\n",
  858. "slots_idle:",
  859. le32_to_cpu(general->slots_idle),
  860. accum_general->slots_idle,
  861. delta_general->slots_idle, max_general->slots_idle);
  862. pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp:\t\t\t%u\n",
  863. le32_to_cpu(general->ttl_timestamp));
  864. pos += scnprintf(buf + pos, bufsz - pos,
  865. " %-30s %10u %10u %10u %10u\n",
  866. "tx_on_a:",
  867. le32_to_cpu(div->tx_on_a), accum_div->tx_on_a,
  868. delta_div->tx_on_a, max_div->tx_on_a);
  869. pos += scnprintf(buf + pos, bufsz - pos,
  870. " %-30s %10u %10u %10u %10u\n",
  871. "tx_on_b:",
  872. le32_to_cpu(div->tx_on_b), accum_div->tx_on_b,
  873. delta_div->tx_on_b, max_div->tx_on_b);
  874. pos += scnprintf(buf + pos, bufsz - pos,
  875. " %-30s %10u %10u %10u %10u\n",
  876. "exec_time:",
  877. le32_to_cpu(div->exec_time), accum_div->exec_time,
  878. delta_div->exec_time, max_div->exec_time);
  879. pos += scnprintf(buf + pos, bufsz - pos,
  880. " %-30s %10u %10u %10u %10u\n",
  881. "probe_time:",
  882. le32_to_cpu(div->probe_time), accum_div->probe_time,
  883. delta_div->probe_time, max_div->probe_time);
  884. pos += scnprintf(buf + pos, bufsz - pos,
  885. " %-30s %10u %10u %10u %10u\n",
  886. "rx_enable_counter:",
  887. le32_to_cpu(general->rx_enable_counter),
  888. accum_general->rx_enable_counter,
  889. delta_general->rx_enable_counter,
  890. max_general->rx_enable_counter);
  891. pos += scnprintf(buf + pos, bufsz - pos,
  892. " %-30s %10u %10u %10u %10u\n",
  893. "num_of_sos_states:",
  894. le32_to_cpu(general->num_of_sos_states),
  895. accum_general->num_of_sos_states,
  896. delta_general->num_of_sos_states,
  897. max_general->num_of_sos_states);
  898. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  899. kfree(buf);
  900. return ret;
  901. }
  902. ssize_t iwl_ucode_bt_stats_read(struct file *file,
  903. char __user *user_buf,
  904. size_t count, loff_t *ppos)
  905. {
  906. struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
  907. int pos = 0;
  908. char *buf;
  909. int bufsz = (sizeof(struct statistics_bt_activity) * 24) + 200;
  910. ssize_t ret;
  911. struct statistics_bt_activity *bt, *accum_bt;
  912. if (!iwl_is_alive(priv))
  913. return -EAGAIN;
  914. /* make request to uCode to retrieve statistics information */
  915. mutex_lock(&priv->mutex);
  916. ret = iwl_send_statistics_request(priv, CMD_SYNC, false);
  917. mutex_unlock(&priv->mutex);
  918. if (ret) {
  919. IWL_ERR(priv,
  920. "Error sending statistics request: %zd\n", ret);
  921. return -EAGAIN;
  922. }
  923. buf = kzalloc(bufsz, GFP_KERNEL);
  924. if (!buf) {
  925. IWL_ERR(priv, "Can not allocate Buffer\n");
  926. return -ENOMEM;
  927. }
  928. /*
  929. * the statistic information display here is based on
  930. * the last statistics notification from uCode
  931. * might not reflect the current uCode activity
  932. */
  933. bt = &priv->_agn.statistics_bt.general.activity;
  934. accum_bt = &priv->_agn.accum_statistics_bt.general.activity;
  935. pos += iwl_statistics_flag(priv, buf, bufsz);
  936. pos += scnprintf(buf + pos, bufsz - pos, "Statistics_BT:\n");
  937. pos += scnprintf(buf + pos, bufsz - pos,
  938. "\t\t\tcurrent\t\t\taccumulative\n");
  939. pos += scnprintf(buf + pos, bufsz - pos,
  940. "hi_priority_tx_req_cnt:\t\t%u\t\t\t%u\n",
  941. le32_to_cpu(bt->hi_priority_tx_req_cnt),
  942. accum_bt->hi_priority_tx_req_cnt);
  943. pos += scnprintf(buf + pos, bufsz - pos,
  944. "hi_priority_tx_denied_cnt:\t%u\t\t\t%u\n",
  945. le32_to_cpu(bt->hi_priority_tx_denied_cnt),
  946. accum_bt->hi_priority_tx_denied_cnt);
  947. pos += scnprintf(buf + pos, bufsz - pos,
  948. "lo_priority_tx_req_cnt:\t\t%u\t\t\t%u\n",
  949. le32_to_cpu(bt->lo_priority_tx_req_cnt),
  950. accum_bt->lo_priority_tx_req_cnt);
  951. pos += scnprintf(buf + pos, bufsz - pos,
  952. "lo_priority_tx_denied_cnt:\t%u\t\t\t%u\n",
  953. le32_to_cpu(bt->lo_priority_tx_denied_cnt),
  954. accum_bt->lo_priority_tx_denied_cnt);
  955. pos += scnprintf(buf + pos, bufsz - pos,
  956. "hi_priority_rx_req_cnt:\t\t%u\t\t\t%u\n",
  957. le32_to_cpu(bt->hi_priority_rx_req_cnt),
  958. accum_bt->hi_priority_rx_req_cnt);
  959. pos += scnprintf(buf + pos, bufsz - pos,
  960. "hi_priority_rx_denied_cnt:\t%u\t\t\t%u\n",
  961. le32_to_cpu(bt->hi_priority_rx_denied_cnt),
  962. accum_bt->hi_priority_rx_denied_cnt);
  963. pos += scnprintf(buf + pos, bufsz - pos,
  964. "lo_priority_rx_req_cnt:\t\t%u\t\t\t%u\n",
  965. le32_to_cpu(bt->lo_priority_rx_req_cnt),
  966. accum_bt->lo_priority_rx_req_cnt);
  967. pos += scnprintf(buf + pos, bufsz - pos,
  968. "lo_priority_rx_denied_cnt:\t%u\t\t\t%u\n",
  969. le32_to_cpu(bt->lo_priority_rx_denied_cnt),
  970. accum_bt->lo_priority_rx_denied_cnt);
  971. pos += scnprintf(buf + pos, bufsz - pos,
  972. "(rx)num_bt_kills:\t\t%u\t\t\t%u\n",
  973. le32_to_cpu(priv->_agn.statistics_bt.rx.
  974. general.num_bt_kills),
  975. priv->_agn.accum_statistics_bt.rx.
  976. general.num_bt_kills);
  977. ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
  978. kfree(buf);
  979. return ret;
  980. }