39 "IP4_INPUT must follow IP4_NCS_INPUT");
54 STATIC_ASSERT ((PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD | PKT_RX_FDIR) <
55 256,
"dpdk flags not un lower byte, fix needed");
60 if (
PREDICT_TRUE (etype == clib_host_to_net_u16 (ETHERNET_TYPE_IP4)))
66 else if (
PREDICT_TRUE (etype == clib_host_to_net_u16 (ETHERNET_TYPE_IP6)))
68 else if (
PREDICT_TRUE (etype == clib_host_to_net_u16 (ETHERNET_TYPE_MPLS)))
79 struct rte_mbuf *mb_seg = 0;
87 b->
flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
90 while (nb_seg < mb->nb_segs)
97 ASSERT ((b_seg->
flags & VLIB_BUFFER_NEXT_PRESENT) == 0);
105 (mb_seg->buf_addr + mb_seg->data_off) - (
void *) b_seg->
data;
110 b_chain->
flags |= VLIB_BUFFER_NEXT_PRESENT;
114 mb_seg = mb_seg->next;
201 for (i = 0; i <
count; i++)
205 flags[
i] = (
u8) mb[i]->ol_flags;
213 uword n_rx_packets,
int maybe_multiseg,
u8 * or_flagsp)
215 u32 n_left = n_rx_packets;
218 struct rte_mbuf **mb = ptd->
mbufs;
251 off = mb[0]->data_off;
253 off -= RTE_PKTMBUF_HEADROOM;
257 off = mb[1]->data_off;
259 off -= RTE_PKTMBUF_HEADROOM;
263 off = mb[2]->data_off;
265 off -= RTE_PKTMBUF_HEADROOM;
269 off = mb[3]->data_off;
271 off -= RTE_PKTMBUF_HEADROOM;
280 n_bytes += mb[0]->data_len;
281 n_bytes += mb[1]->data_len;
282 n_bytes += mb[2]->data_len;
283 n_bytes += mb[3]->data_len;
311 off = mb[0]->data_off;
313 off -= RTE_PKTMBUF_HEADROOM;
317 n_bytes += mb[0]->data_len;
328 *or_flagsp = or_flags;
339 struct rte_mbuf **mb = ptd->
mbufs;
342 u32 n_left = n_rx_packets;
407 for (n = 0; n < n_rx_packets; n++)
413 ptd->
mbufs[n]->hash.fdir.hi);
436 uword n_rx_packets = 0, n_rx_bytes;
440 struct rte_mbuf **mb;
451 if ((xd->
flags & DPDK_DEVICE_FLAG_ADMIN_UP) == 0)
457 n = rte_eth_rx_burst (xd->
port_id, queue_id,
458 ptd->
mbufs + n_rx_packets,
466 if (n_rx_packets == 0)
491 if (xd->
flags & DPDK_DEVICE_FLAG_MAYBE_MULTISEG)
498 for (n = 0; n < n_rx_packets; n++)
499 ptd->
next[n] = next_index;
515 for (n = 0; n < n_rx_packets; n++)
523 b0->
error = node->
errors[DPDK_ERROR_IP_CHECKSUM_ERROR];
530 sizeof (
struct rte_mbuf));
538 n_left = n_rx_packets;
542 while (n_trace && n_left)
571 n_left = n_rx_packets;
596 data_start = (mb->buf_addr + mb->data_off) - (
void *) b0->
data;
612 n_rx_packets, n_rx_bytes);
624 uword n_rx_packets = 0;
627 u32 thread_index = node->thread_index;
648 .name =
"dpdk-input",
649 .sibling_of =
"device-input",
652 .state = VLIB_NODE_STATE_DISABLED,
static_always_inline void dpdk_prefetch_buffer_data_x4(struct rte_mbuf *mb[])
static void vnet_device_increment_rx_packets(u32 thread_index, u64 count)
static_always_inline void dpdk_set_next_from_etype(vlib_main_t *vm, vlib_node_runtime_t *node, dpdk_per_thread_data_t *ptd, uword n_rx_packets)
#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.
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
vnet_main_t * vnet_get_main(void)
u8 flags[DPDK_RX_BURST_SZ]
#define foreach_dpdk_error
u8 buffer_pool_index
index of buffer pool this buffer belongs.
u32 per_interface_next_index
#define STRUCT_OFFSET_OF(t, f)
#define VLIB_NODE_FN(node)
vlib_error_t * errors
Vector of errors for this node.
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
static_always_inline int vnet_device_input_have_features(u32 sw_if_index)
static_always_inline void dpdk_prefetch_buffer_x4(struct rte_mbuf *mb[])
STATIC_ASSERT(VNET_DEVICE_INPUT_NEXT_IP4_INPUT-1==VNET_DEVICE_INPUT_NEXT_IP4_NCS_INPUT,"IP4_INPUT must follow IP4_NCS_INPUT")
#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.
static_always_inline void dpdk_prefetch_mbuf_x4(struct rte_mbuf *mb[])
static u32 vlib_get_buffer_index(vlib_main_t *vm, void *p)
Translate buffer pointer into buffer index.
#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]
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
u16 current_length
Nbytes between current data and the end of this buffer.
static_always_inline void dpdk_process_flow_offload(dpdk_device_t *xd, dpdk_per_thread_data_t *ptd, uword n_rx_packets)
dpdk_per_thread_data_t * per_thread_data
vlib_buffer_t buffer_template
#define VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX
static void pcap_add_buffer(pcap_main_t *pm, vlib_main_t *vm, u32 buffer_index, u32 n_bytes_in_trace)
Add buffer (vlib_buffer_t) to the trace.
static_always_inline void vlib_get_buffer_indices_with_offset(vlib_main_t *vm, void **b, u32 *bi, uword count, i32 offset)
Translate array of buffer pointers into buffer indices with offset.
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static char * dpdk_error_strings[]
u8 * format_ethernet_header_with_length(u8 *s, va_list *args)
static_always_inline u8 dpdk_ol_flags_extract(struct rte_mbuf **mb, u8 *flags, int count)
Main DPDK input node.
#define VLIB_REGISTER_NODE(x,...)
u32 flow_id
Generic flow identifier.
#define CLIB_PREFETCH(addr, size, type)
dpdk_flow_lookup_entry_t * flow_lookup_entries
static_always_inline void vlib_buffer_enqueue_to_next(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, u16 *nexts, uword count)
static_always_inline void clib_memcpy64_x4(void *d0, void *d1, void *d2, void *d3, void *s)
#define clib_memcpy(a, b, c)
u32 buffers[DPDK_RX_BURST_SZ]
u16 next[DPDK_RX_BURST_SZ]
static_always_inline u32 dpdk_device_input(vlib_main_t *vm, dpdk_main_t *dm, dpdk_device_t *xd, vlib_node_runtime_t *node, u32 thread_index, u16 queue_id)
u32 next_buffer
Next buffer for this linked-list of buffers.
static_always_inline uword dpdk_process_rx_burst(vlib_main_t *vm, dpdk_per_thread_data_t *ptd, uword n_rx_packets, int maybe_multiseg, u8 *or_flagsp)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
dpdk_portid_t device_index
format_function_t format_dpdk_rx_trace
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.
struct rte_mbuf * mbufs[DPDK_RX_BURST_SZ]
#define foreach_device_and_queue(var, vec)
static u32 dpdk_rx_next(vlib_node_runtime_t *node, u16 etype, u8 flags)
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
dpdk_pcap_t pcap[VLIB_N_RX_TX]
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 uword dpdk_process_subseq_segs(vlib_main_t *vm, vlib_buffer_t *b, struct rte_mbuf *mb, vlib_buffer_free_list_t *fl)
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".