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