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