41 return (h->
type == clib_host_to_net_u16 (ETHERNET_TYPE_IP4));
48 return (h->
type == clib_host_to_net_u16 (ETHERNET_TYPE_IP6));
55 return (h->
type == clib_host_to_net_u16 (ETHERNET_TYPE_MPLS_UNICAST));
63 if (
PREDICT_TRUE ((mb->ol_flags & PKT_RX_IP_CKSUM_GOOD) != 0))
83 ((mb->buf_addr + mb->data_off) - (
void *) b0->
data);
89 if (
PREDICT_TRUE ((mb->ol_flags & PKT_RX_IP_CKSUM_GOOD) != 0))
108 if (mb->ol_flags & PKT_RX_IP_CKSUM_BAD)
110 *error = DPDK_ERROR_IP_CHECKSUM_ERROR;
114 *error = DPDK_ERROR_NONE;
181 n_this_chunk = rte_eth_rx_burst (xd->
device_index, queue_id,
184 n_buffers += n_this_chunk;
185 n_left -= n_this_chunk;
188 if (n_this_chunk < 32)
206 struct rte_mbuf *mb_seg = 0;
211 while ((mb->nb_segs > 1) && (nb_seg < mb->nb_segs))
226 (mb_seg->buf_addr + mb_seg->data_off) - (
void *) b_seg->
data;
235 mb_seg = mb_seg->next;
271 for (i = 0; i < 2; i++)
273 *(u8x32 *) (((
u8 *) d0) + i * 32) =
274 *(u8x32 *) (((
u8 *) d1) + i * 32) =
275 *(u8x32 *) (((
u8 *) d2) + i * 32) =
276 *(u8x32 *) (((
u8 *) d3) + i * 32) = *(u8x32 *) (((
u8 *) s) + i * 32);
291 u32 n_left_to_next, *to_next;
294 uword n_rx_bytes = 0;
295 u32 n_trace, trace_cnt __attribute__ ((unused));
319 struct rte_mbuf *mb = xd->
rx_vectors[queue_id][mb_index++];
334 while (n_buffers > 0)
341 u8 error0, error1, error2, error3;
346 while (n_buffers >= 12 && n_left_to_next >= 4)
348 struct rte_mbuf *mb0, *mb1, *mb2, *mb3;
428 or_ol_flags = (mb0->ol_flags | mb1->ol_flags |
429 mb2->ol_flags | mb3->ol_flags);
447 n_rx_bytes += mb0->pkt_len;
448 n_rx_bytes += mb1->pkt_len;
449 n_rx_bytes += mb2->pkt_len;
450 n_rx_bytes += mb3->pkt_len;
473 &next0, &next1, &next2, &next3,
477 to_next, n_left_to_next,
479 next0, next1, next2, next3);
483 while (n_buffers > 0 && n_left_to_next > 0)
485 struct rte_mbuf *mb0 = xd->
rx_vectors[queue_id][mb_index];
524 n_rx_bytes += mb0->pkt_len;
541 to_next, n_left_to_next,
573 struct timespec ts, tsrem;
578 while (nanosleep (&ts, &tsrem) < 0)
631 uword n_rx_packets = 0;
658 .name =
"dpdk-input",
659 .sibling_of =
"device-input",
662 .state = VLIB_NODE_STATE_DISABLED,
static_always_inline u32 dpdk_device_input(dpdk_main_t *dm, dpdk_device_t *xd, vlib_node_runtime_t *node, u32 cpu_index, u16 queue_id, int maybe_multiseg)
#define vlib_buffer_from_rte_mbuf(x)
static uword dpdk_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *f)
Main DPDK input node.
sll srl srl sll sra u16x4 i
static int vlib_buffer_is_mpls(vlib_buffer_t *b)
static u32 vlib_get_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt)
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)
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 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)
static int vlib_buffer_is_ip4(vlib_buffer_t *b)
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
static int vlib_buffer_is_ip6(vlib_buffer_t *b)
static void vlib_trace_buffer(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, vlib_buffer_t *b, int follow_chain)
static void vnet_device_increment_rx_packets(u32 cpu_index, u64 count)
#define VLIB_BUFFER_NEXT_PRESENT
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define static_always_inline
#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.
dpdk_device_and_queue_t ** devices_by_cpu
static u32 dpdk_rx_next_from_etype(struct rte_mbuf *mb, vlib_buffer_t *b0)
static_always_inline void dpdk_prefetch_ethertype(struct rte_mbuf *mb)
uword os_get_cpu_number(void)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX
static_always_inline void dpdk_buffer_init_from_template(void *d0, void *d1, void *d2, void *d3, void *s)
#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)
#define CLIB_PREFETCH(addr, size, type)
struct rte_mbuf *** rx_vectors
vlib_node_registration_t dpdk_input_node
(constructor) VLIB_REGISTER_NODE (dpdk_input_node)
#define clib_memcpy(a, b, c)
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
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 void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
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)
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 vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
static u32 dpdk_rx_next_from_packet_start(struct rte_mbuf *mb, vlib_buffer_t *b0)
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,...)
#define vec_foreach(var, vec)
Vector iterator.
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_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.
VLIB_NODE_FUNCTION_MULTIARCH(ethernet_input_not_l2_node, ethernet_input_not_l2)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".