|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
30 #ifndef CLIB_MARCH_VARIANT
42 "simulated network loss" :
"no space in ring");
44 s =
format (s,
"NSIM: tx time %.6f sw_if_index %d",
53 #define foreach_nsim_error \
54 _(BUFFERED, "Packets buffered") \
55 _(DROPPED, "Packets dropped due to lack of space") \
56 _(LOSS, "Network loss simulation drop packets") \
57 _(REORDERED, "Packets reordered")
61 #define _(sym,str) NSIM_ERROR_##sym,
67 #ifndef CLIB_MARCH_VARIANT
69 #define _(sym,string) string,
87 memset (
ctx->action, 0, n_actions * sizeof (
ctx->action[0]));
91 for (
i = 0;
i < n_actions;
i++)
93 ctx->action[
i] |= NSIM_ACTION_DROP;
98 for (
i = 0;
i < n_actions;
i++)
100 ctx->action[
i] |= NSIM_ACTION_REORDER;
108 if (
b->
flags & VLIB_BUFFER_IS_TRACED)
113 t->
is_lost =
ctx->action[0] & NSIM_ACTION_DROP;
122 if (is_cross_connect)
154 ctx->reord_nexts += 1;
170 ctx->n_buffered += 1;
190 int is_cross_connect)
212 ctx.reord = reorders;
213 ctx.reord_nexts = reorders_nexts;
230 is_cross_connect, is_trace);
232 is_cross_connect, is_trace);
234 is_cross_connect, is_trace);
236 is_cross_connect, is_trace);
249 || (
ctx.action[0] & NSIM_ACTION_DROP)
250 || (
ctx.action[0] & NSIM_ACTION_REORDER)))
253 is_cross_connect, is_trace);
271 u32 n_left_to_drop =
ctx.drop - drops;
276 n_left_to_drop -
ctx.n_loss);
280 u32 n_reordered =
ctx.reord - reorders;
287 NSIM_ERROR_BUFFERED,
ctx.n_buffered);
288 return frame->n_vectors;
303 #ifndef CLIB_MARCH_VARIANT
307 .vector_size =
sizeof (
u32),
337 #ifndef CLIB_MARCH_VARIANT
340 .name =
"nsim-output-feature",
341 .vector_size =
sizeof (
u32),
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)
vlib_buffer_t * bufs[VLIB_FRAME_SIZE]
static void nsim_set_actions(nsim_main_t *nsm, vlib_buffer_t **b, nsim_node_ctx_t *ctx, u32 n_actions)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
vlib_get_buffers(vm, from, b, n_left_from)
@ VLIB_NODE_TYPE_INTERNAL
vlib_main_t vlib_node_runtime_t * node
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
vlib_buffer_enqueue_to_next(vm, node, from,(u16 *) nexts, frame->n_vectors)
static f64 random_f64(u32 *seed)
Generate f64 random number in the interval [0,1].
static uword nsim_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_trace, int is_cross_connect)
static u8 * format_nsim_trace(u8 *s, va_list *args)
static char * nsim_error_strings[]
#define VLIB_NODE_FN(node)
#define VLIB_NODE_FLAG_TRACE
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
vlib_node_registration_t nsim_feature_node
(constructor) VLIB_REGISTER_NODE (nsim_feature_node)
#define foreach_nsim_error
struct _vlib_node_registration vlib_node_registration_t
static void nsim_trace_buffer(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_buffer_t *b, nsim_node_ctx_t *ctx, u32 is_drop)
static void nsim_dispatch_buffer(vlib_main_t *vm, vlib_node_runtime_t *node, nsim_main_t *nsm, nsim_wheel_t *wp, vlib_buffer_t *b, u32 bi, nsim_node_ctx_t *ctx, u8 is_cross_connect, u8 is_trace)
nsim_wheel_t ** wheel_by_thread
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
description fragment has unexpected format
static void nsim_buffer_fwd_lookup(nsim_main_t *nsm, vlib_buffer_t *b, u32 *next, u8 is_cross_connect)
nsim_wheel_entry_t * entries
vl_api_flow_action_t actions
static u32 slow_path(nat44_ei_main_t *nm, vlib_buffer_t *b0, ip4_header_t *ip0, ip4_address_t i2o_addr, u16 i2o_port, u32 rx_fib_index0, nat_protocol_t nat_proto, nat44_ei_session_t **sessionp, vlib_node_runtime_t *node, u32 next0, u32 thread_index, f64 now)
static_always_inline vnet_feature_config_main_t * vnet_feature_get_config_main(u16 arc)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static void * vnet_get_config_data(vnet_config_main_t *cm, u32 *config_index, u32 *next_index, u32 n_data_bytes)
static f64 vlib_time_now(vlib_main_t *vm)
vlib_node_registration_t nsim_node
(constructor) VLIB_REGISTER_NODE (nsim_node)
u32 * output_next_index_by_sw_if_index
vl_api_interface_index_t sw_if_index
vl_api_fib_path_type_t type
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)