26 #include <vpp/app/version.h> 41 char *p,
path[PATH_MAX];
46 if ((rv = readlink (
"/proc/self/exe", path, PATH_MAX - 1)) == -1)
53 if ((p = strrchr (path,
'/')) == 0)
58 if ((p = strrchr (path,
'/')) == 0)
62 s =
format (0,
"%s/lib/" CLIB_TARGET_TRIPLET
"/vpp_plugins:" 63 "%s/lib/vpp_plugins", path, path);
67 s =
format (0,
"%s/lib/" CLIB_TARGET_TRIPLET
"/vpp_api_test_plugins:" 68 "%s/lib/vpp_api_test_plugins", path, path);
70 vat_plugin_path = (
char *) s;
106 uword main_heap_size = (1ULL << 30);
115 =
"ERROR: This binary requires CPU with %s extensions.\n";
117 if (!clib_cpu_supports_ ## a ()) \ 119 fprintf(stderr, msg, b); \ 147 if ((argc == 3) && !strncmp (argv[1],
"-c", 2))
156 fp = fopen (argv[2],
"r");
159 fprintf (stderr,
"open configuration file '%s' failed\n", argv[2]);
162 argv_ = calloc (1,
sizeof (
char *));
168 arg = strndup (argv[0], 1024);
179 if (fgets (inbuf, 4096, fp) == 0)
181 p = strtok (inbuf,
" \t\n");
187 char **tmp = realloc (argv_, argc_ *
sizeof (
char *));
191 arg = strndup (p, 1024);
194 argv_[argc_ - 1] = arg;
195 p = strtok (NULL,
" \t\n");
201 char **tmp = realloc (argv_, (argc_ + 1) *
sizeof (
char *));
218 for (i = 1; i < (argc - 1); i++)
220 if (!strncmp (argv[i],
"plugin_path", 11))
225 if (!strncmp (argv[i],
"test_plugin_path", 16))
230 else if (!strncmp (argv[i],
"heapsize", 8))
232 sizep = (
u8 *) argv[i + 1];
234 while (*sizep >=
'0' && *sizep <=
'9')
237 size += *sizep++ -
'0';
243 "warning: heapsize parse error '%s', use default %lld\n",
244 argv[i], (
long long int) main_heap_size);
248 main_heap_size =
size;
250 if (*sizep ==
'g' || *sizep ==
'G')
251 main_heap_size <<= 30;
252 else if (*sizep ==
'm' || *sizep ==
'M')
253 main_heap_size <<= 20;
255 else if (!strncmp (argv[i],
"main-core", 9))
260 unsigned long x = strtol (argv[++i], 0, 0);
271 CPU_SET (main_core, &cpuset);
272 pthread_setaffinity_np (pthread_self (),
sizeof (cpu_set_t), &cpuset);
296 int rv __attribute__ ((unused)) =
297 write (2,
"Main heap allocation failure!\r\n", 31);
378 static int recursion_block;
395 #ifdef BARRIER_TRACING 444 return strcmp ((
char *) n1->
name, (
char *) n2->
name);
452 clib_bihash_8_8_t *
h;
453 u64 total_actual_virt_size = 0;
454 u64 total_configured_virt_size = 0;
455 u64 actual_virt_size;
456 u64 configured_virt_size;
467 if (alloc_arena (h) || verbose)
471 configured_virt_size = h->memory_size;
472 actual_virt_size = alloc_arena (h) ? h->memory_size : 0ULL;
473 this->actual_virt_size = actual_virt_size;
474 this->configured_virt_size = configured_virt_size;
475 total_actual_virt_size += actual_virt_size;
476 total_configured_virt_size += configured_virt_size;
484 for (i = 0; i <
vec_len (names); i++)
488 names[i].actual_virt_size,
504 .path =
"show bihash",
505 .short_help =
"show bihash",
510 #ifdef CLIB_SANITIZE_ADDR 513 __asan_default_options (
void)
516 "unmap_shadow_on_exit=1:disable_coredump=0:abort_on_error=1:detect_leaks=0";
int vlib_unix_main(int argc, char *argv[])
u32 vlib_app_num_thread_stacks_needed(void)
vlib_main_t vlib_global_main
static clib_error_t * srp_init(vlib_main_t *vm)
void vlib_unix_cli_set_prompt(char *prompt)
Set the CLI prompt.
void vl_msg_api_barrier_sync(void)
static clib_error_t * plugin_path_config(vlib_main_t *vm, unformat_input_t *input)
static clib_error_t * heapsize_config(vlib_main_t *vm, unformat_input_t *input)
#define vlib_mark_init_function_complete(vm, x)
void vhost_user_unmap_all(void)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
static clib_error_t * test_plugin_path_config(vlib_main_t *vm, unformat_input_t *input)
#define vl_msg_api_barrier_trace_context(X)
static clib_error_t * show_bihash_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vlib_worker_thread_barrier_sync(X)
char * vlib_default_runtime_dir
#define clib_error_return(e, args...)
void vl_msg_api_post_mortem_dump(void)
vlib_worker_thread_t * vlib_worker_threads
static int name_sort_cmp(void *a1, void *a2)
const char * barrier_context
#define VLIB_CONFIG_FUNCTION(x, n,...)
void elog_post_mortem_dump(void)
uword * init_functions_called
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
static clib_error_t * dummy_path_config(vlib_main_t *vm, unformat_input_t *input)
#define VLIB_CLI_COMMAND(x,...)
#define hash_create(elts, value_bytes)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
void vat_plugin_hash_create(void)
void vl_msg_api_barrier_release(void)
static void vpe_main_init(vlib_main_t *vm)
static vlib_main_t * vlib_get_main(void)
void vlib_get_thread_core_numa(vlib_worker_thread_t *w, unsigned cpu_id)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
static void vpp_find_plugin_path()
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
int main(int argc, char *argv[])
void ** clib_all_bihashes
char * vlib_plugin_app_version
void * clib_mem_init_thread_safe(void *memory, uword memory_size)
void vl_msg_api_set_first_available_msg_id(u16 first_avail)
static void * clib_mem_set_per_numa_heap(u8 *new_heap)