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