stream_statistics_compat.h Source File

Reference Documentation

Platform
Intel® PAC
Napatech SmartNIC
Content Type
Reference Information
Capture Software Version
Link™ Capture Software 12.10
Napatech Software Suite: include/ntapi/stream_statistics_compat.h Source File
stream_statistics_compat.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (C) 2023 Napatech A/S.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Napatech A/S nor the
14  * names of its contributors may 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL NAPATECH A/S BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  *
29 
30  */
31 
32 /**
33  * @file
34  *
35  * This is the header file of the statistics stream interface containing
36  * included for backward compatibility structures.
37  *
38  */
39 
40 #ifndef __STREAM_STATISTICS_COMPAT_H__
41 #define __STREAM_STATISTICS_COMPAT_H__
42 
43 #if !defined(_NT_NTAPI_NO_COMPAT)
44 
45 /********************************************************************************/
46 /* Statistics data defines for NT_STATISTICS_READ_CMD_QUERY */
47 /********************************************************************************/
48 #define NT_STATISTICS_READ_CMD_QUERY NT_STATISTICS_READ_CMD_COMPAT_0
49 
50 /**
51  * Extended drop counters - these counters will count the packets
52  * dropped for various reasons
53  */
54 struct NtExtendedDropCounters_s {
55  uint64_t pktsMacBandwidth; //!< Number of packets dropped by the MAC because of bandwidth issues and number of packets < 17 octets. This counter is also available in @ref NtRMON1Counters_s::dropEvents.
56 
57  uint64_t pktsOverflow; //!< Number of packets dropped because the port buffer is full
58  uint64_t octetsOverflow; //!< Number of octets dropped because the port buffer is full
59 
60  uint64_t pktsDedup; //!< Number of packets dropped because of deduplication
61  uint64_t octetsDedup; //!< Number of octets dropped because of deduplication
62 
63  uint64_t pktsNoFilter; //!< Number of packets dropped because they do not match a filter
64  uint64_t octetsNoFilter; //!< Number of octets dropped because they do not match a filter
65 };
66 
67 /**
68  * Extended RMON - these counters are used to categorize packets not handled by RMON1
69  */
70 struct NtExtendedRMONCounters_s {
71  uint64_t pkts1519to2047Octets; //!< Number of packets in the range 1519 to 2047 octets
72  uint64_t pkts2048to4095Octets; //!< Number of packets in the range 2048 to 4095 octets
73  uint64_t pkts4096to8191Octets; //!< Number of packets in the range 4096 to 8191 octets
74  uint64_t pkts8192toMaxOctets; //!< Number of packets in the range 8192 to MAX octets
75  uint64_t pktsHardSlice; //!< Number of packets in the range 10001 to 16383 octets
76  uint64_t pktsHardSliceJabber; //!< Number of bad packets in the range 10001 to 16383 octets and packets > 16383 octets
77  uint64_t unicastPkts; //!< Number of Unicast packets including MAC control packets
78  // The following counters are also counted as a sum in @ref NtRMON1Counters_s::crcAlignErrors.
79  uint64_t pktsCrc; //!< Number of packets with CRC errors
80  uint64_t pktsAlignment; //!< Number of packets with alignment errors
81  uint64_t pktsCodeViolation; //!< Number of packets with code violation errors
82 };
83 
84 /**
85  * Packet decoding counters - these counters are available on adapters with a packet decoder
86  */
87 struct NtDecodeCounters_s {
88  uint64_t pktsGiantUndersize; //!< Number of packets > 63 bytes including tags and =< 63 excluding tags
89  uint64_t pktsBabyGiant; //!< Number of packets > MAX including tags and =< MAX excluding tags
90  uint64_t pktsNotIslVlanMpls; //!< Number of packets without ISL, VLAN and MPLS
91  uint64_t pktsIsl; //!< Number of packets with ISL
92  uint64_t pktsVlan; //!< Number of packets with VLAN
93  uint64_t pktsIslVlan; //!< Number of packets with ISL and VLAN
94  uint64_t pktsMpls; //!< Number of packets with MPLS
95  uint64_t pktsIslMpls; //!< Number of packets with ISL and MPLS
96  uint64_t pktsVlanMpls; //!< Number of packets with VLAN and MPLS
97  uint64_t pktsIslVlanMpls; //!< Number of packets with ISL, VLAN and MPLS
98 };
99 
100 /**
101  * Statistics for each port
102  */
103 struct NtPortStatistics_s {
104  /**
105  * Valid indicators. These indicate which counters are supported by the port.
106  */
107  struct NtPortStatisticsValid_s {
108  int RMON1; //!< Is set if RMON1 counters are supported
109  int extRMON; //!< Is set if extended RMON counters are supported
110  int chksum; //!< Is set if IP/TCP/UDP checksum counters are supported
111  int decode; //!< Is set if packet decode counters are supported
112  int extDrop; //!< Is set if extended drop counters are supported
113  } valid;
114 
115  struct NtRMON1Counters_s RMON1; //!< RMON1 counters
116  struct NtExtendedRMONCounters_s extRMON; //!< Extended RMON counters
117  struct NtCheckSumCounters_s chksum; //!< Checksum error counters
118  struct NtDecodeCounters_s decode; //!< Packets decoded by onboard packet decoder
119  struct NtExtendedDropCounters_s extDrop; //!< Extended drop counters
120 };
121 
122 /**
123  * Statistics info group for port statistics
124  */
125 struct NtStatGroupPort_s {
126  struct NtPortStatistics_s rx; //!< Counters based on RX ports
127  struct NtPortStatistics_s tx; //!< Counters based on TX ports
128  uint64_t linkDownCounter; //!< Counts number of link downs
129 
130  uint64_t ts; //!< Port counter sample time stamp
131  enum NtTimestampType_e tsType; //!< Time stamp type
132 };
133 
134 struct NtStatisticsQuery_s {
135  int poll; //!< Gets the current statistical information or waits for a new update
136  int clear; //!< Clears the statistical information after it has been read. All statistics counters for the current stream will be cleared. Other statistics streams will remain untouched.
137  /**
138  * Data section holding the statistic counters
139  */
140  struct NtStatisticsQueryResult_s {
141  /**
142  * Port specific statistics
143  */
144  struct NtStatisticsQueryPortResult_s {
145  uint8_t numPorts; //!< Number of ports in @ref aPorts
146  uint8_t Reserved1[3];
147  struct NtStatGroupPort_s aPorts[64]; //!< Array of port statistic structures in the system
148  } port;
149  /**
150  * Adapter specific statistics
151  */
152  struct NtStatisticsQueryAdapterResult_s {
153  uint8_t numAdapters; //!< Number of adapters in @ref aAdapters
154  uint8_t Reserved1[3];
155  struct NtStatGroupAdapter_s aAdapters[10]; //!< Array of adapter statistic structures
156  } adapter;
157  } data; //!< Structure for statistic results
158 };
159 
160 /********************************************************************************/
161 /* Statistics data defines for NT_STATISTICS_READ_CMD_QUERY_V1 */
162 /********************************************************************************/
163 #define NT_STATISTICS_READ_CMD_QUERY_V1 NT_STATISTICS_READ_CMD_COMPAT_1
164 
165 /**
166  * Statistics for each port
167  */
168 struct NtPortStatistics_v1_s {
169  /**
170  * Valid indicators - these indicate which counters are supported by the port
171  */
172  struct NtPortStatisticsValid_v1_s {
173  int RMON1; //!< Is set if RMON1 counters are supported
174  int extRMON; //!< Is set if extended RMON counters are supported
175  int chksum; //!< Is set if IP/TCP/UDP checksum counters are supported
176  int decode; //!< Is set if packet decode counters are supported
177  int extDrop; //!< Is set if extended drop counters are supported
178  int ipf; //!< Is set if IP fragment table counters are supported
179  } valid;
180 
181  struct NtRMON1Counters_s RMON1; //!< RMON1 counters
182  struct NtExtendedRMONCounters_s extRMON; //!< Extended RMON counters
183  struct NtCheckSumCounters_s chksum; //!< Checksum error counters
184  struct NtDecodeCounters_s decode; //!< Packets decoded by onboard packet decoder
185  struct NtExtendedDropCounters_s extDrop; //!< Extended drop counters
186  struct NtIpFragTableCounters_s ipf; //!< IP fragment table counters (when using IPFMode)
187 };
188 
189 /**
190  * Statistics info group for port statistics
191  */
192 struct NtStatGroupport_v1_s {
193  struct NtPortStatistics_v1_s rx; //!< Counters based on RX ports
194  struct NtPortStatistics_v1_s tx; //!< Counters based on TX ports
195  uint64_t linkDownCounter; //!< Counts number of link downs
196  uint64_t ts; //!< Port counter sample time stamp. The format of the timestamp is specified by @ref tsType.
197  enum NtTimestampType_e tsType; //!< Time stamp type - For a description of the time stamp type see "DN-0384 3GD Time-Stamping and Time Synchronization User Guide"
198 };
199 
200 
201 struct NtStatisticsQuery_v1_s {
202  int poll; //!< Gets the current statistical information or waits for a new update
203  int clear; //!< Clears the statistical information after it has been read. All statistics counters for the current stream will be cleared. Other statistics streams will remain untouched.
204  /**
205  * Data section holding the statistic counters
206  */
207  struct NtStatisticsQueryResult_v1_s {
208  /**
209  * Port specific statistics
210  */
211  struct NtStatisticsQueryPortResult_v1_s {
212  uint8_t numPorts; //!< Number of ports in @ref aPorts
213  uint8_t Reserved1[3];
214  struct NtStatGroupport_v1_s aPorts[64]; //!< Array of port statistic structures in the system
215  } port;
216  /**
217  * Adapter specific statistics
218  */
219  struct NtStatisticsQueryAdapterResult_v1_s {
220  uint8_t numAdapters; //!< Number of adapters in @ref aAdapters
221  uint8_t Reserved1[3];
222  struct NtStatGroupAdapter_s aAdapters[10]; //!< Array of adapter statistic structures
223  } adapter;
224  } data; //!< Structure for statistic results
225 };
226 
227 
228 /********************************************************************************/
229 /* Statistics data defines for NT_STATISTICS_READ_CMD_QUERY_V2 */
230 /********************************************************************************/
231 #define NT_STATISTICS_READ_CMD_QUERY_V2 NT_STATISTICS_READ_CMD_COMPAT_2
232 
233 struct NtStatisticsQuery_v2_s {
234  int poll; //!< Gets the current statistical information or waits for a new update
235  int clear; //!< Clears the statistical information after it has been read. All statistics counters for the current stream will be cleared. Other statistics streams will remain untouched.
236  /**
237  * Data section holding the statistic counters
238  */
239  struct NtStatisticsQueryResult_v2_s {
240  /**
241  * Port specific statistics
242  */
243  struct NtStatisticsQueryPortResult_v2_s {
244  uint8_t numPorts; //!< Number of ports in @ref aPorts
245  uint8_t Reserved1[3];
246 //
247 
248  struct NtStatGroupport_v1_s aPorts[64]; //!< Array of port statistic structures in the system
249 //
250 
251  } port;
252  /**
253  * Adapter specific statistics
254  */
255  struct NtStatisticsQueryAdapterResult_v2_s {
256  uint8_t numAdapters; //!< Number of adapters in @ref aAdapters
257  uint8_t Reserved1[3];
258  struct NtStatGroupAdapter_s aAdapters[10]; //!< Array of adapter statistic structures
259  } adapter;
260  /**
261  * Stream specific statistics
262  */
263  struct NtStatGroupStream_s stream;
264  } data; //!< Structure for statistic results
265 };
266 
267 #endif /* _NT_NTAPI_NO_COMPAT */
268 #endif /* __STREAM_STATISTICS_COMPAT_H__ */