1 #ifndef _IPXE_IPSTATS_H
2 #define _IPXE_IPSTATS_H
10 FILE_LICENCE ( GPL2_OR_LATER );
12 #include <ipxe/tables.h>
16 /** IP system statistics
18 * Definitions are taken from the RFC4293 section 5
19 * "ipSystemStatsEntry" table.
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.
32 * Counters relating to packet forwarding are omitted, since iPXE
33 * includes no functionality for acting as a router.
35 * Counters related to output fragmentation are omitted, since iPXE
36 * has no support for fragmenting transmitted packets.
38 * The ipSystemStatsInDiscards and ipSystemStatsOutDiscards counters
39 * are omitted, since they will always be zero.
41 * Separate octet counters for multicast packets are omitted to save
44 struct ip_statistics {
45 /** ipSystemStatsInReceives
47 * The total number of input IP datagrams received, including
48 * those received in error.
50 unsigned long in_receives;
51 /** ipSystemStatsInOctets
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.
57 unsigned long in_octets;
58 /** ipSystemStatsInHdrErrors
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.
65 unsigned long in_hdr_errors;
66 /** ipSystemStatsInAddrErrors
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.
76 unsigned long in_addr_errors;
77 /** ipSystemStatsInUnknownProtos
79 * The number of locally-addressed IP datagrams received
80 * successfully but discarded because of an unknown or
81 * unsupported protocol.
83 unsigned long in_unknown_protos;
84 /** ipSystemStatsInTruncatedPkts
86 * The number of input IP datagrams discarded because the
87 * datagram frame didn't carry enough data.
89 unsigned long in_truncated_pkts;
90 /** ipSystemStatsReasmReqds
92 * The number of IP fragments received that needed to be
93 * reassembled at this interface.
95 unsigned long reasm_reqds;
96 /** ipSystemStatsReasmOks
98 * The number of IP datagrams successfully reassembled.
100 unsigned long reasm_oks;
101 /** ipSystemStatsReasmFails
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.
110 unsigned long reasm_fails;
111 /** ipSystemStatsInDelivers
113 * The total number of datagrams successfully delivered to IP
114 * user-protocols (including ICMP).
116 unsigned long in_delivers;
117 /** ipSystemStatsOutRequests
119 * The total number of IP datagrams that local IP user-
120 * protocols (including ICMP) supplied to IP in requests for
123 unsigned long out_requests;
124 /** ipSystemStatsOutNoRoutes
126 * The number of locally generated IP datagrams discarded
127 * because no route could be found to transmit them to their
130 unsigned long out_no_routes;
131 /** ipSystemStatsOutTransmits
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
138 unsigned long out_transmits;
139 /** ipSystemStatsOutOctets
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.
145 unsigned long out_octets;
146 /** ipSystemStatsInMcastPkts
148 * The number of IP multicast datagrams received.
150 unsigned long in_mcast_pkts;
151 /** ipSystemStatsOutMcastPkts
153 * The number of IP multicast datagrams transmitted.
155 unsigned long out_mcast_pkts;
156 /** ipSystemStatsInBcastPkts
158 * The number of IP broadcast datagrams received.
160 unsigned long in_bcast_pkts;
161 /** ipSystemStatsOutBcastPkts
163 * The number of IP broadcast datagrams transmitted.
165 unsigned long out_bcast_pkts;
168 /** An IP system statistics family */
169 struct ip_statistics_family {
171 unsigned int version;
173 struct ip_statistics *stats;
176 /** IP system statistics family table */
177 #define IP_STATISTICS_FAMILIES \
178 __table ( struct ip_statistics_family, "ip_statistics_families" )
180 /** Declare an IP system statistics family */
181 #define __ip_statistics_family( order ) \
182 __table_entry ( IP_STATISTICS_FAMILIES, order )
184 #define IP_STATISTICS_IPV4 01
185 #define IP_STATISTICS_IPV6 02
187 #endif /* _IPXE_IPSTATS_H */