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