TX Network Stream

Reference Documentation

Platform
Intel® PAC
Napatech SmartNIC
Content Type
Reference Information
Capture Software Version
Link™ Capture Software 12.10
Napatech Software Suite: TX Network Stream

Typedefs

typedef struct NtNetStreamTx_s * NtNetStreamTx_t
 

Enumerations

enum  NtNetTxPacketOption_e {
  NT_NETTX_PACKET_OPTION_UNKNOWN =0, NT_NETTX_PACKET_OPTION_DEFAULT, NT_NETTX_PACKET_OPTION_L2 =NT_NETTX_PACKET_OPTION_DEFAULT, NT_NETTX_PACKET_OPTION_RAW,
  NT_NETTX_SEGMENT_OPTION_RAW, NT_NETTX_PACKET_OPTION_DYN
}
 
enum  NtNetTxOpenNumaOption_e { NT_NETTX_NUMA_ANY_HB =0xFFFFFFFE, NT_NETTX_NUMA_ADAPTER_HB =0xFFFFFFFF }
 
enum  NtNetTxOpenFlags_e { NT_NETTX_OPEN_NONE =0, NT_NETTX_OPEN_FLAGS_NONE =0, NT_NETTX_OPEN_FLAGS_ADAPTER_MULTI_PORT_BUFFER =(1LL<<0) }
 

Functions

int NT_NetTxOpen (NtNetStreamTx_t *hStream, const char *name, uint64_t portMask, uint32_t NUMA, uint32_t minHostBufferSize)
 Opens a TX host buffer and returns a NtNetStreamTx_t handle. More...
 
int NT_NetTxOpen_v2 (NtNetStreamTx_t *hStream, const char *name, uint64_t portMask, uint32_t NUMA, uint32_t minHostBufferSize, enum NtPacketDescriptorType_e descriptor, enum NtTimestampType_e ts)
 Opens a TX host buffer and returns a NtNetStreamTx_t handle (extended version) More...
 
int NT_NetTxOpen_v3 (NtNetStreamTx_t *hStream, const char *name, uint64_t portMask, uint32_t NUMA, uint64_t minHostBufferSize, enum NtPacketDescriptorType_e descriptor, enum NtTimestampType_e ts)
 Opens a TX host buffer and returns a NtNetStreamTx_t handle (extended version) More...
 
void NT_NetTxOpenAttrInit (NtNetTxAttr_t *attr)
 Initialize TX stream attributes. More...
 
void NT_NetTxOpenAttrSetName (NtNetTxAttr_t *attr, const char *name)
 Sets the stream name attribute. More...
 
const char * NT_NetTxOpenAttrGetName (const NtNetTxAttr_t *attr)
 Returns the name attribute. More...
 
int NT_NetTxOpenAttrSetDescriptorMode (NtNetTxAttr_t *attr, enum NtNetTxDescriptorMode_e descriptorMode)
 Sets the descriptor mode attribute. More...
 
enum NtNetTxDescriptorMode_e NT_NetTxOpenAttrGetDescriptorMode (const NtNetTxAttr_t *attr)
 Returns the descriptor mode attribute. More...
 
void NT_NetTxOpenAttrSetPortMask (NtNetTxAttr_t *attr, uint64_t portMask)
 Sets the port mask attribute. More...
 
uint64_t NT_NetTxOpenAttrGetPortMask (NtNetTxAttr_t *attr)
 Returns the port mask attribute. More...
 
void NT_NetTxOpenAttrSetNUMA (NtNetTxAttr_t *attr, uint32_t NUMA)
 Sets the numa attribute. More...
 
uint32_t NT_NetTxOpenAttrGetNUMA (NtNetTxAttr_t *attr)
 Returns the numa attribute. More...
 
void NT_NetTxOpenAttrSetFlags (NtNetTxAttr_t *attr, uint32_t flags)
 Sets the flags attribute. More...
 
uint32_t NT_NetTxOpenAttrGetFlags (NtNetTxAttr_t *attr)
 Returns the flags attribute. More...
 
void NT_NetTxOpenAttrSetMinHostbufferSize (NtNetTxAttr_t *attr, uint64_t minHostBufferSize)
 Sets the minimum host buffer size attribute. More...
 
uint64_t NT_NetTxOpenAttrGetMinHostbufferSize (NtNetTxAttr_t *attr)
 Returns the minimum host buffer size attribute. More...
 
void NT_NetTxOpenAttrSetDescriptor (NtNetTxAttr_t *attr, enum NtPacketDescriptorType_e descriptor)
 Sets the descriptor type attribute. More...
 
enum NtPacketDescriptorType_e NT_NetTxOpenAttrGetDescriptor (NtNetTxAttr_t *attr)
 Returns the descriptor type attribute. More...
 
int NT_NetTxOpenAttrSetTxtDescriptorPosTimestampInject (NtNetTxAttr_t *attr, bool enable, uint32_t pos)
 Sets bit position in packet descriptor for the Timestamp Inject command bit. More...
 
void NT_NetTxOpenAttrGetTxtDescriptorPosTimestampInject (NtNetTxAttr_t *attr, bool *enable, uint32_t *pos)
 Gets bit position in packet descriptor for the Timestamp Inject command bit. More...
 
int NT_NetTxOpenAttrSetTxtDescriptorPosFcs (NtNetTxAttr_t *attr, bool enable, uint32_t pos)
 Sets bit position in packet descriptor for the FCS control command bit. More...
 
void NT_NetTxOpenAttrGetTxtDescriptorPosFcs (NtNetTxAttr_t *attr, bool *enable, uint32_t *pos)
 Gets bit position in packet descriptor for the FCS control command bit. More...
 
void NT_NetTxOpenAttrSetTimestampType (NtNetTxAttr_t *attr, enum NtTimestampType_e timestampType)
 Sets the timestamp type attribute. More...
 
enum NtTimestampType_e NT_NetTxOpenAttrGetTimestampType (NtNetTxAttr_t *attr)
 Returns the timestamp type attribute. More...
 
int NT_NetTxOpenAttrSetDescriptorPosLayer3Offset (NtNetTxAttr_t *attr, bool enable, uint32_t pos)
 Set bit position in packet descriptor for layer 3 offset bits. More...
 
void NT_NetTxOpenAttrGetDescriptorPosLayer3Offset (const NtNetTxAttr_t *attr, bool *enable, uint32_t *pos)
 Get bit position in packet descriptor for layer 3 offset bits. More...
 
int NT_NetTxOpenAttrSetDescriptorPosLayer4Offset (NtNetTxAttr_t *attr, bool enable, uint32_t pos)
 Set bit position in packet descriptor for layer 4 offset bits. More...
 
void NT_NetTxOpenAttrGetDescriptorPosLayer4Offset (const NtNetTxAttr_t *attr, bool *enable, uint32_t *pos)
 Get bit position in packet descriptor for layer 4 offset bits. More...
 
int NT_NetTxOpenAttrSetDescriptorPosFrameType (NtNetTxAttr_t *attr, bool enable, uint32_t pos)
 Set bit position in packet descriptor for frame type bits. More...
 
void NT_NetTxOpenAttrGetDescriptorPosFrameType (const NtNetTxAttr_t *attr, bool *enable, uint32_t *pos)
 Get bit position in packet descriptor for frame type bits. More...
 
int NT_NetTxOpenAttrSetDescriptorPosChecksumCmd (NtNetTxAttr_t *attr, bool enable, uint32_t pos)
 Set bit position in packet descriptor for checksum command bits. More...
 
void NT_NetTxOpenAttrGetDescriptorPosChecksumCmd (const NtNetTxAttr_t *attr, bool *enable, uint32_t *pos)
 Get bit position in packet descriptor for checksum command bits. More...
 
int NT_NetTxOpenAttrSetDescriptorPosIgnoreBit (NtNetTxAttr_t *attr, bool enable, uint32_t pos)
 Set bit position in packet descriptor for TX ignore bit. More...
 
void NT_NetTxOpenAttrGetDescriptorPosIgnoreBit (const NtNetTxAttr_t *attr, bool *enable, uint32_t *pos)
 Get bit position in packet descriptor for TX ignore bit. More...
 
int NT_NetTxOpenAttrSetDescriptorPosTxNowBit (NtNetTxAttr_t *attr, bool enable, uint32_t pos)
 Set bit position in packet descriptor for TX now bit. More...
 
void NT_NetTxOpenAttrGetDescriptorPosTxNowBit (const NtNetTxAttr_t *attr, bool *enable, uint32_t *pos)
 Get bit position in packet descriptor for TX now bit. More...
 
int NT_NetTxOpenAttrSetDescriptorPosClockBit (NtNetTxAttr_t *attr, bool enable, uint32_t pos)
 Set bit position in packet descriptor for TX set clock bit. More...
 
void NT_NetTxOpenAttrGetDescriptorPosClockBit (const NtNetTxAttr_t *attr, bool *enable, uint32_t *pos)
 Get bit position in packet descriptor for TX set clock bit. More...
 
int NT_NetTxOpenAttrSetDescriptorUseWireLength (NtNetTxAttr_t *attr, bool enable)
 Set mode for use of wire length in packet descriptor. More...
 
int NT_NetTxOpenAttrGetDescriptorUseWireLength (const NtNetTxAttr_t *attr, bool *enable)
 get mode for use of wire length in packet descriptor More...
 
int NT_NetTxOpen_Attr (NtNetStreamTx_t *hStream, const NtNetTxAttr_t *attr)
 Opens a TX host buffer and returns a NtNetStreamTx_t handle (extended version) More...
 
int NT_NetTxGet (NtNetStreamTx_t hStream, NtNetBuf_t *netBuf, uint32_t port, size_t packetSize, enum NtNetTxPacketOption_e packetOption, int timeout)
 Gets a TX port buffer. More...
 
int NT_NetTxRelease (NtNetStreamTx_t hStream, NtNetBuf_t netBuf)
 Releases the network buffer. More...
 
int NT_NetTxRead (NtNetStreamTx_t hStream, NtNetTx_t *cmd)
 Reads data from the stream. More...
 
int NT_NetTxClose (NtNetStreamTx_t hStream)
 Closes a TX stream. More...
 
int NT_NetTxAddPacket (NtNetStreamTx_t hStream, uint32_t port, NtNetTxFragment_t *fragments, uint32_t fragmentCount, int timeout)
 AddPacket to a TX stream. More...
 

Detailed Description

The TX network stream is used for transmitting data. Packets sent via this stream will be interleaved with traffic from in-line streams or other transmit streams.

To open a TX network stream, call the NT_NetTxOpen function. To get an empty packet, call the NT_NetTxGet function with the desired length of the packet. The length includes the 4 bytes for the Ethernet CRC. Now fill data into the buffer and use the TX Macros for setting the desired time stamp, force CRC generation, etc. When finished with the packet, call NT_NetTxRelease to release and transmit it. When finished with the stream, call NT_NetTxClose to close it.

For an example on how to use the packet interface, see net/transmit/transmit_example.c.

With NT3GA FPGAs Tx mode selection is an adapter global configuration - controlled by the actual FPGA image functionality and the profile ini-option.
With NT4GA FPGAs the configuration granularity has changed - Tx mode selection can be set up/configured dynamically on individual streams.
To facilitate this change - new options have been introduced into NTAPI (NT_NetTxOpen).

Tx streams are normally "per port Tx mode" - meaning that one host buffer is allocated per (Tx) port set in the (Tx) portMask specfied to NT_NetTxOpen. Each allocated host buffer will be paired to a specific Tx port and the txPort field in the standard packet descriptor will have no meaning/effect.

Adapter-based multi-port transmit buffer mode (named after its option/flag) will allocate one host buffer per adapter that has (Tx) ports set in the (Tx) portMask specified to NetTxOpen. Each host buffer allocated will be paired to a specific adapter - and that host buffer will be able to transmit on all the ports mentioned in the portMask on the adapter it is paired with. The Tx port will be selected by the txPort field in each packet descriptor.

Adapter-based multi-port transmit buffer mode is selected by a new option (called flags) that is introduced to the attributes used by NTAPI function NT_NetTxOpen_Attr(). The new NT_NETTX_OPEN_FLAGS_ADAPTER_MULTI_PORT_BUFFER flag/attribute is set up using NT_NetTxOpenAttrSetFlags().

With NT4GA Test & Measurement FPGAs the following can be controlled per transmitted packet: timestamp injection, FCS calculation, Layer 3 checksum calculation and Layer 4 checksum calculation. See 4GA Test and Measurement features for a detailed description.

HW IP/UDP/TCP checksum

The NT40E2-4, NT20E2, NT4E2 adapters and NT4E in-line adapters support IPv4, UDP and TCP calculations in hardware on transmit.
In order to use the feature, the packet descriptor must be configured prior to calling NT_NetTxRelease().
Note: The feature only works on non-fragmented packets.

Here is an example on the configuration required before transmitting a packet.
 struct IPv4Header_s {
  uint16_t ip_hl: 4;
  uint16_t ip_v: 4;
  uint16_t ip_tos: 8;
  uint16_t ip_len;

  uint32_t ip_id:16;
  uint32_t ip_frag_off:16;
#define IP_DONT_FRAGMENT  0x4000
#define IP_MORE_FRAGMENTS 0x2000

  uint32_t ip_ttl:8;
  uint32_t ip_prot:8;
  uint32_t ip_crc:16;

  uint32_t ip_src;
  uint32_t ip_dest;
}; //20 bytes

struct UDPHeader_s {
  uint32_t udp_src:16;
  uint32_t udp_dest:16;

  uint32_t udp_len:16;
  uint32_t udp_crc:16;
}; // 8 bytes


          NT_NET_SET_PKT_IS_IP(hNetBuf, 1);
          NT_NET_SET_PKT_IS_UDP(hNetBuf, 1);
          NT_NET_SET_PKT_IP_CSUM_OK(hNetBuf, 1);
          NT_NET_SET_PKT_UDP_CSUM_OK(hNetBuf, 1);
          if(NT_NET_GET_PKT_DESCRIPTOR_TYPE(hNetBuf) == NT_PACKET_DESCRIPTOR_TYPE_NT_EXTENDED) {
            NT_NET_SET_PKT_ISL(hNetBuf, 0);
            NT_NET_SET_PKT_VLAN_COUNT(hNetBuf, 0);
            NT_NET_SET_PKT_MPLS_COUNT(hNetBuf, 0);
            NT_NET_SET_PKT_L2_FRAME_TYPE(hNetBuf, NT_L2_FRAME_TYPE_ETHER_II);
            NT_NET_SET_PKT_L3_FRAME_TYPE(hNetBuf, NT_L3_FRAME_TYPE_IPv4);
            NT_NET_SET_PKT_L4_FRAME_TYPE(hNetBuf, NT_L4_FRAME_TYPE_UDP);
            NT_NET_SET_PKT_L3_LENGTH(hNetBuf, sizeof(struct IPv4Header_s)>>2);
            NT_NET_SET_PKT_L4_LENGTH(hNetBuf, sizeof(struct UDPHeader_s)>>2);
            NT_NET_SET_PKT_CALC_L3_CHECKSUM(hNetBuf, 1);
            NT_NET_SET_PKT_CALC_L4_CHECKSUM(hNetBuf, 1);
         }

Packet based transmit

For packet based transmit see the example net/transmit/transmit_packet_example.c

Segment based transmit

For segment based transmit see the example net/transmit_segment/transmit_segment_example.c

Typedef Documentation

typedef struct NtNetStreamTx_s* NtNetStreamTx_t

Network TX stream handle - used for TX streams

Definition at line 862 of file stream_net.h.

Enumeration Type Documentation

Network TX packet options

Enumerator
NT_NETTX_PACKET_OPTION_UNKNOWN 

Unknown option.

NT_NETTX_PACKET_OPTION_DEFAULT 

Gets a TX buffer with a pre-configured packet descriptor. Use this option to transmit L2 data. This option uses packetSize as wire length.

NT_NETTX_PACKET_OPTION_L2 

Same as default.

NT_NETTX_PACKET_OPTION_RAW 

Gets a raw TX packet buffer without packet descriptor. Care needs to be taken when using this option. Use this option in replay scenarios where packets already have a correct descriptor, e.g. data recorded using File Network Stream. Uses packetSize as the stored length. With this option packetSize must be a multiple of 8 (NT3GA only).

NT_NETTX_SEGMENT_OPTION_RAW 

Gets a raw TX segment buffer. Care needs to be taken when using this option. Use this option in replay scenarios where the segment length is known prior to calling NT_NetTxGet. Use packetSize as the segment length. The port parameter in NT_NetTxGet is used to control that the segment returned belongs to the adapter on which the port resides. It is required that the txPort in the packet descriptors within the segment are set before releasing the segment. If the host buffer layout is NT_NET_HOSTBUFFER_LAYOUT_SLABS, the slabs are automatically terminated when this option is used.

NT_NETTX_PACKET_OPTION_DYN 

Gets a TX buffer with a pre-configured dynamic packet descriptor. Use this option to transmit L2 data. This option uses packetSize as wire length. Set DescriptorMode before using this option.

Definition at line 867 of file stream_net.h.

Network TX NUMA HB options for NUMA-parameter in NT_NetTxOpen()

Enumerator
NT_NETTX_NUMA_ANY_HB 

(=-2) Allocate TX host buffer from any TX host buffer pool

NT_NETTX_NUMA_ADAPTER_HB 

(=-1) Allocate TX host buffer from TX-host buffer pool on that NUMA node where the adapter of the TX-port is located

Definition at line 879 of file stream_net.h.

Flags for NT_NetTxOpen_Attr()

Enumerator
NT_NETTX_OPEN_NONE 

No NtNetTxOpen flags (Obsolete)

NT_NETTX_OPEN_FLAGS_NONE 

No NtNetTxOpen flags.

NT_NETTX_OPEN_FLAGS_ADAPTER_MULTI_PORT_BUFFER 

Allocate one TX host buffer per adapter that has ports set in NT_NetTXOpen portmask - if unset allocate one TX host buffer per port that is set in NT_NetTXOpen portmask.

Definition at line 887 of file stream_net.h.

Function Documentation

int NT_NetTxOpen ( NtNetStreamTx_t hStream,
const char *  name,
uint64_t  portMask,
uint32_t  NUMA,
uint32_t  minHostBufferSize 
)

Opens a TX host buffer and returns a NtNetStreamTx_t handle.

This function, which is superseded by NT_NetTxOpen_v3(), is called to retrieve a TX stream handle.

Note that the TX stream on capture-only adapters (NT4E Capture, NT4E_STD Capture and NT20E Capture) will have very limited transmit capabilities. They will not be able to transmit at line rate and their transmit sizes and statistics will also be limited. Packets larger than 2000 bytes will sliced to the size of 2000 bytes.

Parameters
[out]hStreamReference to a NtNetStreamTx_t stream pointer
[in]nameStream friendly name - used in, for example, logging statements
[in]portMaskBitmask for ports this stream will use for transmitting
[in]NUMANUMA node on which the host buffer is be located (NOTE: Special options in NtNetTxOpenNumaOption_e)
[in]minHostBufferSizeMinimum size of host buffer needed in MBytes. The smallest host buffer found that is larger or equal to minHostBufferSize is used and the size of the host buffer is set to minHostBufferSize. If set to 0, the first host buffer found is used regardsless of the size.
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description
Examples:
net/replay/replay_example.c, net/replay4GA/replay4ga_example.c, net/replayGS/replayGS_example.c, net/transmit_multifunction/transmit_multifunction_example.c, net/transmit_on_timestamp/transmit_on_timestamp_example.c, net/transmit_packet/transmit_packet_example.c, and net/transmit_segment/transmit_segment_example.c.

Referenced by main(), and taskTransmitter().

int NT_NetTxOpen_v2 ( NtNetStreamTx_t hStream,
const char *  name,
uint64_t  portMask,
uint32_t  NUMA,
uint32_t  minHostBufferSize,
enum NtPacketDescriptorType_e  descriptor,
enum NtTimestampType_e  ts 
)

Opens a TX host buffer and returns a NtNetStreamTx_t handle (extended version)

This function, which is superseded by NT_NetTxOpen_v3(), is similar to the NT_NetTxOpen() function. The main difference is that it has two additional parameters, the descriptor type and the timestamp format.

This function will only work with 4GA adapters.

Parameters
[out]hStreamReference to a NtNetStreamTx_t stream pointer
[in]nameStream friendly name - used in, for example, logging statements
[in]portMaskBitmask for ports this stream will use for transmitting
[in]NUMANUMA node on which the host buffer is be located (NOTE: Special options in NtNetTxOpenNumaOption_e)
[in]minHostBufferSizeMinimum size of host buffer needed in MBytes. The smallest host buffer found that is larger or equal to minHostBufferSize is used and the size of the host buffer is set to minHostBufferSize. If set to 0, the first host buffer found is used regardsless of the size.
[in]descriptorDescriptor type to use when transmitting.
[in]tsTimestamp format to use when transmitting.
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description
Examples:
net/transmit_on_timestamp_setclock/transmit_on_timestamp_setclock_example.c.

Referenced by main().

int NT_NetTxOpen_v3 ( NtNetStreamTx_t hStream,
const char *  name,
uint64_t  portMask,
uint32_t  NUMA,
uint64_t  minHostBufferSize,
enum NtPacketDescriptorType_e  descriptor,
enum NtTimestampType_e  ts 
)

Opens a TX host buffer and returns a NtNetStreamTx_t handle (extended version)

This function is similar to the NT_NetTxOpen_v2() function. The main difference is that the minimum hostbuffer size is specified in bytes to support a hostbuffer size less than one megabyte.

This function will only work with 4GA adapters.

Parameters
[out]hStreamReference to a NtNetStreamTx_t stream pointer
[in]nameStream friendly name - used in, for example, logging statements
[in]portMaskBitmask for ports this stream will use for transmitting
[in]NUMANUMA node on which the host buffer is be located (NOTE: Special options in NtNetTxOpenNumaOption_e)
[in]minHostBufferSizeMinimum size of host buffer needed in bytes. The smallest host buffer found that is larger or equal to minHostBufferSize is used and the size of the host buffer is set to minHostBufferSize. If set to 0, the first host buffer found is used regardsless of the size.
[in]descriptorDescriptor type to use when transmitting.
[in]tsTimestamp format to use when transmitting.
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description

NOTE: When using NT_NetTxOpen() >= 3: ntservice ini-option System.NtapiNetTxSegmentRawAlignMode can be used to control NT_NetTxGet()/NT_NetTxRelease() behaviour for NT_NETTX_SEGMENT_OPTION_RAW mode. System.NtapiNetTxSegmentRawAlignMode = 1 will retain previous NTAPI default behaviour where RAW segment mode always operates on a whole (aligned) underlying slab (segment) typically (1,2,4 MB - dictated by FPGA) System.NtapiNetTxSegmentRawAlignMode = 0 will enable NT4GA to operate on arbitrary raw segment sizes that will be placed back to back System.NtapiNetTxSegmentRawAlignMode = -1 will apply the decided default value for the current driver release. This default value (applied with -1) can change across driver releases.

void NT_NetTxOpenAttrInit ( NtNetTxAttr_t attr)

Initialize TX stream attributes.

The attributes are initialized to the following default values:
name = NULL
portMask = 0
NUMA = NT_NETTX_NUMA_ADAPTER_HB
minHostBufferSize = 0
descriptor = NT_PACKET_DESCRIPTOR_TYPE_NT
timestampType = NT_TIMESTAMP_TYPE_NATIVE_UNIX

Parameters
[out]attrPointer to the attributes structure
Examples:
net/checksum/checksum_example.cpp, net/timestamp_inject/timestamp_inject_example.cpp, and net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Referenced by main(), and PacketTransmitterThread::transmitPackets().

void NT_NetTxOpenAttrSetName ( NtNetTxAttr_t attr,
const char *  name 
)

Sets the stream name attribute.

Parameters
[in]attrPointer to the attributes structure
[in]nameStream friendly name - used in, for example, logging statements
Examples:
net/checksum/checksum_example.cpp, net/timestamp_inject/timestamp_inject_example.cpp, net/transmit_pcap/transmit_pcap_example.c, and net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Referenced by main(), and PacketTransmitterThread::transmitPackets().

const char* NT_NetTxOpenAttrGetName ( const NtNetTxAttr_t attr)

Returns the name attribute.

Returns
The name attribute
int NT_NetTxOpenAttrSetDescriptorMode ( NtNetTxAttr_t attr,
enum NtNetTxDescriptorMode_e  descriptorMode 
)

Sets the descriptor mode attribute.

Parameters
[in]attrPointer to the attributes structure
[in]portMaskDescriptor mode
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description
Examples:
net/checksum/checksum_example.cpp, net/timestamp_inject/timestamp_inject_example.cpp, and net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Referenced by main(), and PacketTransmitterThread::transmitPackets().

enum NtNetTxDescriptorMode_e NT_NetTxOpenAttrGetDescriptorMode ( const NtNetTxAttr_t attr)

Returns the descriptor mode attribute.

Returns
The descriptor mode attribute
void NT_NetTxOpenAttrSetPortMask ( NtNetTxAttr_t attr,
uint64_t  portMask 
)

Sets the port mask attribute.

Parameters
[in]attrPointer to the attributes structure
[in]portMaskBitmask for ports this stream will use for transmitting
Examples:
net/checksum/checksum_example.cpp, net/timestamp_inject/timestamp_inject_example.cpp, net/transmit_pcap/transmit_pcap_example.c, and net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Referenced by main(), and PacketTransmitterThread::transmitPackets().

uint64_t NT_NetTxOpenAttrGetPortMask ( NtNetTxAttr_t attr)

Returns the port mask attribute.

Returns
The port mask attribute
void NT_NetTxOpenAttrSetNUMA ( NtNetTxAttr_t attr,
uint32_t  NUMA 
)

Sets the numa attribute.

Parameters
[in]attrPointer to the attributes structure
[in]NUMANUMA node on which the host buffer is be located (NOTE: Special options in enum NtNetTxOpenNumaOption_e)
Examples:
net/transmit_pcap/transmit_pcap_example.c.

Referenced by main().

uint32_t NT_NetTxOpenAttrGetNUMA ( NtNetTxAttr_t attr)

Returns the numa attribute.

Returns
The numa attribute
void NT_NetTxOpenAttrSetFlags ( NtNetTxAttr_t attr,
uint32_t  flags 
)

Sets the flags attribute.

Parameters
[in]attrPointer to the attributes structure
[in]flagsFlags - see enum NtNetTxOpenFlags_e

flags shall be either NT_NETTX_OPEN_FLAGS_NONE (0) or the bitwise-inclusive OR of one or more of the other flags in enum NtNetTxOpenFlags_e

uint32_t NT_NetTxOpenAttrGetFlags ( NtNetTxAttr_t attr)

Returns the flags attribute.

Returns
The flags attribute - see enum NtNetTxOpenFlags_e
void NT_NetTxOpenAttrSetMinHostbufferSize ( NtNetTxAttr_t attr,
uint64_t  minHostBufferSize 
)

Sets the minimum host buffer size attribute.

Parameters
[in]attrPointer to the attributes structure
[in]minHostBufferSizeMinimum size of host buffer needed in bytes. The smallest host buffer found that is larger or equal to minHostBufferSize is used and the size of the host buffer is set to minHostBufferSize. If set to 0, the first host buffer found is used regardsless of the size.
Examples:
net/timestamp_inject/timestamp_inject_example.cpp.

Referenced by PacketTransmitterThread::transmitPackets().

uint64_t NT_NetTxOpenAttrGetMinHostbufferSize ( NtNetTxAttr_t attr)

Returns the minimum host buffer size attribute.

Returns
The minimum host buffer size attribute
void NT_NetTxOpenAttrSetDescriptor ( NtNetTxAttr_t attr,
enum NtPacketDescriptorType_e  descriptor 
)

Sets the descriptor type attribute.

Parameters
[in]attrPointer to the attributes structure
[in]descriptorDescriptor type to use when transmitting.
Examples:
net/transmit_pcap/transmit_pcap_example.c.

Referenced by main().

enum NtPacketDescriptorType_e NT_NetTxOpenAttrGetDescriptor ( NtNetTxAttr_t attr)

Returns the descriptor type attribute.

Returns
The descriptor type attribute
int NT_NetTxOpenAttrSetTxtDescriptorPosTimestampInject ( NtNetTxAttr_t attr,
bool  enable,
uint32_t  pos 
)

Sets bit position in packet descriptor for the Timestamp Inject command bit.

Parameters
[in]attrPointer to the attributes structure
[in]enableEnable/disable use of bits in packet descriptor.
[in]posPosition of bit. Maximum value is 191.
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description
Examples:
net/timestamp_inject/timestamp_inject_example.cpp.

Referenced by PacketTransmitterThread::transmitPackets().

void NT_NetTxOpenAttrGetTxtDescriptorPosTimestampInject ( NtNetTxAttr_t attr,
bool *  enable,
uint32_t *  pos 
)

Gets bit position in packet descriptor for the Timestamp Inject command bit.

Parameters
[in]attrPointer to the attributes structure
[in]enableOutput pointer to enable/disable use of bit in packet descriptor.
[in]posOutput pointer to position of bits. Value will not be set if disabled.
int NT_NetTxOpenAttrSetTxtDescriptorPosFcs ( NtNetTxAttr_t attr,
bool  enable,
uint32_t  pos 
)

Sets bit position in packet descriptor for the FCS control command bit.

Parameters
[in]attrPointer to the attributes structure
[in]enableEnable/disable use of bits in packet descriptor. When disabled all FCS is recalculated for packets. When enabled FCS recalculation is controlled by the packet descriptor bit in position pos.
[in]posPosition of bit. Maximum value is 191.
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description
Examples:
net/timestamp_inject/timestamp_inject_example.cpp.

Referenced by PacketTransmitterThread::transmitPackets().

void NT_NetTxOpenAttrGetTxtDescriptorPosFcs ( NtNetTxAttr_t attr,
bool *  enable,
uint32_t *  pos 
)

Gets bit position in packet descriptor for the FCS control command bit.

Parameters
[in]attrPointer to the attributes structure
[in]enableOutput pointer to enable/disable use of bit in packet descriptor.
[in]posOutput pointer to position of bits. Value will not be set if disabled.
void NT_NetTxOpenAttrSetTimestampType ( NtNetTxAttr_t attr,
enum NtTimestampType_e  timestampType 
)

Sets the timestamp type attribute.

Parameters
[in]attrPointer to the attributes structure
[in]timestampTypeTimestamp format to use when transmitting.
Examples:
net/transmit_pcap/transmit_pcap_example.c.

Referenced by main().

enum NtTimestampType_e NT_NetTxOpenAttrGetTimestampType ( NtNetTxAttr_t attr)

Returns the timestamp type attribute.

Returns
The timestamp type attribute
int NT_NetTxOpenAttrSetDescriptorPosLayer3Offset ( NtNetTxAttr_t attr,
bool  enable,
uint32_t  pos 
)

Set bit position in packet descriptor for layer 3 offset bits.

Parameters
[in]attrPointer to the attributes structure.
[in]enableEnable/disable use of bits in packet descriptor.
[in]posPosition of bits. Maximum value is 191.
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description
void NT_NetTxOpenAttrGetDescriptorPosLayer3Offset ( const NtNetTxAttr_t attr,
bool *  enable,
uint32_t *  pos 
)

Get bit position in packet descriptor for layer 3 offset bits.

Parameters
[in]attrPointer to the attributes structure.
[in]enableOutput pointer to enable/disable use of bits in packet descriptor.
[in]posOutput pointer to position of bits. Value will not be set if disabled.
int NT_NetTxOpenAttrSetDescriptorPosLayer4Offset ( NtNetTxAttr_t attr,
bool  enable,
uint32_t  pos 
)

Set bit position in packet descriptor for layer 4 offset bits.

Parameters
[in]attrPointer to the attributes structure.
[in]enableEnable/disable use of bits in packet descriptor.
[in]posPosition of bits. Maximum value is 191.
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description
void NT_NetTxOpenAttrGetDescriptorPosLayer4Offset ( const NtNetTxAttr_t attr,
bool *  enable,
uint32_t *  pos 
)

Get bit position in packet descriptor for layer 4 offset bits.

Parameters
[in]attrPointer to the attributes structure.
[in]enableOutput pointer to enable/disable use of bits in packet descriptor.
[in]posOutput pointer to position of bits. Value will not be set if disabled.
int NT_NetTxOpenAttrSetDescriptorPosFrameType ( NtNetTxAttr_t attr,
bool  enable,
uint32_t  pos 
)

Set bit position in packet descriptor for frame type bits.

Parameters
[in]attrPointer to the attributes structure.
[in]enableEnable/disable use of bits in packet descriptor.
[in]posPosition of bits. Maximum value is 191.
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description
Examples:
net/checksum/checksum_example.cpp, and net/timestamp_inject/timestamp_inject_example.cpp.

Referenced by main(), and PacketTransmitterThread::transmitPackets().

void NT_NetTxOpenAttrGetDescriptorPosFrameType ( const NtNetTxAttr_t attr,
bool *  enable,
uint32_t *  pos 
)

Get bit position in packet descriptor for frame type bits.

Parameters
[in]attrPointer to the attributes structure.
[in]enableOutput pointer to enable/disable use of bits in packet descriptor.
[in]posOutput pointer to position of bits. Value will not be set if disabled.
int NT_NetTxOpenAttrSetDescriptorPosChecksumCmd ( NtNetTxAttr_t attr,
bool  enable,
uint32_t  pos 
)

Set bit position in packet descriptor for checksum command bits.

Parameters
[in]attrPointer to the attributes structure.
[in]enableEnable/disable use of bits in packet descriptor.
[in]posPosition of bits. Maximum value is 191.
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description
Examples:
net/checksum/checksum_example.cpp, and net/timestamp_inject/timestamp_inject_example.cpp.

Referenced by main(), and PacketTransmitterThread::transmitPackets().

void NT_NetTxOpenAttrGetDescriptorPosChecksumCmd ( const NtNetTxAttr_t attr,
bool *  enable,
uint32_t *  pos 
)

Get bit position in packet descriptor for checksum command bits.

Parameters
[in]attrPointer to the attributes structure.
[in]enableOutput pointer to enable/disable use of bits in packet descriptor.
[in]posOutput pointer to position of bits. Value will not be set if disabled.
int NT_NetTxOpenAttrSetDescriptorPosIgnoreBit ( NtNetTxAttr_t attr,
bool  enable,
uint32_t  pos 
)

Set bit position in packet descriptor for TX ignore bit.

See Standard Descriptor for "TX ignore bit" description.

Parameters
[in]attrPointer to the attributes structure.
[in]enableEnable/disable use of bit in packet descriptor.
[in]posPosition of bits. Maximum value is 191.
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description
Examples:
net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Referenced by main().

void NT_NetTxOpenAttrGetDescriptorPosIgnoreBit ( const NtNetTxAttr_t attr,
bool *  enable,
uint32_t *  pos 
)

Get bit position in packet descriptor for TX ignore bit.

Parameters
[in]attrPointer to the attributes structure.
[in]enableOutput pointer to enable/disable use of bits in packet descriptor.
[in]posOutput pointer to position of bits. Value will not be set if disabled.
int NT_NetTxOpenAttrSetDescriptorPosTxNowBit ( NtNetTxAttr_t attr,
bool  enable,
uint32_t  pos 
)

Set bit position in packet descriptor for TX now bit.

See Standard Descriptor for "TX now bit" description.

Parameters
[in]attrPointer to the attributes structure.
[in]enableEnable/disable use of bit in packet descriptor.
[in]posPosition of bits. Maximum value is 191.
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description
void NT_NetTxOpenAttrGetDescriptorPosTxNowBit ( const NtNetTxAttr_t attr,
bool *  enable,
uint32_t *  pos 
)

Get bit position in packet descriptor for TX now bit.

Parameters
[in]attrPointer to the attributes structure.
[in]enableOutput pointer to enable/disable use of bits in packet descriptor.
[in]posOutput pointer to position of bits. Value will not be set if disabled.
int NT_NetTxOpenAttrSetDescriptorPosClockBit ( NtNetTxAttr_t attr,
bool  enable,
uint32_t  pos 
)

Set bit position in packet descriptor for TX set clock bit.

See Standard Descriptor for "TX set clock bit" description.

Parameters
[in]attrPointer to the attributes structure.
[in]enableEnable/disable use of bit in packet descriptor.
[in]posPosition of bits. Maximum value is 191.
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description
void NT_NetTxOpenAttrGetDescriptorPosClockBit ( const NtNetTxAttr_t attr,
bool *  enable,
uint32_t *  pos 
)

Get bit position in packet descriptor for TX set clock bit.

Parameters
[in]attrPointer to the attributes structure.
[in]enableOutput pointer to enable/disable use of bits in packet descriptor.
[in]posOutput pointer to position of bits. Value will not be set if disabled.
int NT_NetTxOpenAttrSetDescriptorUseWireLength ( NtNetTxAttr_t attr,
bool  enable 
)

Set mode for use of wire length in packet descriptor.

Parameters
[in]attrPointer to the attributes structure.
[in]enableflag to enable/disable use wire length in packet descriptor.
Examples:
net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Referenced by main().

int NT_NetTxOpenAttrGetDescriptorUseWireLength ( const NtNetTxAttr_t attr,
bool *  enable 
)

get mode for use of wire length in packet descriptor

Parameters
[in]attrPointer to the attributes structure.
[in]enableOutput pointer flag indicating use of wire length in packet descriptor.
int NT_NetTxOpen_Attr ( NtNetStreamTx_t hStream,
const NtNetTxAttr_t attr 
)

Opens a TX host buffer and returns a NtNetStreamTx_t handle (extended version)

This function is called to retrieve a TX stream handle. This function will only work with 4GA adapters.

Parameters
[out]hStreamReference to a NtNetStreamTx_t stream pointer
[in]attrPointer to stream attributes
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description
Examples:
net/checksum/checksum_example.cpp, net/timestamp_inject/timestamp_inject_example.cpp, net/transmit_pcap/transmit_pcap_example.c, and net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Referenced by main(), and PacketTransmitterThread::transmitPackets().

int NT_NetTxGet ( NtNetStreamTx_t  hStream,
NtNetBuf_t netBuf,
uint32_t  port,
size_t  packetSize,
enum NtNetTxPacketOption_e  packetOption,
int  timeout 
)

Gets a TX port buffer.

This function is called to acquire a TX buffer

Note
This function has no mutex protection, therefore the same hStream cannot be used by multiple threads
Parameters
[in]hStreamNetwork TX stream handle
[out]netBufSegment/packet container reference
[in]portPort to receive a TX buffer from
[in]packetSizeSize of the packet to transmit including 4-byte CRC.
[in]packetOptionOption to control the properties of the buffer, see NtNetTxPacketOption_e for details
[in]timeoutTime in milliseconds to wait for a new buffer - a timeout of -1 will wait indefinitely for a new buffer
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description
Examples:
net/checksum/checksum_example.cpp, net/replay/replay_example.c, net/replay4GA/replay4ga_example.c, net/replayGS/replayGS_example.c, net/timestamp_inject/timestamp_inject_example.cpp, net/transmit_multifunction/transmit_multifunction_example.c, net/transmit_on_timestamp/transmit_on_timestamp_example.c, net/transmit_on_timestamp_setclock/transmit_on_timestamp_setclock_example.c, net/transmit_packet/transmit_packet_example.c, net/transmit_pcap/transmit_pcap_example.c, net/transmit_segment/transmit_segment_example.c, and net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Referenced by main(), taskTransmitter(), and PacketTransmitterThread::txPacket().

int NT_NetTxRelease ( NtNetStreamTx_t  hStream,
NtNetBuf_t  netBuf 
)

Releases the network buffer.

This function releases the netBuf data obtained via NT_TxGet

Note
This function has no mutex protection and can therefore the same hStream cannot be used by multiple threads
Parameters
[in]hStreamNetwork TX stream handle
[in]netBufNet buffer is received via NT_TxGet
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description
Examples:
net/checksum/checksum_example.cpp, net/replay/replay_example.c, net/replay4GA/replay4ga_example.c, net/replayGS/replayGS_example.c, net/timestamp_inject/timestamp_inject_example.cpp, net/transmit_multifunction/transmit_multifunction_example.c, net/transmit_on_timestamp/transmit_on_timestamp_example.c, net/transmit_on_timestamp_setclock/transmit_on_timestamp_setclock_example.c, net/transmit_packet/transmit_packet_example.c, net/transmit_pcap/transmit_pcap_example.c, net/transmit_segment/transmit_segment_example.c, and net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Referenced by main(), taskTransmitter(), and PacketTransmitterThread::txPacket().

int NT_NetTxRead ( NtNetStreamTx_t  hStream,
NtNetTx_t cmd 
)

Reads data from the stream.

This function will read Tx related info

Parameters
[in]hStreamNetTx stream handle
[in]cmdNetTx read structure
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description
Examples:
net/transmit_multifunction/transmit_multifunction_example.c, net/transmit_packet/transmit_packet_example.c, and net/transmit_segment/transmit_segment_example.c.

Referenced by _NetTxDataCheckHbInfo(), and main().

int NT_NetTxAddPacket ( NtNetStreamTx_t  hStream,
uint32_t  port,
NtNetTxFragment_t fragments,
uint32_t  fragmentCount,
int  timeout 
)

AddPacket to a TX stream.

This function is called to put together scattered fragments of a packet and add it to a TX stream

Note
This function has no mutex protection and cannot be used by multiple threads on the same stream, hStream.
Parameters
[in]hStreamNetwork TX stream handle
[in]portPort to add packet into host buffer
[in]fragmentsThe scattered list of packet fragments
[in]fragmentCountThe number of scattered fragments in the list
[in]timeoutTime in milliseconds to wait for a packet buffer - a timeout of -1 will wait indefinitely for a packet buffer
Return values
NT_SUCCESSSuccess
!=NT_SUCCESSError - use NT_ExplainError for an error description

Referenced by main().