41 #define TRACE_VLIB_MEMORY_QUEUE 0 50 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 59 vl_print (handle,
"vl_api_trace_plugin_msg_ids: %s first %u last %u\n",
80 u16 first_msg_id = ~0;
101 rmp->_vl_msg_id =
ntohs (VL_API_GET_FIRST_MSG_ID_REPLY);
115 int msg_size =
sizeof (*rmp) +
sizeof (rmp->
api_versions[0]) * nmsg;
124 rmp->_vl_msg_id =
ntohs (VL_API_API_VERSIONS_REPLY);
128 rmp->
count = htonl (nmsg);
130 for (i = 0; i < nmsg; ++
i)
145 #define foreach_vlib_api_msg \ 146 _(GET_FIRST_MSG_ID, get_first_msg_id) \ 147 _(API_VERSIONS, api_versions) 160 #define _(N,n) do { \ 161 c->id = VL_API_##N; \ 163 c->handler = vl_api_##n##_t_handler; \ 164 c->cleanup = vl_noop_handler; \ 165 c->endian = vl_api_##n##_t_endian; \ 166 c->print = vl_api_##n##_t_print; \ 167 c->size = sizeof(vl_api_##n##_t); \ 170 c->message_bounce = 0; \ 171 vl_msg_api_config(c);} while (0); 195 mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_TRACE_PLUGIN_MSG_IDS);
199 mp->
last_msg_id = clib_host_to_net_u16 (last_msg_id);
209 u8 *serialized_message_table;
220 clib_warning (
"illegal save-message-table filename '%s'",
227 fd = creat ((
char *) chroot_file, 0644);
237 rv = write (fd, serialized_message_table,
238 vec_len (serialized_message_table));
240 if (rv !=
vec_len (serialized_message_table))
248 vec_free (serialized_message_table);
262 int private_segment_rotor = 0,
i, rv;
268 f64 dead_client_scan_time;
269 f64 sleep_time, start_time;
273 uword *event_data = 0;
285 clib_warning (
"vlib_api_init returned %d, quitting...", rv);
349 int index = SLEEP_400_US;
350 if (vector_rate > 40.0)
352 else if (vector_rate > 20.0)
354 index = SLEEP_200_US;
357 else if (vector_rate >= 1.0)
359 index = SLEEP_100_US;
380 private_segment_rotor = 0;
423 if (now > dead_client_scan_time)
437 .name =
"api-rx-from-ring",
438 .state = VLIB_NODE_STATE_DISABLED,
439 .process_log2_n_stack_bytes = 18,
448 ? VLIB_NODE_STATE_POLLING
449 : VLIB_NODE_STATE_DISABLED));
465 while (n_left_from > 0)
479 if (b0->
flags & VLIB_BUFFER_NEXT_PRESENT)
482 _vec_len (long_msg) = 0;
483 vec_add (long_msg, msg, msg_len);
484 while (b0->
flags & VLIB_BUFFER_NEXT_PRESENT)
489 vec_add (long_msg, msg, msg_len);
507 .name =
"api-rx-from-node",
514 vl_api_rpc_call_reply_t *rmp;
543 rmp->_vl_msg_id =
ntohs (VL_API_RPC_CALL_REPLY);
585 void (*call_fp) (
void *);
601 mp->_vl_msg_id =
ntohs (VL_API_RPC_CALL);
650 clib_warning (
"WARNING: traced plugin '%s' not in current image",
658 clib_warning (
"WARNING: traced plugin '%s' first message id %d not %d",
665 clib_warning (
"WARNING: traced plugin '%s' last message id %d not %d",
671 #define foreach_rpc_api_msg \ 672 _(RPC_CALL,rpc_call) \ 673 _(RPC_CALL_REPLY,rpc_call_reply) 675 #define foreach_plugin_trace_msg \ 676 _(TRACE_PLUGIN_MSG_IDS,trace_plugin_msg_ids) 694 vl_msg_api_set_handlers(VL_API_##N, #n, \ 695 vl_api_##n##_t_handler, \ 698 vl_api_##n##_t_print, \ 699 sizeof(vl_api_##n##_t), 0 ); 704 vl_msg_api_set_handlers(VL_API_##N, #n, \ 705 vl_api_##n##_t_handler, \ 708 vl_api_##n##_t_print, \ 709 sizeof(vl_api_##n##_t), 1 ); 714 am->
is_mp_safe[VL_API_TRACE_PLUGIN_MSG_IDS] = 1;
#define foreach_vlib_api_msg
int vl_mem_api_handle_msg_private(vlib_main_t *vm, vlib_node_runtime_t *node, u32 reg_index)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Message range (belonging to a plugin)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
int vl_mem_api_handle_msg_main(vlib_main_t *vm, vlib_node_runtime_t *node)
uword * pending_rpc_requests
vlib_main_t vlib_global_main
static void send_one_plugin_msg_ids_msg(u8 *name, u16 first_msg_id, u16 last_msg_id)
VLIB_API_INIT_FUNCTION(rpc_api_hookup)
clib_error_t * vl_sock_api_init(vlib_main_t *vm)
void vl_msg_api_handler_no_trace_no_free(void *the_msg)
static void vl_api_rpc_call_main_thread_inline(void *fp, u8 *data, u32 data_length, u8 force_rpc)
void vl_api_save_msg_table(void)
u8 * name
name of the plugin
clib_spinlock_t pending_rpc_lock
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...
static void vl_api_get_first_msg_id_t_handler(vl_api_get_first_msg_id_t *mp)
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 void * vl_api_trace_plugin_msg_ids_t_print(vl_api_trace_plugin_msg_ids_t *a, void *handle)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
Fixed length block allocator.
#define clib_memcpy_fast(a, b, c)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static f64 vlib_time_now(vlib_main_t *vm)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
vl_socket_args_for_process_t * process_args
Message configuration definition.
u16 current_length
Nbytes between current data and the end of this buffer.
socket_main_t socket_main
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
api_version_t * api_version_list
api version list
void * vl_msg_api_alloc(int nbytes)
static u32 vlib_last_vectors_per_main_loop(vlib_main_t *vm)
#define VL_MEM_API_LOG_Q_LEN(fmt, qlen)
vlib_node_registration_t vl_api_clnt_node
(constructor) VLIB_REGISTER_NODE (vl_api_clnt_node)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
#define vlib_worker_thread_barrier_sync(X)
clib_error_t * vlib_call_init_exit_functions(vlib_main_t *vm, _vlib_init_function_list_elt_t **headp, int call_once)
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
static vl_api_registration_t * vl_socket_get_registration(u32 reg_index)
_vlib_init_function_list_elt_t * api_init_function_registrations
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...
static clib_error_t * rpc_api_hookup(vlib_main_t *vm)
void vl_mem_api_dead_client_scan(api_main_t *am, vl_shmem_hdr_t *shm, f64 now)
#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?
void vl_api_send_pending_rpc_requests(vlib_main_t *vm)
struct vl_shmem_hdr_ * shmem_hdr
Binary API shared-memory segment header pointer.
void vl_msg_api_send_shmem(svm_queue_t *q, u8 *elem)
static uword vl_api_clnt_process(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *f)
u16 last_msg_id
last assigned message ID
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void * rpc_call_main_thread_cb_fn
#define pool_put(P, E)
Free an object E in pool P.
svm_region_t ** vlib_private_rps
Vector of all mapped shared-VM segments.
clib_error_t * vat_builtin_main_init(vlib_main_t *vm)
volatile u32 queue_signal_pending
int vl_mem_api_handle_rpc(vlib_main_t *vm, vlib_node_runtime_t *node)
vl_api_module_version_t api_versions[count]
API main structure, used by both vpp and binary API clients.
static void vl_api_rpc_call_reply_t_handler(vl_api_rpc_call_reply_t *mp)
An API client registration, only in vpp/vlib.
The fine-grained event logger allows lightweight, thread-safe event logging at minimum cost...
#define VLIB_REGISTER_NODE(x,...)
static_always_inline uword vlib_get_thread_index(void)
static vlib_node_registration_t api_rx_from_node_node
(constructor) VLIB_REGISTER_NODE (api_rx_from_node_node)
svm_queue_t * vl_api_client_index_to_input_queue(u32 index)
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
vl_api_msg_range_t * msg_ranges
vector of message ranges
#define clib_warning(format, args...)
#define vl_print(handle,...)
u64 vector_rate_histogram[SLEEP_N_BUCKETS]
static void vl_api_rpc_call_t_handler(vl_api_rpc_call_t *mp)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
svm_queue_t * vl_input_queue
vlib_main_t vlib_node_runtime_t * node
u8 * save_msg_table_filename
Dump (msg-name, crc) snapshot here at startup.
#define uword_to_pointer(u, type)
#define foreach_rpc_api_msg
u8 * vl_api_serialize_message_table(api_main_t *am, u8 *vector)
#define clib_error_report(e)
#define vec_append(v1, v2)
Append v2 after v1.
void vl_api_api_versions_t_handler(vl_api_api_versions_t *mp)
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
static uword pointer_to_uword(const void *p)
static vlib_main_t * vlib_get_main(void)
#define foreach_plugin_trace_msg
u32 vl(void *p)
GDB callable function: vl - Return vector length of vector.
u16 first_msg_id
first assigned message ID
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 next_buffer
Next buffer for this linked-list of buffers.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define clib_unix_warning(format, args...)
volatile u32 api_queue_nonempty
struct _svm_queue svm_queue_t
static int vlib_api_init(void)
#define hash_get_mem(h, key)
static api_main_t * vlibapi_get_main(void)
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
u8 * is_mp_safe
Message is mp safe vector.
void vl_api_force_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
static void vl_api_trace_plugin_msg_ids_t_handler(vl_api_trace_plugin_msg_ids_t *mp)
static uword api_rx_from_node(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
void * vl_msg_api_alloc_as_if_client(int nbytes)
uword * msg_range_by_name
Message range by name hash.
void vl_mem_api_enable_disable(vlib_main_t *vm, int enable)
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
void vl_socket_process_api_msg(vl_api_registration_t *rp, i8 *input_v)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".