stream_info.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_info.h Source File
stream_info.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 STREAMTYPE_INFO interface.
36  */
37 #ifndef __STREAM_INFO_H__
38 #define __STREAM_INFO_H__
39 
40 #if !defined(__NT_H__)
41  #error: My interface file is 'nt.h'. Please include that via #include "nt.h" directly.
42 #endif
43 
44 /** @addtogroup InfoStream
45  * @{
46  *
47  * Info streams are used to access system information. The info
48  * stream is read only.
49  *
50  * To open an info stream call @ref NT_InfoOpen. Once the info stream
51  * is open, the info read command needs to be set in the @ref NtInfo_t
52  * structure and depending on the info command an adapter number, port
53  * number or similar also needs to be set. Once the @ref NtInfo_t
54  * structure query is filled out, a call to @ref NT_InfoRead makes the
55  * system read out the requested data. When done, call @ref
56  * NT_InfoClose to close the stream.
57  *
58  * The info stream read commands currently supported are:
59  * @li <tt>System info</tt> - this includes the number of ports, adapters and sensors
60  * @li <tt>Adapter info</tt> - this includes the number of sensors, ports, PCI ID and bus ID
61  * @li <tt>Port info</tt> - this includes the port state, speed and duplex
62  * @li <tt>Sensor info</tt> - this includes the sensor type, name and value
63  * @li <tt>Host buffer info</tt> - this includes the NUMA node, size and feed
64  * @li <tt>Time sync info</tt> - this includes the time sync connector and time sync data
65  * @li <tt>Time sync external info</tt> - this includes the time sync information from a connected device
66  * @li <tt>Stream ID info</tt> - this includes the Stream ID.
67  * @li <tt>Product info</tt> - this includes the Product type, Product ID, Serial Number, PBA ID, AVR version, CPLD version and FPGA versions
68  * @li <tt>PTP info</tt> - this includes the PTP related information
69  *
70  * For an example of using the info stream see @ref info/info_example.c "info/info_example.c"
71  *
72  * @note The info stream is not thread-safe. If the same stream handle is to be used by multiple threads,
73  * it must be mutex protected in the application.
74  *
75  */
76 
77 /**
78  * Possible info stream read commands
79  */
81  NT_INFO_CMD_READ_UNKNOWN=0, //!< Unknown stream read command
82  NT_INFO_CMD_READ_SYSTEM, //!< System info - the number of ports, adapters and sensors
83  NT_INFO_CMD_READ_COMPAT_0, //!< Command for backward compatibility - defined in stream_info_compat.h
84  NT_INFO_CMD_READ_COMPAT_1, //!< Command for backward compatibility - defined in stream_info_compat.h
85  NT_INFO_CMD_READ_SENSOR, //!< Sensor info - the sensor type, name and value
86  NT_INFO_CMD_READ_COMPAT_3, //!< Command for backward compatibility - defined in stream_info_compat.h
87  NT_INFO_CMD_READ_STREAM, //!< Info about active streams in the system
88  NT_INFO_CMD_READ_COMPAT_2, //!< Command for backward compatibility - defined in stream_info_compat.h
89  NT_INFO_CMD_READ_COMPAT_5, //!< Command for backward compatibility - defined in stream_info_compat.h
90  NT_INFO_CMD_READ_COMPAT_4, //!< Command for backward compatibility - defined in stream_info_compat.h
91  NT_INFO_CMD_READ_COMPAT_6, //!< Command for backward compatibility - defined in stream_info_compat.h
92  NT_INFO_CMD_READ_HOSTBUFFER_V1, //!< Host buffer info - the NUMA node, size and feed
93  NT_INFO_CMD_READ_COMPAT_9, //!< Command for backward compatibility - defined in stream_info_compat.h
94  NT_INFO_CMD_READ_STREAMID, //!< Info about a stream ID
95  NT_INFO_CMD_READ_COMPAT_10, //!< Command for backward compatibility - defined in stream_info_compat.h
96  NT_INFO_CMD_READ_TIMESYNC_STATUS_EXT, //!< Time sync external status info - the time sync external status data
97  NT_INFO_CMD_READ_COMPAT_7, //!< Adapter info version 2 - the number of sensors, ports, PCI ID and bus ID
98  NT_INFO_CMD_READ_COMPAT_8, //!< Port info - the port state, speed and duplex
99  NT_INFO_CMD_READ_COMPAT_19, //!< Product information version 0 request command
100  NT_INFO_CMD_READ_COMPAT_11, //!< Adapter info version 3 - the number of sensors, ports, PCI ID and bus ID
101  NT_INFO_CMD_READ_COMPAT_12, //!< Port info version 3 - the port state, speed and duplex
102  NT_INFO_CMD_READ_COMPAT_15, //!< PTP info v1 PTP port status, PTP clock datasets and PTP configuration
103  NT_INFO_CMD_READ_COMPAT_23, //!< Filter usage info. Read filter usage information
104  NT_INFO_CMD_READ_COMPAT_21, //!< Time sync info version 3 - the time sync connector and time sync data
105  NT_INFO_CMD_READ_PATH_DELAY, //!< Port path delay
106  NT_INFO_CMD_READ_COMPAT_13, //!< Adapter info version 4 - the number of sensors, ports, PCI ID and bus ID
107  NT_INFO_CMD_READ_COMPAT_14, //!< Port info version 4 - the port state, speed and duplex
108  NT_INFO_CMD_READ_COMPAT_17, //!< Adapter info version 5 - the number of sensors, ports, PCI ID and bus ID
109  NT_INFO_CMD_READ_COMPAT_16, //!< Port info version 5 - the port state, speed and duplex
110  NT_INFO_CMD_READ_TIMESYNC_STAT, //!< Time sync statistics
111  NT_INFO_CMD_READ_PTP_V2, //!< PTP info v2 PTP port status, PTP clock data sets and PTP configuration
112  NT_INFO_CMD_READ_COMPAT_18, //!< Port info version 6 - the port state, speed and duplex
113 
114  NT_INFO_CMD_READ_COMPAT_27, //!< Adapter info version 6 - the number of sensors, ports, PCI ID and bus ID
115  NT_INFO_CMD_READ_COMPAT_20, //!< Port info version 7 - the port state, speed and duplex
116  NT_INFO_CMD_READ_COMPAT_22, //!< Product information version 1 request command
117  NT_INFO_CMD_READ_COMPAT_24, //!< Port info version 8 - the port state, speed and duplex
118  NT_INFO_CMD_READ_TIMESYNC_V4, //!< Time sync info version 4 - the time sync connector and time sync data
119  NT_INFO_CMD_READ_COMPAT_25, //!< Product information version 2 request command
120  NT_INFO_CMD_READ_FILTERUSAGE_V1,//!< Filter usage info. Read filter usage information
121  NT_INFO_CMD_READ_PROPERTY, //!< Property information request
122  NT_INFO_CMD_READ_COMPAT_28, //!< Port info version 9 - the port state, speed and duplex
123  NT_INFO_CMD_READ_COMPAT_26, //!< Product information version 3 request command
124  NT_INFO_CMD_READ_PRODUCT_INFO_V4,//!< Product information version 4 request command
125  NT_INFO_CMD_READ_ADAPTER_V7, //!< Adapter info version 7 - the number of sensors, ports, PCI ID and bus ID
126  NT_INFO_CMD_READ_PORT_V10, //!< Port info version 10 - the port state, speed and duplex
127 };
128 
129 /**
130  * This structure will return the system-wide information
131  */
133  uint8_t numNumaNodes; //!< The number of online NUMA nodes in the system
134  uint8_t Reserved1[3];
135  uint8_t numAdapters; //!< The number of adapters in the system
136  uint8_t Reserved2[3];
137  uint8_t numPorts; //!< The number of ports in the system
138  uint8_t Reserved3[3];
139  /**
140  * Version info
141  */
142  struct {
143  int32_t major; //!< The major release number
144  int32_t minor; //!< The minor release number
145  int32_t patch; //!< The major/minor patch release
146  int32_t tag; //!< The release tag number
147  } version;
148 };
149 
150 enum {
151  NT_BMC_NOT_VALID = 0, //!< No valid BMC/NIOS data
152  NT_BMC_VALID = 1, //!< Valid BMC/NIOS data
153 };
154 
156  struct {
157  struct {
158  uint8_t type;
159  uint8_t ver;
160  uint16_t group;
161  uint8_t rev;
162  uint8_t patch;
163  uint16_t build;
164  uint8_t valid; //!< Valid == NT_BMC_VALID for valid BMC data
165  } bmc;
166  struct {
167  uint8_t ver;
168  uint8_t rev;
169  uint8_t patch;
170  uint8_t valid; //!< Valid == NT_BMC_VALID for valid NIOS data
171  } nios;
172  } bmc[2];
173  uint8_t serialValid; //!< serialValid == NT_BMC_VALID for valid CPU board serial number
174  char serialNo[50]; //!< The CPU board serial number. FPGA board serial number is the main serial number
175 };
176 
177 enum {
178  NT_AVR_NOT_VALID = 0, //!< No valid AVR data
179  NT_AVR_VALID_2 = 1, //!< Valid AVR data for mainboard and front board has been filled in the structure (Both index 0 and 1 has been filled with valid data)
180  NT_AVR_VALID_1 = 2, //!< Valid AVR data has been filled in the structure (Only index 0 has been filled with valid data)
181 };
182 
184  uint8_t valid; //!< Does this structure contain valid data (not all adapters use this structure)
185  struct {
186  uint8_t version_major; //!< The major version
187  uint8_t version_minor; //!< The minor version
188  uint8_t version_build; //!< The build number
189  } avr[2];
190 };
191 
192 union Ntpciid_u {
193  /**
194  * PCI ID can be read as:
195  * 32-bit value,
196  * 2 x 16-bit values defining
197  * device ID and
198  * vendor ID
199  */
200  struct Ntpciid_s {
201  uint16_t device; //!< The device ID, for example, NT20E in-line 0x64
202  uint16_t vendor; //!< The vendor ID, for example, Napatech 0x18F4
203  }s;
204  uint32_t value; //!< The PCI ID, for example, 0x18540064
205 };
206 
207 union Ntfpgaid_u {
208  struct {
209  uint32_t rev:8; //!< The FPGA revision
210  uint32_t ver:8; //!< The FPGA version
211  uint32_t product:16; //!< The FPGA product code
212  uint32_t item:12; //!< The FPGA item type (200 is FPGA, 201 is CPLD)
213  uint32_t build:10; //!< The build number - non-zero for R&D builds
214  uint32_t reserved:10;
215  }s;
216  uint64_t value; //!< The raw 64-bit FPGA ID
217 };
218 
219 /**
220  * Structure to hold information about WIS mode
221  */
223  int supported; //!< Is WIS mode supported by the adapter - 1 supported, 0: not supported
224  enum NtWISMode_e mode; //!< Is WIS mode enabled
225  uint32_t mask; //!< Wismode port enable mask -> bit 0 = port0, bit 1 = port 1 etc.
226 };
227 
228 /**
229  * Structure to hold information about global sync
230  */
232  int supported; //!< Is global sync supported.
233  uint32_t portEnableMask; //!< Enables coordinated time synchronized transmit on port bit mask
234  uint64_t timeSynchronizedTxOffset; //!< Time offset between time stamp in first frame and adapter time
235 };
236 
237 /**
238  * Structure to read SDRAM information
239  */
241  int present; //!< Is the SDRAM present
242  enum NtSdramSize_e size; //!< The physical SDRAM chip size
243 };
244 
245 /**
246  * Structure to read PCIe information
247  */
249  int pciGen; //!< PCI generation
250  int numLanes; //!< Number of PCI lanes
251  int numLanesSupported; //!< The number of lanes supported by the adapter
252  int maxPayloadSupported; //!< The maximum supported payload by the adapter
253  int maxPayload; //!< The negotiated maximum payload
254  uint32_t measuredRxThroughput; //!< RX PCI throughput
255  uint32_t measuredTxThroughput; //!< TX PCI throughput
256  uint32_t measuredCombinedRxThroughput; //!< Combined RX throughput
257  uint32_t measuredCombinedTxThroughput; //!< Combined RX throughput
258 };
259 
260 /**
261  * Adapter bonding information
262  */
263 typedef struct {
264  uint32_t bonded; //!< Has this adapter been bonded with another
265  uint8_t remoteAdapter; //!< The adapter this adapter is bonded with.
266  enum NtBondingType_e type; //!< Is the adapter master or slave
268 
269 
270 
271 /**
272  * This structure will return the adapter specific info version 6.
273  * Must be a mirror of NtInfoAdapter_v6_s with version 6 variables added
274  * to the bottom.
275  */
277  uint8_t numSensors; //!< The number of sensors on this adapter
278  uint8_t Reserved1[3];
279  uint8_t numLevel1Sensors; //!< The number of level 1 sensors on this adapter
280  uint8_t Reserved2[3];
281  uint8_t portOffset; //!< The port numbers of this adapter start at this port offset
282  uint8_t Reserved3[3];
283  uint8_t numPorts; //!< The number of ports on this adapter
284  uint8_t Reserved4[3];
285  uint8_t numPhysicalAdapters; //!< The number of physical adapters grouped in this logical adapter
286  uint8_t Reserved5[3];
287  uint32_t numHostBuffersRx; //!< The number of RX host buffers on this adapter
288  uint32_t numHostBuffersTx; //!< The number of TX host buffers on this adapter
289  uint32_t numTsConnectors; //!< The number of time sync connectors on this adapter
290  enum NtAdapterType_e adapterType; //!< The adapter type
291  enum NtProductType_e productType; //!< The product line type
292  enum NtProfileType_e profile; //!< The profile the adapter is using
293  uint32_t supportedProfilesBitmask; //!< The profiles supported by the adapter - the value is represented as a bitmask of @ref NtProfileType_e values
294  uint32_t adapterFeatures; //!< The features supported by the adapter - the value is represented as a bitmask of @ref NtFeatureType_e values
295  enum NtProductFamily_e productFamily; //!< The product family
296  char name[128]; //!< The adapter name
297  char serialNo[50]; //!< The adapter serial number
298  /**
299  * AVR version for Gen2 adapters:
300  * avr[0] = Main board AVR,
301  * avr[1] = Front board AVR
302  */
304 
305  /**
306  * The bus ID of the device
307  */
308  union Ntbusid_v7_u {
309  struct Ntbusid_v7_s {
310  uint32_t function:3; //!< The PCI function number
311  uint32_t device:5; //!< The PCI device number
312  uint32_t bus:8; //!< The PCI bus number
313  uint32_t domain:16; //!< The PCI domain number
314  }s;
315  uint32_t value; //!< The domain, bus, device and function as a 32-bit value
316  } busid;
317  /**
318  * PCI ID is read as:
319  * 32-bit value,
320  * 2 x 16-bit values defining
321  * device ID and
322  * vendor ID
323  */
324  union Ntpciid_u pciid;
325  struct NtInfoPCIeInfo_s pciInfo; //!< Information about the PCI bus.
326  /**
327  * The FPGA ID of the image currently running on the adapter.
328  * The format is: item-product-version-revision-build.
329  * For example, 200-9114-40-01-1023.
330  */
331  union Ntfpgaid_u fpgaid;
332  struct NtInfoSDRAMInfo_s sdramInfo; //!< The SDRAM information
333  uint32_t extendedDescriptor; //!< The extended descriptor in use by RX - if 0 then no extended is used
334  uint32_t supportedExtendedDescriptorsBitmask; //!< Bitmask of supported extended descriptors, for example, if bit 7 is set then extended descriptor 7 is supported, and if bit 8 it set then extended descriptor 8 is supported
335  enum NtPacketDescriptorType_e descriptorType; //!< The descriptor type used
336  enum NtTimestampType_e timestampType; //!< The time stamp type used by the adapter
337  enum NtTimestampMethod_e timestampMethod; //!< The time stamp method (SOF/EOF) used by the adapter
338  enum NtTxTimingMethod_e txTiming; //!< The TX timing
339  struct NtInfoWis_v1_s wisMode; //!< Wis mode status
340  enum NtTimestampInjectOffsetMode_e tsInjectModeOffset; //!< Time stamp injection offset mode
341  struct NtInfoGlobalSync_s globalSync; //!< Global sync status
342  NtInfoBondingInfo_t bondingInfo; //!< Adapter Bonding status
343  enum NtFeatureLevel_e featureLevel; //!< Adapter/FPGA feature level
344  uint16_t customId; //!< Custom identification number
345 
346  /**
347  * BMC version for SOC adapters:
348  */
350 };
351 
353  NT_PORT_FEATURE_DMA_TRANSMIT=1LL<<0, //!< The port is able to perform DMA transmit. Ports that do not have this bit set will only be able to transmit at a limited rate
354  NT_PORT_FEATURE_HARDSLICE_AT_MAXFRAMESIZE=1LL<<1, //!< The port will hard slice packets when they exceed the maximum frame size
355  NT_PORT_FEATURE_IPV4_TX_CHECKSUM_CALC=1LL<<2, //!< The port can calculate the IPv4 checksum on transmit
356  NT_PORT_FEATURE_UDP_TX_CHECKSUM_CALC=1LL<<3, //!< The port can calculate the UDP checksum on transmit
357  NT_PORT_FEATURE_TCP_TX_CHECKSUM_CALC=1LL<<4, //!< The port can calculate the TCP checksum on transmit
358  NT_PORT_FEATURE_INJECT_TX_TS=1LL<<5, //!< The port can inject a time stamp when transmitting packets
359  NT_PORT_FEATURE_TIMED_TX=1LL<<6, //!< The port can transmit timed using the time stamps in each packet
360  NT_PORT_FEATURE_BYPASS=1LL<<7, //!< The port has bypass functionality
361  NT_PORT_FEATURE_DISABLE=1LL<<8, //!< The port can be disabled
362  NT_PORT_FEATURE_64BIT_TIMESTAMP=1LL<<9, //!< The port has 64-bit time stamp support
363  NT_PORT_FEATURE_RX_ONLY=1LL<<10, //!< The port can only be used to receive data. No transmit capabilities.
364  NT_PORT_FEATURE_TX_REPLICATE=1LL<<11, //!< The port can replicate the TX traffic of another port
365  NT_PORT_FEATURE_FCS_TX_CHECKSUM_CALC=1LL<<12, //!< The port can calculate the FCS checksum on transmit
366  NT_PORT_FEATURE_MAX //!< Last entry
367 };
368 
370  NT_NIM_UNKNOWN = 0x00, //!< Nim type is unknown
371  NT_NIM_GBIC = 0x01, //!< Nim type = GBIC
372  NT_NIM_FIXED = 0x02, //!< Nim type = FIXED
373  NT_NIM_SFP_SFP_PLUS = 0x03, //!< Nim type = SFP/SFP+
374  NT_NIM_300_PIN_XBI = 0x04, //!< Nim type = 300 pin XBI
375  NT_NIM_XEN_PAK = 0x05, //!< Nim type = XEN-PAK
376  NT_NIM_XFP = 0x06, //!< Nim type = XFP
377  NT_NIM_XFF = 0x07, //!< Nim type = XFF
378  NT_NIM_XFP_E = 0x08, //!< Nim type = XFP-E
379  NT_NIM_XPAK = 0x09, //!< Nim type = XPAK
380  NT_NIM_X2 = 0x0A, //!< Nim type = X2
381  NT_NIM_DWDM = 0x0B, //!< Nim type = DWDM
382  NT_NIM_QSFP = 0x0C, //!< Nim type = QSFP
383  NT_NIM_QSFP_PLUS = 0x0D, //!< Nim type = QSFP+
384  NT_NIM_QSFP28 = 0x11, //!< Nim type = QSFP28
385  NT_NIM_CFP4 = 0x12, //!< Nim type = CFP4
386  NT_NIM_QSFP_CMIS = 0x1E, //!< Nim type = QSFP+/CMIS
387 };
388 
390  NT_PORT_IFG_BYTE_MODE=1LL<<0, //!< The port is configured to run in IFG BYTE mode
391 };
392 
394  uint32_t halfDuplexMask; //!< The available half duplex (use @ref NtLinkSpeed_e as the bitmask)
395  uint32_t fullDuplexMask; //!< The available full duplex (use @ref NtLinkSpeed_e as the bitmask)
396  uint32_t speed; //!< The available speed (use @ref NtLinkSpeed_e as the bitmask)
397  uint32_t mdi; //!< The available MDI mode (use @ref NtLinkMDI_e as the bitmask)
398  uint32_t AutoNeg; //!< The available link mode (use @ref NtLinkAutoNeg_e as the bitmask)
399  uint32_t duplex;
400  uint16_t minTxPktSize; //!< The minimum transmit packet size, see also @ref NtRMON1Counters_s::undersizePkts
401  uint16_t maxTxPktSize; //!< The maximum transmit packet size
402  uint32_t featureMask; //!< The feature mask of the port
403 };
404 
406  uint16_t sm; //!< NIM link length (in meters) supported SM (9um). A value of 0xFFFF indicates that the length is >= 65535 m
407  uint16_t ebw; //!< NIM link length (in meters) supported EBW (50um)
408  uint16_t mm50; //!< NIM link length (in meters) supported MM (50um)
409  uint16_t mm62; //!< NIM link length (in meters) supported MM (62.5um)
410  uint16_t copper; //!< NIM link length (in meters) supported copper
411 };
412 
413 /*
414  * Bypass port information
415  */
416 struct NtBypassPortInfo_s { //!< Read-only information about bypass port states
417  uint8_t bypassPortsetNo; //!< Portset (portpair) membership - within an adapter
418  uint8_t Reserved1[3];
419  enum NtBypassTrigger_e bypassTriggerModes; //!< Bypass triggers that affect this port state using @ref NtBypassTrigger_e
420  enum NtBypassPortState_e currentBypassPortState; //!< Current (live) bypass port state using @ref NtBypassPortState_e
421  enum NtBypassPortState_e onInitBypassPortState; //!< onInit bypass port state using @ref NtBypassPortState_e
422  enum NtBypassPortState_e onPowerFailBypassPortState; //!< onPowerFail bypass port state using @ref NtBypassPortState_e
423  enum NtBypassPortState_e onWatchdogFailBypassPortState; //!< onWatchdogFail bypass port state using @ref NtBypassPortState_e
424  uint32_t bypassPortWatchdogTimeout; //!< Watchdog timeout (msec)
425  uint32_t bypassPortWatchdogTimeRemaining; //!< Watchdog remaining time before timeout (msec)
426 };
427 
428 
429 
430 /**
431  * This structure will return the port specific information version 7.
432  * Must be a mirror of NtInfoPort_v9_s with version 10 variables added
433  * to the bottom.
434  */
436  enum NtPortType_e type; //!< The interface type
437  enum NtLinkState_e state; //!< The port up or down
438  enum NtLinkSpeed_e speed; //!< The interface speed
439  enum NtLinkDuplex_e duplex; //!< The duplex mode
440  int32_t flow; //!< 0 = no flow control, 1 = flow control
441  enum NtLinkMDI_e mdi; //!< 1 = auto, 2 = MDI, 4 = MDIX
442  uint8_t macAddress[6]; //!< The MAC address of the interface
443  uint16_t maxFrameSize; //!< The current maximum frame size
444  /**
445  * Capabilities reflect what the port is capable of, that is, what speed/duplex is possible. For example,
446  * if only 100 M full duplex is available, the capabilities would
447  * show:
448  * halfDuplexMask=0.
449  * fullDuplexMask=NT_LINK_SPEED_100M.
450  * Other capabilities are min/max transmit sizes.
451  */
452  struct NtLinkCapabilities_s capabilities; //!< The link capabilities
453  uint8_t adapterNo; //!< The adapter that has the port
454  uint8_t Reserved1[3];
455  uint8_t numSensors; //!< The number of sensors on this port
456  uint8_t Reserved2[3];
457  uint8_t numLevel1Sensors; //!< Number of level 1 sensors on this port
458  uint8_t Reserved3[3];
459  uint8_t numLevel2Sensors; //!< Number of level 2 sensors on this port
460  uint8_t Reserved4[3];
461 
462  /**
463  * NIM model information
464  */
465  enum NtNimIdentifier_e nim_id; //!< NIM identifier
466  uint8_t vendor_name[17]; //!< NIM Vendor name
467  uint8_t product_no[17]; //!< NIM product number
468  uint8_t serial_no[17]; //!< NIM serial number
469  uint8_t date[9]; //!< NIM vendors manufacturing date
470  uint8_t revision[5]; //!< NIM vendor revision
471  uint8_t power_level_req; //!< NIM required power level
472  uint8_t power_level_curr; //!< NIM current power level
473  struct NtNIMLinkLength_s link_length;
474  /**
475  * Adapter information
476  */
477  struct NtInfoAdapter_v7_s adapterInfo; // Adapter information
478  /**
479  * Bypass port information
480  */
481  struct NtBypassPortInfo_s bypass; // Bypass port information
482  uint32_t statusMask; //!< The status mask is either zero or one dependent on
483  //!< the ntservice.ini setting IfgMode (NS or BYTE): Zero
484  //!< denotes inter-frame gaps are in 10-ns ticks (NS),
485  //!< and one denotes bytes (BYTE)
486  NtPortFec_t fecState; //!< The state of Forward Error Correction if applicable
487  uint64_t nextPktNs; //!< Time till next packet will be transmitted in ns
488  uint64_t maxPktDelayedNs; //!< Max time pkts were late in being transmitted
489 };
490 
491 
492 
493 
494 
495 
496 /**
497 This structure will return the sensor specific information
498 
499 The units used for the fields: value, valueLowest, valueHighest, limitLow and
500 limitHigh depend on the type field. See @ref NtSensorType_e.
501 
502 For the limitLow and limitHigh fields the following applies:\n
503 If the sensor is located in a NIM (Network Interface Module), the limits are read
504 from the NIM module via the DMI (Diagnostic Monitoring Interface) from the alarm
505 and warning threshholds section, and the units are changed to internal representation.
506 Only the alarm threshholds are used and are read only once during initialization.
507 The limits cannot be changed.
508 
509 The value field is updated internally on a regular basis and is also based on a
510 value read from the NIM which is also changed to internal representation.
511 
512 Not all NIM types support DMI data, and its presence must be determined by reading an
513 option flag. In general, a NIM can read out: temperature, supply voltage,
514 TX bias, TX optical power and RX optical power but not all NIM types support all
515 5 values.
516 
517 If external calibration is used (most NIM use internal calibration), both the
518 current value and the threshold values are subjected to the specified calibration
519 along with the change to internal calibration.
520 */
521 typedef struct NtInfoSensor_s {
522  enum NtSensorSource_e source; //!< The source of the sensor (port or adapter on which the sensor resides)
523  uint32_t sourceIndex; //!< The source index - the adapter number for adapter sensors and port number for port sensors
524  uint32_t sensorIndex; //!< The sensor index within the source index (sensor number on the adapter or sensor number on the port)
525  enum NtSensorType_e type; //!< The sensor type
526  enum NtSensorSubType_e subType; //!< The sensor subtype (if applicable)
527  enum NtSensorState_e state; //!< The current state (normal or alarm)
528  int32_t value; //!< The current value
529  int32_t valueLowest; //!< The lowest value registered
530  int32_t valueHighest; //!< The highest value registered
531  int32_t limitLow; //!< The minimum sensor value before an alarm is triggered
532  int32_t limitHigh; //!< The maximum sensor value before an alarm is triggered
533  char name[50]; //!< The sensor name
534  enum NtAdapterType_e adapterType; //!< The adapter type where the sensor resides
536 
537 
538 /**
539  * StreamID specific information
540  */
542  int useCount; //!< Set to the number of streams using this stream ID
543  int numHostBuffers; //!< The amount of hostbuffers currently in use by this stream ID
544  enum NtStreamIdState_e state; //!< The current state of the stream ID
545  uint64_t minHostBufferSize; //!< The minimum hostbuffer size this stream ID requires
546  uint8_t numaNode; //!< The NUMA node on which this stream ID resides
547  //!< Note: The NUMA node will only be valid if a numa node has been
548  //!< assigned to the stream ID using the ntpl command:
549  //!< Setup[NUMANode=2] = StreamId==(0..7)
550  //!< Otherwise it will always be zero.
551 };
552 
553 /**
554  * Host buffer specific information
555  */
557  uint8_t numaNode; //!< The NUMA node on which the host buffer resides
558  uint8_t Reserved1[3];
559  uint64_t size; //!< The size of the host buffer in bytes
560  uint32_t feed; //!< The feed index per adapter and type
561 };
562 
563 
564 /**
565  * Structure to hold information about currently active streams
566  */
568  int streamIDList[256]; //!< Holds all the stream IDs currently created in the system // HB256: TODO
569  uint32_t count; //!< The number of stream IDs from the stream ID list
570 };
571 
572 
573 /**
574  * Structure to hold the sampled timestamps and status
575  */
577  enum NtTimeSyncSamplingSrcStatus_e sampledStatus; //!< Status of sampled timestamp (valid/invalid)
578  uint64_t sampledTime; //!< The sampled adapter time in ns since 1/1 1970 (unix epoch). if NATIVE timestamp format is configured, the epoch is user defined)
579  enum NtTimeSyncSamplingSrcStatus_e externalStatus; //!< Status of external reference timestamp (available/unavailable)
580  uint64_t externalTime; //!< The sampled external time in ns since 1/1 1970 (unix epoch). if NATIVE timestamp format is configured, the epoch is user defined)
581 };
582 
583 
584 /**
585  * Time syncronization specific info
586  */
587 #define NT_TIME_SYNC_CLOCK_RATE_ADJ_UNKNOWN 1000000000 //!< Used for timeSyncClockRateAdjustment and timeSyncOSClockRateAdjustment parameters to indicate that no clock rate adjustment is retrievable
588 
590  uint32_t timeSyncSupported; //!< Is time sync supported by this adapter
591  uint32_t ptpSupported; //!< Is PTP time sync available on this adapter
592 
593  NtTimeSyncConnectorSetting_t timeSyncConnectorExt1; //!< Timesync connector Ext1 setting
594  NtTimeSyncConnectorSetting_t timeSyncConnectorInt1; //!< Timesync connector Int1 setting
595  NtTimeSyncConnectorSetting_t timeSyncConnectorInt2; //!< Timesync connector Int2 setting
596  enum NtTimeSyncReference_e tsRefPrio[4]; //!< Timesync source reference priority list
597  enum NtTimeSyncReference_e timeRef; //!< The current time reference
598  enum NtTimeSyncFreqReference_e tsFreqRefPrio[4]; //!< Timesync frequency reference priority list
599  enum NtTimeSyncFreqReference_e freqRef; //!< The current frequency reference
600  uint32_t timeSyncNTTSInSyncLimit; //!< The configured NT-TS in-sync limit
601  uint32_t timeSyncOSInSyncLimit; //!< The configured OS in-sync limit
602  uint32_t timeSyncPPSInSyncLimit; //!< The configured PPS in-sync limit
603  uint32_t timeSyncPTPInSyncLimit; //!< The configured PTP in-sync limit
604  enum NtTimeSyncInSyncStatus_e timeSyncInSyncStatus; //!< The timestamp clock time in-sync/out-of-sync status
605  enum NtTimeSyncConStatus_e timeSyncCurrentConStatus; //!< The current time sync connector status
606  enum NtTimeSyncPpsStatus_e timeSyncPpsEnable; //!< The time sync PPS enable. Activated by an application
607  enum NtTimeSyncPpsSyncMode_e timeSyncPpsSyncMode; //!< When current timeref is PpsIn, this is the sync mode status
608  uint32_t timeSyncClockAdjustmentMode; //!< The time sync timestamp clock adjustment mode
609  /* timeSyncClockAdjustmentMode 2 only */
610  uint32_t timeSyncHardReset; //!< If hard reset of clock is allowed (time jumps)
611  /* timeSyncClockAdjustmentMode 1 only */
612  uint32_t timeSyncTimeJumpThreshold; //!< The time sync time jump threshold in seconds
613 
614  uint32_t timeSyncTimeOffset; //!< The time sync offset in nanoseconds. Used for NT-TS and PPS caple delay compensation
615  uint64_t timeSyncPpsSampled; //!< The sampled PPS time. In ns since 1/1 1970 (unix epoch). if NATIVE timestamp format is configured, the epoch is user defined). Note that timeSyncPpsEnable must be true for this parameter to become valid
616  int64_t timeSyncTimeSkew; //!< The time skew in ns (0 if not syncing to a time reference)
617  uint32_t highFrequencySampling; //!< The high frequency sampling status
618  struct NtInfoTimeSyncSample_s sample[NT_TIMESYNC_SAMPLING_CNT]; //!< Timestamp sample sets. @ref NtTimeSyncSamplingSrc_e
619  uint64_t timeSyncCpuTsc[2]; //!< When TS sampling is app initiated through an event write, these values are cpu tsc values before and after the ts sampling
620 
621  int64_t timeSyncClockRateAdjustment; //!< The current clock rate adjustment imposed on the TS clock to synchronize to the referenced clock in nanoseconds per second. This is only supported on newer Gen2 adapters (FPGA version must be 46 or above)
622 
623  /* Server OS clock synchronization to TS clock */
624  uint32_t timeSyncAdapterToOSSyncEnabled; //!< Non-zero if this adapter is configured to synchronize the server OS clock
625  int64_t timeSyncOSClockOffset; //!< The latest read OS clock offset to the adapter TS clock
626  int64_t timeSyncOSClockRateAdjustment; //!< The current clock rate adjustment imposed on the server OS clock to synchronize to the adapter TS clock.
627 };
628 
629 /**
630  * Time synchronization NT-TS remote info
631  */
633  uint32_t infoValid; //!< The information is valid if infoValid != 0
634  uint32_t extDevSyncSignalOk; //!< The status of the external synchronization signal (1 if ok, otherwise 0) (Only used if the external device is a NT-TSU)
635  uint32_t extDevInSync; //!< The external device is in sync (1 if in sync, otherwise 0) (Only used if the external device is a NT-TSU or a NT-TSE)
636  uint32_t extDevTimeOfDayOk; //!< The external device delivers valid Time Of Day information (1 if valid, otherwise 0) (Only used if the external device is a NT-TSU or a NT-TSE) For the NT-TSU this indicates if the serial time stream is available. For the NT-TSE this field indicates if the Ethernet connection is up.
637  uint32_t extDevOsModeSyncEnabled; //!< The external device is synching to the OS time (1 if synching, otherwise 0) Only used if the external device is an adapter.
638  uint32_t extDevOsModeInSync; //!< The external device is in synchronization to the OS time (1 if in sync, otherwise 0) Only used if the external device is an adapter.
639  uint32_t extDevIsMaster; //!< The External device is master (1 if the external device is a NTTSU or NTTSE, otherwise 0)
640  uint32_t extAdapterIsMaster; //!< An external Adapter is master (1 if the external device is an adapter, otherwise 0)
641  uint32_t extDevMasterID; //!< Master ID of the external device
642 };
643 
644 
645 
646 /**
647  * Time synchronization statistics
648  * support level
649  */
651  NT_TIMESYNC_STATISTICS_NO_SUPPORT = 0, //!< Not supported
652  NT_TIMESYNC_STATISTICS_PTP_ONLY = 1, //!< When using older FPGAs on PTP adapters, then PTP will be supported only
653  NT_TIMESYNC_STATISTICS_FULL_SUPPORT = 2 //!< Full supported. All protocols and failover/fallback are supported
654 };
655 
656 /**
657  * Overall Time synchronization performance statistics
658  * and time sync event counters
659  */
661  enum NtTsStatSupport_e supported; //!< Specifies the level of which this feature is supported by the adapter.
662  uint64_t ts; //!< The adapter time when retrieved in ns since 1/1 1970 (unix epoch). if NATIVE timestamp format is configured, the epoch is user defined)
663  uint64_t samples; //!< The number of skew samples this statistics report is based on
664  int64_t skew; //!< The last recorded clock skew used to adjust the clock
665  int64_t min; //!< The minimum clock skew measured
666  int64_t max; //!< The maximum clock skew measured
667  int64_t mean; //!< The calculate mean clock skew
668  int64_t jitter; //!< The peak to peak jitter measured
669  uint64_t secSinceReset; //!< Time elapsed since last reset in seconds (using the OS time)
670  double stdDevSqr; //!< The calculated standard deviation square
671  /* Timesync event counters */
672  uint64_t signalLostCnt; //!< The number of signal lost events that has occured since last reset
673  uint64_t syncLostCnt; //!< The number of out-of-sync events (or synchronization lost events) that has occured since last reset
674  uint64_t hardResetCnt; //!< The number of clock hard reset events that has occured since last reset (including the application triggered)
675 };
676 
677 
678 /**
679  * NT_INFO_CMD_READ_SYSTEM specific data
680  */
682  struct NtInfoSystem_s data; //!< System data
683 };
684 
685 /**
686  * NT_INFO_CMD_READ_ADAPTER_V7 specific data.
687  * The adapterNo must be initialized for the relevant adapter.
688  */
690  uint8_t adapterNo; //!< The adapter to query
691  uint8_t Reserved1[3];
692  struct NtInfoAdapter_v7_s data; //!< The adapter data
693 };
694 
695 /**
696  * NT_INFO_CMD_READ_PORT_V10 specific data.
697  * The portNo must be initialized for the relevant port.
698  */
700  uint8_t portNo; //!< The port to query
701  uint8_t Reserved1[3];
702  struct NtInfoPort_v10_s data; //!< The port data
703 };
704 
705 
706 /**
707  * NT_INFO_CMD_READ_SENSOR specific data.
708  * The group, adapterNo/portNo and grpIndex must be initialized for the relevant sensor.
709  * For example, to read sensor 2 from port 4, do the following:
710  * info.u.cmd = NT_INFO_CMD_READ_SENSOR;
711  * info.u.sensor.source = NT_SENSOR_SOURCE_PORT;
712  * info.u.sensor.sourceIndex= 4;
713  * info.u.sensor.sensorIndex = 2;
714  * NT_ReadInfo(h, &info);
715  */
717  enum NtSensorSource_e source; //!< The source of the sensor - either a port or adapter sensor
718  uint32_t sourceIndex; //!< The source index - either adapter number or port number on which the sensor resides
719  uint32_t sensorIndex; //!< The sensor index within the source index, for example, 2 for sensor 2 on port 4
720  struct NtInfoSensor_s data; //!< The sensor data
721 };
722 
723 /**
724  * NT_INFO_CMD_READ_HOSTBUFFER_V1 specific data.
725  * The adapterNo, hostBufferNo and hostBufferType must be initialized for the relevant adapter, host buffer number and host buffer type.
726  */
728  uint8_t adapterNo; //!< The adapter to query
729  uint8_t Reserved1[3];
730  uint32_t hostBufferNo; //!< The host buffer to query
731  enum NtNetHostBufferType_e hostBufferType; //!< The host buffer type, that is, CAPTURE or TX
732  struct NtInfoHostBuffer_v1_s data; //!< The host buffer data
733 };
734 
735 /**
736  * NT_INFO_CMD_READ_STREAM specific data.
737  * Returning information about streams. Currently only the list of active streams is supported.
738  */
740 //
741 
742  struct NtInfoStreams_s data;
743 };
744 
745 /**
746  * NT_INFO_CMD_READ_STREAMID specific data.
747  * Returning information about a streamID.
748  */
750  int streamId; //!< The streamID to query
751  struct NtInfoStreamId_s data; //!< The streamID data
752 };
753 
754 /**
755  * NT_INFO_CMD_READ_TIMESYNC_V4 specific data.
756  * The adapterNo must be initialized for the relevant adapter.
757  */
759  uint8_t adapterNo; //!< The adapter to query
760  uint8_t Reserved1[2];
761  struct NtInfoTimeSync_v4_s data; //!< The time sync data
762 };
763 
764 /**
765  * NT_INFO_CMD_READ_TIMESYNC_STAT specific data.
766  * The adapterNo must be initialized for the relevant adapter.
767  */
769  uint8_t adapterNo; //!< The adapter to query
770  uint8_t Reserved1[2];
771  struct NtInfoTimeSyncStatistics_s data; //!< The time sync data
772 };
773 
774 
775 /**
776  * NT_INFO_CMD_READ_TIMESYNC_EXT_STATUS specific data.
777  * The adapterNo must be initialized for the relevant adapter.
778  */
780  uint8_t adapterNo; //!< The adapter to query
781  uint8_t Reserved1[3];
782  struct NtInfoTimeSyncStatusExt_s data; //!< The time sync data
783 };
784 
785 
786 
787 /**
788  * IEEE 1588 PTP network protocol identifier
789  */
791  NT_PTP_NETW_PROTOCOL_NA = 0, //!< invalid protocol ID
792  NT_PTP_NETW_PROTOCOL_IPV4_UDP = 1, //!< IPv4/UDP protocol
793  NT_PTP_NETW_PROTOCOL_IPV6_UDP = 2, //!< IPv6/UDP protocol
794  NT_PTP_NETW_PROTOCOL_IEEE802_3 = 3, //!< IEEE 802.3 or Layer 2 protocol
795  NT_PTP_NETW_PROTOCOL_DEVICENET = 4, //!< DeviceNet
796  NT_PTP_NETW_PROTOCOL_CONTROLNET = 5, //!< ControlNet
798 };
799 
800 /**
801  * IEEE 1588 PTP: Filter to be applied to calculated
802  * offset values before feed to PI controller
803  */
805  NT_PTP_FILTER_NONE = 0, //!< No filter
806  NT_PTP_FILTER_MIN = 1, //!< Minimum filter
807  NT_PTP_FILTER_PDV = 2 //!< PDV filter
808 };
809 
810 /**
811  * IEEE 1588 PTP time source identifier
812  */
814  NT_PTP_TIMESOURCE_NA = 0, //!< Invalid
815  NT_PTP_TIMESOURCE_ATOMIC = 0x10, //!< Time source is an atomic clock
816  NT_PTP_TIMESOURCE_GPS = 0x20, //!< Time source is GPS
817  NT_PTP_TIMESOURCE_TER_RADIO = 0x30, //!< Time source is terrestrial radio
818  NT_PTP_TIMESOURCE_PTP = 0x40, //!< Time source is PTP (external to the domain)
819  NT_PTP_TIMESOURCE_NTP = 0x50, //!< Time source is NTP
820  NT_PTP_TIMESOURCE_HAND_SET = 0x60, //!< Time source is hand set
821  NT_PTP_TIMESOURCE_OTHER = 0x90, //!< Any other time source
822  NT_PTP_TIMESOURCE_OSCILLATOR = 0xA0 //!< Time source is free running oscillator
823 };
824 
825 /**
826  * IEEE 1588 PTP propagation delay measurement mechanism identifier
827  */
829  NT_PTP_DELAY_MECHANISM_NA = 0x00, //!< Invalid
830  NT_PTP_DELAY_MECHANISM_E2E = 0x01, //!< End-to-End or delay request-response mechanism
831  NT_PTP_DELAY_MECHANISM_P2P = 0x02, //!< Peer-to-Peer or peer delay mechanism
832  NT_PTP_DELAY_MECHANISM_DISABLED = 0xFE //!< no propagation delay mechanism implemented
833 };
834 
835 
836 /**
837  * Timestamp structure used for PTP information request
838  * Number of seconds since configured Epoch (if PTP timescale, this is TAI time)
839  */
841  uint32_t sec; //!< Number of seconds and nano seconds since Epoch
842  uint32_t nsec;
843 };
844 
845 /**
846  * Rx and Tx port statistics for the PTP ethernet port
847  */
849  // Do not change the order
850  uint32_t txGoodBytes; //!< Number of Good bytes transmitted.
851  uint32_t txGoodBroadcast; //!< Number of Good Broadcast frames transmitted.
852  uint32_t txGoodMulticast; //!< Number of Good Multicast frames transmitted.
853  uint32_t txGoodUnicast; //!< Number of Good Unicast frames transmitted.
854  uint32_t rxGoodBytes; //!< Number of Good bytes received.
855  uint32_t rxGoodBroadcast; //!< Number of Good Broadcast frames received.
856  uint32_t rxGoodMulticast; //!< Number of Good Multicast frames received.
857  uint32_t rxGoodUnicast; //!< Number of Good Unicast frames received.
858  uint32_t rxGoodLegalLength; //!< Number of Good legal length received with errors received.
859  uint32_t rxFragmented; //!< Number of Fragmented frames received.
860  uint32_t rxJabber; //!< Number of Jabber frames received.
861  uint32_t rxBadBytes; //!< Number of Bad bytes received.
862  uint32_t rxDiscarded; //!< Number of Discarded frames received.
863 };
864 
865 /**
866  * IEEE 1588 PTP clock type
867  */
869  NT_PTP_CLOCK_TYPE_ORDINARY = 0, //!< Ordinary clock slave or master
870  NT_PTP_CLOCK_TYPE_BOUNDARY = 1, //!< Boundary clock
871  NT_PTP_CLOCK_TYPE_P2P_TRANSPARENT = 2, //!< Peer-to-Peer transparent clock
872  NT_PTP_CLOCK_TYPE_E2E_TRANSPARENT = 3, //!< End-to-End transparent clock
873  NT_PTP_CLOCK_TYPE_MANAGEMENT = 4 //!< Management node
874 };
875 
876 /**
877  * Information structure for PTP port
878  */
879 struct NtPTPPort_s {
880  /* Clock description */
881  enum NtPTPClockType_e clockType; //!< Ordinary, boundary or transparent clock
882  uint8_t physicalLayerProtocol[65]; //!< Ethernet IEEE 802.3
883  int16_t physicalAddressLen; //!< Length of physical address
884  uint8_t physicalAdress[6]; //!< Physical address
885  uint8_t protocolAddress[33]; //!< ex. IPv4:10.10.10.50 or Layer2:00:0D:E9:33:22:11
886  uint8_t manufacturerId[3]; //!< Manufacturer identification
887  uint8_t productDescription[129]; //!< Product description
888  uint8_t revisionData[129]; //!< Product revision
889  uint8_t userDescr[129]; //!< User description
890  uint8_t profileId[6]; //!< Configured PTP profile
891  /* PTP ethernet port configuration/status */
892  /* and filter config */
893  enum NtLinkSpeed_e linkSpeed; //!< Current link speed on PTP ethernet port
894  enum NtPTPNetProt_e ptpNetProt; //!< Configured PTP network protocol
895  enum NtPTPFilter_e ptpFilter; //!< Configured PTP filter
896  enum NtPTPProfile_e ptpProfile; //!< The PTP profile configured on this adapter
897  uint32_t ipAddress; //!< IP address
898  uint32_t ipSubmask; //!< IP subnet mask
899  uint32_t ipGateway; //!< IP gateway
900  bool dhcp; //!< DHCP enabled
901  uint16_t vlanId; //!< Configured Vlan Id
902  uint16_t vlanPrio; //!< Configured Vlan priority
903 };
904 
905 
906 
907 /**
908  * IEEE 1588 PTP clock quality
909  */
911  uint8_t clkClass; //!< Clock class
912  uint8_t clkAccuracy; //!< Clock accuracy
913  uint16_t clkVariance; //!< Clock variance
914 };
915 
916 /**
917  * IEEE 1588 PTP Default Data Set
918  */
920  /* Const values */
921  bool twoStepFlag; //!< One or two step clock
922  uint8_t clockId[8]; //!< Clock Id
923  uint16_t NumPorts; //!< Number of ports
924  struct NtPTPclkQuality_s clkQuality; //!< Clock quality
925  /* From configuration of clock */
926  uint8_t priority1; //!< Master priority1 for BMC
927  uint8_t priority2; //!< Master priority2 for BMC
928  uint8_t domain; //!< PTP domain operating in
929  bool slaveOnly; //!< Slave-only identifier
930 };
931 
932 /**
933  * IEEE 1588 PTP Current Data Set
934  */
936  uint16_t stepsRemoved; //!< Steps removed information for BMC
937  int64_t offsFromMaster; //!< Current offset from master
938  int64_t meanPathDelay; //!< Current mean path delay
939 };
940 
941 /**
942  * IEEE 1588 PTP Parent Data Set
943  */
945  uint8_t parentPortId[8]; //!< Parent port identifier
946  bool parentStat; //!< Is observed variance and observed phase change measured
947  uint16_t observedOffsScaledLogVariance; //!< Observed offset variance of the parent clock, measured by this clock
948  int32_t observedPhaseChangeRate; //!< Observed phase change rate of the parent clock, measured by this clock
949  struct NtPTPclkQuality_s gmQuality; //!< Grand Master clock quality
950  uint8_t gmId[8]; //!< Grand Master clock Id
951  uint8_t gmPriority1; //!< Grand Master priority 1
952  uint8_t gmPriority2; //!< Grand Master priority 2
953 
954  /* Proprietary extension */
955  union {
956  struct {
957  uint8_t grandmasterId; //!< Power profile Grand master ID
958  uint32_t grandmasterTimeInaccuracy; //!< Power profile grand master time inacuuracy
959  uint32_t networkTimeInaccuracy; //!< Power profile network time inaccuracy
960  uint8_t keyField; //!< Alternate time offset indicator tlv keyField
961  uint32_t currentOffset; //!< Alternate time offset indicator tlv currentOffset
962  uint32_t jumpSeconds; //!< Alternate time offset indicator tlv jumpSeconds
963  uint64_t timeOfNextJump; //!< Alternate time offset indicator tlv timeOfNextJump
964  char displayName[10]; //!< Alternate time offset indicator tlv displayName
965  } power;
966  struct {
967  uint32_t IPv4_Addr; //!< IP address of Unicast grand master
968  uint8_t ssm_ql; //!< Telecom profile SSM quality level
969  uint8_t priority; //!< The configured priority of current grand master
970  } telecom;
971  } profile; //!< information received on Announce depending on PTP profile used
972 };
973 
974 /**
975  * IEEE 1588 PTP Time Properties Data Set
976  */
978  int16_t currentUtcOffset; //!< Current UTC offset used. This may be from GM or configured if currUtcOffsValid is false
979  bool currUtcOffsValid; //!< Is current UTC offset specified by GM valid
980  bool leap59; //!< True if last minute of current UTC day is 59 sec
981  bool leap61; //!< True if last minute of current UTC day is 61 sec
982  bool timeTraceable; //!< True if timescale and current UTC offset is traceable to a primary source
983  bool frequencyTraceable; //!< True if the frequency determining the timescale is traceable to a primary source
984  bool ptpTimescale; //!< True if GM timescale is PTP
985  enum NtPTPTimeSource_e timeSource; //!< Identifies the source used by the GM
986 };
987 
988 
989 /**
990  * IEEE 1588 PTP Port Data Set
991  */
993  uint8_t portId[8]; //!< Port Identity
994  enum NtPTPPortState_e state; //!< Current PTP port state
995  int64_t peerMeanPathDelay; //!< If using Peer-to-Peer delay mechanism this is the measured P2P propagation delay for this port
996  uint8_t versionNumber; //!< PTP version number of this port
997  /* Configuration */
998  int8_t logMinDelReqInt; //!< Current minimum delay request interval (when E2E used)
999  int8_t logAnnoInt; //!< Current mean announce interval
1000  uint8_t announceReceiptTimeout; //!< Configured announce receipt timeout multiplier
1001  int8_t logSyncInt; //!< Configured sync interval used in master mode
1002  enum NtPTPDelayMech_e delayMechanism; //!< Configured propagation delay mechanism
1003  int8_t logMinPDelayReqInt; //!< Configured minimum peer delay request interval (when P2P used)
1004 };
1005 
1006 /**
1007  * IEEE 1588 PTP all Data Sets
1008  */
1010  struct NtPTPdefaultDs_s defaultDs; //!< Default Data Set
1011  struct NtPTPcurrentDs_s currentDs; //!< Current Data Set
1012  struct NtPTPparentDs_s parentDs; //!< Parent Data Set
1013  struct NtPTPtimePropertiesDs_s timePropDs; //!< Time Property Data Set
1014  struct NtPTPportDs_s portDs; //!< Port Data Set
1015 };
1016 
1018  int32_t PTPDelayAsymmetry; //!< PTP Delay asymmetry compensation parameter in ns
1019 };
1020 
1021 
1022 
1023 /**
1024  * PTP information structure
1025  */
1027  bool enabled; //!< Is PTP stack configured to be used (slave, master or ptp pps sampling)
1028  struct NtPTPTimestamp_s ts; //!< Timestamp at this info retrieval
1029  struct NtPTPPort_s ptpPort; //!< PTP port information structure
1030  struct NtPTPDataSets_s ptpDataSets; //!< PTP data sets (according to IEEE1588-2008 spec.)
1031  struct NtPTPPortStat_s ptpPortStat; //!< PTP ethernet port statistics
1032  struct NtPTPImplCfg_s ptpImplCfg; //!< PTP implementation configuration settings
1033 };
1034 
1035 /**
1036  * NT_INFO_CMD_READ_PTP_V2 specific data.
1037  */
1039  uint8_t adapterNo; //!< The adapter to query
1040  uint8_t Reserved1[2];
1041  struct NtInfoPTP_v2_s data; //!< Query PTP information structure
1042 };
1043 
1044 
1045 
1046 
1054 };
1055 
1056 /**
1057  * Structure to read product information
1058  */
1059 typedef struct NtInfoProductInfo_v4_s {
1060  enum NtProductInfoType_e infoType; //!< Information from Gen 1, Gen 2, NTBPE or Gen 3 adapter
1061  char ProductId[32]; //!< Product ID (P/N)
1062  char SerialNo[2][32]; //!< Serial number (only index 0 used on Gen 1 otherwise 0 = main, 1 = front)
1063  char PbaId[2][32]; //!< PBA ID (only index 0 used on Gen 1 otherwise 0 = main, 1 = front)
1064  char AvrId[2][32]; //!< AVR version (only on Gen 2)
1065  char CpldVersion[32]; //!< CPLD Version
1066  char fpgaId1[40]; //!< FPGA Image #0 ID
1067  char fpgaId2[40]; //!< FPGA Image #1 ID
1068  uint16_t customId; //!< Custom ID
1069  uint8_t userId[8]; //!< User ID
1070  uint8_t fpgaImageRunningBank; //!< FPGA image active/running bank
1071  uint8_t fpgaImagePrimaryBank; //!< FPGA image primary bank
1072  uint8_t fpgaImageChangeState; //!< FPGA image (change/switch) state
1073  char BmcId[2][32]; //!< BMC version
1074  char NiosId[2][32]; //!< BMC NIOS version
1076 
1077 
1078 /**
1079  * Product info
1080  */
1082  uint8_t adapterNo; //!< Adapter number to query for product information
1083  NtInfoProductInfo_v4_t data; //!< Product Information returned
1084 };
1085 
1086 /**
1087  * Structure to read NTPL filter usage for gen. 3 adapters
1088  */
1089 typedef struct NtInfoFilterUsage3ga_s {
1090  int32_t sizeCount; //!< Number of frame length filters used
1091  int32_t protocolCount; //!< Number of protocol filters used
1092  int32_t errorCount; //!< Number of error filters used
1093  int32_t patternCount; //!< Number of data filters used
1094  int32_t dynOffsetCount; //!< Number of dynamic offsets used
1095  int32_t group4PlusCount; //!< Number of group filters used combining 4 patterns with 4 different dynamic offsets
1096  int32_t group8Count; //!< Number of group filters used combining 8 patterns with 2 different dynamic offsets
1097  int32_t ipmatchCount; //!< Number of IP match filters used
1098  int32_t ipmatchListOuter; //!< Number of IP match list outer resources used
1099  int32_t ipmatchListInner; //!< Number of IP match list inner resources used
1101 
1102 /**
1103  * Structure to read NTPL filter usage for gen. 4 adapters
1104  */
1105 typedef struct NtInfoFilterUsage4ga_s {
1106  uint32_t categorizerFunctionCount; //!< Number of categorizer functions used
1107  uint32_t sizeCount; //!< Number of frame length comparators used
1108  uint32_t patternExtractorCount; //!< Number of data extractors used
1109  uint32_t patternCompareCount; //!< Number of data comparators used
1110  uint32_t keyMatchCAMUsage; //!< CAM usage in percent
1111  uint32_t keyMatchTCAMUsage; //!< TCAM usage in percent
1113 
1114 typedef struct NtInfoFilterUsage_v1_s {
1115  enum NtAdapterFpgaArchGeneration_e generation; //!< Adapter generation
1116  union {
1119  } u;
1121 
1122 /**
1123  * Filter usage command
1124  */
1126  uint8_t adapterNo; //!< Adapter number to query for filter usage
1127  uint8_t Reserved1[3];
1128  uint32_t ntplId; //!< Ntpl ID to query. 0 will retrieve total usage
1129  NtInfoFilterUsage_v1_t data; //!< Filter usage information returned
1130 };
1131 
1132 /**
1133  * Path delay status codes
1134  */
1136  NT_PATH_DELAY_SUCCESS = 0x0, //!< Returned delay includes both
1137  //!< adapter and NIM contributions.
1138  NT_PATH_DELAY_NOT_SUPPORTED = 0x1, //!< The adapter or NIM is not supported;
1139  //!< the returned delay is set to zero.
1140  NT_PATH_DELAY_LINK_DOWN = 0x2, //!< The link is down;
1141  //!< the returned delay is set to zero.
1142  NT_PATH_DELAY_UNKNOWN_NIM = 0x4, //!< The NIM module is unknown; returned
1143  //!< delay pertains to the adapter/FPGA.
1144 };
1145 
1146 /**
1147  * Structure used for returning port path delay information
1148  */
1149 typedef struct NtInfoPortPathDelay_s {
1150  enum NtPathDelayStatus_e status; //!< status code
1151  int32_t delay; //!< The delay
1153 
1154 /**
1155  * Port path delay command structure
1156  */
1157 #define NT_PATH_DELAY_RX_DIR 0
1158 #define NT_PATH_DELAY_TX_DIR 1
1160  uint8_t portNo; //!< logical port number on which to query path delay
1161  uint8_t direction; //!< NT_PATH_DELAY_RX_DIR or NT_PATH_DELAY_TX_DIR.
1162  uint8_t Reserved1[2];
1163  NtInfoPortPathDelayInfo_t data; //!< Delay information (returned to caller)
1164 };
1165 
1170 };
1171 
1172 typedef struct NtInfoPropertyValue_s {
1173  enum NtPropertyType_e type;
1174  union {
1175  int i;
1176  uint64_t u;
1177  char s[120];
1178  } u;
1180 
1181 /**
1182  * Property request command
1183  */
1185  char path[120];
1187 };
1188 
1189 
1190 /* Include commands for backward compatibility */
1191 #if !defined(_NT_NTAPI_NO_COMPAT)
1192 #include "stream_info_compat.h"
1193 #endif
1194 
1195 
1196 /**
1197  * Read command structure. Query used for info via NT_InfoRead().
1198  */
1199 typedef struct NtInfo_s {
1200  enum NtInfoCmd_e cmd; //!< Info stream command
1201  /**
1202  * Union of data structures for each info stream command
1203  */
1204  union NtInfo_u {
1205  struct NtInfoCmdSystem_s system; //!< NT_INFO_CMD_READ_SYSTEM specific data
1206  struct NtInfoCmdAdapter_v7_s adapter_v7; //!< NT_INFO_CMD_READ_ADAPTER_V7 specific data version 7
1207  struct NtInfoCmdSensor_s sensor; //!< NT_INFO_CMD_READ_SENSOR specific data
1208  struct NtInfoCmdHostBuffer_v1_s hostBuffer_v1; //!< NT_INFO_CMD_READ_HOSTBUFFER specific data version 1
1209  struct NtInfoCmdStream_s stream; //!< NT_INFO_CMD_READ_STREAM specific data
1210  struct NtInfoCmdTimeSync_v4_s timeSync_v4; //!< NT_INFO_CMD_READ_TIMESYNC specific data version 4
1211  struct NtInfoCmdTimeSyncStatusExt_s timeSyncExt; //!< NT_INFO_CMD_READ_TIMESYNC_EXT_STATUS specific data
1212  struct NtInfoCmdPort_v10_s port_v10; //!< NT_INFO_CMD_READ_PORT_V9 specific data
1213  struct NtInfoCmdstreamID_s streamID; //!< NT_INFO_CMD_READ_STREAMID specific data
1214  struct NtInfoReadProductInfo_v4_s productInfo_v4;//!< NT_INFO_CMD_READ_PRODUCTINFO specific data version 4
1215  struct NtInfoCmdPTP_v2_s ptp_v2; //!< NT_INFO_CMD_READ_PTP_V2 specific data
1216  struct NtInfoCmdFilterUsage_v1_s filterUsage_v1;//!< NT_INFO_CMD_READ_FILTERUSAGE_V1 specific data
1217  struct NtInfoCmdPortPathDelay_s pathDelay; //!< NT_INFO_CMD_READ_PATH_DELAY specific data
1218  struct NtInfoCmdTimeSyncStat_s timeSyncStat; //!< NT_INFO_CMD_READ_TIMESYNC_STAT specific data
1219  struct NtInfoProperty_s property; //!< NT_INFO_CMD_READ_PROPERTY specific data
1220 #if !defined(_NT_NTAPI_NO_COMPAT)
1221  /* Commands for backward compatibility */
1222  struct NtInfoCmdTimeSync_v1_s timeSync_v1; //!< NT_INFO_CMD_READ_TIMESYNC specific data version 1
1223  struct NtInfoCmdTimeSync_v2_s timeSync_v2; //!< NT_INFO_CMD_READ_TIMESYNC specific data version 2
1224  struct NtInfoCmdTimeSync_v3_s timeSync_v3; //!< NT_INFO_CMD_READ_TIMESYNC specific data version 3
1225  struct NtInfoCmdAdapter_s adapter; //!< NT_INFO_CMD_READ_ADAPTER specific data
1226  struct NtInfoCmdAdapter_v1_s adapter_v1; //!< NT_INFO_CMD_READ_ADAPTER specific data version 1
1227  struct NtInfoCmdPort_s port; //!< NT_INFO_CMD_READ_PORT specific data
1228  struct NtInfoCmdPort_v1_s port_v1; //!< NT_INFO_CMD_READ_PORT_V1 specific data
1229  struct NtInfoCmdTimeSync_s timeSync; //!< NT_INFO_CMD_READ_TIMESYNC specific data
1230  struct NtInfoCmdHostBuffer_s hostBuffer; //!< NT_INFO_CMD_READ_HOSTBUFFER specific data
1231  struct NtInfoCmdAdapter_v2_s adapter_v2; //!< NT_INFO_CMD_READ_ADAPTER specific data version 2
1232  struct NtInfoCmdPort_v2_s port_v2; //!< NT_INFO_CMD_READ_PORT_V2 specific data
1233  struct NtInfoCmdPTP_s ptp; //!< NT_INFO_CMD_READ_PTP specific data
1234  struct NtInfoCmdAdapter_v3_s adapter_v3; //!< NT_INFO_CMD_READ_ADAPTER specific data version 3
1235  struct NtInfoCmdPort_v3_s port_v3; //!< NT_INFO_CMD_READ_PORT_V3 specific data
1236  struct NtInfoCmdAdapter_v4_s adapter_v4; //!< NT_INFO_CMD_READ_ADAPTER_V4 specific data version 4
1237  struct NtInfoCmdPort_v4_s port_v4; //!< NT_INFO_CMD_READ_PORT_V4 specific data
1238  struct NtInfoCmdPTP_v1_s ptp_v1; //!< NT_INFO_CMD_READ_PTP_V1 specific data
1239  struct NtInfoCmdPort_v5_s port_v5; //!< NT_INFO_CMD_READ_PORT_V5 specific data
1240  struct NtInfoCmdAdapter_v5_s adapter_v5; //!< NT_INFO_CMD_READ_ADAPTER specific data version 5
1241  struct NtInfoCmdPort_v6_s port_v6; //!< NT_INFO_CMD_READ_PORT_V6 specific data
1242  struct NtInfoReadProductInfo_s productInfo;//!< NT_INFO_CMD_READ_PRODUCTINFO specific data
1243  struct NtInfoCmdPort_v7_s port_v7; //!< NT_INFO_CMD_READ_PORT_V6 specific data
1244  struct NtInfoReadProductInfo_v1_s productInfo_v1;//!< NT_INFO_CMD_READ_PRODUCTINFO specific data version 1
1245  struct NtInfoReadProductInfo_v2_s productInfo_v2;//!< NT_INFO_CMD_READ_PRODUCTINFO specific data version 2
1246  struct NtInfoCmdFilterUsage_s filterUsage; //!< NT_INFO_CMD_READ_FILTERUSAGE specific data
1247  struct NtInfoCmdPort_v8_s port_v8; //!< NT_INFO_CMD_READ_PORT_V8 specific data
1248  struct NtInfoReadProductInfo_v3_s productInfo_v3;//!< NT_INFO_CMD_READ_PRODUCTINFO specific data version 3
1249  struct NtInfoCmdAdapter_v6_s adapter_v6; //!< NT_INFO_CMD_READ_ADAPTER_V6 specific data version 6
1250  struct NtInfoCmdPort_v9_s port_v9; //!< NT_INFO_CMD_READ_PORT_V9 specific data
1251 #endif
1252  } u;
1253 } NtInfo_t;
1254 
1255 /**
1256  * Info stream handle
1257  */
1258 typedef struct NtInfoStream_s* NtInfoStream_t;
1259 
1260 /**
1261  * @brief Opens an info stream
1262  *
1263  * This function is called to retrieve a handle to an info stream
1264  *
1265  * @param[out] hStream Reference to an NtInfoStream_t stream pointer
1266  * @param[in] name The stream friendly name - used in, for example, logging statements
1267  *
1268  * @retval 0 Success
1269  * @retval !=0 Error
1270  */
1271 int NT_InfoOpen(NtInfoStream_t *hStream, const char *name);
1272 
1273 /**
1274  * @brief Reads data from an info stream
1275  *
1276  * Returns system stream data
1277  *
1278  * @param[in] hStream NtSystemStream_t handle
1279  * @param[in,out] info The info structure containing query info, which serves as an output buffer for data
1280  *
1281  * @retval 0 Success
1282  * @retval !=0 Error
1283  */
1284 int NT_InfoRead(NtInfoStream_t hStream, NtInfo_t *info);
1285 
1286 /**
1287  * @brief Closes an info stream
1288  *
1289  * This function is called to close an info stream
1290  *
1291  * @param[in] hStream Reference to an NtInfoStream_t stream pointer
1292  *
1293  * @retval 0 Success
1294  * @retval !=0 Error
1295  */
1296 int NT_InfoClose(NtInfoStream_t hStream);
1297 
1298 /** @} */
1299 
1300 #endif // __STREAM_INFO_H__