Network Streams

Software Architecture

Napatech SmartNIC
Overview Document

In this section

This section lists the NTAPI network stream functions. They are defined in the stream_net.h file.

Receive functions

These are the functions for receive:

  • NT_NetRxOpen(NtNetStreamRx_t *hStream, const char *name, enum NtNetInterface_e netIntf, uint32_t streamId, int hostBufferAllowance)
  • NT_NetRxOpenMulti(NtNetStreamRx_t *hStream, const char *name, enum NtNetInterface_e netIntf, uint32_t *paStreamId, unsigned int numStreamIds, int hostBufferAllowance)
  • NT_NetRxClose(NtNetStreamRx_t hStream)
  • NT_NetRxGet(NtNetStreamRx_t hStream, NtNetBuf_t *netBuf, int timeout)
  • NT_NetRxGetNextPacket(NtNetStreamRx_t hStream, NtNetBuf_t *netBuf, int timeout)
  • NT_NetRxRelease(NtNetStreamRx_t hStream, NtNetBuf_t netBuf)
  • NT_NetRxRead(NtNetStreamRx_t hStream, NtNetRxRead_t *cmd)

Transmit functions

These are the functions for transmit:

  • NT_NetTxOpen(NtNetStreamTx_t *hStream, const char *name, uint64_t portMask, uint32_t NUMA, uint32_t minHostBufferSize)
  • NT_NetTxClose(NtNetStreamTx_t hStream)
  • NT_NetTxGet(NtNetStreamTx_t hStream, NtNetBuf_t *netBuf, uint32_t port, size_t packetSize, enum NtNetTxPacketOption_e packetOption, int timeout)
  • NT_NetTxRelease(NtNetStreamTx_t hStream, NtNetBuf_t netBuf)
  • NT_NetTxRead(NtNetStreamTx_t hStream, NtNetTx_t *cmd)
  • NT_NetTxAddPacket(NtNetStreamTx_t hStream, uint32_t port, NtNetTxFragment_t *fragments, uint32_t fragmentCount, int timeout)
Note: It is recommended that the NT_NetTxAddPacket function (see DN-0449) is not used. The NT_NetTxAddPacket function is present for legacy compatibility but it reduces the TX throughput. Instead dynamic packet descriptor 3 (see DN-1108) should be used for adding, for instance, VLAN tags or MPLS labels to the transmitted packets.

File functions

These are the file functions:

  • NT_NetFileOpen(NtNetStreamFile_t *hStream, const char *name, enum NtNetInterface_e netIntf, const char *file)
  • NT_NetFileClose(NtNetStreamFile_t hStream)
  • NT_NetFileGet(NtNetStreamFile_t hStream, NtNetBuf_t *netBuf)
  • NT_NetFileRelease(NtNetStreamFile_t hStream, NtNetBuf_t netBuf)
  • NT_NetFileRead(NtNetStreamFile_t hStream, NtNetFileRead_t *data)