diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945-debugfs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-debugfs.c | 500 |
1 files changed, 500 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-3945-debugfs.c new file mode 100644 index 000000000000..6a9c64a50e36 --- /dev/null +++ b/drivers/net/wireless/iwlwifi/iwl-3945-debugfs.c | |||
@@ -0,0 +1,500 @@ | |||
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-3945-debugfs.h" | ||
30 | |||
31 | ssize_t iwl3945_ucode_rx_stats_read(struct file *file, | ||
32 | char __user *user_buf, | ||
33 | size_t count, loff_t *ppos) | ||
34 | { | ||
35 | struct iwl_priv *priv = file->private_data; | ||
36 | int pos = 0; | ||
37 | char *buf; | ||
38 | int bufsz = sizeof(struct iwl39_statistics_rx_phy) * 40 + | ||
39 | sizeof(struct iwl39_statistics_rx_non_phy) * 40 + 400; | ||
40 | ssize_t ret; | ||
41 | struct iwl39_statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm; | ||
42 | struct iwl39_statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck; | ||
43 | struct iwl39_statistics_rx_non_phy *general, *accum_general; | ||
44 | struct iwl39_statistics_rx_non_phy *delta_general, *max_general; | ||
45 | |||
46 | if (!iwl_is_alive(priv)) | ||
47 | return -EAGAIN; | ||
48 | |||
49 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
50 | if (!buf) { | ||
51 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
52 | return -ENOMEM; | ||
53 | } | ||
54 | |||
55 | /* | ||
56 | * The statistic information display here is based on | ||
57 | * the last statistics notification from uCode | ||
58 | * might not reflect the current uCode activity | ||
59 | */ | ||
60 | ofdm = &priv->_3945.statistics.rx.ofdm; | ||
61 | cck = &priv->_3945.statistics.rx.cck; | ||
62 | general = &priv->_3945.statistics.rx.general; | ||
63 | accum_ofdm = &priv->_3945.accum_statistics.rx.ofdm; | ||
64 | accum_cck = &priv->_3945.accum_statistics.rx.cck; | ||
65 | accum_general = &priv->_3945.accum_statistics.rx.general; | ||
66 | delta_ofdm = &priv->_3945.delta_statistics.rx.ofdm; | ||
67 | delta_cck = &priv->_3945.delta_statistics.rx.cck; | ||
68 | delta_general = &priv->_3945.delta_statistics.rx.general; | ||
69 | max_ofdm = &priv->_3945.max_delta.rx.ofdm; | ||
70 | max_cck = &priv->_3945.max_delta.rx.cck; | ||
71 | max_general = &priv->_3945.max_delta.rx.general; | ||
72 | |||
73 | pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz); | ||
74 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" | ||
75 | "acumulative delta max\n", | ||
76 | "Statistics_Rx - OFDM:"); | ||
77 | pos += scnprintf(buf + pos, bufsz - pos, | ||
78 | " %-30s %10u %10u %10u %10u\n", | ||
79 | "ina_cnt:", le32_to_cpu(ofdm->ina_cnt), | ||
80 | accum_ofdm->ina_cnt, | ||
81 | delta_ofdm->ina_cnt, max_ofdm->ina_cnt); | ||
82 | pos += scnprintf(buf + pos, bufsz - pos, | ||
83 | " %-30s %10u %10u %10u %10u\n", | ||
84 | "fina_cnt:", | ||
85 | le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt, | ||
86 | delta_ofdm->fina_cnt, max_ofdm->fina_cnt); | ||
87 | pos += scnprintf(buf + pos, bufsz - pos, | ||
88 | " %-30s %10u %10u %10u %10u\n", "plcp_err:", | ||
89 | le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err, | ||
90 | delta_ofdm->plcp_err, max_ofdm->plcp_err); | ||
91 | pos += scnprintf(buf + pos, bufsz - pos, | ||
92 | " %-30s %10u %10u %10u %10u\n", "crc32_err:", | ||
93 | le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err, | ||
94 | delta_ofdm->crc32_err, max_ofdm->crc32_err); | ||
95 | pos += scnprintf(buf + pos, bufsz - pos, | ||
96 | " %-30s %10u %10u %10u %10u\n", "overrun_err:", | ||
97 | le32_to_cpu(ofdm->overrun_err), | ||
98 | accum_ofdm->overrun_err, delta_ofdm->overrun_err, | ||
99 | max_ofdm->overrun_err); | ||
100 | pos += scnprintf(buf + pos, bufsz - pos, | ||
101 | " %-30s %10u %10u %10u %10u\n", | ||
102 | "early_overrun_err:", | ||
103 | le32_to_cpu(ofdm->early_overrun_err), | ||
104 | accum_ofdm->early_overrun_err, | ||
105 | delta_ofdm->early_overrun_err, | ||
106 | max_ofdm->early_overrun_err); | ||
107 | pos += scnprintf(buf + pos, bufsz - pos, | ||
108 | " %-30s %10u %10u %10u %10u\n", | ||
109 | "crc32_good:", le32_to_cpu(ofdm->crc32_good), | ||
110 | accum_ofdm->crc32_good, delta_ofdm->crc32_good, | ||
111 | max_ofdm->crc32_good); | ||
112 | pos += scnprintf(buf + pos, bufsz - pos, | ||
113 | " %-30s %10u %10u %10u %10u\n", "false_alarm_cnt:", | ||
114 | le32_to_cpu(ofdm->false_alarm_cnt), | ||
115 | accum_ofdm->false_alarm_cnt, | ||
116 | delta_ofdm->false_alarm_cnt, | ||
117 | max_ofdm->false_alarm_cnt); | ||
118 | pos += scnprintf(buf + pos, bufsz - pos, | ||
119 | " %-30s %10u %10u %10u %10u\n", | ||
120 | "fina_sync_err_cnt:", | ||
121 | le32_to_cpu(ofdm->fina_sync_err_cnt), | ||
122 | accum_ofdm->fina_sync_err_cnt, | ||
123 | delta_ofdm->fina_sync_err_cnt, | ||
124 | max_ofdm->fina_sync_err_cnt); | ||
125 | pos += scnprintf(buf + pos, bufsz - pos, | ||
126 | " %-30s %10u %10u %10u %10u\n", | ||
127 | "sfd_timeout:", | ||
128 | le32_to_cpu(ofdm->sfd_timeout), | ||
129 | accum_ofdm->sfd_timeout, | ||
130 | delta_ofdm->sfd_timeout, | ||
131 | max_ofdm->sfd_timeout); | ||
132 | pos += scnprintf(buf + pos, bufsz - pos, | ||
133 | " %-30s %10u %10u %10u %10u\n", | ||
134 | "fina_timeout:", | ||
135 | le32_to_cpu(ofdm->fina_timeout), | ||
136 | accum_ofdm->fina_timeout, | ||
137 | delta_ofdm->fina_timeout, | ||
138 | max_ofdm->fina_timeout); | ||
139 | pos += scnprintf(buf + pos, bufsz - pos, | ||
140 | " %-30s %10u %10u %10u %10u\n", | ||
141 | "unresponded_rts:", | ||
142 | le32_to_cpu(ofdm->unresponded_rts), | ||
143 | accum_ofdm->unresponded_rts, | ||
144 | delta_ofdm->unresponded_rts, | ||
145 | max_ofdm->unresponded_rts); | ||
146 | pos += scnprintf(buf + pos, bufsz - pos, | ||
147 | " %-30s %10u %10u %10u %10u\n", | ||
148 | "rxe_frame_lmt_ovrun:", | ||
149 | le32_to_cpu(ofdm->rxe_frame_limit_overrun), | ||
150 | accum_ofdm->rxe_frame_limit_overrun, | ||
151 | delta_ofdm->rxe_frame_limit_overrun, | ||
152 | max_ofdm->rxe_frame_limit_overrun); | ||
153 | pos += scnprintf(buf + pos, bufsz - pos, | ||
154 | " %-30s %10u %10u %10u %10u\n", | ||
155 | "sent_ack_cnt:", | ||
156 | le32_to_cpu(ofdm->sent_ack_cnt), | ||
157 | accum_ofdm->sent_ack_cnt, | ||
158 | delta_ofdm->sent_ack_cnt, | ||
159 | max_ofdm->sent_ack_cnt); | ||
160 | pos += scnprintf(buf + pos, bufsz - pos, | ||
161 | " %-30s %10u %10u %10u %10u\n", | ||
162 | "sent_cts_cnt:", | ||
163 | le32_to_cpu(ofdm->sent_cts_cnt), | ||
164 | accum_ofdm->sent_cts_cnt, | ||
165 | delta_ofdm->sent_cts_cnt, max_ofdm->sent_cts_cnt); | ||
166 | |||
167 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" | ||
168 | "acumulative delta max\n", | ||
169 | "Statistics_Rx - CCK:"); | ||
170 | pos += scnprintf(buf + pos, bufsz - pos, | ||
171 | " %-30s %10u %10u %10u %10u\n", | ||
172 | "ina_cnt:", | ||
173 | le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt, | ||
174 | delta_cck->ina_cnt, max_cck->ina_cnt); | ||
175 | pos += scnprintf(buf + pos, bufsz - pos, | ||
176 | " %-30s %10u %10u %10u %10u\n", | ||
177 | "fina_cnt:", | ||
178 | le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt, | ||
179 | delta_cck->fina_cnt, max_cck->fina_cnt); | ||
180 | pos += scnprintf(buf + pos, bufsz - pos, | ||
181 | " %-30s %10u %10u %10u %10u\n", | ||
182 | "plcp_err:", | ||
183 | le32_to_cpu(cck->plcp_err), accum_cck->plcp_err, | ||
184 | delta_cck->plcp_err, max_cck->plcp_err); | ||
185 | pos += scnprintf(buf + pos, bufsz - pos, | ||
186 | " %-30s %10u %10u %10u %10u\n", | ||
187 | "crc32_err:", | ||
188 | le32_to_cpu(cck->crc32_err), accum_cck->crc32_err, | ||
189 | delta_cck->crc32_err, max_cck->crc32_err); | ||
190 | pos += scnprintf(buf + pos, bufsz - pos, | ||
191 | " %-30s %10u %10u %10u %10u\n", | ||
192 | "overrun_err:", | ||
193 | le32_to_cpu(cck->overrun_err), | ||
194 | accum_cck->overrun_err, | ||
195 | delta_cck->overrun_err, max_cck->overrun_err); | ||
196 | pos += scnprintf(buf + pos, bufsz - pos, | ||
197 | " %-30s %10u %10u %10u %10u\n", | ||
198 | "early_overrun_err:", | ||
199 | le32_to_cpu(cck->early_overrun_err), | ||
200 | accum_cck->early_overrun_err, | ||
201 | delta_cck->early_overrun_err, | ||
202 | max_cck->early_overrun_err); | ||
203 | pos += scnprintf(buf + pos, bufsz - pos, | ||
204 | " %-30s %10u %10u %10u %10u\n", | ||
205 | "crc32_good:", | ||
206 | le32_to_cpu(cck->crc32_good), accum_cck->crc32_good, | ||
207 | delta_cck->crc32_good, | ||
208 | max_cck->crc32_good); | ||
209 | pos += scnprintf(buf + pos, bufsz - pos, | ||
210 | " %-30s %10u %10u %10u %10u\n", | ||
211 | "false_alarm_cnt:", | ||
212 | le32_to_cpu(cck->false_alarm_cnt), | ||
213 | accum_cck->false_alarm_cnt, | ||
214 | delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt); | ||
215 | pos += scnprintf(buf + pos, bufsz - pos, | ||
216 | " %-30s %10u %10u %10u %10u\n", | ||
217 | "fina_sync_err_cnt:", | ||
218 | le32_to_cpu(cck->fina_sync_err_cnt), | ||
219 | accum_cck->fina_sync_err_cnt, | ||
220 | delta_cck->fina_sync_err_cnt, | ||
221 | max_cck->fina_sync_err_cnt); | ||
222 | pos += scnprintf(buf + pos, bufsz - pos, | ||
223 | " %-30s %10u %10u %10u %10u\n", | ||
224 | "sfd_timeout:", | ||
225 | le32_to_cpu(cck->sfd_timeout), | ||
226 | accum_cck->sfd_timeout, | ||
227 | delta_cck->sfd_timeout, max_cck->sfd_timeout); | ||
228 | pos += scnprintf(buf + pos, bufsz - pos, | ||
229 | " %-30s %10u %10u %10u %10u\n", | ||
230 | "fina_timeout:", | ||
231 | le32_to_cpu(cck->fina_timeout), | ||
232 | accum_cck->fina_timeout, | ||
233 | delta_cck->fina_timeout, max_cck->fina_timeout); | ||
234 | pos += scnprintf(buf + pos, bufsz - pos, | ||
235 | " %-30s %10u %10u %10u %10u\n", | ||
236 | "unresponded_rts:", | ||
237 | le32_to_cpu(cck->unresponded_rts), | ||
238 | accum_cck->unresponded_rts, | ||
239 | delta_cck->unresponded_rts, | ||
240 | max_cck->unresponded_rts); | ||
241 | pos += scnprintf(buf + pos, bufsz - pos, | ||
242 | " %-30s %10u %10u %10u %10u\n", | ||
243 | "rxe_frame_lmt_ovrun:", | ||
244 | le32_to_cpu(cck->rxe_frame_limit_overrun), | ||
245 | accum_cck->rxe_frame_limit_overrun, | ||
246 | delta_cck->rxe_frame_limit_overrun, | ||
247 | max_cck->rxe_frame_limit_overrun); | ||
248 | pos += scnprintf(buf + pos, bufsz - pos, | ||
249 | " %-30s %10u %10u %10u %10u\n", | ||
250 | "sent_ack_cnt:", | ||
251 | le32_to_cpu(cck->sent_ack_cnt), | ||
252 | accum_cck->sent_ack_cnt, | ||
253 | delta_cck->sent_ack_cnt, | ||
254 | max_cck->sent_ack_cnt); | ||
255 | pos += scnprintf(buf + pos, bufsz - pos, | ||
256 | " %-30s %10u %10u %10u %10u\n", | ||
257 | "sent_cts_cnt:", | ||
258 | le32_to_cpu(cck->sent_cts_cnt), | ||
259 | accum_cck->sent_cts_cnt, | ||
260 | delta_cck->sent_cts_cnt, | ||
261 | max_cck->sent_cts_cnt); | ||
262 | |||
263 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" | ||
264 | "acumulative delta max\n", | ||
265 | "Statistics_Rx - GENERAL:"); | ||
266 | pos += scnprintf(buf + pos, bufsz - pos, | ||
267 | " %-30s %10u %10u %10u %10u\n", | ||
268 | "bogus_cts:", | ||
269 | le32_to_cpu(general->bogus_cts), | ||
270 | accum_general->bogus_cts, | ||
271 | delta_general->bogus_cts, max_general->bogus_cts); | ||
272 | pos += scnprintf(buf + pos, bufsz - pos, | ||
273 | " %-30s %10u %10u %10u %10u\n", | ||
274 | "bogus_ack:", | ||
275 | le32_to_cpu(general->bogus_ack), | ||
276 | accum_general->bogus_ack, | ||
277 | delta_general->bogus_ack, max_general->bogus_ack); | ||
278 | pos += scnprintf(buf + pos, bufsz - pos, | ||
279 | " %-30s %10u %10u %10u %10u\n", | ||
280 | "non_bssid_frames:", | ||
281 | le32_to_cpu(general->non_bssid_frames), | ||
282 | accum_general->non_bssid_frames, | ||
283 | delta_general->non_bssid_frames, | ||
284 | max_general->non_bssid_frames); | ||
285 | pos += scnprintf(buf + pos, bufsz - pos, | ||
286 | " %-30s %10u %10u %10u %10u\n", | ||
287 | "filtered_frames:", | ||
288 | le32_to_cpu(general->filtered_frames), | ||
289 | accum_general->filtered_frames, | ||
290 | delta_general->filtered_frames, | ||
291 | max_general->filtered_frames); | ||
292 | pos += scnprintf(buf + pos, bufsz - pos, | ||
293 | " %-30s %10u %10u %10u %10u\n", | ||
294 | "non_channel_beacons:", | ||
295 | le32_to_cpu(general->non_channel_beacons), | ||
296 | accum_general->non_channel_beacons, | ||
297 | delta_general->non_channel_beacons, | ||
298 | max_general->non_channel_beacons); | ||
299 | |||
300 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
301 | kfree(buf); | ||
302 | return ret; | ||
303 | } | ||
304 | |||
305 | ssize_t iwl3945_ucode_tx_stats_read(struct file *file, | ||
306 | char __user *user_buf, | ||
307 | size_t count, loff_t *ppos) | ||
308 | { | ||
309 | struct iwl_priv *priv = file->private_data; | ||
310 | int pos = 0; | ||
311 | char *buf; | ||
312 | int bufsz = (sizeof(struct iwl39_statistics_tx) * 48) + 250; | ||
313 | ssize_t ret; | ||
314 | struct iwl39_statistics_tx *tx, *accum_tx, *delta_tx, *max_tx; | ||
315 | |||
316 | if (!iwl_is_alive(priv)) | ||
317 | return -EAGAIN; | ||
318 | |||
319 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
320 | if (!buf) { | ||
321 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
322 | return -ENOMEM; | ||
323 | } | ||
324 | |||
325 | /* | ||
326 | * The statistic information display here is based on | ||
327 | * the last statistics notification from uCode | ||
328 | * might not reflect the current uCode activity | ||
329 | */ | ||
330 | tx = &priv->_3945.statistics.tx; | ||
331 | accum_tx = &priv->_3945.accum_statistics.tx; | ||
332 | delta_tx = &priv->_3945.delta_statistics.tx; | ||
333 | max_tx = &priv->_3945.max_delta.tx; | ||
334 | pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz); | ||
335 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" | ||
336 | "acumulative delta max\n", | ||
337 | "Statistics_Tx:"); | ||
338 | pos += scnprintf(buf + pos, bufsz - pos, | ||
339 | " %-30s %10u %10u %10u %10u\n", | ||
340 | "preamble:", | ||
341 | le32_to_cpu(tx->preamble_cnt), | ||
342 | accum_tx->preamble_cnt, | ||
343 | delta_tx->preamble_cnt, max_tx->preamble_cnt); | ||
344 | pos += scnprintf(buf + pos, bufsz - pos, | ||
345 | " %-30s %10u %10u %10u %10u\n", | ||
346 | "rx_detected_cnt:", | ||
347 | le32_to_cpu(tx->rx_detected_cnt), | ||
348 | accum_tx->rx_detected_cnt, | ||
349 | delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt); | ||
350 | pos += scnprintf(buf + pos, bufsz - pos, | ||
351 | " %-30s %10u %10u %10u %10u\n", | ||
352 | "bt_prio_defer_cnt:", | ||
353 | le32_to_cpu(tx->bt_prio_defer_cnt), | ||
354 | accum_tx->bt_prio_defer_cnt, | ||
355 | delta_tx->bt_prio_defer_cnt, | ||
356 | max_tx->bt_prio_defer_cnt); | ||
357 | pos += scnprintf(buf + pos, bufsz - pos, | ||
358 | " %-30s %10u %10u %10u %10u\n", | ||
359 | "bt_prio_kill_cnt:", | ||
360 | le32_to_cpu(tx->bt_prio_kill_cnt), | ||
361 | accum_tx->bt_prio_kill_cnt, | ||
362 | delta_tx->bt_prio_kill_cnt, | ||
363 | max_tx->bt_prio_kill_cnt); | ||
364 | pos += scnprintf(buf + pos, bufsz - pos, | ||
365 | " %-30s %10u %10u %10u %10u\n", | ||
366 | "few_bytes_cnt:", | ||
367 | le32_to_cpu(tx->few_bytes_cnt), | ||
368 | accum_tx->few_bytes_cnt, | ||
369 | delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt); | ||
370 | pos += scnprintf(buf + pos, bufsz - pos, | ||
371 | " %-30s %10u %10u %10u %10u\n", | ||
372 | "cts_timeout:", | ||
373 | le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout, | ||
374 | delta_tx->cts_timeout, max_tx->cts_timeout); | ||
375 | pos += scnprintf(buf + pos, bufsz - pos, | ||
376 | " %-30s %10u %10u %10u %10u\n", | ||
377 | "ack_timeout:", | ||
378 | le32_to_cpu(tx->ack_timeout), | ||
379 | accum_tx->ack_timeout, | ||
380 | delta_tx->ack_timeout, max_tx->ack_timeout); | ||
381 | pos += scnprintf(buf + pos, bufsz - pos, | ||
382 | " %-30s %10u %10u %10u %10u\n", | ||
383 | "expected_ack_cnt:", | ||
384 | le32_to_cpu(tx->expected_ack_cnt), | ||
385 | accum_tx->expected_ack_cnt, | ||
386 | delta_tx->expected_ack_cnt, | ||
387 | max_tx->expected_ack_cnt); | ||
388 | pos += scnprintf(buf + pos, bufsz - pos, | ||
389 | " %-30s %10u %10u %10u %10u\n", | ||
390 | "actual_ack_cnt:", | ||
391 | le32_to_cpu(tx->actual_ack_cnt), | ||
392 | accum_tx->actual_ack_cnt, | ||
393 | delta_tx->actual_ack_cnt, | ||
394 | max_tx->actual_ack_cnt); | ||
395 | |||
396 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
397 | kfree(buf); | ||
398 | return ret; | ||
399 | } | ||
400 | |||
401 | ssize_t iwl3945_ucode_general_stats_read(struct file *file, | ||
402 | char __user *user_buf, | ||
403 | size_t count, loff_t *ppos) | ||
404 | { | ||
405 | struct iwl_priv *priv = file->private_data; | ||
406 | int pos = 0; | ||
407 | char *buf; | ||
408 | int bufsz = sizeof(struct iwl39_statistics_general) * 10 + 300; | ||
409 | ssize_t ret; | ||
410 | struct iwl39_statistics_general *general, *accum_general; | ||
411 | struct iwl39_statistics_general *delta_general, *max_general; | ||
412 | struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; | ||
413 | struct iwl39_statistics_div *div, *accum_div, *delta_div, *max_div; | ||
414 | |||
415 | if (!iwl_is_alive(priv)) | ||
416 | return -EAGAIN; | ||
417 | |||
418 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
419 | if (!buf) { | ||
420 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
421 | return -ENOMEM; | ||
422 | } | ||
423 | |||
424 | /* | ||
425 | * The statistic information display here is based on | ||
426 | * the last statistics notification from uCode | ||
427 | * might not reflect the current uCode activity | ||
428 | */ | ||
429 | general = &priv->_3945.statistics.general; | ||
430 | dbg = &priv->_3945.statistics.general.dbg; | ||
431 | div = &priv->_3945.statistics.general.div; | ||
432 | accum_general = &priv->_3945.accum_statistics.general; | ||
433 | delta_general = &priv->_3945.delta_statistics.general; | ||
434 | max_general = &priv->_3945.max_delta.general; | ||
435 | accum_dbg = &priv->_3945.accum_statistics.general.dbg; | ||
436 | delta_dbg = &priv->_3945.delta_statistics.general.dbg; | ||
437 | max_dbg = &priv->_3945.max_delta.general.dbg; | ||
438 | accum_div = &priv->_3945.accum_statistics.general.div; | ||
439 | delta_div = &priv->_3945.delta_statistics.general.div; | ||
440 | max_div = &priv->_3945.max_delta.general.div; | ||
441 | pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz); | ||
442 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" | ||
443 | "acumulative delta max\n", | ||
444 | "Statistics_General:"); | ||
445 | pos += scnprintf(buf + pos, bufsz - pos, | ||
446 | " %-30s %10u %10u %10u %10u\n", | ||
447 | "burst_check:", | ||
448 | le32_to_cpu(dbg->burst_check), | ||
449 | accum_dbg->burst_check, | ||
450 | delta_dbg->burst_check, max_dbg->burst_check); | ||
451 | pos += scnprintf(buf + pos, bufsz - pos, | ||
452 | " %-30s %10u %10u %10u %10u\n", | ||
453 | "burst_count:", | ||
454 | le32_to_cpu(dbg->burst_count), | ||
455 | accum_dbg->burst_count, | ||
456 | delta_dbg->burst_count, max_dbg->burst_count); | ||
457 | pos += scnprintf(buf + pos, bufsz - pos, | ||
458 | " %-30s %10u %10u %10u %10u\n", | ||
459 | "sleep_time:", | ||
460 | le32_to_cpu(general->sleep_time), | ||
461 | accum_general->sleep_time, | ||
462 | delta_general->sleep_time, max_general->sleep_time); | ||
463 | pos += scnprintf(buf + pos, bufsz - pos, | ||
464 | " %-30s %10u %10u %10u %10u\n", | ||
465 | "slots_out:", | ||
466 | le32_to_cpu(general->slots_out), | ||
467 | accum_general->slots_out, | ||
468 | delta_general->slots_out, max_general->slots_out); | ||
469 | pos += scnprintf(buf + pos, bufsz - pos, | ||
470 | " %-30s %10u %10u %10u %10u\n", | ||
471 | "slots_idle:", | ||
472 | le32_to_cpu(general->slots_idle), | ||
473 | accum_general->slots_idle, | ||
474 | delta_general->slots_idle, max_general->slots_idle); | ||
475 | pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp:\t\t\t%u\n", | ||
476 | le32_to_cpu(general->ttl_timestamp)); | ||
477 | pos += scnprintf(buf + pos, bufsz - pos, | ||
478 | " %-30s %10u %10u %10u %10u\n", | ||
479 | "tx_on_a:", | ||
480 | le32_to_cpu(div->tx_on_a), accum_div->tx_on_a, | ||
481 | delta_div->tx_on_a, max_div->tx_on_a); | ||
482 | pos += scnprintf(buf + pos, bufsz - pos, | ||
483 | " %-30s %10u %10u %10u %10u\n", | ||
484 | "tx_on_b:", | ||
485 | le32_to_cpu(div->tx_on_b), accum_div->tx_on_b, | ||
486 | delta_div->tx_on_b, max_div->tx_on_b); | ||
487 | pos += scnprintf(buf + pos, bufsz - pos, | ||
488 | " %-30s %10u %10u %10u %10u\n", | ||
489 | "exec_time:", | ||
490 | le32_to_cpu(div->exec_time), accum_div->exec_time, | ||
491 | delta_div->exec_time, max_div->exec_time); | ||
492 | pos += scnprintf(buf + pos, bufsz - pos, | ||
493 | " %-30s %10u %10u %10u %10u\n", | ||
494 | "probe_time:", | ||
495 | le32_to_cpu(div->probe_time), accum_div->probe_time, | ||
496 | delta_div->probe_time, max_div->probe_time); | ||
497 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
498 | kfree(buf); | ||
499 | return ret; | ||
500 | } | ||