21 #include <sys/ioctl.h> 32 #define foreach_memif_input_error 36 #define _(f,s) MEMIF_INPUT_ERROR_##f, 63 s =
format (s,
"memif: hw_if_index %d next-index %d",
101 u16 mask = ring_size - 1;
115 _vec_len (nm->
rx_buffers[cpu_index]) = n_free_bufs;
125 num_slots = ring_size - rd->
last_head + head;
130 u32 next0 = next_index;
131 u32 next1 = next_index;
134 while (num_slots > 5 && n_left_to_next > 2)
163 bi1 = nm->
rx_buffers[cpu_index][last_buf - 1];
243 &next0, &next1, b0, b1);
248 bi0, bi1, next0, next1);
256 while (num_slots && n_left_to_next)
261 _vec_len (nm->
rx_buffers[cpu_index]) = last_buf;
304 n_left_to_next, bi0, next0);
329 u32 n_rx_packets = 0;
337 if (mif->flags & MEMIF_IF_FLAG_ADMIN_UP &&
338 mif->flags & MEMIF_IF_FLAG_CONNECTED &&
339 (mif->if_index % nm->input_cpu_count) ==
340 (cpu_index - nm->input_cpu_first_index))
342 if (mif->flags & MEMIF_IF_FLAG_IS_SLAVE)
344 memif_device_input_inline (vm, node, frame, mif,
348 memif_device_input_inline (vm, node, frame, mif,
360 .name =
"memif-input",
361 .sibling_of =
"device-input",
364 .state = VLIB_NODE_STATE_INTERRUPT,
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static u32 vlib_get_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt)
static u8 * format_memif_input_trace(u8 *s, va_list *args)
vnet_main_t * vnet_get_main(void)
vnet_interface_main_t interface_main
static_always_inline void * memif_get_buffer(memif_if_t *mif, memif_ring_t *ring, u16 slot)
#define CLIB_MEMORY_STORE_BARRIER()
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
static void vlib_trace_buffer(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, vlib_buffer_t *b, int follow_chain)
#define static_always_inline
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
vlib_combined_counter_main_t * combined_sw_if_counters
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
u32 per_interface_next_index
vlib_node_registration_t memif_input_node
(constructor) VLIB_REGISTER_NODE (memif_input_node)
u16 current_length
Nbytes between current data and the end of this buffer.
uword os_get_cpu_number(void)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static uword memif_input_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define foreach_memif_input_error
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
static_always_inline void vnet_feature_start_device_input_x2(u32 sw_if_index, u32 *next0, u32 *next1, vlib_buffer_t *b0, vlib_buffer_t *b1)
#define CLIB_PREFETCH(addr, size, type)
#define clib_memcpy(a, b, c)
static_always_inline uword memif_device_input_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, memif_if_t *mif, memif_ring_type_t type)
static_always_inline void memif_prefetch(vlib_main_t *vm, u32 bi)
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
static char * memif_input_error_strings[]
memif_ring_data_t * ring_data
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
static_always_inline memif_ring_t * memif_get_ring(memif_if_t *mif, memif_ring_type_t type, u16 ring_num)
static_always_inline void vnet_feature_start_device_input_x1(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
#define VLIB_REGISTER_NODE(x,...)
static void vlib_set_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt, u32 count)
#define CLIB_CACHE_LINE_BYTES
static u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
VLIB_NODE_FUNCTION_MULTIARCH(ethernet_input_not_l2_node, ethernet_input_not_l2)