31 s =
format (s,
"SSVM_ETH_INPUT: sw_if_index %d, next index %d",
38 #define foreach_ssvm_eth_input_error \ 39 _(NO_BUFFERS, "Rx packet drops (no buffers)") 42 #define _(sym,str) SSVM_ETH_INPUT_ERROR_##sym, 49 #define _(sym,string) string, 76 u32 n_allocated, n_present_in_cache;
83 u32 n_left_to_next, * to_next;
89 u32 saved_cache_size = 0;
92 u32 n_rx_bytes = 0, l3_offset0;
118 while (__sync_lock_test_and_set (lock, 1))
120 while (q->cursize > 0)
139 n_present_in_cache += n_allocated;
148 while (n_buffers > 0)
152 while (n_buffers > 0 && n_left_to_next > 0)
154 elt = elts + intfc->
rx_queue[rx_queue_index];
156 saved_cache_size = n_present_in_cache;
162 saved_bi0 = bi0 = em->
buffer_cache [--n_present_in_cache];
198 saved_cache_size = n_present_in_cache;
200 to_next[0] = saved_bi0;
207 type0 = clib_net_to_host_u16 (eh0->
type);
211 if (type0 == ETHERNET_TYPE_IP4)
213 else if (type0 == ETHERNET_TYPE_IP6)
215 else if (type0 == ETHERNET_TYPE_MPLS_UNICAST)
255 to_next, n_left_to_next,
268 ASSERT (saved_cache_size == 0);
292 rx_queue_index, n_rx_bytes);
294 return rx_queue_index;
304 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)
always_inline void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
always_inline void vlib_set_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt, u32 count)
#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
always_inline void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
always_inline void ssvm_unlock(ssvm_shared_header_t *h)
vnet_main_t * vnet_get_main(void)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
always_inline u32 vlib_get_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt)
always_inline void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u32 packet_increment, u32 byte_increment)
always_inline void ssvm_lock(ssvm_shared_header_t *h, u32 my_pid, u32 tag)
always_inline vlib_buffer_free_list_t * vlib_buffer_get_free_list(vlib_main_t *vm, u32 free_list_index)
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 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)
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
#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
vhost_vring_state_t state
u32 next_buffer
Next buffer for this linked-list of buffers.
u32 clone_count
Specifies whether this buffer should be reinitialized when freed.
u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
always_inline void vlib_buffer_init_for_free_list(vlib_buffer_t *_dst, vlib_buffer_free_list_t *fl)
u8 data[SSVM_BUFFER_SIZE]
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
always_inline void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define VLIB_REGISTER_NODE(x,...)
#define vec_foreach(var, vec)
Vector iterator.
static char * ssvm_eth_input_error_strings[]
#define CLIB_MEMORY_BARRIER()
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
always_inline void vlib_trace_buffer(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, vlib_buffer_t *b, int follow_chain)
always_inline vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define foreach_ssvm_eth_input_error
struct _unix_shared_memory_queue unix_shared_memory_queue_t