Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 Cisco and/or its affiliates. |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | #include <vnet/vnet.h> |
| 16 | #include <vppinfra/vec.h> |
| 17 | #include <vppinfra/error.h> |
| 18 | #include <vppinfra/format.h> |
| 19 | #include <vppinfra/xxhash.h> |
| 20 | |
| 21 | #include <vnet/ethernet/ethernet.h> |
| 22 | #include <vnet/devices/dpdk/dpdk.h> |
| 23 | #include <vnet/classify/vnet_classify.h> |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 24 | #include <vnet/mpls/packet.h> |
Damjan Marion | 0247b46 | 2016-06-08 01:37:11 +0200 | [diff] [blame] | 25 | #include <vnet/handoff.h> |
Damjan Marion | 8bdc63b | 2016-11-02 14:48:21 +0100 | [diff] [blame] | 26 | #include <vnet/devices/devices.h> |
Damjan Marion | 2231150 | 2016-10-28 20:30:15 +0200 | [diff] [blame] | 27 | #include <vnet/feature/feature.h> |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 28 | |
| 29 | #include "dpdk_priv.h" |
| 30 | |
| 31 | #ifndef MAX |
| 32 | #define MAX(a,b) ((a) < (b) ? (b) : (a)) |
| 33 | #endif |
| 34 | |
| 35 | #ifndef MIN |
| 36 | #define MIN(a,b) ((a) < (b) ? (a) : (b)) |
| 37 | #endif |
| 38 | |
| 39 | /* |
| 40 | * At least in certain versions of ESXi, vmware e1000's don't honor the |
| 41 | * "strip rx CRC" bit. Set this flag to work around that bug FOR UNIT TEST ONLY. |
| 42 | * |
| 43 | * If wireshark complains like so: |
| 44 | * |
| 45 | * "Frame check sequence: 0x00000000 [incorrect, should be <hex-num>]" |
| 46 | * and you're using ESXi emulated e1000's, set this flag FOR UNIT TEST ONLY. |
| 47 | * |
| 48 | * Note: do NOT check in this file with this workaround enabled! You'll lose |
| 49 | * actual data from e.g. 10xGE interfaces. The extra 4 bytes annoy |
| 50 | * wireshark, but they're harmless... |
| 51 | */ |
| 52 | #define VMWARE_LENGTH_BUG_WORKAROUND 0 |
| 53 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 54 | static char *dpdk_error_strings[] = { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 55 | #define _(n,s) s, |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 56 | foreach_dpdk_error |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 57 | #undef _ |
| 58 | }; |
| 59 | |
Damjan Marion | 0247b46 | 2016-06-08 01:37:11 +0200 | [diff] [blame] | 60 | always_inline int |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 61 | dpdk_mbuf_is_ip4 (struct rte_mbuf *mb) |
Damjan Marion | 0247b46 | 2016-06-08 01:37:11 +0200 | [diff] [blame] | 62 | { |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 63 | return RTE_ETH_IS_IPV4_HDR (mb->packet_type) != 0; |
Damjan Marion | 0247b46 | 2016-06-08 01:37:11 +0200 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | always_inline int |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 67 | dpdk_mbuf_is_ip6 (struct rte_mbuf *mb) |
Damjan Marion | 0247b46 | 2016-06-08 01:37:11 +0200 | [diff] [blame] | 68 | { |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 69 | return RTE_ETH_IS_IPV6_HDR (mb->packet_type) != 0; |
Damjan Marion | 0247b46 | 2016-06-08 01:37:11 +0200 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | always_inline int |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 73 | vlib_buffer_is_mpls (vlib_buffer_t * b) |
Damjan Marion | 0247b46 | 2016-06-08 01:37:11 +0200 | [diff] [blame] | 74 | { |
| 75 | ethernet_header_t *h = (ethernet_header_t *) b->data; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 76 | return (h->type == clib_host_to_net_u16 (ETHERNET_TYPE_MPLS_UNICAST)); |
Damjan Marion | 0247b46 | 2016-06-08 01:37:11 +0200 | [diff] [blame] | 77 | } |
| 78 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 79 | always_inline void |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 80 | dpdk_rx_next_and_error_from_mb_flags_x1 (dpdk_device_t * xd, |
| 81 | struct rte_mbuf *mb, |
Damjan Marion | 6e3c65e | 2016-10-31 23:23:34 +0100 | [diff] [blame] | 82 | vlib_buffer_t * b0, u32 * next0, |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 83 | u8 * error0) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 84 | { |
Damjan Marion | 0247b46 | 2016-06-08 01:37:11 +0200 | [diff] [blame] | 85 | u8 n0; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 86 | uint16_t mb_flags = mb->ol_flags; |
| 87 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 88 | if (PREDICT_FALSE (mb_flags & ( |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 89 | #ifdef RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 90 | PKT_EXT_RX_PKT_ERROR | PKT_EXT_RX_BAD_FCS | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 91 | #endif /* RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS */ |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 92 | PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD))) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 93 | { |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 94 | /* some error was flagged. determine the drop reason */ |
Damjan Marion | 8bdc63b | 2016-11-02 14:48:21 +0100 | [diff] [blame] | 95 | n0 = VNET_DEVICE_INPUT_NEXT_DROP; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 96 | *error0 = |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 97 | #ifdef RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 98 | (mb_flags & PKT_EXT_RX_PKT_ERROR) ? DPDK_ERROR_RX_PACKET_ERROR : |
| 99 | (mb_flags & PKT_EXT_RX_BAD_FCS) ? DPDK_ERROR_RX_BAD_FCS : |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 100 | #endif /* RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS */ |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 101 | (mb_flags & PKT_RX_IP_CKSUM_BAD) ? DPDK_ERROR_IP_CHECKSUM_ERROR : |
| 102 | (mb_flags & PKT_RX_L4_CKSUM_BAD) ? DPDK_ERROR_L4_CHECKSUM_ERROR : |
| 103 | DPDK_ERROR_NONE; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 104 | } |
| 105 | else |
| 106 | { |
| 107 | *error0 = DPDK_ERROR_NONE; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 108 | if (PREDICT_FALSE (xd->per_interface_next_index != ~0)) |
Damjan Marion | 0247b46 | 2016-06-08 01:37:11 +0200 | [diff] [blame] | 109 | { |
| 110 | n0 = xd->per_interface_next_index; |
| 111 | b0->flags |= BUFFER_HANDOFF_NEXT_VALID; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 112 | if (PREDICT_TRUE (dpdk_mbuf_is_ip4 (mb))) |
| 113 | vnet_buffer (b0)->handoff.next_index = |
| 114 | HANDOFF_DISPATCH_NEXT_IP4_INPUT; |
| 115 | else if (PREDICT_TRUE (dpdk_mbuf_is_ip6 (mb))) |
| 116 | vnet_buffer (b0)->handoff.next_index = |
| 117 | HANDOFF_DISPATCH_NEXT_IP6_INPUT; |
| 118 | else if (PREDICT_TRUE (vlib_buffer_is_mpls (b0))) |
| 119 | vnet_buffer (b0)->handoff.next_index = |
| 120 | HANDOFF_DISPATCH_NEXT_MPLS_INPUT; |
Damjan Marion | 0247b46 | 2016-06-08 01:37:11 +0200 | [diff] [blame] | 121 | else |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 122 | vnet_buffer (b0)->handoff.next_index = |
| 123 | HANDOFF_DISPATCH_NEXT_ETHERNET_INPUT; |
Damjan Marion | 0247b46 | 2016-06-08 01:37:11 +0200 | [diff] [blame] | 124 | } |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 125 | else |
Damjan Marion | a7cc447 | 2016-09-19 13:31:49 +0200 | [diff] [blame] | 126 | if (PREDICT_FALSE ((xd->flags & DPDK_DEVICE_FLAG_HAVE_SUBIF) || |
| 127 | (mb_flags & PKT_RX_VLAN_PKT))) |
Damjan Marion | 8bdc63b | 2016-11-02 14:48:21 +0100 | [diff] [blame] | 128 | n0 = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 129 | else |
| 130 | { |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 131 | if (PREDICT_TRUE (dpdk_mbuf_is_ip4 (mb))) |
Damjan Marion | 8bdc63b | 2016-11-02 14:48:21 +0100 | [diff] [blame] | 132 | n0 = VNET_DEVICE_INPUT_NEXT_IP4_INPUT; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 133 | else if (PREDICT_TRUE (dpdk_mbuf_is_ip6 (mb))) |
Damjan Marion | 8bdc63b | 2016-11-02 14:48:21 +0100 | [diff] [blame] | 134 | n0 = VNET_DEVICE_INPUT_NEXT_IP6_INPUT; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 135 | else if (PREDICT_TRUE (vlib_buffer_is_mpls (b0))) |
Damjan Marion | 8bdc63b | 2016-11-02 14:48:21 +0100 | [diff] [blame] | 136 | n0 = VNET_DEVICE_INPUT_NEXT_MPLS_INPUT; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 137 | else |
Damjan Marion | 8bdc63b | 2016-11-02 14:48:21 +0100 | [diff] [blame] | 138 | n0 = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 139 | } |
| 140 | } |
| 141 | *next0 = n0; |
| 142 | } |
| 143 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 144 | void |
| 145 | dpdk_rx_trace (dpdk_main_t * dm, |
| 146 | vlib_node_runtime_t * node, |
| 147 | dpdk_device_t * xd, |
| 148 | u16 queue_id, u32 * buffers, uword n_buffers) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 149 | { |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 150 | vlib_main_t *vm = vlib_get_main (); |
| 151 | u32 *b, n_left; |
Damjan Marion | 6e3c65e | 2016-10-31 23:23:34 +0100 | [diff] [blame] | 152 | u32 next0; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 153 | |
| 154 | n_left = n_buffers; |
| 155 | b = buffers; |
| 156 | |
| 157 | while (n_left >= 1) |
| 158 | { |
| 159 | u32 bi0; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 160 | vlib_buffer_t *b0; |
| 161 | dpdk_rx_dma_trace_t *t0; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 162 | struct rte_mbuf *mb; |
| 163 | u8 error0; |
| 164 | |
| 165 | bi0 = b[0]; |
| 166 | n_left -= 1; |
| 167 | |
| 168 | b0 = vlib_get_buffer (vm, bi0); |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 169 | mb = rte_mbuf_from_vlib_buffer (b0); |
| 170 | dpdk_rx_next_and_error_from_mb_flags_x1 (xd, mb, b0, &next0, &error0); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 171 | vlib_trace_buffer (vm, node, next0, b0, /* follow_chain */ 0); |
| 172 | t0 = vlib_add_trace (vm, node, b0, sizeof (t0[0])); |
| 173 | t0->queue_index = queue_id; |
| 174 | t0->device_index = xd->device_index; |
| 175 | t0->buffer_index = bi0; |
| 176 | |
Damjan Marion | f1213b8 | 2016-03-13 02:22:06 +0100 | [diff] [blame] | 177 | clib_memcpy (&t0->mb, mb, sizeof (t0->mb)); |
| 178 | clib_memcpy (&t0->buffer, b0, sizeof (b0[0]) - sizeof (b0->pre_data)); |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 179 | clib_memcpy (t0->buffer.pre_data, b0->data, |
| 180 | sizeof (t0->buffer.pre_data)); |
Damjan Marion | db7b269 | 2016-06-09 16:16:27 +0200 | [diff] [blame] | 181 | clib_memcpy (&t0->data, mb->buf_addr + mb->data_off, sizeof (t0->data)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 182 | |
| 183 | #ifdef RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS |
| 184 | /* |
| 185 | * Clear overloaded TX offload flags when a DPDK driver |
| 186 | * is using them for RX flags (e.g. Cisco VIC Ethernet driver) |
| 187 | */ |
| 188 | mb->ol_flags &= PKT_EXT_RX_CLR_TX_FLAGS_MASK; |
| 189 | #endif /* RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS */ |
| 190 | |
| 191 | b += 1; |
| 192 | } |
| 193 | } |
| 194 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 195 | static inline u32 |
| 196 | dpdk_rx_burst (dpdk_main_t * dm, dpdk_device_t * xd, u16 queue_id) |
| 197 | { |
| 198 | u32 n_buffers; |
| 199 | u32 n_left; |
| 200 | u32 n_this_chunk; |
| 201 | |
| 202 | n_left = VLIB_FRAME_SIZE; |
| 203 | n_buffers = 0; |
| 204 | |
Damjan Marion | 5643170 | 2016-09-19 13:18:09 +0200 | [diff] [blame] | 205 | if (PREDICT_TRUE (xd->flags & DPDK_DEVICE_FLAG_PMD)) |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 206 | { |
| 207 | while (n_left) |
| 208 | { |
| 209 | n_this_chunk = rte_eth_rx_burst (xd->device_index, queue_id, |
| 210 | xd->rx_vectors[queue_id] + |
| 211 | n_buffers, n_left); |
| 212 | n_buffers += n_this_chunk; |
| 213 | n_left -= n_this_chunk; |
| 214 | |
| 215 | /* Empirically, DPDK r1.8 produces vectors w/ 32 or fewer elts */ |
| 216 | if (n_this_chunk < 32) |
| 217 | break; |
| 218 | } |
| 219 | } |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 220 | else |
| 221 | { |
| 222 | ASSERT (0); |
| 223 | } |
| 224 | |
| 225 | return n_buffers; |
| 226 | } |
| 227 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 228 | /* |
| 229 | * This function is used when there are no worker threads. |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 230 | * The main thread performs IO and forwards the packets. |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 231 | */ |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 232 | static inline u32 |
| 233 | dpdk_device_input (dpdk_main_t * dm, |
| 234 | dpdk_device_t * xd, |
| 235 | vlib_node_runtime_t * node, |
Damjan Marion | 4ee3a65 | 2016-11-15 19:47:58 +0100 | [diff] [blame^] | 236 | u32 cpu_index, u16 queue_id) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 237 | { |
| 238 | u32 n_buffers; |
Damjan Marion | 8bdc63b | 2016-11-02 14:48:21 +0100 | [diff] [blame] | 239 | u32 next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 240 | u32 n_left_to_next, *to_next; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 241 | u32 mb_index; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 242 | vlib_main_t *vm = vlib_get_main (); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 243 | uword n_rx_bytes = 0; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 244 | u32 n_trace, trace_cnt __attribute__ ((unused)); |
| 245 | vlib_buffer_free_list_t *fl; |
Dave Barach | d81566f | 2016-02-15 11:34:13 -0500 | [diff] [blame] | 246 | u32 buffer_flags_template; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 247 | |
Damjan Marion | b28e498 | 2016-08-22 22:34:38 +0200 | [diff] [blame] | 248 | if ((xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP) == 0) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 249 | return 0; |
| 250 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 251 | n_buffers = dpdk_rx_burst (dm, xd, queue_id); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 252 | |
| 253 | if (n_buffers == 0) |
| 254 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 255 | return 0; |
| 256 | } |
| 257 | |
Dave Barach | d81566f | 2016-02-15 11:34:13 -0500 | [diff] [blame] | 258 | buffer_flags_template = dm->buffer_flags_template; |
| 259 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 260 | vec_reset_length (xd->d_trace_buffers); |
| 261 | trace_cnt = n_trace = vlib_get_trace_count (vm, node); |
| 262 | |
| 263 | fl = vlib_buffer_get_free_list (vm, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX); |
| 264 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 265 | mb_index = 0; |
| 266 | |
| 267 | while (n_buffers > 0) |
| 268 | { |
Damjan Marion | 6e3c65e | 2016-10-31 23:23:34 +0100 | [diff] [blame] | 269 | u32 bi0, next0; |
| 270 | u8 error0; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 271 | u32 l3_offset0; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 272 | vlib_buffer_t *b0, *b_seg, *b_chain = 0; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 273 | |
| 274 | vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); |
| 275 | |
| 276 | while (n_buffers > 0 && n_left_to_next > 0) |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 277 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 278 | u8 nb_seg = 1; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 279 | struct rte_mbuf *mb = xd->rx_vectors[queue_id][mb_index]; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 280 | struct rte_mbuf *mb_seg = mb->next; |
| 281 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 282 | if (PREDICT_TRUE (n_buffers > 2)) |
| 283 | { |
| 284 | struct rte_mbuf *pfmb = xd->rx_vectors[queue_id][mb_index + 2]; |
| 285 | vlib_buffer_t *bp = vlib_buffer_from_rte_mbuf (pfmb); |
| 286 | CLIB_PREFETCH (pfmb, CLIB_CACHE_LINE_BYTES, STORE); |
| 287 | CLIB_PREFETCH (bp, CLIB_CACHE_LINE_BYTES, STORE); |
| 288 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 289 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 290 | ASSERT (mb); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 291 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 292 | b0 = vlib_buffer_from_rte_mbuf (mb); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 293 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 294 | /* Prefetch one next segment if it exists. */ |
| 295 | if (PREDICT_FALSE (mb->nb_segs > 1)) |
| 296 | { |
| 297 | struct rte_mbuf *pfmb = mb->next; |
| 298 | vlib_buffer_t *bp = vlib_buffer_from_rte_mbuf (pfmb); |
| 299 | CLIB_PREFETCH (pfmb, CLIB_CACHE_LINE_BYTES, LOAD); |
| 300 | CLIB_PREFETCH (bp, CLIB_CACHE_LINE_BYTES, STORE); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 301 | b_chain = b0; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 302 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 303 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 304 | vlib_buffer_init_for_free_list (b0, fl); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 305 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 306 | bi0 = vlib_get_buffer_index (vm, b0); |
| 307 | |
| 308 | to_next[0] = bi0; |
| 309 | to_next++; |
| 310 | n_left_to_next--; |
| 311 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 312 | dpdk_rx_next_and_error_from_mb_flags_x1 (xd, mb, b0, |
| 313 | &next0, &error0); |
| 314 | #ifdef RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS |
| 315 | /* |
| 316 | * Clear overloaded TX offload flags when a DPDK driver |
| 317 | * is using them for RX flags (e.g. Cisco VIC Ethernet driver) |
| 318 | */ |
| 319 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 320 | if (PREDICT_TRUE (trace_cnt == 0)) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 321 | mb->ol_flags &= PKT_EXT_RX_CLR_TX_FLAGS_MASK; |
| 322 | else |
| 323 | trace_cnt--; |
| 324 | #endif /* RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS */ |
| 325 | |
| 326 | b0->error = node->errors[error0]; |
| 327 | |
Damjan Marion | 8bdc63b | 2016-11-02 14:48:21 +0100 | [diff] [blame] | 328 | l3_offset0 = ((next0 == VNET_DEVICE_INPUT_NEXT_IP4_INPUT || |
| 329 | next0 == VNET_DEVICE_INPUT_NEXT_IP6_INPUT || |
| 330 | next0 == VNET_DEVICE_INPUT_NEXT_MPLS_INPUT) ? |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 331 | sizeof (ethernet_header_t) : 0); |
| 332 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 333 | b0->current_data = l3_offset0; |
| 334 | /* Some drivers like fm10k receive frames with |
| 335 | mb->data_off > RTE_PKTMBUF_HEADROOM */ |
| 336 | b0->current_data += mb->data_off - RTE_PKTMBUF_HEADROOM; |
| 337 | b0->current_length = mb->data_len - l3_offset0; |
Dave Barach | 61efa14 | 2016-01-22 08:23:09 -0500 | [diff] [blame] | 338 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 339 | b0->flags = buffer_flags_template; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 340 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 341 | if (VMWARE_LENGTH_BUG_WORKAROUND) |
| 342 | b0->current_length -= 4; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 343 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 344 | vnet_buffer (b0)->sw_if_index[VLIB_RX] = xd->vlib_sw_if_index; |
| 345 | vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32) ~ 0; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 346 | n_rx_bytes += mb->pkt_len; |
| 347 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 348 | /* Process subsequent segments of multi-segment packets */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 349 | while ((mb->nb_segs > 1) && (nb_seg < mb->nb_segs)) |
| 350 | { |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 351 | ASSERT (mb_seg != 0); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 352 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 353 | b_seg = vlib_buffer_from_rte_mbuf (mb_seg); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 354 | vlib_buffer_init_for_free_list (b_seg, fl); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 355 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 356 | ASSERT ((b_seg->flags & VLIB_BUFFER_NEXT_PRESENT) == 0); |
| 357 | ASSERT (b_seg->current_data == 0); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 358 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 359 | /* |
| 360 | * The driver (e.g. virtio) may not put the packet data at the start |
| 361 | * of the segment, so don't assume b_seg->current_data == 0 is correct. |
| 362 | */ |
| 363 | b_seg->current_data = |
| 364 | (mb_seg->buf_addr + mb_seg->data_off) - (void *) b_seg->data; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 365 | |
| 366 | b_seg->current_length = mb_seg->data_len; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 367 | b0->total_length_not_including_first_buffer += mb_seg->data_len; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 368 | |
| 369 | b_chain->flags |= VLIB_BUFFER_NEXT_PRESENT; |
| 370 | b_chain->next_buffer = vlib_get_buffer_index (vm, b_seg); |
| 371 | |
| 372 | b_chain = b_seg; |
| 373 | mb_seg = mb_seg->next; |
| 374 | nb_seg++; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 375 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 376 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 377 | /* |
| 378 | * Turn this on if you run into |
| 379 | * "bad monkey" contexts, and you want to know exactly |
| 380 | * which nodes they've visited... See main.c... |
| 381 | */ |
| 382 | VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 383 | |
Damjan Marion | 2231150 | 2016-10-28 20:30:15 +0200 | [diff] [blame] | 384 | /* Do we have any driver RX features configured on the interface? */ |
Damjan Marion | 87cd119 | 2016-11-04 11:00:27 +0100 | [diff] [blame] | 385 | vnet_feature_start_device_input_x1 (xd->vlib_sw_if_index, &next0, b0, l3_offset0); |
Damjan Marion | 2231150 | 2016-10-28 20:30:15 +0200 | [diff] [blame] | 386 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 387 | vlib_validate_buffer_enqueue_x1 (vm, node, next_index, |
| 388 | to_next, n_left_to_next, |
| 389 | bi0, next0); |
| 390 | if (PREDICT_FALSE (n_trace > mb_index)) |
| 391 | vec_add1 (xd->d_trace_buffers, bi0); |
| 392 | n_buffers--; |
| 393 | mb_index++; |
| 394 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 395 | vlib_put_next_frame (vm, node, next_index, n_left_to_next); |
| 396 | } |
| 397 | |
| 398 | if (PREDICT_FALSE (vec_len (xd->d_trace_buffers) > 0)) |
| 399 | { |
| 400 | dpdk_rx_trace (dm, node, xd, queue_id, xd->d_trace_buffers, |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 401 | vec_len (xd->d_trace_buffers)); |
| 402 | vlib_set_trace_count (vm, node, |
| 403 | n_trace - vec_len (xd->d_trace_buffers)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 404 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 405 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 406 | vlib_increment_combined_counter |
| 407 | (vnet_get_main ()->interface_main.combined_sw_if_counters |
| 408 | + VNET_INTERFACE_COUNTER_RX, |
| 409 | cpu_index, xd->vlib_sw_if_index, mb_index, n_rx_bytes); |
| 410 | |
| 411 | dpdk_worker_t *dw = vec_elt_at_index (dm->workers, cpu_index); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 412 | dw->aggregate_rx_packets += mb_index; |
| 413 | |
| 414 | return mb_index; |
| 415 | } |
| 416 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 417 | static inline void |
| 418 | poll_rate_limit (dpdk_main_t * dm) |
Dave Barach | 08602d1 | 2016-06-04 14:10:59 -0400 | [diff] [blame] | 419 | { |
| 420 | /* Limit the poll rate by sleeping for N msec between polls */ |
| 421 | if (PREDICT_FALSE (dm->poll_sleep != 0)) |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 422 | { |
| 423 | struct timespec ts, tsrem; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 424 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 425 | ts.tv_sec = 0; |
| 426 | ts.tv_nsec = 1000 * 1000 * dm->poll_sleep; /* 1ms */ |
Dave Barach | 08602d1 | 2016-06-04 14:10:59 -0400 | [diff] [blame] | 427 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 428 | while (nanosleep (&ts, &tsrem) < 0) |
| 429 | { |
| 430 | ts = tsrem; |
| 431 | } |
| 432 | } |
Dave Barach | 08602d1 | 2016-06-04 14:10:59 -0400 | [diff] [blame] | 433 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 434 | |
Dave Barach | 132d51d | 2016-07-07 10:10:17 -0400 | [diff] [blame] | 435 | /** \brief Main DPDK input node |
| 436 | @node dpdk-input |
| 437 | |
| 438 | This is the main DPDK input node: across each assigned interface, |
| 439 | call rte_eth_rx_burst(...) or similar to obtain a vector of |
| 440 | packets to process. Handle early packet discard. Derive @c |
| 441 | vlib_buffer_t metadata from <code>struct rte_mbuf</code> metadata, |
| 442 | Depending on the resulting metadata: adjust <code>b->current_data, |
| 443 | b->current_length </code> and dispatch directly to |
| 444 | ip4-input-no-checksum, or ip6-input. Trace the packet if required. |
| 445 | |
Chris Luke | d4024f5 | 2016-09-06 09:32:36 -0400 | [diff] [blame] | 446 | @param vm vlib_main_t corresponding to the current thread |
Dave Barach | 132d51d | 2016-07-07 10:10:17 -0400 | [diff] [blame] | 447 | @param node vlib_node_runtime_t |
Chris Luke | d4024f5 | 2016-09-06 09:32:36 -0400 | [diff] [blame] | 448 | @param f vlib_frame_t input-node, not used. |
Dave Barach | 132d51d | 2016-07-07 10:10:17 -0400 | [diff] [blame] | 449 | |
| 450 | @par Graph mechanics: buffer metadata, next index usage |
| 451 | |
| 452 | @em Uses: |
| 453 | - <code>struct rte_mbuf mb->ol_flags</code> |
| 454 | - PKT_EXT_RX_PKT_ERROR, PKT_EXT_RX_BAD_FCS |
| 455 | PKT_RX_IP_CKSUM_BAD, PKT_RX_L4_CKSUM_BAD |
| 456 | - <code> RTE_ETH_IS_xxx_HDR(mb->packet_type) </code> |
| 457 | - packet classification result |
| 458 | |
| 459 | @em Sets: |
| 460 | - <code>b->error</code> if the packet is to be dropped immediately |
| 461 | - <code>b->current_data, b->current_length</code> |
| 462 | - adjusted as needed to skip the L2 header in direct-dispatch cases |
| 463 | - <code>vnet_buffer(b)->sw_if_index[VLIB_RX]</code> |
| 464 | - rx interface sw_if_index |
| 465 | - <code>vnet_buffer(b)->sw_if_index[VLIB_TX] = ~0</code> |
| 466 | - required by ipX-lookup |
| 467 | - <code>b->flags</code> |
| 468 | - to indicate multi-segment pkts (VLIB_BUFFER_NEXT_PRESENT), etc. |
| 469 | |
| 470 | <em>Next Nodes:</em> |
| 471 | - Static arcs to: error-drop, ethernet-input, |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 472 | ip4-input-no-checksum, ip6-input, mpls-input |
Dave Barach | 132d51d | 2016-07-07 10:10:17 -0400 | [diff] [blame] | 473 | - per-interface redirection, controlled by |
| 474 | <code>xd->per_interface_next_index</code> |
| 475 | */ |
| 476 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 477 | static uword |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 478 | dpdk_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * f) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 479 | { |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 480 | dpdk_main_t *dm = &dpdk_main; |
| 481 | dpdk_device_t *xd; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 482 | uword n_rx_packets = 0; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 483 | dpdk_device_and_queue_t *dq; |
| 484 | u32 cpu_index = os_get_cpu_number (); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 485 | |
| 486 | /* |
| 487 | * Poll all devices on this cpu for input/interrupts. |
| 488 | */ |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 489 | /* *INDENT-OFF* */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 490 | vec_foreach (dq, dm->devices_by_cpu[cpu_index]) |
| 491 | { |
| 492 | xd = vec_elt_at_index(dm->devices, dq->device); |
| 493 | ASSERT(dq->queue_id == 0); |
Damjan Marion | 4ee3a65 | 2016-11-15 19:47:58 +0100 | [diff] [blame^] | 494 | n_rx_packets += dpdk_device_input (dm, xd, node, cpu_index, 0); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 495 | } |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 496 | /* *INDENT-ON* */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 497 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 498 | poll_rate_limit (dm); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 499 | |
| 500 | return n_rx_packets; |
| 501 | } |
| 502 | |
| 503 | uword |
| 504 | dpdk_input_rss (vlib_main_t * vm, |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 505 | vlib_node_runtime_t * node, vlib_frame_t * f) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 506 | { |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 507 | dpdk_main_t *dm = &dpdk_main; |
| 508 | dpdk_device_t *xd; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 509 | uword n_rx_packets = 0; |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 510 | dpdk_device_and_queue_t *dq; |
| 511 | u32 cpu_index = os_get_cpu_number (); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 512 | |
| 513 | /* |
| 514 | * Poll all devices on this cpu for input/interrupts. |
| 515 | */ |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 516 | /* *INDENT-OFF* */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 517 | vec_foreach (dq, dm->devices_by_cpu[cpu_index]) |
| 518 | { |
| 519 | xd = vec_elt_at_index(dm->devices, dq->device); |
Damjan Marion | 4ee3a65 | 2016-11-15 19:47:58 +0100 | [diff] [blame^] | 520 | n_rx_packets += dpdk_device_input (dm, xd, node, cpu_index, dq->queue_id); |
Damjan Marion | 1c80e83 | 2016-05-11 23:07:18 +0200 | [diff] [blame] | 521 | } |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 522 | /* *INDENT-ON* */ |
Damjan Marion | 1c80e83 | 2016-05-11 23:07:18 +0200 | [diff] [blame] | 523 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 524 | poll_rate_limit (dm); |
Damjan Marion | 1c80e83 | 2016-05-11 23:07:18 +0200 | [diff] [blame] | 525 | |
| 526 | return n_rx_packets; |
| 527 | } |
| 528 | |
Damjan Marion | 2566567 | 2016-08-16 18:56:08 +0200 | [diff] [blame] | 529 | /* *INDENT-OFF* */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 530 | VLIB_REGISTER_NODE (dpdk_input_node) = { |
| 531 | .function = dpdk_input, |
| 532 | .type = VLIB_NODE_TYPE_INPUT, |
| 533 | .name = "dpdk-input", |
Damjan Marion | 51327ac | 2016-11-09 11:59:42 +0100 | [diff] [blame] | 534 | .sibling_of = "device-input", |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 535 | |
| 536 | /* Will be enabled if/when hardware is detected. */ |
| 537 | .state = VLIB_NODE_STATE_DISABLED, |
| 538 | |
| 539 | .format_buffer = format_ethernet_header_with_length, |
| 540 | .format_trace = format_dpdk_rx_dma_trace, |
| 541 | |
| 542 | .n_errors = DPDK_N_ERROR, |
| 543 | .error_strings = dpdk_error_strings, |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 544 | }; |
| 545 | |
Damjan Marion | 1c80e83 | 2016-05-11 23:07:18 +0200 | [diff] [blame] | 546 | |
| 547 | /* handle dpdk_input_rss alternative function */ |
| 548 | VLIB_NODE_FUNCTION_MULTIARCH_CLONE(dpdk_input) |
| 549 | VLIB_NODE_FUNCTION_MULTIARCH_CLONE(dpdk_input_rss) |
Damjan Marion | 1c80e83 | 2016-05-11 23:07:18 +0200 | [diff] [blame] | 550 | |
| 551 | /* this macro defines dpdk_input_rss_multiarch_select() */ |
| 552 | CLIB_MULTIARCH_SELECT_FN(dpdk_input); |
| 553 | CLIB_MULTIARCH_SELECT_FN(dpdk_input_rss); |
Damjan Marion | 1c80e83 | 2016-05-11 23:07:18 +0200 | [diff] [blame] | 554 | |