stream_statistics_compat.h Source File

Reference Documentation

Platform
Napatech SmartNIC
Content Type
Reference Information
Capture Software Version
Link™ Capture Software 12.15
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) 2025 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 associated SDRAM and host buffers are full
58  uint64_t octetsOverflow; //!< Number of octets dropped because the associated SDRAM and host buffers are 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_v2_s {
104  /**
105  * Valid indicators - these indicate which counters are supported by the port
106  */
107  struct NtPortStatisticsValid_v2_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  int ipf; //!< Is set if IP fragment table counters are supported
114  } valid;
115 
116  struct NtRMON1Counters_s RMON1; //!< RMON1 counters
117  struct NtExtendedRMONCounters_v1_s extRMON; //!< Extended RMON counters
118  struct NtCheckSumCounters_s chksum; //!< Checksum error counters
119  struct NtDecodeCounters_v1_s decode; //!< Packets decoded by onboard packet decoder
120  struct NtExtendedDropCounters_v1_s extDrop; //!< Extended drop counters
121  struct NtIpFragTableCounters_s ipf; //!< IP fragment table counters (when using IPFMode)
122 };
123 
124 /**
125  * Statistics info group for port statistics
126  */
127 struct NtStatGroupport_v2_s {
128  struct NtPortStatistics_v2_s rx; //!< Counters based on RX ports
129  struct NtPortStatistics_v2_s tx; //!< Counters based on TX ports
130  uint64_t linkDownCounter; //!< Counts number of link downs
131  uint64_t ts; //!< Port counter sample time stamp. The format of the timestamp is specified by @ref tsType.
132  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"
133 };
134 
135 /**
136  * Statistics for each port
137  */
138 struct NtPortStatistics_s {
139  /**
140  * Valid indicators. These indicate which counters are supported by the port.
141  */
142  struct NtPortStatisticsValid_s {
143  int RMON1; //!< Is set if RMON1 counters are supported
144  int extRMON; //!< Is set if extended RMON counters are supported
145  int chksum; //!< Is set if IP/TCP/UDP checksum counters are supported
146  int decode; //!< Is set if packet decode counters are supported
147  int extDrop; //!< Is set if extended drop counters are supported
148  } valid;
149 
150  struct NtRMON1Counters_s RMON1; //!< RMON1 counters
151  struct NtExtendedRMONCounters_s extRMON; //!< Extended RMON counters
152  struct NtCheckSumCounters_s chksum; //!< Checksum error counters
153  struct NtDecodeCounters_s decode; //!< Packets decoded by onboard packet decoder
154  struct NtExtendedDropCounters_s extDrop; //!< Extended drop counters
155 };
156 
157 /**
158  * Statistics info group for port statistics
159  */
160 struct NtStatGroupPort_s {
161  struct NtPortStatistics_s rx; //!< Counters based on RX ports
162  struct NtPortStatistics_s tx; //!< Counters based on TX ports
163  uint64_t linkDownCounter; //!< Counts number of link downs
164 
165  uint64_t ts; //!< Port counter sample time stamp
166  enum NtTimestampType_e tsType; //!< Time stamp type
167 };
168 
169 struct NtStatisticsQuery_s {
170  int poll; //!< Gets the current statistical information or waits for a new update
171  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.
172  /**
173  * Data section holding the statistic counters
174  */
175  struct NtStatisticsQueryResult_s {
176  /**
177  * Port specific statistics
178  */
179  struct NtStatisticsQueryPortResult_s {
180  uint8_t numPorts; //!< Number of ports in @ref aPorts
181  uint8_t Reserved1[3];
182  struct NtStatGroupPort_s aPorts[64]; //!< Array of port statistic structures in the system
183  } port;
184  /**
185  * Adapter specific statistics
186  */
187  struct NtStatisticsQueryAdapterResult_s {
188  uint8_t numAdapters; //!< Number of adapters in @ref aAdapters
189  uint8_t Reserved1[3];
190  struct NtStatGroupAdapter_s aAdapters[10]; //!< Array of adapter statistic structures
191  } adapter;
192  } data; //!< Structure for statistic results
193 };
194 
195 /********************************************************************************/
196 /* Statistics data defines for NT_STATISTICS_READ_CMD_QUERY_V1 */
197 /********************************************************************************/
198 #define NT_STATISTICS_READ_CMD_QUERY_V1 NT_STATISTICS_READ_CMD_COMPAT_1
199 
200 /**
201  * Statistics for each port
202  */
203 struct NtPortStatistics_v1_s {
204  /**
205  * Valid indicators - these indicate which counters are supported by the port
206  */
207  struct NtPortStatisticsValid_v1_s {
208  int RMON1; //!< Is set if RMON1 counters are supported
209  int extRMON; //!< Is set if extended RMON counters are supported
210  int chksum; //!< Is set if IP/TCP/UDP checksum counters are supported
211  int decode; //!< Is set if packet decode counters are supported
212  int extDrop; //!< Is set if extended drop counters are supported
213  int ipf; //!< Is set if IP fragment table counters are supported
214  } valid;
215 
216  struct NtRMON1Counters_s RMON1; //!< RMON1 counters
217  struct NtExtendedRMONCounters_s extRMON; //!< Extended RMON counters
218  struct NtCheckSumCounters_s chksum; //!< Checksum error counters
219  struct NtDecodeCounters_s decode; //!< Packets decoded by onboard packet decoder
220  struct NtExtendedDropCounters_s extDrop; //!< Extended drop counters
221  struct NtIpFragTableCounters_s ipf; //!< IP fragment table counters (when using IPFMode)
222 };
223 
224 /**
225  * Statistics info group for port statistics
226  */
227 struct NtStatGroupport_v1_s {
228  struct NtPortStatistics_v1_s rx; //!< Counters based on RX ports
229  struct NtPortStatistics_v1_s tx; //!< Counters based on TX ports
230  uint64_t linkDownCounter; //!< Counts number of link downs
231  uint64_t ts; //!< Port counter sample time stamp. The format of the timestamp is specified by @ref tsType.
232  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"
233 };
234 
235 
236 struct NtStatisticsQuery_v1_s {
237  int poll; //!< Gets the current statistical information or waits for a new update
238  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.
239  /**
240  * Data section holding the statistic counters
241  */
242  struct NtStatisticsQueryResult_v1_s {
243  /**
244  * Port specific statistics
245  */
246  struct NtStatisticsQueryPortResult_v1_s {
247  uint8_t numPorts; //!< Number of ports in @ref aPorts
248  uint8_t Reserved1[3];
249  struct NtStatGroupport_v1_s aPorts[64]; //!< Array of port statistic structures in the system
250  } port;
251  /**
252  * Adapter specific statistics
253  */
254  struct NtStatisticsQueryAdapterResult_v1_s {
255  uint8_t numAdapters; //!< Number of adapters in @ref aAdapters
256  uint8_t Reserved1[3];
257  struct NtStatGroupAdapter_s aAdapters[10]; //!< Array of adapter statistic structures
258  } adapter;
259  } data; //!< Structure for statistic results
260 };
261 
262 
263 /********************************************************************************/
264 /* Statistics data defines for NT_STATISTICS_READ_CMD_QUERY_V2 */
265 /********************************************************************************/
266 #define NT_STATISTICS_READ_CMD_QUERY_V2 NT_STATISTICS_READ_CMD_COMPAT_2
267 
268 struct NtStatisticsQuery_v2_s {
269  int poll; //!< Gets the current statistical information or waits for a new update
270  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.
271  /**
272  * Data section holding the statistic counters
273  */
274  struct NtStatisticsQueryResult_v2_s {
275  /**
276  * Port specific statistics
277  */
278  struct NtStatisticsQueryPortResult_v2_s {
279  uint8_t numPorts; //!< Number of ports in @ref aPorts
280  uint8_t Reserved1[3];
281 //
282 
283  struct NtStatGroupport_v1_s aPorts[64]; //!< Array of port statistic structures in the system
284 //
285 
286  } port;
287  /**
288  * Adapter specific statistics
289  */
290  struct NtStatisticsQueryAdapterResult_v2_s {
291  uint8_t numAdapters; //!< Number of adapters in @ref aAdapters
292  uint8_t Reserved1[3];
293  struct NtStatGroupAdapter_s aAdapters[10]; //!< Array of adapter statistic structures
294  } adapter;
295  /**
296  * Stream specific statistics
297  */
298  struct NtStatGroupStream_s stream;
299  } data; //!< Structure for statistic results
300 };
301 
302 /********************************************************************************/
303 /* Statistics data defines for NT_STATISTICS_READ_CMD_QUERY_V3 */
304 /********************************************************************************/
305 #define NT_STATISTICS_READ_CMD_QUERY_V3 NT_STATISTICS_READ_CMD_COMPAT_3
306 
307 struct NtStatisticsQuery_v3_s {
308  int poll; //!< Gets the current statistical information or waits for a new update
309  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.
310  /**
311  * Data section holding the statistic counters
312  */
313  struct NtStatisticsQueryResult_v3_s {
314  /**
315  * Port specific statistics
316  */
317  struct NtStatisticsQueryPortResult_v3_s {
318  uint8_t numPorts; //!< Number of ports in @ref aPorts
319  uint8_t Reserved1[3];
320 //
321 
322  struct NtStatGroupport_v2_s aPorts[64]; //!< Array of port statistic structures in the system
323 //
324 
325  } port;
326  /**
327  * Adapter specific statistics
328  */
329  struct NtStatisticsQueryAdapterResult_v3_s {
330  uint8_t numAdapters; //!< Number of adapters in @ref aAdapters
331  uint8_t Reserved1[3];
332  struct NtStatGroupAdapter_s aAdapters[10]; //!< Array of adapter statistic structures
333  } adapter;
334  /**
335  * Stream specific statistics
336  */
337  struct NtStatGroupStream_s stream;
338  } data; //!< Structure for statistic results
339 };
340 
341 
342 
343 #endif /* _NT_NTAPI_NO_COMPAT */
344 #endif /* __STREAM_STATISTICS_COMPAT_H__ */