Rev 4350 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3666 | mejdrech | 1 | /* |
3912 | mejdrech | 2 | * Copyright (c) 2009 Lukas Mejdrech |
3666 | mejdrech | 3 | * All rights reserved. |
4 | * |
||
5 | * Redistribution and use in source and binary forms, with or without |
||
6 | * modification, are permitted provided that the following conditions |
||
7 | * are met: |
||
8 | * |
||
9 | * - Redistributions of source code must retain the above copyright |
||
10 | * notice, this list of conditions and the following disclaimer. |
||
11 | * - Redistributions in binary form must reproduce the above copyright |
||
12 | * notice, this list of conditions and the following disclaimer in the |
||
13 | * documentation and/or other materials provided with the distribution. |
||
14 | * - The name of the author may not be used to endorse or promote products |
||
15 | * derived from this software without specific prior written permission. |
||
16 | * |
||
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
||
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
||
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
||
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
||
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
27 | */ |
||
28 | |||
3912 | mejdrech | 29 | /** @addtogroup netif |
30 | * @{ |
||
3666 | mejdrech | 31 | */ |
32 | |||
3912 | mejdrech | 33 | /** @file |
34 | * Device identifier, state and usage statistics. |
||
3666 | mejdrech | 35 | */ |
36 | |||
3846 | mejdrech | 37 | #ifndef __NET_DEVICE_ID_TYPE_H__ |
38 | #define __NET_DEVICE_ID_TYPE_H__ |
||
3666 | mejdrech | 39 | |
3886 | mejdrech | 40 | #include "../structures/int_map.h" |
41 | |||
4725 | mejdrech | 42 | /** Device identifier to generic type map declaration. |
43 | */ |
||
44 | #define DEVICE_MAP_DECLARE INT_MAP_DECLARE |
||
45 | |||
46 | /** Device identifier to generic type map implementation. |
||
47 | */ |
||
3666 | mejdrech | 48 | #define DEVICE_MAP_IMPLEMENT INT_MAP_IMPLEMENT |
49 | |||
3912 | mejdrech | 50 | /** Device identifier type. |
51 | */ |
||
3846 | mejdrech | 52 | typedef int device_id_t; |
3666 | mejdrech | 53 | |
3912 | mejdrech | 54 | /** Device state type. |
55 | */ |
||
3846 | mejdrech | 56 | typedef enum device_state device_state_t; |
57 | |||
3912 | mejdrech | 58 | /** Type definition of the device usage statistics. |
59 | * @see device_stats |
||
60 | */ |
||
3846 | mejdrech | 61 | typedef struct device_stats device_stats_t; |
3912 | mejdrech | 62 | |
63 | /** Type definition of the device usage statistics pointer. |
||
64 | * @see device_stats |
||
65 | */ |
||
3846 | mejdrech | 66 | typedef device_stats_t * device_stats_ref; |
67 | |||
3912 | mejdrech | 68 | /** Device state. |
69 | */ |
||
3846 | mejdrech | 70 | enum device_state{ |
3912 | mejdrech | 71 | /** Device not present or not initialized. |
72 | */ |
||
3846 | mejdrech | 73 | NETIF_NULL = 0, |
3912 | mejdrech | 74 | /** Device present and stopped. |
75 | */ |
||
3846 | mejdrech | 76 | NETIF_STOPPED, |
3912 | mejdrech | 77 | /** Device present and active. |
78 | */ |
||
3846 | mejdrech | 79 | NETIF_ACTIVE, |
3912 | mejdrech | 80 | /** Device present but unable to transmit. |
81 | */ |
||
3846 | mejdrech | 82 | NETIF_CARRIER_LOST |
83 | }; |
||
84 | |||
3912 | mejdrech | 85 | /** Device usage statistics. |
86 | * Based on linux_kernel/include/linux/netdevice.h. |
||
87 | */ |
||
3846 | mejdrech | 88 | struct device_stats{ |
3912 | mejdrech | 89 | /** Total packets received. |
90 | */ |
||
91 | unsigned long rx_packets; |
||
92 | /** Total packets transmitted. |
||
93 | */ |
||
94 | unsigned long tx_packets; |
||
95 | /** Total bytes received. |
||
96 | */ |
||
97 | unsigned long rx_bytes; |
||
98 | /** Total bytes transmitted. |
||
99 | */ |
||
100 | unsigned long tx_bytes; |
||
101 | /** Bad packets received counter. |
||
102 | */ |
||
103 | unsigned long rx_errors; |
||
104 | /** Packet transmition problems counter. |
||
105 | */ |
||
106 | unsigned long tx_errors; |
||
107 | /** No space in buffers counter. |
||
108 | */ |
||
109 | unsigned long rx_dropped; |
||
110 | /** No space available counter. |
||
111 | */ |
||
112 | unsigned long tx_dropped; |
||
113 | /** Total multicast packets received. |
||
114 | */ |
||
115 | unsigned long multicast; |
||
116 | /** The number of collisions due to congestion on the medium. |
||
117 | */ |
||
3846 | mejdrech | 118 | unsigned long collisions; |
119 | |||
120 | /* detailed rx_errors: */ |
||
3912 | mejdrech | 121 | /** Received packet length error counter. |
122 | */ |
||
3846 | mejdrech | 123 | unsigned long rx_length_errors; |
3912 | mejdrech | 124 | /** Receiver buffer overflow counter. |
125 | */ |
||
126 | unsigned long rx_over_errors; |
||
127 | /** Received packet with crc error counter. |
||
128 | */ |
||
129 | unsigned long rx_crc_errors; |
||
130 | /** Received frame alignment error counter. |
||
131 | */ |
||
132 | unsigned long rx_frame_errors; |
||
133 | /** Receiver fifo overrun counter. |
||
134 | */ |
||
135 | unsigned long rx_fifo_errors; |
||
136 | /** Receiver missed packet counter. |
||
137 | */ |
||
138 | unsigned long rx_missed_errors; |
||
3846 | mejdrech | 139 | |
140 | /* detailed tx_errors */ |
||
3912 | mejdrech | 141 | /** Transmitter aborted counter. |
142 | */ |
||
3846 | mejdrech | 143 | unsigned long tx_aborted_errors; |
3912 | mejdrech | 144 | /** Transmitter carrier errors counter. |
145 | */ |
||
3846 | mejdrech | 146 | unsigned long tx_carrier_errors; |
3912 | mejdrech | 147 | /** Transmitter fifo overrun counter. |
148 | */ |
||
3846 | mejdrech | 149 | unsigned long tx_fifo_errors; |
3912 | mejdrech | 150 | /** Transmitter carrier errors counter. |
151 | */ |
||
3846 | mejdrech | 152 | unsigned long tx_heartbeat_errors; |
3912 | mejdrech | 153 | /** Transmitter window errors counter. |
154 | */ |
||
3846 | mejdrech | 155 | unsigned long tx_window_errors; |
156 | |||
157 | /* for cslip etc */ |
||
3912 | mejdrech | 158 | /** Total compressed packets received. |
159 | */ |
||
3846 | mejdrech | 160 | unsigned long rx_compressed; |
3912 | mejdrech | 161 | /** Total compressed packet transmitted. |
162 | */ |
||
3846 | mejdrech | 163 | unsigned long tx_compressed; |
164 | }; |
||
165 | |||
3666 | mejdrech | 166 | #endif |
167 | |||
168 | /** @} |
||
169 | */ |
||
170 |