|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
18 #include <sys/types.h>
21 #include <netinet/in.h>
74 u64 significant_errors = 0;
79 for (vm_index = 0; vm_index <
vec_len (
gm->my_vlib_mains); vm_index++)
81 this_vlib_main =
gm->my_vlib_mains[vm_index];
83 significant_errors += em->
counters[code] -
90 return (significant_errors);
98 *
gm->vpef_pid_ptr = getpid ();
110 u64 input_packets, last_input_packets, new_sig_errors;
111 f64 last_runtime, dt,
now;
116 last_input_packets = 0;
119 last_input_packets = 0;
130 vector_rate = vlib_last_vector_length_per_node (
vm);
131 *
gm->vector_rate_ptr = vector_rate;
133 dt =
now - last_runtime;
135 *
gm->input_rate_ptr = (
f64) (input_packets - last_input_packets) / dt;
137 last_input_packets = input_packets;
140 *
gm->sig_error_rate_ptr =
141 ((
f64) (new_sig_errors -
gm->last_sig_errors)) / dt;
142 gm->last_sig_errors = new_sig_errors;
152 .name =
"gmon-process",
176 ma->
uid =
am->api_uid;
177 ma->
gid =
am->api_gid;
184 "vpp_vector_rate", (
char *) v, sizeof (*v));
188 "vpp_input_rate", (
char *) v, sizeof (*v));
192 "vpp_sig_error_rate",
193 (
char *) v, sizeof (*v));
198 "vpp_pid", (
char *) swp, sizeof (*swp));
202 gm->vector_rate_ptr =
210 gm->sig_error_rate_ptr =
213 "vpp_sig_error_rate");
227 if (
gm->vector_rate_ptr)
229 *
gm->vector_rate_ptr = 0.0;
230 *
gm->vpef_pid_ptr = 0;
231 *
gm->input_rate_ptr = 0.0;
232 *
gm->sig_error_rate_ptr = 0.0;
248 return VNET_API_ERROR_NO_SUCH_ENTRY;
250 gm->sig_error_bitmap =
269 else if (
unformat (input,
"disable"))
285 (0,
"significant_error_enable_disable returned %d",
rv);
293 .path =
"set significant error",
294 .short_help =
"set significant error <counter-index-nnn> [disable]",
void svmdb_local_set_vec_variable(svmdb_client_t *client, char *var, void *val_arg, u32 elsize)
static clib_error_t * set_significant_error_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * publish_pid(vlib_main_t *vm)
void svm_region_unmap(void *rp_arg)
#define clib_error_return(e, args...)
static u64 get_significant_errors(gmon_main_t *gm)
vlib_error_main_t error_main
#define vlib_call_init_function(vm, x)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static clib_error_t * gmon_init(vlib_main_t *vm)
void * svmdb_local_get_variable_reference(svmdb_client_t *client, svmdb_namespace_t namespace, char *var)
static clib_error_t * gmon_exit(vlib_main_t *vm)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
svmdb_client_t * svmdb_client
Fixed length block allocator. Pools are built from clib vectors and bitmaps. Use pools when repeatedl...
static api_main_t * vlibapi_get_main(void)
vlib_main_t ** my_vlib_mains
sll srl srl sll sra u16x4 i
static uword gmon_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
#define VLIB_CLI_COMMAND(x,...)
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap.
VLIB_API_INIT_FUNCTION(publish_pid)
struct _vlib_node_registration vlib_node_registration_t
API main structure, used by both vpp and binary API clients.
#define vec_free(V)
Free vector's memory (no header).
static int significant_error_enable_disable(gmon_main_t *gm, u32 index, int enable)
u64 * counters_last_clear
static uword vlib_process_suspend(vlib_main_t *vm, f64 dt)
Suspend a vlib cooperative multi-tasking thread for a period of time.
svmdb_client_t * svmdb_map(svmdb_map_args_t *dba)
#define VLIB_INIT_FUNCTION(x)
clib_error_t * vpe_api_init(vlib_main_t *vm)
clib_error_t * vlibmemory_init(vlib_main_t *vm)
static vlib_cli_command_t set_significant_error_command
(constructor) VLIB_CLI_COMMAND (set_significant_error_command)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static u32 vlib_get_n_threads()
vnet_interface_output_runtime_t * rt
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
static f64 vlib_time_now(vlib_main_t *vm)
#define VLIB_MAIN_LOOP_EXIT_FUNCTION(x)
#define clib_bitmap_foreach(i, ai)
Macro to iterate across set bits in a bitmap.
static vlib_node_registration_t gmon_process_node
(constructor) VLIB_REGISTER_NODE (gmon_process_node)
static u64 vnet_get_aggregate_rx_packets(void)
#define VLIB_REGISTER_NODE(x,...)