1 /******************************************************************************
2 * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
4 * Based on the r8180 driver, which is:
5 * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 * The full GNU General Public License is included in this distribution in the
20 * file called LICENSE.
22 * Contact Information:
23 * wlanfae <wlanfae@realtek.com>
24 ******************************************************************************/
25 #include "rtl_debug.h"
27 #include "r8192E_phy.h"
28 #include "r8192E_phyreg.h"
29 #include "r8190P_rtl8256.h" /* RTL8225 Radio frontend */
30 #include "r8192E_cmdpkt.h"
32 u32 rt_global_debug_component
= \
35 /*------------------Declare variable-----------------------*/
36 u32 DBGP_Type
[DBGP_TYPE_MAX
];
38 /*-----------------------------------------------------------------------------
39 * Function: DBGP_Flag_Init
41 * Overview: Refresh all debug print control flag content to zero.
51 * 10/20/2006 MHC Create Version 0.
53 *---------------------------------------------------------------------------*/
54 void rtl8192_dbgp_flag_init(struct net_device
*dev
)
58 for (i
= 0; i
< DBGP_TYPE_MAX
; i
++)
62 } /* DBGP_Flag_Init */
64 /* this is only for debugging */
65 void print_buffer(u32
*buffer
, int len
)
68 u8
*buf
= (u8
*)buffer
;
70 printk(KERN_INFO
"ASCII BUFFER DUMP (len: %x):\n", len
);
72 for (i
= 0; i
< len
; i
++)
73 printk(KERN_INFO
"%c", buf
[i
]);
75 printk(KERN_INFO
"\nBINARY BUFFER DUMP (len: %x):\n", len
);
77 for (i
= 0; i
< len
; i
++)
78 printk(KERN_INFO
"%x", buf
[i
]);
80 printk(KERN_INFO
"\n");
83 /* this is only for debug */
84 void dump_eprom(struct net_device
*dev
)
88 for (i
= 0; i
< 0xff; i
++)
89 RT_TRACE(COMP_INIT
, "EEPROM addr %x : %x", i
,
93 /* this is only for debug */
94 void rtl8192_dump_reg(struct net_device
*dev
)
100 RT_TRACE(COMP_INIT
, "Dumping NIC register map");
102 for (n
= 0; n
<= max
; ) {
103 printk(KERN_INFO
"\nD: %2x> ", n
);
104 for (i
= 0; i
< 16 && n
<= max
; i
++, n
++)
105 printk(KERN_INFO
"%2x ", read_nic_byte(dev
, n
));
107 printk(KERN_INFO
"\n");
110 /****************************************************************************
111 -----------------------------PROCFS STUFF-------------------------
112 *****************************************************************************/
113 /*This part is related to PROC, which will record some statistics. */
114 static struct proc_dir_entry
*rtl8192_proc
;
116 static int proc_get_stats_ap(char *page
, char **start
,
117 off_t offset
, int count
,
118 int *eof
, void *data
)
120 struct net_device
*dev
= data
;
121 struct r8192_priv
*priv
= (struct r8192_priv
*)rtllib_priv(dev
);
122 struct rtllib_device
*ieee
= priv
->rtllib
;
123 struct rtllib_network
*target
;
126 list_for_each_entry(target
, &ieee
->network_list
, list
) {
128 len
+= snprintf(page
+ len
, count
- len
,
129 "%s ", target
->ssid
);
131 if (target
->wpa_ie_len
> 0 || target
->rsn_ie_len
> 0)
132 len
+= snprintf(page
+ len
, count
- len
,
135 len
+= snprintf(page
+ len
, count
- len
,
144 static int proc_get_registers_0(char *page
, char **start
,
145 off_t offset
, int count
,
146 int *eof
, void *data
)
148 struct net_device
*dev
= data
;
156 len
+= snprintf(page
+ len
, count
- len
,
157 "\n####################page %x##################\n ",
159 len
+= snprintf(page
+ len
, count
- len
,
160 "\nD: OF > 00 01 02 03 04 05 06 07 08 09 0A 0B "
162 for (n
= 0; n
<= max
;) {
163 len
+= snprintf(page
+ len
, count
- len
, "\nD: %2x > ", n
);
164 for (i
= 0; i
< 16 && n
<= max
; n
++, i
++)
165 len
+= snprintf(page
+ len
, count
- len
,
166 "%2.2x ", read_nic_byte(dev
,
169 len
+= snprintf(page
+ len
, count
- len
, "\n");
174 static int proc_get_registers_1(char *page
, char **start
,
175 off_t offset
, int count
,
176 int *eof
, void *data
)
178 struct net_device
*dev
= data
;
186 /* This dump the current register page */
187 len
+= snprintf(page
+ len
, count
- len
,
188 "\n####################page %x##################\n ",
190 len
+= snprintf(page
+ len
, count
- len
,
191 "\nD: OF > 00 01 02 03 04 05 06 07 08 09 0A 0B "
193 for (n
= 0; n
<= max
;) {
194 len
+= snprintf(page
+ len
, count
- len
,
196 for (i
= 0; i
< 16 && n
<= max
; i
++, n
++)
197 len
+= snprintf(page
+ len
, count
- len
,
198 "%2.2x ", read_nic_byte(dev
,
201 len
+= snprintf(page
+ len
, count
- len
, "\n");
206 static int proc_get_registers_2(char *page
, char **start
,
207 off_t offset
, int count
,
208 int *eof
, void *data
)
210 struct net_device
*dev
= data
;
218 /* This dump the current register page */
219 len
+= snprintf(page
+ len
, count
- len
,
220 "\n####################page %x##################\n ",
222 len
+= snprintf(page
+ len
, count
- len
,
223 "\nD: OF > 00 01 02 03 04 05 06 07 08 09 0A 0B 0C "
225 for (n
= 0; n
<= max
;) {
226 len
+= snprintf(page
+ len
, count
- len
,
228 for (i
= 0; i
< 16 && n
<= max
; i
++, n
++)
229 len
+= snprintf(page
+ len
, count
- len
,
230 "%2.2x ", read_nic_byte(dev
,
233 len
+= snprintf(page
+ len
, count
- len
, "\n");
238 static int proc_get_registers_3(char *page
, char **start
,
239 off_t offset
, int count
,
240 int *eof
, void *data
)
242 struct net_device
*dev
= data
;
250 /* This dump the current register page */
251 len
+= snprintf(page
+ len
, count
- len
,
252 "\n####################page %x##################\n ",
254 len
+= snprintf(page
+ len
, count
- len
,
255 "\nD: OF > 00 01 02 03 04 05 06 07 08 09 0A 0B "
257 for (n
= 0; n
<= max
;) {
258 len
+= snprintf(page
+ len
, count
- len
,
260 for (i
= 0; i
< 16 && n
<= max
; i
++, n
++)
261 len
+= snprintf(page
+ len
, count
- len
,
262 "%2.2x ", read_nic_byte(dev
,
265 len
+= snprintf(page
+ len
, count
- len
, "\n");
270 static int proc_get_registers_4(char *page
, char **start
,
271 off_t offset
, int count
,
272 int *eof
, void *data
)
274 struct net_device
*dev
= data
;
282 /* This dump the current register page */
283 len
+= snprintf(page
+ len
, count
- len
,
284 "\n####################page %x##################\n ",
286 len
+= snprintf(page
+ len
, count
- len
,
287 "\nD: OF > 00 01 02 03 04 05 06 07 08 09 0A 0B "
289 for (n
= 0; n
<= max
;) {
290 len
+= snprintf(page
+ len
, count
- len
,
292 for (i
= 0; i
< 16 && n
<= max
; i
++, n
++)
293 len
+= snprintf(page
+ len
, count
- len
,
294 "%2.2x ", read_nic_byte(dev
,
297 len
+= snprintf(page
+ len
, count
- len
, "\n");
302 static int proc_get_registers_5(char *page
, char **start
,
303 off_t offset
, int count
,
304 int *eof
, void *data
)
306 struct net_device
*dev
= data
;
314 /* This dump the current register page */
315 len
+= snprintf(page
+ len
, count
- len
,
316 "\n####################page %x##################\n ",
318 len
+= snprintf(page
+ len
, count
- len
,
319 "\nD: OF > 00 01 02 03 04 05 06 07 08 09 0A 0B "
321 for (n
= 0; n
<= max
;) {
322 len
+= snprintf(page
+ len
, count
- len
,
324 for (i
= 0; i
< 16 && n
<= max
; i
++, n
++)
325 len
+= snprintf(page
+ len
, count
- len
,
326 "%2.2x ", read_nic_byte(dev
,
329 len
+= snprintf(page
+ len
, count
- len
, "\n");
334 static int proc_get_registers_6(char *page
, char **start
,
335 off_t offset
, int count
,
336 int *eof
, void *data
)
338 struct net_device
*dev
= data
;
346 /* This dump the current register page */
347 len
+= snprintf(page
+ len
, count
- len
,
348 "\n####################page %x##################\n ",
350 len
+= snprintf(page
+ len
, count
- len
,
351 "\nD: OF > 00 01 02 03 04 05 06 07 08 09 0A 0B "
353 for (n
= 0; n
<= max
;) {
354 len
+= snprintf(page
+ len
, count
- len
,
356 for (i
= 0; i
< 16 && n
<= max
; i
++, n
++)
357 len
+= snprintf(page
+ len
, count
- len
,
358 "%2.2x ", read_nic_byte(dev
,
361 len
+= snprintf(page
+ len
, count
- len
, "\n");
366 static int proc_get_registers_7(char *page
, char **start
,
367 off_t offset
, int count
,
368 int *eof
, void *data
)
370 struct net_device
*dev
= data
;
378 /* This dump the current register page */
379 len
+= snprintf(page
+ len
, count
- len
,
380 "\n####################page %x##################\n ",
382 len
+= snprintf(page
+ len
, count
- len
,
383 "\nD: OF > 00 01 02 03 04 05 06 07 08 09 0A 0B 0C "
385 for (n
= 0; n
<= max
;) {
386 len
+= snprintf(page
+ len
, count
- len
,
388 for (i
= 0; i
< 16 && n
<= max
; i
++, n
++)
389 len
+= snprintf(page
+ len
, count
- len
,
390 "%2.2x ", read_nic_byte(dev
,
393 len
+= snprintf(page
+ len
, count
- len
, "\n");
398 static int proc_get_registers_8(char *page
, char **start
,
399 off_t offset
, int count
,
400 int *eof
, void *data
)
402 struct net_device
*dev
= data
;
410 /* This dump the current register page */
411 len
+= snprintf(page
+ len
, count
- len
,
412 "\n####################page %x##################\n",
414 for (n
= 0; n
<= max
;) {
415 len
+= snprintf(page
+ len
, count
- len
, "\nD: %2x > ", n
);
416 for (i
= 0; i
< 4 && n
<= max
; n
+= 4, i
++)
417 len
+= snprintf(page
+ len
, count
- len
,
418 "%8.8x ", rtl8192_QueryBBReg(dev
,
419 (page0
| n
), bMaskDWord
));
421 len
+= snprintf(page
+ len
, count
- len
, "\n");
426 static int proc_get_registers_9(char *page
, char **start
,
427 off_t offset
, int count
,
428 int *eof
, void *data
)
430 struct net_device
*dev
= data
;
438 /* This dump the current register page */
439 len
+= snprintf(page
+ len
, count
- len
,
440 "\n####################page %x##################\n",
442 for (n
= 0; n
<= max
;) {
443 len
+= snprintf(page
+ len
, count
- len
, "\nD: %2x > ", n
);
444 for (i
= 0; i
< 4 && n
<= max
; n
+= 4, i
++)
445 len
+= snprintf(page
+ len
, count
- len
,
446 "%8.8x ", rtl8192_QueryBBReg(dev
,
447 (page0
| n
), bMaskDWord
));
449 len
+= snprintf(page
+ len
, count
- len
, "\n");
453 static int proc_get_registers_a(char *page
, char **start
,
454 off_t offset
, int count
,
455 int *eof
, void *data
)
457 struct net_device
*dev
= data
;
465 /* This dump the current register page */
466 len
+= snprintf(page
+ len
, count
- len
,
467 "\n####################page %x##################\n",
469 for (n
= 0; n
<= max
;) {
470 len
+= snprintf(page
+ len
, count
- len
, "\nD: %2x > ", n
);
471 for (i
= 0; i
< 4 && n
<= max
; n
+= 4, i
++)
472 len
+= snprintf(page
+ len
, count
- len
,
473 "%8.8x ", rtl8192_QueryBBReg(dev
,
474 (page0
| n
), bMaskDWord
));
476 len
+= snprintf(page
+ len
, count
- len
, "\n");
480 static int proc_get_registers_b(char *page
, char **start
,
481 off_t offset
, int count
,
482 int *eof
, void *data
)
484 struct net_device
*dev
= data
;
492 /* This dump the current register page */
493 len
+= snprintf(page
+ len
, count
- len
,
494 "\n####################page %x##################\n",
496 for (n
= 0; n
<= max
;) {
497 len
+= snprintf(page
+ len
, count
- len
, "\nD: %2x > ", n
);
498 for (i
= 0; i
< 4 && n
<= max
; n
+= 4, i
++)
499 len
+= snprintf(page
+ len
, count
- len
,
500 "%8.8x ", rtl8192_QueryBBReg(dev
,
501 (page0
| n
), bMaskDWord
));
503 len
+= snprintf(page
+ len
, count
- len
, "\n");
507 static int proc_get_registers_c(char *page
, char **start
,
508 off_t offset
, int count
,
509 int *eof
, void *data
)
511 struct net_device
*dev
= data
;
519 /* This dump the current register page */
520 len
+= snprintf(page
+ len
, count
- len
,
521 "\n####################page %x##################\n",
523 for (n
= 0; n
<= max
;) {
524 len
+= snprintf(page
+ len
, count
- len
, "\nD: %2x > ", n
);
525 for (i
= 0; i
< 4 && n
<= max
; n
+= 4, i
++)
526 len
+= snprintf(page
+ len
, count
- len
,
527 "%8.8x ", rtl8192_QueryBBReg(dev
,
528 (page0
| n
), bMaskDWord
));
530 len
+= snprintf(page
+ len
, count
- len
, "\n");
534 static int proc_get_registers_d(char *page
, char **start
,
535 off_t offset
, int count
,
536 int *eof
, void *data
)
538 struct net_device
*dev
= data
;
546 /* This dump the current register page */
547 len
+= snprintf(page
+ len
, count
- len
,
548 "\n####################page %x##################\n",
550 for (n
= 0; n
<= max
;) {
551 len
+= snprintf(page
+ len
, count
- len
, "\nD: %2x > ", n
);
552 for (i
= 0; i
< 4 && n
<= max
; n
+= 4, i
++)
553 len
+= snprintf(page
+ len
, count
- len
,
554 "%8.8x ", rtl8192_QueryBBReg(dev
,
555 (page0
| n
), bMaskDWord
));
557 len
+= snprintf(page
+ len
, count
- len
, "\n");
561 static int proc_get_registers_e(char *page
, char **start
,
562 off_t offset
, int count
,
563 int *eof
, void *data
)
565 struct net_device
*dev
= data
;
573 /* This dump the current register page */
574 len
+= snprintf(page
+ len
, count
- len
,
575 "\n####################page %x##################\n",
577 for (n
= 0; n
<= max
;) {
578 len
+= snprintf(page
+ len
, count
- len
, "\nD: %2x > ", n
);
579 for (i
= 0; i
< 4 && n
<= max
; n
+= 4, i
++)
580 len
+= snprintf(page
+ len
, count
- len
,
581 "%8.8x ", rtl8192_QueryBBReg(dev
,
582 (page0
| n
), bMaskDWord
));
584 len
+= snprintf(page
+ len
, count
- len
, "\n");
589 static int proc_get_reg_rf_a(char *page
, char **start
,
590 off_t offset
, int count
,
591 int *eof
, void *data
)
593 struct net_device
*dev
= data
;
600 /* This dump the current register page */
601 len
+= snprintf(page
+ len
, count
- len
,
602 "\n#################### RF-A ##################\n ");
603 for (n
= 0; n
<= max
;) {
604 len
+= snprintf(page
+ len
, count
- len
, "\nD: %2x > ", n
);
605 for (i
= 0; i
< 4 && n
<= max
; n
+= 4, i
++)
606 len
+= snprintf(page
+ len
, count
- len
,
607 "%8.8x ", rtl8192_phy_QueryRFReg(dev
,
608 (enum rf90_radio_path
)RF90_PATH_A
, n
,
611 len
+= snprintf(page
+ len
, count
- len
, "\n");
616 static int proc_get_reg_rf_b(char *page
, char **start
,
617 off_t offset
, int count
,
618 int *eof
, void *data
)
620 struct net_device
*dev
= data
;
627 /* This dump the current register page */
628 len
+= snprintf(page
+ len
, count
- len
,
629 "\n#################### RF-B ##################\n ");
630 for (n
= 0; n
<= max
;) {
631 len
+= snprintf(page
+ len
, count
- len
, "\nD: %2x > ", n
);
632 for (i
= 0; i
< 4 && n
<= max
; n
+= 4, i
++)
633 len
+= snprintf(page
+ len
, count
- len
,
634 "%8.8x ", rtl8192_phy_QueryRFReg(dev
,
635 (enum rf90_radio_path
)RF90_PATH_B
, n
,
638 len
+= snprintf(page
+ len
, count
- len
, "\n");
643 static int proc_get_reg_rf_c(char *page
, char **start
,
644 off_t offset
, int count
,
645 int *eof
, void *data
)
647 struct net_device
*dev
= data
;
654 /* This dump the current register page */
655 len
+= snprintf(page
+ len
, count
- len
,
656 "\n#################### RF-C ##################\n");
657 for (n
= 0; n
<= max
;) {
658 len
+= snprintf(page
+ len
, count
- len
, "\nD: %2x > ", n
);
659 for (i
= 0; i
< 4 && n
<= max
; n
+= 4, i
++)
660 len
+= snprintf(page
+ len
, count
- len
,
661 "%8.8x ", rtl8192_phy_QueryRFReg(dev
,
662 (enum rf90_radio_path
)RF90_PATH_C
, n
,
665 len
+= snprintf(page
+ len
, count
- len
, "\n");
670 static int proc_get_reg_rf_d(char *page
, char **start
,
671 off_t offset
, int count
,
672 int *eof
, void *data
)
674 struct net_device
*dev
= data
;
681 /* This dump the current register page */
682 len
+= snprintf(page
+ len
, count
- len
,
683 "\n#################### RF-D ##################\n ");
684 for (n
= 0; n
<= max
;) {
685 len
+= snprintf(page
+ len
, count
- len
, "\nD: %2x > ", n
);
686 for (i
= 0; i
< 4 && n
<= max
; n
+= 4, i
++)
687 len
+= snprintf(page
+ len
, count
- len
,
688 "%8.8x ", rtl8192_phy_QueryRFReg(dev
,
689 (enum rf90_radio_path
)RF90_PATH_D
, n
,
692 len
+= snprintf(page
+ len
, count
- len
, "\n");
697 static int proc_get_cam_register_1(char *page
, char **start
,
698 off_t offset
, int count
,
699 int *eof
, void *data
)
701 struct net_device
*dev
= data
;
702 u32 target_command
= 0;
703 u32 target_content
= 0;
709 /* This dump the current register page */
710 len
+= snprintf(page
+ len
, count
- len
,
711 "\n#################### SECURITY CAM (0-10) ######"
713 for (j
= 0; j
< 11; j
++) {
714 len
+= snprintf(page
+ len
, count
- len
, "\nD: %2x > ", j
);
715 for (entry_i
= 0; entry_i
< CAM_CONTENT_COUNT
; entry_i
++) {
716 target_command
= entry_i
+CAM_CONTENT_COUNT
*j
;
717 target_command
= target_command
| BIT31
;
720 ulStatus
= read_nic_dword(dev
, RWCAM
);
721 if (ulStatus
& BIT31
)
726 write_nic_dword(dev
, RWCAM
, target_command
);
727 target_content
= read_nic_dword(dev
, RCAMO
);
728 len
+= snprintf(page
+ len
, count
- len
, "%8.8x ",
733 len
+= snprintf(page
+ len
, count
- len
, "\n");
738 static int proc_get_cam_register_2(char *page
, char **start
,
739 off_t offset
, int count
,
740 int *eof
, void *data
)
742 struct net_device
*dev
= data
;
743 u32 target_command
= 0;
744 u32 target_content
= 0;
750 /* This dump the current register page */
751 len
+= snprintf(page
+ len
, count
- len
,
752 "\n#################### SECURITY CAM (11-21) "
753 "##################\n ");
754 for (j
= 11; j
< 22; j
++) {
755 len
+= snprintf(page
+ len
, count
- len
, "\nD: %2x > ", j
);
756 for (entry_i
= 0; entry_i
< CAM_CONTENT_COUNT
; entry_i
++) {
757 target_command
= entry_i
+ CAM_CONTENT_COUNT
* j
;
758 target_command
= target_command
| BIT31
;
761 ulStatus
= read_nic_dword(dev
, RWCAM
);
762 if (ulStatus
& BIT31
)
767 write_nic_dword(dev
, RWCAM
, target_command
);
768 target_content
= read_nic_dword(dev
, RCAMO
);
769 len
+= snprintf(page
+ len
, count
- len
, "%8.8x ",
774 len
+= snprintf(page
+ len
, count
- len
, "\n");
779 static int proc_get_cam_register_3(char *page
, char **start
,
780 off_t offset
, int count
,
781 int *eof
, void *data
)
783 struct net_device
*dev
= data
;
784 u32 target_command
= 0;
785 u32 target_content
= 0;
791 /* This dump the current register page */
792 len
+= snprintf(page
+ len
, count
- len
,
793 "\n#################### SECURITY CAM (22-31) ######"
795 for (j
= 22; j
< TOTAL_CAM_ENTRY
; j
++) {
796 len
+= snprintf(page
+ len
, count
- len
, "\nD: %2x > ", j
);
797 for (entry_i
= 0; entry_i
< CAM_CONTENT_COUNT
; entry_i
++) {
798 target_command
= entry_i
+ CAM_CONTENT_COUNT
* j
;
799 target_command
= target_command
| BIT31
;
802 ulStatus
= read_nic_dword(dev
, RWCAM
);
803 if (ulStatus
& BIT31
)
808 write_nic_dword(dev
, RWCAM
, target_command
);
809 target_content
= read_nic_dword(dev
, RCAMO
);
810 len
+= snprintf(page
+ len
, count
- len
, "%8.8x ",
815 len
+= snprintf(page
+ len
, count
- len
, "\n");
819 static int proc_get_stats_tx(char *page
, char **start
,
820 off_t offset
, int count
,
821 int *eof
, void *data
)
823 struct net_device
*dev
= data
;
824 struct r8192_priv
*priv
= (struct r8192_priv
*)rtllib_priv(dev
);
828 len
+= snprintf(page
+ len
, count
- len
,
829 "TX VI priority ok int: %lu\n"
830 "TX VO priority ok int: %lu\n"
831 "TX BE priority ok int: %lu\n"
832 "TX BK priority ok int: %lu\n"
833 "TX MANAGE priority ok int: %lu\n"
834 "TX BEACON priority ok int: %lu\n"
835 "TX BEACON priority error int: %lu\n"
836 "TX CMDPKT priority ok int: %lu\n"
837 "TX queue stopped?: %d\n"
838 "TX fifo overflow: %lu\n"
839 "TX total data packets %lu\n"
840 "TX total data bytes :%lu\n",
841 priv
->stats
.txviokint
,
842 priv
->stats
.txvookint
,
843 priv
->stats
.txbeokint
,
844 priv
->stats
.txbkokint
,
845 priv
->stats
.txmanageokint
,
846 priv
->stats
.txbeaconokint
,
847 priv
->stats
.txbeaconerr
,
848 priv
->stats
.txcmdpktokint
,
849 netif_queue_stopped(dev
),
850 priv
->stats
.txoverflow
,
851 priv
->rtllib
->stats
.tx_packets
,
852 priv
->rtllib
->stats
.tx_bytes
863 static int proc_get_stats_rx(char *page
, char **start
,
864 off_t offset
, int count
,
865 int *eof
, void *data
)
867 struct net_device
*dev
= data
;
868 struct r8192_priv
*priv
= (struct r8192_priv
*)rtllib_priv(dev
);
872 len
+= snprintf(page
+ len
, count
- len
,
874 "RX data crc err: %lu\n"
875 "RX mgmt crc err: %lu\n"
877 "RX rx overflow error: %lu\n",
879 priv
->stats
.rxdatacrcerr
,
880 priv
->stats
.rxmgmtcrcerr
,
882 priv
->stats
.rxoverflow
);
888 void rtl8192_proc_module_init(void)
890 RT_TRACE(COMP_INIT
, "Initializing proc filesystem");
891 rtl8192_proc
= create_proc_entry(DRV_NAME
, S_IFDIR
, init_net
.proc_net
);
895 void rtl8192_proc_module_remove(void)
897 remove_proc_entry(DRV_NAME
, init_net
.proc_net
);
901 void rtl8192_proc_remove_one(struct net_device
*dev
)
903 struct r8192_priv
*priv
= (struct r8192_priv
*)rtllib_priv(dev
);
905 printk(KERN_INFO
"dev name %s\n", dev
->name
);
908 remove_proc_entry("stats-tx", priv
->dir_dev
);
909 remove_proc_entry("stats-rx", priv
->dir_dev
);
910 remove_proc_entry("stats-ap", priv
->dir_dev
);
911 remove_proc_entry("registers-0", priv
->dir_dev
);
912 remove_proc_entry("registers-1", priv
->dir_dev
);
913 remove_proc_entry("registers-2", priv
->dir_dev
);
914 remove_proc_entry("registers-3", priv
->dir_dev
);
915 remove_proc_entry("registers-4", priv
->dir_dev
);
916 remove_proc_entry("registers-5", priv
->dir_dev
);
917 remove_proc_entry("registers-6", priv
->dir_dev
);
918 remove_proc_entry("registers-7", priv
->dir_dev
);
919 remove_proc_entry("registers-8", priv
->dir_dev
);
920 remove_proc_entry("registers-9", priv
->dir_dev
);
921 remove_proc_entry("registers-a", priv
->dir_dev
);
922 remove_proc_entry("registers-b", priv
->dir_dev
);
923 remove_proc_entry("registers-c", priv
->dir_dev
);
924 remove_proc_entry("registers-d", priv
->dir_dev
);
925 remove_proc_entry("registers-e", priv
->dir_dev
);
926 remove_proc_entry("RF-A", priv
->dir_dev
);
927 remove_proc_entry("RF-B", priv
->dir_dev
);
928 remove_proc_entry("RF-C", priv
->dir_dev
);
929 remove_proc_entry("RF-D", priv
->dir_dev
);
930 remove_proc_entry("SEC-CAM-1", priv
->dir_dev
);
931 remove_proc_entry("SEC-CAM-2", priv
->dir_dev
);
932 remove_proc_entry("SEC-CAM-3", priv
->dir_dev
);
933 remove_proc_entry("wlan0", rtl8192_proc
);
934 priv
->dir_dev
= NULL
;
939 void rtl8192_proc_init_one(struct net_device
*dev
)
941 struct proc_dir_entry
*e
;
942 struct r8192_priv
*priv
= (struct r8192_priv
*)rtllib_priv(dev
);
944 priv
->dir_dev
= create_proc_entry(dev
->name
,
945 S_IFDIR
| S_IRUGO
| S_IXUGO
,
947 if (!priv
->dir_dev
) {
948 RT_TRACE(COMP_ERR
, "Unable to initialize /proc/net/rtl8192"
952 e
= create_proc_read_entry("stats-rx", S_IFREG
| S_IRUGO
,
953 priv
->dir_dev
, proc_get_stats_rx
, dev
);
956 RT_TRACE(COMP_ERR
, "Unable to initialize "
957 "/proc/net/rtl8192/%s/stats-rx\n",
960 e
= create_proc_read_entry("stats-tx", S_IFREG
| S_IRUGO
,
961 priv
->dir_dev
, proc_get_stats_tx
, dev
);
964 RT_TRACE(COMP_ERR
, "Unable to initialize "
965 "/proc/net/rtl8192/%s/stats-tx\n",
968 e
= create_proc_read_entry("stats-ap", S_IFREG
| S_IRUGO
,
969 priv
->dir_dev
, proc_get_stats_ap
, dev
);
972 RT_TRACE(COMP_ERR
, "Unable to initialize "
973 "/proc/net/rtl8192/%s/stats-ap\n",
976 e
= create_proc_read_entry("registers-0", S_IFREG
| S_IRUGO
,
977 priv
->dir_dev
, proc_get_registers_0
, dev
);
979 RT_TRACE(COMP_ERR
, "Unable to initialize "
980 "/proc/net/rtl8192/%s/registers-0\n",
982 e
= create_proc_read_entry("registers-1", S_IFREG
| S_IRUGO
,
983 priv
->dir_dev
, proc_get_registers_1
, dev
);
985 RT_TRACE(COMP_ERR
, "Unable to initialize "
986 "/proc/net/rtl8192/%s/registers-1\n",
988 e
= create_proc_read_entry("registers-2", S_IFREG
| S_IRUGO
,
989 priv
->dir_dev
, proc_get_registers_2
, dev
);
991 RT_TRACE(COMP_ERR
, "Unable to initialize "
992 "/proc/net/rtl8192/%s/registers-2\n",
994 e
= create_proc_read_entry("registers-3", S_IFREG
| S_IRUGO
,
995 priv
->dir_dev
, proc_get_registers_3
, dev
);
997 RT_TRACE(COMP_ERR
, "Unable to initialize "
998 "/proc/net/rtl8192/%s/registers-3\n",
1000 e
= create_proc_read_entry("registers-4", S_IFREG
| S_IRUGO
,
1001 priv
->dir_dev
, proc_get_registers_4
, dev
);
1003 RT_TRACE(COMP_ERR
, "Unable to initialize "
1004 "/proc/net/rtl8192/%s/registers-4\n",
1006 e
= create_proc_read_entry("registers-5", S_IFREG
| S_IRUGO
,
1007 priv
->dir_dev
, proc_get_registers_5
, dev
);
1009 RT_TRACE(COMP_ERR
, "Unable to initialize "
1010 "/proc/net/rtl8192/%s/registers-5\n",
1012 e
= create_proc_read_entry("registers-6", S_IFREG
| S_IRUGO
,
1013 priv
->dir_dev
, proc_get_registers_6
, dev
);
1015 RT_TRACE(COMP_ERR
, "Unable to initialize "
1016 "/proc/net/rtl8192/%s/registers-6\n",
1018 e
= create_proc_read_entry("registers-7", S_IFREG
| S_IRUGO
,
1019 priv
->dir_dev
, proc_get_registers_7
, dev
);
1021 RT_TRACE(COMP_ERR
, "Unable to initialize "
1022 "/proc/net/rtl8192/%s/registers-7\n",
1024 e
= create_proc_read_entry("registers-8", S_IFREG
| S_IRUGO
,
1025 priv
->dir_dev
, proc_get_registers_8
, dev
);
1027 RT_TRACE(COMP_ERR
, "Unable to initialize "
1028 "/proc/net/rtl8192/%s/registers-8\n",
1030 e
= create_proc_read_entry("registers-9", S_IFREG
| S_IRUGO
,
1031 priv
->dir_dev
, proc_get_registers_9
, dev
);
1033 RT_TRACE(COMP_ERR
, "Unable to initialize "
1034 "/proc/net/rtl8192/%s/registers-9\n",
1036 e
= create_proc_read_entry("registers-a", S_IFREG
| S_IRUGO
,
1037 priv
->dir_dev
, proc_get_registers_a
, dev
);
1039 RT_TRACE(COMP_ERR
, "Unable to initialize "
1040 "/proc/net/rtl8192/%s/registers-a\n",
1042 e
= create_proc_read_entry("registers-b", S_IFREG
| S_IRUGO
,
1043 priv
->dir_dev
, proc_get_registers_b
, dev
);
1045 RT_TRACE(COMP_ERR
, "Unable to initialize "
1046 "/proc/net/rtl8192/%s/registers-b\n",
1048 e
= create_proc_read_entry("registers-c", S_IFREG
| S_IRUGO
,
1049 priv
->dir_dev
, proc_get_registers_c
, dev
);
1051 RT_TRACE(COMP_ERR
, "Unable to initialize "
1052 "/proc/net/rtl8192/%s/registers-c\n",
1054 e
= create_proc_read_entry("registers-d", S_IFREG
| S_IRUGO
,
1055 priv
->dir_dev
, proc_get_registers_d
, dev
);
1057 RT_TRACE(COMP_ERR
, "Unable to initialize "
1058 "/proc/net/rtl8192/%s/registers-d\n",
1060 e
= create_proc_read_entry("registers-e", S_IFREG
| S_IRUGO
,
1061 priv
->dir_dev
, proc_get_registers_e
, dev
);
1063 RT_TRACE(COMP_ERR
, "Unable to initialize "
1064 "/proc/net/rtl8192/%s/registers-e\n",
1066 e
= create_proc_read_entry("RF-A", S_IFREG
| S_IRUGO
,
1067 priv
->dir_dev
, proc_get_reg_rf_a
, dev
);
1069 RT_TRACE(COMP_ERR
, "Unable to initialize "
1070 "/proc/net/rtl8192/%s/RF-A\n",
1072 e
= create_proc_read_entry("RF-B", S_IFREG
| S_IRUGO
,
1073 priv
->dir_dev
, proc_get_reg_rf_b
, dev
);
1075 RT_TRACE(COMP_ERR
, "Unable to initialize "
1076 "/proc/net/rtl8192/%s/RF-B\n",
1078 e
= create_proc_read_entry("RF-C", S_IFREG
| S_IRUGO
,
1079 priv
->dir_dev
, proc_get_reg_rf_c
, dev
);
1081 RT_TRACE(COMP_ERR
, "Unable to initialize "
1082 "/proc/net/rtl8192/%s/RF-C\n",
1084 e
= create_proc_read_entry("RF-D", S_IFREG
| S_IRUGO
,
1085 priv
->dir_dev
, proc_get_reg_rf_d
, dev
);
1087 RT_TRACE(COMP_ERR
, "Unable to initialize "
1088 "/proc/net/rtl8192/%s/RF-D\n",
1090 e
= create_proc_read_entry("SEC-CAM-1", S_IFREG
| S_IRUGO
,
1091 priv
->dir_dev
, proc_get_cam_register_1
, dev
);
1093 RT_TRACE(COMP_ERR
, "Unable to initialize "
1094 "/proc/net/rtl8192/%s/SEC-CAM-1\n",
1096 e
= create_proc_read_entry("SEC-CAM-2", S_IFREG
| S_IRUGO
,
1097 priv
->dir_dev
, proc_get_cam_register_2
, dev
);
1099 RT_TRACE(COMP_ERR
, "Unable to initialize "
1100 "/proc/net/rtl8192/%s/SEC-CAM-2\n",
1102 e
= create_proc_read_entry("SEC-CAM-3", S_IFREG
| S_IRUGO
,
1103 priv
->dir_dev
, proc_get_cam_register_3
, dev
);
1105 RT_TRACE(COMP_ERR
, "Unable to initialize "
1106 "/proc/net/rtl8192/%s/SEC-CAM-3\n",