FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
lisp_gpe_fwd_entry.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 
20 #include <vnet/fib/fib_table.h>
21 #include <vnet/fib/fib_entry.h>
22 #include <vnet/fib/fib_path_list.h>
23 #include <vnet/dpo/drop_dpo.h>
24 #include <vnet/dpo/lookup_dpo.h>
25 #include <vnet/dpo/load_balance.h>
26 #include <vnet/adj/adj_midchain.h>
27 
28 /**
29  * @brief Add route to IP4 or IP6 Destination FIB.
30  *
31  * Add a route to the destination FIB that results in the lookup
32  * in the SRC FIB. The SRC FIB is created is it does not yet exist.
33  *
34  * @param[in] dst_table_id Destination FIB Table-ID
35  * @param[in] dst_prefix Destination IP prefix.
36  *
37  * @return src_fib_index The index/ID of the SRC FIB created.
38  */
39 static u32
41 {
42  fib_node_index_t src_fib_index;
43  fib_prefix_t dst_fib_prefix;
44  fib_node_index_t dst_fei;
45 
46  ASSERT (NULL != dst_prefix);
47 
48  ip_prefix_to_fib_prefix (dst_prefix, &dst_fib_prefix);
49 
50  /*
51  * lookup the destination prefix in the VRF table and retrieve the
52  * LISP associated data
53  */
54  dst_fei = fib_table_lookup_exact_match (dst_fib_index, &dst_fib_prefix);
55 
56  /*
57  * If the FIB entry is not present, or not LISP sourced, add it
58  */
59  if (dst_fei == FIB_NODE_INDEX_INVALID ||
60  NULL == fib_entry_get_source_data (dst_fei, FIB_SOURCE_LISP))
61  {
62  dpo_id_t src_lkup_dpo = DPO_INVALID;
63 
64  /* create a new src FIB. */
65  src_fib_index =
66  fib_table_create_and_lock (dst_fib_prefix.fp_proto,
68  "LISP-src for [%d,%U]",
69  dst_fib_index,
70  format_fib_prefix, &dst_fib_prefix);
71  /*
72  * add src fib default route
73  */
75  .fp_proto = dst_fib_prefix.fp_proto,
76  };
77  fib_table_entry_special_dpo_add (src_fib_index, &prefix,
81  (dst_fib_prefix.fp_proto)));
82  /*
83  * create a data-path object to perform the source address lookup
84  * in the SRC FIB
85  */
93  &src_lkup_dpo);
94 
95  /*
96  * add the entry to the destination FIB that uses the lookup DPO
97  */
98  dst_fei = fib_table_entry_special_dpo_add (dst_fib_index,
99  &dst_fib_prefix,
102  &src_lkup_dpo);
103 
104  /*
105  * the DPO is locked by the FIB entry, and we have no further
106  * need for it.
107  */
108  dpo_unlock (&src_lkup_dpo);
109 
110  /*
111  * save the SRC FIB index on the entry so we can retrieve it for
112  * subsequent routes.
113  */
114  fib_entry_set_source_data (dst_fei, FIB_SOURCE_LISP, &src_fib_index);
115  }
116  else
117  {
118  /*
119  * destination FIB entry already present
120  */
121  src_fib_index = *(u32 *) fib_entry_get_source_data (dst_fei,
123  }
124 
125  return (src_fib_index);
126 }
127 
128 /**
129  * @brief Del route to IP4 or IP6 SD FIB.
130  *
131  * Remove routes from both destination and source FIBs.
132  *
133  * @param[in] src_fib_index The index/ID of the SRC FIB
134  * @param[in] src_prefix Source IP prefix.
135  * @param[in] dst_fib_index The index/ID of the DST FIB
136  * @param[in] dst_prefix Destination IP prefix.
137  */
138 static void
140  const ip_prefix_t * src_prefix,
141  u32 dst_fib_index, const ip_prefix_t * dst_prefix)
142 {
143  fib_prefix_t dst_fib_prefix, src_fib_prefix;
144  u8 have_default = 0;
145  u32 n_entries;
146 
147  ASSERT (NULL != dst_prefix);
148  ASSERT (NULL != src_prefix);
149 
150  ip_prefix_to_fib_prefix (dst_prefix, &dst_fib_prefix);
151  ip_prefix_to_fib_prefix (src_prefix, &src_fib_prefix);
152 
153  fib_table_entry_delete (src_fib_index, &src_fib_prefix, FIB_SOURCE_LISP);
154 
155  /* check if only default left or empty */
156  fib_prefix_t default_pref = {
157  .fp_proto = dst_fib_prefix.fp_proto
158  };
159 
160  if (fib_table_lookup_exact_match (src_fib_index,
161  &default_pref) != FIB_NODE_INDEX_INVALID)
162  have_default = 1;
163 
164  n_entries = fib_table_get_num_entries (src_fib_index,
165  src_fib_prefix.fp_proto,
167  if (n_entries == 0 || (have_default && n_entries == 1))
168  {
169  /*
170  * remove src FIB default route
171  */
172  if (have_default)
173  fib_table_entry_special_remove (src_fib_index, &default_pref,
175 
176  /*
177  * there's nothing left now, unlock the source FIB and the
178  * destination route
179  */
180  fib_table_entry_special_remove (dst_fib_index,
181  &dst_fib_prefix, FIB_SOURCE_LISP);
182  fib_table_unlock (src_fib_index, src_fib_prefix.fp_proto,
184  }
185 }
186 
187 /**
188  * @brief Add route to IP4 or IP6 SRC FIB.
189  *
190  * Adds a route to in the LISP SRC FIB with the result of the route
191  * being the DPO passed.
192  *
193  * @param[in] src_fib_index The index/ID of the SRC FIB
194  * @param[in] src_prefix Source IP prefix.
195  * @param[in] src_dpo The DPO the route will link to.
196  *
197  * @return fib index of the inserted prefix
198  */
199 static fib_node_index_t
201  const ip_prefix_t * src_prefix,
202  const dpo_id_t * src_dpo)
203 {
204  fib_node_index_t fei = ~0;
205  fib_prefix_t src_fib_prefix;
206 
207  ip_prefix_to_fib_prefix (src_prefix, &src_fib_prefix);
208 
209  /*
210  * add the entry into the source fib.
211  */
212  fib_node_index_t src_fei;
213 
214  src_fei = fib_table_lookup_exact_match (src_fib_index, &src_fib_prefix);
215 
216  if (FIB_NODE_INDEX_INVALID == src_fei ||
218  {
219  fei = fib_table_entry_special_dpo_add (src_fib_index,
220  &src_fib_prefix,
223  src_dpo);
224  }
225  return fei;
226 }
227 
228 static fib_route_path_t *
230 {
231  const lisp_gpe_adjacency_t *ladj;
232  fib_route_path_t *rpaths = NULL;
233  fib_protocol_t fp;
234  u8 best_priority;
235  u32 ii;
236 
237  vec_validate (rpaths, vec_len (paths) - 1);
238 
239  best_priority = paths[0].priority;
240 
242  {
243  if (paths[0].priority != best_priority)
244  break;
245 
246  ladj = lisp_gpe_adjacency_get (paths[ii].lisp_adj);
247 
248  fp = ip_address_to_46 (&ladj->remote_rloc, &rpaths[ii].frp_addr);
249 
250  rpaths[ii].frp_proto = fib_proto_to_dpo (fp);
251  rpaths[ii].frp_sw_if_index = ladj->sw_if_index;
252  rpaths[ii].frp_weight = (paths[ii].weight ? paths[ii].weight : 1);
253  }
254 
255  ASSERT (0 != vec_len (rpaths));
256 
257  return (rpaths);
258 }
259 
260 /**
261  * @brief Add route to IP4 or IP6 SRC FIB.
262  *
263  * Adds a route to in the LISP SRC FIB for the tunnel.
264  *
265  * @param[in] src_fib_index The index/ID of the SRC FIB
266  * @param[in] src_prefix Source IP prefix.
267  * @param[in] paths The paths from which to construct the
268  * load balance
269  */
270 static fib_node_index_t
271 ip_src_fib_add_route (u32 src_fib_index,
272  const ip_prefix_t * src_prefix,
273  const lisp_fwd_path_t * paths)
274 {
275  fib_prefix_t src_fib_prefix;
276  fib_route_path_t *rpaths;
277 
278  ip_prefix_to_fib_prefix (src_prefix, &src_fib_prefix);
279 
280  rpaths = lisp_gpe_mk_fib_paths (paths);
281 
282  fib_node_index_t fib_entry_index =
283  fib_table_entry_update (src_fib_index, &src_fib_prefix, FIB_SOURCE_LISP,
284  FIB_ENTRY_FLAG_NONE, rpaths);
285  vec_free (rpaths);
286  return fib_entry_index;
287 }
288 
289 static void
291 {
293  u8 found = 0, ip_version;
294  u32 *lfei, new_lfei;
295  ip_version = ip_prefix_version (&lfe->key->rmt.ippref);
296 
297  new_lfei = lfe - lgm->lisp_fwd_entry_pool;
298  vec_foreach (lfei, lgm->native_fwd_lfes[ip_version])
299  {
300  lfe = pool_elt_at_index (lgm->lisp_fwd_entry_pool, lfei[0]);
301  if (lfei[0] == new_lfei)
302  {
303  found = 1;
304  break;
305  }
306  }
307 
308  if (is_add)
309  {
310  if (!found)
311  vec_add1 (lgm->native_fwd_lfes[ip_version], new_lfei);
312  }
313  else
314  {
315  if (found)
316  vec_del1 (lgm->native_fwd_lfes[ip_version], lfei[0]);
317  }
318 }
319 
320 static index_t
322 {
323  fib_node_index_t fi;
324  fib_entry_t *fe;
326  dpo_proto_t dproto;
327  ip_prefix_t ippref;
328  fib_prefix_t fib_prefix;
329  u8 ip_version = ip_prefix_version (&lfe->key->rmt.ippref);
330  dproto = (ip_version == AF_IP4 ? DPO_PROTO_IP4 : DPO_PROTO_IP6);
331 
332  if (lfe->is_src_dst)
333  {
335  &lfe->key->rmt.ippref);
336  memcpy (&ippref, &lfe->key->lcl.ippref, sizeof (ippref));
337  }
338  else
339  {
340  lfe->src_fib_index = lfe->eid_fib_index;
341  memcpy (&ippref, &lfe->key->rmt.ippref, sizeof (ippref));
342  }
343 
345  {
346  dpo_id_t dpo = DPO_INVALID;
347 
348  switch (lfe->action)
349  {
350  case LISP_FORWARD_NATIVE:
351  /* TODO handle route overlaps with fib and default route */
352  if (vec_len (lgm->native_fwd_rpath[ip_version]))
353  {
354  ip_prefix_to_fib_prefix (&lfe->key->rmt.ippref, &fib_prefix);
355  fi = fib_table_entry_update (lfe->eid_fib_index, &fib_prefix,
358  lgm->native_fwd_rpath[ip_version]);
360  goto done;
361  }
362  case LISP_NO_ACTION:
363  /* TODO update timers? */
365  /* insert tunnel that always sends map-request */
366  dpo_copy (&dpo, lisp_cp_dpo_get (dproto));
367  break;
368  case LISP_DROP:
369  /* for drop fwd entries, just add route, no need to add encap tunnel */
370  dpo_copy (&dpo, drop_dpo_get (dproto));
371  break;
372  }
373  fi = ip_src_fib_add_route_w_dpo (lfe->src_fib_index, &ippref, &dpo);
374  dpo_reset (&dpo);
375  }
376  else
377  {
378  fi = ip_src_fib_add_route (lfe->src_fib_index, &ippref, lfe->paths);
379  }
380 done:
381  fe = fib_entry_get (fi);
382  return fe->fe_lb.dpoi_index;
383 }
384 
385 static void
387 {
388  fib_prefix_t dst_fib_prefix;
389 
390  if (lfe->is_src_dst)
392  &lfe->key->lcl.ippref,
393  lfe->eid_fib_index, &lfe->key->rmt.ippref);
394  else
395  {
396  ip_prefix_to_fib_prefix (&lfe->key->rmt.ippref, &dst_fib_prefix);
397  fib_table_entry_delete (lfe->src_fib_index, &dst_fib_prefix,
400  }
401 }
402 
403 static lisp_gpe_fwd_entry_t *
407 {
408  uword *p;
409 
410  clib_memset (key, 0, sizeof (*key));
411 
412  if (GID_ADDR_IP_PREFIX == gid_address_type (&a->rmt_eid))
413  {
414  /*
415  * the ip version of the source is not set to ip6 when the
416  * source is all zeros. force it.
417  */
418  ip_prefix_version (&gid_address_ippref (&a->lcl_eid)) =
419  ip_prefix_version (&gid_address_ippref (&a->rmt_eid));
420  }
421 
422  gid_to_dp_address (&a->rmt_eid, &key->rmt);
423  gid_to_dp_address (&a->lcl_eid, &key->lcl);
424  key->vni = a->vni;
425 
427 
428  if (NULL != p)
429  {
430  return (pool_elt_at_index (lgm->lisp_fwd_entry_pool, p[0]));
431  }
432  return (NULL);
433 }
434 
435 static int
436 lisp_gpe_fwd_entry_path_sort (void *a1, void *a2)
437 {
438  lisp_fwd_path_t *p1 = a1, *p2 = a2;
439 
440  return (p1->priority - p2->priority);
441 }
442 
443 static void
446 {
448  u32 index;
449 
450  vec_validate (lfe->paths, vec_len (a->locator_pairs) - 1);
451 
452  vec_foreach_index (index, a->locator_pairs)
453  {
454  path = &lfe->paths[index];
455 
456  path->priority = a->locator_pairs[index].priority;
457  path->weight = a->locator_pairs[index].weight;
458 
459  path->lisp_adj =
461  [index],
462  a->dp_table, lfe->key->vni);
463  }
465 }
466 
467 void
469  u32 fwd_entry_index)
470 {
471  const lisp_gpe_adjacency_t *ladj;
474  u8 *placeholder_elt;
478 
479  lfe = find_fwd_entry (lgm, a, &fe_key);
480 
481  if (!lfe)
482  return;
483 
485  return;
486 
487  clib_memset (&key, 0, sizeof (key));
488  key.fwd_entry_index = fwd_entry_index;
489 
490  vec_foreach (path, lfe->paths)
491  {
492  ladj = lisp_gpe_adjacency_get (path->lisp_adj);
493  key.tunnel_index = ladj->tunnel_index;
494  lisp_stats_key_t *key_copy = clib_mem_alloc (sizeof (*key_copy));
495  memcpy (key_copy, &key, sizeof (*key_copy));
496  pool_get (lgm->placeholder_stats_pool, placeholder_elt);
497  hash_set_mem (lgm->lisp_stats_index_by_key, key_copy,
498  placeholder_elt - lgm->placeholder_stats_pool);
499 
501  placeholder_elt -
504  placeholder_elt -
506  }
507 }
508 
509 /**
510  * @brief Add/Delete LISP IP forwarding entry.
511  *
512  * creation of forwarding entries for IP LISP overlay:
513  *
514  * @param[in] lgm Reference to @ref lisp_gpe_main_t.
515  * @param[in] a Parameters for building the forwarding entry.
516  *
517  * @return 0 on success.
518  */
519 static int
522 {
525  fib_protocol_t fproto;
526 
527  lfe = find_fwd_entry (lgm, a, &key);
528 
529  if (NULL != lfe)
530  /* don't support updates */
531  return VNET_API_ERROR_INVALID_VALUE;
532 
533  pool_get (lgm->lisp_fwd_entry_pool, lfe);
534  clib_memset (lfe, 0, sizeof (*lfe));
535  lfe->key = clib_mem_alloc (sizeof (key));
536  memcpy (lfe->key, &key, sizeof (key));
537 
539  lfe - lgm->lisp_fwd_entry_pool);
540  a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
541 
542  fproto = (AF_IP4 == ip_prefix_version (&fid_addr_ippref (&lfe->key->rmt)) ?
544 
545  lfe->type = (a->is_negative ?
549  lfe->eid_table_id = a->table_id;
551  lfe->eid_table_id,
553  lfe->is_src_dst = a->is_src_dst;
554 
556  {
558  }
559  else
560  {
561  lfe->action = a->action;
562  }
563 
564  lfe->dpoi_index = create_fib_entries (lfe);
565  return (0);
566 }
567 
568 static void
570 {
572  fib_protocol_t fproto;
573 
575  {
576  vec_foreach (path, lfe->paths)
577  {
578  lisp_gpe_adjacency_unlock (path->lisp_adj);
579  }
580  }
581 
582  delete_fib_entries (lfe);
583 
584  fproto = (AF_IP4 == ip_prefix_version (&fid_addr_ippref (&lfe->key->rmt)) ?
587 
589  clib_mem_free (lfe->key);
590  pool_put (lgm->lisp_fwd_entry_pool, lfe);
591 }
592 
593 /**
594  * @brief Add/Delete LISP IP forwarding entry.
595  *
596  * removal of forwarding entries for IP LISP overlay:
597  *
598  * @param[in] lgm Reference to @ref lisp_gpe_main_t.
599  * @param[in] a Parameters for building the forwarding entry.
600  *
601  * @return 0 on success.
602  */
603 static int
606 {
609 
610  lfe = find_fwd_entry (lgm, a, &key);
611 
612  if (NULL == lfe)
613  /* no such entry */
614  return VNET_API_ERROR_INVALID_VALUE;
615 
616  del_ip_fwd_entry_i (lgm, lfe);
617 
618  return (0);
619 }
620 
621 static void
622 make_mac_fib_key (BVT (clib_bihash_kv) * kv, u16 bd_index, u8 src_mac[6],
623  u8 dst_mac[6])
624 {
625  kv->key[0] = (((u64) bd_index) << 48) | mac_to_u64 (dst_mac);
626  kv->key[1] = mac_to_u64 (src_mac);
627  kv->key[2] = 0;
628 }
629 
630 /**
631  * @brief Lookup L2 SD FIB entry
632  *
633  * Does a vni + dest + source lookup in the L2 LISP FIB. If the lookup fails
634  * it tries a second time with source set to 0 (i.e., a simple dest lookup).
635  *
636  * @param[in] lgm Reference to @ref lisp_gpe_main_t.
637  * @param[in] bd_index Bridge domain index.
638  * @param[in] src_mac Source mac address.
639  * @param[in] dst_mac Destination mac address.
640  *
641  * @return index of mapping matching the lookup key.
642  */
643 index_t
645  u8 dst_mac[6])
646 {
647  int rv;
648  BVT (clib_bihash_kv) kv, value;
649 
650  make_mac_fib_key (&kv, bd_index, src_mac, dst_mac);
651  rv = BV (clib_bihash_search_inline_2) (&lgm->l2_fib, &kv, &value);
652 
653  /* no match, try with src 0, catch all for dst */
654  if (rv != 0)
655  {
656  kv.key[1] = 0;
657  rv = BV (clib_bihash_search_inline_2) (&lgm->l2_fib, &kv, &value);
658  if (rv == 0)
659  return value.value;
660  }
661  else
662  return value.value;
663 
665 }
666 
667 /**
668  * @brief Add/del L2 SD FIB entry
669  *
670  * Inserts value in L2 FIB keyed by vni + dest + source. If entry is
671  * overwritten the associated value is returned.
672  *
673  * @param[in] lgm Reference to @ref lisp_gpe_main_t.
674  * @param[in] bd_index Bridge domain index.
675  * @param[in] src_mac Source mac address.
676  * @param[in] dst_mac Destination mac address.
677  * @param[in] val Value to add.
678  * @param[in] is_add Add/del flag.
679  *
680  * @return ~0 or value of overwritten entry.
681  */
682 static u32
684  u8 dst_mac[6], const dpo_id_t * dpo, u8 is_add)
685 {
687  BVT (clib_bihash_kv) kv, value;
688  u32 old_val = ~0;
689 
690  make_mac_fib_key (&kv, bd_index, src_mac, dst_mac);
691 
692  if (BV (clib_bihash_search) (&lgm->l2_fib, &kv, &value) == 0)
693  old_val = value.value;
694 
695  if (!is_add)
696  BV (clib_bihash_add_del) (&lgm->l2_fib, &kv, 0 /* is_add */ );
697  else
698  {
699  kv.value = dpo->dpoi_index;
700  BV (clib_bihash_add_del) (&lgm->l2_fib, &kv, 1 /* is_add */ );
701  }
702  return old_val;
703 }
704 
705 #define L2_FIB_DEFAULT_HASH_NUM_BUCKETS (64 * 1024)
706 #define L2_FIB_DEFAULT_HASH_MEMORY_SIZE (32<<20)
707 
708 static void
710 {
711  index_t lbi;
712 
713  BV (clib_bihash_init) (&lgm->l2_fib, "l2 fib",
716 
717  /*
718  * the result from a 'miss' in a L2 Table
719  */
722 
724 }
725 
726 static void
728 {
730 
732  {
733  vec_foreach (path, lfe->paths)
734  {
735  lisp_gpe_adjacency_unlock (path->lisp_adj);
736  }
737  fib_path_list_child_remove (lfe->l2.path_list_index,
738  lfe->l2.child_index);
739  }
740 
741  lisp_l2_fib_add_del_entry (lfe->l2.eid_bd_index,
742  fid_addr_mac (&lfe->key->lcl),
743  fid_addr_mac (&lfe->key->rmt), NULL, 0);
744 
746  clib_mem_free (lfe->key);
747  pool_put (lgm->lisp_fwd_entry_pool, lfe);
748 }
749 
750 /**
751  * @brief Delete LISP L2 forwarding entry.
752  *
753  * Coordinates the removal of forwarding entries for L2 LISP overlay:
754  *
755  * @param[in] lgm Reference to @ref lisp_gpe_main_t.
756  * @param[in] a Parameters for building the forwarding entry.
757  *
758  * @return 0 on success.
759  */
760 static int
763 {
766 
767  lfe = find_fwd_entry (lgm, a, &key);
768 
769  if (NULL == lfe)
770  return VNET_API_ERROR_INVALID_VALUE;
771 
772  del_l2_fwd_entry_i (lgm, lfe);
773 
774  return (0);
775 }
776 
777 /**
778  * @brief Construct and insert the forwarding information used by an L2 entry
779  */
780 static void
782 {
784  dpo_id_t dpo = DPO_INVALID;
785 
787  {
788  fib_path_list_contribute_forwarding (lfe->l2.path_list_index,
791  &lfe->l2.dpo);
792  dpo_copy (&dpo, &lfe->l2.dpo);
793  }
794  else
795  {
796  switch (lfe->action)
797  {
798  case SEND_MAP_REQUEST:
799  dpo_copy (&dpo, &lgm->l2_lb_cp_lkup);
800  break;
801  case NO_ACTION:
802  case FORWARD_NATIVE:
803  case DROP:
805  }
806  }
807 
808  /* add entry to l2 lisp fib */
809  lisp_l2_fib_add_del_entry (lfe->l2.eid_bd_index,
810  fid_addr_mac (&lfe->key->lcl),
811  fid_addr_mac (&lfe->key->rmt), &dpo, 1);
812  lfe->dpoi_index = dpo.dpoi_index;
813 
814  dpo_reset (&dpo);
815 }
816 
817 /**
818  * @brief Add LISP L2 forwarding entry.
819  *
820  * Coordinates the creation of forwarding entries for L2 LISP overlay:
821  * creates lisp-gpe tunnel and injects new entry in Source/Dest L2 FIB.
822  *
823  * @param[in] lgm Reference to @ref lisp_gpe_main_t.
824  * @param[in] a Parameters for building the forwarding entry.
825  *
826  * @return 0 on success.
827  */
828 static int
831 {
833  bd_main_t *bdm = &bd_main;
835  uword *bd_indexp;
836 
837  bd_indexp = hash_get (bdm->bd_index_by_bd_id, a->bd_id);
838  if (!bd_indexp)
839  {
840  clib_warning ("bridge domain %d doesn't exist", a->bd_id);
841  return -1;
842  }
843 
844  lfe = find_fwd_entry (lgm, a, &key);
845 
846  if (NULL != lfe)
847  /* don't support updates */
848  return VNET_API_ERROR_INVALID_VALUE;
849 
850  pool_get (lgm->lisp_fwd_entry_pool, lfe);
851  clib_memset (lfe, 0, sizeof (*lfe));
852  lfe->key = clib_mem_alloc (sizeof (key));
853  memcpy (lfe->key, &key, sizeof (key));
854 
856  lfe - lgm->lisp_fwd_entry_pool);
857  a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
858 
859  lfe->type = (a->is_negative ?
862  lfe->l2.eid_bd_id = a->bd_id;
863  lfe->l2.eid_bd_index = bd_indexp[0];
865 
867  {
868  fib_route_path_t *rpaths;
869 
870  /*
871  * Make the sorted array of LISP paths with their resp. adjacency
872  */
874 
875  /*
876  * From the LISP paths, construct a FIB path list that will
877  * contribute a load-balance.
878  */
879  rpaths = lisp_gpe_mk_fib_paths (lfe->paths);
880 
881  lfe->l2.path_list_index =
883 
884  /*
885  * become a child of the path-list so we receive updates when
886  * its forwarding state changes. this includes an implicit lock.
887  */
888  lfe->l2.child_index =
889  fib_path_list_child_add (lfe->l2.path_list_index,
891  lfe - lgm->lisp_fwd_entry_pool);
892  }
893  else
894  {
895  lfe->action = a->action;
896  }
897 
899 
900  return 0;
901 }
902 
903 /**
904  * @brief Lookup NSH SD FIB entry
905  *
906  * Does an SPI+SI lookup in the NSH LISP FIB.
907  *
908  * @param[in] lgm Reference to @ref lisp_gpe_main_t.
909  * @param[in] spi_si SPI + SI.
910  *
911  * @return next node index.
912  */
913 const dpo_id_t *
914 lisp_nsh_fib_lookup (lisp_gpe_main_t * lgm, u32 spi_si_net_order)
915 {
916  int rv;
917  BVT (clib_bihash_kv) kv, value;
918 
919  clib_memset (&kv, 0, sizeof (kv));
920  kv.key[0] = spi_si_net_order;
921  rv = BV (clib_bihash_search_inline_2) (&lgm->nsh_fib, &kv, &value);
922 
923  if (rv != 0)
924  {
925  return lgm->nsh_cp_lkup;
926  }
927  else
928  {
930  lfe = pool_elt_at_index (lgm->lisp_fwd_entry_pool, value.value);
931  return &lfe->nsh.choice;
932  }
933 }
934 
935 /**
936  * @brief Add/del NSH FIB entry
937  *
938  * Inserts value in NSH FIB keyed by SPI+SI. If entry is
939  * overwritten the associated value is returned.
940  *
941  * @param[in] lgm Reference to @ref lisp_gpe_main_t.
942  * @param[in] spi_si SPI + SI.
943  * @param[in] dpo Load balanced mapped to SPI + SI
944  *
945  * @return ~0 or value of overwritten entry.
946  */
947 static u32
948 lisp_nsh_fib_add_del_entry (u32 spi_si_host_order, u32 lfei, u8 is_add)
949 {
951  BVT (clib_bihash_kv) kv, value;
952  u32 old_val = ~0;
953 
954  clib_memset (&kv, 0, sizeof (kv));
955  kv.key[0] = clib_host_to_net_u32 (spi_si_host_order);
956  kv.value = 0ULL;
957 
958  if (BV (clib_bihash_search) (&lgm->nsh_fib, &kv, &value) == 0)
959  old_val = value.value;
960 
961  if (!is_add)
962  BV (clib_bihash_add_del) (&lgm->nsh_fib, &kv, 0 /* is_add */ );
963  else
964  {
965  kv.value = lfei;
966  BV (clib_bihash_add_del) (&lgm->nsh_fib, &kv, 1 /* is_add */ );
967  }
968  return old_val;
969 }
970 
971 #define NSH_FIB_DEFAULT_HASH_NUM_BUCKETS (64 * 1024)
972 #define NSH_FIB_DEFAULT_HASH_MEMORY_SIZE (32<<20)
973 
974 static void
976 {
977  BV (clib_bihash_init) (&lgm->nsh_fib, "nsh fib",
980 
981  /*
982  * the result from a 'miss' in a NSH Table
983  */
985 }
986 
987 static void
989 {
991 
993  {
994  vec_foreach (path, lfe->paths)
995  {
996  lisp_gpe_adjacency_unlock (path->lisp_adj);
997  }
998  fib_path_list_child_remove (lfe->nsh.path_list_index,
999  lfe->nsh.child_index);
1000  dpo_reset (&lfe->nsh.choice);
1001  }
1002 
1003  lisp_nsh_fib_add_del_entry (fid_addr_nsh (&lfe->key->rmt), (u32) ~ 0, 0);
1004 
1006  clib_mem_free (lfe->key);
1007  pool_put (lgm->lisp_fwd_entry_pool, lfe);
1008 }
1009 
1010 /**
1011  * @brief Delete LISP NSH forwarding entry.
1012  *
1013  * Coordinates the removal of forwarding entries for NSH LISP overlay:
1014  *
1015  * @param[in] lgm Reference to @ref lisp_gpe_main_t.
1016  * @param[in] a Parameters for building the forwarding entry.
1017  *
1018  * @return 0 on success.
1019  */
1020 static int
1023 {
1025  lisp_gpe_fwd_entry_t *lfe;
1026 
1027  lfe = find_fwd_entry (lgm, a, &key);
1028 
1029  if (NULL == lfe)
1030  return VNET_API_ERROR_INVALID_VALUE;
1031 
1032  del_nsh_fwd_entry_i (lgm, lfe);
1033 
1034  return (0);
1035 }
1036 
1037 /**
1038  * @brief Construct and insert the forwarding information used by an NSH entry
1039  */
1040 static void
1042 {
1044  dpo_id_t dpo = DPO_INVALID;
1046  uword *hip;
1047 
1049  {
1050  fib_path_list_contribute_forwarding (lfe->nsh.path_list_index,
1053  &lfe->nsh.dpo);
1054 
1055  /*
1056  * LISP encap is always the same for this SPI+SI so we do that hash now
1057  * and stack on the choice.
1058  */
1059  if (DPO_LOAD_BALANCE == lfe->nsh.dpo.dpoi_type)
1060  {
1061  const dpo_id_t *tmp;
1062  const load_balance_t *lb;
1063  int hash;
1064 
1065  lb = load_balance_get (lfe->nsh.dpo.dpoi_index);
1066  hash = fid_addr_nsh (&lfe->key->rmt) % lb->lb_n_buckets;
1067  tmp =
1069 
1070  dpo_copy (&dpo, tmp);
1071  }
1072  }
1073  else
1074  {
1075  switch (lfe->action)
1076  {
1077  case SEND_MAP_REQUEST:
1078  dpo_copy (&dpo, lgm->nsh_cp_lkup);
1079  break;
1080  case NO_ACTION:
1081  case FORWARD_NATIVE:
1082  case DROP:
1084  }
1085  }
1086 
1087  /* We have only one nsh-lisp interface (no NSH virtualization) */
1089  if (hip)
1090  {
1091  hi = vnet_get_hw_interface (lgm->vnet_main, hip[0]);
1092  dpo_stack_from_node (hi->tx_node_index, &lfe->nsh.choice, &dpo);
1093  }
1094  /* add entry to nsh lisp fib */
1096  lfe - lgm->lisp_fwd_entry_pool, 1);
1097  dpo_reset (&dpo);
1098 
1099 }
1100 
1101 /**
1102  * @brief Add LISP NSH forwarding entry.
1103  *
1104  * Coordinates the creation of forwarding entries for L2 LISP overlay:
1105  * creates lisp-gpe tunnel and injects new entry in Source/Dest L2 FIB.
1106  *
1107  * @param[in] lgm Reference to @ref lisp_gpe_main_t.
1108  * @param[in] a Parameters for building the forwarding entry.
1109  *
1110  * @return 0 on success.
1111  */
1112 static int
1115 {
1117  lisp_gpe_fwd_entry_t *lfe;
1118 
1119  lfe = find_fwd_entry (lgm, a, &key);
1120 
1121  if (NULL != lfe)
1122  /* don't support updates */
1123  return VNET_API_ERROR_INVALID_VALUE;
1124 
1125  pool_get (lgm->lisp_fwd_entry_pool, lfe);
1126  clib_memset (lfe, 0, sizeof (*lfe));
1127  lfe->key = clib_mem_alloc (sizeof (key));
1128  memcpy (lfe->key, &key, sizeof (key));
1129 
1131  lfe - lgm->lisp_fwd_entry_pool);
1132  a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
1133 
1134  lfe->type = (a->is_negative ?
1137  lfe->tenant = 0;
1138 
1140  {
1141  fib_route_path_t *rpaths;
1142 
1143  /*
1144  * Make the sorted array of LISP paths with their resp. adjacency
1145  */
1147 
1148  /*
1149  * From the LISP paths, construct a FIB path list that will
1150  * contribute a load-balance.
1151  */
1152  rpaths = lisp_gpe_mk_fib_paths (lfe->paths);
1153 
1154  lfe->nsh.path_list_index =
1156 
1157  /*
1158  * become a child of the path-list so we receive updates when
1159  * its forwarding state changes. this includes an implicit lock.
1160  */
1161  lfe->nsh.child_index =
1162  fib_path_list_child_add (lfe->nsh.path_list_index,
1164  lfe - lgm->lisp_fwd_entry_pool);
1165  }
1166  else
1167  {
1168  lfe->action = a->action;
1169  }
1170 
1172 
1173  return 0;
1174 }
1175 
1176 /**
1177  * @brief conver from the embedded fib_node_t struct to the LSIP entry
1178  */
1179 static lisp_gpe_fwd_entry_t *
1181 {
1182  return ((lisp_gpe_fwd_entry_t *) (((char *) node) -
1184  node)));
1185 }
1186 
1187 /**
1188  * @brief Function invoked during a backwalk of the FIB graph
1189  */
1193 {
1195 
1196  if (fid_addr_type (&lfe->key->rmt) == FID_ADDR_MAC)
1198  else if (fid_addr_type (&lfe->key->rmt) == FID_ADDR_NSH)
1200 
1201  return (FIB_NODE_BACK_WALK_CONTINUE);
1202 }
1203 
1204 /**
1205  * @brief Get a fib_node_t struct from the index of a LISP fwd entry
1206  */
1207 static fib_node_t *
1209 {
1211  lisp_gpe_fwd_entry_t *lfe;
1212 
1214 
1215  return (&(lfe->node));
1216 }
1217 
1218 /**
1219  * @brief An indication from the graph that the last lock has gone
1220  */
1221 static void
1223 {
1224  /* We don't manage the locks of the LISP objects via the graph, since
1225  * this object has no children. so this is a no-op. */
1226 }
1227 
1228 /**
1229  * @brief Virtual function table to register with FIB for the LISP type
1230  */
1234  .fnv_back_walk = lisp_gpe_fib_node_back_walk,
1235 };
1236 
1237 /**
1238  * @brief Forwarding entry create/remove dispatcher.
1239  *
1240  * Calls l2 or l3 forwarding entry add/del function based on input data.
1241  *
1242  * @param[in] a Forwarding entry parameters.
1243  * @param[out] hw_if_indexp NOT USED
1244  *
1245  * @return 0 on success.
1246  */
1247 int
1249  u32 * hw_if_indexp)
1250 {
1252  u8 type;
1253 
1255  {
1256  clib_warning ("LISP is disabled!");
1257  return VNET_API_ERROR_LISP_DISABLED;
1258  }
1259 
1260  type = gid_address_type (&a->rmt_eid);
1261  switch (type)
1262  {
1263  case GID_ADDR_IP_PREFIX:
1264  if (a->is_add)
1265  return add_ip_fwd_entry (lgm, a);
1266  else
1267  return del_ip_fwd_entry (lgm, a);
1268  break;
1269  case GID_ADDR_MAC:
1270  if (a->is_add)
1271  return add_l2_fwd_entry (lgm, a);
1272  else
1273  return del_l2_fwd_entry (lgm, a);
1274  case GID_ADDR_NSH:
1275  if (a->is_add)
1276  return add_nsh_fwd_entry (lgm, a);
1277  else
1278  return del_nsh_fwd_entry (lgm, a);
1279  default:
1280  clib_warning ("Forwarding entries for type %d not supported!", type);
1281  return -1;
1282  }
1283 }
1284 
1285 int
1287 {
1290  u32 i;
1291 
1292  if (cm->counters == NULL)
1293  return 0;
1294 
1295  for (i = 0; i < vlib_combined_counter_n_counters (cm); i++)
1297 
1298  return 0;
1299 }
1300 
1301 static void
1302 lisp_del_adj_stats (lisp_gpe_main_t * lgm, u32 fwd_entry_index, u32 ti)
1303 {
1304  hash_pair_t *hp;
1306  void *key_copy;
1307  uword *p;
1308  u8 *s;
1309 
1310  clib_memset (&key, 0, sizeof (key));
1311  key.fwd_entry_index = fwd_entry_index;
1312  key.tunnel_index = ti;
1313 
1315  if (p)
1316  {
1317  s = pool_elt_at_index (lgm->placeholder_stats_pool, p[0]);
1319  key_copy = (void *) (hp->key);
1321  clib_mem_free (key_copy);
1322  pool_put (lgm->placeholder_stats_pool, s);
1323  }
1324 }
1325 
1326 void
1328  u32 fwd_entry_index)
1329 {
1331  lisp_gpe_fwd_entry_key_t fe_key;
1332  lisp_gpe_fwd_entry_t *lfe;
1334  const lisp_gpe_adjacency_t *ladj;
1335 
1336  lfe = find_fwd_entry (lgm, a, &fe_key);
1337  if (!lfe)
1338  return;
1339 
1341  return;
1342 
1343  vec_foreach (path, lfe->paths)
1344  {
1345  ladj = lisp_gpe_adjacency_get (path->lisp_adj);
1346  lisp_del_adj_stats (lgm, fwd_entry_index, ladj->tunnel_index);
1347  }
1348 }
1349 
1350 /**
1351  * @brief Flush all the forwrding entries
1352  */
1353 void
1355 {
1357  lisp_gpe_fwd_entry_t *lfe;
1358 
1359  /* *INDENT-OFF* */
1360  pool_foreach (lfe, lgm->lisp_fwd_entry_pool)
1361  {
1362  switch (fid_addr_type(&lfe->key->rmt))
1363  {
1364  case FID_ADDR_MAC:
1365  del_l2_fwd_entry_i (lgm, lfe);
1366  break;
1367  case FID_ADDR_IP_PREF:
1368  del_ip_fwd_entry_i (lgm, lfe);
1369  break;
1370  case FID_ADDR_NSH:
1371  del_nsh_fwd_entry_i (lgm, lfe);
1372  break;
1373  }
1374  }
1375  /* *INDENT-ON* */
1376 }
1377 
1378 static u8 *
1379 format_lisp_fwd_path (u8 * s, va_list * ap)
1380 {
1381  lisp_fwd_path_t *lfp = va_arg (*ap, lisp_fwd_path_t *);
1382 
1383  s = format (s, "weight:%d ", lfp->weight);
1384  s = format (s, "adj:[%U]\n",
1388 
1389  return (s);
1390 }
1391 
1393 {
1397 
1398 
1399 static u8 *
1400 format_lisp_gpe_fwd_entry (u8 * s, va_list * ap)
1401 {
1403  lisp_gpe_fwd_entry_t *lfe = va_arg (*ap, lisp_gpe_fwd_entry_t *);
1405  va_arg (*ap, lisp_gpe_fwd_entry_format_flag_t);
1406 
1407  s = format (s, "VNI:%d VRF:%d EID: %U -> %U [index:%d]",
1408  lfe->key->vni, lfe->eid_table_id,
1409  format_fid_address, &lfe->key->lcl,
1410  format_fid_address, &lfe->key->rmt,
1411  lfe - lgm->lisp_fwd_entry_pool);
1412 
1414  {
1415  s = format (s, "\n Negative - action:%U",
1417  }
1418  else
1419  {
1421 
1422  s = format (s, "\n via:");
1423  vec_foreach (path, lfe->paths)
1424  {
1425  s = format (s, "\n %U", format_lisp_fwd_path, path);
1426  }
1427  }
1428 
1430  {
1431  switch (fid_addr_type (&lfe->key->rmt))
1432  {
1433  case FID_ADDR_MAC:
1434  s = format (s, " fib-path-list:%d\n", lfe->l2.path_list_index);
1435  s = format (s, " dpo:%U\n", format_dpo_id, &lfe->l2.dpo, 0);
1436  break;
1437  case FID_ADDR_NSH:
1438  s = format (s, " fib-path-list:%d\n", lfe->nsh.path_list_index);
1439  s = format (s, " dpo:%U\n", format_dpo_id, &lfe->nsh.dpo, 0);
1440  break;
1441  case FID_ADDR_IP_PREF:
1442  break;
1443  }
1444  }
1445 
1446  return (s);
1447 }
1448 
1449 static clib_error_t *
1451  unformat_input_t * input, vlib_cli_command_t * cmd)
1452 {
1454  lisp_gpe_fwd_entry_t *lfe;
1455  index_t index;
1456  u32 vni = ~0;
1457 
1458  if (unformat (input, "vni %d", &vni))
1459  ;
1460  else if (unformat (input, "%d", &index))
1461  {
1463  {
1465 
1466  vlib_cli_output (vm, "[%d@] %U",
1467  index,
1470  }
1471  else
1472  {
1473  vlib_cli_output (vm, "entry %d invalid", index);
1474  }
1475 
1476  return (NULL);
1477  }
1478 
1479  /* *INDENT-OFF* */
1480  pool_foreach (lfe, lgm->lisp_fwd_entry_pool)
1481  {
1482  if ((vni == ~0) ||
1483  (lfe->key->vni == vni))
1486  }
1487  /* *INDENT-ON* */
1488 
1489  return (NULL);
1490 }
1491 
1492 /* *INDENT-OFF* */
1494  .path = "show gpe entry",
1495  .short_help = "show gpe entry vni <vni> vrf <vrf> [leid <leid>] reid <reid>",
1496  .function = lisp_gpe_fwd_entry_show,
1497 };
1498 /* *INDENT-ON* */
1499 
1500 clib_error_t *
1502 {
1504  clib_error_t *error = NULL;
1505 
1507  return (error);
1508 
1509  l2_fib_init (lgm);
1510  nsh_fib_init (lgm);
1511 
1513 
1514  return (error);
1515 }
1516 
1517 u32 *
1519 {
1521  lisp_gpe_fwd_entry_t *lfe;
1522  u32 *vnis = 0;
1523 
1524  /* *INDENT-OFF* */
1525  pool_foreach (lfe, lgm->lisp_fwd_entry_pool)
1526  {
1527  hash_set (vnis, lfe->key->vni, 0);
1528  }
1529  /* *INDENT-ON* */
1530 
1531  return vnis;
1532 }
1533 
1536 {
1538  lisp_gpe_fwd_entry_t *lfe;
1540 
1541  /* *INDENT-OFF* */
1542  pool_foreach (lfe, lgm->lisp_fwd_entry_pool)
1543  {
1544  if (lfe->key->vni == vni)
1545  {
1546  clib_memset (&e, 0, sizeof (e));
1547  e.dp_table = lfe->eid_table_id;
1548  e.vni = lfe->key->vni;
1550  e.action = lfe->action;
1551  e.fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
1552  memcpy (&e.reid, &lfe->key->rmt, sizeof (e.reid));
1553  memcpy (&e.leid, &lfe->key->lcl, sizeof (e.leid));
1554  vec_add1 (entries, e);
1555  }
1556  }
1557  /* *INDENT-ON* */
1558 
1559  return entries;
1560 }
1561 
1562 int
1564  vlib_counter_t * c)
1565 {
1567  lisp_gpe_fwd_entry_t *lfe;
1568  lisp_gpe_fwd_entry_key_t unused;
1569 
1570  lfe = find_fwd_entry (lgm, a, &unused);
1571  if (NULL == lfe)
1572  return -1;
1573 
1575  return -1;
1576 
1577  if (~0 == lfe->dpoi_index)
1578  return -1;
1579 
1581  lfe->dpoi_index, c);
1582  return 0;
1583 }
1584 
1586 
1587 /*
1588  * fd.io coding-style-patch-verification: ON
1589  *
1590  * Local Variables:
1591  * eval: (c-set-style "gnu")
1592  * End:
1593  */
load_balance.h
vnet_lisp_gpe_fwd_entries_get_by_vni
lisp_api_gpe_fwd_entry_t * vnet_lisp_gpe_fwd_entries_get_by_vni(u32 vni)
Definition: lisp_gpe_fwd_entry.c:1535
tmp
u32 * tmp
Definition: interface_output.c:1078
lisp_gpe_adjacency_t_::remote_rloc
ip_address_t remote_rloc
remote RLOC.
Definition: lisp_gpe_adjacency.h:53
adj_midchain.h
fib_entry.h
LISP_FORWARD_NATIVE
@ LISP_FORWARD_NATIVE
Definition: lisp_cp_messages.h:419
lisp_stats_key_t
Definition: lisp_gpe.h:94
lisp_nsh_fib_add_del_entry
static u32 lisp_nsh_fib_add_del_entry(u32 spi_si_host_order, u32 lfei, u8 is_add)
Add/del NSH FIB entry.
Definition: lisp_gpe_fwd_entry.c:948
load_balance_t_::lb_n_buckets
u16 lb_n_buckets
number of buckets in the load-balance.
Definition: load_balance.h:116
dpo_id_t_::dpoi_index
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:190
lisp_gpe_fwd_entry_t_::is_src_dst
u8 is_src_dst
Follows src/dst or dst only forwarding policy.
Definition: lisp_gpe_fwd_entry.h:80
DPO_INVALID
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:204
fib_table_entry_special_dpo_add
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 'special' entry to the FIB that links to the DPO passed A special entry is an entry that the FI...
Definition: fib_table.c:324
lisp_gpe_fwd_entry_t_::node
fib_node_t node
This object joins the FIB control plane graph to receive updates to for changes to the graph.
Definition: lisp_gpe_fwd_entry.h:86
LISP_SEND_MAP_REQUEST
@ LISP_SEND_MAP_REQUEST
Definition: lisp_cp_messages.h:420
fib_node_back_walk_rc_t
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
lisp_gpe_fwd_entry_key_t_
LISP-GPE fwd entry key.
Definition: lisp_gpe_fwd_entry.h:63
lisp_gpe_fwd_entry_t_::l2
struct lisp_gpe_fwd_entry_t_::@706::@712 l2
Fields relevant to an L2 entry.
lisp_fwd_path_t_::lisp_adj
index_t lisp_adj
The adjacency constructed for the locator pair.
Definition: lisp_gpe_fwd_entry.h:33
fib_table_entry_delete
void fib_table_entry_delete(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Delete a FIB entry.
Definition: fib_table.c:895
src_prefix
vl_api_prefix_t src_prefix
Definition: acl_types.api:45
ip_prefix
Definition: ip_types.h:116
fib_entry_t_
An entry in a FIB table.
Definition: fib_entry.h:305
src_mac
vl_api_mac_address_t src_mac
Definition: acl_types.api:94
lisp_gpe_fwd_entry_init
clib_error_t * lisp_gpe_fwd_entry_init(vlib_main_t *vm)
Definition: lisp_gpe_fwd_entry.c:1501
fib_route_path_t_::frp_weight
u8 frp_weight
[un]equal cost path weight
Definition: fib_types.h:599
dpo_proto_t
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
DROP
DROP
Definition: error.def:41
lisp_l2_fib_lookup
index_t lisp_l2_fib_lookup(lisp_gpe_main_t *lgm, u16 bd_index, u8 src_mac[6], u8 dst_mac[6])
Lookup L2 SD FIB entry.
Definition: lisp_gpe_fwd_entry.c:644
create_fib_entries
static index_t create_fib_entries(lisp_gpe_fwd_entry_t *lfe)
Definition: lisp_gpe_fwd_entry.c:321
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:553
lisp_gpe_fwd_entry_key_t_::lcl
dp_address_t lcl
Definition: lisp_gpe_fwd_entry.h:66
bd_main_t
Definition: l2_bd.h:33
clib_mem_free
static void clib_mem_free(void *p)
Definition: mem.h:311
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
path
vl_api_fib_path_t path
Definition: mfib_types.api:44
fib_node_vft_t_
A FIB graph nodes virtual function table.
Definition: fib_node.h:288
vni
u32 vni
Definition: flow_types.api:160
SEND_MAP_REQUEST
@ SEND_MAP_REQUEST
Definition: lisp_gpe.h:223
vlib_cli_command_t::path
char * path
Definition: cli.h:96
paths
paths
Definition: map.api:460
load_balance_create
index_t load_balance_create(u32 n_buckets, dpo_proto_t lb_proto, flow_hash_config_t fhc)
Definition: load_balance.c:266
FIB_NODE_INDEX_INVALID
#define FIB_NODE_INDEX_INVALID
Definition: fib_types.h:30
fib_table.h
gid_address_ippref
#define gid_address_ippref(_a)
Definition: lisp_types.h:204
fib_table_get_num_entries
u32 fib_table_get_num_entries(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Return the number of entries in the FIB added by a given source.
Definition: fib_table.c:1367
L2_FIB_DEFAULT_HASH_MEMORY_SIZE
#define L2_FIB_DEFAULT_HASH_MEMORY_SIZE
Definition: lisp_gpe_fwd_entry.c:706
fib_route_path_t_::frp_addr
ip46_address_t frp_addr
The next-hop address.
Definition: fib_types.h:516
lisp_gpe_fwd_entry_format_flag_t
enum lisp_gpe_fwd_entry_format_flag_t_ lisp_gpe_fwd_entry_format_flag_t
hash_get_pair
#define hash_get_pair(h, key)
Definition: hash.h:252
u16
unsigned short u16
Definition: types.h:57
entries
u32 entries
Definition: flowhash_template.h:362
FIB_FORW_CHAIN_TYPE_ETHERNET
@ FIB_FORW_CHAIN_TYPE_ETHERNET
Contribute an object that is to be used to forward Ethernet packets.
Definition: fib_types.h:140
vlib_call_init_function
#define vlib_call_init_function(vm, x)
Definition: init.h:259
vlib_validate_combined_counter
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
Definition: counter.c:119
pool_put
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
LISP_NO_ACTION
@ LISP_NO_ACTION
Definition: lisp_cp_messages.h:418
AF_IP4
@ AF_IP4
Definition: ip_types.h:23
fib_route_path_t_::frp_sw_if_index
u32 frp_sw_if_index
The interface.
Definition: fib_types.h:545
lisp_cp_dpo_get
const dpo_id_t * lisp_cp_dpo_get(dpo_proto_t proto)
Definition: lisp_cp_dpo.c:26
GID_ADDR_IP_PREFIX
@ GID_ADDR_IP_PREFIX
Definition: lisp_types.h:39
NSH_FIB_DEFAULT_HASH_MEMORY_SIZE
#define NSH_FIB_DEFAULT_HASH_MEMORY_SIZE
Definition: lisp_gpe_fwd_entry.c:972
hi
vl_api_ip4_address_t hi
Definition: arp.api:37
FIB_PATH_LIST_FLAG_NONE
@ FIB_PATH_LIST_FLAG_NONE
Definition: fib_path_list.h:80
FIB_ENTRY_FLAG_EXCLUSIVE
@ FIB_ENTRY_FLAG_EXCLUSIVE
Definition: fib_entry.h:116
unformat_input_t
struct _unformat_input_t unformat_input_t
lisp_gpe_main::lisp_fwd_entry_pool
struct lisp_gpe_fwd_entry_t_ * lisp_fwd_entry_pool
A Pool of all LISP forwarding entries.
Definition: lisp_gpe.h:130
fib_route_path_t_::frp_proto
dpo_proto_t frp_proto
The protocol of the address below.
Definition: fib_types.h:505
add_nsh_fwd_entry
static int add_nsh_fwd_entry(lisp_gpe_main_t *lgm, vnet_lisp_gpe_add_del_fwd_entry_args_t *a)
Add LISP NSH forwarding entry.
Definition: lisp_gpe_fwd_entry.c:1113
lisp_gpe_fwd_entry_t_::dpoi_index
index_t dpoi_index
used for getting load balance statistics
Definition: lisp_gpe_fwd_entry.h:205
drop_dpo.h
LOOKUP_INPUT_SRC_ADDR
@ LOOKUP_INPUT_SRC_ADDR
Definition: lookup_dpo.h:27
FORWARD_NATIVE
@ FORWARD_NATIVE
Definition: lisp_gpe.h:222
error
Definition: cJSON.c:88
lisp_gpe_fwd_entry_key_t_::rmt
dp_address_t rmt
Definition: lisp_gpe_fwd_entry.h:65
lisp_gpe_main::nsh_ifaces
tunnel_lookup_t nsh_ifaces
Definition: lisp_gpe.h:157
ip_src_fib_add_route_w_dpo
static fib_node_index_t ip_src_fib_add_route_w_dpo(u32 src_fib_index, const ip_prefix_t *src_prefix, const dpo_id_t *src_dpo)
Add route to IP4 or IP6 SRC FIB.
Definition: lisp_gpe_fwd_entry.c:200
key
typedef key
Definition: ipsec_types.api:88
lisp_gpe_main::placeholder_stats_pool
u8 * placeholder_stats_pool
Definition: lisp_gpe.h:163
del_l2_fwd_entry
static int del_l2_fwd_entry(lisp_gpe_main_t *lgm, vnet_lisp_gpe_add_del_fwd_entry_args_t *a)
Delete LISP L2 forwarding entry.
Definition: lisp_gpe_fwd_entry.c:761
del_l2_fwd_entry_i
static void del_l2_fwd_entry_i(lisp_gpe_main_t *lgm, lisp_gpe_fwd_entry_t *lfe)
Definition: lisp_gpe_fwd_entry.c:727
clib_bihash_search_inline_2
int clib_bihash_search_inline_2(clib_bihash *h, clib_bihash_kv *search_key, clib_bihash_kv *valuep)
Search a bi-hash table.
FIB_FORW_CHAIN_TYPE_NSH
@ FIB_FORW_CHAIN_TYPE_NSH
Contribute an object that is to be used to forward NSH packets.
Definition: fib_types.h:146
lisp_gpe_tenant_find_or_create
u32 lisp_gpe_tenant_find_or_create(u32 vni)
Find or create a tenant for the given VNI.
Definition: lisp_gpe_tenant.c:67
max_log2
static uword max_log2(uword x)
Definition: clib.h:223
unformat
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
pool_is_free_index
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:302
hash_set
#define hash_set(h, key, value)
Definition: hash.h:255
vnet_lisp_gpe_get_main
static lisp_gpe_main_t * vnet_lisp_gpe_get_main()
Definition: lisp_gpe.h:184
nsh_fib_init
static void nsh_fib_init(lisp_gpe_main_t *lgm)
Definition: lisp_gpe_fwd_entry.c:975
format_lisp_gpe_fwd_entry
static u8 * format_lisp_gpe_fwd_entry(u8 *s, va_list *ap)
Definition: lisp_gpe_fwd_entry.c:1400
format_negative_mapping_action
u8 * format_negative_mapping_action(u8 *s, va_list *args)
Definition: lisp_types.c:360
STRUCT_OFFSET_OF
#define STRUCT_OFFSET_OF(t, f)
Definition: clib.h:73
LISP_GPE_FWD_ENTRY_FORMAT_DETAIL
@ LISP_GPE_FWD_ENTRY_FORMAT_DETAIL
Definition: lisp_gpe_fwd_entry.c:1395
ti
u32 ti
Definition: interface_output.c:405
fib_table_entry_special_remove
void fib_table_entry_special_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Remove a 'special' entry from the FIB.
Definition: fib_table.c:424
lisp_gpe_main::l2_lb_cp_lkup
dpo_id_t l2_lb_cp_lkup
Load-balance for a miss in the table.
Definition: lisp_gpe.h:150
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
lisp_l2_fib_add_del_entry
static u32 lisp_l2_fib_add_del_entry(u16 bd_index, u8 src_mac[6], u8 dst_mac[6], const dpo_id_t *dpo, u8 is_add)
Add/del L2 SD FIB entry.
Definition: lisp_gpe_fwd_entry.c:683
load_balance_main
load_balance_main_t load_balance_main
The one instance of load-balance main.
Definition: load_balance.c:59
ip_dst_fib_add_route
static u32 ip_dst_fib_add_route(u32 dst_fib_index, const ip_prefix_t *dst_prefix)
Add route to IP4 or IP6 Destination FIB.
Definition: lisp_gpe_fwd_entry.c:40
format_fid_address
u8 * format_fid_address(u8 *s, va_list *args)
Definition: lisp_types.c:166
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
L2_FIB_DEFAULT_HASH_NUM_BUCKETS
#define L2_FIB_DEFAULT_HASH_NUM_BUCKETS
Definition: lisp_gpe_fwd_entry.c:705
LISP_DROP
@ LISP_DROP
Definition: lisp_cp_messages.h:421
clib_bihash_init
void clib_bihash_init(clib_bihash *h, char *name, u32 nbuckets, uword memory_size)
initialize a bounded index extensible hash table
vec_add1
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:606
vnet_get_hw_interface
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface_funcs.h:44
add_ip_fwd_entry
static int add_ip_fwd_entry(lisp_gpe_main_t *lgm, vnet_lisp_gpe_add_del_fwd_entry_args_t *a)
Add/Delete LISP IP forwarding entry.
Definition: lisp_gpe_fwd_entry.c:520
LISP_GPE_ADJ_FORMAT_FLAG_NONE
@ LISP_GPE_ADJ_FORMAT_FLAG_NONE
Definition: lisp_gpe_adjacency.h:122
lisp_fwd_path_t_::weight
u8 weight
[UE]CMP weigt for the path
Definition: lisp_gpe_fwd_entry.h:43
format_lisp_fwd_path
static u8 * format_lisp_fwd_path(u8 *s, va_list *ap)
Definition: lisp_gpe_fwd_entry.c:1379
priority
i32 priority
Definition: ipsec.api:95
vlib_counter_t
Combined counter to hold both packets and byte differences.
Definition: counter_types.h:26
fib_table_find_or_create_and_lock
u32 fib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id, fib_source_t src)
Get the index of the FIB for a Table-ID.
Definition: fib_table.c:1165
gpe_native_fwd_add_del_lfe
static void gpe_native_fwd_add_del_lfe(lisp_gpe_fwd_entry_t *lfe, u8 is_add)
Definition: lisp_gpe_fwd_entry.c:290
fid_addr_type
#define fid_addr_type(_a)
Definition: lisp_types.h:87
FID_ADDR_IP_PREF
@ FID_ADDR_IP_PREF
Definition: lisp_types.h:63
lisp_gpe_fwd_entry_key_t_::vni
u32 vni
Definition: lisp_gpe_fwd_entry.h:67
FIB_ENTRY_FLAG_NONE
@ FIB_ENTRY_FLAG_NONE
Definition: fib_entry.h:112
vnet_lisp_flush_stats
int vnet_lisp_flush_stats(void)
Definition: lisp_gpe_fwd_entry.c:1286
c
svmdb_client_t * c
Definition: vpp_get_metrics.c:48
index_t
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:43
lisp_gpe_fwd_entry_show_command
static vlib_cli_command_t lisp_gpe_fwd_entry_show_command
(constructor) VLIB_CLI_COMMAND (lisp_gpe_fwd_entry_show_command)
Definition: lisp_gpe_fwd_entry.c:1493
lisp_gpe_fwd_entry_path_sort
static int lisp_gpe_fwd_entry_path_sort(void *a1, void *a2)
Definition: lisp_gpe_fwd_entry.c:436
NO_ACTION
@ NO_ACTION
Definition: lisp_gpe.h:221
LOOKUP_UNICAST
@ LOOKUP_UNICAST
Definition: lookup_dpo.h:53
FID_ADDR_MAC
@ FID_ADDR_MAC
Definition: lisp_types.h:64
fib_node_index_t
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
vec_foreach_index
#define vec_foreach_index(var, v)
Iterate over vector indices.
Definition: vec_bootstrap.h:220
del_ip_fwd_entry
static int del_ip_fwd_entry(lisp_gpe_main_t *lgm, vnet_lisp_gpe_add_del_fwd_entry_args_t *a)
Add/Delete LISP IP forwarding entry.
Definition: lisp_gpe_fwd_entry.c:604
uword
u64 uword
Definition: types.h:112
vlib_zero_combined_counter
static void vlib_zero_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
Clear a combined counter Clears the set of per-thread counters.
Definition: counter.h:298
hash_get
#define hash_get(h, key)
Definition: hash.h:249
vnet_lisp_gpe_get_fwd_stats
int vnet_lisp_gpe_get_fwd_stats(vnet_lisp_gpe_add_del_fwd_entry_args_t *a, vlib_counter_t *c)
Definition: lisp_gpe_fwd_entry.c:1563
lisp_gpe_tenant.h
lisp_gpe_fib_node_back_walk
static fib_node_back_walk_rc_t lisp_gpe_fib_node_back_walk(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Function invoked during a backwalk of the FIB graph.
Definition: lisp_gpe_fwd_entry.c:1191
hash_set_mem
#define hash_set_mem(h, key, value)
Definition: hash.h:275
lisp_gpe_adjacency_unlock
void lisp_gpe_adjacency_unlock(index_t lai)
Definition: lisp_gpe_adjacency.c:450
BVT
BVT(clib_bihash)
The table of adjacencies indexed by the rewrite string.
Definition: l2_fib.c:1069
vnet_lisp_gpe_get_fwd_entry_vnis
u32 * vnet_lisp_gpe_get_fwd_entry_vnis(void)
Definition: lisp_gpe_fwd_entry.c:1518
dst_prefix
vl_api_prefix_t dst_prefix
Definition: acl_types.api:46
lisp_gpe_main
lisp_gpe_main_t lisp_gpe_main
LISP-GPE global state.
Definition: lisp_gpe.c:30
fid_addr_nsh
#define fid_addr_nsh(_a)
Definition: lisp_types.h:86
load_balance_get_bucket_i
static const dpo_id_t * load_balance_get_bucket_i(const load_balance_t *lb, u32 bucket)
Definition: load_balance.h:229
i
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
lisp_gpe_main::native_fwd_rpath
fib_route_path_t * native_fwd_rpath[2]
Native fwd data structures.
Definition: lisp_gpe.h:168
NSH_FIB_DEFAULT_HASH_NUM_BUCKETS
#define NSH_FIB_DEFAULT_HASH_NUM_BUCKETS
Definition: lisp_gpe_fwd_entry.c:971
cm
vnet_feature_config_main_t * cm
Definition: nat44_ei_hairpinning.c:591
pool_get
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:255
fib_entry_get_source_data
const void * fib_entry_get_source_data(fib_node_index_t fib_entry_index, fib_source_t source)
Definition: fib_entry_src.c:1932
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
vnet_lisp_gpe_add_del_fwd_entry_args_t
Definition: lisp_gpe.h:228
VLIB_CLI_COMMAND
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:163
dpo_stack_from_node
void dpo_stack_from_node(u32 child_node_index, 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:550
fib_protocol_t
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
ip_address_to_46
fib_protocol_t ip_address_to_46(const ip_address_t *addr, ip46_address_t *a)
Definition: ip_types.c:252
lisp_gpe_adjacency_t_::sw_if_index
u32 sw_if_index
The SW IF index of the sub-interface this adjacency uses.
Definition: lisp_gpe_adjacency.h:74
fib_path_list_child_add
u32 fib_path_list_child_add(fib_node_index_t path_list_index, fib_node_type_t child_type, fib_node_index_t child_index)
Definition: fib_path_list.c:1296
LOOKUP_TABLE_FROM_CONFIG
@ LOOKUP_TABLE_FROM_CONFIG
Definition: lookup_dpo.h:41
lisp_gpe_fwd_entry_t_::key
lisp_gpe_fwd_entry_key_t * key
The Entry's key: {lEID,rEID,vni}.
Definition: lisp_gpe_fwd_entry.h:91
lisp_gpe_main::lisp_stats_index_by_key
uword * lisp_stats_index_by_key
Definition: lisp_gpe.h:164
fib_path_list_contribute_forwarding
void fib_path_list_contribute_forwarding(fib_node_index_t path_list_index, fib_forward_chain_type_t fct, fib_path_list_fwd_flags_t flags, dpo_id_t *dpo)
Definition: fib_path_list.c:1211
FIB_PROTOCOL_IP4
@ FIB_PROTOCOL_IP4
Definition: fib_types.h:36
lisp_gpe_fwd_entry_mk_paths
static void lisp_gpe_fwd_entry_mk_paths(lisp_gpe_fwd_entry_t *lfe, vnet_lisp_gpe_add_del_fwd_entry_args_t *a)
Definition: lisp_gpe_fwd_entry.c:444
fib_node_register_type
void fib_node_register_type(fib_node_type_t type, const fib_node_vft_t *vft)
fib_node_register_type
Definition: fib_node.c:60
FIB_NODE_BACK_WALK_CONTINUE
@ FIB_NODE_BACK_WALK_CONTINUE
Definition: fib_node.h:259
vlib_cli_output
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:716
fib_proto_to_dpo
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
Definition: fib_types.c:343
del_ip_fwd_entry_i
static void del_ip_fwd_entry_i(lisp_gpe_main_t *lgm, lisp_gpe_fwd_entry_t *lfe)
Definition: lisp_gpe_fwd_entry.c:569
format_dpo_id
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject.
Definition: dpo.c:150
lisp_gpe_main::native_fwd_lfes
u32 * native_fwd_lfes[2]
Definition: lisp_gpe.h:169
vnet_lisp_gpe_enable_disable_status
u8 vnet_lisp_gpe_enable_disable_status(void)
Check if LISP-GPE is enabled.
Definition: lisp_gpe.c:184
lisp_gpe_mk_fib_paths
static fib_route_path_t * lisp_gpe_mk_fib_paths(const lisp_fwd_path_t *paths)
Definition: lisp_gpe_fwd_entry.c:229
vnet_lisp_gpe_add_del_fwd_entry
int vnet_lisp_gpe_add_del_fwd_entry(vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 *hw_if_indexp)
Forwarding entry create/remove dispatcher.
Definition: lisp_gpe_fwd_entry.c:1248
vlib_combined_counter_n_counters
u32 vlib_combined_counter_n_counters(const vlib_combined_counter_main_t *cm)
The number of counters (not the number of per-thread counters)
Definition: counter.c:191
load_balance_set_bucket
void load_balance_set_bucket(index_t lbi, u32 bucket, const dpo_id_t *next)
Definition: load_balance.c:283
fib_table_lookup_exact_match
fib_node_index_t fib_table_lookup_exact_match(u32 fib_index, const fib_prefix_t *prefix)
Perfom an exact match in the non-forwarding table.
Definition: fib_table.c:97
DPO_LOAD_BALANCE
@ DPO_LOAD_BALANCE
load-balancing over a choice of [un]equal cost paths
Definition: dpo.h:104
vlib_get_combined_counter
static void vlib_get_combined_counter(const vlib_combined_counter_main_t *cm, u32 index, vlib_counter_t *result)
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thr...
Definition: counter.h:272
LISP_GPE_FWD_ENTRY_TYPE_NORMAL
@ LISP_GPE_FWD_ENTRY_TYPE_NORMAL
Definition: lisp_gpe_fwd_entry.h:55
vnet_hw_interface_t
Definition: interface.h:638
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
GID_ADDR_NSH
@ GID_ADDR_NSH
Definition: lisp_types.h:43
index
u32 index
Definition: flow_types.api:221
lisp_del_adj_stats
static void lisp_del_adj_stats(lisp_gpe_main_t *lgm, u32 fwd_entry_index, u32 ti)
Definition: lisp_gpe_fwd_entry.c:1302
lisp_gpe_adjacency_get
const lisp_gpe_adjacency_t * lisp_gpe_adjacency_get(index_t lai)
Definition: lisp_gpe_adjacency.c:465
load_balance_main_t_::lbm_to_counters
vlib_combined_counter_main_t lbm_to_counters
Definition: load_balance.h:46
dpo_copy
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
Definition: dpo.c:264
lisp_gpe_fwd_entry_t_::paths
lisp_fwd_path_t * paths
When the type is 'normal' The RLOC pair that form the route's paths.
Definition: lisp_gpe_fwd_entry.h:194
find_fwd_entry
static lisp_gpe_fwd_entry_t * find_fwd_entry(lisp_gpe_main_t *lgm, vnet_lisp_gpe_add_del_fwd_entry_args_t *a, lisp_gpe_fwd_entry_key_t *key)
Definition: lisp_gpe_fwd_entry.c:404
fib_path_list.h
lisp_fwd_path_t_::priority
u8 priority
Priority.
Definition: lisp_gpe_fwd_entry.h:38
lisp_gpe_fwd_entry_show
static clib_error_t * lisp_gpe_fwd_entry_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: lisp_gpe_fwd_entry.c:1450
del_nsh_fwd_entry_i
static void del_nsh_fwd_entry_i(lisp_gpe_main_t *lgm, lisp_gpe_fwd_entry_t *lfe)
Definition: lisp_gpe_fwd_entry.c:988
hash_get_mem
#define hash_get_mem(h, key)
Definition: hash.h:269
fib_entry_get
fib_entry_t * fib_entry_get(fib_node_index_t index)
Definition: fib_entry.c:51
lisp_gpe_main
LISP-GPE global state.
Definition: lisp_gpe.h:119
lisp_fwd_path_t_
A path on which to forward lisp traffic.
Definition: lisp_gpe_fwd_entry.h:28
u64
unsigned long u64
Definition: types.h:89
fib_entry_is_sourced
int fib_entry_is_sourced(fib_node_index_t fib_entry_index, fib_source_t source)
Definition: fib_entry_src.c:139
format
description fragment has unexpected format
Definition: map.api:433
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
vlib_combined_counter_main_t
A collection of combined counters.
Definition: counter.h:203
DPO_PROTO_IP6
@ DPO_PROTO_IP6
Definition: dpo.h:65
fib_entry_t_::fe_lb
dpo_id_t fe_lb
The load-balance used for forwarding.
Definition: fib_entry.h:331
lisp_gpe_fwd_entry_t_::tenant
u32 tenant
The tenant the entry belongs to.
Definition: lisp_gpe_fwd_entry.h:101
fib_table_create_and_lock
u32 fib_table_create_and_lock(fib_protocol_t proto, fib_source_t src, const char *const fmt,...)
Create a new table with no table ID.
Definition: fib_table.c:1184
u32
unsigned int u32
Definition: types.h:88
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
lisp_gpe_l2_update_fwding
static void lisp_gpe_l2_update_fwding(lisp_gpe_fwd_entry_t *lfe)
Construct and insert the forwarding information used by an L2 entry.
Definition: lisp_gpe_fwd_entry.c:781
lisp_gpe_fwd_entry_t_::action
negative_fwd_actions_e action
When the type is negative.
Definition: lisp_gpe_fwd_entry.h:199
lisp_gpe_fwd_entry_format_flag_t_
lisp_gpe_fwd_entry_format_flag_t_
Definition: lisp_gpe_fwd_entry.c:1392
lookup_dpo.h
FIB_PROTOCOL_IP6
@ FIB_PROTOCOL_IP6
Definition: fib_types.h:37
fib_route_path_t_
A representation of a path as described by a route producer.
Definition: fib_types.h:500
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
format_fib_prefix
u8 * format_fib_prefix(u8 *s, va_list *args)
Definition: fib_types.c:283
fid_address_t::ippref
ip_prefix_t ippref
Definition: lisp_types.h:73
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
load_balance_get
static load_balance_t * load_balance_get(index_t lbi)
Definition: load_balance.h:220
hash_pair_t::key
uword key
Definition: hash.h:162
lisp_gpe_adjacency_t_
A LISP GPE Adjacency.
Definition: lisp_gpe_adjacency.h:43
fid_addr_ippref
#define fid_addr_ippref(_a)
Definition: lisp_types.h:82
lisp_gpe_fwd_entry_t_
A LISP Forwarding Entry.
Definition: lisp_gpe_fwd_entry.h:75
clib_bihash_add_del
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.
AF_IP6
@ AF_IP6
Definition: ip_types.h:24
lisp_gpe_adjacency_find_or_create_and_lock
index_t lisp_gpe_adjacency_find_or_create_and_lock(const locator_pair_t *pair, u32 overlay_table_id, u32 vni)
Definition: lisp_gpe_adjacency.c:342
value
u8 value
Definition: qos.api:54
LISP_GPE_FWD_ENTRY_FORMAT_NONE
@ LISP_GPE_FWD_ENTRY_FORMAT_NONE
Definition: lisp_gpe_fwd_entry.c:1394
ip_src_dst_fib_del_route
static void ip_src_dst_fib_del_route(u32 src_fib_index, const ip_prefix_t *src_prefix, u32 dst_fib_index, const ip_prefix_t *dst_prefix)
Del route to IP4 or IP6 SD FIB.
Definition: lisp_gpe_fwd_entry.c:139
vnet_lisp_gpe_del_fwd_counters
void vnet_lisp_gpe_del_fwd_counters(vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 fwd_entry_index)
Definition: lisp_gpe_fwd_entry.c:1327
fib_prefix_t_::fp_proto
fib_protocol_t fp_proto
protocol type
Definition: fib_types.h:211
lisp_gpe_fwd_entry_get_fib_node
static fib_node_t * lisp_gpe_fwd_entry_get_fib_node(fib_node_index_t index)
Get a fib_node_t struct from the index of a LISP fwd entry.
Definition: lisp_gpe_fwd_entry.c:1208
fib_path_list_child_remove
void fib_path_list_child_remove(fib_node_index_t path_list_index, u32 si)
Definition: fib_path_list.c:1335
dpo_unlock
void dpo_unlock(dpo_id_t *dpo)
Release a reference counting lock on the DPO.
Definition: dpo.c:380
mac_to_u64
static u64 mac_to_u64(u8 *m)
Definition: load_balance.c:1083
fib_node_t_
An node in the FIB graph.
Definition: fib_node.h:301
vec_sort_with_function
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
Definition: vec.h:1097
lisp_gpe_fwd_entry_t_::nsh
struct lisp_gpe_fwd_entry_t_::@706::@713 nsh
Fields relevant to an NSH entry.
lisp_gpe_fwd_entry_from_fib_node
static lisp_gpe_fwd_entry_t * lisp_gpe_fwd_entry_from_fib_node(fib_node_t *node)
conver from the embedded fib_node_t struct to the LSIP entry
Definition: lisp_gpe_fwd_entry.c:1180
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
drop_dpo_get
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
Definition: drop_dpo.c:25
bd_main
bd_main_t bd_main
Definition: l2_bd.c:44
FID_ADDR_NSH
@ FID_ADDR_NSH
Definition: lisp_types.h:65
lisp_gpe_adjacency.h
Common utility functions for IPv4, IPv6 and L2 LISP-GPE adjacencys.
lisp_cp_dpo_module_init
clib_error_t * lisp_cp_dpo_module_init(vlib_main_t *vm)
Definition: lisp_cp_dpo.c:96
lisp_gpe_fwd_entry_t_::src_fib_index
u32 src_fib_index
The SRC-FIB index for created for anding source-route entries.
Definition: lisp_gpe_fwd_entry.h:126
lisp_gpe_fwd_entry_t_::eid_table_id
u32 eid_table_id
The VRF ID.
Definition: lisp_gpe_fwd_entry.h:116
gid_address_type
#define gid_address_type(_a)
Definition: lisp_types.h:203
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
lisp_gpe_nsh_update_fwding
static void lisp_gpe_nsh_update_fwding(lisp_gpe_fwd_entry_t *lfe)
Construct and insert the forwarding information used by an NSH entry.
Definition: lisp_gpe_fwd_entry.c:1041
a
a
Definition: bitmap.h:544
LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE
@ LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE
Definition: lisp_gpe_fwd_entry.h:56
hash_unset_mem
#define hash_unset_mem(h, key)
Definition: hash.h:291
lisp_nsh_fib_lookup
const dpo_id_t * lisp_nsh_fib_lookup(lisp_gpe_main_t *lgm, u32 spi_si_net_order)
Lookup NSH SD FIB entry.
Definition: lisp_gpe_fwd_entry.c:914
make_mac_fib_key
static void make_mac_fib_key(BVT(clib_bihash_kv) *kv, u16 bd_index, u8 src_mac[6], u8 dst_mac[6])
Definition: lisp_gpe_fwd_entry.c:622
lisp_cp_dpo.h
ip_prefix_version
#define ip_prefix_version(_a)
Definition: ip_types.h:124
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
lisp_fwd_vft
const static fib_node_vft_t lisp_fwd_vft
Virtual function table to register with FIB for the LISP type.
Definition: lisp_gpe_fwd_entry.c:1231
fib_table_unlock
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
Definition: fib_table.c:1336
FIB_PATH_LIST_FWD_FLAG_NONE
@ FIB_PATH_LIST_FWD_FLAG_NONE
Definition: fib_path_list.h:142
add_l2_fwd_entry
static int add_l2_fwd_entry(lisp_gpe_main_t *lgm, vnet_lisp_gpe_add_del_fwd_entry_args_t *a)
Add LISP L2 forwarding entry.
Definition: lisp_gpe_fwd_entry.c:829
DPO_PROTO_IP4
@ DPO_PROTO_IP4
Definition: dpo.h:64
lisp_gpe_main::nsh_cp_lkup
const dpo_id_t * nsh_cp_lkup
Definition: lisp_gpe.h:159
fib_node_back_walk_ctx_t_
Context passed between object during a back walk.
Definition: fib_node.h:214
lisp_api_gpe_fwd_entry_t
Definition: lisp_gpe.h:284
fib_node_vft_t_::fnv_get
fib_node_get_t fnv_get
Definition: fib_node.h:289
clib_warning
#define clib_warning(format, args...)
Definition: error.h:59
l2_fib_init
static void l2_fib_init(lisp_gpe_main_t *lgm)
Definition: lisp_gpe_fwd_entry.c:709
lisp_gpe_adjacency_t_::tunnel_index
u32 tunnel_index
The index of the LISP GPE tunnel that provides the transport in the underlay.
Definition: lisp_gpe_adjacency.h:80
FIB_NODE_TYPE_LISP_GPE_FWD_ENTRY
@ FIB_NODE_TYPE_LISP_GPE_FWD_ENTRY
Definition: fib_node.h:40
dpo_id_t_
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:172
lisp_gpe_fwd_entry_t_::eid_fib_index
u32 eid_fib_index
The FIB index for the overlay, i.e.
Definition: lisp_gpe_fwd_entry.h:122
format_lisp_gpe_adjacency
u8 * format_lisp_gpe_adjacency(u8 *s, va_list *args)
Definition: lisp_gpe_adjacency.c:508
lisp_gpe_fwd_entry.h
LISP-GPE definitions.
rv
int __clib_unused rv
Definition: application.c:491
load_balance_t_::lb_n_buckets_minus_1
u16 lb_n_buckets_minus_1
number of buckets in the load-balance - 1.
Definition: load_balance.h:121
DPO_PROTO_NSH
@ DPO_PROTO_NSH
Definition: dpo.h:69
FIB_SOURCE_LISP
@ FIB_SOURCE_LISP
LISP.
Definition: fib_source.h:83
lisp_gpe_main::counters
vlib_combined_counter_main_t counters
Definition: lisp_gpe.h:165
load_balance_t_
The FIB DPO provieds;.
Definition: load_balance.h:106
DPO_PROTO_ETHERNET
@ DPO_PROTO_ETHERNET
Definition: dpo.h:67
dpo_set
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:188
GID_ADDR_MAC
@ GID_ADDR_MAC
Definition: lisp_types.h:41
fid_addr_mac
#define fid_addr_mac(_a)
Definition: lisp_types.h:85
ip_src_fib_add_route
static fib_node_index_t ip_src_fib_add_route(u32 src_fib_index, const ip_prefix_t *src_prefix, const lisp_fwd_path_t *paths)
Add route to IP4 or IP6 SRC FIB.
Definition: lisp_gpe_fwd_entry.c:271
lisp_gpe_main::lisp_gpe_fwd_entries
uword * lisp_gpe_fwd_entries
DB of all forwarding entries.
Definition: lisp_gpe.h:125
vlib_cli_command_t
Definition: cli.h:92
gid_to_dp_address
void gid_to_dp_address(gid_address_t *g, dp_address_t *d)
Definition: lisp_types.c:489
fib_path_list_create
fib_node_index_t fib_path_list_create(fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
Definition: fib_path_list.c:682
lookup_dpo_add_or_lock_w_fib_index
void lookup_dpo_add_or_lock_w_fib_index(fib_node_index_t fib_index, dpo_proto_t proto, lookup_cast_t cast, lookup_input_t input, lookup_table_t table_config, dpo_id_t *dpo)
Definition: lookup_dpo.c:137
lisp_gpe_fwd_entry_t_::type
lisp_gpe_fwd_entry_type_t type
The forwarding entry type.
Definition: lisp_gpe_fwd_entry.h:96
delete_fib_entries
static void delete_fib_entries(lisp_gpe_fwd_entry_t *lfe)
Definition: lisp_gpe_fwd_entry.c:386
dpo_reset
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:234
bd_main_t::bd_index_by_bd_id
uword * bd_index_by_bd_id
Definition: l2_bd.h:36
lisp_gpe_main::vnet_main
vnet_main_t * vnet_main
Definition: lisp_gpe.h:173
clib_mem_alloc
static void * clib_mem_alloc(uword size)
Definition: mem.h:253
tunnel_lookup::hw_if_index_by_dp_table
uword * hw_if_index_by_dp_table
Lookup lisp-gpe interfaces by dp table (eg.
Definition: lisp_gpe.h:85
fib_prefix_t_
Aggregate type for a prefix.
Definition: fib_types.h:202
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
vnet_lisp_gpe_fwd_entry_flush
void vnet_lisp_gpe_fwd_entry_flush(void)
Flush all the forwrding entries.
Definition: lisp_gpe_fwd_entry.c:1354
vec_del1
#define vec_del1(v, i)
Delete the element at index I.
Definition: vec.h:896
fib_table_entry_update
fib_node_index_t fib_table_entry_update(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, fib_route_path_t *paths)
Update an entry to have a new set of paths.
Definition: fib_table.c:765
fib_entry_set_source_data
void fib_entry_set_source_data(fib_node_index_t fib_entry_index, fib_source_t source, const void *data)
Definition: fib_entry_src.c:1914
hash_pair_t
Definition: hash.h:159
vnet_lisp_gpe_add_fwd_counters
void vnet_lisp_gpe_add_fwd_counters(vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 fwd_entry_index)
Definition: lisp_gpe_fwd_entry.c:468
prefix
vl_api_prefix_t prefix
Definition: ip.api:146
del_nsh_fwd_entry
static int del_nsh_fwd_entry(lisp_gpe_main_t *lgm, vnet_lisp_gpe_add_del_fwd_entry_args_t *a)
Delete LISP NSH forwarding entry.
Definition: lisp_gpe_fwd_entry.c:1021
ip_prefix_to_fib_prefix
void ip_prefix_to_fib_prefix(const ip_prefix_t *ip_prefix, fib_prefix_t *fib_prefix)
convert from a LISP to a FIB prefix
Definition: ip_types.c:410
lisp_gpe_fwd_entry_fib_node_last_lock_gone
static void lisp_gpe_fwd_entry_fib_node_last_lock_gone(fib_node_t *node)
An indication from the graph that the last lock has gone.
Definition: lisp_gpe_fwd_entry.c:1222
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105