transmit_multifunction_example.c

Reference Documentation

product_line_custom
IntelĀ® PAC
Napatech SmartNIC
category
Reference Information
Napatech Software Suite: examples/net/transmit_multifunction/transmit_multifunction_example.c File Reference
transmit_multifunction_example.c File Reference
#include <nt.h>
#include <string.h>
#include <assert.h>
#include <argparse.h>

Go to the source code of this file.

Functions

static void StopApplication (int sig)
 
static int _Is4GATxSupported (NtInfoStream_t hInfo, uint8_t adapterNo)
 
static int _TxPortRateLimit (int port, uint64_t new, uint64_t *pOld)
 
static int _NetTxDataCheckHbInfo (NtNetStreamTx_t *phNetTx, bool bWaitDone)
 
int main (int argc, const char *argv[])
 

Macros

#define MIN_PACKET_SIZE   64
 
#define MAX_PACKET_SIZE   8192
 
#define SEGMENT_LENGTH   (1024*1024)
 
#define RANDOM(_min_, _max_)   ((uint32_t)_min_ + (uint32_t)((_max_-_min_+1) * (rand() /(RAND_MAX + 1.0))))
 
#define NUM_MB   10 /* Number of segments to pre-fill/reuse */
 

Variables

volatile int appRunning =1
 
static const char * usageText []
 
static int opt_port = -1
 
static char * opt_rate = NULL
 
static char * opt_size = NULL
 
struct argparse_option arg_options []
 
static int is4GATxSupported = 0
 

Function Documentation

static void StopApplication ( int  sig)
static

The function called when user is pressing CTRL-C

Definition at line 237 of file transmit_multifunction_example.c.

Referenced by main().

static int _Is4GATxSupported ( NtInfoStream_t  hInfo,
uint8_t  adapterNo 
)
static
Examples:
net/transmit_multifunction/transmit_multifunction_example.c.

Definition at line 252 of file transmit_multifunction_example.c.

Referenced by main().

static int _TxPortRateLimit ( int  port,
uint64_t  new,
uint64_t *  pOld 
)
static
Examples:
net/transmit_multifunction/transmit_multifunction_example.c.

Definition at line 278 of file transmit_multifunction_example.c.

Referenced by main().

static int _NetTxDataCheckHbInfo ( NtNetStreamTx_t phNetTx,
bool  bWaitDone 
)
static
Examples:
net/transmit_multifunction/transmit_multifunction_example.c.

Definition at line 329 of file transmit_multifunction_example.c.

Referenced by main().

int main ( int  argc,
const char *  argv[] 
)

Definition at line 366 of file transmit_multifunction_example.c.

Macro Definition Documentation

#define MIN_PACKET_SIZE   64
Examples:
net/transmit_multifunction/transmit_multifunction_example.c.

Definition at line 190 of file transmit_multifunction_example.c.

Referenced by main().

#define MAX_PACKET_SIZE   8192
Examples:
net/transmit_multifunction/transmit_multifunction_example.c.

Definition at line 191 of file transmit_multifunction_example.c.

Referenced by main().

#define SEGMENT_LENGTH   (1024*1024)
Examples:
net/transmit_multifunction/transmit_multifunction_example.c.

Definition at line 192 of file transmit_multifunction_example.c.

Referenced by main().

#define RANDOM (   _min_,
  _max_ 
)    ((uint32_t)_min_ + (uint32_t)((_max_-_min_+1) * (rand() /(RAND_MAX + 1.0))))
Examples:
net/transmit_multifunction/transmit_multifunction_example.c.

Definition at line 195 of file transmit_multifunction_example.c.

Referenced by main().

#define NUM_MB   10 /* Number of segments to pre-fill/reuse */

Variable Documentation

volatile int appRunning =1

Definition at line 197 of file transmit_multifunction_example.c.

Referenced by _NetTxDataCheckHbInfo(), main(), and StopApplication().

const char* usageText[]
static
Initial value:
= {
"Syntax:\n"
"transmit_multifunction [-h][-p <port no.>][-r <tx rate>][-s <size>|r|i|d]\n"
"\nCommands:\n",

Print command line info

Definition at line 202 of file transmit_multifunction_example.c.

Referenced by main().

int opt_port = -1
static

Definition at line 208 of file transmit_multifunction_example.c.

Referenced by main().

char* opt_rate = NULL
static
Examples:
net/transmit_multifunction/transmit_multifunction_example.c.

Definition at line 209 of file transmit_multifunction_example.c.

Referenced by main().

char* opt_size = NULL
static
Examples:
net/transmit_multifunction/transmit_multifunction_example.c.

Definition at line 210 of file transmit_multifunction_example.c.

Referenced by main().

struct argparse_option arg_options[]
Initial value:
= {
OPT_INTEGER('p', "port", &opt_port, "Output port", NULL, 0, 0, "port number"),
OPT_STRING( 'r', "rate", &opt_rate, "Transmit rate\n"
"0 = line rate\n"
"<rate> = <rate> Mbps\n"
"<rate>K = <rate> Kbps\n"
"<rate>M = <rate> Mbps\n"
"<rate>G = <rate> Gbps", NULL, 0, 0, "value"),
OPT_STRING( 's', "size", &opt_size, "Packet size - <value> = packet size (Size is aligned to 4 byte boundary\n"
"r = random size\n"
"i = increasing size from 64 bytes to 8192 bytes.\n"
"d = decreasing size from 8192 bytes to 64 bytes.", NULL, 0, 0, "value"),
}

Table of valid options.

Definition at line 215 of file transmit_multifunction_example.c.

int is4GATxSupported = 0
static
Examples:
net/transmit_multifunction/transmit_multifunction_example.c.

Definition at line 251 of file transmit_multifunction_example.c.