summaryrefslogtreecommitdiffstats
path: root/package/ifxmips-atm/src/proc.c
diff options
context:
space:
mode:
authorblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-10-02 09:41:22 +0000
committerblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-10-02 09:41:22 +0000
commit6d5918487d06c85c193d01c12f2297ca3d9f6433 (patch)
tree8caf0c94e441c5d63db606081de7ccf0748a04cf /package/ifxmips-atm/src/proc.c
parenta10614cd42f98639ac1857d3f33ed6924e3c0811 (diff)
adds atm driver for ifxmips, code ported from wippies 2.6.16 gpl release. it compiles but throws ioctl -EINVAL during bring up of atm device, hence marked as broken
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@17819 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/ifxmips-atm/src/proc.c')
-rw-r--r--package/ifxmips-atm/src/proc.c98
1 files changed, 98 insertions, 0 deletions
diff --git a/package/ifxmips-atm/src/proc.c b/package/ifxmips-atm/src/proc.c
new file mode 100644
index 000000000..47b882052
--- /dev/null
+++ b/package/ifxmips-atm/src/proc.c
@@ -0,0 +1,98 @@
+#include <linux/atm.h>
+#include <linux/proc_fs.h>
+
+#include "proc.h"
+#include "common.h"
+
+struct proc_dir_entry *ppe_proc_dir;
+
+int proc_read_idle_counter(char *page, char **start, off_t off, int count, int *eof, void *data)
+{
+ int len = 0;
+
+ len += sprintf(page + off, "Channel 0\n");
+ len += sprintf(page + off + len, " TX\n");
+ len += sprintf(page + off + len,
+ " DREG_AT_CELL0 = %d\n", *DREG_AT_CELL0 & 0xFFFF);
+ len += sprintf(page + off + len,
+ " DREG_AT_IDLE_CNT0 = %d\n", *DREG_AT_IDLE_CNT0 & 0xFFFF);
+ len += sprintf(page + off + len, " RX\n");
+ len += sprintf(page + off + len,
+ " DREG_AR_CELL0 = %d\n", *DREG_AR_CELL0 & 0xFFFF);
+ len += sprintf(page + off + len,
+ " DREG_AR_IDLE_CNT0 = %d\n", *DREG_AR_IDLE_CNT0 & 0xFFFF);
+ len += sprintf(page + off + len,
+ " DREG_AR_AIIDLE_CNT0 = %d\n", *DREG_AR_AIIDLE_CNT0 & 0xFFFF);
+ len += sprintf(page + off + len,
+ " DREG_AR_BE_CNT0 = %d\n", *DREG_AR_BE_CNT0 & 0xFFFF);
+ len += sprintf(page + off + len, "Channel 1\n");
+ len += sprintf(page + off + len, " TX\n");
+ len += sprintf(page + off + len,
+ " DREG_AT_CELL1 = %d\n", *DREG_AT_CELL1 & 0xFFFF);
+ len += sprintf(page + off + len,
+ " DREG_AT_IDLE_CNT1 = %d\n", *DREG_AT_IDLE_CNT1 & 0xFFFF);
+ len += sprintf(page + off + len, " RX\n");
+ len += sprintf(page + off + len,
+ " DREG_AR_CELL1 = %d\n", *DREG_AR_CELL1 & 0xFFFF);
+ len += sprintf(page + off + len,
+ " DREG_AR_IDLE_CNT1 = %d\n", *DREG_AR_IDLE_CNT1 & 0xFFFF);
+ len += sprintf(page + off + len,
+ " DREG_AR_AIIDLE_CNT1 = %d\n", *DREG_AR_AIIDLE_CNT1 & 0xFFFF);
+ len += sprintf(page + off + len,
+ " DREG_AR_BE_CNT1 = %d\n", *DREG_AR_BE_CNT1 & 0xFFFF);
+
+ return len;
+}
+
+int proc_read_stats(char *page, char **start, off_t off, int count, int *eof, void *data)
+{
+ int len = 0;
+
+ int i, j;
+ struct connection *connection;
+ struct port *port;
+ int base;
+
+ len += sprintf(page + off, "ATM Stats:\n");
+
+ connection = ppe_dev.connection;
+ port = ppe_dev.port;
+ for ( i = 0; i < ATM_PORT_NUMBER; i++, port++ )
+ {
+ base = port->connection_base;
+ for ( j = 0; j < port->max_connections; j++, base++ )
+ if ( (port->connection_table & (1 << j))
+ && connection[base].vcc != NULL )
+ {
+ if ( connection[base].vcc->stats )
+ {
+ struct k_atm_aal_stats *stats = connection[base].vcc->stats;
+
+ len += sprintf(page + off + len, " VCC %d.%d.%d (stats)\n", i, connection[base].vcc->vpi, connection[base].vcc->vci);
+ len += sprintf(page + off + len, " rx = %d\n", stats->rx.counter);
+ len += sprintf(page + off + len, " rx_err = %d\n", stats->rx_err.counter);
+ len += sprintf(page + off + len, " rx_drop = %d\n", stats->rx_drop.counter);
+ len += sprintf(page + off + len, " tx = %d\n", stats->tx.counter);
+ len += sprintf(page + off + len, " tx_err = %d\n", stats->tx_err.counter);
+ }
+ else
+ len += sprintf(page + off + len, " VCC %d.%d.%d\n", i, connection[base].vcc->vpi, connection[base].vcc->vci);
+ }
+ }
+
+ return len;
+}
+
+void proc_file_create(void)
+{
+ ppe_proc_dir = proc_mkdir("ppe", NULL);
+ create_proc_read_entry("idle_counter", 0, ppe_proc_dir, proc_read_idle_counter, NULL);
+ create_proc_read_entry("stats", 0, ppe_proc_dir, proc_read_stats, NULL);
+}
+
+void proc_file_delete(void)
+{
+ remove_proc_entry("idle_counter", ppe_proc_dir);
+ remove_proc_entry("stats", ppe_proc_dir);
+ remove_proc_entry("ppe", NULL);
+}