|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
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",
61 clib_host_to_net_u16 (
a->first_msg_id),
62 clib_host_to_net_u16 (
a->last_msg_id));
80 u16 first_msg_id = ~0;
87 if (
am->msg_range_by_name == 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;
217 if (strstr ((
char *)
am->save_msg_table_filename,
"..")
218 ||
index ((
char *)
am->save_msg_table_filename,
'/'))
220 clib_warning (
"illegal save-message-table filename '%s'",
221 am->save_msg_table_filename);
225 chroot_file =
format (0,
"/tmp/%s%c",
am->save_msg_table_filename, 0);
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);
263 int private_segment_rotor = 0,
i,
rv;
269 f64 dead_client_scan_time;
270 f64 sleep_time, start_time;
274 uword *event_data = 0;
318 if (
am->save_msg_table_filename)
350 int index = SLEEP_400_US;
351 if (vector_rate > 40.0)
353 else if (vector_rate > 20.0)
355 index = SLEEP_200_US;
358 else if (vector_rate >= 1.0)
360 index = SLEEP_100_US;
380 if (private_segment_rotor >=
vec_len (
am->vlib_private_rps))
381 private_segment_rotor = 0;
424 if (
now > dead_client_scan_time)
438 .name =
"api-rx-from-ring",
439 .state = VLIB_NODE_STATE_DISABLED,
440 .process_log2_n_stack_bytes = 18,
449 ? VLIB_NODE_STATE_POLLING
450 : VLIB_NODE_STATE_DISABLED));
480 if (b0->
flags & VLIB_BUFFER_NEXT_PRESENT)
483 _vec_len (long_msg) = 0;
484 vec_add (long_msg, msg, msg_len);
485 while (b0->
flags & VLIB_BUFFER_NEXT_PRESENT)
490 vec_add (long_msg, msg, msg_len);
508 .name =
"api-rx-from-node",
515 vl_api_rpc_call_reply_t *rmp;
544 rmp->_vl_msg_id =
ntohs (VL_API_RPC_CALL_REPLY);
586 void (*call_fp) (
void *);
602 mp->_vl_msg_id =
ntohs (VL_API_RPC_CALL);
645 if (
am->replay_in_progress == 0)
651 clib_warning (
"WARNING: traced plugin '%s' not in current image",
659 clib_warning (
"WARNING: traced plugin '%s' first message id %d not %d",
666 clib_warning (
"WARNING: traced plugin '%s' last message id %d not %d",
672 #define foreach_rpc_api_msg \
673 _(RPC_CALL,rpc_call) \
674 _(RPC_CALL_REPLY,rpc_call_reply)
676 #define foreach_plugin_trace_msg \
677 _(TRACE_PLUGIN_MSG_IDS,trace_plugin_msg_ids)
695 vl_msg_api_set_handlers(VL_API_##N, #n, \
696 vl_api_##n##_t_handler, \
699 vl_api_##n##_t_print, \
700 sizeof(vl_api_##n##_t), 0 );
705 vl_msg_api_set_handlers(VL_API_##N, #n, \
706 vl_api_##n##_t_handler, \
709 vl_api_##n##_t_print, \
710 sizeof(vl_api_##n##_t), 1 );
715 am->is_mp_safe[VL_API_TRACE_PLUGIN_MSG_IDS] = 1;
static int vlib_api_init(void)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
u32 next_buffer
Next buffer for this linked-list of buffers.
vl_socket_args_for_process_t * process_args
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 vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
void vl_socket_process_api_msg(vl_api_registration_t *rp, i8 *input_v)
static vlib_node_registration_t api_rx_from_node_node
(constructor) VLIB_REGISTER_NODE (api_rx_from_node_node)
vl_api_module_version_t api_versions[count]
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
u8 * name
name of the plugin
void vl_api_send_pending_rpc_requests(vlib_main_t *vm)
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
int vl_mem_api_handle_msg_private(vlib_main_t *vm, vlib_node_runtime_t *node, u32 reg_index)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
void vl_api_save_msg_table(void)
static uword pointer_to_uword(const void *p)
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define VL_MEM_API_LOG_Q_LEN(fmt, qlen)
@ VLIB_NODE_TYPE_INTERNAL
clib_spinlock_t pending_rpc_lock
vlib_main_t vlib_node_runtime_t * node
#define foreach_plugin_trace_msg
struct _svm_queue svm_queue_t
#define vec_append(v1, v2)
Append v2 after v1.
Message configuration definition.
#define pool_put(P, E)
Free an object E in pool P.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
u16 last_msg_id
last assigned message ID
#define clib_error_report(e)
static void vl_api_rpc_call_t_handler(vl_api_rpc_call_t *mp)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
void vl_api_force_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
volatile u32 queue_signal_pending
clib_error_t * vat_builtin_main_init(vlib_main_t *vm)
static vlib_global_main_t * vlib_get_global_main(void)
void * vl_msg_api_alloc_as_if_client(int nbytes)
#define clib_unix_warning(format, args...)
void vl_api_api_versions_t_handler(vl_api_api_versions_t *mp)
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,...
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
socket_main_t socket_main
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
svm_queue_t * vl_api_client_index_to_input_queue(u32 index)
#define foreach_vlib_api_msg
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
vlib_node_registration_t vl_api_clnt_node
(constructor) VLIB_REGISTER_NODE (vl_api_clnt_node)
static u32 vlib_last_vectors_per_main_loop(vlib_main_t *vm)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
void vl_msg_api_handler_no_trace_no_free(void *the_msg)
int vl_mem_api_handle_rpc(vlib_main_t *vm, vlib_node_runtime_t *node)
int vl_mem_api_handle_msg_main(vlib_main_t *vm, vlib_node_runtime_t *node)
#define vlib_worker_thread_barrier_sync(X)
static_always_inline uword vlib_get_thread_index(void)
An API client registration, only in vpp/vlib.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static void vl_api_rpc_call_main_thread_inline(void *fp, u8 *data, u32 data_length, u8 force_rpc)
_vlib_init_function_list_elt_t * api_init_function_registrations
clib_error_t * vlib_call_init_exit_functions(vlib_main_t *vm, _vlib_init_function_list_elt_t **headp, int call_once, int is_global)
svm_queue_t * vl_input_queue
static void vl_api_rpc_call_reply_t_handler(vl_api_rpc_call_reply_t *mp)
u64 vector_rate_histogram[SLEEP_N_BUCKETS]
Fixed length block allocator. Pools are built from clib vectors and bitmaps. Use pools when repeatedl...
static api_main_t * vlibapi_get_main(void)
static uword api_rx_from_node(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u8 * vl_api_serialize_message_table(api_main_t *am, u8 *vector)
void vl_mem_api_enable_disable(vlib_main_t *vm, int enable)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define foreach_rpc_api_msg
uword * pending_rpc_requests
volatile u32 api_queue_nonempty
struct _vlib_node_registration vlib_node_registration_t
u16 current_length
Nbytes between current data and the end of this buffer.
clib_error_t * vl_sock_api_init(vlib_main_t *vm)
API main structure, used by both vpp and binary API clients.
#define hash_get_mem(h, key)
#define vec_free(V)
Free vector's memory (no header).
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...
description fragment has unexpected format
void vl_mem_api_dead_client_scan(api_main_t *am, vl_shmem_hdr_t *shm, f64 now)
Message range (belonging to a plugin)
static vlib_main_t * vlib_get_first_main(void)
static uword vl_api_clnt_process(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *f)
static vl_api_registration_t * vl_socket_get_registration(u32 reg_index)
u16 first_msg_id
first assigned message ID
u32 vl(void *p)
GDB callable function: vl - Return vector length of vector.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static vlib_main_t * vlib_get_main(void)
void vl_msg_api_send_shmem(svm_queue_t *q, u8 *elem)
VLIB_API_INIT_FUNCTION(rpc_api_hookup)
void * rpc_call_main_thread_cb_fn
#define uword_to_pointer(u, type)
#define vl_print(handle,...)
static void send_one_plugin_msg_ids_msg(u8 *name, u16 first_msg_id, u16 last_msg_id)
#define clib_warning(format, args...)
static f64 vlib_time_now(vlib_main_t *vm)
static void * vl_api_trace_plugin_msg_ids_t_print(vl_api_trace_plugin_msg_ids_t *a, void *handle)
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
static clib_error_t * rpc_api_hookup(vlib_main_t *vm)
static void vl_api_get_first_msg_id_t_handler(vl_api_get_first_msg_id_t *mp)
static void vl_api_trace_plugin_msg_ids_t_handler(vl_api_trace_plugin_msg_ids_t *mp)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
void * vl_msg_api_alloc(int nbytes)
#define VLIB_REGISTER_NODE(x,...)