-always_inline int
-vlib_buffer_is_ip4 (vlib_buffer_t * b)
-{
- ethernet_header_t *h = (ethernet_header_t *) vlib_buffer_get_current (b);
- return (h->type == clib_host_to_net_u16 (ETHERNET_TYPE_IP4));
-}
-
-always_inline int
-vlib_buffer_is_ip6 (vlib_buffer_t * b)
-{
- ethernet_header_t *h = (ethernet_header_t *) vlib_buffer_get_current (b);
- return (h->type == clib_host_to_net_u16 (ETHERNET_TYPE_IP6));
-}
-
-always_inline int
-vlib_buffer_is_mpls (vlib_buffer_t * b)
-{
- ethernet_header_t *h = (ethernet_header_t *) vlib_buffer_get_current (b);
- return (h->type == clib_host_to_net_u16 (ETHERNET_TYPE_MPLS));
-}
-
-always_inline u32
-dpdk_rx_next_from_etype (struct rte_mbuf * mb, vlib_buffer_t * b0)
-{
- if (PREDICT_TRUE (vlib_buffer_is_ip4 (b0)))
- {
- if (PREDICT_TRUE ((mb->ol_flags & PKT_RX_IP_CKSUM_GOOD) != 0))
- return VNET_DEVICE_INPUT_NEXT_IP4_NCS_INPUT;
- else
- return VNET_DEVICE_INPUT_NEXT_IP4_INPUT;
- }
- else if (PREDICT_TRUE (vlib_buffer_is_ip6 (b0)))
- return VNET_DEVICE_INPUT_NEXT_IP6_INPUT;
- else if (PREDICT_TRUE (vlib_buffer_is_mpls (b0)))
- return VNET_DEVICE_INPUT_NEXT_MPLS_INPUT;
- else
- return VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT;
-}
-
-always_inline u32
-dpdk_rx_next_from_packet_start (struct rte_mbuf * mb, vlib_buffer_t * b0)
-{
- word start_delta;
- int rv;
-
- start_delta = b0->current_data -
- ((mb->buf_addr + mb->data_off) - (void *) b0->data);
-
- vlib_buffer_advance (b0, -start_delta);
-
- if (PREDICT_TRUE (vlib_buffer_is_ip4 (b0)))
- {
- if (PREDICT_TRUE ((mb->ol_flags & PKT_RX_IP_CKSUM_GOOD) != 0))
- rv = VNET_DEVICE_INPUT_NEXT_IP4_NCS_INPUT;
- else
- rv = VNET_DEVICE_INPUT_NEXT_IP4_INPUT;
- }
- else if (PREDICT_TRUE (vlib_buffer_is_ip6 (b0)))
- rv = VNET_DEVICE_INPUT_NEXT_IP6_INPUT;
- else if (PREDICT_TRUE (vlib_buffer_is_mpls (b0)))
- rv = VNET_DEVICE_INPUT_NEXT_MPLS_INPUT;
- else
- rv = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT;
-
- vlib_buffer_advance (b0, start_delta);
- return rv;
-}
-
-always_inline void
-dpdk_rx_error_from_mb (struct rte_mbuf *mb, u32 * next, u8 * error)
-{
- if (mb->ol_flags & PKT_RX_IP_CKSUM_BAD)
- {
- *error = DPDK_ERROR_IP_CHECKSUM_ERROR;
- *next = VNET_DEVICE_INPUT_NEXT_DROP;
- }
- else
- *error = DPDK_ERROR_NONE;
-}
-
-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)
-{
- vlib_main_t *vm = vlib_get_main ();
- u32 *b, n_left;
- u32 next0;