Reference Documentation

Napatech SmartNIC
Reference Information

Events are used to get asynchronous information from the system. The information could be an alert if a sensor is out of range, or if the link disappears. To receive any event, the Event Stream must be used and must be polled continuously.

Event Types

The following event types can be received:




Triggered if there is a change in the link status for one of the ports


Triggered if a sensor is out of range


Triggered if a configuration has been changed


Triggered by PPS timesync when a new time is needed


Triggered by fill level events


Triggered by PTP port link up/down events


Triggered by changes in timesync state events

The event types are defined in the NtEventSource_e enum

Port Events

Port link events are triggered if there is a change in the link status of a port




A link up occured


A link down occured


An internal error occured

The port events are defined in the NtEventPort_e enum

Config Change Events

When a configuration change is made, either by an application using the configuration stream NT_ConfigWrite, or internally, a config change event is triggered. The event contains a copy of the NtConfig_t configuration structure used by the NT_ConfigWrite configuration stream to send the change request.

Sensor Events

Sensor events are triggered if a sensor is out of range. This could be a temperature sensor that is too hot or a fan sensor that is too low due to a blocked fan.




The sensor is out of range and enters the alarm state


The sensor is within range and leaves the alarm state again

The sensor event is defined in the NtEventSensor_e enum. See Sensors for further information about the sensors.

Timesync Events

Timesync events are triggered by PPS timesync when a new time is needed. The adapter receives a PPS pulse then requires the matching time.




Timesync needs an updated time

Reading an Event

NtEvent_t hEvent; // Read the event. Wait 10 seconds for the event to occur if((status = NT_EventRead(hEventStream, &hEvent, 10000)) != NT_SUCCESS) { // Get the status code as text NT_ExplainError(status, errorBuffer, sizeof(errorBuffer)-1); fprintf(stderr, "NT_EventRead() failed: %s\n", errorBuffer); return -1; } // Print event info if(hEvent.type == NT_EVENT_SOURCE_CONFIG) { if(hEvent.u.configEvent.parm == NT_CONFIG_PARM_ADAPTER_TIMESTAMP) { printf("Event received: Timestamp config change: New time: %lld\n", (unsigned long long); } }

SDRAM Fill Level Warning Event

An event can be sent if the host buffers are running full. Up to 4 levels can be defined in the ntservice.ini file. The event works on a single host buffer. If several host buffers are defined and used, each host buffer will trigger its own event. [System] SDRAMFillLevelWarning=20,40,60,80 In the above example, an event is sent if the SDRAM fill level exceeds 20%, 40%, 60% and 80% and when the SDRAM fill level drops below the levels again. The SDRAM fill warning events are received like any other events by using the event stream. The event mask should either be NT_EVENT_SOURCE_ALL or NT_EVENT_SOURCE_SDRAM_FILL_LEVEL if only the SDRAM fill level events are required. The outputs from the SDRAM fill level events are placed in the NtSDRAMFillLevel_s structure and contain a number of values describing the SDRAM and host buffer usage, and the fill level in percent. Note: If the numStreams is larger than 1, the host buffer is shared between applications. Setting the SDRAMFillLevelWarning to zero disables the event. Note: Setting the fill levels to, for example, 0,50,80 will also disable the event.

How it works The SDRAM fill level is monitored every millisecond. If the fill level is above one of the limits defined in the ntservice.ini file, an event is triggered. The triggered event contains information about the current fill level. Only the 65% event is triggered. An event will not be triggered for every limit being crossed. In the above case an event will not be triggered when crossing the 20% limit and the 50% limit. Hysterisis To avoid event flooding, a hysterisis of 10% is used. This means when a limit is crossed with a rising level an event is triggered. However, when a limit is crossed with a falling level, the level must be 10% below the limit before an event is triggered. The figure below shows when an event is triggered with rising and falling levels. 0% and 100% An event will always be triggered when reaching either 100% SDRAM (full) or 0% SDRAM (empty) even though 0% and 100% are not defined in the ntservice.ini file. Valid syntaxes Values can be omitted - if a value is omitted it is replaced by a zero


Equal to




Event disabled



Event disabled



Event disabled



Event disabled

Event Monitor Example

See the eventMonitor_example.c example for further information about how to read an event.