31 #ifndef CLIB_MULTIARCH_VARIANT 45 if (
PREDICT_TRUE ((mb->ol_flags & PKT_RX_IP_CKSUM_GOOD) != 0))
62 if (mb->ol_flags & PKT_RX_IP_CKSUM_BAD)
64 *error = DPDK_ERROR_IP_CHECKSUM_ERROR;
68 *error = DPDK_ERROR_NONE;
103 n_this_chunk = rte_eth_rx_burst (xd->
device_index, queue_id,
106 n_buffers += n_this_chunk;
107 n_left -= n_this_chunk;
110 if (n_this_chunk < 32)
127 struct rte_mbuf *mb_seg = 0;
135 b->
flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
138 while (nb_seg < mb->nb_segs)
145 ASSERT ((b_seg->
flags & VLIB_BUFFER_NEXT_PRESENT) == 0);
153 (mb_seg->buf_addr + mb_seg->data_off) - (
void *) b_seg->
data;
158 b_chain->
flags |= VLIB_BUFFER_NEXT_PRESENT;
162 mb_seg = mb_seg->next;
190 int maybe_multiseg,
u32 n_trace)
194 u32 n_left_to_next, *to_next;
197 uword n_rx_bytes = 0;
222 while (n_buffers > 0)
229 u8 error0, error1, error2, error3;
230 i16 offset0, offset1, offset2, offset3;
235 while (n_buffers >= 12 && n_left_to_next >= 4)
237 struct rte_mbuf *mb0, *mb1, *mb2, *mb3;
302 or_ol_flags = (mb0->ol_flags | mb1->ol_flags |
303 mb2->ol_flags | mb3->ol_flags);
321 b0->
current_data = mb0->data_off + offset0 - RTE_PKTMBUF_HEADROOM;
325 mb0->data_off - RTE_PKTMBUF_HEADROOM;
327 n_rx_bytes += mb0->pkt_len;
330 b1->
current_data = mb1->data_off + offset1 - RTE_PKTMBUF_HEADROOM;
334 mb1->data_off - RTE_PKTMBUF_HEADROOM;
336 n_rx_bytes += mb1->pkt_len;
339 b2->
current_data = mb2->data_off + offset2 - RTE_PKTMBUF_HEADROOM;
343 mb2->data_off - RTE_PKTMBUF_HEADROOM;
345 n_rx_bytes += mb2->pkt_len;
348 b3->
current_data = mb3->data_off + offset3 - RTE_PKTMBUF_HEADROOM;
352 mb3->data_off - RTE_PKTMBUF_HEADROOM;
354 n_rx_bytes += mb3->pkt_len;
378 &next0, &next1, &next2, &next3,
382 to_next, n_left_to_next,
384 next0, next1, next2, next3);
409 while (n_buffers > 0 && n_left_to_next > 0)
411 struct rte_mbuf *mb0 = xd->
rx_vectors[queue_id][mb_index];
447 b0->
current_data = mb0->data_off + offset0 - RTE_PKTMBUF_HEADROOM;
451 mb0->data_off - RTE_PKTMBUF_HEADROOM;
453 n_rx_bytes += mb0->pkt_len;
470 to_next, n_left_to_next,
497 u16 queue_id,
u32 n_trace)
513 struct timespec ts, tsrem;
518 while (nanosleep (&ts, &tsrem) < 0)
572 uword n_rx_packets = 0;
575 u32 thread_index = node->thread_index;
593 dq->queue_id, n_trace);
594 n_rx_packets += n_tr_packets;
596 n_trace -
clib_min(n_trace, n_tr_packets));
606 #ifndef CLIB_MULTIARCH_VARIANT 611 .name =
"dpdk-input",
612 .sibling_of =
"device-input",
615 .state = VLIB_NODE_STATE_DISABLED,
629 static void __clib_constructor
static void vnet_device_increment_rx_packets(u32 thread_index, u64 count)
#define vlib_buffer_from_rte_mbuf(x)
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)
#define foreach_dpdk_error
static_always_inline void vnet_feature_start_device_input_x4(u32 sw_if_index, u32 *next0, u32 *next1, u32 *next2, u32 *next3, vlib_buffer_t *b0, vlib_buffer_t *b1, vlib_buffer_t *b2, vlib_buffer_t *b3)
u8 buffer_pool_index
index of buffer pool this buffer belongs.
#define vlib_validate_buffer_enqueue_x4(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, bi2, bi3, next0, next1, next2, next3)
Finish enqueueing four buffers forward in the graph.
u32 per_interface_next_index
#define STRUCT_OFFSET_OF(t, f)
vlib_buffer_t * buffer_templates
vlib_error_t * errors
Vector of errors for this node.
#define DPDK_DEVICE_FLAG_PMD
vlib_node_function_t __clib_weak dpdk_input_avx2
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 static_always_inline
vlib_node_function_t __clib_weak dpdk_input_avx512
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
u8 pre_data[VLIB_BUFFER_PRE_DATA_SIZE]
Space for inserting data before buffer start.
#define DPDK_DEVICE_FLAG_MAYBE_MULTISEG
static u32 vlib_get_buffer_index(vlib_main_t *vm, void *p)
Translate buffer pointer into buffer index.
static void poll_rate_limit(dpdk_main_t *dm)
static u32 dpdk_rx_burst(dpdk_main_t *dm, dpdk_device_t *xd, u16 queue_id)
const u32 device_input_next_node_advance[((VNET_DEVICE_INPUT_N_NEXT_NODES/CLIB_CACHE_LINE_BYTES)+1)*CLIB_CACHE_LINE_BYTES]
format_function_t format_dpdk_rx_dma_trace
static_always_inline void dpdk_process_subseq_segs(vlib_main_t *vm, vlib_buffer_t *b, struct rte_mbuf *mb, vlib_buffer_free_list_t *fl)
u16 current_length
Nbytes between current data and the end of this buffer.
static_always_inline void dpdk_prefetch_ethertype(struct rte_mbuf *mb)
#define VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX
static void __clib_constructor dpdk_input_multiarch_select(void)
#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).
uword( vlib_node_function_t)(struct vlib_main_t *vm, struct vlib_node_runtime_t *node, struct vlib_frame_t *frame)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static char * dpdk_error_strings[]
#define DPDK_DEVICE_FLAG_ADMIN_UP
u8 * format_ethernet_header_with_length(u8 *s, va_list *args)
#define VLIB_REGISTER_NODE(x,...)
static u32 dpdk_rx_next_from_etype(struct rte_mbuf *mb)
#define CLIB_PREFETCH(addr, size, type)
struct rte_mbuf *** rx_vectors
static_always_inline void clib_memcpy64_x4(void *d0, void *d1, void *d2, void *d3, void *s)
vlib_node_registration_t dpdk_input_node
(constructor) VLIB_REGISTER_NODE (dpdk_input_node)
#define clib_memcpy(a, b, c)
const u32 device_input_next_node_flags[((VNET_DEVICE_INPUT_N_NEXT_NODES/CLIB_CACHE_LINE_BYTES)+1)*CLIB_CACHE_LINE_BYTES]
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.
uword CLIB_MULTIARCH_FN() dpdk_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *f)
Main DPDK input node.
static void dpdk_rx_error_from_mb(struct rte_mbuf *mb, u32 *next, u8 *error)
u32 next_buffer
Next buffer for this linked-list of buffers.
static_always_inline u32 dpdk_device_input_mseg(dpdk_main_t *dm, dpdk_device_t *xd, vlib_node_runtime_t *node, u32 thread_index, u16 queue_id, u32 n_trace)
dpdk_portid_t device_index
static vlib_main_t * vlib_get_main(void)
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.
#define foreach_device_and_queue(var, vec)
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
#define DPDK_DEVICE_FLAG_BOND_SLAVE
static_always_inline void dpdk_add_trace(vlib_main_t *vm, vlib_node_runtime_t *node, u32 next, dpdk_device_t *xd, u16 queue_id, vlib_buffer_t *b, struct rte_mbuf *mb)
static void vlib_buffer_init_for_free_list(vlib_buffer_t *dst, vlib_buffer_free_list_t *fl)
static_always_inline void vnet_feature_start_device_input_x1(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
static vlib_buffer_free_list_t * vlib_buffer_get_free_list(vlib_main_t *vm, vlib_buffer_free_list_index_t free_list_index)
static void vlib_set_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt, u32 count)
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static_always_inline void dpdk_prefetch_buffer(struct rte_mbuf *mb)
u8 * buffer_pool_for_queue
static_always_inline u32 dpdk_device_input(dpdk_main_t *dm, dpdk_device_t *xd, vlib_node_runtime_t *node, u32 thread_index, u16 queue_id, int maybe_multiseg, u32 n_trace)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".
#define CLIB_MULTIARCH_FN(fn)