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