FD.io VPP  v20.09-64-g4f7b92f0a
Vector Packet Processing
mpls_output.c
Go to the documentation of this file.
1 /*
2  * mpls_output.c: MPLS Adj rewrite
3  *
4  * Copyright (c) 2012-2014 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #include <vlib/vlib.h>
19 #include <vnet/pg/pg.h>
20 #include <vnet/ip/ip.h>
21 #include <vnet/mpls/mpls.h>
22 #include <vnet/ip/ip_frag.h>
23 
24 typedef struct {
25  /* Adjacency taken. */
29 
30 typedef enum {
34 
35 #define foreach_mpls_output_next \
36 _(DROP, "error-drop") \
37 _(FRAG, "mpls-frag")
38 
39 typedef enum {
40 #define _(s,n) MPLS_OUTPUT_NEXT_##s,
42 #undef _
45 
46 static u8 *
47 format_mpls_output_trace (u8 * s, va_list * args)
48 {
49  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
50  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
51  mpls_output_trace_t * t = va_arg (*args, mpls_output_trace_t *);
52 
53  s = format (s, "adj-idx %d : %U flow hash: 0x%08x",
54  t->adj_index,
56  t->flow_hash);
57  return s;
58 }
59 
60 static inline uword
63  vlib_frame_t * from_frame,
65 {
66  u32 n_left_from, next_index, * from, * to_next, thread_index;
67  vlib_node_runtime_t * error_node;
68  u32 n_left_to_next;
69  mpls_main_t *mm;
70 
71  thread_index = vlib_get_thread_index();
72  error_node = vlib_node_get_runtime (vm, mpls_output_node.index);
73  from = vlib_frame_vector_args (from_frame);
74  n_left_from = from_frame->n_vectors;
75  next_index = node->cached_next_index;
76  mm = &mpls_main;
77 
78  while (n_left_from > 0)
79  {
80  vlib_get_next_frame (vm, node, next_index,
81  to_next, n_left_to_next);
82 
83  while (n_left_from >= 4 && n_left_to_next >= 2)
84  {
85  ip_adjacency_t * adj0;
87  vlib_buffer_t * p0;
88  u32 pi0, adj_index0, next0, error0;
89  word rw_len0;
90 
91  ip_adjacency_t * adj1;
93  vlib_buffer_t * p1;
94  u32 pi1, adj_index1, next1, error1;
95  word rw_len1;
96 
97  /* Prefetch next iteration. */
98  {
99  vlib_buffer_t * p2, * p3;
100 
101  p2 = vlib_get_buffer (vm, from[2]);
102  p3 = vlib_get_buffer (vm, from[3]);
103 
104  vlib_prefetch_buffer_header (p2, STORE);
105  vlib_prefetch_buffer_header (p3, STORE);
106 
107  CLIB_PREFETCH (p2->data, sizeof (hdr0[0]), STORE);
108  CLIB_PREFETCH (p3->data, sizeof (hdr1[0]), STORE);
109  }
110 
111  pi0 = to_next[0] = from[0];
112  pi1 = to_next[1] = from[1];
113 
114  from += 2;
115  n_left_from -= 2;
116  to_next += 2;
117  n_left_to_next -= 2;
118 
119  p0 = vlib_get_buffer (vm, pi0);
120  p1 = vlib_get_buffer (vm, pi1);
121 
122  adj_index0 = vnet_buffer (p0)->ip.adj_index[VLIB_TX];
123  adj_index1 = vnet_buffer (p1)->ip.adj_index[VLIB_TX];
124 
125  adj0 = adj_get(adj_index0);
126  adj1 = adj_get(adj_index1);
127  hdr0 = vlib_buffer_get_current (p0);
128  hdr1 = vlib_buffer_get_current (p1);
129 
130  /* Guess we are only writing on simple Ethernet header. */
131  vnet_rewrite_two_headers (adj0[0], adj1[0], hdr0, hdr1,
132  sizeof (ethernet_header_t));
133 
134  /* Update packet buffer attributes/set output interface. */
135  rw_len0 = adj0[0].rewrite_header.data_bytes;
136  rw_len1 = adj1[0].rewrite_header.data_bytes;
137  vnet_buffer (p0)->mpls.save_rewrite_length = rw_len0;
138  vnet_buffer (p1)->mpls.save_rewrite_length = rw_len1;
139 
140  /* Bump the adj counters for packet and bytes */
143  thread_index,
144  adj_index0,
145  1,
146  vlib_buffer_length_in_chain (vm, p0) + rw_len0);
149  thread_index,
150  adj_index1,
151  1,
152  vlib_buffer_length_in_chain (vm, p1) + rw_len1);
153 
154  /* Check MTU of outgoing interface. */
156  adj0[0].rewrite_header.max_l3_packet_bytes))
157  {
158  vlib_buffer_advance(p0, -rw_len0);
159 
160  vnet_buffer (p0)->sw_if_index[VLIB_TX] =
161  adj0[0].rewrite_header.sw_if_index;
162  next0 = adj0[0].rewrite_header.next_index;
163  error0 = IP4_ERROR_NONE;
164 
165  if (PREDICT_FALSE(adj0[0].rewrite_header.flags & VNET_REWRITE_HAS_FEATURES))
167  adj0[0].rewrite_header.sw_if_index,
168  &next0, p0);
169  }
170  else
171  {
172  error0 = IP4_ERROR_MTU_EXCEEDED;
173  next0 = MPLS_OUTPUT_NEXT_FRAG;
175  MPLS_ERROR_PKTS_NEED_FRAG,
176  1);
177  }
179  adj1[0].rewrite_header.max_l3_packet_bytes))
180  {
181  vlib_buffer_advance(p1, -rw_len1);
182 
183  vnet_buffer (p1)->sw_if_index[VLIB_TX] =
184  adj1[0].rewrite_header.sw_if_index;
185  next1 = adj1[0].rewrite_header.next_index;
186  error1 = IP4_ERROR_NONE;
187 
188  if (PREDICT_FALSE(adj1[0].rewrite_header.flags & VNET_REWRITE_HAS_FEATURES))
190  adj1[0].rewrite_header.sw_if_index,
191  &next1, p1);
192  }
193  else
194  {
195  error1 = IP4_ERROR_MTU_EXCEEDED;
196  next1 = MPLS_OUTPUT_NEXT_FRAG;
198  MPLS_ERROR_PKTS_NEED_FRAG,
199  1);
200  }
201  if (mode == MPLS_OUTPUT_MIDCHAIN_MODE)
202  {
203  adj0->sub_type.midchain.fixup_func
204  (vm, adj0, p0,
205  adj0->sub_type.midchain.fixup_data);
206  adj1->sub_type.midchain.fixup_func
207  (vm, adj1, p1,
208  adj1->sub_type.midchain.fixup_data);
209  }
210 
211  p0->error = error_node->errors[error0];
212  p1->error = error_node->errors[error1];
213 
214  if (PREDICT_FALSE(p0->flags & VLIB_BUFFER_IS_TRACED))
215  {
216  mpls_output_trace_t *tr = vlib_add_trace (vm, node,
217  p0, sizeof (*tr));
218  tr->adj_index = vnet_buffer(p0)->ip.adj_index[VLIB_TX];
219  tr->flow_hash = vnet_buffer(p0)->ip.flow_hash;
220  }
221  if (PREDICT_FALSE(p1->flags & VLIB_BUFFER_IS_TRACED))
222  {
223  mpls_output_trace_t *tr = vlib_add_trace (vm, node,
224  p1, sizeof (*tr));
225  tr->adj_index = vnet_buffer(p1)->ip.adj_index[VLIB_TX];
226  tr->flow_hash = vnet_buffer(p1)->ip.flow_hash;
227  }
228 
229  vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
230  to_next, n_left_to_next,
231  pi0, pi1, next0, next1);
232  }
233 
234  while (n_left_from > 0 && n_left_to_next > 0)
235  {
236  ip_adjacency_t * adj0;
237  mpls_unicast_header_t *hdr0;
238  vlib_buffer_t * p0;
239  u32 pi0, adj_index0, next0, error0;
240  word rw_len0;
241 
242  pi0 = to_next[0] = from[0];
243 
244  p0 = vlib_get_buffer (vm, pi0);
245 
246  adj_index0 = vnet_buffer (p0)->ip.adj_index[VLIB_TX];
247 
248  adj0 = adj_get(adj_index0);
249  hdr0 = vlib_buffer_get_current (p0);
250 
251  /* Guess we are only writing on simple Ethernet header. */
252  vnet_rewrite_one_header (adj0[0], hdr0,
253  sizeof (ethernet_header_t));
254 
255  /* Update packet buffer attributes/set output interface. */
256  rw_len0 = adj0[0].rewrite_header.data_bytes;
257  vnet_buffer (p0)->mpls.save_rewrite_length = rw_len0;
258 
261  thread_index,
262  adj_index0,
263  1,
264  vlib_buffer_length_in_chain (vm, p0) + rw_len0);
265 
266  /* Check MTU of outgoing interface. */
268  adj0[0].rewrite_header.max_l3_packet_bytes))
269  {
270  vlib_buffer_advance(p0, -rw_len0);
271 
272  vnet_buffer (p0)->sw_if_index[VLIB_TX] =
273  adj0[0].rewrite_header.sw_if_index;
274  next0 = adj0[0].rewrite_header.next_index;
275  error0 = IP4_ERROR_NONE;
276 
277  if (PREDICT_FALSE(adj0[0].rewrite_header.flags & VNET_REWRITE_HAS_FEATURES))
279  adj0[0].rewrite_header.sw_if_index,
280  &next0, p0);
281  }
282  else
283  {
284  error0 = IP4_ERROR_MTU_EXCEEDED;
285  next0 = MPLS_OUTPUT_NEXT_FRAG;
287  MPLS_ERROR_PKTS_NEED_FRAG,
288  1);
289  }
290  if (mode == MPLS_OUTPUT_MIDCHAIN_MODE)
291  {
292  adj0->sub_type.midchain.fixup_func
293  (vm, adj0, p0,
294  adj0->sub_type.midchain.fixup_data);
295  }
296 
297  p0->error = error_node->errors[error0];
298 
299  from += 1;
300  n_left_from -= 1;
301  to_next += 1;
302  n_left_to_next -= 1;
303 
304  if (PREDICT_FALSE(p0->flags & VLIB_BUFFER_IS_TRACED))
305  {
306  mpls_output_trace_t *tr = vlib_add_trace (vm, node,
307  p0, sizeof (*tr));
308  tr->adj_index = vnet_buffer(p0)->ip.adj_index[VLIB_TX];
309  tr->flow_hash = vnet_buffer(p0)->ip.flow_hash;
310  }
311 
312  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
313  to_next, n_left_to_next,
314  pi0, next0);
315  }
316 
317  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
318  }
320  MPLS_ERROR_PKTS_ENCAP,
321  from_frame->n_vectors);
322 
323  return from_frame->n_vectors;
324 }
325 
326 static char * mpls_error_strings[] = {
327 #define mpls_error(n,s) s,
328 #include "error.def"
329 #undef mpls_error
330 };
331 
334  vlib_frame_t * from_frame)
335 {
336  return (mpls_output_inline(vm, node, from_frame, MPLS_OUTPUT_MODE));
337 }
338 
340  .name = "mpls-output",
341  /* Takes a vector of packets. */
342  .vector_size = sizeof (u32),
343  .n_errors = MPLS_N_ERROR,
344  .error_strings = mpls_error_strings,
345 
346  .n_next_nodes = MPLS_OUTPUT_N_NEXT,
347  .next_nodes = {
348  [MPLS_OUTPUT_NEXT_DROP] = "mpls-drop",
349  [MPLS_OUTPUT_NEXT_FRAG] = "mpls-frag",
350  },
351  .format_trace = format_mpls_output_trace,
352 };
353 
356  vlib_frame_t * from_frame)
357 {
358  return (mpls_output_inline(vm, node, from_frame, MPLS_OUTPUT_MIDCHAIN_MODE));
359 }
360 
362  .name = "mpls-midchain",
363  .vector_size = sizeof (u32),
364 
365  .n_errors = MPLS_N_ERROR,
366  .error_strings = mpls_error_strings,
367 
368  .sibling_of = "mpls-output",
369  .format_trace = format_mpls_output_trace,
370 };
371 
372 static char *mpls_frag_error_strings[] = {
373 #define _(sym,string) string,
375 #undef _
376 };
377 
378 typedef struct mpls_frag_trace_t_
379 {
383 
384 typedef enum
385 {
392 
393 static uword
397 {
398  u32 n_left_from, next_index, * from, * to_next, n_left_to_next, *frags;
399  vlib_node_runtime_t * error_node;
400 
401  error_node = vlib_node_get_runtime (vm, mpls_output_node.index);
402  from = vlib_frame_vector_args (frame);
403  n_left_from = frame->n_vectors;
404  next_index = node->cached_next_index;
405  frags = NULL;
406 
407  while (n_left_from > 0)
408  {
409  vlib_get_next_frame (vm, node, next_index,
410  to_next, n_left_to_next);
411 
412  while (n_left_from > 0 && n_left_to_next > 0)
413  {
414  ip_adjacency_t * adj0;
415  vlib_buffer_t * p0;
416  mpls_frag_next_t next0;
417  u32 pi0, adj_index0;
418  ip_frag_error_t error0 = IP_FRAG_ERROR_NONE;
419  i16 encap_size;
420  u8 is_ip4;
421 
422  pi0 = to_next[0] = from[0];
423  p0 = vlib_get_buffer (vm, pi0);
424  from += 1;
425  n_left_from -= 1;
426  is_ip4 = vnet_buffer (p0)->mpls.pyld_proto == DPO_PROTO_IP4;
427 
428  adj_index0 = vnet_buffer (p0)->ip.adj_index[VLIB_TX];
429  adj0 = adj_get(adj_index0);
430 
431  /* the size of the MPLS stack */
432  encap_size = vnet_buffer(p0)->l3_hdr_offset - p0->current_data;
433 
434  /* IP fragmentation */
435  if (is_ip4)
436  error0 = ip4_frag_do_fragment (vm, pi0,
437  adj0->rewrite_header.max_l3_packet_bytes,
438  encap_size, &frags);
439  else
440  error0 = ip6_frag_do_fragment (vm, pi0,
441  adj0->rewrite_header.max_l3_packet_bytes,
442  encap_size, &frags);
443 
444  if (PREDICT_FALSE (p0->flags & VLIB_BUFFER_IS_TRACED))
445  {
446  mpls_frag_trace_t *tr =
447  vlib_add_trace (vm, node, p0, sizeof (*tr));
448  tr->mtu = adj0->rewrite_header.max_l3_packet_bytes;
450  }
451 
452  if (PREDICT_TRUE(error0 == IP_FRAG_ERROR_NONE))
453  {
454  /* Free original buffer chain */
455  vlib_buffer_free_one (vm, pi0); /* Free original packet */
456  next0 = (IP_LOOKUP_NEXT_MIDCHAIN == adj0->lookup_next_index ?
459  }
460  else if (is_ip4 && error0 == IP_FRAG_ERROR_DONT_FRAGMENT_SET)
461  {
463  p0, ICMP4_destination_unreachable,
464  ICMP4_destination_unreachable_fragmentation_needed_and_dont_fragment_set,
465  vnet_buffer (p0)->ip_frag.mtu);
467  }
468  else
469  {
470  vlib_error_count (vm, mpls_output_node.index, error0, 1);
471  vec_add1 (frags, pi0); /* Get rid of the original buffer */
472  next0 = MPLS_FRAG_NEXT_DROP;
473  }
474 
475  /* Send fragments that were added in the frame */
476  u32 *frag_from, frag_left;
477 
478  frag_from = frags;
479  frag_left = vec_len (frags);
480 
481  while (frag_left > 0)
482  {
483  while (frag_left > 0 && n_left_to_next > 0)
484  {
485  u32 i;
486  i = to_next[0] = frag_from[0];
487  frag_from += 1;
488  frag_left -= 1;
489  to_next += 1;
490  n_left_to_next -= 1;
491 
492  p0 = vlib_get_buffer (vm, i);
493  p0->error = error_node->errors[error0];
494 
495  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
496  to_next, n_left_to_next, i,
497  next0);
498  }
499  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
500  vlib_get_next_frame (vm, node, next_index, to_next,
501  n_left_to_next);
502  }
503  vec_reset_length (frags);
504  }
505  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
506  }
507  vec_free (frags);
508 
509  return frame->n_vectors;
510 }
511 
512 static u8 *
513 format_mpls_frag_trace (u8 * s, va_list * args)
514 {
515  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
516  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
517  mpls_frag_trace_t *t = va_arg (*args, mpls_frag_trace_t *);
518 
519  s = format (s, "mtu:%d pkt-size:%d", t->mtu, t->pkt_size);
520  return s;
521 }
522 
524  .function = mpls_frag,
525  .name = "mpls-frag",
526  .vector_size = sizeof (u32),
527  .format_trace = format_mpls_frag_trace,
529 
530  .n_errors = IP_FRAG_N_ERROR,
531  .error_strings = mpls_frag_error_strings,
532 
533  .n_next_nodes = MPLS_FRAG_N_NEXT,
534  .next_nodes = {
535  [MPLS_FRAG_NEXT_REWRITE] = "mpls-output",
536  [MPLS_FRAG_NEXT_REWRITE_MIDCHAIN] = "mpls-midchain",
537  [MPLS_FRAG_NEXT_ICMP_ERROR] = "ip4-icmp-error",
538  [MPLS_FRAG_NEXT_DROP] = "mpls-drop"
539  },
540 };
541 
542 /*
543  * @brief Next index values from the MPLS incomplete adj node
544  */
545 #define foreach_mpls_adj_incomplete_next \
546 _(DROP, "error-drop") \
547 _(IP4, "ip4-arp") \
548 _(IP6, "ip6-discover-neighbor")
549 
550 typedef enum {
551 #define _(s,n) MPLS_ADJ_INCOMPLETE_NEXT_##s,
553 #undef _
556 
557 /**
558  * @brief A struct to hold tracing information for the MPLS label imposition
559  * node.
560  */
562 {
565 
566 
567 /**
568  * @brief Graph node for incomplete MPLS adjacency.
569  * This node will push traffic to either the v4-arp or v6-nd node
570  * based on the next-hop proto of the adj.
571  * We pay a cost for this 'routing' node, but an incomplete adj is the
572  * exception case.
573  */
576  vlib_frame_t * from_frame)
577 {
578  u32 n_left_from, next_index, * from, * to_next;
579 
580  from = vlib_frame_vector_args (from_frame);
581  n_left_from = from_frame->n_vectors;
582  next_index = node->cached_next_index;
583 
584  while (n_left_from > 0)
585  {
586  u32 n_left_to_next;
587 
588  vlib_get_next_frame (vm, node, next_index,
589  to_next, n_left_to_next);
590 
591  while (n_left_from > 0 && n_left_to_next > 0)
592  {
593  u32 pi0, next0, adj_index0;
594  ip_adjacency_t * adj0;
595  vlib_buffer_t * p0;
596 
597  pi0 = to_next[0] = from[0];
598  p0 = vlib_get_buffer (vm, pi0);
599  from += 1;
600  n_left_from -= 1;
601  to_next += 1;
602  n_left_to_next -= 1;
603 
604  adj_index0 = vnet_buffer (p0)->ip.adj_index[VLIB_TX];
605 
606  adj0 = adj_get(adj_index0);
607 
609  {
610  next0 = MPLS_ADJ_INCOMPLETE_NEXT_IP4;
611  }
612  else
613  {
614  next0 = MPLS_ADJ_INCOMPLETE_NEXT_IP6;
615  }
616 
617  if (PREDICT_FALSE(p0->flags & VLIB_BUFFER_IS_TRACED))
618  {
620  vlib_add_trace (vm, node, p0, sizeof (*tr));
621  tr->next = next0;
622  }
623 
624  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
625  to_next, n_left_to_next,
626  pi0, next0);
627  }
628 
629  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
630  }
631 
632  return from_frame->n_vectors;
633 }
634 
635 static u8 *
637 {
638  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
639  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
641  u32 indent;
642 
643  t = va_arg (*args, mpls_adj_incomplete_trace_t *);
644  indent = format_get_indent (s);
645 
646  s = format (s, "%Unext:%d",
647  format_white_space, indent,
648  t->next);
649  return (s);
650 }
651 
653  .name = "mpls-adj-incomplete",
654  .format_trace = format_mpls_adj_incomplete_trace,
655  /* Takes a vector of packets. */
656  .vector_size = sizeof (u32),
657  .n_errors = MPLS_N_ERROR,
658  .error_strings = mpls_error_strings,
659 
660  .n_next_nodes = MPLS_ADJ_INCOMPLETE_N_NEXT,
661  .next_nodes = {
662 #define _(s,n) [MPLS_ADJ_INCOMPLETE_NEXT_##s] = n,
664 #undef _
665  },
666 };
#define vnet_rewrite_one_header(rw0, p0, most_likely_size)
Definition: rewrite.h:211
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
Definition: buffer.h:124
#define foreach_mpls_output_next
Definition: mpls_output.c:35
#define CLIB_UNUSED(x)
Definition: clib.h:87
#define foreach_ip_frag_error
Definition: ip_frag.h:60
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.
Definition: counter.h:220
#define PREDICT_TRUE(x)
Definition: clib.h:121
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
Definition: buffer.h:110
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
Definition: error_funcs.h:57
IP unicast adjacency.
Definition: adj.h:227
A struct to hold tracing information for the MPLS label imposition node.
Definition: mpls_output.c:561
static u8 * format_mpls_frag_trace(u8 *s, va_list *args)
Definition: mpls_output.c:513
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:592
static u8 * format_mpls_adj_incomplete_trace(u8 *s, va_list *args)
Definition: mpls_output.c:636
static u32 format_get_indent(u8 *s)
Definition: format.h:72
vlib_main_t * vm
Definition: in2out_ed.c:1582
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
#define VLIB_NODE_FN(node)
Definition: node.h:202
mpls_frag_next_t
Definition: mpls_output.c:384
vlib_error_t * errors
Vector of errors for this node.
Definition: node.h:469
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
Definition: buffer_funcs.h:402
unsigned char u8
Definition: types.h:56
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static u8 * format_mpls_output_trace(u8 *s, va_list *args)
Definition: mpls_output.c:47
vlib_node_registration_t mpls_midchain_node
(constructor) VLIB_REGISTER_NODE (mpls_midchain_node)
Definition: mpls_output.c:361
vlib_node_registration_t mpls_output_node
(constructor) VLIB_REGISTER_NODE (mpls_output_node)
Definition: mpls_output.c:339
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
Definition: adj.h:459
i64 word
Definition: types.h:111
format_function_t format_ip_adjacency
Definition: format.h:58
u8 * format_white_space(u8 *s, va_list *va)
Definition: std-formats.c:129
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
Definition: buffer.h:203
mpls_adj_incomplete_next_t
Definition: mpls_output.c:550
mpls_output_next_t
Definition: mpls_output.c:39
unsigned int u32
Definition: types.h:88
u8 output_feature_arc_index
Definition: mpls.h:57
struct ip_adjacency_t_::@149::@151 midchain
IP_LOOKUP_NEXT_MIDCHAIN.
union ip_adjacency_t_::@149 sub_type
static uword mpls_output_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, mpls_output_mode_t mode)
Definition: mpls_output.c:61
vl_api_fib_path_type_t type
Definition: fib_types.api:123
vlib_error_t error
Error code for buffers to be enqueued to error handler.
Definition: buffer.h:136
vlib_node_registration_t mpls_frag_node
(constructor) VLIB_REGISTER_NODE (mpls_frag_node)
Definition: mpls_output.c:523
unsigned short u16
Definition: types.h:57
static char * mpls_frag_error_strings[]
Definition: mpls_output.c:372
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:229
#define PREDICT_FALSE(x)
Definition: clib.h:120
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
Definition: buffer_node.h:70
#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.
Definition: buffer_node.h:224
#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).
Definition: node_funcs.h:391
vlib_combined_counter_main_t adjacency_counters
Adjacency packet counters.
Definition: adj.c:25
vl_api_tunnel_mode_t mode
Definition: gre.api:48
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
Definition: node_funcs.h:1231
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169
u16 n_vectors
Definition: node.h:396
mpls_main_t mpls_main
Definition: mpls.c:25
ip_frag_error_t ip6_frag_do_fragment(vlib_main_t *vm, u32 from_bi, u16 mtu, u16 l2unfragmentablesize, u32 **buffer)
Definition: ip_frag.c:382
static_always_inline uword vlib_get_thread_index(void)
Definition: threads.h:219
#define CLIB_PREFETCH(addr, size, type)
Definition: cache.h:80
mpls_output_mode_t
Definition: mpls_output.c:30
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:317
ip_frag_error_t
Definition: ip_frag.h:71
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:380
#define foreach_mpls_adj_incomplete_next
Definition: mpls_output.c:545
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
Definition: node_funcs.h:115
u8 data[]
Packet data.
Definition: buffer.h:181
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.
Definition: main.c:483
vlib_main_t vlib_node_runtime_t * node
Definition: in2out_ed.c:1582
This packets follow a mid-chain adjacency.
Definition: adj.h:76
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
Definition: node.h:510
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
Definition: buffer.h:248
static char * mpls_error_strings[]
Definition: mpls_output.c:326
fib_protocol_t ia_nh_proto
The protocol of the neighbor/peer.
Definition: adj.h:342
Definition: defs.h:47
struct mpls_frag_trace_t_ mpls_frag_trace_t
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
Definition: adj.h:329
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
Definition: in2out_ed.c:1583
VLIB buffer representation.
Definition: buffer.h:102
u64 uword
Definition: types.h:112
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:297
ip_frag_error_t ip4_frag_do_fragment(vlib_main_t *vm, u32 from_bi, u16 mtu, u16 l2unfragmentablesize, u32 **buffer)
Definition: ip_frag.c:94
#define vnet_buffer(b)
Definition: buffer.h:417
struct mpls_adj_incomplete_trace_t_ mpls_adj_incomplete_trace_t
A struct to hold tracing information for the MPLS label imposition node.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
Definition: trace.c:577
static void vlib_buffer_free_one(vlib_main_t *vm, u32 buffer_index)
Free one buffer Shorthand to free a single buffer chain.
Definition: buffer_funcs.h:970
vlib_node_registration_t mpls_adj_incomplete_node
(constructor) VLIB_REGISTER_NODE (mpls_adj_incomplete_node)
Definition: mpls_output.c:652
#define vnet_rewrite_two_headers(rw0, rw1, p0, p1, most_likely_size)
Definition: rewrite.h:215
This adjacency/interface has output features configured.
Definition: rewrite.h:57
static_always_inline void icmp4_error_set_vnet_buffer(vlib_buffer_t *b, u8 type, u8 code, u32 data)
Definition: icmp4.h:51
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:85
static uword mpls_frag(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: mpls_output.c:394
signed short i16
Definition: types.h:46
static_always_inline void vnet_feature_arc_start(u8 arc, u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
Definition: feature.h:302