FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
node.c
Go to the documentation of this file.
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 <dpdk/buffer.h>
23 #include <dpdk/device/dpdk.h>
25 #include <vnet/mpls/packet.h>
26 #include <vnet/handoff.h>
27 #include <vnet/devices/devices.h>
29 #include <vnet/feature/feature.h>
30 
31 #include <dpdk/device/dpdk_priv.h>
32 
33 static char *dpdk_error_strings[] = {
34 #define _(n,s) s,
36 #undef _
37 };
38 
39 /* make sure all flags we need are stored in lower 32 bits */
40 STATIC_ASSERT ((u64) (PKT_RX_IP_CKSUM_BAD | PKT_RX_FDIR | PKT_RX_LRO) <
41  (1ULL << 32),
42  "dpdk flags not in lower word, fix needed");
43 
46  struct rte_mbuf *mb, vlib_buffer_t * bt)
47 {
48  u8 nb_seg = 1;
49  struct rte_mbuf *mb_seg = 0;
50  vlib_buffer_t *b_seg, *b_chain = 0;
51  mb_seg = mb->next;
52  b_chain = b;
53 
54  if (mb->nb_segs < 2)
55  return 0;
56 
57  b->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
59 
60  while (nb_seg < mb->nb_segs)
61  {
62  ASSERT (mb_seg != 0);
63 
64  b_seg = vlib_buffer_from_rte_mbuf (mb_seg);
65  vlib_buffer_copy_template (b_seg, bt);
66 
67  /*
68  * The driver (e.g. virtio) may not put the packet data at the start
69  * of the segment, so don't assume b_seg->current_data == 0 is correct.
70  */
71  b_seg->current_data =
72  (mb_seg->buf_addr + mb_seg->data_off) - (void *) b_seg->data;
73 
74  b_seg->current_length = mb_seg->data_len;
75  b->total_length_not_including_first_buffer += mb_seg->data_len;
76 
77  b_chain->flags |= VLIB_BUFFER_NEXT_PRESENT;
78  b_chain->next_buffer = vlib_get_buffer_index (vm, b_seg);
79 
80  b_chain = b_seg;
81  mb_seg = mb_seg->next;
82  nb_seg++;
83  }
85 }
86 
88 dpdk_prefetch_mbuf_x4 (struct rte_mbuf *mb[])
89 {
90  clib_prefetch_load (mb[0]);
91  clib_prefetch_load (mb[1]);
92  clib_prefetch_load (mb[2]);
93  clib_prefetch_load (mb[3]);
94 }
95 
97 dpdk_prefetch_buffer_x4 (struct rte_mbuf *mb[])
98 {
100  b = vlib_buffer_from_rte_mbuf (mb[0]);
102  b = vlib_buffer_from_rte_mbuf (mb[1]);
104  b = vlib_buffer_from_rte_mbuf (mb[2]);
106  b = vlib_buffer_from_rte_mbuf (mb[3]);
108 }
109 
110 /** \brief Main DPDK input node
111  @node dpdk-input
112 
113  This is the main DPDK input node: across each assigned interface,
114  call rte_eth_rx_burst(...) or similar to obtain a vector of
115  packets to process. Derive @c vlib_buffer_t metadata from
116  <code>struct rte_mbuf</code> metadata,
117  Depending on the resulting metadata: adjust <code>b->current_data,
118  b->current_length </code> and dispatch directly to
119  ip4-input-no-checksum, or ip6-input. Trace the packet if required.
120 
121  @param vm vlib_main_t corresponding to the current thread
122  @param node vlib_node_runtime_t
123  @param f vlib_frame_t input-node, not used.
124 
125  @par Graph mechanics: buffer metadata, next index usage
126 
127  @em Uses:
128  - <code>struct rte_mbuf mb->ol_flags</code>
129  - PKT_RX_IP_CKSUM_BAD
130 
131  @em Sets:
132  - <code>b->error</code> if the packet is to be dropped immediately
133  - <code>b->current_data, b->current_length</code>
134  - adjusted as needed to skip the L2 header in direct-dispatch cases
135  - <code>vnet_buffer(b)->sw_if_index[VLIB_RX]</code>
136  - rx interface sw_if_index
137  - <code>vnet_buffer(b)->sw_if_index[VLIB_TX] = ~0</code>
138  - required by ipX-lookup
139  - <code>b->flags</code>
140  - to indicate multi-segment pkts (VLIB_BUFFER_NEXT_PRESENT), etc.
141 
142  <em>Next Nodes:</em>
143  - Static arcs to: error-drop, ethernet-input,
144  ip4-input-no-checksum, ip6-input, mpls-input
145  - per-interface redirection, controlled by
146  <code>xd->per_interface_next_index</code>
147 */
148 
150 dpdk_ol_flags_extract (struct rte_mbuf **mb, u32 *flags, int count)
151 {
152  u32 rv = 0;
153  int i;
154  for (i = 0; i < count; i++)
155  {
156  /* all flags we are interested in are in lower 8 bits but
157  that might change */
158  flags[i] = (u32) mb[i]->ol_flags;
159  rv |= flags[i];
160  }
161  return rv;
162 }
163 
166  uword n_rx_packets, int maybe_multiseg, u32 *or_flagsp)
167 {
168  u32 n_left = n_rx_packets;
169  vlib_buffer_t *b[4];
170  struct rte_mbuf **mb = ptd->mbufs;
171  uword n_bytes = 0;
172  u32 *flags, or_flags = 0;
173  vlib_buffer_t bt;
174 
175  mb = ptd->mbufs;
176  flags = ptd->flags;
177 
178  /* copy template into local variable - will save per packet load */
180  while (n_left >= 8)
181  {
182  dpdk_prefetch_buffer_x4 (mb + 4);
183 
184  b[0] = vlib_buffer_from_rte_mbuf (mb[0]);
185  b[1] = vlib_buffer_from_rte_mbuf (mb[1]);
186  b[2] = vlib_buffer_from_rte_mbuf (mb[2]);
187  b[3] = vlib_buffer_from_rte_mbuf (mb[3]);
188 
189  vlib_buffer_copy_template (b[0], &bt);
190  vlib_buffer_copy_template (b[1], &bt);
191  vlib_buffer_copy_template (b[2], &bt);
192  vlib_buffer_copy_template (b[3], &bt);
193 
194  dpdk_prefetch_mbuf_x4 (mb + 4);
195 
196  or_flags |= dpdk_ol_flags_extract (mb, flags, 4);
197  flags += 4;
198 
199  b[0]->current_data = mb[0]->data_off - RTE_PKTMBUF_HEADROOM;
200  n_bytes += b[0]->current_length = mb[0]->data_len;
201 
202  b[1]->current_data = mb[1]->data_off - RTE_PKTMBUF_HEADROOM;
203  n_bytes += b[1]->current_length = mb[1]->data_len;
204 
205  b[2]->current_data = mb[2]->data_off - RTE_PKTMBUF_HEADROOM;
206  n_bytes += b[2]->current_length = mb[2]->data_len;
207 
208  b[3]->current_data = mb[3]->data_off - RTE_PKTMBUF_HEADROOM;
209  n_bytes += b[3]->current_length = mb[3]->data_len;
210 
211  if (maybe_multiseg)
212  {
213  n_bytes += dpdk_process_subseq_segs (vm, b[0], mb[0], &bt);
214  n_bytes += dpdk_process_subseq_segs (vm, b[1], mb[1], &bt);
215  n_bytes += dpdk_process_subseq_segs (vm, b[2], mb[2], &bt);
216  n_bytes += dpdk_process_subseq_segs (vm, b[3], mb[3], &bt);
217  }
218 
219  /* next */
220  mb += 4;
221  n_left -= 4;
222  }
223 
224  while (n_left)
225  {
226  b[0] = vlib_buffer_from_rte_mbuf (mb[0]);
227  vlib_buffer_copy_template (b[0], &bt);
228  or_flags |= dpdk_ol_flags_extract (mb, flags, 1);
229  flags += 1;
230 
231  b[0]->current_data = mb[0]->data_off - RTE_PKTMBUF_HEADROOM;
232  n_bytes += b[0]->current_length = mb[0]->data_len;
233 
234  if (maybe_multiseg)
235  n_bytes += dpdk_process_subseq_segs (vm, b[0], mb[0], &bt);
236 
237  /* next */
238  mb += 1;
239  n_left -= 1;
240  }
241 
242  *or_flagsp = or_flags;
243  return n_bytes;
244 }
245 
248  uword n_rx_packets)
249 {
250  uword n;
252  vlib_buffer_t *b0;
253 
254  /* TODO prefetch and quad-loop */
255  for (n = 0; n < n_rx_packets; n++)
256  {
257  if ((ptd->flags[n] & PKT_RX_FDIR_ID) == 0)
258  continue;
259 
261  ptd->mbufs[n]->hash.fdir.hi);
262 
263  if (fle->next_index != (u16) ~ 0)
264  ptd->next[n] = fle->next_index;
265 
266  if (fle->flow_id != ~0)
267  {
268  b0 = vlib_buffer_from_rte_mbuf (ptd->mbufs[n]);
269  b0->flow_id = fle->flow_id;
270  }
271 
272  if (fle->buffer_advance != ~0)
273  {
274  b0 = vlib_buffer_from_rte_mbuf (ptd->mbufs[n]);
276  }
277  }
278 }
279 
282 {
283  u16 l4_hdr_sz = 0;
284  u16 current_offset = 0;
286  tcp_header_t *tcp;
288  u16 ethertype;
289  e = (void *) data;
290  current_offset += sizeof (e[0]);
291  ethertype = clib_net_to_host_u16 (e->type);
292  if (ethernet_frame_is_tagged (ethertype))
293  {
295  ethertype = clib_net_to_host_u16 (vlan->type);
296  current_offset += sizeof (*vlan);
297  if (ethertype == ETHERNET_TYPE_VLAN)
298  {
299  vlan++;
300  current_offset += sizeof (*vlan);
301  ethertype = clib_net_to_host_u16 (vlan->type);
302  }
303  }
304  data += current_offset;
305  if (ethertype == ETHERNET_TYPE_IP4)
306  {
307  data += sizeof (ip4_header_t);
308  tcp = (void *) data;
309  l4_hdr_sz = tcp_header_bytes (tcp);
310  }
311  else
312  {
313  /* FIXME: extension headers...*/
314  data += sizeof (ip6_header_t);
315  tcp = (void *) data;
316  l4_hdr_sz = tcp_header_bytes (tcp);
317  }
318  return l4_hdr_sz;
319 }
320 
323  uword n_rx_packets)
324 {
325  uword n;
326  vlib_buffer_t *b0;
327  for (n = 0; n < n_rx_packets; n++)
328  {
329  b0 = vlib_buffer_from_rte_mbuf (ptd->mbufs[n]);
330  if (ptd->flags[n] & PKT_RX_LRO)
331  {
332  b0->flags |= VNET_BUFFER_F_GSO;
333  vnet_buffer2 (b0)->gso_size = ptd->mbufs[n]->tso_segsz;
334  vnet_buffer2 (b0)->gso_l4_hdr_sz = dpdk_lro_find_l4_hdr_sz (b0);
335  }
336  }
337 }
338 
342 {
343  uword n_rx_packets = 0, n_rx_bytes;
344  dpdk_rx_queue_t *rxq = vec_elt_at_index (xd->rx_queues, queue_id);
345  u32 n_left, n_trace;
346  u32 *buffers;
348  struct rte_mbuf **mb;
349  vlib_buffer_t *b0;
350  u16 *next;
351  u32 or_flags;
352  u32 n;
353  int single_next = 0;
354 
356  thread_index);
357  vlib_buffer_t *bt = &ptd->buffer_template;
358 
359  if ((xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP) == 0)
360  return 0;
361 
362  /* get up to DPDK_RX_BURST_SZ buffers from PMD */
363  while (n_rx_packets < DPDK_RX_BURST_SZ)
364  {
365  n = rte_eth_rx_burst (xd->port_id, queue_id,
366  ptd->mbufs + n_rx_packets,
367  DPDK_RX_BURST_SZ - n_rx_packets);
368  n_rx_packets += n;
369 
370  if (n < 32)
371  break;
372  }
373 
374  if (n_rx_packets == 0)
375  return 0;
376 
377  /* Update buffer template */
378  vnet_buffer (bt)->sw_if_index[VLIB_RX] = xd->sw_if_index;
379  bt->error = node->errors[DPDK_ERROR_NONE];
380  /* as DPDK is allocating empty buffers from mempool provided before interface
381  start for each queue, it is safe to store this in the template */
383  bt->ref_count = 1;
384  vnet_buffer (bt)->feature_arc_index = 0;
385  bt->current_config_index = 0;
386 
387  /* receive burst of packets from DPDK PMD */
388  if (PREDICT_FALSE (xd->per_interface_next_index != ~0))
390 
391  /* as all packets belong to the same interface feature arc lookup
392  can be don once and result stored in the buffer template */
395 
396  if (xd->flags & DPDK_DEVICE_FLAG_MAYBE_MULTISEG)
397  n_rx_bytes = dpdk_process_rx_burst (vm, ptd, n_rx_packets, 1, &or_flags);
398  else
399  n_rx_bytes = dpdk_process_rx_burst (vm, ptd, n_rx_packets, 0, &or_flags);
400 
401  if (PREDICT_FALSE ((or_flags & PKT_RX_LRO)))
402  dpdk_process_lro_offload (xd, ptd, n_rx_packets);
403 
404  if (PREDICT_FALSE (or_flags & PKT_RX_FDIR))
405  {
406  /* some packets will need to go to different next nodes */
407  for (n = 0; n < n_rx_packets; n++)
408  ptd->next[n] = next_index;
409 
410  /* flow offload - process if rx flow offload enabled and at least one
411  packet is marked */
412  if (PREDICT_FALSE ((xd->flags & DPDK_DEVICE_FLAG_RX_FLOW_OFFLOAD) &&
413  (or_flags & PKT_RX_FDIR)))
414  dpdk_process_flow_offload (xd, ptd, n_rx_packets);
415 
416  /* enqueue buffers to the next node */
418  ptd->buffers, n_rx_packets,
419  sizeof (struct rte_mbuf));
420 
422  n_rx_packets);
423  }
424  else
425  {
426  u32 *to_next, n_left_to_next;
427 
428  vlib_get_new_next_frame (vm, node, next_index, to_next, n_left_to_next);
429  vlib_get_buffer_indices_with_offset (vm, (void **) ptd->mbufs, to_next,
430  n_rx_packets,
431  sizeof (struct rte_mbuf));
432 
434  {
435  vlib_next_frame_t *nf;
436  vlib_frame_t *f;
439  f = vlib_get_frame (vm, nf->frame);
441 
442  ef = vlib_frame_scalar_args (f);
443  ef->sw_if_index = xd->sw_if_index;
444  ef->hw_if_index = xd->hw_if_index;
445 
446  /* if PMD supports ip4 checksum check and there are no packets
447  marked as ip4 checksum bad we can notify ethernet input so it
448  can send pacets to ip4-input-no-checksum node */
449  if (xd->flags & DPDK_DEVICE_FLAG_RX_IP4_CKSUM &&
450  (or_flags & PKT_RX_IP_CKSUM_BAD) == 0)
453  }
454  n_left_to_next -= n_rx_packets;
455  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
456  single_next = 1;
457  }
458 
459  /* packet trace if enabled */
460  if (PREDICT_FALSE ((n_trace = vlib_get_trace_count (vm, node))))
461  {
462  if (single_next)
464  ptd->buffers, n_rx_packets,
465  sizeof (struct rte_mbuf));
466 
467  n_left = n_rx_packets;
468  buffers = ptd->buffers;
469  mb = ptd->mbufs;
470  next = ptd->next;
471 
472  while (n_trace && n_left)
473  {
474  b0 = vlib_get_buffer (vm, buffers[0]);
475  if (single_next == 0)
476  next_index = next[0];
477 
478  if (PREDICT_TRUE
480  (vm, node, next_index, b0, /* follow_chain */ 0)))
481  {
482 
483  dpdk_rx_trace_t *t0 =
484  vlib_add_trace (vm, node, b0, sizeof t0[0]);
485  t0->queue_index = queue_id;
486  t0->device_index = xd->device_index;
488 
489  clib_memcpy_fast (&t0->mb, mb[0], sizeof t0->mb);
490  clib_memcpy_fast (&t0->buffer, b0,
491  sizeof b0[0] - sizeof b0->pre_data);
493  sizeof t0->buffer.pre_data);
494  clib_memcpy_fast (&t0->data, mb[0]->buf_addr + mb[0]->data_off,
495  sizeof t0->data);
496  n_trace--;
497  }
498 
499  n_left--;
500  buffers++;
501  mb++;
502  next++;
503  }
504  vlib_set_trace_count (vm, node, n_trace);
505  }
506 
508  (vnet_get_main ()->interface_main.combined_sw_if_counters
510  n_rx_packets, n_rx_bytes);
511 
513 
514  return n_rx_packets;
515 }
516 
518  vlib_frame_t * f)
519 {
520  dpdk_main_t *dm = &dpdk_main;
521  dpdk_device_t *xd;
522  uword n_rx_packets = 0;
525 
526  /*
527  * Poll all devices on this cpu for input/interrupts.
528  */
529 
531 
532  for (int i = 0; i < vec_len (pv); i++)
533  {
534  xd = vec_elt_at_index (dm->devices, pv[i].dev_instance);
535  n_rx_packets +=
536  dpdk_device_input (vm, dm, xd, node, thread_index, pv[i].queue_id);
537  }
538  return n_rx_packets;
539 }
540 
541 /* *INDENT-OFF* */
543  .type = VLIB_NODE_TYPE_INPUT,
544  .name = "dpdk-input",
545  .sibling_of = "device-input",
547 
548  /* Will be enabled if/when hardware is detected. */
549  .state = VLIB_NODE_STATE_DISABLED,
550 
551  .format_buffer = format_ethernet_header_with_length,
552  .format_trace = format_dpdk_rx_trace,
553 
554  .n_errors = DPDK_N_ERROR,
555  .error_strings = dpdk_error_strings,
556 };
557 /* *INDENT-ON* */
558 
559 /*
560  * fd.io coding-style-patch-verification: ON
561  *
562  * Local Variables:
563  * eval: (c-set-style "gnu")
564  * End:
565  */
vlib_get_frame
static vlib_frame_t * vlib_get_frame(vlib_main_t *vm, vlib_frame_t *f)
Definition: node_funcs.h:273
vlib_buffer_t::next_buffer
u32 next_buffer
Next buffer for this linked-list of buffers.
Definition: buffer.h:149
dpdk_flow_lookup_entry_t::flow_id
u32 flow_id
Definition: dpdk.h:162
dpdk.h
vlib_buffer_t::buffer_pool_index
u8 buffer_pool_index
index of buffer pool this buffer belongs.
Definition: buffer.h:142
tcp_header_bytes
static int tcp_header_bytes(tcp_header_t *t)
Definition: tcp_packet.h:93
thread_index
u32 thread_index
Definition: nat44_ei_hairpinning.c:495
dpdk_device_t::flags
u16 flags
Definition: dpdk.h:200
dpdk_main_t::devices
dpdk_device_t * devices
Definition: dpdk.h:361
next_index
nat44_ei_hairpin_src_next_t next_index
Definition: nat44_ei_hairpinning.c:412
format_dpdk_rx_trace
format_function_t format_dpdk_rx_trace
Definition: dpdk.h:481
vlib_get_buffer
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:111
f
vlib_frame_t * f
Definition: interface_output.c:1098
ethernet_vlan_header_t
Definition: packet.h:128
dpdk_rx_queue_t
Definition: dpdk.h:167
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
ethernet_frame_is_tagged
static_always_inline int ethernet_frame_is_tagged(u16 type)
Definition: ethernet.h:77
tcp_header_t
struct _tcp_header tcp_header_t
next
u16 * next
Definition: nat44_ei_out2in.c:718
dpdk_lro_find_l4_hdr_sz
static_always_inline u16 dpdk_lro_find_l4_hdr_sz(vlib_buffer_t *b)
Definition: node.c:281
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
vnet_device_input_have_features
static_always_inline int vnet_device_input_have_features(u32 sw_if_index)
Definition: feature.h:336
VLIB_NODE_TYPE_INPUT
@ VLIB_NODE_TYPE_INPUT
Definition: node.h:76
DPDK_RX_BURST_SZ
#define DPDK_RX_BURST_SZ
Definition: dpdk.h:344
u16
unsigned short u16
Definition: types.h:57
DPDK_N_ERROR
@ DPDK_N_ERROR
Definition: dpdk.h:435
ethernet_header_t::type
u16 type
Definition: packet.h:59
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
VLIB_RX
@ VLIB_RX
Definition: defs.h:46
dpdk_device_t::port_id
dpdk_portid_t port_id
Definition: dpdk.h:203
vlib_get_trace_count
static u32 vlib_get_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt)
Definition: trace_funcs.h:212
dpdk_rx_trace_t::mb
struct rte_mbuf mb
Definition: dpdk.h:409
handoff.h
packet.h
vlib_buffer_enqueue_to_next
vlib_buffer_enqueue_to_next(vm, node, from,(u16 *) nexts, frame->n_vectors)
dpdk_prefetch_buffer_x4
static_always_inline void dpdk_prefetch_buffer_x4(struct rte_mbuf *mb[])
Definition: node.c:97
vnet_buffer2
#define vnet_buffer2(b)
Definition: buffer.h:505
VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT
@ VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT
Definition: devices.h:28
vlib_frame_t
Definition: node.h:372
clib_memcpy_fast
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
Definition: string.h:92
ip4_header_t
Definition: ip4_packet.h:87
ethernet.h
dpdk_rx_trace_t::buffer
vlib_buffer_t buffer
Definition: dpdk.h:411
vlib_frame_no_append
static void vlib_frame_no_append(vlib_frame_t *f)
Definition: node_funcs.h:281
dpdk_rx_trace_t::buffer_index
u32 buffer_index
Definition: dpdk.h:406
vlib_buffer_t::current_data
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
Definition: buffer.h:119
dpdk_device_t::per_interface_next_index
u32 per_interface_next_index
Definition: dpdk.h:196
dpdk_process_subseq_segs
static_always_inline uword dpdk_process_subseq_segs(vlib_main_t *vm, vlib_buffer_t *b, struct rte_mbuf *mb, vlib_buffer_t *bt)
Definition: node.c:45
dpdk_device_t::hw_if_index
u32 hw_if_index
Definition: dpdk.h:192
vlib_buffer_advance
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
Definition: buffer.h:276
count
u8 count
Definition: dhcp.api:208
dpdk_process_rx_burst
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, u32 *or_flagsp)
Definition: node.c:165
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
vlib_buffer_t::error
vlib_error_t error
Error code for buffers to be enqueued to error handler.
Definition: buffer.h:145
foreach_dpdk_error
#define foreach_dpdk_error
Definition: dpdk.h:421
error.h
VLIB_NODE_FN
#define VLIB_NODE_FN(node)
Definition: node.h:202
feature.h
vnet_buffer
#define vnet_buffer(b)
Definition: buffer.h:441
vec_elt_at_index
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Definition: vec_bootstrap.h:203
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
PREDICT_FALSE
#define PREDICT_FALSE(x)
Definition: clib.h:124
dpdk_flow_lookup_entry_t::buffer_advance
i16 buffer_advance
Definition: dpdk.h:164
vlib_get_buffer_index
static u32 vlib_get_buffer_index(vlib_main_t *vm, void *p)
Translate buffer pointer into buffer index.
Definition: buffer_funcs.h:324
dpdk_device_t::device_index
u32 device_index
Definition: dpdk.h:190
dpdk_main
dpdk_main_t dpdk_main
Definition: init.c:48
rx_queue_funcs.h
dpdk_main_t
Definition: dpdk.h:357
static_always_inline
#define static_always_inline
Definition: clib.h:112
vlib_buffer_from_rte_mbuf
#define vlib_buffer_from_rte_mbuf(x)
Definition: buffer.h:20
dpdk_rx_trace_t
Definition: dpdk.h:404
dpdk_process_flow_offload
static_always_inline void dpdk_process_flow_offload(dpdk_device_t *xd, dpdk_per_thread_data_t *ptd, uword n_rx_packets)
Definition: node.c:247
uword
u64 uword
Definition: types.h:112
dpdk_main_t::per_thread_data
dpdk_per_thread_data_t * per_thread_data
Definition: dpdk.h:362
if
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
ethernet_header_t
Definition: packet.h:52
buffer.h
vlib_main_t::thread_index
u32 thread_index
Definition: main.h:215
vlib_buffer_copy_template
static_always_inline void vlib_buffer_copy_template(vlib_buffer_t *b, vlib_buffer_t *bt)
Definition: buffer_funcs.h:171
VLIB_NODE_FLAG_TRACE_SUPPORTED
#define VLIB_NODE_FLAG_TRACE_SUPPORTED
Definition: node.h:295
dpdk_per_thread_data_t
Definition: dpdk.h:346
format.h
vlib_buffer_t::ref_count
volatile u8 ref_count
Reference count for this buffer.
Definition: buffer.h:139
STATIC_ASSERT
STATIC_ASSERT(STRUCT_OFFSET_OF(vnet_buffer_opaque_t, l2_hdr_offset)==STRUCT_OFFSET_OF(vnet_buffer_opaque_t, l3_hdr_offset) - 2, "l3_hdr_offset must follow l2_hdr_offset")
vlib_buffer_t::flow_id
u32 flow_id
Generic flow identifier.
Definition: buffer.h:136
VNET_INTERFACE_COUNTER_RX
@ VNET_INTERFACE_COUNTER_RX
Definition: interface.h:915
dpdk_prefetch_mbuf_x4
static_always_inline void dpdk_prefetch_mbuf_x4(struct rte_mbuf *mb[])
Definition: node.c:88
dpdk_rx_trace_t::data
u8 data[256]
Definition: dpdk.h:410
vlib_get_buffer_indices_with_offset
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.
Definition: buffer_funcs.h:343
vlib_set_trace_count
static void vlib_set_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt, u32 count)
Definition: trace_funcs.h:226
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
vlib_buffer_t::current_length
u16 current_length
Nbytes between current data and the end of this buffer.
Definition: buffer.h:122
vlib_frame_scalar_args
static void * vlib_frame_scalar_args(vlib_frame_t *f)
Get pointer to frame scalar data.
Definition: node_funcs.h:315
dpdk_per_thread_data_t::next
u16 next[DPDK_RX_BURST_SZ]
Definition: dpdk.h:351
data
u8 data[128]
Definition: ipsec_types.api:95
vlib_buffer_t::current_config_index
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
Definition: buffer.h:156
ethernet_input_frame_t::sw_if_index
u32 sw_if_index
Definition: ethernet.h:58
xxhash.h
dpdk_per_thread_data_t::mbufs
struct rte_mbuf * mbufs[DPDK_RX_BURST_SZ]
Definition: dpdk.h:349
dpdk_device_input
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)
Definition: node.c:340
dpdk_device_t::flow_lookup_entries
dpdk_flow_lookup_entry_t * flow_lookup_entries
Definition: dpdk.h:224
dpdk_rx_trace_t::queue_index
u16 queue_index
Definition: dpdk.h:408
u64
unsigned long u64
Definition: types.h:89
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
vlib_put_next_frame
vlib_put_next_frame(vm, node, next_index, 0)
vlib_frame_t::flags
u16 flags
Definition: node.h:378
dpdk_ol_flags_extract
static_always_inline u32 dpdk_ol_flags_extract(struct rte_mbuf **mb, u32 *flags, int count)
Main DPDK input node.
Definition: node.c:150
u32
unsigned int u32
Definition: types.h:88
format_ethernet_header_with_length
u8 * format_ethernet_header_with_length(u8 *s, va_list *args)
Definition: format.c:97
n_bytes
u32 n_bytes
Definition: interface_output.c:421
clib_prefetch_load
static_always_inline void clib_prefetch_load(void *p)
Definition: cache.h:92
dpdk_rx_trace_t::device_index
u16 device_index
Definition: dpdk.h:407
n_left
u32 n_left
Definition: interface_output.c:1096
ETH_INPUT_FRAME_F_IP4_CKSUM_OK
#define ETH_INPUT_FRAME_F_IP4_CKSUM_OK
Definition: ethernet.h:54
vnet_hw_if_get_rxq_poll_vector
static_always_inline vnet_hw_if_rxq_poll_vector_t * vnet_hw_if_get_rxq_poll_vector(vlib_main_t *vm, vlib_node_runtime_t *node)
Definition: rx_queue_funcs.h:70
ETH_INPUT_FRAME_F_SINGLE_SW_IF_IDX
#define ETH_INPUT_FRAME_F_SINGLE_SW_IF_IDX
Definition: ethernet.h:51
vlib_get_new_next_frame
#define vlib_get_new_next_frame(vm, node, next_index, vectors, n_vectors_left)
Definition: node_funcs.h:400
ip6_header_t
Definition: ip6_packet.h:294
ethernet_input_frame_t::hw_if_index
u32 hw_if_index
Definition: ethernet.h:59
vnet_classify.h
vec.h
vlib_main_t
Definition: main.h:102
dpdk_flow_lookup_entry_t::next_index
u16 next_index
Definition: dpdk.h:163
vlib_add_trace
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
Definition: trace.c:628
b
vlib_buffer_t ** b
Definition: nat44_ei_out2in.c:717
u8
unsigned char u8
Definition: types.h:56
vlib_buffer_get_current
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:257
vlib_buffer_t::data
u8 data[]
Packet data.
Definition: buffer.h:204
vnet_feature_start_device_input_x1
static_always_inline void vnet_feature_start_device_input_x1(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
Definition: feature.h:343
ethernet_vlan_header_t::type
u16 type
Definition: packet.h:136
ethernet_input_frame_t
Definition: ethernet.h:56
i
int i
Definition: flowhash_template.h:376
dpdk_per_thread_data_t::buffers
u32 buffers[DPDK_RX_BURST_SZ]
Definition: dpdk.h:350
dpdk_error_strings
static char * dpdk_error_strings[]
Definition: node.c:33
devices.h
dpdk_process_lro_offload
static_always_inline void dpdk_process_lro_offload(dpdk_device_t *xd, dpdk_per_thread_data_t *ptd, uword n_rx_packets)
Definition: node.c:322
rv
int __clib_unused rv
Definition: application.c:491
vnet_device_increment_rx_packets
static void vnet_device_increment_rx_packets(u32 thread_index, u64 count)
Definition: devices.h:86
dpdk_per_thread_data_t::flags
u32 flags[DPDK_RX_BURST_SZ]
Definition: dpdk.h:353
dpdk_rx_queue_t::buffer_pool_index
u8 buffer_pool_index
Definition: dpdk.h:170
vlib_buffer_t::pre_data
u8 pre_data[VLIB_BUFFER_PRE_DATA_SIZE]
Space for inserting data before buffer start.
Definition: buffer.h:201
vnet.h
vlib_node_runtime_t
Definition: node.h:454
vlib_next_frame_t
Definition: node.h:393
vlib_trace_buffer
static __clib_warn_unused_result int vlib_trace_buffer(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, vlib_buffer_t *b, int follow_chain)
Definition: trace_funcs.h:153
PREDICT_TRUE
#define PREDICT_TRUE(x)
Definition: clib.h:125
vlib_buffer_t::total_length_not_including_first_buffer
u32 total_length_not_including_first_buffer
Only valid for first buffer in chain.
Definition: buffer.h:176
vnet_hw_if_rxq_poll_vector_t::dev_instance
u32 dev_instance
Definition: interface.h:748
dpdk_device_t::sw_if_index
u32 sw_if_index
Definition: dpdk.h:193
dpdk_input_node
vlib_node_registration_t dpdk_input_node
(constructor) VLIB_REGISTER_NODE (dpdk_input_node)
Definition: node.c:542
vlib_node_runtime_get_next_frame
static vlib_next_frame_t * vlib_node_runtime_get_next_frame(vlib_main_t *vm, vlib_node_runtime_t *n, u32 next_index)
Definition: node_funcs.h:321
vlib_increment_combined_counter
vlib_increment_combined_counter(ccm, ti, sw_if_index, n_buffers, n_bytes)
vlib_next_frame_t::frame
vlib_frame_t * frame
Definition: node.h:396
dpdk_priv.h
vlib_buffer_t::flags
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
Definition: buffer.h:133
dpdk_device_t::rx_queues
dpdk_rx_queue_t * rx_queues
Definition: dpdk.h:186
dpdk_per_thread_data_t::buffer_template
vlib_buffer_t buffer_template
Definition: dpdk.h:354
vlib_buffer_t
VLIB buffer representation.
Definition: buffer.h:111
vnet_hw_if_rxq_poll_vector_t
Definition: interface.h:746
VLIB_REGISTER_NODE
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169
dpdk_flow_lookup_entry_t
Definition: dpdk.h:160
dpdk_device_t
Definition: dpdk.h:182
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105