FD.io VPP  v21.01.1
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_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   32
 
#define VCL_TEST_CFG_MAX_EPOLL_EVENTS   16
 
#define VCL_TEST_DELAY_DISCONNECT   1
 
#define VCL_TEST_SEPARATOR_STRING   " -----------------------------\n"
 
#define INDENT   "\n "
 

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
}
 

Functions

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 *socket)
 
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 int vcl_comp_tspec (struct timespec *a, struct timespec *b)
 
static int vcl_test_read (int fd, uint8_t *buf, uint32_t nbytes, vcl_test_stats_t *stats)
 
static int vcl_test_read_ds (int fd, vppcom_data_segment_t *ds, vcl_test_stats_t *stats)
 
static int vcl_test_write (int fd, uint8_t *buf, uint32_t nbytes, vcl_test_stats_t *stats, uint32_t verbose)
 
static void dump_help (void)
 

Variables

char vcl_test_crt_rsa []
 
uint32_t vcl_test_crt_rsa_len = sizeof (vcl_test_crt_rsa)
 
char vcl_test_key_rsa []
 
uint32_t vcl_test_key_rsa_len = sizeof (vcl_test_key_rsa)
 

Macro Definition Documentation

◆ INDENT

#define INDENT   "\n "

◆ VCL_TEST_CFG_BUF_SIZE_MIN

#define VCL_TEST_CFG_BUF_SIZE_MIN   128

Definition at line 66 of file vcl_test.h.

◆ VCL_TEST_CFG_CTRL_MAGIC

#define VCL_TEST_CFG_CTRL_MAGIC   0xfeedface

Definition at line 62 of file vcl_test.h.

◆ VCL_TEST_CFG_MAX_EPOLL_EVENTS

#define VCL_TEST_CFG_MAX_EPOLL_EVENTS   16

Definition at line 68 of file vcl_test.h.

◆ VCL_TEST_CFG_MAX_TEST_SESS

#define VCL_TEST_CFG_MAX_TEST_SESS   32

Definition at line 67 of file vcl_test.h.

◆ VCL_TEST_CFG_NUM_WRITES_DEF

#define VCL_TEST_CFG_NUM_WRITES_DEF   1000000

Definition at line 63 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 65 of file vcl_test.h.

◆ VCL_TEST_CFG_TXBUF_SIZE_DEF

#define VCL_TEST_CFG_TXBUF_SIZE_DEF   8192

Definition at line 64 of file vcl_test.h.

◆ VCL_TEST_DELAY_DISCONNECT

#define VCL_TEST_DELAY_DISCONNECT   1

Definition at line 70 of file vcl_test.h.

◆ VCL_TEST_LOCALHOST_IPADDR

#define VCL_TEST_LOCALHOST_IPADDR   "127.0.0.1"

Definition at line 60 of file vcl_test.h.

◆ VCL_TEST_SEPARATOR_STRING

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

Definition at line 71 of file vcl_test.h.

◆ VCL_TEST_SERVER_PORT

#define VCL_TEST_SERVER_PORT   22000

Definition at line 59 of file vcl_test.h.

◆ VCL_TEST_TOKEN_EXIT

#define VCL_TEST_TOKEN_EXIT   "#X"

Definition at line 49 of file vcl_test.h.

◆ VCL_TEST_TOKEN_HELP

#define VCL_TEST_TOKEN_HELP   "#H"

Definition at line 48 of file vcl_test.h.

◆ VCL_TEST_TOKEN_NUM_TEST_SESS

#define VCL_TEST_TOKEN_NUM_TEST_SESS   "#I:"

Definition at line 52 of file vcl_test.h.

◆ VCL_TEST_TOKEN_NUM_WRITES

#define VCL_TEST_TOKEN_NUM_WRITES   "#N:"

Definition at line 53 of file vcl_test.h.

◆ VCL_TEST_TOKEN_RUN_BI

#define VCL_TEST_TOKEN_RUN_BI   "#B"

Definition at line 57 of file vcl_test.h.

◆ VCL_TEST_TOKEN_RUN_UNI

#define VCL_TEST_TOKEN_RUN_UNI   "#U"

Definition at line 56 of file vcl_test.h.

◆ VCL_TEST_TOKEN_RXBUF_SIZE

#define VCL_TEST_TOKEN_RXBUF_SIZE   "#R:"

Definition at line 54 of file vcl_test.h.

◆ VCL_TEST_TOKEN_SHOW_CFG

#define VCL_TEST_TOKEN_SHOW_CFG   "#C"

Definition at line 55 of file vcl_test.h.

◆ VCL_TEST_TOKEN_TXBUF_SIZE

#define VCL_TEST_TOKEN_TXBUF_SIZE   "#T:"

Definition at line 51 of file vcl_test.h.

◆ VCL_TEST_TOKEN_VERBOSE

#define VCL_TEST_TOKEN_VERBOSE   "#V"

Definition at line 50 of file vcl_test.h.

◆ vt_atomic_add

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

Definition at line 45 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 33 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 25 of file vcl_test.h.

◆ vtinf

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

Definition at line 42 of file vcl_test.h.

◆ vtwrn

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

Definition at line 39 of file vcl_test.h.

Enumeration Type Documentation

◆ 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 73 of file vcl_test.h.

Function Documentation

◆ dump_help()

static void dump_help ( void  )
inlinestatic

Definition at line 523 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 392 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 229 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 288 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 200 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 215 of file vcl_test.h.

+ Here is the caller graph for this function:

◆ vcl_test_read()

static int vcl_test_read ( int  fd,
uint8_t *  buf,
uint32_t  nbytes,
vcl_test_stats_t stats 
)
inlinestatic

Definition at line 407 of file vcl_test.h.

+ Here is the caller graph for this function:

◆ vcl_test_read_ds()

static int vcl_test_read_ds ( int  fd,
vppcom_data_segment_t *  ds,
vcl_test_stats_t stats 
)
inlinestatic

Definition at line 447 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 socket)
inlinestatic

Definition at line 252 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 187 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 326 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 263 of file vcl_test.h.

+ Here is the caller graph for this function:

◆ vcl_test_write()

static int vcl_test_write ( int  fd,
uint8_t *  buf,
uint32_t  nbytes,
vcl_test_stats_t stats,
uint32_t  verbose 
)
inlinestatic

Definition at line 485 of file vcl_test.h.

+ Here is the caller graph for this function:

Variable Documentation

◆ vcl_test_crt_rsa

char vcl_test_crt_rsa[]
Initial value:
=
"-----BEGIN CERTIFICATE-----\r\n"
"MIID5zCCAs+gAwIBAgIJALeMYCEHrTtJMA0GCSqGSIb3DQEBCwUAMIGJMQswCQYD\r\n"
"VQQGEwJVUzELMAkGA1UECAwCQ0ExETAPBgNVBAcMCFNhbiBKb3NlMQ4wDAYDVQQK\r\n"
"DAVDaXNjbzEOMAwGA1UECwwFZmQuaW8xFjAUBgNVBAMMDXRlc3R0bHMuZmQuaW8x\r\n"
"IjAgBgkqhkiG9w0BCQEWE3ZwcC1kZXZAbGlzdHMuZmQuaW8wHhcNMTgwMzA1MjEx\r\n"
"NTEyWhcNMjgwMzAyMjExNTEyWjCBiTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNB\r\n"
"MREwDwYDVQQHDAhTYW4gSm9zZTEOMAwGA1UECgwFQ2lzY28xDjAMBgNVBAsMBWZk\r\n"
"LmlvMRYwFAYDVQQDDA10ZXN0dGxzLmZkLmlvMSIwIAYJKoZIhvcNAQkBFhN2cHAt\r\n"
"ZGV2QGxpc3RzLmZkLmlvMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA\r\n"
"4C1k8a1DuStgggqT4o09fP9sJ2dC54bxhS/Xk2VEfaIZ222WSo4X/syRVfVy9Yah\r\n"
"cpI1zJ/RDxaZSFhgA+nPZBrFMsrULkrdAOpOVj8eDEp9JuWdO2ODSoFnCvLxcYWB\r\n"
"Yc5kHryJpEaGJl1sFQSesnzMFty/59ta0stk0Fp8r5NhIjWvSovGzPo6Bhz+VS2c\r\n"
"ebIZh4x1t2hHaFcgm0qJoJ6DceReWCW8w+yOVovTolGGq+bpb2Hn7MnRSZ2K2NdL\r\n"
"+aLXpkZbS/AODP1FF2vTO1mYL290LO7/51vJmPXNKSDYMy5EvILr5/VqtjsFCwRL\r\n"
"Q4jcM/+GeHSAFWx4qIv0BwIDAQABo1AwTjAdBgNVHQ4EFgQUWa1SOB37xmT53tZQ\r\n"
"aXuLLhRI7U8wHwYDVR0jBBgwFoAUWa1SOB37xmT53tZQaXuLLhRI7U8wDAYDVR0T\r\n"
"BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAoUht13W4ya27NVzQuCMvqPWL3VM4\r\n"
"3xbPFk02FaGz/WupPu276zGlzJAZrbuDcQowwwU1Ni1Yygxl96s1c2M5rHDTrOKG\r\n"
"rK0hbkSFBo+i6I8u4HiiQ4rYmG0Hv6+sXn3of0HsbtDPGgWZoipPWDljPYEURu3e\r\n"
"3HRe/Dtsj9CakBoSDzs8ndWaBR+f4sM9Tk1cjD46Gq2T/qpSPXqKxEUXlzhdCAn4\r\n"
"twub17Bq2kykHpppCwPg5M+v30tHG/R2Go15MeFWbEJthFk3TZMjKL7UFs7fH+x2\r\n"
"wSonXb++jY+KmCb93C+soABBizE57g/KmiR2IxQ/LMjDik01RSUIaM0lLA==\r\n"
"-----END CERTIFICATE-----\r\n"

Definition at line 130 of file vcl_test.h.

◆ vcl_test_crt_rsa_len

uint32_t vcl_test_crt_rsa_len = sizeof (vcl_test_crt_rsa)

Definition at line 154 of file vcl_test.h.

◆ vcl_test_key_rsa

char vcl_test_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teunF1mdZgXs+WrN+uLlRrQR20F\r\n"
"ZyMYiUCH2Dtn26EzA2moy7FipIIrQcX/j+KhYNGM3e7MU4LymIO29E18mn8JODnH\r\n"
"sQOXzBTsf8A4yIVMkcuQD3bfb0JiUGYUPOidTp2N7IJA7+6Yc3vQOyb74lnKnJoO\r\n"
"gougPT2wS+cCgYAn7muzb6xFsXDhyW0Tm6YJYBfRS9yAWEuVufINobeBZPSl2cN1\r\n"
"Jrnw+HlrfTNbrJWuJmjtZJXUXQ6cVp2rUbjutNyRV4vG6iRwEXYQ40EJdkr1gZpi\r\n"
"CHQhuShuuPih2MNAy7EEbM+sXrDjTBR3bFqzuHPzu7dp+BshCFX3lRfAAQKBgGQt\r\n"
"K5i7IhCFDjb/+3IPLgOAK7mZvsvZ4eXD33TQ2eZgtut1PXtBtNl17/b85uv293Fm\r\n"
"VDISVcsk3eLNS8zIiT6afUoWlxAwXEs0v5WRfjl4radkGvgGiJpJYvyeM67877RB\r\n"
"EDSKc/X8ESLfOB44iGvZUEMG6zJFscx9DgN25iQZAoGAbyd+JEWwdVH9/K3IH1t2\r\n"
"PBkZX17kNWv+iVM1WyFjbe++vfKZCrOJiyiqhDeEqgrP3AuNMlaaduC3VRC3G5oV\r\n"
"Mj1tlhDWQ/qhvKdCKNdIVQYDE75nw+FRWV8yYkHAnXYW3tNoweDIwixE0hkPR1bc\r\n"
"oEjPLVNtx8SOj/M4rhaPT3I=\r\n" "-----END PRIVATE KEY-----\r\n"

Definition at line 156 of file vcl_test.h.

◆ vcl_test_key_rsa_len

uint32_t vcl_test_key_rsa_len = sizeof (vcl_test_key_rsa)

Definition at line 184 of file vcl_test.h.