Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / ipstat.h
1 #ifndef _IPXE_IPSTATS_H
2 #define _IPXE_IPSTATS_H
3
4 /** @file
5  *
6  * IP statistics
7  *
8  */
9
10 FILE_LICENCE ( GPL2_OR_LATER );
11
12 #include <ipxe/tables.h>
13
14 struct io_buffer;
15
16 /** IP system statistics
17  *
18  * Definitions are taken from the RFC4293 section 5
19  * "ipSystemStatsEntry" table.
20  *
21  * To minimise code size, we use "unsigned long" as the counter
22  * variable type regardless of whether this type is 32-bit or 64-bit.
23  * On a 32-bit build (e.g. the standard BIOS build), this means that
24  * we omit the "high capacity" 64-bit counters (prefixed with "HC").
25  * This reduces the code size required to maintain the counter values,
26  * and avoids the need to support the "%lld" format in vsprintf.c
27  * (which would require dragging in the 64-bit division library on a
28  * standard 32-bit build).  Since total available memory in a 32-bit
29  * environment is limited to 4GB, it is unlikely that we will overflow
30  * even the 32-bit octet counters under normal operation.
31  *
32  * Counters relating to packet forwarding are omitted, since iPXE
33  * includes no functionality for acting as a router.
34  *
35  * Counters related to output fragmentation are omitted, since iPXE
36  * has no support for fragmenting transmitted packets.
37  *
38  * The ipSystemStatsInDiscards and ipSystemStatsOutDiscards counters
39  * are omitted, since they will always be zero.
40  *
41  * Separate octet counters for multicast packets are omitted to save
42  * code size.
43  */
44 struct ip_statistics {
45         /** ipSystemStatsInReceives
46          *
47          * The total number of input IP datagrams received, including
48          * those received in error.
49          */
50         unsigned long in_receives;
51         /** ipSystemStatsInOctets
52          *
53          * The total number of octets received in input IP datagrams,
54          * including those received in error.  Octets from datagrams
55          * counted in ipSystemStatsInReceives MUST be counted here.
56          */
57         unsigned long in_octets;
58         /** ipSystemStatsInHdrErrors
59          *
60          * The number of input IP datagrams discarded due to errors in
61          * their IP headers, including version number mismatch, other
62          * format errors, hop count exceeded, errors discovered in
63          * processing their IP options, etc.
64          */
65         unsigned long in_hdr_errors;
66         /** ipSystemStatsInAddrErrors
67          *
68          * The number of input IP datagrams discarded because the IP
69          * address in their IP header's destination field was not a
70          * valid address to be received at this entity.  This count
71          * includes invalid addresses (e.g., ::0).  For entities that
72          * are not IP routers and therefore do not forward datagrams,
73          * this counter includes datagrams discarded because the
74          * destination address was not a local address.
75          */
76         unsigned long in_addr_errors;
77         /** ipSystemStatsInUnknownProtos
78          *
79          * The number of locally-addressed IP datagrams received
80          * successfully but discarded because of an unknown or
81          * unsupported protocol.
82          */
83         unsigned long in_unknown_protos;
84         /** ipSystemStatsInTruncatedPkts
85          *
86          * The number of input IP datagrams discarded because the
87          * datagram frame didn't carry enough data.
88          */
89         unsigned long in_truncated_pkts;
90         /** ipSystemStatsReasmReqds
91          *
92          * The number of IP fragments received that needed to be
93          * reassembled at this interface.
94          */
95         unsigned long reasm_reqds;
96         /** ipSystemStatsReasmOks
97          *
98          * The number of IP datagrams successfully reassembled.
99          */
100         unsigned long reasm_oks;
101         /** ipSystemStatsReasmFails
102          *
103          * The number of failures detected by the IP re-assembly
104          * algorithm (for whatever reason: timed out, errors, etc.).
105          * Note that this is not necessarily a count of discarded IP
106          * fragments since some algorithms (notably the algorithm in
107          * RFC 815) can lose track of the number of fragments by
108          * combining them as they are received.
109          */
110         unsigned long reasm_fails;
111         /** ipSystemStatsInDelivers
112          *
113          * The total number of datagrams successfully delivered to IP
114          * user-protocols (including ICMP).
115          */
116         unsigned long in_delivers;
117         /** ipSystemStatsOutRequests
118          *
119          * The total number of IP datagrams that local IP user-
120          * protocols (including ICMP) supplied to IP in requests for
121          * transmission.
122          */
123         unsigned long out_requests;
124         /** ipSystemStatsOutNoRoutes
125          *
126          * The number of locally generated IP datagrams discarded
127          * because no route could be found to transmit them to their
128          * destination.
129          */
130         unsigned long out_no_routes;
131         /** ipSystemStatsOutTransmits
132          *
133          * The total number of IP datagrams that this entity supplied
134          * to the lower layers for transmission.  This includes
135          * datagrams generated locally and those forwarded by this
136          * entity.
137          */
138         unsigned long out_transmits;
139         /** ipSystemStatsOutOctets
140          *
141          * The total number of octets in IP datagrams delivered to the
142          * lower layers for transmission.  Octets from datagrams
143          * counted in ipSystemStatsOutTransmits MUST be counted here.
144          */
145         unsigned long out_octets;
146         /** ipSystemStatsInMcastPkts
147          *
148          * The number of IP multicast datagrams received.
149          */
150         unsigned long in_mcast_pkts;
151         /** ipSystemStatsOutMcastPkts
152          *
153          * The number of IP multicast datagrams transmitted.
154          */
155         unsigned long out_mcast_pkts;
156         /** ipSystemStatsInBcastPkts
157          *
158          * The number of IP broadcast datagrams received.
159          */
160         unsigned long in_bcast_pkts;
161         /** ipSystemStatsOutBcastPkts
162          *
163          * The number of IP broadcast datagrams transmitted.
164          */
165         unsigned long out_bcast_pkts;
166 };
167
168 /** An IP system statistics family */
169 struct ip_statistics_family {
170         /** IP version */
171         unsigned int version;
172         /** Statistics */
173         struct ip_statistics *stats;
174 };
175
176 /** IP system statistics family table */
177 #define IP_STATISTICS_FAMILIES \
178         __table ( struct ip_statistics_family, "ip_statistics_families" )
179
180 /** Declare an IP system statistics family */
181 #define __ip_statistics_family( order ) \
182         __table_entry ( IP_STATISTICS_FAMILIES, order )
183
184 #define IP_STATISTICS_IPV4 01
185 #define IP_STATISTICS_IPV6 02
186
187 #endif /* _IPXE_IPSTATS_H */