24 #define foreach_netmap_input_error 27 #define _(f,s) NETMAP_INPUT_ERROR_##f, 58 s =
format (s,
"netmap: hw_if_index %d next-index %d",
60 s =
format (s,
"\n%Uslot: flags 0x%x len %u buf_idx %u",
84 struct rte_mbuf * mbuf = rte_mbuf_from_vlib_buffer(b);
85 struct rte_mbuf * first_mbuf = rte_mbuf_from_vlib_buffer(first_b);
86 struct rte_mbuf * prev_mbuf = rte_mbuf_from_vlib_buffer(prev_b);
87 first_mbuf->nb_segs++;
88 prev_mbuf->next = mbuf;
103 u32 n_rx_packets = 0;
124 while (cur_ring <= nif->last_rx_ring && n_free_bufs)
140 cur_slot_index = ring->
cur;
144 u32 next0 = next_index;
147 while (r && n_left_to_next)
151 u32 bi0 = 0, first_bi0 = 0, prev_bi0;
152 u32 next_slot_index = (cur_slot_index + 1) % ring->
num_slots;
153 u32 next2_slot_index = (cur_slot_index + 2) % ring->
num_slots;
163 while (data_len && n_free_bufs)
170 _vec_len (nm->
rx_buffers) = last_empty_buffer;
174 u32 bytes_to_copy = data_len > n_buffer_bytes ? n_buffer_bytes : data_len;
187 struct rte_mbuf * mb = rte_mbuf_from_vlib_buffer(b0);
201 offset += bytes_to_copy;
202 data_len -= bytes_to_copy;
219 n_left_to_next, first_bi0, next0);
223 n_rx_bytes += slot->
len;
224 to_next[0] = first_bi0;
227 cur_slot_index = next_slot_index;
233 ring->
head = ring->
cur = cur_slot_index;
245 n_rx_packets, n_rx_bytes);
255 u32 n_rx_packets = 0;
261 clib_bitmap_set (nm->pending_input_bitmap, i, 0);
262 n_rx_packets += netmap_device_input_fn(vm, node, frame, i);
271 .name =
"netmap-input",
274 .state = VLIB_NODE_STATE_INTERRUPT,
#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)
struct netmap_slot slot[0]
static uword netmap_input_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
sll srl srl sll sra u16x4 i
vlib_node_registration_t netmap_input_node
(constructor) VLIB_REGISTER_NODE (netmap_input_node)
#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)
always_inline void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
always_inline u32 vlib_buffer_free_list_buffer_size(vlib_main_t *vm, u32 free_list_index)
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)
u32 per_interface_next_index
#define VLIB_BUFFER_NEXT_PRESENT
#define NETMAP_RXRING(nifp, index)
static char * netmap_input_error_strings[]
#define clib_bitmap_foreach(i, ai, body)
#define pool_elt_at_index(p, i)
u16 current_length
Nbytes between current data and the end of this buffer.
uword os_get_cpu_number(void)
#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 CLIB_PREFETCH(addr, size, type)
#define clib_memcpy(a, b, c)
#define VLIB_BUFFER_TOTAL_LENGTH_VALID
#define VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX
netmap_main_t netmap_main
always_inline void buffer_add_to_chain(vlib_main_t *vm, u32 bi, u32 first_bi, u32 prev_bi)
u32 next_buffer
Next buffer for this linked-list of buffers.
u32 clone_count
Specifies whether this buffer should be reinitialized when freed.
static uint32_t nm_ring_space(struct netmap_ring *ring)
u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
u32 total_length_not_including_first_buffer
Only valid for first buffer in chain.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
always_inline void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
uword * pending_input_bitmap
#define VLIB_REGISTER_NODE(x,...)
always_inline uword netmap_device_input_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u32 device_idx)
#define foreach_netmap_input_error
#define CLIB_CACHE_LINE_BYTES
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 NETMAP_BUF(ring, index)
static u8 * format_netmap_input_trace(u8 *s, va_list *args)