In this section
This section describes a number of time stamp features supported by the SmartNICs.
The time stamp clock
The time stamp clock is also used for time-stamping statistics data blocks transferred to the host memory. This enables the host application to correlate received frame data with statistics information.
The time stamp clock is driven by a local clock oscillator, and the internal resolution is 1 ns. The time stamp clock can either be free-running or be adjusted according to another reference clock.
Time stamps in packet descriptors
The standard packet descriptor, the dynamic packet descriptors and the PCAP packet descriptor contain the time stamp (see DN-1128). The time stamp in the standard packet descriptor can be retrieved using the NT_NET_GET_PKT_TIMESTAMP macro (see DN-0449).
Injection of time stamps
A time stamp can be injected into a frame to be transmitted at a specified offset on NT200A02 SmartNICs running on a test and measurement image.
The injected data consists of the 64-bit time stamp prepended a 2-byte correction value to make the complete 10-byte checksum neutral. The original 10 bytes of frame data must be set to all zeros by the application before the injection, and they must belong to the same layer (fully contained in one checksum domain). The time stamp injection offset must be 2-byte aligned with the start of the data included in the checksum to be recalculated.
The time stamp injection can be controlled per packet by a control bit in the dynamic packet descriptors. This is illustrated in the net/timestamp_inject code example (see DN-0449). Time stamp injection can also be applied globally by using TimestampInjectAlways in the ntservice.ini file (see Configuring Global Time Stamp Injection).
The value of the time stamp can be the time when the first byte of the frame is put on the wire, or the time when the last byte is put on the wire, depending on the setting of TimestampMethod in the ntservice.ini file (see Specifying the Time Stamp Method).
The time stamp injection offset is determined by the setting of TimestampInjectDynamicOffset and TimestampInjectStaticOffset in the ntservice.ini file (see Setting the Time Stamp Injection Offset). TimestampInjectDynamicOffset can be set to the start of the frame, the end of the frame, the start of the layer 3 header or the start of the layer 4 header. The actual offset is calculated from the location of TimestampInjectDynamicOffset by adding the value of TimestampInjectStaticOffset. If, for instance, TimestampInjectDynamicOffset is set to the end of the frame and TimestampInjectStaticOffset is set to -20, the time stamp is injected 20 bytes before the end of the frame. The combination of the two offsets must result in a location inside the current frame, and there must be enough space for both the prepended 2-byte correction value, the 8-byte time stamp and a 4-byte FCS, that is the resulting offset must be between the start of the frame and 14 bytes before the end of the frame. Otherwise some of the time stamp is overwritten by the FCS, and the checksum will be wrong.