24 #include <sys/types.h> 49 #define TRACE_VLIB_MEMORY_QUEUE 0 58 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 66 vl_print (handle,
"vl_api_memclnt_create_t:\n");
77 vl_print (handle,
"vl_api_memclnt_delete_t:\n");
87 vl_print (handle,
"vl_api_trace_plugin_msg_ids: %s first %u last %u\n",
100 __attribute__ ((weak));
108 clib_warning (
"need to link against -lvlibsocket, msg not sent!");
139 serialize_likely_small_unsigned_integer (sm, hp->value[0]);
140 serialize_cstring (sm, (char *) hp->key);
165 pthread_mutex_lock (&svm->
mutex);
170 memset (regp, 0,
sizeof (*regp));
177 pthread_mutex_unlock (&svm->
mutex);
230 pthread_mutex_lock (&svm->
mutex);
235 memset (regp, 0,
sizeof (*regp));
245 pthread_mutex_unlock (&svm->
mutex);
251 rp->_vl_msg_id = ntohs (VL_API_MEMCLNT_CREATE_REPLY);
268 _vl_msg_api_function_list_elt_t *
i;
273 error = i->f (client_index);
276 i = i->next_init_function;
293 u32 handle, client_index, epoch;
306 (
"Stale clnt delete index %d old epoch %d cur epoch %d",
322 rp->_vl_msg_id = ntohs (VL_API_MEMCLNT_DELETE_REPLY);
341 pthread_mutex_lock (&svm->
mutex);
344 memset (regp, 0xF1,
sizeof (*regp));
346 pthread_mutex_unlock (&svm->
mutex);
364 u16 first_msg_id = ~0;
374 strncpy ((
char *) name, (
char *) mp->
name,
ARRAY_LEN (name) - 1);
388 rmp->_vl_msg_id = ntohs (VL_API_GET_FIRST_MSG_ID_REPLY);
395 #define foreach_vlib_api_msg \ 396 _(MEMCLNT_CREATE, memclnt_create) \ 397 _(MEMCLNT_DELETE, memclnt_delete) \ 398 _(GET_FIRST_MSG_ID, get_first_msg_id) 410 memset (c, 0,
sizeof (*c));
415 #define _(N,n) do { \ 416 c->id = VL_API_##N; \ 418 c->handler = vl_api_##n##_t_handler; \ 419 c->cleanup = vl_noop_handler; \ 420 c->endian = vl_api_##n##_t_endian; \ 421 c->print = vl_api_##n##_t_print; \ 422 c->size = sizeof(vl_api_##n##_t); \ 425 c->message_bounce = 0; \ 426 vl_msg_api_config(c);} while (0); 434 #define foreach_histogram_bucket \ 442 #define _(n) SLEEP_##n##_US, 464 memset (mp, 0,
sizeof (*mp));
466 mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_TRACE_PLUGIN_MSG_IDS);
470 mp->
last_msg_id = clib_host_to_net_u16 (last_msg_id);
487 f64 dead_client_scan_time;
488 f64 sleep_time, start_time;
491 u8 *serialized_message_table = 0;
499 clib_warning (
"memory_api_init returned %d, wait for godot...", rv);
532 pthread_mutex_lock (&svm->
mutex);
537 pthread_mutex_unlock (&svm->
mutex);
550 clib_warning (
"illegal save-message-table filename '%s'",
557 fd = creat ((
char *) chroot_file, 0644);
564 rv = write (fd, serialized_message_table,
565 vec_len (serialized_message_table));
567 if (rv != vec_len (serialized_message_table))
578 vec_free (serialized_message_table);
583 uword event_type __attribute__ ((unused));
601 pthread_mutex_lock (&q->mutex);
605 pthread_mutex_unlock (&q->mutex);
612 .format =
"q-underflow: len %d",
627 headp = (
i8 *) (q->data + sizeof (
uword) * q->head);
631 need_broadcast = (q->cursize == q->maxsize / 2);
636 pthread_mutex_unlock (&q->mutex);
638 (void) pthread_cond_broadcast (&q->condvar);
645 int index = SLEEP_400_US;
646 if (vector_rate > 40.0)
648 else if (vector_rate > 20.0)
650 index = SLEEP_200_US;
653 else if (vector_rate >= 1.0)
655 index = SLEEP_100_US;
663 vector_rate_histogram[index] += 1;
677 static u32 *dead_indices;
678 static u32 *confused_indices;
689 q = regp->vl_input_queue;
690 if (kill (q->consumer_pid, 0) < 0)
692 vec_add1(dead_indices, regpp - am->vl_clients);
697 clib_warning (
"NULL client registration index %d",
698 regpp - am->vl_clients);
699 vec_add1 (confused_indices, regpp - am->vl_clients);
707 for (i = 0; i <
vec_len (confused_indices); i++)
720 for (i = 0; i <
vec_len (dead_indices); i++)
734 pthread_mutex_lock (&svm->
mutex);
737 for (i = 0; i <
vec_len (dead_indices); i++)
743 memset (*regpp, 0xF3,
sizeof (**regpp));
759 pthread_mutex_unlock (&svm->
mutex);
761 for (i = 0; i <
vec_len (dead_indices); i++)
772 .format =
"q-awake: len %d",
781 ed->len = q->cursize;
791 .name =
"api-rx-from-ring",
792 .state = VLIB_NODE_STATE_DISABLED,
802 u64 total_counts = 0;
810 if (total_counts == 0)
819 percent = ((f64) vector_rate_histogram[SLEEP_##n##_US]) \ 820 / (f64) total_counts; \ 822 vlib_cli_output (vm, "Sleep %3d us: %llu, %.2f%%",n, \ 823 vector_rate_histogram[SLEEP_##n##_US], \ 838 .path =
"show api histogram",
839 .short_help =
"show api histogram",
862 .path =
"clear api histogram",
863 .short_help =
"clear api histogram",
871 static volatile int *cursizep;
885 cursizep = &q->cursize;
902 ? VLIB_NODE_STATE_POLLING
903 : VLIB_NODE_STATE_DISABLED));
919 while (n_left_from > 0)
936 _vec_len (long_msg) = 0;
937 vec_add (long_msg, msg, msg_len);
943 vec_add (long_msg, msg, msg_len);
961 .name =
"api-rx-from-node",
993 "Owner",
"Size",
"Nitems",
"Hits",
"Misses");
1017 (vm,
"%d application restarts, %d reclaimed msgs, %d garbage collects\n",
1024 __attribute__ ((weak));
1039 u32 *confused_indices = 0;
1042 goto socket_clients;
1045 "Name",
"PID",
"Queue Length",
"Queue VA",
"Health");
1054 q = regp->vl_input_queue;
1055 if (kill (q->consumer_pid, 0) < 0)
1063 vlib_cli_output (vm,
"%16s %8d %14d 0x%016llx %s\n",
1064 regp->name, q->consumer_pid, q->cursize,
1069 clib_warning (
"NULL client registration index %d",
1070 regpp - am->vl_clients);
1071 vec_add1 (confused_indices, regpp - am->vl_clients);
1080 for (i = 0; i <
vec_len (confused_indices); i++)
1135 .short_help =
"Show API information",
1145 .path =
"show api ring-stats",
1146 .short_help =
"Message ring statistics",
1157 .path =
"show api clients",
1158 .short_help =
"Client information",
1169 .path =
"show api trace-status",
1170 .short_help =
"Display API trace status",
1220 .path =
"show api message-table",
1221 .short_help =
"Message Table",
1238 else if (
unformat (input,
"tx nitems %u", &nitems)
1244 else if (
unformat (input,
"on rx"))
1248 else if (
unformat (input,
"on tx"))
1268 else if (
unformat (input,
"debug on"))
1272 else if (
unformat (input,
"debug off"))
1298 .path =
"set api-trace [on][on tx][on rx][off][free][debug on][debug off]",
1299 .short_help =
"API trace",
1310 memset (a, 0,
sizeof (*a));
1340 int len0, len1, clen;
1344 clen = len0 < len1 ? len0 : len1;
1345 return (strncmp ((
char *) a0->
name, (
char *) a1->
name, clen));
1354 s =
format (s,
"%-50s%9s%9s",
"Name",
"First-ID",
"Last-ID");
1384 for (i = 0; i <
vec_len (rp); i++)
1398 .path =
"show api plugin",
1399 .short_help =
"show api plugin",
1407 vl_api_rpc_call_reply_t *rmp;
1437 rmp->_vl_msg_id = ntohs (VL_API_RPC_CALL_REPLY);
1468 void (*call_fp) (
void *);
1482 memset (mp, 0,
sizeof (*mp));
1484 mp->_vl_msg_id = ntohs (VL_API_RPC_CALL);
1495 while (pthread_mutex_trylock (&q->mutex))
1500 pthread_mutex_unlock (&q->mutex);
1502 while (pthread_mutex_trylock (&q->mutex))
1508 pthread_mutex_unlock (&q->mutex);
1548 clib_warning (
"WARNING: traced plugin '%s' not in current image",
1556 clib_warning (
"WARNING: traced plugin '%s' first message id %d not %d",
1563 clib_warning (
"WARNING: traced plugin '%s' last message id %d not %d",
1569 #define foreach_rpc_api_msg \ 1570 _(RPC_CALL,rpc_call) \ 1571 _(RPC_CALL_REPLY,rpc_call_reply) 1573 #define foreach_plugin_trace_msg \ 1574 _(TRACE_PLUGIN_MSG_IDS,trace_plugin_msg_ids) 1592 vl_msg_api_set_handlers(VL_API_##N, #n, \ 1593 vl_api_##n##_t_handler, \ 1596 vl_api_##n##_t_print, \ 1597 sizeof(vl_api_##n##_t), 0 ); 1602 vl_msg_api_set_handlers(VL_API_##N, #n, \ 1603 vl_api_##n##_t_handler, \ 1606 vl_api_##n##_t_print, \ 1607 sizeof(vl_api_##n##_t), 1 ); 1612 am->
is_mp_safe[VL_API_TRACE_PLUGIN_MSG_IDS] = 1;
1639 trace_name =
"TX trace";
1644 trace_name =
"RX trace";
1653 s =
format (s,
"%s: not yet configured.\n", trace_name);
1657 s =
format (s,
"%s: used %d of %d items, %s enabled, %s wrapped\n",
1664 __attribute__ ((weak));
1672 u32 first_index,
u32 last_index,
1673 vl_api_replay_t which)
1675 vl_api_trace_file_header_t *hp;
1680 u8 endian_swap_needed = 0;
1684 void **saved_print_handlers = 0;
1686 fd = open ((
char *) filename, O_RDONLY);
1694 if (fstat (fd, &statb) < 0)
1701 if (!(statb.st_mode & S_IFREG) || (statb.st_size < sizeof (*hp)))
1708 file_size = statb.st_size;
1709 file_size = (file_size + 4095) & ~(4096);
1711 hp = mmap (0, file_size, PROT_READ, MAP_PRIVATE, fd, 0);
1713 if (hp == (vl_api_trace_file_header_t *) MAP_FAILED)
1723 endian_swap_needed = 1;
1725 if (endian_swap_needed)
1726 nitems = ntohl (hp->nitems);
1728 nitems = hp->nitems;
1730 if (last_index == (
u32) ~ 0)
1732 last_index = nitems - 1;
1735 if (first_index >= nitems || last_index >= nitems)
1738 first_index, last_index, nitems - 1);
1739 munmap (hp, file_size);
1744 "Note: wrapped/incomplete trace, results may vary\n");
1753 msg = (
u8 *) (hp + 1);
1755 for (i = 0; i < first_index; i++)
1761 size = clib_host_to_net_u32 (*(
u32 *) msg);
1762 msg +=
sizeof (
u32);
1765 msg_id = ntohs (*((
u16 *) msg));
1767 msg_id = *((
u16 *) msg);
1773 munmap (hp, file_size);
1782 for (; i <= last_index; i++)
1792 size = clib_host_to_net_u32 (*(
u32 *) msg);
1793 msg +=
sizeof (
u32);
1796 msg_id = ntohs (*((
u16 *) msg));
1798 msg_id = *((
u16 *) msg);
1804 munmap (hp, file_size);
1813 memset (tmpbuf, 0xf,
sizeof (
uword));
1823 void (*endian_fp) (
void *);
1828 munmap (hp, file_size);
1834 (*endian_fp) (tmpbuf +
sizeof (
uword));
1840 msg_idp = (
u16 *) (tmpbuf +
sizeof (
uword));
1851 u8 *(*print_fp) (
void *,
void *);
1854 (*print_fp) (tmpbuf +
sizeof (
uword), vm);
1870 u8 *(*print_fp) (
void *,
void *);
1876 (*print_fp) (tmpbuf +
sizeof (
uword), vm);
1879 s =
format (0,
"static u8 * vl_api_%s_%d[%d] = {",
1887 s =
format (s,
"0x%02x,", tmpbuf[
sizeof (
uword) + j]);
1889 s =
format (s,
"\n};\n%c", 0);
1899 void (*handler) (
void *);
1905 (*handler) (tmpbuf +
sizeof (
uword));
1919 _vec_len (tmpbuf) = 0;
1923 if (saved_print_handlers)
1930 munmap (hp, file_size);
1939 u32 nitems = 256 << 10;
1952 if (
unformat (input,
"nitems %d", &nitems))
1961 else if (
unformat (input,
"save %s", &filename))
1963 u8 *chroot_filename;
1964 if (strstr ((
char *) filename,
"..")
1965 || index ((
char *) filename,
'/'))
1972 chroot_filename =
format (0,
"/tmp/%s%c", filename, 0);
1976 fp = fopen ((
char *) chroot_filename,
"w");
1994 "Error while writing end of buffer trace to file\n");
1997 "Error while writing start of buffer trace to file\n");
2004 else if (
unformat (input,
"dump %s", &filename))
2008 else if (
unformat (input,
"custom-dump %s", &filename))
2012 else if (
unformat (input,
"replay %s", &filename))
2016 else if (
unformat (input,
"initializers %s", &filename))
2024 else if (
unformat (input,
"first %d", &first))
2028 else if (
unformat (input,
"last %d", &last))
2032 else if (
unformat (input,
"status"))
2042 else if (
unformat (input,
"post-mortem-on"))
2044 else if (
unformat (input,
"post-mortem-off"))
2060 .path =
"api trace",
2062 "api trace [on|off][dump|save|replay <file>][status][free][post-mortem-on]",
2070 u32 nitems = 256 << 10;
2078 if (
unformat (input,
"nitems %d", &nitems))
2084 else if (
unformat (input,
"save-api-table %s",
2110 if (
unformat (input,
"length %d", &nitems) ||
2111 (
unformat (input,
"len %d", &nitems)))
2116 clib_warning (
"vlib input queue length %d too small, ignored",
2151 for (i =
vec_len (rv) - 1; i >= 0; i--)
2201 int compare_current = 0;
2202 int numeric_sort = 0;
2205 u32 ndifferences = 0;
2209 if (
unformat (input,
"file %s", &filename))
2211 else if (
unformat (input,
"compare-current")
2213 compare_current = 1;
2214 else if (
unformat (input,
"numeric"))
2221 if (numeric_sort && compare_current)
2223 (0,
"Comparison and numeric sorting are incompatible");
2237 for (i = 0; i < nmsgs; i++)
2242 item->msg_index = msg_index;
2243 item->name_and_crc = name_and_crc;
2251 if (compare_current)
2259 for (i = 0; i < nmsgs; i++)
2265 item->msg_index = msg_index;
2266 item->name_and_crc = name_and_crc;
2279 if (compare_current)
2291 for (i = 0; i <
vec_len (table);)
2294 if (i == vec_len (table) - 1)
2302 ((
char *) table[i].name_and_crc,
2303 (
char *) table[i + 1].name_and_crc,
2304 vec_len (table[i].name_and_crc)))
2313 if (strncmp ((
char *) table[i].name, (
char *) table[i + 1].name,
2314 vec_len (table[i].name)))
2318 table[i].name, table[i].which ?
2327 if (ndifferences == 0)
2336 vlib_cli_output (vm,
"%=60s %=8s %=10s",
"Message name",
"MsgID",
"CRC");
2338 for (i = 0; i <
vec_len (table); i++)
2342 item->msg_index, item->crc);
2346 for (i = 0; i <
vec_len (table); i++)
2393 .path =
"show api dump",
2394 .short_help =
"show api dump file <filename> [numeric | compare-current]",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Message range (belonging to a plugin)
void vl_set_memory_region_name(const char *name)
static int table_id_cmp(void *a1, void *a2)
void * vl_msg_api_alloc_as_if_client(int nbytes)
#define TRACE_VLIB_MEMORY_QUEUE
#define vl_print(handle,...)
static int memory_api_init(const char *region_name)
#define SVM_GLOBAL_REGION_NAME
sll srl srl sll sra u16x4 i
void vl_api_memclnt_delete_t_handler(vl_api_memclnt_delete_t *mp)
u8 * name
name of the plugin
static void svm_pop_heap(void *oldheap)
static u64 unserialize_likely_small_unsigned_integer(serialize_main_t *m)
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
int unix_shared_memory_queue_is_full(unix_shared_memory_queue_t *q)
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
static clib_error_t * api_queue_config_fn(vlib_main_t *vm, unformat_input_t *input)
static clib_error_t * setup_memclnt_exit(vlib_main_t *vm)
u8 wrapped
trace has wrapped
int size
for sanity checking
Fixed length block allocator.
unix_shared_memory_queue_t * vl_input_queue
static vlib_node_registration_t api_rx_from_node_node
(constructor) VLIB_REGISTER_NODE (api_rx_from_node_node)
static f64 vlib_time_now(vlib_main_t *vm)
static clib_error_t * vl_api_client_command(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cli_cmd)
u8 * message_bounce
Don't automatically free message buffer vetor.
Message configuration definition.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static void vl_api_trace_plugin_msg_ids_t_handler(vl_api_trace_plugin_msg_ids_t *mp)
static clib_error_t * vl_api_message_table_command(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cli_cmd)
static clib_error_t * vl_api_show_plugin_command(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cli_cmd)
static heap_elt_t * last(heap_header_t *h)
#define SVM_PVT_MHEAP_SIZE
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
int api_uid
uid for the api shared memory region
static clib_error_t * api_config_fn(vlib_main_t *vm, unformat_input_t *input)
ring_alloc_t * client_rings
static clib_error_t * vl_api_clear_histogram_command(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cli_cmd)
void vl_msg_api_send(vl_api_registration_t *rp, u8 *elem)
#define pool_is_free(P, E)
Use free bitmap to query whether given element is free.
static void vl_api_rpc_call_reply_t_handler(vl_api_rpc_call_reply_t *mp)
void vl_api_get_first_msg_id_t_handler(vl_api_get_first_msg_id_t *mp)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
int api_gid
gid for the api shared memory region
static clib_error_t * dump_api_table_file_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void vl_enable_disable_memory_api(vlib_main_t *vm, int enable)
#define VL_API_EPOCH_MASK
trace_cfg_t * api_trace_cfg
Current trace configuration.
static vlib_cli_command_t cli_show_api_clients_command
(constructor) VLIB_CLI_COMMAND (cli_show_api_clients_command)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
#define vlib_worker_thread_barrier_sync(X)
_vl_msg_api_function_list_elt_t * reaper_function_registrations
List of API client reaper functions.
void vl_msg_api_custom_dump_configure(api_main_t *am)
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
static f64 vlib_last_vector_length_per_node(vlib_main_t *vm)
static void vlib_worker_thread_barrier_check(void)
static uword vlib_process_suspend(vlib_main_t *vm, f64 dt)
Suspend a vlib cooperative multi-tasking thread for a period of time.
#define VLIB_BUFFER_NEXT_PRESENT
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
_vlib_init_function_list_elt_t * api_init_function_registrations
static vlib_cli_command_t cli_show_api_status_command
(constructor) VLIB_CLI_COMMAND (cli_show_api_status_command)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
static int range_compare(vl_api_msg_range_t *a0, vl_api_msg_range_t *a1)
vl_api_trace_t * rx_trace
Received message trace configuration.
#define VLIB_INIT_FUNCTION(x)
clib_error_t * unserialize_open_unix_file(serialize_main_t *m, char *file)
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type...
void vl_msg_api_handler_no_trace_no_free(void *the_msg)
u32 ring_misses
Number of times that the ring allocator failed.
static void * svm_push_data_heap(svm_region_t *rp)
vl_api_registration_t ** vl_clients
vlib/vpp only: vector of client registrations
static vlib_cli_command_t cli_show_api_message_table_command
(constructor) VLIB_CLI_COMMAND (cli_show_api_message_table_command)
#define clib_arch_is_little_endian
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
int replay_in_progress
Replay in progress?
static void send_one_plugin_msg_ids_msg(u8 *name, u16 first_msg_id, u16 last_msg_id)
const char * root_path
Chroot path to the shared memory API files.
#define clib_error_return(e, args...)
svm_region_t * vlib_rp
Binary api segment descriptor.
clib_error_t * vlib_call_init_exit_functions(vlib_main_t *vm, _vlib_init_function_list_elt_t *head, int call_once)
static clib_error_t * api_trace_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define SVM_GLOBAL_REGION_BASEVA
struct vl_shmem_hdr_ * shmem_hdr
Binary API shared-memory segment header pointer.
static void * vl_api_memclnt_create_t_print(vl_api_memclnt_create_t *a, void *handle)
void vl_socket_api_send(vl_api_registration_t *rp, u8 *elem)
#define foreach_plugin_trace_msg
static uword pointer_to_uword(const void *p)
void * vl_msg_api_alloc(int nbytes)
static void memclnt_queue_callback(vlib_main_t *vm)
static void vlib_set_queue_signal_callback(vlib_main_t *vm, void(*fp)(vlib_main_t *))
vl_shmem_hdr_t * shmem_hdr
static heap_elt_t * first(heap_header_t *h)
void * rpc_call_main_thread_cb_fn
int vl_msg_api_trace_free(api_main_t *am, vl_api_trace_which_t which)
vl_registration_type_t registration_type
type
static vlib_cli_command_t api_trace_command
(constructor) VLIB_CLI_COMMAND (api_trace_command)
u16 last_msg_id
last assigned message ID
static void * vl_api_trace_plugin_msg_ids_t_print(vl_api_trace_plugin_msg_ids_t *a, void *handle)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define foreach_rpc_api_msg
static vlib_node_registration_t memclnt_node
(constructor) VLIB_REGISTER_NODE (memclnt_node)
static clib_error_t * vl_api_ring_command(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cli_cmd)
u16 current_length
Nbytes between current data and the end of this buffer.
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
static int call_reaper_functions(u32 client_index)
void(** msg_print_handlers)(void *, void *)
Message print function vector.
int replay_enable
This message can be replayed.
static vlib_cli_command_t cli_show_api_ring_command
(constructor) VLIB_CLI_COMMAND (cli_show_api_ring_command)
void vl_msg_api_free(void *)
#define vec_dup(V)
Return copy of vector (no header, no alignment)
static void cleanup(void)
#define VLIB_CONFIG_FUNCTION(x, n,...)
void svm_region_init_args(svm_map_region_args_t *a)
void vl_msg_api_barrier_sync(void)
static void vl_api_rpc_call_t_handler(vl_api_rpc_call_t *mp)
#define SVM_GLOBAL_REGION_SIZE
static u32 vl_msg_api_handle_get_index(u32 index)
#define foreach_vlib_api_msg
void vl_msg_api_handler_with_vm_node(api_main_t *am, void *the_msg, vlib_main_t *vm, vlib_node_runtime_t *node)
volatile u32 queue_signal_pending
void unserialize_cstring(serialize_main_t *m, char **s)
#define uword_to_pointer(u, type)
API main structure, used by both vpp and binary API clients.
int vl_msg_api_trace_save(api_main_t *am, vl_api_trace_which_t which, FILE *fp)
u64 global_size
size of the global VM region
void vl_api_force_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
u8 enabled
trace is enabled
An API client registration, only in vpp/vlib.
The fine-grained event logger allows lightweight, thread-safe event logging at minimum cost...
#define clib_arch_is_big_endian
int vl_msg_api_trace_onoff(api_main_t *am, vl_api_trace_which_t which, int onoff)
static void vl_api_rpc_call_main_thread_inline(void *fp, u8 *data, u32 data_length, u8 force_rpc)
static_always_inline uword vlib_get_thread_index(void)
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
void serialize_open_vector(serialize_main_t *m, u8 *vector)
void vl_unmap_shmem(void)
u64 global_baseva
base virtual address for global VM region
#define vec_free(V)
Free vector's memory (no header).
unix_shared_memory_queue_t * vl_input_queue
shared memory only: pointer to client input queue
vl_api_msg_range_t * msg_ranges
vector of message ranges
#define clib_warning(format, args...)
#define clib_memcpy(a, b, c)
#define foreach_histogram_bucket
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
static void unserialize_integer(serialize_main_t *m, void *x, u32 n_bytes)
static void serialize_integer(serialize_main_t *m, u64 x, u32 n_bytes)
#define ELOG_TYPE_DECLARE(f)
const char ** msg_names
Message name vector.
void vl_msg_api_barrier_release(void)
static vlib_cli_command_t cli_show_api_command
(constructor) VLIB_CLI_COMMAND (cli_show_api_command)
static clib_error_t * vl_api_trace_command(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cli_cmd)
static void vl_msg_api_process_file(vlib_main_t *vm, u8 *filename, u32 first_index, u32 last_index, vl_api_replay_t which)
#define VLIB_CLI_COMMAND(x,...)
u8 * save_msg_table_filename
Dump (msg-name, crc) snapshot here at startup.
#define VL_API_BIG_ENDIAN
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
vl_api_trace_t * tx_trace
Sent message trace configuration.
static uword api_rx_from_node(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static vlib_cli_command_t cli_show_api_plugin_command
(constructor) VLIB_CLI_COMMAND (cli_show_api_plugin_command)
#define pool_put_index(p, i)
Free pool element with given index.
static uword hash_elts(void *v)
clib_error_t * vlibmemory_init(vlib_main_t *vm)
#define VL_API_LITTLE_ENDIAN
#define vec_delete(V, N, M)
Delete N elements starting at element M.
static u64 vector_rate_histogram[SLEEP_N_BUCKETS]
static uword memclnt_process(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *f)
void serialize_close(serialize_main_t *m)
VLIB_API_INIT_FUNCTION(rpc_api_hookup)
u8 * vl_api_serialize_message_table(api_main_t *am, u8 *vector)
u32 next_buffer
Next buffer for this linked-list of buffers.
static void clib_mem_free(void *p)
static u8 * extract_name(u8 *s)
u8 * serialized_message_table_in_shmem
vlib/vpp only: serialized (message, name, crc) table
#define clib_error_report(e)
static void * vlib_frame_args(vlib_frame_t *f)
Get pointer to frame scalar data.
void dump_socket_clients(vlib_main_t *vm, api_main_t *am)
u64 global_pvt_heap_size
size of the global VM private mheap
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
static void * clib_mem_alloc(uword size)
static u8 * format_api_msg_range(u8 *s, va_list *args)
static vlib_main_t * vlib_get_main(void)
static clib_error_t * rpc_api_hookup(vlib_main_t *vm)
static clib_error_t * vl_api_status_command(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cli_cmd)
u32 missing_clients
Number of missing clients / failed message sends.
void vl_msg_api_post_mortem_dump_enable_disable(int enable)
u16 first_msg_id
first assigned message ID
void vl_msg_api_send_shmem_nolock(unix_shared_memory_queue_t *q, u8 *elem)
void vl_api_memclnt_create_t_handler(vl_api_memclnt_create_t *mp)
void(** msg_endian_handlers)(void *)
Message endian handler vector.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
static u8 * extract_crc(u8 *s)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
#define clib_unix_warning(format, args...)
u8 * format_vl_msg_api_trace_status(u8 *s, va_list *args)
u32 vl_api_registration_pool_index
Index in VLIB's brain (not shared memory).
void svm_client_scan_this_region_nolock(svm_region_t *rp)
static clib_error_t * vl_api_show_histogram_command(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cli_cmd)
volatile u32 api_queue_nonempty
#define hash_get_mem(h, key)
void(** msg_handlers)(void *)
Message handler vector.
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
u8 * is_mp_safe
Message is mp safe vector.
#define VLIB_REGISTER_NODE(x,...)
static int table_name_and_crc_cmp(void *a1, void *a2)
int msg_print_flag
Print every received message.
static vlib_cli_command_t dump_api_table_file
(constructor) VLIB_CLI_COMMAND (dump_api_table_file)
void * serialize_close_vector(serialize_main_t *m)
static void * vl_api_memclnt_delete_t_print(vl_api_memclnt_delete_t *a, void *handle)
vl_api_trace_which_t
Trace RX / TX enum.
const char * region_name
Shared VM binary API region name.
Trace configuration for a single message.
static u32 vl_msg_api_handle_get_epoch(u32 index)
int vl_map_shmem(const char *region_name, int is_vlib)
u32 vl_api_memclnt_create_internal(char *name, unix_shared_memory_queue_t *q)
uword * msg_index_by_name_and_crc
client message index hash table
int vl_msg_api_trace_configure(api_main_t *am, vl_api_trace_which_t which, u32 nitems)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
uword * msg_range_by_name
Message range by name hash.
Shared memory connection.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
u32 nitems
Number of trace records.
u32 vlib_input_queue_length
vpp/vlib input queue length
static u32 vl_msg_api_handle_from_index_and_epoch(u32 index, u32 epoch)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".
struct _unix_shared_memory_queue unix_shared_memory_queue_t
static uword pool_elts(void *v)
Number of active elements in a pool.