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;
82 u32 n_left_to_next, *to_next;
88 u32 saved_cache_size = 0;
91 u32 n_rx_bytes = 0, l3_offset0;
117 while (__sync_lock_test_and_set (lock, 1))
119 while (q->cursize > 0)
122 ASSERT (elt_index < 2048);
138 n_present_in_cache += n_allocated;
147 while (n_buffers > 0)
151 while (n_buffers > 0 && n_left_to_next > 0)
153 elt = elts + intfc->
rx_queue[rx_queue_index];
155 saved_cache_size = n_present_in_cache;
161 saved_bi0 = bi0 = em->
buffer_cache[--n_present_in_cache];
196 saved_cache_size = n_present_in_cache;
198 to_next[0] = saved_bi0;
205 type0 = clib_net_to_host_u16 (eh0->
type);
209 if (type0 == ETHERNET_TYPE_IP4)
211 else if (type0 == ETHERNET_TYPE_IP6)
213 else if (type0 == ETHERNET_TYPE_MPLS)
252 to_next, n_left_to_next,
265 ASSERT (saved_cache_size == 0);
292 return rx_queue_index;
301 uword n_rx_packets = 0;
314 .name =
"ssvm_eth_input",
315 .vector_size =
sizeof (
u32),
318 .
state = VLIB_NODE_STATE_DISABLED,
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static void vnet_device_increment_rx_packets(u32 thread_index, u64 count)
static u8 * format_ssvm_eth_input_trace(u8 *s, va_list *args)
static u32 vlib_get_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt)
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
vnet_main_t * vnet_get_main(void)
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
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.
#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
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)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define VLIB_BUFFER_TOTAL_LENGTH_VALID
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 void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX
int unix_shared_memory_queue_sub_raw(unix_shared_memory_queue_t *q, u8 *elem)
u32 node_index
Node index.
#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)
static_always_inline uword vlib_get_thread_index(void)
static char * ssvm_eth_input_error_strings[]
#define clib_memcpy(a, b, c)
vhost_vring_state_t state
u32 next_buffer
Next buffer for this linked-list of buffers.
#define foreach_ssvm_eth_input_error
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)
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
u16 total_length_not_including_first_buffer
static void vlib_buffer_init_for_free_list(vlib_buffer_t *dst, vlib_buffer_free_list_t *fl)
#define VLIB_REGISTER_NODE(x,...)
#define vec_foreach(var, vec)
Vector iterator.
static uword ssvm_eth_device_input(ssvm_eth_main_t *em, ssvm_private_t *intfc, vlib_node_runtime_t *node)
#define CLIB_MEMORY_BARRIER()
static vlib_buffer_free_list_t * vlib_buffer_get_free_list(vlib_main_t *vm, u32 free_list_index)
static uword ssvm_eth_input_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
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 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)
static void ssvm_lock(ssvm_shared_header_t *h, u32 my_pid, u32 tag)
struct _unix_shared_memory_queue unix_shared_memory_queue_t