|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
26 #include <vpp/app/version.h>
27 #include <vpp/vnet/config.h>
42 char *p,
path[PATH_MAX];
47 if ((
rv = readlink (
"/proc/self/exe",
path, PATH_MAX - 1)) == -1)
54 if ((p = strrchr (
path,
'/')) == 0)
59 if ((p = strrchr (
path,
'/')) == 0)
63 s =
format (0,
"%s/lib/" CLIB_TARGET_TRIPLET
"/vpp_plugins:"
68 s =
format (0,
"%s/lib/" CLIB_TARGET_TRIPLET
"/vpp_api_test_plugins:"
69 "%s/lib/vpp_api_test_plugins",
path,
path);
77 #if VPP_API_TEST_BUILTIN > 0
92 #if VPP_API_TEST_BUILTIN > 0
110 uword main_heap_size = (1ULL << 30);
123 =
"ERROR: This binary requires CPU with %s extensions.\n";
125 if (!clib_cpu_supports_ ## a ()) \
127 fprintf(stderr, msg, b); \
155 if ((argc == 3) && !strncmp (argv[1],
"-c", 2))
164 fp = fopen (argv[2],
"r");
167 fprintf (stderr,
"open configuration file '%s' failed\n", argv[2]);
170 argv_ =
calloc (1,
sizeof (
char *));
176 arg = strndup (argv[0], 1024);
187 if (fgets (inbuf, 4096, fp) == 0)
189 p = strtok (inbuf,
" \t\n");
195 char **
tmp =
realloc (argv_, argc_ *
sizeof (
char *));
199 arg = strndup (p, 1024);
202 argv_[argc_ - 1] = arg;
203 p = strtok (NULL,
" \t\n");
209 char **
tmp =
realloc (argv_, (argc_ + 1) *
sizeof (
char *));
226 for (
i = 1;
i < (argc - 1);
i++)
228 if (!strncmp (argv[
i],
"plugin_path", 11))
233 if (!strncmp (argv[
i],
"test_plugin_path", 16))
238 else if (!strncmp (argv[
i],
"heapsize", 8))
240 sizep = (
u8 *) argv[
i + 1];
242 while (*sizep >=
'0' && *sizep <=
'9')
245 size += *sizep++ -
'0';
251 "warning: heapsize parse error '%s', use default %lld\n",
252 argv[
i], (
long long int) main_heap_size);
256 main_heap_size =
size;
258 if (*sizep ==
'g' || *sizep ==
'G')
259 main_heap_size <<= 30;
260 else if (*sizep ==
'm' || *sizep ==
'M')
261 main_heap_size <<= 20;
263 else if (!strncmp (argv[
i],
"main-core", 9))
268 unsigned long x = strtol (argv[++
i], 0, 0);
282 if (
unformat (&input,
"memory %v", &v))
288 if (
unformat (&sub_input,
"main-heap-size %U",
291 else if (
unformat (&sub_input,
"main-heap-page-size %U",
293 &main_heap_log2_page_sz))
295 else if (
unformat (&sub_input,
"default-hugepage-size %U",
297 &default_log2_hugepage_sz))
301 fformat (stderr,
"unknown 'memory' config input '%U'\n",
309 else if (!
unformat (&input,
"%s %v", &s, &v))
322 CPU_SET (main_core, &cpuset);
323 pthread_setaffinity_np (pthread_self (),
sizeof (cpu_set_t), &cpuset);
332 main_heap_log2_page_sz)))
349 int rv __attribute__ ((unused)) =
350 write (2,
"Main heap allocation failure!\r\n", 31);
427 static int recursion_block;
444 #ifdef BARRIER_TRACING
485 clib_bihash_8_8_t *
h;
503 .path =
"show bihash",
504 .short_help =
"show bihash",
509 #ifdef CLIB_SANITIZE_ADDR
512 __asan_default_options (
void)
514 return VPP_SANITIZE_ADDR_OPTIONS;
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
static vlib_cli_command_t show_bihash_command
(constructor) VLIB_CLI_COMMAND (show_bihash_command)
static clib_error_t * show_bihash_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * plugin_path_config(vlib_main_t *vm, unformat_input_t *input)
void * realloc(void *p, size_t size)
#define clib_error_return(e, args...)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
void vhost_user_unmap_all(void)
void vl_msg_api_set_first_available_msg_id(u16 first_avail)
vlib_worker_thread_t * vlib_worker_threads
static void * clib_mem_set_per_numa_heap(void *new_heap)
char * vlib_plugin_app_version
#define VLIB_CONFIG_FUNCTION(x, n,...)
int vlib_unix_main(int argc, char *argv[])
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void vat_plugin_hash_create(void)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
u32 vlib_app_num_thread_stacks_needed(void)
static void vpe_main_init(vlib_main_t *vm)
__clib_export void ** clib_all_bihashes
#define vlib_worker_thread_barrier_sync(X)
static clib_error_t * srp_init(vlib_main_t *vm)
void vl_msg_api_barrier_release(void)
void clib_mem_destroy(void)
const char * barrier_context
static_always_inline void clib_mem_set_log2_default_hugepage_size(clib_mem_page_sz_t log2_page_sz)
#define VLIB_CLI_COMMAND(x,...)
__clib_export u32 clib_get_current_numa_node()
static void vlib_main_init()
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static clib_error_t * test_plugin_path_config(vlib_main_t *vm, unformat_input_t *input)
static clib_error_t * placeholder_path_config(vlib_main_t *vm, unformat_input_t *input)
#define vec_free(V)
Free vector's memory (no header).
int main(int argc, char *argv[])
static clib_error_t * heapsize_config(vlib_main_t *vm, unformat_input_t *input)
description fragment has unexpected format
#define vl_msg_api_barrier_trace_context(X)
void vlib_post_mortem_dump(void)
@ CLIB_MEM_PAGE_SZ_DEFAULT
static vlib_main_t * vlib_get_first_main(void)
void vl_msg_api_post_mortem_dump(void)
#define vlib_mark_init_function_complete(vm, x)
void vl_msg_api_barrier_sync(void)
static clib_error_t * memory_config(vlib_main_t *vm, unformat_input_t *input)
static void vpp_find_plugin_path()
void * clib_mem_init(void *base, uword size)
void * calloc(size_t nmemb, size_t size)
static vlib_main_t * vlib_get_main(void)
void * clib_mem_init_with_page_size(uword memory_size, clib_mem_page_sz_t log2_page_sz)
@ CLIB_MEM_PAGE_SZ_UNKNOWN
void vlib_unix_cli_set_prompt(char *prompt)
Set the CLI prompt.
char * vlib_default_runtime_dir