1 /******************************************************************************
5 * Copyright(c) 2008 - 2011 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,
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 *****************************************************************************/
31 static const char *fmt_value
= " %-30s %10u\n";
32 static const char *fmt_table
= " %-30s %10u %10u %10u %10u\n";
33 static const char *fmt_header
=
34 "%-32s current cumulative delta max\n";
37 il4965_stats_flag(struct il_priv
*il
, char *buf
, int bufsz
)
42 flag
= le32_to_cpu(il
->_4965
.stats
.flag
);
44 p
+= scnprintf(buf
+ p
, bufsz
- p
, "Statistics Flag(0x%X):\n", flag
);
45 if (flag
& UCODE_STATS_CLEAR_MSK
)
46 p
+= scnprintf(buf
+ p
, bufsz
- p
,
47 "\tStatistics have been cleared\n");
48 p
+= scnprintf(buf
+ p
, bufsz
- p
, "\tOperational Frequency: %s\n",
49 (flag
& UCODE_STATS_FREQUENCY_MSK
) ? "2.4 GHz" :
51 p
+= scnprintf(buf
+ p
, bufsz
- p
, "\tTGj Narrow Band: %s\n",
52 (flag
& UCODE_STATS_NARROW_BAND_MSK
) ? "enabled" :
59 il4965_ucode_rx_stats_read(struct file
*file
, char __user
*user_buf
,
60 size_t count
, loff_t
*ppos
)
62 struct il_priv
*il
= file
->private_data
;
66 sizeof(struct stats_rx_phy
) * 40 +
67 sizeof(struct stats_rx_non_phy
) * 40 +
68 sizeof(struct stats_rx_ht_phy
) * 40 + 400;
70 struct stats_rx_phy
*ofdm
, *accum_ofdm
, *delta_ofdm
, *max_ofdm
;
71 struct stats_rx_phy
*cck
, *accum_cck
, *delta_cck
, *max_cck
;
72 struct stats_rx_non_phy
*general
, *accum_general
;
73 struct stats_rx_non_phy
*delta_general
, *max_general
;
74 struct stats_rx_ht_phy
*ht
, *accum_ht
, *delta_ht
, *max_ht
;
79 buf
= kzalloc(bufsz
, GFP_KERNEL
);
81 IL_ERR("Can not allocate Buffer\n");
86 * the statistic information display here is based on
87 * the last stats notification from uCode
88 * might not reflect the current uCode activity
90 ofdm
= &il
->_4965
.stats
.rx
.ofdm
;
91 cck
= &il
->_4965
.stats
.rx
.cck
;
92 general
= &il
->_4965
.stats
.rx
.general
;
93 ht
= &il
->_4965
.stats
.rx
.ofdm_ht
;
94 accum_ofdm
= &il
->_4965
.accum_stats
.rx
.ofdm
;
95 accum_cck
= &il
->_4965
.accum_stats
.rx
.cck
;
96 accum_general
= &il
->_4965
.accum_stats
.rx
.general
;
97 accum_ht
= &il
->_4965
.accum_stats
.rx
.ofdm_ht
;
98 delta_ofdm
= &il
->_4965
.delta_stats
.rx
.ofdm
;
99 delta_cck
= &il
->_4965
.delta_stats
.rx
.cck
;
100 delta_general
= &il
->_4965
.delta_stats
.rx
.general
;
101 delta_ht
= &il
->_4965
.delta_stats
.rx
.ofdm_ht
;
102 max_ofdm
= &il
->_4965
.max_delta
.rx
.ofdm
;
103 max_cck
= &il
->_4965
.max_delta
.rx
.cck
;
104 max_general
= &il
->_4965
.max_delta
.rx
.general
;
105 max_ht
= &il
->_4965
.max_delta
.rx
.ofdm_ht
;
107 pos
+= il4965_stats_flag(il
, buf
, bufsz
);
109 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_header
,
110 "Statistics_Rx - OFDM:");
112 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "ina_cnt:",
113 le32_to_cpu(ofdm
->ina_cnt
), accum_ofdm
->ina_cnt
,
114 delta_ofdm
->ina_cnt
, max_ofdm
->ina_cnt
);
116 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "fina_cnt:",
117 le32_to_cpu(ofdm
->fina_cnt
), accum_ofdm
->fina_cnt
,
118 delta_ofdm
->fina_cnt
, max_ofdm
->fina_cnt
);
120 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "plcp_err:",
121 le32_to_cpu(ofdm
->plcp_err
), accum_ofdm
->plcp_err
,
122 delta_ofdm
->plcp_err
, max_ofdm
->plcp_err
);
124 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "crc32_err:",
125 le32_to_cpu(ofdm
->crc32_err
), accum_ofdm
->crc32_err
,
126 delta_ofdm
->crc32_err
, max_ofdm
->crc32_err
);
128 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "overrun_err:",
129 le32_to_cpu(ofdm
->overrun_err
), accum_ofdm
->overrun_err
,
130 delta_ofdm
->overrun_err
, max_ofdm
->overrun_err
);
132 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "early_overrun_err:",
133 le32_to_cpu(ofdm
->early_overrun_err
),
134 accum_ofdm
->early_overrun_err
,
135 delta_ofdm
->early_overrun_err
,
136 max_ofdm
->early_overrun_err
);
138 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "crc32_good:",
139 le32_to_cpu(ofdm
->crc32_good
), accum_ofdm
->crc32_good
,
140 delta_ofdm
->crc32_good
, max_ofdm
->crc32_good
);
142 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "false_alarm_cnt:",
143 le32_to_cpu(ofdm
->false_alarm_cnt
),
144 accum_ofdm
->false_alarm_cnt
, delta_ofdm
->false_alarm_cnt
,
145 max_ofdm
->false_alarm_cnt
);
147 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "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
);
153 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "sfd_timeout:",
154 le32_to_cpu(ofdm
->sfd_timeout
), accum_ofdm
->sfd_timeout
,
155 delta_ofdm
->sfd_timeout
, max_ofdm
->sfd_timeout
);
157 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "fina_timeout:",
158 le32_to_cpu(ofdm
->fina_timeout
), accum_ofdm
->fina_timeout
,
159 delta_ofdm
->fina_timeout
, max_ofdm
->fina_timeout
);
161 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "unresponded_rts:",
162 le32_to_cpu(ofdm
->unresponded_rts
),
163 accum_ofdm
->unresponded_rts
, delta_ofdm
->unresponded_rts
,
164 max_ofdm
->unresponded_rts
);
166 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "rxe_frame_lmt_ovrun:",
167 le32_to_cpu(ofdm
->rxe_frame_limit_overrun
),
168 accum_ofdm
->rxe_frame_limit_overrun
,
169 delta_ofdm
->rxe_frame_limit_overrun
,
170 max_ofdm
->rxe_frame_limit_overrun
);
172 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "sent_ack_cnt:",
173 le32_to_cpu(ofdm
->sent_ack_cnt
), accum_ofdm
->sent_ack_cnt
,
174 delta_ofdm
->sent_ack_cnt
, max_ofdm
->sent_ack_cnt
);
176 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "sent_cts_cnt:",
177 le32_to_cpu(ofdm
->sent_cts_cnt
), accum_ofdm
->sent_cts_cnt
,
178 delta_ofdm
->sent_cts_cnt
, max_ofdm
->sent_cts_cnt
);
180 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "sent_ba_rsp_cnt:",
181 le32_to_cpu(ofdm
->sent_ba_rsp_cnt
),
182 accum_ofdm
->sent_ba_rsp_cnt
, delta_ofdm
->sent_ba_rsp_cnt
,
183 max_ofdm
->sent_ba_rsp_cnt
);
185 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "dsp_self_kill:",
186 le32_to_cpu(ofdm
->dsp_self_kill
),
187 accum_ofdm
->dsp_self_kill
, delta_ofdm
->dsp_self_kill
,
188 max_ofdm
->dsp_self_kill
);
190 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "mh_format_err:",
191 le32_to_cpu(ofdm
->mh_format_err
),
192 accum_ofdm
->mh_format_err
, delta_ofdm
->mh_format_err
,
193 max_ofdm
->mh_format_err
);
195 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
196 "re_acq_main_rssi_sum:",
197 le32_to_cpu(ofdm
->re_acq_main_rssi_sum
),
198 accum_ofdm
->re_acq_main_rssi_sum
,
199 delta_ofdm
->re_acq_main_rssi_sum
,
200 max_ofdm
->re_acq_main_rssi_sum
);
203 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_header
,
204 "Statistics_Rx - CCK:");
206 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "ina_cnt:",
207 le32_to_cpu(cck
->ina_cnt
), accum_cck
->ina_cnt
,
208 delta_cck
->ina_cnt
, max_cck
->ina_cnt
);
210 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "fina_cnt:",
211 le32_to_cpu(cck
->fina_cnt
), accum_cck
->fina_cnt
,
212 delta_cck
->fina_cnt
, max_cck
->fina_cnt
);
214 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "plcp_err:",
215 le32_to_cpu(cck
->plcp_err
), accum_cck
->plcp_err
,
216 delta_cck
->plcp_err
, max_cck
->plcp_err
);
218 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "crc32_err:",
219 le32_to_cpu(cck
->crc32_err
), accum_cck
->crc32_err
,
220 delta_cck
->crc32_err
, max_cck
->crc32_err
);
222 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "overrun_err:",
223 le32_to_cpu(cck
->overrun_err
), accum_cck
->overrun_err
,
224 delta_cck
->overrun_err
, max_cck
->overrun_err
);
226 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "early_overrun_err:",
227 le32_to_cpu(cck
->early_overrun_err
),
228 accum_cck
->early_overrun_err
,
229 delta_cck
->early_overrun_err
, max_cck
->early_overrun_err
);
231 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "crc32_good:",
232 le32_to_cpu(cck
->crc32_good
), accum_cck
->crc32_good
,
233 delta_cck
->crc32_good
, max_cck
->crc32_good
);
235 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "false_alarm_cnt:",
236 le32_to_cpu(cck
->false_alarm_cnt
),
237 accum_cck
->false_alarm_cnt
, delta_cck
->false_alarm_cnt
,
238 max_cck
->false_alarm_cnt
);
240 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "fina_sync_err_cnt:",
241 le32_to_cpu(cck
->fina_sync_err_cnt
),
242 accum_cck
->fina_sync_err_cnt
,
243 delta_cck
->fina_sync_err_cnt
, max_cck
->fina_sync_err_cnt
);
245 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "sfd_timeout:",
246 le32_to_cpu(cck
->sfd_timeout
), accum_cck
->sfd_timeout
,
247 delta_cck
->sfd_timeout
, max_cck
->sfd_timeout
);
249 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "fina_timeout:",
250 le32_to_cpu(cck
->fina_timeout
), accum_cck
->fina_timeout
,
251 delta_cck
->fina_timeout
, max_cck
->fina_timeout
);
253 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "unresponded_rts:",
254 le32_to_cpu(cck
->unresponded_rts
),
255 accum_cck
->unresponded_rts
, delta_cck
->unresponded_rts
,
256 max_cck
->unresponded_rts
);
258 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "rxe_frame_lmt_ovrun:",
259 le32_to_cpu(cck
->rxe_frame_limit_overrun
),
260 accum_cck
->rxe_frame_limit_overrun
,
261 delta_cck
->rxe_frame_limit_overrun
,
262 max_cck
->rxe_frame_limit_overrun
);
264 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "sent_ack_cnt:",
265 le32_to_cpu(cck
->sent_ack_cnt
), accum_cck
->sent_ack_cnt
,
266 delta_cck
->sent_ack_cnt
, max_cck
->sent_ack_cnt
);
268 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "sent_cts_cnt:",
269 le32_to_cpu(cck
->sent_cts_cnt
), accum_cck
->sent_cts_cnt
,
270 delta_cck
->sent_cts_cnt
, max_cck
->sent_cts_cnt
);
272 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "sent_ba_rsp_cnt:",
273 le32_to_cpu(cck
->sent_ba_rsp_cnt
),
274 accum_cck
->sent_ba_rsp_cnt
, delta_cck
->sent_ba_rsp_cnt
,
275 max_cck
->sent_ba_rsp_cnt
);
277 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "dsp_self_kill:",
278 le32_to_cpu(cck
->dsp_self_kill
), accum_cck
->dsp_self_kill
,
279 delta_cck
->dsp_self_kill
, max_cck
->dsp_self_kill
);
281 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "mh_format_err:",
282 le32_to_cpu(cck
->mh_format_err
), accum_cck
->mh_format_err
,
283 delta_cck
->mh_format_err
, max_cck
->mh_format_err
);
285 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
286 "re_acq_main_rssi_sum:",
287 le32_to_cpu(cck
->re_acq_main_rssi_sum
),
288 accum_cck
->re_acq_main_rssi_sum
,
289 delta_cck
->re_acq_main_rssi_sum
,
290 max_cck
->re_acq_main_rssi_sum
);
293 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_header
,
294 "Statistics_Rx - GENERAL:");
296 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "bogus_cts:",
297 le32_to_cpu(general
->bogus_cts
), accum_general
->bogus_cts
,
298 delta_general
->bogus_cts
, max_general
->bogus_cts
);
300 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "bogus_ack:",
301 le32_to_cpu(general
->bogus_ack
), accum_general
->bogus_ack
,
302 delta_general
->bogus_ack
, max_general
->bogus_ack
);
304 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "non_bssid_frames:",
305 le32_to_cpu(general
->non_bssid_frames
),
306 accum_general
->non_bssid_frames
,
307 delta_general
->non_bssid_frames
,
308 max_general
->non_bssid_frames
);
310 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "filtered_frames:",
311 le32_to_cpu(general
->filtered_frames
),
312 accum_general
->filtered_frames
,
313 delta_general
->filtered_frames
,
314 max_general
->filtered_frames
);
316 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "non_channel_beacons:",
317 le32_to_cpu(general
->non_channel_beacons
),
318 accum_general
->non_channel_beacons
,
319 delta_general
->non_channel_beacons
,
320 max_general
->non_channel_beacons
);
322 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "channel_beacons:",
323 le32_to_cpu(general
->channel_beacons
),
324 accum_general
->channel_beacons
,
325 delta_general
->channel_beacons
,
326 max_general
->channel_beacons
);
328 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "num_missed_bcon:",
329 le32_to_cpu(general
->num_missed_bcon
),
330 accum_general
->num_missed_bcon
,
331 delta_general
->num_missed_bcon
,
332 max_general
->num_missed_bcon
);
334 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
335 "adc_rx_saturation_time:",
336 le32_to_cpu(general
->adc_rx_saturation_time
),
337 accum_general
->adc_rx_saturation_time
,
338 delta_general
->adc_rx_saturation_time
,
339 max_general
->adc_rx_saturation_time
);
341 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
342 "ina_detect_search_tm:",
343 le32_to_cpu(general
->ina_detection_search_time
),
344 accum_general
->ina_detection_search_time
,
345 delta_general
->ina_detection_search_time
,
346 max_general
->ina_detection_search_time
);
348 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
349 "beacon_silence_rssi_a:",
350 le32_to_cpu(general
->beacon_silence_rssi_a
),
351 accum_general
->beacon_silence_rssi_a
,
352 delta_general
->beacon_silence_rssi_a
,
353 max_general
->beacon_silence_rssi_a
);
355 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
356 "beacon_silence_rssi_b:",
357 le32_to_cpu(general
->beacon_silence_rssi_b
),
358 accum_general
->beacon_silence_rssi_b
,
359 delta_general
->beacon_silence_rssi_b
,
360 max_general
->beacon_silence_rssi_b
);
362 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
363 "beacon_silence_rssi_c:",
364 le32_to_cpu(general
->beacon_silence_rssi_c
),
365 accum_general
->beacon_silence_rssi_c
,
366 delta_general
->beacon_silence_rssi_c
,
367 max_general
->beacon_silence_rssi_c
);
369 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
370 "interference_data_flag:",
371 le32_to_cpu(general
->interference_data_flag
),
372 accum_general
->interference_data_flag
,
373 delta_general
->interference_data_flag
,
374 max_general
->interference_data_flag
);
376 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "channel_load:",
377 le32_to_cpu(general
->channel_load
),
378 accum_general
->channel_load
, delta_general
->channel_load
,
379 max_general
->channel_load
);
381 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "dsp_false_alarms:",
382 le32_to_cpu(general
->dsp_false_alarms
),
383 accum_general
->dsp_false_alarms
,
384 delta_general
->dsp_false_alarms
,
385 max_general
->dsp_false_alarms
);
387 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "beacon_rssi_a:",
388 le32_to_cpu(general
->beacon_rssi_a
),
389 accum_general
->beacon_rssi_a
,
390 delta_general
->beacon_rssi_a
, max_general
->beacon_rssi_a
);
392 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "beacon_rssi_b:",
393 le32_to_cpu(general
->beacon_rssi_b
),
394 accum_general
->beacon_rssi_b
,
395 delta_general
->beacon_rssi_b
, max_general
->beacon_rssi_b
);
397 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "beacon_rssi_c:",
398 le32_to_cpu(general
->beacon_rssi_c
),
399 accum_general
->beacon_rssi_c
,
400 delta_general
->beacon_rssi_c
, max_general
->beacon_rssi_c
);
402 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "beacon_energy_a:",
403 le32_to_cpu(general
->beacon_energy_a
),
404 accum_general
->beacon_energy_a
,
405 delta_general
->beacon_energy_a
,
406 max_general
->beacon_energy_a
);
408 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "beacon_energy_b:",
409 le32_to_cpu(general
->beacon_energy_b
),
410 accum_general
->beacon_energy_b
,
411 delta_general
->beacon_energy_b
,
412 max_general
->beacon_energy_b
);
414 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "beacon_energy_c:",
415 le32_to_cpu(general
->beacon_energy_c
),
416 accum_general
->beacon_energy_c
,
417 delta_general
->beacon_energy_c
,
418 max_general
->beacon_energy_c
);
421 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_header
,
422 "Statistics_Rx - OFDM_HT:");
424 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "plcp_err:",
425 le32_to_cpu(ht
->plcp_err
), accum_ht
->plcp_err
,
426 delta_ht
->plcp_err
, max_ht
->plcp_err
);
428 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "overrun_err:",
429 le32_to_cpu(ht
->overrun_err
), accum_ht
->overrun_err
,
430 delta_ht
->overrun_err
, max_ht
->overrun_err
);
432 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "early_overrun_err:",
433 le32_to_cpu(ht
->early_overrun_err
),
434 accum_ht
->early_overrun_err
, delta_ht
->early_overrun_err
,
435 max_ht
->early_overrun_err
);
437 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "crc32_good:",
438 le32_to_cpu(ht
->crc32_good
), accum_ht
->crc32_good
,
439 delta_ht
->crc32_good
, max_ht
->crc32_good
);
441 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "crc32_err:",
442 le32_to_cpu(ht
->crc32_err
), accum_ht
->crc32_err
,
443 delta_ht
->crc32_err
, max_ht
->crc32_err
);
445 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "mh_format_err:",
446 le32_to_cpu(ht
->mh_format_err
), accum_ht
->mh_format_err
,
447 delta_ht
->mh_format_err
, max_ht
->mh_format_err
);
449 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "agg_crc32_good:",
450 le32_to_cpu(ht
->agg_crc32_good
), accum_ht
->agg_crc32_good
,
451 delta_ht
->agg_crc32_good
, max_ht
->agg_crc32_good
);
453 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "agg_mpdu_cnt:",
454 le32_to_cpu(ht
->agg_mpdu_cnt
), accum_ht
->agg_mpdu_cnt
,
455 delta_ht
->agg_mpdu_cnt
, max_ht
->agg_mpdu_cnt
);
457 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "agg_cnt:",
458 le32_to_cpu(ht
->agg_cnt
), accum_ht
->agg_cnt
,
459 delta_ht
->agg_cnt
, max_ht
->agg_cnt
);
461 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "unsupport_mcs:",
462 le32_to_cpu(ht
->unsupport_mcs
), accum_ht
->unsupport_mcs
,
463 delta_ht
->unsupport_mcs
, max_ht
->unsupport_mcs
);
465 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
471 il4965_ucode_tx_stats_read(struct file
*file
, char __user
*user_buf
,
472 size_t count
, loff_t
*ppos
)
474 struct il_priv
*il
= file
->private_data
;
477 int bufsz
= (sizeof(struct stats_tx
) * 48) + 250;
479 struct stats_tx
*tx
, *accum_tx
, *delta_tx
, *max_tx
;
481 if (!il_is_alive(il
))
484 buf
= kzalloc(bufsz
, GFP_KERNEL
);
486 IL_ERR("Can not allocate Buffer\n");
490 /* the statistic information display here is based on
491 * the last stats notification from uCode
492 * might not reflect the current uCode activity
494 tx
= &il
->_4965
.stats
.tx
;
495 accum_tx
= &il
->_4965
.accum_stats
.tx
;
496 delta_tx
= &il
->_4965
.delta_stats
.tx
;
497 max_tx
= &il
->_4965
.max_delta
.tx
;
499 pos
+= il4965_stats_flag(il
, buf
, bufsz
);
500 pos
+= scnprintf(buf
+ pos
, bufsz
- pos
, fmt_header
, "Statistics_Tx:");
502 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "preamble:",
503 le32_to_cpu(tx
->preamble_cnt
), accum_tx
->preamble_cnt
,
504 delta_tx
->preamble_cnt
, max_tx
->preamble_cnt
);
506 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "rx_detected_cnt:",
507 le32_to_cpu(tx
->rx_detected_cnt
),
508 accum_tx
->rx_detected_cnt
, delta_tx
->rx_detected_cnt
,
509 max_tx
->rx_detected_cnt
);
511 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "bt_prio_defer_cnt:",
512 le32_to_cpu(tx
->bt_prio_defer_cnt
),
513 accum_tx
->bt_prio_defer_cnt
, delta_tx
->bt_prio_defer_cnt
,
514 max_tx
->bt_prio_defer_cnt
);
516 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "bt_prio_kill_cnt:",
517 le32_to_cpu(tx
->bt_prio_kill_cnt
),
518 accum_tx
->bt_prio_kill_cnt
, delta_tx
->bt_prio_kill_cnt
,
519 max_tx
->bt_prio_kill_cnt
);
521 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "few_bytes_cnt:",
522 le32_to_cpu(tx
->few_bytes_cnt
), accum_tx
->few_bytes_cnt
,
523 delta_tx
->few_bytes_cnt
, max_tx
->few_bytes_cnt
);
525 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "cts_timeout:",
526 le32_to_cpu(tx
->cts_timeout
), accum_tx
->cts_timeout
,
527 delta_tx
->cts_timeout
, max_tx
->cts_timeout
);
529 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "ack_timeout:",
530 le32_to_cpu(tx
->ack_timeout
), accum_tx
->ack_timeout
,
531 delta_tx
->ack_timeout
, max_tx
->ack_timeout
);
533 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "expected_ack_cnt:",
534 le32_to_cpu(tx
->expected_ack_cnt
),
535 accum_tx
->expected_ack_cnt
, delta_tx
->expected_ack_cnt
,
536 max_tx
->expected_ack_cnt
);
538 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "actual_ack_cnt:",
539 le32_to_cpu(tx
->actual_ack_cnt
), accum_tx
->actual_ack_cnt
,
540 delta_tx
->actual_ack_cnt
, max_tx
->actual_ack_cnt
);
542 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "dump_msdu_cnt:",
543 le32_to_cpu(tx
->dump_msdu_cnt
), accum_tx
->dump_msdu_cnt
,
544 delta_tx
->dump_msdu_cnt
, max_tx
->dump_msdu_cnt
);
546 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
547 "abort_nxt_frame_mismatch:",
548 le32_to_cpu(tx
->burst_abort_next_frame_mismatch_cnt
),
549 accum_tx
->burst_abort_next_frame_mismatch_cnt
,
550 delta_tx
->burst_abort_next_frame_mismatch_cnt
,
551 max_tx
->burst_abort_next_frame_mismatch_cnt
);
553 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
554 "abort_missing_nxt_frame:",
555 le32_to_cpu(tx
->burst_abort_missing_next_frame_cnt
),
556 accum_tx
->burst_abort_missing_next_frame_cnt
,
557 delta_tx
->burst_abort_missing_next_frame_cnt
,
558 max_tx
->burst_abort_missing_next_frame_cnt
);
560 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
561 "cts_timeout_collision:",
562 le32_to_cpu(tx
->cts_timeout_collision
),
563 accum_tx
->cts_timeout_collision
,
564 delta_tx
->cts_timeout_collision
,
565 max_tx
->cts_timeout_collision
);
567 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
568 "ack_ba_timeout_collision:",
569 le32_to_cpu(tx
->ack_or_ba_timeout_collision
),
570 accum_tx
->ack_or_ba_timeout_collision
,
571 delta_tx
->ack_or_ba_timeout_collision
,
572 max_tx
->ack_or_ba_timeout_collision
);
574 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "agg ba_timeout:",
575 le32_to_cpu(tx
->agg
.ba_timeout
), accum_tx
->agg
.ba_timeout
,
576 delta_tx
->agg
.ba_timeout
, max_tx
->agg
.ba_timeout
);
578 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
579 "agg ba_resched_frames:",
580 le32_to_cpu(tx
->agg
.ba_reschedule_frames
),
581 accum_tx
->agg
.ba_reschedule_frames
,
582 delta_tx
->agg
.ba_reschedule_frames
,
583 max_tx
->agg
.ba_reschedule_frames
);
585 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
586 "agg scd_query_agg_frame:",
587 le32_to_cpu(tx
->agg
.scd_query_agg_frame_cnt
),
588 accum_tx
->agg
.scd_query_agg_frame_cnt
,
589 delta_tx
->agg
.scd_query_agg_frame_cnt
,
590 max_tx
->agg
.scd_query_agg_frame_cnt
);
592 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
593 "agg scd_query_no_agg:",
594 le32_to_cpu(tx
->agg
.scd_query_no_agg
),
595 accum_tx
->agg
.scd_query_no_agg
,
596 delta_tx
->agg
.scd_query_no_agg
,
597 max_tx
->agg
.scd_query_no_agg
);
599 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "agg scd_query_agg:",
600 le32_to_cpu(tx
->agg
.scd_query_agg
),
601 accum_tx
->agg
.scd_query_agg
, delta_tx
->agg
.scd_query_agg
,
602 max_tx
->agg
.scd_query_agg
);
604 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
605 "agg scd_query_mismatch:",
606 le32_to_cpu(tx
->agg
.scd_query_mismatch
),
607 accum_tx
->agg
.scd_query_mismatch
,
608 delta_tx
->agg
.scd_query_mismatch
,
609 max_tx
->agg
.scd_query_mismatch
);
611 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "agg frame_not_ready:",
612 le32_to_cpu(tx
->agg
.frame_not_ready
),
613 accum_tx
->agg
.frame_not_ready
,
614 delta_tx
->agg
.frame_not_ready
,
615 max_tx
->agg
.frame_not_ready
);
617 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "agg underrun:",
618 le32_to_cpu(tx
->agg
.underrun
), accum_tx
->agg
.underrun
,
619 delta_tx
->agg
.underrun
, max_tx
->agg
.underrun
);
621 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "agg bt_prio_kill:",
622 le32_to_cpu(tx
->agg
.bt_prio_kill
),
623 accum_tx
->agg
.bt_prio_kill
, delta_tx
->agg
.bt_prio_kill
,
624 max_tx
->agg
.bt_prio_kill
);
626 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "agg rx_ba_rsp_cnt:",
627 le32_to_cpu(tx
->agg
.rx_ba_rsp_cnt
),
628 accum_tx
->agg
.rx_ba_rsp_cnt
, delta_tx
->agg
.rx_ba_rsp_cnt
,
629 max_tx
->agg
.rx_ba_rsp_cnt
);
631 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
637 il4965_ucode_general_stats_read(struct file
*file
, char __user
*user_buf
,
638 size_t count
, loff_t
*ppos
)
640 struct il_priv
*il
= file
->private_data
;
643 int bufsz
= sizeof(struct stats_general
) * 10 + 300;
645 struct stats_general_common
*general
, *accum_general
;
646 struct stats_general_common
*delta_general
, *max_general
;
647 struct stats_dbg
*dbg
, *accum_dbg
, *delta_dbg
, *max_dbg
;
648 struct stats_div
*div
, *accum_div
, *delta_div
, *max_div
;
650 if (!il_is_alive(il
))
653 buf
= kzalloc(bufsz
, GFP_KERNEL
);
655 IL_ERR("Can not allocate Buffer\n");
659 /* the statistic information display here is based on
660 * the last stats notification from uCode
661 * might not reflect the current uCode activity
663 general
= &il
->_4965
.stats
.general
.common
;
664 dbg
= &il
->_4965
.stats
.general
.common
.dbg
;
665 div
= &il
->_4965
.stats
.general
.common
.div
;
666 accum_general
= &il
->_4965
.accum_stats
.general
.common
;
667 accum_dbg
= &il
->_4965
.accum_stats
.general
.common
.dbg
;
668 accum_div
= &il
->_4965
.accum_stats
.general
.common
.div
;
669 delta_general
= &il
->_4965
.delta_stats
.general
.common
;
670 max_general
= &il
->_4965
.max_delta
.general
.common
;
671 delta_dbg
= &il
->_4965
.delta_stats
.general
.common
.dbg
;
672 max_dbg
= &il
->_4965
.max_delta
.general
.common
.dbg
;
673 delta_div
= &il
->_4965
.delta_stats
.general
.common
.div
;
674 max_div
= &il
->_4965
.max_delta
.general
.common
.div
;
676 pos
+= il4965_stats_flag(il
, buf
, bufsz
);
678 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_header
,
679 "Statistics_General:");
681 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_value
, "temperature:",
682 le32_to_cpu(general
->temperature
));
684 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_value
, "ttl_timestamp:",
685 le32_to_cpu(general
->ttl_timestamp
));
687 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "burst_check:",
688 le32_to_cpu(dbg
->burst_check
), accum_dbg
->burst_check
,
689 delta_dbg
->burst_check
, max_dbg
->burst_check
);
691 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "burst_count:",
692 le32_to_cpu(dbg
->burst_count
), accum_dbg
->burst_count
,
693 delta_dbg
->burst_count
, max_dbg
->burst_count
);
695 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
,
696 "wait_for_silence_timeout_count:",
697 le32_to_cpu(dbg
->wait_for_silence_timeout_cnt
),
698 accum_dbg
->wait_for_silence_timeout_cnt
,
699 delta_dbg
->wait_for_silence_timeout_cnt
,
700 max_dbg
->wait_for_silence_timeout_cnt
);
702 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "sleep_time:",
703 le32_to_cpu(general
->sleep_time
),
704 accum_general
->sleep_time
, delta_general
->sleep_time
,
705 max_general
->sleep_time
);
707 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "slots_out:",
708 le32_to_cpu(general
->slots_out
), accum_general
->slots_out
,
709 delta_general
->slots_out
, max_general
->slots_out
);
711 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "slots_idle:",
712 le32_to_cpu(general
->slots_idle
),
713 accum_general
->slots_idle
, delta_general
->slots_idle
,
714 max_general
->slots_idle
);
716 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "tx_on_a:",
717 le32_to_cpu(div
->tx_on_a
), accum_div
->tx_on_a
,
718 delta_div
->tx_on_a
, max_div
->tx_on_a
);
720 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "tx_on_b:",
721 le32_to_cpu(div
->tx_on_b
), accum_div
->tx_on_b
,
722 delta_div
->tx_on_b
, max_div
->tx_on_b
);
724 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "exec_time:",
725 le32_to_cpu(div
->exec_time
), accum_div
->exec_time
,
726 delta_div
->exec_time
, max_div
->exec_time
);
728 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "probe_time:",
729 le32_to_cpu(div
->probe_time
), accum_div
->probe_time
,
730 delta_div
->probe_time
, max_div
->probe_time
);
732 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "rx_enable_counter:",
733 le32_to_cpu(general
->rx_enable_counter
),
734 accum_general
->rx_enable_counter
,
735 delta_general
->rx_enable_counter
,
736 max_general
->rx_enable_counter
);
738 scnprintf(buf
+ pos
, bufsz
- pos
, fmt_table
, "num_of_sos_states:",
739 le32_to_cpu(general
->num_of_sos_states
),
740 accum_general
->num_of_sos_states
,
741 delta_general
->num_of_sos_states
,
742 max_general
->num_of_sos_states
);
743 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, pos
);
748 const struct il_debugfs_ops il4965_debugfs_ops
= {
749 .rx_stats_read
= il4965_ucode_rx_stats_read
,
750 .tx_stats_read
= il4965_ucode_tx_stats_read
,
751 .general_stats_read
= il4965_ucode_general_stats_read
,