FD.io VPP  v17.01.1-3-gc6833f8
Vector Packet Processing
ila.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 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 
16 #include <ila/ila.h>
17 #include <vnet/plugin/plugin.h>
18 #include <vnet/ip/lookup.h>
19 #include <vnet/dpo/dpo.h>
20 #include <vnet/fib/fib_table.h>
21 
23 
24 #define ILA_TABLE_DEFAULT_HASH_NUM_BUCKETS (64 * 1024)
25 #define ILA_TABLE_DEFAULT_HASH_MEMORY_SIZE (32<<20)
26 
27 #define foreach_ila_error \
28  _(NONE, "valid ILA packets")
29 
30 typedef enum {
31 #define _(sym,str) ILA_ERROR_##sym,
33 #undef _
35 } ila_error_t;
36 
37 static char *ila_error_strings[] = {
38 #define _(sym,string) string,
40 #undef _
41 };
42 
43 typedef enum {
47 
48 typedef struct {
53 
54 static ila_entry_t ila_sir2ila_default_entry = {
55  .csum_mode = ILA_CSUM_MODE_NO_ACTION,
56  .type = ILA_TYPE_IID,
57  .dir = ILA_DIR_ILA2SIR, //Will pass the packet with no
58 };
59 
60 /**
61  * @brief Dynamically registered DPO Type for ILA
62  */
64 
65 /**
66  * @brief Dynamically registered FIB node type for ILA
67  */
69 
70 u8 *
71 format_half_ip6_address (u8 * s, va_list * va)
72 {
73  u64 v = clib_net_to_host_u64 (va_arg (*va, u64));
74 
75  return format (s, "%04x:%04x:%04x:%04x",
76  v >> 48, (v >> 32) & 0xffff, (v >> 16) & 0xffff, v & 0xffff);
77 
78 }
79 
80 u8 *
81 format_ila_direction (u8 * s, va_list * args)
82 {
83  ila_direction_t t = va_arg (*args, ila_direction_t);
84 #define _(i,n,st) \
85  if (t == ILA_DIR_##i) \
86  return format(s, st);
88 #undef _
89  return format (s, "invalid_ila_direction");
90 }
91 
92 static u8 *
93 format_csum_mode (u8 * s, va_list * va)
94 {
95  ila_csum_mode_t csum_mode = va_arg (*va, ila_csum_mode_t);
96  char *txt;
97 
98  switch (csum_mode)
99  {
100 #define _(i,n,st) \
101  case ILA_CSUM_MODE_##i: \
102  txt = st; \
103  break;
105 #undef _
106  default:
107  txt = "invalid_ila_csum_mode";
108  break;
109  }
110  return format (s, txt);
111 }
112 
113 u8 *
114 format_ila_type (u8 * s, va_list * args)
115 {
116  ila_type_t t = va_arg (*args, ila_type_t);
117 #define _(i,n,st) \
118  if (t == ILA_TYPE_##i) \
119  return format(s, st);
121 #undef _
122  return format (s, "invalid_ila_type");
123 }
124 
125 static u8 *
126 format_ila_entry (u8 * s, va_list * va)
127 {
128  vnet_main_t *vnm = va_arg (*va, vnet_main_t *);
129  ila_entry_t *e = va_arg (*va, ila_entry_t *);
130 
131  if (!e)
132  {
133  return format (s, "%-15s%=40s%=40s%+16s%+18s%+11s", "Type", "SIR Address",
134  "ILA Address", "Checksum Mode", "Direction", "Next DPO");
135  }
136  else if (vnm)
137  {
138  if (ip6_address_is_zero(&e->next_hop))
139  {
140  return format (s, "%-15U%=40U%=40U%18U%11U%s",
141  format_ila_type, e->type,
146  "n/a");
147  }
148  else
149  {
150  return format (s, "%-15U%=40U%=40U%18U%11U%U",
151  format_ila_type, e->type,
156  format_dpo_id, &e->ila_dpo, 0);
157  }
158  }
159 
160  return NULL;
161 }
162 
163 u8 *
164 format_ila_ila2sir_trace (u8 * s, va_list * args)
165 {
166  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
167  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
168  ila_ila2sir_trace_t *t = va_arg (*args, ila_ila2sir_trace_t *);
169  return format (s,
170  "ILA -> SIR adj index: %d entry index: %d initial_dst: %U",
172  &t->initial_dst);
173 }
174 
175 static uword
176 unformat_ila_direction (unformat_input_t * input, va_list * args)
177 {
178  ila_direction_t *result = va_arg (*args, ila_direction_t *);
179 #define _(i,n,s) \
180  if (unformat(input, s)) \
181  { \
182  *result = ILA_DIR_##i; \
183  return 1;\
184  }
185 
187 #undef _
188  return 0;
189 }
190 
191 static uword
192 unformat_ila_type (unformat_input_t * input, va_list * args)
193 {
194  ila_type_t *result = va_arg (*args, ila_type_t *);
195 #define _(i,n,s) \
196  if (unformat(input, s)) \
197  { \
198  *result = ILA_TYPE_##i; \
199  return 1;\
200  }
201 
203 #undef _
204  return 0;
205 }
206 
207 static uword
208 unformat_ila_csum_mode (unformat_input_t * input, va_list * args)
209 {
210  ila_csum_mode_t *result = va_arg (*args, ila_csum_mode_t *);
211  if (unformat (input, "none") || unformat (input, "no-action"))
212  {
213  *result = ILA_CSUM_MODE_NO_ACTION;
214  return 1;
215  }
216  if (unformat (input, "neutral-map"))
217  {
218  *result = ILA_CSUM_MODE_NEUTRAL_MAP;
219  return 1;
220  }
221  if (unformat (input, "adjust-transport"))
222  {
223  *result = ILA_CSUM_MODE_ADJUST_TRANSPORT;
224  return 1;
225  }
226  return 0;
227 }
228 
229 static uword
231 {
232  u64 *result = va_arg (*args, u64 *);
233  u32 a[4];
234 
235  if (!unformat (input, "%x:%x:%x:%x", &a[0], &a[1], &a[2], &a[3]))
236  return 0;
237 
238  if (a[0] > 0xFFFF || a[1] > 0xFFFF || a[2] > 0xFFFF || a[3] > 0xFFFF)
239  return 0;
240 
241  *result = clib_host_to_net_u64 ((((u64) a[0]) << 48) |
242  (((u64) a[1]) << 32) |
243  (((u64) a[2]) << 16) | (((u64) a[3])));
244 
245  return 1;
246 }
247 
249 
250 static uword
252  vlib_node_runtime_t * node, vlib_frame_t * frame)
253 {
254  u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
255  ila_main_t *ilm = &ila_main;
256 
257  from = vlib_frame_vector_args (frame);
258  n_left_from = frame->n_vectors;
259  next_index = node->cached_next_index;
260 
261  while (n_left_from > 0)
262  {
263  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
264 
265  while (n_left_from >= 4 && n_left_to_next >= 2)
266  {
267  u32 pi0, pi1;
268  vlib_buffer_t *p0, *p1;
269  ila_entry_t *ie0, *ie1;
270  ip6_header_t *ip60, *ip61;
271  ip6_address_t *sir_address0, *sir_address1;
272 
273  {
274  vlib_buffer_t *p2, *p3;
275 
276  p2 = vlib_get_buffer (vm, from[2]);
277  p3 = vlib_get_buffer (vm, from[3]);
278 
279  vlib_prefetch_buffer_header (p2, LOAD);
280  vlib_prefetch_buffer_header (p3, LOAD);
281  CLIB_PREFETCH (p2->data, sizeof (ip6_header_t), LOAD);
282  CLIB_PREFETCH (p3->data, sizeof (ip6_header_t), LOAD);
283  }
284 
285  pi0 = to_next[0] = from[0];
286  pi1 = to_next[1] = from[1];
287  from += 2;
288  n_left_from -= 2;
289  to_next += 2;
290  n_left_to_next -= 2;
291 
292  p0 = vlib_get_buffer (vm, pi0);
293  p1 = vlib_get_buffer (vm, pi1);
294  ip60 = vlib_buffer_get_current (p0);
295  ip61 = vlib_buffer_get_current (p1);
296  sir_address0 = &ip60->dst_address;
297  sir_address1 = &ip61->dst_address;
298  ie0 = pool_elt_at_index (ilm->entries,
299  vnet_buffer (p0)->ip.adj_index[VLIB_TX]);
300  ie1 = pool_elt_at_index (ilm->entries,
301  vnet_buffer (p1)->ip.adj_index[VLIB_TX]);
302 
304  {
305  ila_ila2sir_trace_t *tr =
306  vlib_add_trace (vm, node, p0, sizeof (*tr));
307  tr->ila_index = ie0 - ilm->entries;
308  tr->initial_dst = ip60->dst_address;
309  tr->adj_index = vnet_buffer (p0)->ip.adj_index[VLIB_TX];
310  }
311 
313  {
314  ila_ila2sir_trace_t *tr =
315  vlib_add_trace (vm, node, p1, sizeof (*tr));
316  tr->ila_index = ie1 - ilm->entries;
317  tr->initial_dst = ip61->dst_address;
318  tr->adj_index = vnet_buffer (p1)->ip.adj_index[VLIB_TX];
319  }
320 
321  sir_address0 = (ie0->dir != ILA_DIR_SIR2ILA) ? &ie0->sir_address : sir_address0;
322  sir_address1 = (ie1->dir != ILA_DIR_SIR2ILA) ? &ie1->sir_address : sir_address1;
323  ip60->dst_address.as_u64[0] = sir_address0->as_u64[0];
324  ip60->dst_address.as_u64[1] = sir_address0->as_u64[1];
325  ip61->dst_address.as_u64[0] = sir_address1->as_u64[0];
326  ip61->dst_address.as_u64[1] = sir_address1->as_u64[1];
327 
328  vnet_buffer (p0)->ip.adj_index[VLIB_TX] = ie0->ila_dpo.dpoi_index;
329  vnet_buffer (p1)->ip.adj_index[VLIB_TX] = ie1->ila_dpo.dpoi_index;
330 
331  vlib_validate_buffer_enqueue_x2 (vm, node, next_index, to_next,
332  n_left_to_next, pi0, pi1,
333  ie0->ila_dpo.dpoi_next_node,
334  ie1->ila_dpo.dpoi_next_node);
335  }
336 
337  /* Single loop */
338  while (n_left_from > 0 && n_left_to_next > 0)
339  {
340  u32 pi0;
341  vlib_buffer_t *p0;
342  ila_entry_t *ie0;
343  ip6_header_t *ip60;
344  ip6_address_t *sir_address0;
345 
346  pi0 = to_next[0] = from[0];
347  from += 1;
348  n_left_from -= 1;
349  to_next += 1;
350  n_left_to_next -= 1;
351 
352  p0 = vlib_get_buffer (vm, pi0);
353  ip60 = vlib_buffer_get_current (p0);
354  sir_address0 = &ip60->dst_address;
355  ie0 = pool_elt_at_index (ilm->entries,
356  vnet_buffer (p0)->ip.adj_index[VLIB_TX]);
357 
359  {
360  ila_ila2sir_trace_t *tr =
361  vlib_add_trace (vm, node, p0, sizeof (*tr));
362  tr->ila_index = ie0 ? (ie0 - ilm->entries) : ~0;
363  tr->initial_dst = ip60->dst_address;
364  tr->adj_index = vnet_buffer (p0)->ip.adj_index[VLIB_TX];
365  }
366 
367  sir_address0 = (ie0->dir != ILA_DIR_SIR2ILA) ? &ie0->sir_address : sir_address0;
368  ip60->dst_address.as_u64[0] = sir_address0->as_u64[0];
369  ip60->dst_address.as_u64[1] = sir_address0->as_u64[1];
370  vnet_buffer (p0)->ip.adj_index[VLIB_TX] = ie0->ila_dpo.dpoi_index;
371 
372  vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
373  n_left_to_next, pi0,
374  ie0->ila_dpo.dpoi_next_node);
375  }
376  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
377  }
378 
379  return frame->n_vectors;
380 }
381 
382 /** *INDENT-OFF* */
384 {
385  .function = ila_ila2sir,
386  .name = "ila-to-sir",
387  .vector_size = sizeof (u32),
388  .format_trace = format_ila_ila2sir_trace,
389  .n_errors = ILA_N_ERROR,
390  .error_strings = ila_error_strings,
391  .n_next_nodes = ILA_ILA2SIR_N_NEXT,
392  .next_nodes =
393  {
394  [ILA_ILA2SIR_NEXT_DROP] = "error-drop"
395  },
396 };
397 /** *INDENT-ON* */
398 
399 typedef enum
400 {
404 
405 typedef struct
406 {
410 
411 u8 *
412 format_ila_sir2ila_trace (u8 * s, va_list * args)
413 {
414  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
415  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
416  ila_sir2ila_trace_t *t = va_arg (*args, ila_sir2ila_trace_t *);
417 
418  return format (s, "SIR -> ILA entry index: %d initial_dst: %U",
420 }
421 
423 
424 static uword
426  vlib_node_runtime_t * node, vlib_frame_t * frame)
427 {
428  u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
429  ila_main_t *ilm = &ila_main;
430 
431  from = vlib_frame_vector_args (frame);
432  n_left_from = frame->n_vectors;
433  next_index = node->cached_next_index;
434 
435  while (n_left_from > 0)
436  {
437  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
438 
439  while (n_left_from >= 4 && n_left_to_next >= 2)
440  {
441  u32 pi0, pi1;
442  vlib_buffer_t *p0, *p1;
443  ip6_header_t *ip60, *ip61;
444  u32 next0 = ILA_SIR2ILA_NEXT_DROP;
445  u32 next1 = ILA_SIR2ILA_NEXT_DROP;
446  BVT (clib_bihash_kv) kv0, value0;
447  BVT (clib_bihash_kv) kv1, value1;
450  ip6_address_t *ila_address0, *ila_address1;
451 
452  {
453  vlib_buffer_t *p2, *p3;
454 
455  p2 = vlib_get_buffer (vm, from[2]);
456  p3 = vlib_get_buffer (vm, from[3]);
457 
458  vlib_prefetch_buffer_header (p2, LOAD);
459  vlib_prefetch_buffer_header (p3, LOAD);
460  CLIB_PREFETCH (p2->data, sizeof (ip6_header_t), LOAD);
461  CLIB_PREFETCH (p3->data, sizeof (ip6_header_t), LOAD);
462  }
463 
464  pi0 = to_next[0] = from[0];
465  pi1 = to_next[1] = from[1];
466  from += 2;
467  n_left_from -= 2;
468  to_next += 2;
469  n_left_to_next -= 2;
470 
471  p0 = vlib_get_buffer (vm, pi0);
472  p1 = vlib_get_buffer (vm, pi1);
473  ip60 = vlib_buffer_get_current (p0);
474  ip61 = vlib_buffer_get_current (p1);
475  ila_address0 = &ip60->dst_address;
476  ila_address1 = &ip61->dst_address;
477  kv0.key[0] = ip60->dst_address.as_u64[0];
478  kv0.key[1] = ip60->dst_address.as_u64[1];
479  kv0.key[2] = 0;
480  kv1.key[0] = ip61->dst_address.as_u64[0];
481  kv1.key[1] = ip61->dst_address.as_u64[1];
482  kv1.key[2] = 0;
483 
485  (&ilm->id_to_entry_table, &kv0, &value0)) == 0)) {
486  ie0 = &ilm->entries[value0.value];
487  ila_address0 = (ie0->dir != ILA_DIR_ILA2SIR) ? &ie0->ila_address : ila_address0;
488  }
489 
490  if ((BV (clib_bihash_search)
491  (&ilm->id_to_entry_table, &kv1, &value1)) == 0) {
492  ie1 = &ilm->entries[value1.value];
493  ila_address1 = (ie1->dir != ILA_DIR_ILA2SIR) ? &ie1->ila_address : ila_address1;
494  }
495 
497  {
498  ila_sir2ila_trace_t *tr =
499  vlib_add_trace (vm, node, p0, sizeof (*tr));
500  tr->ila_index =
501  (ie0 != &ila_sir2ila_default_entry) ? (ie0 - ilm->entries) : ~0;
502  tr->initial_dst = ip60->dst_address;
503  }
504 
506  {
507  ila_sir2ila_trace_t *tr =
508  vlib_add_trace (vm, node, p1, sizeof (*tr));
509  tr->ila_index =
510  (ie1 != &ila_sir2ila_default_entry) ? (ie1 - ilm->entries) : ~0;
511  tr->initial_dst = ip61->dst_address;
512  }
513 
514  ip60->dst_address.as_u64[0] = ila_address0->as_u64[0];
515  ip60->dst_address.as_u64[1] = ila_address0->as_u64[1];
516  ip61->dst_address.as_u64[0] = ila_address1->as_u64[0];
517  ip61->dst_address.as_u64[1] = ila_address1->as_u64[1];
518 
519  vnet_feature_next (vnet_buffer (p0)->sw_if_index[VLIB_RX], &next0, p0);
520  vnet_feature_next (vnet_buffer (p1)->sw_if_index[VLIB_RX], &next1, p1);
521 
522  vlib_validate_buffer_enqueue_x2 (vm, node, next_index, to_next,
523  n_left_to_next, pi0, pi1, next0,
524  next1);
525  }
526 
527  /* Single loop */
528  while (n_left_from > 0 && n_left_to_next > 0)
529  {
530  u32 pi0;
531  vlib_buffer_t *p0;
532  ip6_header_t *ip60;
533  u32 next0 = ILA_SIR2ILA_NEXT_DROP;
534  BVT (clib_bihash_kv) kv0, value0;
536  ip6_address_t *ila_address0;
537 
538  pi0 = to_next[0] = from[0];
539  from += 1;
540  n_left_from -= 1;
541  to_next += 1;
542  n_left_to_next -= 1;
543 
544  p0 = vlib_get_buffer (vm, pi0);
545  ip60 = vlib_buffer_get_current (p0);
546  ila_address0 = &ip60->dst_address;
547 
548  kv0.key[0] = ip60->dst_address.as_u64[0];
549  kv0.key[1] = ip60->dst_address.as_u64[1];
550  kv0.key[2] = 0;
551 
553  (&ilm->id_to_entry_table, &kv0, &value0)) == 0)) {
554  ie0 = &ilm->entries[value0.value];
555  ila_address0 = (ie0->dir != ILA_DIR_ILA2SIR) ? &ie0->ila_address : ila_address0;
556  }
557 
559  {
560  ila_sir2ila_trace_t *tr =
561  vlib_add_trace (vm, node, p0, sizeof (*tr));
562  tr->ila_index =
563  (ie0 != &ila_sir2ila_default_entry) ? (ie0 - ilm->entries) : ~0;
564  tr->initial_dst = ip60->dst_address;
565  }
566 
567  //This operation should do everything for any type (except vnid4 obviously)
568  ip60->dst_address.as_u64[0] = ila_address0->as_u64[0];
569  ip60->dst_address.as_u64[1] = ila_address0->as_u64[1];
570 
571  vnet_feature_next (vnet_buffer (p0)->sw_if_index[VLIB_RX], &next0, p0);
572 
573  vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
574  n_left_to_next, pi0, next0);
575  }
576  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
577  }
578 
579  return frame->n_vectors;
580 }
581 
582 /** *INDENT-OFF* */
584 {
585  .function = ila_sir2ila,.name = "sir-to-ila",
586  .vector_size = sizeof (u32),
587  .format_trace = format_ila_sir2ila_trace,
588  .n_errors = ILA_N_ERROR,
589  .error_strings = ila_error_strings,
590  .n_next_nodes = ILA_SIR2ILA_N_NEXT,
591  .next_nodes =
592  {
593  [ILA_SIR2ILA_NEXT_DROP] = "error-drop"
594  },
595 };
596 /** *INDENT-ON* */
597 
598 /** *INDENT-OFF* */
599 VNET_FEATURE_INIT (ila_sir2ila, static) =
600 {
601  .arc_name = "ip6-unicast",
602  .node_name = "sir-to-ila",
603  .runs_before = VNET_FEATURES ("ip6-lookup"),
604 };
605 /** *INDENT-ON* */
606 
607 static void
609 {
610  /*
611  * restack on the next-hop's FIB entry
612  */
615  &ie->ila_dpo,
618 }
619 
620 int
622 {
623  ila_main_t *ilm = &ila_main;
624  BVT (clib_bihash_kv) kv, value;
625 
626  //Sanity check
627  if (args->type == ILA_TYPE_IID || args->type == ILA_TYPE_LUID)
628  {
629  if ((args->sir_address.as_u8[8] >> 5) != args->type)
630  {
631  clib_warning ("Incorrect SIR address (ILA type mismatch %d %d)",
632  args->sir_address.as_u8[8] >> 1, args->type);
633  return -1;
634  }
635  if (args->sir_address.as_u8[8] & 0x10)
636  {
637  clib_warning ("Checksum bit should not be set in SIR address");
638  return -1;
639  }
640  }
641  else if (args->type == ILA_TYPE_VNIDM)
642  {
643  if (args->sir_address.as_u8[0] != 0xff ||
644  (args->sir_address.as_u8[1] & 0xf0) != 0xf0)
645  {
646  clib_warning ("SIR multicast address must start with fff");
647  return -1;
648  }
649  if (args->sir_address.as_u16[1] || args->sir_address.as_u16[2] ||
650  args->sir_address.as_u16[3] || args->sir_address.as_u16[4] ||
651  args->sir_address.as_u16[5] || (args->sir_address.as_u8[12] & 0xf0))
652  {
653  clib_warning ("SIR multicast address must start with fff");
654  return -1;
655  }
656  }
657 
658  if (!args->is_del)
659  {
660  ila_entry_t *e;
661  pool_get (ilm->entries, e);
662  e->type = args->type;
663  e->sir_address = args->sir_address;
664  e->next_hop = args->next_hop_address;
665  e->csum_mode = args->csum_mode;
666  e->dir = args->dir;
667 
668  //Construct ILA address
669  switch (e->type)
670  {
671  case ILA_TYPE_IID:
672  e->ila_address = e->sir_address;
673  break;
674  case ILA_TYPE_LUID:
675  e->ila_address.as_u64[0] = args->locator;
676  e->ila_address.as_u64[1] = args->sir_address.as_u64[1];
677  break;
678  case ILA_TYPE_VNID6:
679  e->ila_address.as_u64[0] = args->locator;
680  e->ila_address.as_u8[8] = (ILA_TYPE_VNID6 << 1);
681  e->ila_address.as_u32[2] |= args->vnid;
682  e->ila_address.as_u32[3] = args->sir_address.as_u32[3];
683  break;
684  case ILA_TYPE_VNIDM:
685  e->ila_address.as_u64[0] = args->locator;
686  e->ila_address.as_u8[8] = (ILA_TYPE_VNIDM << 1);
687  e->ila_address.as_u32[2] |= args->vnid;
688  e->ila_address.as_u32[3] = args->sir_address.as_u32[3];
689  e->ila_address.as_u8[12] |= args->sir_address.as_u8[2] << 4;
690  break;
691  case ILA_TYPE_VNID4:
692  clib_warning ("ILA type '%U' is not supported", format_ila_type,
693  e->type);
694  return -1;
695  }
696 
697  //Modify ILA checksum if necessary
698  if (e->csum_mode == ILA_CSUM_MODE_NEUTRAL_MAP)
699  {
700  ip_csum_t csum = e->ila_address.as_u16[7];
701  int i;
702  for (i = 0; i < 4; i++)
703  {
704  csum = ip_csum_sub_even (csum, e->sir_address.as_u32[i]);
705  csum = ip_csum_add_even (csum, e->ila_address.as_u32[i]);
706  }
707  csum = ip_csum_add_even (csum, clib_host_to_net_u16 (0x1000));
708  e->ila_address.as_u16[7] = ip_csum_fold (csum);
709  e->ila_address.as_u8[8] |= 0x10;
710  }
711 
712  //Create entry with the sir address
713  kv.key[0] = e->sir_address.as_u64[0];
714  kv.key[1] = e->sir_address.as_u64[1];
715  kv.key[2] = 0;
716  kv.value = e - ilm->entries;
717  BV (clib_bihash_add_del) (&ilm->id_to_entry_table, &kv,
718  1 /* is_add */ );
719 
720  if (!ip6_address_is_zero(&e->next_hop))
721  {
722  /*
723  * become a child of the FIB netry for the next-hop
724  * so we are informed when its forwarding changes
725  */
726  fib_prefix_t next_hop = {
727  .fp_addr = {
728  .ip6 = e->next_hop,
729  },
730  .fp_len = 128,
731  .fp_proto = FIB_PROTOCOL_IP6,
732  };
733 
736  &next_hop,
743  e - ilm->entries);
744 
745  /*
746  * Create a route that results in the ILA entry
747  */
748  dpo_id_t dpo = DPO_INVALID;
749  fib_prefix_t pfx = {
750  .fp_addr = {
751  .ip6 = e->ila_address,
752  },
753  .fp_len = 128,
754  .fp_proto = FIB_PROTOCOL_IP6,
755  };
756 
757  dpo_set(&dpo, ila_dpo_type, DPO_PROTO_IP6, e - ilm->entries);
758 
760  &pfx,
763  &dpo);
764  dpo_reset(&dpo);
765 
766  /*
767  * finally stack the ILA entry so it will forward to the next-hop
768  */
769  ila_entry_stack (e);
770  }
771  }
772  else
773  {
774  ila_entry_t *e;
775  kv.key[0] = args->sir_address.as_u64[0];
776  kv.key[1] = args->sir_address.as_u64[1];
777  kv.key[2] = 0;
778 
779  if ((BV (clib_bihash_search) (&ilm->id_to_entry_table, &kv, &value) <
780  0))
781  {
782  return -1;
783  }
784 
785  e = &ilm->entries[value.value];
786 
787  if (!ip6_address_is_zero(&e->next_hop))
788  {
789  fib_prefix_t pfx = {
790  .fp_addr = {
791  .ip6 = e->ila_address,
792  },
793  .fp_len = 128,
794  .fp_proto = FIB_PROTOCOL_IP6,
795  };
796 
798  /*
799  * remove this ILA entry as child of the FIB netry for the next-hop
800  */
804  FIB_SOURCE_RR);
806  }
807  dpo_reset (&e->ila_dpo);
808 
809  BV (clib_bihash_add_del) (&ilm->id_to_entry_table, &kv,
810  0 /* is_add */ );
811  pool_put (ilm->entries, e);
812  }
813  return 0;
814 }
815 
816 int
817 ila_interface (u32 sw_if_index, u8 disable)
818 {
819  vnet_feature_enable_disable ("ip4-unicast", "sir-to-ila", sw_if_index,
820  !disable, 0, 0);
821  return 0;
822 }
823 
824 clib_error_t *
826  int from_early_init)
827 {
828  clib_error_t *error = 0;
829 
830  return error;
831 }
832 
833 u8 *format_ila_dpo (u8 * s, va_list * va)
834 {
835  index_t index = va_arg (*va, index_t);
836  CLIB_UNUSED(u32 indent) = va_arg (*va, u32);
837  ila_main_t *ilm = &ila_main;
838  ila_entry_t *ie = pool_elt_at_index (ilm->entries, index);
839  return format(s, "ILA: idx:%d sir:%U",
840  index,
842 }
843 
844 /**
845  * @brief no-op lock function.
846  * The lifetime of the ILA entry is managed by the control plane
847  */
848 static void
850 {
851 }
852 
853 /**
854  * @brief no-op unlock function.
855  * The lifetime of the ILA entry is managed by the control plane
856  */
857 static void
859 {
860 }
861 
862 const static dpo_vft_t ila_vft = {
864  .dv_unlock = ila_dpo_unlock,
865  .dv_format = format_ila_dpo,
866 };
867 const static char* const ila_ip6_nodes[] =
868 {
869  "ila-to-sir",
870  NULL,
871 };
872 const static char* const * const ila_nodes[DPO_PROTO_NUM] =
873 {
875 };
876 
877 static fib_node_t *
879 {
880  ila_main_t *ilm = &ila_main;
881  ila_entry_t *ie = pool_elt_at_index (ilm->entries, index);
882 
883  return (&ie->ila_fib_node);
884 }
885 
886 /**
887  * @brief no-op unlock function.
888  * The lifetime of the ILA entry is managed by the control plane
889  */
890 static void
892 {
893 }
894 
895 static ila_entry_t *
897 {
898  return ((ila_entry_t*)(((char*)node) -
899  STRUCT_OFFSET_OF(ila_entry_t, ila_fib_node)));
900 }
901 
902 /**
903  * @brief
904  * Callback function invoked when the forwarding changes for the ILA next-hop
905  */
909 {
911 
913 }
914 
915 /*
916  * ILA's FIB graph node virtual function table
917  */
918 static const fib_node_vft_t ila_fib_node_vft = {
920  .fnv_last_lock = ila_fib_node_last_lock_gone,
921  .fnv_back_walk = ila_fib_node_back_walk_notify,
922 };
923 
924 clib_error_t *
926 {
927  ila_main_t *ilm = &ila_main;
928  ilm->entries = NULL;
929 
933 
935  "ila id to entry index table",
937 
939  ila_fib_node_type = fib_node_register_new_type(&ila_fib_node_vft);
940 
941  return NULL;
942 }
943 
945 
946 static clib_error_t *
948  unformat_input_t * input, vlib_cli_command_t * cmd)
949 {
950  unformat_input_t _line_input, *line_input = &_line_input;
951  ila_add_del_entry_args_t args = { 0 };
952  u8 next_hop_set = 0;
953  int ret;
954 
955  args.type = ILA_TYPE_IID;
956  args.csum_mode = ILA_CSUM_MODE_NO_ACTION;
957  args.local_adj_index = ~0;
958  args.dir = ILA_DIR_BIDIR;
959 
960  if (!unformat_user (input, unformat_line_input, line_input))
961  return 0;
962 
963  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
964  {
965  if (unformat (line_input, "type %U", unformat_ila_type, &args.type))
966  ;
967  else if (unformat
968  (line_input, "sir-address %U", unformat_ip6_address,
969  &args.sir_address))
970  ;
971  else if (unformat
972  (line_input, "locator %U", unformat_half_ip6_address,
973  &args.locator))
974  ;
975  else if (unformat
976  (line_input, "csum-mode %U", unformat_ila_csum_mode,
977  &args.csum_mode))
978  ;
979  else if (unformat (line_input, "vnid %x", &args.vnid))
980  ;
981  else if (unformat
982  (line_input, "next-hop %U", unformat_ip6_address,
983  &args.next_hop_address))
984  ;
985  else if (unformat
986  (line_input, "direction %U", unformat_ila_direction, &args.dir))
987  next_hop_set = 1;
988  else if (unformat (line_input, "del"))
989  args.is_del = 1;
990  else
991  return clib_error_return (0, "parse error: '%U'",
992  format_unformat_error, line_input);
993  }
994 
995  unformat_free (line_input);
996 
997  if (!next_hop_set)
998  return clib_error_return (0, "Specified a next hop");
999 
1000  if ((ret = ila_add_del_entry (&args)))
1001  return clib_error_return (0, "ila_add_del_entry returned error %d", ret);
1002 
1003  return NULL;
1004 }
1005 
1006 VLIB_CLI_COMMAND (ila_entry_command, static) =
1007 {
1008  .path = "ila entry",
1009  .short_help = "ila entry [type <type>] [sir-address <address>] [locator <locator>] [vnid <hex-vnid>]"
1010  " [adj-index <adj-index>] [next-hop <next-hop>] [direction (bidir|sir2ila|ila2sir)]"
1011  " [csum-mode (no-action|neutral-map|transport-adjust)] [del]",
1012  .function = ila_entry_command_fn,
1013 };
1014 
1015 static clib_error_t *
1017  unformat_input_t * input, vlib_cli_command_t * cmd)
1018 {
1019  vnet_main_t *vnm = vnet_get_main ();
1020  u32 sw_if_index = ~0;
1021  u8 disable = 0;
1022 
1023  if (!unformat (input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index))
1024  {
1025  return clib_error_return (0, "Invalid interface name");
1026  }
1027 
1028  if (unformat (input, "disable"))
1029  {
1030  disable = 1;
1031  }
1032 
1033  int ret;
1034  if ((ret = ila_interface (sw_if_index, disable)))
1035  return clib_error_return (0, "ila_interface returned error %d", ret);
1036 
1037  return NULL;
1038 }
1039 
1040 VLIB_CLI_COMMAND (ila_interface_command, static) =
1041 {
1042  .path = "ila interface",
1043  .short_help = "ila interface <interface-name> [disable]",
1044  .function = ila_interface_command_fn,
1045 };
1046 
1047 static clib_error_t *
1049  unformat_input_t * input,
1050  vlib_cli_command_t * cmd)
1051 {
1052  vnet_main_t *vnm = vnet_get_main ();
1053  ila_main_t *ilm = &ila_main;
1054  ila_entry_t *e;
1055 
1056  vlib_cli_output (vm, " %U\n", format_ila_entry, vnm, NULL);
1057  pool_foreach (e, ilm->entries,
1058  ({
1059  vlib_cli_output (vm, " %U\n", format_ila_entry, vnm, e);
1060  }));
1061 
1062  return NULL;
1063 }
1064 
1065 VLIB_CLI_COMMAND (ila_show_entries_command, static) =
1066 {
1067  .path = "show ila entries",
1068  .short_help = "show ila entries",
1069  .function = ila_show_entries_command_fn,
1070 };
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:459
static u8 * format_ila_entry(u8 *s, va_list *va)
Definition: ila.c:126
ila_direction_t dir
Definition: ila.h:72
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:327
ip6_address_t initial_dst
Definition: ila.c:50
Recursive resolution source.
Definition: fib_entry.h:105
clib_bihash_24_8_t id_to_entry_table
Definition: ila.h:95
ila_direction_t dir
Definition: ila.h:109
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:343
#define CLIB_UNUSED(x)
Definition: clib.h:79
A virtual function table regisitered for a DPO type.
Definition: dpo.h:322
uword unformat(unformat_input_t *i, char *fmt,...)
Definition: unformat.c:966
ila_sir2ila_next_t
INDENT-ON
Definition: ila.c:399
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
ip6_address_t initial_dst
Definition: ila.c:408
a
Definition: bitmap.h:516
ip6_address_t next_hop
Definition: ila.h:70
format_function_t format_ip6_address
Definition: format.h:95
static fib_node_type_t ila_fib_node_type
Dynamically registered FIB node type for ILA.
Definition: ila.c:68
u8 * format_half_ip6_address(u8 *s, va_list *va)
Definition: ila.c:71
u32 fib_entry_child_add(fib_node_index_t fib_entry_index, fib_node_type_t child_type, fib_node_index_t child_index)
Definition: fib_entry.c:472
#define PREDICT_TRUE(x)
Definition: clib.h:98
u8 as_u8[16]
Definition: ip6_packet.h:48
u64 as_u64[2]
Definition: ip6_packet.h:51
Definitions for all things IP (v4|v6) unicast and multicast lookup related.
#define UNFORMAT_END_OF_INPUT
Definition: format.h:143
u8 * format_ila_sir2ila_trace(u8 *s, va_list *args)
Definition: ila.c:412
#define NULL
Definition: clib.h:55
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
const dpo_id_t * fib_entry_contribute_ip_forwarding(fib_node_index_t fib_entry_index)
Definition: fib_entry.c:432
Definition: ila.h:101
static uword unformat_ila_type(unformat_input_t *input, va_list *args)
Definition: ila.c:192
dpo_id_t ila_dpo
The next DPO in the grpah to follow.
Definition: ila.h:87
void fib_entry_child_remove(fib_node_index_t fib_entry_index, u32 sibling_index)
Definition: fib_entry.c:483
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:41
ip6_address_t ila_address
Definition: ila.h:69
struct _vlib_node_registration vlib_node_registration_t
VNET_FEATURE_INIT(ila_sir2ila, static)
INDENT-ON
static void ila_entry_stack(ila_entry_t *ie)
INDENT-ON
Definition: ila.c:608
#define STRUCT_OFFSET_OF(t, f)
Definition: clib.h:62
uword ip_csum_t
Definition: ip_packet.h:90
static ila_main_t ila_main
Definition: ila.c:22
unformat_function_t unformat_vnet_sw_interface
ila_csum_mode_t
Definition: ila.h:44
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:200
clib_error_t * ila_init(vlib_main_t *vm)
Definition: ila.c:925
ip6_address_t sir_address
Definition: ila.h:68
int ila_add_del_entry(ila_add_del_entry_args_t *args)
Definition: ila.c:621
static fib_node_t * ila_fib_node_get_node(fib_node_index_t index)
Definition: ila.c:878
fib_node_type_t fib_node_register_new_type(const fib_node_vft_t *vft)
Create a new FIB node type and Register the function table for it.
Definition: fib_node.c:78
fib_node_index_t next_hop_fib_entry_index
The FIB entry index for the next-hop.
Definition: ila.h:77
static clib_error_t * ila_entry_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: ila.c:947
ila_ila2sir_next_t
Definition: ila.c:43
vnet_main_t * vnet_get_main(void)
Definition: misc.c:46
ip6_address_t next_hop_address
Definition: ila.h:104
enum dpo_type_t_ dpo_type_t
Common types of data-path objects New types can be dynamically added using dpo_register_new_type() ...
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:348
ila_type_t type
Definition: ila.h:67
int clib_bihash_add_del(clib_bihash *h, clib_bihash_kv *add_v, int is_add)
Add or delete a (key,value) pair from a bi-hash table.
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:111
void fib_table_entry_special_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Remove a &#39;special&#39; entry from the FIB.
Definition: fib_table.c:399
#define ILA_TABLE_DEFAULT_HASH_NUM_BUCKETS
Definition: ila.c:24
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:194
static BVT(clib_bihash)
Definition: adj_nbr.c:26
u8 is_del
Definition: ila.h:110
A high priority source a plugin can use.
Definition: fib_entry.h:54
Aggregrate type for a prefix.
Definition: fib_types.h:145
static uword unformat_ila_direction(unformat_input_t *input, va_list *args)
Definition: ila.c:176
static void unformat_free(unformat_input_t *i)
Definition: format.h:161
#define clib_warning(format, args...)
Definition: error.h:59
unsigned long u64
Definition: types.h:89
static ila_entry_t ila_sir2ila_default_entry
Definition: ila.c:54
u32 local_adj_index
Definition: ila.h:107
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:977
ila_direction_t
Definition: ila.h:56
static char * ila_error_strings[]
Definition: ila.c:37
u64 lookup_table_nbuckets
Definition: ila.h:93
static uword unformat_half_ip6_address(unformat_input_t *input, va_list *args)
Definition: ila.c:230
dpo_type_t dpo_register_new_type(const dpo_vft_t *vft, const char *const *const *nodes)
Create and register a new DPO type.
Definition: dpo.c:258
Definition: fib_entry.h:216
static vlib_node_registration_t ila_ila2sir_node
INDENT-OFF
Definition: ila.c:248
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:138
#define ila_csum_foreach_type
Definition: ila.h:39
Definition: ila.h:62
Definition: fib_entry.h:220
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
Definition: adj_types.h:36
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:369
u32 vnid
Definition: ila.h:106
fib_node_index_t fib_table_entry_special_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, adj_index_t adj_index)
Add a &#39;special&#39; entry to the FIB that links to the adj passed A special entry is an entry that the FI...
Definition: fib_table.c:369
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
Definition: fib_types.h:168
#define v
Definition: acl.c:314
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:214
#define PREDICT_FALSE(x)
Definition: clib.h:97
ila_csum_mode_t csum_mode
Definition: ila.h:108
static clib_error_t * ila_show_entries_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: ila.c:1048
#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
static_always_inline void vnet_feature_next(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
Definition: feature.h:223
#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:216
static fib_node_back_walk_rc_t ila_fib_node_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Callback function invoked when the forwarding changes for the ILA next-hop.
Definition: ila.c:907
An node in the FIB graph.
Definition: fib_node.h:273
#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:350
void clib_bihash_init(clib_bihash *h, char *name, u32 nbuckets, uword memory_size)
initialize a bounded index extensible hash table
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:576
static void ila_dpo_unlock(dpo_id_t *dpo)
no-op unlock function.
Definition: ila.c:858
u8 * format_ila_direction(u8 *s, va_list *args)
Definition: ila.c:81
unformat_function_t unformat_ip6_address
Definition: format.h:94
static vlib_node_registration_t ila_sir2ila_node
INDENT-OFF
Definition: ila.c:422
u32 as_u32[4]
Definition: ip6_packet.h:50
static const char *const ila_ip6_nodes[]
Definition: ila.c:867
ila_entry_t * entries
Definition: ila.h:91
u16 n_vectors
Definition: node.h:344
#define CLIB_PREFETCH(addr, size, type)
Definition: cache.h:82
void fib_table_entry_delete_index(fib_node_index_t fib_entry_index, fib_source_t source)
Delete a FIB entry.
Definition: fib_table.c:831
u8 * format_ila_ila2sir_trace(u8 *s, va_list *args)
Definition: ila.c:164
static ila_entry_t * ila_entry_from_fib_node(fib_node_t *node)
Definition: ila.c:896
fib_node_get_t fnv_get
Definition: fib_node.h:261
static uword ila_ila2sir(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: ila.c:251
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:28
fib_node_t ila_fib_node
Fib Node base class.
Definition: ila.h:66
static clib_error_t * ila_interface_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: ila.c:1016
static void ila_fib_node_last_lock_gone(fib_node_t *node)
no-op unlock function.
Definition: ila.c:891
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
Definition: dpo.c:154
ila_type_t type
Definition: ila.h:102
Context passed between object during a back walk.
Definition: fib_node.h:186
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:154
fib_node_index_t fib_table_entry_special_dpo_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Add a &#39;special&#39; entry to the FIB that links to the DPO passed A special entry is an entry that the FI...
Definition: fib_table.c:288
u16 cached_next_index
Definition: node.h:463
static uword ip6_address_is_zero(ip6_address_t *a)
Definition: ip6_packet.h:262
unsigned int u32
Definition: types.h:88
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
#define vnet_buffer(b)
Definition: buffer.h:361
int clib_bihash_search(clib_bihash *h, clib_bihash_kv *search_v, clib_bihash_kv *return_v)
Search a bi-hash table.
u64 lookup_table_size
Definition: ila.h:94
static ip_csum_t ip_csum_sub_even(ip_csum_t c, ip_csum_t x)
Definition: ip_packet.h:117
ip6_address_t sir_address
Definition: ila.h:103
Definition: ila.h:90
clib_error_t * vlib_plugin_register(vlib_main_t *vm, vnet_plugin_handoff_t *h, int from_early_init)
Definition: ila.c:825
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject
Definition: dpo.c:118
#define VLIB_BUFFER_IS_TRACED
Definition: buffer.h:95
#define VNET_FEATURES(...)
Definition: feature.h:363
static u8 * format_csum_mode(u8 *s, va_list *va)
Definition: ila.c:93
u64 uword
Definition: types.h:112
static dpo_type_t ila_dpo_type
Dynamically registered DPO Type for ILA.
Definition: ila.c:63
u8 * format_ila_dpo(u8 *s, va_list *va)
Definition: ila.c:833
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
Definition: trace_funcs.h:55
Definition: defs.h:47
#define DPO_PROTO_NUM
Definition: dpo.h:72
u32 next_hop_child_index
The child index on the FIB entry.
Definition: ila.h:82
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:154
#define FIB_NODE_INDEX_INVALID
Definition: fib_types.h:29
unsigned char u8
Definition: types.h:56
static uword max_log2(uword x)
Definition: clib.h:222
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:253
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:165
u64 locator
Definition: ila.h:105
static void ila_dpo_lock(dpo_id_t *dpo)
no-op lock function.
Definition: ila.c:849
ila_error_t
Definition: ila.c:30
A FIB graph nodes virtual function table.
Definition: fib_node.h:260
ila_csum_mode_t csum_mode
Definition: ila.h:71
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
Definition: buffer.h:170
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:169
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:143
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:418
u8 data[0]
Packet data.
Definition: buffer.h:158
ila_type_t
Definition: ila.h:33
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:191
u16 as_u16[8]
Definition: ip6_packet.h:49
u16 dpoi_next_node
The next VLIB node to follow.
Definition: dpo.h:150
#define clib_error_return(e, args...)
Definition: error.h:111
struct _unformat_input_t unformat_input_t
#define foreach_ila_error
Definition: ila.c:27
static uword unformat_ila_csum_mode(unformat_input_t *input, va_list *args)
Definition: ila.c:208
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
Definition: buffer.h:85
static const char *const *const ila_nodes[DPO_PROTO_NUM]
Definition: ila.c:872
static uword ila_sir2ila(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: ila.c:425
unformat_function_t unformat_line_input
Definition: format.h:281
u8 * format_ila_type(u8 *s, va_list *args)
Definition: ila.c:114
int ila_interface(u32 sw_if_index, u8 disable)
Definition: ila.c:817
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:57
#define ILA_TABLE_DEFAULT_HASH_MEMORY_SIZE
Definition: ila.c:25
static u16 ip_csum_fold(ip_csum_t c)
Definition: ip_packet.h:145
Definition: defs.h:46
static ip_csum_t ip_csum_add_even(ip_csum_t c, ip_csum_t x)
Definition: ip_packet.h:101
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
Definition: feature.c:238
ip6_address_t dst_address
Definition: ip6_packet.h:337
void dpo_stack(dpo_type_t child_type, dpo_proto_t child_proto, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child-parent relationship.
Definition: dpo.c:398