stream_info.h

Reference Documentation

product_line_custom
Napatech SmartNIC
category
Reference Information

Go to the documentation of this file.

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