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