2 #include <linux/proc_fs.h>
7 struct proc_dir_entry
*ppe_proc_dir
;
9 int proc_read_idle_counter(char *page
, char **start
, off_t off
, int count
, int *eof
, void *data
)
13 len
+= sprintf(page
+ off
, "Channel 0\n");
14 len
+= sprintf(page
+ off
+ len
, " TX\n");
15 len
+= sprintf(page
+ off
+ len
,
16 " DREG_AT_CELL0 = %d\n", *DREG_AT_CELL0
& 0xFFFF);
17 len
+= sprintf(page
+ off
+ len
,
18 " DREG_AT_IDLE_CNT0 = %d\n", *DREG_AT_IDLE_CNT0
& 0xFFFF);
19 len
+= sprintf(page
+ off
+ len
, " RX\n");
20 len
+= sprintf(page
+ off
+ len
,
21 " DREG_AR_CELL0 = %d\n", *DREG_AR_CELL0
& 0xFFFF);
22 len
+= sprintf(page
+ off
+ len
,
23 " DREG_AR_IDLE_CNT0 = %d\n", *DREG_AR_IDLE_CNT0
& 0xFFFF);
24 len
+= sprintf(page
+ off
+ len
,
25 " DREG_AR_AIIDLE_CNT0 = %d\n", *DREG_AR_AIIDLE_CNT0
& 0xFFFF);
26 len
+= sprintf(page
+ off
+ len
,
27 " DREG_AR_BE_CNT0 = %d\n", *DREG_AR_BE_CNT0
& 0xFFFF);
28 len
+= sprintf(page
+ off
+ len
, "Channel 1\n");
29 len
+= sprintf(page
+ off
+ len
, " TX\n");
30 len
+= sprintf(page
+ off
+ len
,
31 " DREG_AT_CELL1 = %d\n", *DREG_AT_CELL1
& 0xFFFF);
32 len
+= sprintf(page
+ off
+ len
,
33 " DREG_AT_IDLE_CNT1 = %d\n", *DREG_AT_IDLE_CNT1
& 0xFFFF);
34 len
+= sprintf(page
+ off
+ len
, " RX\n");
35 len
+= sprintf(page
+ off
+ len
,
36 " DREG_AR_CELL1 = %d\n", *DREG_AR_CELL1
& 0xFFFF);
37 len
+= sprintf(page
+ off
+ len
,
38 " DREG_AR_IDLE_CNT1 = %d\n", *DREG_AR_IDLE_CNT1
& 0xFFFF);
39 len
+= sprintf(page
+ off
+ len
,
40 " DREG_AR_AIIDLE_CNT1 = %d\n", *DREG_AR_AIIDLE_CNT1
& 0xFFFF);
41 len
+= sprintf(page
+ off
+ len
,
42 " DREG_AR_BE_CNT1 = %d\n", *DREG_AR_BE_CNT1
& 0xFFFF);
47 int proc_read_stats(char *page
, char **start
, off_t off
, int count
, int *eof
, void *data
)
52 struct connection
*connection
;
56 len
+= sprintf(page
+ off
, "ATM Stats:\n");
58 connection
= ppe_dev
.connection
;
60 for ( i
= 0; i
< ATM_PORT_NUMBER
; i
++, port
++ )
62 base
= port
->connection_base
;
63 for ( j
= 0; j
< port
->max_connections
; j
++, base
++ )
64 if ( (port
->connection_table
& (1 << j
))
65 && connection
[base
].vcc
!= NULL
)
67 if ( connection
[base
].vcc
->stats
)
69 struct k_atm_aal_stats
*stats
= connection
[base
].vcc
->stats
;
71 len
+= sprintf(page
+ off
+ len
, " VCC %d.%d.%d (stats)\n", i
, connection
[base
].vcc
->vpi
, connection
[base
].vcc
->vci
);
72 len
+= sprintf(page
+ off
+ len
, " rx = %d\n", stats
->rx
.counter
);
73 len
+= sprintf(page
+ off
+ len
, " rx_err = %d\n", stats
->rx_err
.counter
);
74 len
+= sprintf(page
+ off
+ len
, " rx_drop = %d\n", stats
->rx_drop
.counter
);
75 len
+= sprintf(page
+ off
+ len
, " tx = %d\n", stats
->tx
.counter
);
76 len
+= sprintf(page
+ off
+ len
, " tx_err = %d\n", stats
->tx_err
.counter
);
79 len
+= sprintf(page
+ off
+ len
, " VCC %d.%d.%d\n", i
, connection
[base
].vcc
->vpi
, connection
[base
].vcc
->vci
);
86 void proc_file_create(void)
88 ppe_proc_dir
= proc_mkdir("ppe", NULL
);
89 create_proc_read_entry("idle_counter", 0, ppe_proc_dir
, proc_read_idle_counter
, NULL
);
90 create_proc_read_entry("stats", 0, ppe_proc_dir
, proc_read_stats
, NULL
);
93 void proc_file_delete(void)
95 remove_proc_entry("idle_counter", ppe_proc_dir
);
96 remove_proc_entry("stats", ppe_proc_dir
);
97 remove_proc_entry("ppe", NULL
);
This page took 0.047426 seconds and 5 git commands to generate.