FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
vcl_test.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2021 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __vcl_test_h__
17 #define __vcl_test_h__
18 
19 #include <netdb.h>
20 #include <errno.h>
21 #include <stdlib.h>
22 #include <stdio.h>
23 #include <string.h>
24 #include <vcl/vppcom.h>
25 
26 #define vtfail(_fn, _rv) \
27 { \
28  errno = -_rv; \
29  perror ("ERROR when calling " _fn); \
30  fprintf (stderr, "\nERROR: " _fn " failed (errno = %d)!\n", -_rv); \
31  exit (1); \
32 }
33 
34 #define vterr(_fn, _rv) \
35 { \
36  errno = -_rv; \
37  fprintf (stderr, "\nERROR: " _fn " failed (errno = %d)!\n", -_rv); \
38 }
39 
40 #define vtwrn(_fmt, _args...) \
41  fprintf (stderr, "\nERROR: " _fmt "\n", ##_args) \
42 
43 #define vtinf(_fmt, _args...) \
44  fprintf (stdout, "vt<w%u>: " _fmt "\n", __wrk_index, ##_args)
45 
46 #define vt_atomic_add(_ptr, _val) \
47  __atomic_fetch_add (_ptr, _val, __ATOMIC_RELEASE)
48 
49 #define VCL_TEST_TOKEN_HELP "#H"
50 #define VCL_TEST_TOKEN_EXIT "#X"
51 #define VCL_TEST_TOKEN_VERBOSE "#V"
52 #define VCL_TEST_TOKEN_TXBUF_SIZE "#T:"
53 #define VCL_TEST_TOKEN_NUM_TEST_SESS "#I:"
54 #define VCL_TEST_TOKEN_NUM_WRITES "#N:"
55 #define VCL_TEST_TOKEN_RXBUF_SIZE "#R:"
56 #define VCL_TEST_TOKEN_SHOW_CFG "#C"
57 #define VCL_TEST_TOKEN_RUN_UNI "#U"
58 #define VCL_TEST_TOKEN_RUN_BI "#B"
59 
60 #define VCL_TEST_SERVER_PORT 22000
61 #define VCL_TEST_LOCALHOST_IPADDR "127.0.0.1"
62 
63 #define VCL_TEST_CFG_CTRL_MAGIC 0xfeedface
64 #define VCL_TEST_CFG_NUM_WRITES_DEF 1000000
65 #define VCL_TEST_CFG_TXBUF_SIZE_DEF 8192
66 #define VCL_TEST_CFG_RXBUF_SIZE_DEF (64*VCL_TEST_CFG_TXBUF_SIZE_DEF)
67 #define VCL_TEST_CFG_BUF_SIZE_MIN 128
68 #define VCL_TEST_CFG_MAX_TEST_SESS 512
69 #define VCL_TEST_CFG_MAX_EPOLL_EVENTS 16
70 
71 #define VCL_TEST_CTRL_LISTENER (~0 - 1)
72 #define VCL_TEST_DATA_LISTENER (~0)
73 #define VCL_TEST_DELAY_DISCONNECT 1
74 #define VCL_TEST_SEPARATOR_STRING \
75  " -----------------------------\n"
76 typedef enum
77 {
83 } vcl_test_t;
84 
85 typedef enum
86 {
91 
92 typedef struct __attribute__ ((packed))
93 {
94  uint32_t magic;
95  uint32_t seq_num;
96  uint32_t test;
97  uint32_t cmd;
98  uint32_t ctrl_handle;
102  uint32_t verbose;
103  uint32_t address_ip6;
104  uint32_t transport_udp;
105  uint64_t rxbuf_size;
106  uint64_t txbuf_size;
107  uint64_t num_writes;
108  uint64_t total_bytes;
110 
111 typedef struct
112 {
113  uint64_t rx_xacts;
114  uint64_t rx_bytes;
115  uint32_t rx_eagain;
116  uint32_t rx_incomp;
117  uint64_t tx_xacts;
118  uint64_t tx_bytes;
119  uint32_t tx_eagain;
120  uint32_t tx_incomp;
121  struct timespec start;
122  struct timespec stop;
124 
125 typedef struct vcl_test_session
126 {
127  uint8_t is_alloc;
128  uint8_t is_open;
129  uint8_t is_done;
130  int fd;
131  int (*read) (struct vcl_test_session *ts, void *buf, uint32_t buflen);
132  int (*write) (struct vcl_test_session *ts, void *buf, uint32_t buflen);
133  uint32_t txbuf_size;
134  uint32_t rxbuf_size;
135  char *txbuf;
136  char *rxbuf;
141  vppcom_endpt_t endpt;
142  uint8_t ip[16];
143  vppcom_data_segment_t ds[2];
144  void *opaque;
146 
147 static __thread int __wrk_index = 0;
148 
149 static inline int
151 {
152  return __wrk_index;
153 }
154 
155 typedef struct
156 {
158  int (*open) (vcl_test_session_t *ts, vppcom_endpt_t *endpt);
159  int (*listen) (vcl_test_session_t *ts, vppcom_endpt_t *endpt);
160  int (*accept) (int listen_fd, vcl_test_session_t *ts);
161  int (*close) (vcl_test_session_t *ts);
163 
164 typedef struct
165 {
167  uint32_t n_qsessions;
168  uint32_t n_sessions;
170 
171 typedef struct
172 {
173  const vcl_test_proto_vft_t *protos[VPPCOM_PROTO_SRTP + 1];
174  uint32_t ckpair_index;
178 
180 
181 #define VCL_TEST_REGISTER_PROTO(proto, vft) \
182  static void __attribute__ ((constructor)) vcl_test_init_##proto (void) \
183  { \
184  vcl_test_main.protos[proto] = &vft; \
185  }
186 
187 static inline void
189 {
190  accum->rx_xacts += incr->rx_xacts;
191  accum->rx_bytes += incr->rx_bytes;
192  accum->rx_eagain += incr->rx_eagain;
193  accum->rx_incomp += incr->rx_incomp;
194  accum->tx_xacts += incr->tx_xacts;
195  accum->tx_bytes += incr->tx_bytes;
196  accum->tx_eagain += incr->tx_eagain;
197  accum->tx_incomp += incr->tx_incomp;
198 }
199 
200 static inline void
202 {
205  cfg->ctrl_handle = ~0;
206  cfg->num_test_sessions = 1;
208  cfg->verbose = 0;
213 }
214 
215 static inline int
217 {
218  /* Note: txbuf & rxbuf on server are the same buffer,
219  * so txbuf_size is not included in this check.
220  */
221  return ((cfg->magic == valid_cfg->magic)
222  && (cfg->test == valid_cfg->test)
223  && (cfg->verbose == valid_cfg->verbose)
224  && (cfg->rxbuf_size == valid_cfg->rxbuf_size)
225  && (cfg->num_writes == valid_cfg->num_writes)
226  && (cfg->total_bytes == valid_cfg->total_bytes));
227 }
228 
229 static inline void
230 vcl_test_buf_alloc (vcl_test_cfg_t * cfg, uint8_t is_rxbuf, uint8_t ** buf,
231  uint32_t * bufsize)
232 {
233  uint32_t alloc_size = is_rxbuf ? cfg->rxbuf_size : cfg->txbuf_size;
234  uint8_t *lb = realloc (*buf, (size_t) alloc_size);
235 
236  if (lb)
237  {
238  if (is_rxbuf)
239  cfg->rxbuf_size = *bufsize = alloc_size;
240  else
241  cfg->txbuf_size = *bufsize = alloc_size;
242 
243  *buf = lb;
244  }
245  else
246  {
247  vtwrn ("realloc failed. using buffer size %d instead of %u",
248  *bufsize, alloc_size);
249  }
250 }
251 
252 static inline void
254 {
255  ts->rxbuf_size = ts->cfg.rxbuf_size;
256  ts->txbuf_size = ts->cfg.txbuf_size;
257  vcl_test_buf_alloc (&ts->cfg, 0 /* is_rxbuf */, (uint8_t **) &ts->txbuf,
258  &ts->txbuf_size);
259  vcl_test_buf_alloc (&ts->cfg, 1 /* is_rxbuf */, (uint8_t **) &ts->rxbuf,
260  &ts->rxbuf_size);
261 }
262 
263 static inline void
265 {
266  free (ts->rxbuf);
267  free (ts->txbuf);
268  ts->rxbuf = 0;
269  ts->txbuf = 0;
270 }
271 
272 static inline char *
274 {
275  switch (t)
276  {
277  case VCL_TEST_TYPE_NONE:
278  return "NONE";
279 
280  case VCL_TEST_TYPE_ECHO:
281  return "ECHO";
282 
283  case VCL_TEST_TYPE_UNI:
284  return "UNI";
285 
286  case VCL_TEST_TYPE_BI:
287  return "BI";
288 
289  case VCL_TEST_TYPE_EXIT:
290  return "EXIT";
291 
292  default:
293  return "Unknown";
294  }
295 }
296 
297 static inline void
298 vcl_test_cfg_dump (vcl_test_cfg_t * cfg, uint8_t is_client)
299 {
300  char *spc = " ";
301 
302  printf (" test config (%p):\n"
304  " magic: 0x%08x\n"
305  " seq_num: 0x%08x\n"
306  "%-5s test: %s (%d)\n"
307  " ctrl handle: %d (0x%x)\n"
308  "%-5s num test sockets: %u (0x%08x)\n"
309  "%-5s verbose: %s (%d)\n"
310  "%-5s rxbuf size: %lu (0x%08lx)\n"
311  "%-5s txbuf size: %lu (0x%08lx)\n"
312  "%-5s num writes: %lu (0x%08lx)\n"
313  " client tx bytes: %lu (0x%08lx)\n"
315  (void *) cfg, cfg->magic, cfg->seq_num,
316  is_client && (cfg->test == VCL_TEST_TYPE_UNI) ?
317  "'" VCL_TEST_TOKEN_RUN_UNI "'" :
318  is_client && (cfg->test == VCL_TEST_TYPE_BI) ?
319  "'" VCL_TEST_TOKEN_RUN_BI "'" : spc,
322  is_client ? "'" VCL_TEST_TOKEN_NUM_TEST_SESS "'" : spc,
324  is_client ? "'" VCL_TEST_TOKEN_VERBOSE "'" : spc,
325  cfg->verbose ? "on" : "off", cfg->verbose,
326  is_client ? "'" VCL_TEST_TOKEN_RXBUF_SIZE "'" : spc,
328  is_client ? "'" VCL_TEST_TOKEN_TXBUF_SIZE "'" : spc,
330  is_client ? "'" VCL_TEST_TOKEN_NUM_WRITES "'" : spc,
333 }
334 
335 static inline void
337  uint8_t show_rx, uint8_t show_tx, uint8_t verbose)
338 {
339  struct timespec diff;
340  double duration, rate;
341  uint64_t total_bytes;
342 
343  if ((stats->stop.tv_nsec - stats->start.tv_nsec) < 0)
344  {
345  diff.tv_sec = stats->stop.tv_sec - stats->start.tv_sec - 1;
346  diff.tv_nsec = stats->stop.tv_nsec - stats->start.tv_nsec + 1e9;
347  }
348  else
349  {
350  diff.tv_sec = stats->stop.tv_sec - stats->start.tv_sec;
351  diff.tv_nsec = stats->stop.tv_nsec - stats->start.tv_nsec;
352  }
353  duration = (double) diff.tv_sec + (1e-9 * diff.tv_nsec);
354 
355  total_bytes = stats->tx_bytes + stats->rx_bytes;
356  rate = (double) total_bytes *8 / duration / 1e9;
357  printf ("\n%s: Streamed %lu bytes\n"
358  " in %lf seconds (%lf Gbps %s-duplex)!\n",
359  header, total_bytes, duration, rate,
360  (show_rx && show_tx) ? "full" : "half");
361 
362  if (show_tx)
363  {
365  " tx stats (0x%p):\n"
367  " writes: %lu (0x%08lx)\n"
368  " tx bytes: %lu (0x%08lx)\n"
369  " tx eagain: %u (0x%08x)\n"
370  " tx incomplete: %u (0x%08x)\n",
371  (void *) stats, stats->tx_xacts, stats->tx_xacts,
372  stats->tx_bytes, stats->tx_bytes,
373  stats->tx_eagain, stats->tx_eagain,
374  stats->tx_incomp, stats->tx_incomp);
375  }
376  if (show_rx)
377  {
379  " rx stats (0x%p):\n"
381  " reads: %lu (0x%08lx)\n"
382  " rx bytes: %lu (0x%08lx)\n"
383  " rx eagain: %u (0x%08x)\n"
384  " rx incomplete: %u (0x%08x)\n",
385  (void *) stats, stats->rx_xacts, stats->rx_xacts,
386  stats->rx_bytes, stats->rx_bytes,
387  stats->rx_eagain, stats->rx_eagain,
388  stats->rx_incomp, stats->rx_incomp);
389  }
390  if (verbose)
391  printf (" start.tv_sec: %ld\n"
392  " start.tv_nsec: %ld\n"
393  " stop.tv_sec: %ld\n"
394  " stop.tv_nsec: %ld\n",
395  stats->start.tv_sec, stats->start.tv_nsec,
396  stats->stop.tv_sec, stats->stop.tv_nsec);
397 
398  printf (VCL_TEST_SEPARATOR_STRING);
399 }
400 
401 static inline double
402 vcl_test_time_diff (struct timespec *old, struct timespec *new)
403 {
404  uint64_t sec, nsec;
405  if ((new->tv_nsec - old->tv_nsec) < 0)
406  {
407  sec = new->tv_sec - old->tv_sec - 1;
408  nsec = new->tv_nsec - old->tv_nsec + 1e9;
409  }
410  else
411  {
412  sec = new->tv_sec - old->tv_sec;
413  nsec = new->tv_nsec - old->tv_nsec;
414  }
415  return (double) sec + (1e-9 * nsec);
416 }
417 
418 static inline void
420 {
421  vcl_test_stats_t *old, *new;
422  double duration, rate;
423  uint64_t total_bytes;
424  char *dir_str;
425 
426  old = &ts->old_stats;
427  new = &ts->stats;
428  duration = vcl_test_time_diff (&old->stop, &new->stop);
429 
430  if (is_rx)
431  {
432  total_bytes = new->rx_bytes - old->rx_bytes;
433  dir_str = "Received";
434  }
435  else
436  {
437  total_bytes = new->tx_bytes - old->tx_bytes;
438  dir_str = "Sent";
439  }
440 
441  rate = (double) total_bytes * 8 / duration / 1e9;
442  printf ("%d: %s %lu Mbytes in %.2lf seconds %.2lf Gbps\n", ts->fd, dir_str,
443  (uint64_t) (total_bytes / 1e6), duration, rate);
444 }
445 
446 static inline int
447 vcl_comp_tspec (struct timespec *a, struct timespec *b)
448 {
449  if (a->tv_sec < b->tv_sec)
450  return -1;
451  else if (a->tv_sec > b->tv_sec)
452  return 1;
453  else if (a->tv_nsec < b->tv_nsec)
454  return -1;
455  else if (a->tv_nsec > b->tv_nsec)
456  return 1;
457  else
458  return 0;
459 }
460 
461 static inline int
462 vcl_test_read (vcl_test_session_t *ts, void *buf, uint32_t nbytes)
463 {
464  vcl_test_stats_t *stats = &ts->stats;
465  int rv, rx_bytes = 0;
466 
467  do
468  {
469  stats->rx_xacts++;
470  rv = vppcom_session_read (ts->fd, buf, nbytes);
471  if (rv <= 0)
472  {
473  errno = -rv;
474  if (errno == EAGAIN || errno == EWOULDBLOCK)
475  {
476  stats->rx_eagain++;
477  continue;
478  }
479 
480  vterr ("vppcom_session_read()", -errno);
481  break;
482  }
483 
484  rx_bytes = rv;
485  if (rv < nbytes)
486  stats->rx_incomp++;
487  }
488  while (!rx_bytes);
489 
490  stats->rx_bytes += rx_bytes;
491 
492  return (rx_bytes);
493 }
494 
495 static inline int
497 {
498  vcl_test_stats_t *stats = &ts->stats;
499  int rx_bytes;
500 
501  do
502  {
503  stats->rx_xacts++;
504  rx_bytes = vppcom_session_read_segments (ts->fd, ts->ds, 2, ~0);
505 
506  if (rx_bytes < 0)
507  {
508  errno = -rx_bytes;
509  rx_bytes = -1;
510  }
511  if ((rx_bytes == 0) ||
512  ((rx_bytes < 0)
513  && ((errno == EAGAIN) || (errno == EWOULDBLOCK))))
514  stats->rx_eagain++;
515  }
516  while ((rx_bytes == 0) ||
517  ((rx_bytes < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))));
518 
519  if (rx_bytes < 0)
520  {
521  vterr ("vppcom_session_read()", -errno);
522  }
523  else
524  stats->rx_bytes += rx_bytes;
525 
526  return (rx_bytes);
527 }
528 
529 static inline int
530 vcl_test_write (vcl_test_session_t *ts, void *buf, uint32_t nbytes)
531 {
532  int tx_bytes = 0, nbytes_left = nbytes, rv;
533  vcl_test_stats_t *stats = &ts->stats;
534 
535  do
536  {
537  stats->tx_xacts++;
538  rv = vppcom_session_write (ts->fd, buf, nbytes_left);
539  if (rv < 0)
540  {
541  errno = -rv;
542  if ((errno == EAGAIN || errno == EWOULDBLOCK))
543  stats->tx_eagain++;
544  break;
545  }
546  tx_bytes += rv;
547 
548  nbytes_left = nbytes_left - rv;
549  buf += rv;
550  if (rv < nbytes_left)
551  stats->tx_incomp++;
552  }
553  while (tx_bytes != nbytes);
554 
555  if (tx_bytes < 0)
556  {
557  vterr ("vpcom_session_write", -errno);
558  }
559  else
560  stats->tx_bytes += tx_bytes;
561 
562  return (tx_bytes);
563 }
564 
565 static inline void
566 dump_help (void)
567 {
568 #define INDENT "\n "
569 
570  printf ("CLIENT: Test configuration commands:"
572  "\t\t\tDisplay help."
574  "\t\t\tExit test client & server."
576  "\t\t\tShow the current test cfg."
578  "\t\t\tRun the Uni-directional test."
580  "\t\t\tRun the Bi-directional test."
582  "\t\t\tToggle verbose setting."
584  "<rxbuf size>\tRx buffer size (bytes)."
586  "<txbuf size>\tTx buffer size (bytes)."
588  "<# of writes>\tNumber of txbuf writes to server." "\n");
589 }
590 
591 #endif /* __vcl_test_h__ */
592 
593 /*
594  * fd.io coding-style-patch-verification: ON
595  *
596  * Local Variables:
597  * eval: (c-set-style "gnu")
598  * End:
599  */
vcl_test_wrk_t::n_qsessions
uint32_t n_qsessions
Definition: vcl_test.h:167
vcl_test_cfg_t::seq_num
uint32_t seq_num
Definition: vcl_test.h:95
vcl_test_session::old_stats
vcl_test_stats_t old_stats
Definition: vcl_test.h:139
vcl_test_read_ds
static int vcl_test_read_ds(vcl_test_session_t *ts)
Definition: vcl_test.h:496
vcl_test_cfg_t::magic
uint32_t magic
Definition: vcl_test.h:94
realloc
void * realloc(void *p, size_t size)
Definition: mem.c:67
VCL_TEST_TYPE_EXIT
@ VCL_TEST_TYPE_EXIT
Definition: vcl_test.h:82
vcl_test_session::session_index
int session_index
Definition: vcl_test.h:140
VCL_TEST_TYPE_NONE
@ VCL_TEST_TYPE_NONE
Definition: vcl_test.h:78
vcl_test_stats_t::tx_eagain
uint32_t tx_eagain
Definition: vcl_test.h:119
vcl_test_cfg_t::address_ip6
uint32_t address_ip6
Definition: vcl_test.h:103
init
static void init(void)
Definition: client.c:83
string.h
vcl_test_stats_t::rx_incomp
uint32_t rx_incomp
Definition: vcl_test.h:116
vcl_test_main_t
Definition: vcl_test.h:171
vcl_test_main
vcl_test_main_t vcl_test_main
Definition: vcl_test_client.c:63
vcl_test_cfg_t::rxbuf_size
uint64_t rxbuf_size
Definition: vcl_test.h:105
vcl_test_cfg_t::test
uint32_t test
Definition: vcl_test.h:96
vcl_test_time_diff
static double vcl_test_time_diff(struct timespec *old, struct timespec *new)
Definition: vcl_test.h:402
VCL_TEST_TOKEN_NUM_WRITES
#define VCL_TEST_TOKEN_NUM_WRITES
Definition: vcl_test.h:54
stats
vl_api_ikev2_sa_stats_t stats
Definition: ikev2_types.api:162
vcl_test_cfg_dump
static void vcl_test_cfg_dump(vcl_test_cfg_t *cfg, uint8_t is_client)
Definition: vcl_test.h:298
VCL_TEST_TOKEN_TXBUF_SIZE
#define VCL_TEST_TOKEN_TXBUF_SIZE
Definition: vcl_test.h:52
vcl_test_cfg_t::ctrl_handle
uint32_t ctrl_handle
Definition: vcl_test.h:98
vcl_test_session::rxbuf
char * rxbuf
Definition: vcl_test.h:136
vcl_test_stats_t::tx_incomp
uint32_t tx_incomp
Definition: vcl_test.h:120
VCL_TEST_TOKEN_RUN_BI
#define VCL_TEST_TOKEN_RUN_BI
Definition: vcl_test.h:58
dump_help
static void dump_help(void)
Definition: vcl_test.h:566
vcl_test_stats_t::tx_bytes
uint64_t tx_bytes
Definition: vcl_test.h:118
VCL_TEST_TOKEN_HELP
#define VCL_TEST_TOKEN_HELP
Definition: vcl_test.h:49
vcl_test_session::is_open
uint8_t is_open
Definition: vcl_test.h:128
vcl_test_main_t::wrk
vcl_test_wrk_t * wrk
Definition: vcl_test.h:176
vcl_test_main_t::cfg
vcl_test_cfg_t cfg
Definition: vcl_test.h:175
vcl_test_cfg_t::num_test_qsessions
uint32_t num_test_qsessions
Definition: vcl_test.h:101
VCL_TEST_TOKEN_SHOW_CFG
#define VCL_TEST_TOKEN_SHOW_CFG
Definition: vcl_test.h:56
vcl_test_wrk_t
Definition: vcl_test.h:164
VCL_TEST_TYPE_ECHO
@ VCL_TEST_TYPE_ECHO
Definition: vcl_test.h:79
vcl_test_session
Definition: vcl_test.h:125
vcl_test_stats_t::tx_xacts
uint64_t tx_xacts
Definition: vcl_test.h:117
INDENT
#define INDENT
vcl_test_session::is_done
uint8_t is_done
Definition: vcl_test.h:129
vcl_test_cfg_t::transport_udp
uint32_t transport_udp
Definition: vcl_test.h:104
vterr
#define vterr(_fn, _rv)
Definition: vcl_test.h:34
vcl_test_session_buf_alloc
static void vcl_test_session_buf_alloc(vcl_test_session_t *ts)
Definition: vcl_test.h:253
vcl_test_session::write
int(* write)(struct vcl_test_session *ts, void *buf, uint32_t buflen)
Definition: vcl_test.h:132
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)
Definition: vcl_test.h:230
VCL_TEST_CFG_NUM_WRITES_DEF
#define VCL_TEST_CFG_NUM_WRITES_DEF
Definition: vcl_test.h:64
vcl_test_stats_t::stop
struct timespec stop
Definition: vcl_test.h:122
vcl_test_session_buf_free
static void vcl_test_session_buf_free(vcl_test_session_t *ts)
Definition: vcl_test.h:264
vcl_test_t
vcl_test_t
Definition: vcl_test.h:76
vcl_test_wrk_t::n_sessions
uint32_t n_sessions
Definition: vcl_test.h:168
vcl_test_cfg_t::num_test_sessions_perq
uint32_t num_test_sessions_perq
Definition: vcl_test.h:100
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)
Definition: vcl_test.h:336
vcl_test_cfg_t::txbuf_size
uint64_t txbuf_size
Definition: vcl_test.h:106
VCL_TEST_TYPE_BI
@ VCL_TEST_TYPE_BI
Definition: vcl_test.h:81
VCL_TEST_CMD_STOP
@ VCL_TEST_CMD_STOP
Definition: vcl_test.h:89
VCL_TEST_CFG_RXBUF_SIZE_DEF
#define VCL_TEST_CFG_RXBUF_SIZE_DEF
Definition: vcl_test.h:66
new
vl_api_cnat_endpoint_t new
Definition: cnat.api:119
vcl_test_cfg_t::total_bytes
uint64_t total_bytes
Definition: vcl_test.h:108
vcl_test_session::read
int(* read)(struct vcl_test_session *ts, void *buf, uint32_t buflen)
Definition: vcl_test.h:131
VCL_TEST_CFG_TXBUF_SIZE_DEF
#define VCL_TEST_CFG_TXBUF_SIZE_DEF
Definition: vcl_test.h:65
vcl_test_cfg_t::num_test_sessions
uint32_t num_test_sessions
Definition: vcl_test.h:99
vcl_test_session::txbuf
char * txbuf
Definition: vcl_test.h:135
vcl_test_stats_t::rx_eagain
uint32_t rx_eagain
Definition: vcl_test.h:115
vcl_test_session::ds
vppcom_data_segment_t ds[2]
Definition: vcl_test.h:143
vcl_test_cfg_t::verbose
uint32_t verbose
Definition: vcl_test.h:102
vcl_test_wrk_t::qsessions
vcl_test_session_t * qsessions
Definition: vcl_test.h:166
VCL_TEST_SEPARATOR_STRING
#define VCL_TEST_SEPARATOR_STRING
Definition: vcl_test.h:74
vcl_test_session::stats
vcl_test_stats_t stats
Definition: vcl_test.h:138
vcl_test_session::fd
int fd
Definition: vcl_test.h:130
vcl_test_type_str
static char * vcl_test_type_str(vcl_test_t t)
Definition: vcl_test.h:273
vcl_test_stats_dump_inc
static void vcl_test_stats_dump_inc(vcl_test_session_t *ts, int is_rx)
Definition: vcl_test.h:419
vcl_test_session::ip
uint8_t ip[16]
Definition: vcl_test.h:142
vcl_test_session::is_alloc
uint8_t is_alloc
Definition: vcl_test.h:127
vcl_test_session::rxbuf_size
uint32_t rxbuf_size
Definition: vcl_test.h:134
vcl_test_main_t::ckpair_index
uint32_t ckpair_index
Definition: vcl_test.h:174
vcl_test_stats_t::rx_bytes
uint64_t rx_bytes
Definition: vcl_test.h:114
buf
u64 buf
Definition: application.c:493
vcl_test_session::endpt
vppcom_endpt_t endpt
Definition: vcl_test.h:141
vcl_test_stats_accumulate
static void vcl_test_stats_accumulate(vcl_test_stats_t *accum, vcl_test_stats_t *incr)
Definition: vcl_test.h:188
vcl_test_cfg_verify
static int vcl_test_cfg_verify(vcl_test_cfg_t *cfg, vcl_test_cfg_t *valid_cfg)
Definition: vcl_test.h:216
vcl_test_cmd_t
vcl_test_cmd_t
Definition: vcl_test.h:85
vcl_test_stats_t::rx_xacts
uint64_t rx_xacts
Definition: vcl_test.h:113
vtwrn
#define vtwrn(_fmt, _args...)
Definition: vcl_test.h:40
VCL_TEST_TOKEN_EXIT
#define VCL_TEST_TOKEN_EXIT
Definition: vcl_test.h:50
VCL_TEST_TOKEN_VERBOSE
#define VCL_TEST_TOKEN_VERBOSE
Definition: vcl_test.h:51
b
vlib_buffer_t ** b
Definition: nat44_ei_out2in.c:717
a
a
Definition: bitmap.h:525
VCL_TEST_TOKEN_RXBUF_SIZE
#define VCL_TEST_TOKEN_RXBUF_SIZE
Definition: vcl_test.h:55
vcl_test_worker_index
static int vcl_test_worker_index(void)
Definition: vcl_test.h:150
free
void free(void *p)
Definition: mem.c:42
VCL_TEST_CMD_SYNC
@ VCL_TEST_CMD_SYNC
Definition: vcl_test.h:87
VCL_TEST_CFG_CTRL_MAGIC
#define VCL_TEST_CFG_CTRL_MAGIC
Definition: vcl_test.h:63
vcl_test_session::opaque
void * opaque
Definition: vcl_test.h:144
vcl_test_cfg_init
static void vcl_test_cfg_init(vcl_test_cfg_t *cfg)
Definition: vcl_test.h:201
VCL_TEST_TOKEN_RUN_UNI
#define VCL_TEST_TOKEN_RUN_UNI
Definition: vcl_test.h:57
rv
int __clib_unused rv
Definition: application.c:491
vcl_test_session::cfg
vcl_test_cfg_t cfg
Definition: vcl_test.h:137
vcl_test_write
static int vcl_test_write(vcl_test_session_t *ts, void *buf, uint32_t nbytes)
Definition: vcl_test.h:530
vcl_test_cfg_t
Definition: vcl_test.h:92
vcl_test_session_t
struct vcl_test_session vcl_test_session_t
vcl_test_cfg_t::cmd
uint32_t cmd
Definition: vcl_test.h:97
vcl_comp_tspec
static int vcl_comp_tspec(struct timespec *a, struct timespec *b)
Definition: vcl_test.h:447
vcl_test_stats_t
Definition: vcl_test.h:111
VCL_TEST_CMD_START
@ VCL_TEST_CMD_START
Definition: vcl_test.h:88
vcl_test_cfg_t::num_writes
uint64_t num_writes
Definition: vcl_test.h:107
vcl_test_session::txbuf_size
uint32_t txbuf_size
Definition: vcl_test.h:133
vcl_test_proto_vft_t
Definition: vcl_test.h:155
VCL_TEST_TOKEN_NUM_TEST_SESS
#define VCL_TEST_TOKEN_NUM_TEST_SESS
Definition: vcl_test.h:53
vcl_test_read
static int vcl_test_read(vcl_test_session_t *ts, void *buf, uint32_t nbytes)
Definition: vcl_test.h:462
VCL_TEST_TYPE_UNI
@ VCL_TEST_TYPE_UNI
Definition: vcl_test.h:80