LCOV - code coverage report
Current view: top level - plugins/ila - ila.c (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 19 423 4.5 %
Date: 2023-07-05 22:20:52 Functions: 15 41 36.6 %

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

Generated by: LCOV version 1.14