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;
135 n_this_chunk = rte_eth_rx_burst (xd->
device_index, queue_id,
138 n_buffers += n_this_chunk;
139 n_left -= n_this_chunk;
142 if (n_this_chunk < 32)
160 struct rte_mbuf *mb_seg = 0;
171 while (nb_seg < mb->nb_segs)
186 (mb_seg->buf_addr + mb_seg->data_off) - (
void *) b_seg->
data;
195 mb_seg = mb_seg->next;
227 u32 n_left_to_next, *to_next;
230 uword n_rx_bytes = 0;
231 u32 n_trace, trace_cnt __attribute__ ((unused));
255 struct rte_mbuf *mb = xd->
rx_vectors[queue_id][mb_index++];
273 while (n_buffers > 0)
280 u8 error0, error1, error2, error3;
281 i16 offset0, offset1, offset2, offset3;
286 while (n_buffers >= 12 && n_left_to_next >= 4)
288 struct rte_mbuf *mb0, *mb1, *mb2, *mb3;
357 or_ol_flags = (mb0->ol_flags | mb1->ol_flags |
358 mb2->ol_flags | mb3->ol_flags);
372 b0->
current_data = mb0->data_off + offset0 - RTE_PKTMBUF_HEADROOM;
376 mb0->data_off - RTE_PKTMBUF_HEADROOM;
378 n_rx_bytes += mb0->pkt_len;
381 b1->
current_data = mb1->data_off + offset1 - RTE_PKTMBUF_HEADROOM;
385 mb1->data_off - RTE_PKTMBUF_HEADROOM;
387 n_rx_bytes += mb1->pkt_len;
390 b2->
current_data = mb2->data_off + offset2 - RTE_PKTMBUF_HEADROOM;
394 mb2->data_off - RTE_PKTMBUF_HEADROOM;
396 n_rx_bytes += mb2->pkt_len;
399 b3->
current_data = mb3->data_off + offset3 - RTE_PKTMBUF_HEADROOM;
403 mb3->data_off - RTE_PKTMBUF_HEADROOM;
405 n_rx_bytes += mb3->pkt_len;
429 &next0, &next1, &next2, &next3,
433 to_next, n_left_to_next,
435 next0, next1, next2, next3);
439 while (n_buffers > 0 && n_left_to_next > 0)
441 struct rte_mbuf *mb0 = xd->
rx_vectors[queue_id][mb_index];
475 b0->
current_data = mb0->data_off + offset0 - RTE_PKTMBUF_HEADROOM;
479 mb0->data_off - RTE_PKTMBUF_HEADROOM;
481 n_rx_bytes += mb0->pkt_len;
498 to_next, n_left_to_next,
532 struct timespec ts, tsrem;
537 while (nanosleep (&ts, &tsrem) < 0)
591 uword n_rx_packets = 0;
594 u32 thread_index = node->thread_index;
617 #ifndef CLIB_MULTIARCH_VARIANT 622 .name =
"dpdk-input",
623 .sibling_of =
"device-input",
626 .state = VLIB_NODE_STATE_DISABLED,
640 static void __clib_constructor
static void vnet_device_increment_rx_packets(u32 thread_index, u64 count)
uword( vlib_node_function_t)(struct vlib_main_t *vm, struct vlib_node_runtime_t *node, struct vlib_frame_t *frame)
#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.
static void dpdk_rx_trace(dpdk_main_t *dm, vlib_node_runtime_t *node, dpdk_device_t *xd, u16 queue_id, u32 *buffers, uword n_buffers)
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)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
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 vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
#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)
#define VLIB_BUFFER_NEXT_PRESENT
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 VLIB_BUFFER_TOTAL_LENGTH_VALID
#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)
#define rte_mbuf_from_vlib_buffer(x)
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).
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)
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.
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 vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
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)
#define DPDK_DEVICE_FLAG_BOND_SLAVE
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)
#define VLIB_REGISTER_NODE(x,...)
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)
#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)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
u8 * buffer_pool_for_queue
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".
#define CLIB_MULTIARCH_FN(fn)