33 s =
format (s,
"SSVM_ETH_INPUT: sw_if_index %d, next index %d",
40 #define foreach_ssvm_eth_input_error \ 41 _(NO_BUFFERS, "Rx packet drops (no buffers)") 45 #define _(sym,str) SSVM_ETH_INPUT_ERROR_##sym, 52 #define _(sym,string) string, 79 u32 n_allocated, n_present_in_cache;
86 u32 n_left_to_next, *to_next;
92 u32 saved_cache_size = 0;
95 u32 n_rx_bytes = 0, l3_offset0;
121 while (__sync_lock_test_and_set (lock, 1))
123 while (q->cursize > 0)
126 ASSERT (elt_index < 2048);
142 n_present_in_cache += n_allocated;
151 while (n_buffers > 0)
155 while (n_buffers > 0 && n_left_to_next > 0)
157 elt = elts + intfc->
rx_queue[rx_queue_index];
159 saved_cache_size = n_present_in_cache;
165 saved_bi0 = bi0 = em->
buffer_cache[--n_present_in_cache];
200 saved_cache_size = n_present_in_cache;
202 to_next[0] = saved_bi0;
209 type0 = clib_net_to_host_u16 (eh0->
type);
213 if (type0 == ETHERNET_TYPE_IP4)
215 else if (type0 == ETHERNET_TYPE_IP6)
217 else if (type0 == ETHERNET_TYPE_MPLS_UNICAST)
256 to_next, n_left_to_next,
269 ASSERT (saved_cache_size == 0);
294 return rx_queue_index;
303 uword n_rx_packets = 0;
316 .name =
"ssvm_eth_input",
317 .vector_size =
sizeof (
u32),
320 .
state = VLIB_NODE_STATE_DISABLED,
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
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.
VLIB_NODE_FUNCTION_MULTIARCH(ethernet_input_not_l2_node, ethernet_input_not_l2)
static u32 vlib_get_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt)
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define SSVM_BUFFER_NEXT_PRESENT
struct _vlib_node_registration vlib_node_registration_t
static u8 * format_ssvm_eth_input_trace(u8 *s, va_list *args)
ssvm_shared_header_t * sh
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static void vlib_trace_buffer(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, vlib_buffer_t *b, int follow_chain)
static void vlib_buffer_init_for_free_list(vlib_buffer_t *_dst, vlib_buffer_free_list_t *fl)
vnet_main_t * vnet_get_main(void)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vlib_node_registration_t ssvm_eth_input_node
(constructor) VLIB_REGISTER_NODE (ssvm_eth_input_node)
static uword pointer_to_uword(const void *p)
u16 current_length
Nbytes between current data and the end of this buffer.
static void ssvm_unlock(ssvm_shared_header_t *h)
static uword ssvm_eth_device_input(ssvm_eth_main_t *em, ssvm_private_t *intfc, vlib_node_runtime_t *node)
uword os_get_cpu_number(void)
int unix_shared_memory_queue_sub_raw(unix_shared_memory_queue_t *q, u8 *elem)
static uword ssvm_eth_input_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#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).
#define uword_to_pointer(u, type)
#define clib_memcpy(a, b, c)
#define VLIB_BUFFER_TOTAL_LENGTH_VALID
#define VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u32 packet_increment, u32 byte_increment)
Increment a combined counter.
vhost_vring_state_t state
u32 next_buffer
Next buffer for this linked-list of buffers.
u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
u8 data[SSVM_BUFFER_SIZE]
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
u32 total_length_not_including_first_buffer
Only valid for first buffer in chain.
ssvm_eth_main_t ssvm_eth_main
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u16 total_length_not_including_first_buffer
#define VLIB_REGISTER_NODE(x,...)
#define vec_foreach(var, vec)
Vector iterator.
static char * ssvm_eth_input_error_strings[]
#define CLIB_MEMORY_BARRIER()
static vlib_buffer_free_list_t * vlib_buffer_get_free_list(vlib_main_t *vm, u32 free_list_index)
static void vlib_set_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt, u32 count)
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static void ssvm_lock(ssvm_shared_header_t *h, u32 my_pid, u32 tag)
#define foreach_ssvm_eth_input_error
struct _unix_shared_memory_queue unix_shared_memory_queue_t