Linux 2.6.33-rc6
[cris-mirror.git] / drivers / staging / octeon / ethernet-proc.c
blob16308d484d3b6910f77b23504894126158d1d2aa
1 /**********************************************************************
2 * Author: Cavium Networks
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
7 * Copyright (c) 2003-2007 Cavium Networks
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 **********************************************************************/
27 #include <linux/kernel.h>
28 #include <linux/seq_file.h>
29 #include <linux/proc_fs.h>
30 #include <net/dst.h>
32 #include <asm/octeon/octeon.h>
34 #include "octeon-ethernet.h"
35 #include "ethernet-defines.h"
37 #include "cvmx-helper.h"
38 #include "cvmx-pip.h"
40 /**
41 * User is reading /proc/octeon_ethernet_stats
43 * @m:
44 * @v:
45 * Returns
47 static int cvm_oct_stats_show(struct seq_file *m, void *v)
49 struct octeon_ethernet *priv;
50 int port;
52 for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
54 if (cvm_oct_device[port]) {
55 priv = netdev_priv(cvm_oct_device[port]);
57 seq_printf(m, "\nOcteon Port %d (%s)\n", port,
58 cvm_oct_device[port]->name);
59 seq_printf(m,
60 "rx_packets: %12lu\t"
61 "tx_packets: %12lu\n",
62 priv->stats.rx_packets,
63 priv->stats.tx_packets);
64 seq_printf(m,
65 "rx_bytes: %12lu\t"
66 "tx_bytes: %12lu\n",
67 priv->stats.rx_bytes, priv->stats.tx_bytes);
68 seq_printf(m,
69 "rx_errors: %12lu\t"
70 "tx_errors: %12lu\n",
71 priv->stats.rx_errors,
72 priv->stats.tx_errors);
73 seq_printf(m,
74 "rx_dropped: %12lu\t"
75 "tx_dropped: %12lu\n",
76 priv->stats.rx_dropped,
77 priv->stats.tx_dropped);
78 seq_printf(m,
79 "rx_length_errors: %12lu\t"
80 "tx_aborted_errors: %12lu\n",
81 priv->stats.rx_length_errors,
82 priv->stats.tx_aborted_errors);
83 seq_printf(m,
84 "rx_over_errors: %12lu\t"
85 "tx_carrier_errors: %12lu\n",
86 priv->stats.rx_over_errors,
87 priv->stats.tx_carrier_errors);
88 seq_printf(m,
89 "rx_crc_errors: %12lu\t"
90 "tx_fifo_errors: %12lu\n",
91 priv->stats.rx_crc_errors,
92 priv->stats.tx_fifo_errors);
93 seq_printf(m,
94 "rx_frame_errors: %12lu\t"
95 "tx_heartbeat_errors: %12lu\n",
96 priv->stats.rx_frame_errors,
97 priv->stats.tx_heartbeat_errors);
98 seq_printf(m,
99 "rx_fifo_errors: %12lu\t"
100 "tx_window_errors: %12lu\n",
101 priv->stats.rx_fifo_errors,
102 priv->stats.tx_window_errors);
103 seq_printf(m,
104 "rx_missed_errors: %12lu\t"
105 "multicast: %12lu\n",
106 priv->stats.rx_missed_errors,
107 priv->stats.multicast);
111 return 0;
115 * /proc/octeon_ethernet_stats was openned. Use the single_open iterator
117 * @inode:
118 * @file:
119 * Returns
121 static int cvm_oct_stats_open(struct inode *inode, struct file *file)
123 return single_open(file, cvm_oct_stats_show, NULL);
126 static const struct file_operations cvm_oct_stats_operations = {
127 .open = cvm_oct_stats_open,
128 .read = seq_read,
129 .llseek = seq_lseek,
130 .release = single_release,
133 void cvm_oct_proc_initialize(void)
135 struct proc_dir_entry *entry =
136 create_proc_entry("octeon_ethernet_stats", 0, NULL);
137 if (entry)
138 entry->proc_fops = &cvm_oct_stats_operations;
141 void cvm_oct_proc_shutdown(void)
143 remove_proc_entry("octeon_ethernet_stats", NULL);