FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
vcl_test.h File Reference
+ Include dependency graph for vcl_test.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  vcl_test_cfg_t
 
struct  vcl_test_stats_t
 
struct  vcl_test_session
 
struct  vcl_test_proto_vft_t
 
struct  vcl_test_wrk_t
 
struct  vcl_test_main_t
 

Macros

#define vtfail(_fn, _rv)
 
#define vterr(_fn, _rv)
 
#define vtwrn(_fmt, _args...)   fprintf (stderr, "\nERROR: " _fmt "\n", ##_args) \
 
#define vtinf(_fmt, _args...)   fprintf (stdout, "vt<w%u>: " _fmt "\n", __wrk_index, ##_args)
 
#define vt_atomic_add(_ptr, _val)   __atomic_fetch_add (_ptr, _val, __ATOMIC_RELEASE)
 
#define VCL_TEST_TOKEN_HELP   "#H"
 
#define VCL_TEST_TOKEN_EXIT   "#X"
 
#define VCL_TEST_TOKEN_VERBOSE   "#V"
 
#define VCL_TEST_TOKEN_TXBUF_SIZE   "#T:"
 
#define VCL_TEST_TOKEN_NUM_TEST_SESS   "#I:"
 
#define VCL_TEST_TOKEN_NUM_WRITES   "#N:"
 
#define VCL_TEST_TOKEN_RXBUF_SIZE   "#R:"
 
#define VCL_TEST_TOKEN_SHOW_CFG   "#C"
 
#define VCL_TEST_TOKEN_RUN_UNI   "#U"
 
#define VCL_TEST_TOKEN_RUN_BI   "#B"
 
#define VCL_TEST_SERVER_PORT   22000
 
#define VCL_TEST_LOCALHOST_IPADDR   "127.0.0.1"
 
#define VCL_TEST_CFG_CTRL_MAGIC   0xfeedface
 
#define VCL_TEST_CFG_NUM_WRITES_DEF   1000000
 
#define VCL_TEST_CFG_TXBUF_SIZE_DEF   8192
 
#define VCL_TEST_CFG_RXBUF_SIZE_DEF   (64*VCL_TEST_CFG_TXBUF_SIZE_DEF)
 
#define VCL_TEST_CFG_BUF_SIZE_MIN   128
 
#define VCL_TEST_CFG_MAX_TEST_SESS   512
 
#define VCL_TEST_CFG_MAX_EPOLL_EVENTS   16
 
#define VCL_TEST_CTRL_LISTENER   (~0 - 1)
 
#define VCL_TEST_DATA_LISTENER   (~0)
 
#define VCL_TEST_DELAY_DISCONNECT   1
 
#define VCL_TEST_SEPARATOR_STRING   " -----------------------------\n"
 
#define VCL_TEST_REGISTER_PROTO(proto, vft)
 
#define INDENT   "\n "
 

Typedefs

typedef struct vcl_test_session vcl_test_session_t
 

Enumerations

enum  vcl_test_t {
  VCL_TEST_TYPE_NONE, VCL_TEST_TYPE_ECHO, VCL_TEST_TYPE_UNI, VCL_TEST_TYPE_BI,
  VCL_TEST_TYPE_EXIT
}
 
enum  vcl_test_cmd_t { VCL_TEST_CMD_SYNC, VCL_TEST_CMD_START, VCL_TEST_CMD_STOP }
 

Functions

static int vcl_test_worker_index (void)
 
static void vcl_test_stats_accumulate (vcl_test_stats_t *accum, vcl_test_stats_t *incr)
 
static void vcl_test_cfg_init (vcl_test_cfg_t *cfg)
 
static int vcl_test_cfg_verify (vcl_test_cfg_t *cfg, vcl_test_cfg_t *valid_cfg)
 
static void vcl_test_buf_alloc (vcl_test_cfg_t *cfg, uint8_t is_rxbuf, uint8_t **buf, uint32_t *bufsize)
 
static void vcl_test_session_buf_alloc (vcl_test_session_t *ts)
 
static void vcl_test_session_buf_free (vcl_test_session_t *ts)
 
static char * vcl_test_type_str (vcl_test_t t)
 
static void vcl_test_cfg_dump (vcl_test_cfg_t *cfg, uint8_t is_client)
 
static void vcl_test_stats_dump (char *header, vcl_test_stats_t *stats, uint8_t show_rx, uint8_t show_tx, uint8_t verbose)
 
static double vcl_test_time_diff (struct timespec *old, struct timespec *new)
 
static void vcl_test_stats_dump_inc (vcl_test_session_t *ts, int is_rx)
 
static int vcl_comp_tspec (struct timespec *a, struct timespec *b)
 
static int vcl_test_read (vcl_test_session_t *ts, void *buf, uint32_t nbytes)
 
static int vcl_test_read_ds (vcl_test_session_t *ts)
 
static int vcl_test_write (vcl_test_session_t *ts, void *buf, uint32_t nbytes)
 
static void dump_help (void)
 

Variables

vcl_test_main_t vcl_test_main
 

Macro Definition Documentation

◆ INDENT

#define INDENT   "\n "

◆ VCL_TEST_CFG_BUF_SIZE_MIN

#define VCL_TEST_CFG_BUF_SIZE_MIN   128

Definition at line 67 of file vcl_test.h.

◆ VCL_TEST_CFG_CTRL_MAGIC

#define VCL_TEST_CFG_CTRL_MAGIC   0xfeedface

Definition at line 63 of file vcl_test.h.

◆ VCL_TEST_CFG_MAX_EPOLL_EVENTS

#define VCL_TEST_CFG_MAX_EPOLL_EVENTS   16

Definition at line 69 of file vcl_test.h.

◆ VCL_TEST_CFG_MAX_TEST_SESS

#define VCL_TEST_CFG_MAX_TEST_SESS   512

Definition at line 68 of file vcl_test.h.

◆ VCL_TEST_CFG_NUM_WRITES_DEF

#define VCL_TEST_CFG_NUM_WRITES_DEF   1000000

Definition at line 64 of file vcl_test.h.

◆ VCL_TEST_CFG_RXBUF_SIZE_DEF

#define VCL_TEST_CFG_RXBUF_SIZE_DEF   (64*VCL_TEST_CFG_TXBUF_SIZE_DEF)

Definition at line 66 of file vcl_test.h.

◆ VCL_TEST_CFG_TXBUF_SIZE_DEF

#define VCL_TEST_CFG_TXBUF_SIZE_DEF   8192

Definition at line 65 of file vcl_test.h.

◆ VCL_TEST_CTRL_LISTENER

#define VCL_TEST_CTRL_LISTENER   (~0 - 1)

Definition at line 71 of file vcl_test.h.

◆ VCL_TEST_DATA_LISTENER

#define VCL_TEST_DATA_LISTENER   (~0)

Definition at line 72 of file vcl_test.h.

◆ VCL_TEST_DELAY_DISCONNECT

#define VCL_TEST_DELAY_DISCONNECT   1

Definition at line 73 of file vcl_test.h.

◆ VCL_TEST_LOCALHOST_IPADDR

#define VCL_TEST_LOCALHOST_IPADDR   "127.0.0.1"

Definition at line 61 of file vcl_test.h.

◆ VCL_TEST_REGISTER_PROTO

#define VCL_TEST_REGISTER_PROTO (   proto,
  vft 
)
Value:
static void __attribute__ ((constructor)) vcl_test_init_##proto (void) \
{ \
vcl_test_main.protos[proto] = &vft; \
}

Definition at line 181 of file vcl_test.h.

◆ VCL_TEST_SEPARATOR_STRING

#define VCL_TEST_SEPARATOR_STRING   " -----------------------------\n"

Definition at line 74 of file vcl_test.h.

◆ VCL_TEST_SERVER_PORT

#define VCL_TEST_SERVER_PORT   22000

Definition at line 60 of file vcl_test.h.

◆ VCL_TEST_TOKEN_EXIT

#define VCL_TEST_TOKEN_EXIT   "#X"

Definition at line 50 of file vcl_test.h.

◆ VCL_TEST_TOKEN_HELP

#define VCL_TEST_TOKEN_HELP   "#H"

Definition at line 49 of file vcl_test.h.

◆ VCL_TEST_TOKEN_NUM_TEST_SESS

#define VCL_TEST_TOKEN_NUM_TEST_SESS   "#I:"

Definition at line 53 of file vcl_test.h.

◆ VCL_TEST_TOKEN_NUM_WRITES

#define VCL_TEST_TOKEN_NUM_WRITES   "#N:"

Definition at line 54 of file vcl_test.h.

◆ VCL_TEST_TOKEN_RUN_BI

#define VCL_TEST_TOKEN_RUN_BI   "#B"

Definition at line 58 of file vcl_test.h.

◆ VCL_TEST_TOKEN_RUN_UNI

#define VCL_TEST_TOKEN_RUN_UNI   "#U"

Definition at line 57 of file vcl_test.h.

◆ VCL_TEST_TOKEN_RXBUF_SIZE

#define VCL_TEST_TOKEN_RXBUF_SIZE   "#R:"

Definition at line 55 of file vcl_test.h.

◆ VCL_TEST_TOKEN_SHOW_CFG

#define VCL_TEST_TOKEN_SHOW_CFG   "#C"

Definition at line 56 of file vcl_test.h.

◆ VCL_TEST_TOKEN_TXBUF_SIZE

#define VCL_TEST_TOKEN_TXBUF_SIZE   "#T:"

Definition at line 52 of file vcl_test.h.

◆ VCL_TEST_TOKEN_VERBOSE

#define VCL_TEST_TOKEN_VERBOSE   "#V"

Definition at line 51 of file vcl_test.h.

◆ vt_atomic_add

#define vt_atomic_add (   _ptr,
  _val 
)    __atomic_fetch_add (_ptr, _val, __ATOMIC_RELEASE)

Definition at line 46 of file vcl_test.h.

◆ vterr

#define vterr (   _fn,
  _rv 
)
Value:
{ \
errno = -_rv; \
fprintf (stderr, "\nERROR: " _fn " failed (errno = %d)!\n", -_rv); \
}

Definition at line 34 of file vcl_test.h.

◆ vtfail

#define vtfail (   _fn,
  _rv 
)
Value:
{ \
errno = -_rv; \
perror ("ERROR when calling " _fn); \
fprintf (stderr, "\nERROR: " _fn " failed (errno = %d)!\n", -_rv); \
exit (1); \
}

Definition at line 26 of file vcl_test.h.

◆ vtinf

#define vtinf (   _fmt,
  _args... 
)    fprintf (stdout, "vt<w%u>: " _fmt "\n", __wrk_index, ##_args)

Definition at line 43 of file vcl_test.h.

◆ vtwrn

#define vtwrn (   _fmt,
  _args... 
)    fprintf (stderr, "\nERROR: " _fmt "\n", ##_args) \

Definition at line 40 of file vcl_test.h.

Typedef Documentation

◆ vcl_test_session_t

Enumeration Type Documentation

◆ vcl_test_cmd_t

Enumerator
VCL_TEST_CMD_SYNC 
VCL_TEST_CMD_START 
VCL_TEST_CMD_STOP 

Definition at line 85 of file vcl_test.h.

◆ vcl_test_t

enum vcl_test_t
Enumerator
VCL_TEST_TYPE_NONE 
VCL_TEST_TYPE_ECHO 
VCL_TEST_TYPE_UNI 
VCL_TEST_TYPE_BI 
VCL_TEST_TYPE_EXIT 

Definition at line 76 of file vcl_test.h.

Function Documentation

◆ dump_help()

static void dump_help ( void  )
inlinestatic

Definition at line 566 of file vcl_test.h.

+ Here is the caller graph for this function:

◆ vcl_comp_tspec()

static int vcl_comp_tspec ( struct timespec *  a,
struct timespec *  b 
)
inlinestatic

Definition at line 447 of file vcl_test.h.

+ Here is the caller graph for this function:

◆ vcl_test_buf_alloc()

static void vcl_test_buf_alloc ( vcl_test_cfg_t cfg,
uint8_t  is_rxbuf,
uint8_t **  buf,
uint32_t *  bufsize 
)
inlinestatic

Definition at line 230 of file vcl_test.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vcl_test_cfg_dump()

static void vcl_test_cfg_dump ( vcl_test_cfg_t cfg,
uint8_t  is_client 
)
inlinestatic

Definition at line 298 of file vcl_test.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vcl_test_cfg_init()

static void vcl_test_cfg_init ( vcl_test_cfg_t cfg)
inlinestatic

Definition at line 201 of file vcl_test.h.

+ Here is the caller graph for this function:

◆ vcl_test_cfg_verify()

static int vcl_test_cfg_verify ( vcl_test_cfg_t cfg,
vcl_test_cfg_t valid_cfg 
)
inlinestatic

Definition at line 216 of file vcl_test.h.

+ Here is the caller graph for this function:

◆ vcl_test_read()

static int vcl_test_read ( vcl_test_session_t ts,
void *  buf,
uint32_t  nbytes 
)
inlinestatic

Definition at line 462 of file vcl_test.h.

+ Here is the caller graph for this function:

◆ vcl_test_read_ds()

static int vcl_test_read_ds ( vcl_test_session_t ts)
inlinestatic

Definition at line 496 of file vcl_test.h.

+ Here is the caller graph for this function:

◆ vcl_test_session_buf_alloc()

static void vcl_test_session_buf_alloc ( vcl_test_session_t ts)
inlinestatic

Definition at line 253 of file vcl_test.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vcl_test_session_buf_free()

static void vcl_test_session_buf_free ( vcl_test_session_t ts)
inlinestatic

Definition at line 264 of file vcl_test.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vcl_test_stats_accumulate()

static void vcl_test_stats_accumulate ( vcl_test_stats_t accum,
vcl_test_stats_t incr 
)
inlinestatic

Definition at line 188 of file vcl_test.h.

+ Here is the caller graph for this function:

◆ vcl_test_stats_dump()

static void vcl_test_stats_dump ( char *  header,
vcl_test_stats_t stats,
uint8_t  show_rx,
uint8_t  show_tx,
uint8_t  verbose 
)
inlinestatic

Definition at line 336 of file vcl_test.h.

+ Here is the caller graph for this function:

◆ vcl_test_stats_dump_inc()

static void vcl_test_stats_dump_inc ( vcl_test_session_t ts,
int  is_rx 
)
inlinestatic

Definition at line 419 of file vcl_test.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vcl_test_time_diff()

static double vcl_test_time_diff ( struct timespec *  old,
struct timespec *  new 
)
inlinestatic

Definition at line 402 of file vcl_test.h.

+ Here is the caller graph for this function:

◆ vcl_test_type_str()

static char* vcl_test_type_str ( vcl_test_t  t)
inlinestatic

Definition at line 273 of file vcl_test.h.

+ Here is the caller graph for this function:

◆ vcl_test_worker_index()

static int vcl_test_worker_index ( void  )
inlinestatic

Definition at line 150 of file vcl_test.h.

+ Here is the caller graph for this function:

◆ vcl_test_write()

static int vcl_test_write ( vcl_test_session_t ts,
void *  buf,
uint32_t  nbytes 
)
inlinestatic

Definition at line 530 of file vcl_test.h.

+ Here is the caller graph for this function:

Variable Documentation

◆ vcl_test_main

vcl_test_main_t vcl_test_main

Definition at line 63 of file vcl_test_client.c.

proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51