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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #include <vnet/lisp-gpe/lisp_gpe_fwd_entry.h>
17 #include <vnet/lisp-gpe/lisp_gpe_adjacency.h>
18 #include <vnet/lisp-gpe/lisp_gpe_tenant.h>
19 #include <vnet/lisp-cp/lisp_cp_dpo.h>
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/fib/ip6_fib.h>
24 #include <vnet/fib/ip4_fib.h>
25 #include <vnet/dpo/drop_dpo.h>
26 #include <vnet/dpo/lookup_dpo.h>
27 #include <vnet/dpo/load_balance.h>
28 #include <vnet/adj/adj_midchain.h>
31 * @brief Add route to IP4 or IP6 Destination FIB.
33 * Add a route to the destination FIB that results in the lookup
34 * in the SRC FIB. The SRC FIB is created is it does not yet exist.
36 * @param[in] dst_table_id Destination FIB Table-ID
37 * @param[in] dst_prefix Destination IP prefix.
39 * @return src_fib_index The index/ID of the SRC FIB created.
42 ip_dst_fib_add_route (u32 dst_fib_index, const ip_prefix_t * dst_prefix)
44 fib_node_index_t src_fib_index;
45 fib_prefix_t dst_fib_prefix;
46 fib_node_index_t dst_fei;
48 ASSERT (NULL != dst_prefix);
50 ip_prefix_to_fib_prefix (dst_prefix, &dst_fib_prefix);
53 * lookup the destination prefix in the VRF table and retrieve the
54 * LISP associated data
56 dst_fei = fib_table_lookup_exact_match (dst_fib_index, &dst_fib_prefix);
59 * If the FIB entry is not present, or not LISP sourced, add it
61 if (dst_fei == FIB_NODE_INDEX_INVALID ||
62 NULL == fib_entry_get_source_data (dst_fei, FIB_SOURCE_LISP))
64 dpo_id_t src_lkup_dpo = DPO_INVALID;
66 /* create a new src FIB. */
68 fib_table_create_and_lock (dst_fib_prefix.fp_proto,
70 "LISP-src for [%d,%U]",
72 format_fib_prefix, &dst_fib_prefix);
74 * add src fib default route
76 fib_prefix_t prefix = {
77 .fp_proto = dst_fib_prefix.fp_proto,
79 fib_table_entry_special_dpo_add (src_fib_index, &prefix,
81 FIB_ENTRY_FLAG_EXCLUSIVE,
82 lisp_cp_dpo_get (fib_proto_to_dpo
83 (dst_fib_prefix.fp_proto)));
85 * create a data-path object to perform the source address lookup
88 lookup_dpo_add_or_lock_w_fib_index (src_fib_index,
89 (ip_prefix_version (dst_prefix) ==
93 LOOKUP_INPUT_SRC_ADDR,
94 LOOKUP_TABLE_FROM_CONFIG,
98 * add the entry to the destination FIB that uses the lookup DPO
100 dst_fei = fib_table_entry_special_dpo_add (dst_fib_index,
103 FIB_ENTRY_FLAG_EXCLUSIVE,
107 * the DPO is locked by the FIB entry, and we have no further
110 dpo_unlock (&src_lkup_dpo);
113 * save the SRC FIB index on the entry so we can retrieve it for
116 fib_entry_set_source_data (dst_fei, FIB_SOURCE_LISP, &src_fib_index);
121 * destination FIB entry already present
123 src_fib_index = *(u32 *) fib_entry_get_source_data (dst_fei,
127 return (src_fib_index);
131 * @brief Del route to IP4 or IP6 SD FIB.
133 * Remove routes from both destination and source FIBs.
135 * @param[in] src_fib_index The index/ID of the SRC FIB
136 * @param[in] src_prefix Source IP prefix.
137 * @param[in] dst_fib_index The index/ID of the DST FIB
138 * @param[in] dst_prefix Destination IP prefix.
141 ip_src_dst_fib_del_route (u32 src_fib_index,
142 const ip_prefix_t * src_prefix,
143 u32 dst_fib_index, const ip_prefix_t * dst_prefix)
145 fib_prefix_t dst_fib_prefix, src_fib_prefix;
149 ASSERT (NULL != dst_prefix);
150 ASSERT (NULL != src_prefix);
152 ip_prefix_to_fib_prefix (dst_prefix, &dst_fib_prefix);
153 ip_prefix_to_fib_prefix (src_prefix, &src_fib_prefix);
155 fib_table_entry_delete (src_fib_index, &src_fib_prefix, FIB_SOURCE_LISP);
157 /* check if only default left or empty */
158 fib_prefix_t default_pref = {
159 .fp_proto = dst_fib_prefix.fp_proto
162 if (fib_table_lookup_exact_match (src_fib_index,
163 &default_pref) != FIB_NODE_INDEX_INVALID)
166 n_entries = fib_table_get_num_entries (src_fib_index,
167 src_fib_prefix.fp_proto,
169 if (n_entries == 0 || (have_default && n_entries == 1))
172 * remove src FIB default route
175 fib_table_entry_special_remove (src_fib_index, &default_pref,
179 * there's nothing left now, unlock the source FIB and the
182 fib_table_entry_special_remove (dst_fib_index,
183 &dst_fib_prefix, FIB_SOURCE_LISP);
184 fib_table_unlock (src_fib_index, src_fib_prefix.fp_proto,
190 * @brief Add route to IP4 or IP6 SRC FIB.
192 * Adds a route to in the LISP SRC FIB with the result of the route
193 * being the DPO passed.
195 * @param[in] src_fib_index The index/ID of the SRC FIB
196 * @param[in] src_prefix Source IP prefix.
197 * @param[in] src_dpo The DPO the route will link to.
199 * @return fib index of the inserted prefix
201 static fib_node_index_t
202 ip_src_fib_add_route_w_dpo (u32 src_fib_index,
203 const ip_prefix_t * src_prefix,
204 const dpo_id_t * src_dpo)
206 fib_node_index_t fei = ~0;
207 fib_prefix_t src_fib_prefix;
209 ip_prefix_to_fib_prefix (src_prefix, &src_fib_prefix);
212 * add the entry into the source fib.
214 fib_node_index_t src_fei;
216 src_fei = fib_table_lookup_exact_match (src_fib_index, &src_fib_prefix);
218 if (FIB_NODE_INDEX_INVALID == src_fei ||
219 !fib_entry_is_sourced (src_fei, FIB_SOURCE_LISP))
221 fei = fib_table_entry_special_dpo_add (src_fib_index,
224 FIB_ENTRY_FLAG_EXCLUSIVE,
230 static fib_route_path_t *
231 lisp_gpe_mk_fib_paths (const lisp_fwd_path_t * paths)
233 const lisp_gpe_adjacency_t *ladj;
234 fib_route_path_t *rpaths = NULL;
239 vec_validate (rpaths, vec_len (paths) - 1);
241 best_priority = paths[0].priority;
243 vec_foreach_index (ii, paths)
245 if (paths[0].priority != best_priority)
248 ladj = lisp_gpe_adjacency_get (paths[ii].lisp_adj);
250 ip_address_to_46 (&ladj->remote_rloc, &rpaths[ii].frp_addr, &fp);
252 rpaths[ii].frp_proto = fib_proto_to_dpo (fp);
253 rpaths[ii].frp_sw_if_index = ladj->sw_if_index;
254 rpaths[ii].frp_weight = (paths[ii].weight ? paths[ii].weight : 1);
257 ASSERT (0 != vec_len (rpaths));
263 * @brief Add route to IP4 or IP6 SRC FIB.
265 * Adds a route to in the LISP SRC FIB for the tunnel.
267 * @param[in] src_fib_index The index/ID of the SRC FIB
268 * @param[in] src_prefix Source IP prefix.
269 * @param[in] paths The paths from which to construct the
272 static fib_node_index_t
273 ip_src_fib_add_route (u32 src_fib_index,
274 const ip_prefix_t * src_prefix,
275 const lisp_fwd_path_t * paths)
277 fib_prefix_t src_fib_prefix;
278 fib_route_path_t *rpaths;
280 ip_prefix_to_fib_prefix (src_prefix, &src_fib_prefix);
282 rpaths = lisp_gpe_mk_fib_paths (paths);
284 fib_node_index_t fib_entry_index =
285 fib_table_entry_update (src_fib_index, &src_fib_prefix, FIB_SOURCE_LISP,
286 FIB_ENTRY_FLAG_NONE, rpaths);
288 return fib_entry_index;
292 gpe_native_fwd_add_del_lfe (lisp_gpe_fwd_entry_t * lfe, u8 is_add)
294 lisp_gpe_main_t *lgm = vnet_lisp_gpe_get_main ();
295 u8 found = 0, ip_version;
297 ip_version = ip_prefix_version (&lfe->key->rmt.ippref);
299 new_lfei = lfe - lgm->lisp_fwd_entry_pool;
300 vec_foreach (lfei, lgm->native_fwd_lfes[ip_version])
302 lfe = pool_elt_at_index (lgm->lisp_fwd_entry_pool, lfei[0]);
303 if (lfei[0] == new_lfei)
313 vec_add1 (lgm->native_fwd_lfes[ip_version], new_lfei);
318 vec_del1 (lgm->native_fwd_lfes[ip_version], lfei[0]);
323 create_fib_entries (lisp_gpe_fwd_entry_t * lfe)
327 lisp_gpe_main_t *lgm = vnet_lisp_gpe_get_main ();
330 fib_prefix_t fib_prefix;
331 u8 ip_version = ip_prefix_version (&lfe->key->rmt.ippref);
332 dproto = (ip_version == IP4 ? DPO_PROTO_IP4 : DPO_PROTO_IP6);
336 lfe->src_fib_index = ip_dst_fib_add_route (lfe->eid_fib_index,
337 &lfe->key->rmt.ippref);
338 memcpy (&ippref, &lfe->key->lcl.ippref, sizeof (ippref));
342 lfe->src_fib_index = lfe->eid_fib_index;
343 memcpy (&ippref, &lfe->key->rmt.ippref, sizeof (ippref));
346 if (LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE == lfe->type)
348 dpo_id_t dpo = DPO_INVALID;
352 case LISP_FORWARD_NATIVE:
353 /* TODO handle route overlaps with fib and default route */
354 if (vec_len (lgm->native_fwd_rpath[ip_version]))
356 ip_prefix_to_fib_prefix (&lfe->key->rmt.ippref, &fib_prefix);
357 fi = fib_table_entry_update (lfe->eid_fib_index, &fib_prefix,
360 lgm->native_fwd_rpath[ip_version]);
361 gpe_native_fwd_add_del_lfe (lfe, 1);
365 /* TODO update timers? */
366 case LISP_SEND_MAP_REQUEST:
367 /* insert tunnel that always sends map-request */
368 dpo_copy (&dpo, lisp_cp_dpo_get (dproto));
371 /* for drop fwd entries, just add route, no need to add encap tunnel */
372 dpo_copy (&dpo, drop_dpo_get (dproto));
375 fi = ip_src_fib_add_route_w_dpo (lfe->src_fib_index, &ippref, &dpo);
380 fi = ip_src_fib_add_route (lfe->src_fib_index, &ippref, lfe->paths);
383 fe = fib_entry_get (fi);
384 return fe->fe_lb.dpoi_index;
388 delete_fib_entries (lisp_gpe_fwd_entry_t * lfe)
390 fib_prefix_t dst_fib_prefix;
393 ip_src_dst_fib_del_route (lfe->src_fib_index,
394 &lfe->key->lcl.ippref,
395 lfe->eid_fib_index, &lfe->key->rmt.ippref);
398 ip_prefix_to_fib_prefix (&lfe->key->rmt.ippref, &dst_fib_prefix);
399 fib_table_entry_delete (lfe->src_fib_index, &dst_fib_prefix,
401 gpe_native_fwd_add_del_lfe (lfe, 0);
405 static lisp_gpe_fwd_entry_t *
406 find_fwd_entry (lisp_gpe_main_t * lgm,
407 vnet_lisp_gpe_add_del_fwd_entry_args_t * a,
408 lisp_gpe_fwd_entry_key_t * key)
412 memset (key, 0, sizeof (*key));
414 if (GID_ADDR_IP_PREFIX == gid_address_type (&a->rmt_eid))
417 * the ip version of the source is not set to ip6 when the
418 * source is all zeros. force it.
420 ip_prefix_version (&gid_address_ippref (&a->lcl_eid)) =
421 ip_prefix_version (&gid_address_ippref (&a->rmt_eid));
424 gid_to_dp_address (&a->rmt_eid, &key->rmt);
425 gid_to_dp_address (&a->lcl_eid, &key->lcl);
428 p = hash_get_mem (lgm->lisp_gpe_fwd_entries, key);
432 return (pool_elt_at_index (lgm->lisp_fwd_entry_pool, p[0]));
438 lisp_gpe_fwd_entry_path_sort (void *a1, void *a2)
440 lisp_fwd_path_t *p1 = a1, *p2 = a2;
442 return (p1->priority - p2->priority);
446 lisp_gpe_fwd_entry_mk_paths (lisp_gpe_fwd_entry_t * lfe,
447 vnet_lisp_gpe_add_del_fwd_entry_args_t * a)
449 lisp_fwd_path_t *path;
452 vec_validate (lfe->paths, vec_len (a->locator_pairs) - 1);
454 vec_foreach_index (index, a->locator_pairs)
456 path = &lfe->paths[index];
458 path->priority = a->locator_pairs[index].priority;
459 path->weight = a->locator_pairs[index].weight;
462 lisp_gpe_adjacency_find_or_create_and_lock (&a->locator_pairs
464 a->dp_table, lfe->key->vni);
466 vec_sort_with_function (lfe->paths, lisp_gpe_fwd_entry_path_sort);
470 vnet_lisp_gpe_add_fwd_counters (vnet_lisp_gpe_add_del_fwd_entry_args_t * a,
473 const lisp_gpe_adjacency_t *ladj;
474 lisp_fwd_path_t *path;
475 lisp_gpe_main_t *lgm = vnet_lisp_gpe_get_main ();
477 lisp_gpe_fwd_entry_t *lfe;
478 lisp_gpe_fwd_entry_key_t fe_key;
479 lisp_stats_key_t key;
481 lfe = find_fwd_entry (lgm, a, &fe_key);
486 if (LISP_GPE_FWD_ENTRY_TYPE_NORMAL != lfe->type)
489 memset (&key, 0, sizeof (key));
490 key.fwd_entry_index = fwd_entry_index;
492 vec_foreach (path, lfe->paths)
494 ladj = lisp_gpe_adjacency_get (path->lisp_adj);
495 key.tunnel_index = ladj->tunnel_index;
496 lisp_stats_key_t *key_copy = clib_mem_alloc (sizeof (*key_copy));
497 memcpy (key_copy, &key, sizeof (*key_copy));
498 pool_get (lgm->dummy_stats_pool, dummy_elt);
499 hash_set_mem (lgm->lisp_stats_index_by_key, key_copy,
500 dummy_elt - lgm->dummy_stats_pool);
502 vlib_validate_combined_counter (&lgm->counters,
503 dummy_elt - lgm->dummy_stats_pool);
504 vlib_zero_combined_counter (&lgm->counters,
505 dummy_elt - lgm->dummy_stats_pool);
510 * @brief Add/Delete LISP IP forwarding entry.
512 * creation of forwarding entries for IP LISP overlay:
514 * @param[in] lgm Reference to @ref lisp_gpe_main_t.
515 * @param[in] a Parameters for building the forwarding entry.
517 * @return 0 on success.
520 add_ip_fwd_entry (lisp_gpe_main_t * lgm,
521 vnet_lisp_gpe_add_del_fwd_entry_args_t * a)
523 lisp_gpe_fwd_entry_key_t key;
524 lisp_gpe_fwd_entry_t *lfe;
525 fib_protocol_t fproto;
527 lfe = find_fwd_entry (lgm, a, &key);
530 /* don't support updates */
531 return VNET_API_ERROR_INVALID_VALUE;
533 pool_get (lgm->lisp_fwd_entry_pool, lfe);
534 memset (lfe, 0, sizeof (*lfe));
535 lfe->key = clib_mem_alloc (sizeof (key));
536 memcpy (lfe->key, &key, sizeof (key));
538 hash_set_mem (lgm->lisp_gpe_fwd_entries, lfe->key,
539 lfe - lgm->lisp_fwd_entry_pool);
540 a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
542 fproto = (IP4 == ip_prefix_version (&fid_addr_ippref (&lfe->key->rmt)) ?
543 FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6);
545 lfe->type = (a->is_negative ?
546 LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE :
547 LISP_GPE_FWD_ENTRY_TYPE_NORMAL);
548 lfe->tenant = lisp_gpe_tenant_find_or_create (lfe->key->vni);
549 lfe->eid_table_id = a->table_id;
550 lfe->eid_fib_index = fib_table_find_or_create_and_lock (fproto,
553 lfe->is_src_dst = a->is_src_dst;
555 if (LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE != lfe->type)
557 lisp_gpe_fwd_entry_mk_paths (lfe, a);
561 lfe->action = a->action;
564 lfe->dpoi_index = create_fib_entries (lfe);
569 del_ip_fwd_entry_i (lisp_gpe_main_t * lgm, lisp_gpe_fwd_entry_t * lfe)
571 lisp_fwd_path_t *path;
572 fib_protocol_t fproto;
574 if (LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE != lfe->type)
576 vec_foreach (path, lfe->paths)
578 lisp_gpe_adjacency_unlock (path->lisp_adj);
582 delete_fib_entries (lfe);
584 fproto = (IP4 == ip_prefix_version (&fid_addr_ippref (&lfe->key->rmt)) ?
585 FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6);
586 fib_table_unlock (lfe->eid_fib_index, fproto, FIB_SOURCE_LISP);
588 hash_unset_mem (lgm->lisp_gpe_fwd_entries, lfe->key);
589 clib_mem_free (lfe->key);
590 pool_put (lgm->lisp_fwd_entry_pool, lfe);
594 * @brief Add/Delete LISP IP forwarding entry.
596 * removal of forwarding entries for IP LISP overlay:
598 * @param[in] lgm Reference to @ref lisp_gpe_main_t.
599 * @param[in] a Parameters for building the forwarding entry.
601 * @return 0 on success.
604 del_ip_fwd_entry (lisp_gpe_main_t * lgm,
605 vnet_lisp_gpe_add_del_fwd_entry_args_t * a)
607 lisp_gpe_fwd_entry_key_t key;
608 lisp_gpe_fwd_entry_t *lfe;
610 lfe = find_fwd_entry (lgm, a, &key);
614 return VNET_API_ERROR_INVALID_VALUE;
616 del_ip_fwd_entry_i (lgm, lfe);
622 make_mac_fib_key (BVT (clib_bihash_kv) * kv, u16 bd_index, u8 src_mac[6],
625 kv->key[0] = (((u64) bd_index) << 48) | mac_to_u64 (dst_mac);
626 kv->key[1] = mac_to_u64 (src_mac);
631 * @brief Lookup L2 SD FIB entry
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).
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.
641 * @return index of mapping matching the lookup key.
644 lisp_l2_fib_lookup (lisp_gpe_main_t * lgm, u16 bd_index, u8 src_mac[6],
648 BVT (clib_bihash_kv) kv, value;
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);
653 /* no match, try with src 0, catch all for dst */
657 rv = BV (clib_bihash_search_inline_2) (&lgm->l2_fib, &kv, &value);
664 return lisp_gpe_main.l2_lb_cp_lkup.dpoi_index;
668 * @brief Add/del L2 SD FIB entry
670 * Inserts value in L2 FIB keyed by vni + dest + source. If entry is
671 * overwritten the associated value is returned.
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.
680 * @return ~0 or value of overwritten entry.
683 lisp_l2_fib_add_del_entry (u16 bd_index, u8 src_mac[6],
684 u8 dst_mac[6], const dpo_id_t * dpo, u8 is_add)
686 lisp_gpe_main_t *lgm = &lisp_gpe_main;
687 BVT (clib_bihash_kv) kv, value;
690 make_mac_fib_key (&kv, bd_index, src_mac, dst_mac);
692 if (BV (clib_bihash_search) (&lgm->l2_fib, &kv, &value) == 0)
693 old_val = value.value;
696 BV (clib_bihash_add_del) (&lgm->l2_fib, &kv, 0 /* is_add */ );
699 kv.value = dpo->dpoi_index;
700 BV (clib_bihash_add_del) (&lgm->l2_fib, &kv, 1 /* is_add */ );
705 #define L2_FIB_DEFAULT_HASH_NUM_BUCKETS (64 * 1024)
706 #define L2_FIB_DEFAULT_HASH_MEMORY_SIZE (32<<20)
709 l2_fib_init (lisp_gpe_main_t * lgm)
713 BV (clib_bihash_init) (&lgm->l2_fib, "l2 fib",
714 1 << max_log2 (L2_FIB_DEFAULT_HASH_NUM_BUCKETS),
715 L2_FIB_DEFAULT_HASH_MEMORY_SIZE);
718 * the result from a 'miss' in a L2 Table
720 lbi = load_balance_create (1, DPO_PROTO_ETHERNET, 0);
721 load_balance_set_bucket (lbi, 0, lisp_cp_dpo_get (DPO_PROTO_ETHERNET));
723 dpo_set (&lgm->l2_lb_cp_lkup, DPO_LOAD_BALANCE, DPO_PROTO_ETHERNET, lbi);
727 del_l2_fwd_entry_i (lisp_gpe_main_t * lgm, lisp_gpe_fwd_entry_t * lfe)
729 lisp_fwd_path_t *path;
731 if (LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE != lfe->type)
733 vec_foreach (path, lfe->paths)
735 lisp_gpe_adjacency_unlock (path->lisp_adj);
737 fib_path_list_child_remove (lfe->l2.path_list_index,
738 lfe->l2.child_index);
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);
745 hash_unset_mem (lgm->lisp_gpe_fwd_entries, lfe->key);
746 clib_mem_free (lfe->key);
747 pool_put (lgm->lisp_fwd_entry_pool, lfe);
751 * @brief Delete LISP L2 forwarding entry.
753 * Coordinates the removal of forwarding entries for L2 LISP overlay:
755 * @param[in] lgm Reference to @ref lisp_gpe_main_t.
756 * @param[in] a Parameters for building the forwarding entry.
758 * @return 0 on success.
761 del_l2_fwd_entry (lisp_gpe_main_t * lgm,
762 vnet_lisp_gpe_add_del_fwd_entry_args_t * a)
764 lisp_gpe_fwd_entry_key_t key;
765 lisp_gpe_fwd_entry_t *lfe;
767 lfe = find_fwd_entry (lgm, a, &key);
770 return VNET_API_ERROR_INVALID_VALUE;
772 del_l2_fwd_entry_i (lgm, lfe);
778 * @brief Construct and insert the forwarding information used by an L2 entry
781 lisp_gpe_l2_update_fwding (lisp_gpe_fwd_entry_t * lfe)
783 lisp_gpe_main_t *lgm = &lisp_gpe_main;
784 dpo_id_t dpo = DPO_INVALID;
786 if (LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE != lfe->type)
788 fib_path_list_contribute_forwarding (lfe->l2.path_list_index,
789 FIB_FORW_CHAIN_TYPE_ETHERNET,
791 dpo_copy (&dpo, &lfe->l2.dpo);
797 case SEND_MAP_REQUEST:
798 dpo_copy (&dpo, &lgm->l2_lb_cp_lkup);
803 dpo_copy (&dpo, drop_dpo_get (DPO_PROTO_ETHERNET));
807 /* add entry to l2 lisp fib */
808 lisp_l2_fib_add_del_entry (lfe->l2.eid_bd_index,
809 fid_addr_mac (&lfe->key->lcl),
810 fid_addr_mac (&lfe->key->rmt), &dpo, 1);
811 lfe->dpoi_index = dpo.dpoi_index;
817 * @brief Add LISP L2 forwarding entry.
819 * Coordinates the creation of forwarding entries for L2 LISP overlay:
820 * creates lisp-gpe tunnel and injects new entry in Source/Dest L2 FIB.
822 * @param[in] lgm Reference to @ref lisp_gpe_main_t.
823 * @param[in] a Parameters for building the forwarding entry.
825 * @return 0 on success.
828 add_l2_fwd_entry (lisp_gpe_main_t * lgm,
829 vnet_lisp_gpe_add_del_fwd_entry_args_t * a)
831 lisp_gpe_fwd_entry_key_t key;
832 bd_main_t *bdm = &bd_main;
833 lisp_gpe_fwd_entry_t *lfe;
836 bd_indexp = hash_get (bdm->bd_index_by_bd_id, a->bd_id);
839 clib_warning ("bridge domain %d doesn't exist", a->bd_id);
843 lfe = find_fwd_entry (lgm, a, &key);
846 /* don't support updates */
847 return VNET_API_ERROR_INVALID_VALUE;
849 pool_get (lgm->lisp_fwd_entry_pool, lfe);
850 memset (lfe, 0, sizeof (*lfe));
851 lfe->key = clib_mem_alloc (sizeof (key));
852 memcpy (lfe->key, &key, sizeof (key));
854 hash_set_mem (lgm->lisp_gpe_fwd_entries, lfe->key,
855 lfe - lgm->lisp_fwd_entry_pool);
856 a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
858 lfe->type = (a->is_negative ?
859 LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE :
860 LISP_GPE_FWD_ENTRY_TYPE_NORMAL);
861 lfe->l2.eid_bd_id = a->bd_id;
862 lfe->l2.eid_bd_index = bd_indexp[0];
863 lfe->tenant = lisp_gpe_tenant_find_or_create (lfe->key->vni);
865 if (LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE != lfe->type)
867 fib_route_path_t *rpaths;
870 * Make the sorted array of LISP paths with their resp. adjacency
872 lisp_gpe_fwd_entry_mk_paths (lfe, a);
875 * From the LISP paths, construct a FIB path list that will
876 * contribute a load-balance.
878 rpaths = lisp_gpe_mk_fib_paths (lfe->paths);
880 lfe->l2.path_list_index =
881 fib_path_list_create (FIB_PATH_LIST_FLAG_NONE, rpaths);
884 * become a child of the path-list so we receive updates when
885 * its forwarding state changes. this includes an implicit lock.
887 lfe->l2.child_index =
888 fib_path_list_child_add (lfe->l2.path_list_index,
889 FIB_NODE_TYPE_LISP_GPE_FWD_ENTRY,
890 lfe - lgm->lisp_fwd_entry_pool);
894 lfe->action = a->action;
897 lisp_gpe_l2_update_fwding (lfe);
903 * @brief Lookup NSH SD FIB entry
905 * Does an SPI+SI lookup in the NSH LISP FIB.
907 * @param[in] lgm Reference to @ref lisp_gpe_main_t.
908 * @param[in] spi_si SPI + SI.
910 * @return next node index.
913 lisp_nsh_fib_lookup (lisp_gpe_main_t * lgm, u32 spi_si_net_order)
916 BVT (clib_bihash_kv) kv, value;
918 memset (&kv, 0, sizeof (kv));
919 kv.key[0] = spi_si_net_order;
920 rv = BV (clib_bihash_search_inline_2) (&lgm->nsh_fib, &kv, &value);
924 return lgm->nsh_cp_lkup;
928 lisp_gpe_fwd_entry_t *lfe;
929 lfe = pool_elt_at_index (lgm->lisp_fwd_entry_pool, value.value);
930 return &lfe->nsh.choice;
935 * @brief Add/del NSH FIB entry
937 * Inserts value in NSH FIB keyed by SPI+SI. If entry is
938 * overwritten the associated value is returned.
940 * @param[in] lgm Reference to @ref lisp_gpe_main_t.
941 * @param[in] spi_si SPI + SI.
942 * @param[in] dpo Load balanced mapped to SPI + SI
944 * @return ~0 or value of overwritten entry.
947 lisp_nsh_fib_add_del_entry (u32 spi_si_host_order, u32 lfei, u8 is_add)
949 lisp_gpe_main_t *lgm = &lisp_gpe_main;
950 BVT (clib_bihash_kv) kv, value;
953 memset (&kv, 0, sizeof (kv));
954 kv.key[0] = clib_host_to_net_u32 (spi_si_host_order);
957 if (BV (clib_bihash_search) (&lgm->nsh_fib, &kv, &value) == 0)
958 old_val = value.value;
961 BV (clib_bihash_add_del) (&lgm->nsh_fib, &kv, 0 /* is_add */ );
965 BV (clib_bihash_add_del) (&lgm->nsh_fib, &kv, 1 /* is_add */ );
970 #define NSH_FIB_DEFAULT_HASH_NUM_BUCKETS (64 * 1024)
971 #define NSH_FIB_DEFAULT_HASH_MEMORY_SIZE (32<<20)
974 nsh_fib_init (lisp_gpe_main_t * lgm)
976 BV (clib_bihash_init) (&lgm->nsh_fib, "nsh fib",
977 1 << max_log2 (NSH_FIB_DEFAULT_HASH_NUM_BUCKETS),
978 NSH_FIB_DEFAULT_HASH_MEMORY_SIZE);
981 * the result from a 'miss' in a NSH Table
983 lgm->nsh_cp_lkup = lisp_cp_dpo_get (DPO_PROTO_NSH);
987 del_nsh_fwd_entry_i (lisp_gpe_main_t * lgm, lisp_gpe_fwd_entry_t * lfe)
989 lisp_fwd_path_t *path;
991 if (LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE != lfe->type)
993 vec_foreach (path, lfe->paths)
995 lisp_gpe_adjacency_unlock (path->lisp_adj);
997 fib_path_list_child_remove (lfe->nsh.path_list_index,
998 lfe->nsh.child_index);
999 dpo_reset (&lfe->nsh.choice);
1002 lisp_nsh_fib_add_del_entry (fid_addr_nsh (&lfe->key->rmt), (u32) ~ 0, 0);
1004 hash_unset_mem (lgm->lisp_gpe_fwd_entries, lfe->key);
1005 clib_mem_free (lfe->key);
1006 pool_put (lgm->lisp_fwd_entry_pool, lfe);
1010 * @brief Delete LISP NSH forwarding entry.
1012 * Coordinates the removal of forwarding entries for NSH LISP overlay:
1014 * @param[in] lgm Reference to @ref lisp_gpe_main_t.
1015 * @param[in] a Parameters for building the forwarding entry.
1017 * @return 0 on success.
1020 del_nsh_fwd_entry (lisp_gpe_main_t * lgm,
1021 vnet_lisp_gpe_add_del_fwd_entry_args_t * a)
1023 lisp_gpe_fwd_entry_key_t key;
1024 lisp_gpe_fwd_entry_t *lfe;
1026 lfe = find_fwd_entry (lgm, a, &key);
1029 return VNET_API_ERROR_INVALID_VALUE;
1031 del_nsh_fwd_entry_i (lgm, lfe);
1037 * @brief Construct and insert the forwarding information used by an NSH entry
1040 lisp_gpe_nsh_update_fwding (lisp_gpe_fwd_entry_t * lfe)
1042 lisp_gpe_main_t *lgm = vnet_lisp_gpe_get_main ();
1043 dpo_id_t dpo = DPO_INVALID;
1044 vnet_hw_interface_t *hi;
1047 if (LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE != lfe->type)
1049 fib_path_list_contribute_forwarding (lfe->nsh.path_list_index,
1050 FIB_FORW_CHAIN_TYPE_NSH,
1054 * LISP encap is always the same for this SPI+SI so we do that hash now
1055 * and stack on the choice.
1057 if (DPO_LOAD_BALANCE == lfe->nsh.dpo.dpoi_type)
1059 const dpo_id_t *tmp;
1060 const load_balance_t *lb;
1063 lb = load_balance_get (lfe->nsh.dpo.dpoi_index);
1064 hash = fid_addr_nsh (&lfe->key->rmt) % lb->lb_n_buckets;
1066 load_balance_get_bucket_i (lb, hash & lb->lb_n_buckets_minus_1);
1068 dpo_copy (&dpo, tmp);
1073 switch (lfe->action)
1075 case SEND_MAP_REQUEST:
1076 dpo_copy (&dpo, lgm->nsh_cp_lkup);
1079 case FORWARD_NATIVE:
1081 dpo_copy (&dpo, drop_dpo_get (DPO_PROTO_NSH));
1085 /* We have only one nsh-lisp interface (no NSH virtualization) */
1086 hip = hash_get (lgm->nsh_ifaces.hw_if_index_by_dp_table, 0);
1089 hi = vnet_get_hw_interface (lgm->vnet_main, hip[0]);
1090 dpo_stack_from_node (hi->tx_node_index, &lfe->nsh.choice, &dpo);
1092 /* add entry to nsh lisp fib */
1093 lisp_nsh_fib_add_del_entry (fid_addr_nsh (&lfe->key->rmt),
1094 lfe - lgm->lisp_fwd_entry_pool, 1);
1100 * @brief Add LISP NSH forwarding entry.
1102 * Coordinates the creation of forwarding entries for L2 LISP overlay:
1103 * creates lisp-gpe tunnel and injects new entry in Source/Dest L2 FIB.
1105 * @param[in] lgm Reference to @ref lisp_gpe_main_t.
1106 * @param[in] a Parameters for building the forwarding entry.
1108 * @return 0 on success.
1111 add_nsh_fwd_entry (lisp_gpe_main_t * lgm,
1112 vnet_lisp_gpe_add_del_fwd_entry_args_t * a)
1114 lisp_gpe_fwd_entry_key_t key;
1115 lisp_gpe_fwd_entry_t *lfe;
1117 lfe = find_fwd_entry (lgm, a, &key);
1120 /* don't support updates */
1121 return VNET_API_ERROR_INVALID_VALUE;
1123 pool_get (lgm->lisp_fwd_entry_pool, lfe);
1124 memset (lfe, 0, sizeof (*lfe));
1125 lfe->key = clib_mem_alloc (sizeof (key));
1126 memcpy (lfe->key, &key, sizeof (key));
1128 hash_set_mem (lgm->lisp_gpe_fwd_entries, lfe->key,
1129 lfe - lgm->lisp_fwd_entry_pool);
1130 a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
1132 lfe->type = (a->is_negative ?
1133 LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE :
1134 LISP_GPE_FWD_ENTRY_TYPE_NORMAL);
1137 if (LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE != lfe->type)
1139 fib_route_path_t *rpaths;
1142 * Make the sorted array of LISP paths with their resp. adjacency
1144 lisp_gpe_fwd_entry_mk_paths (lfe, a);
1147 * From the LISP paths, construct a FIB path list that will
1148 * contribute a load-balance.
1150 rpaths = lisp_gpe_mk_fib_paths (lfe->paths);
1152 lfe->nsh.path_list_index =
1153 fib_path_list_create (FIB_PATH_LIST_FLAG_NONE, rpaths);
1156 * become a child of the path-list so we receive updates when
1157 * its forwarding state changes. this includes an implicit lock.
1159 lfe->nsh.child_index =
1160 fib_path_list_child_add (lfe->nsh.path_list_index,
1161 FIB_NODE_TYPE_LISP_GPE_FWD_ENTRY,
1162 lfe - lgm->lisp_fwd_entry_pool);
1166 lfe->action = a->action;
1169 lisp_gpe_nsh_update_fwding (lfe);
1175 * @brief conver from the embedded fib_node_t struct to the LSIP entry
1177 static lisp_gpe_fwd_entry_t *
1178 lisp_gpe_fwd_entry_from_fib_node (fib_node_t * node)
1180 return ((lisp_gpe_fwd_entry_t *) (((char *) node) -
1181 STRUCT_OFFSET_OF (lisp_gpe_fwd_entry_t,
1186 * @brief Function invoked during a backwalk of the FIB graph
1188 static fib_node_back_walk_rc_t
1189 lisp_gpe_fib_node_back_walk (fib_node_t * node,
1190 fib_node_back_walk_ctx_t * ctx)
1192 lisp_gpe_fwd_entry_t *lfe = lisp_gpe_fwd_entry_from_fib_node (node);
1194 if (fid_addr_type (&lfe->key->rmt) == FID_ADDR_MAC)
1195 lisp_gpe_l2_update_fwding (lfe);
1196 else if (fid_addr_type (&lfe->key->rmt) == FID_ADDR_NSH)
1197 lisp_gpe_nsh_update_fwding (lfe);
1199 return (FIB_NODE_BACK_WALK_CONTINUE);
1203 * @brief Get a fib_node_t struct from the index of a LISP fwd entry
1206 lisp_gpe_fwd_entry_get_fib_node (fib_node_index_t index)
1208 lisp_gpe_main_t *lgm = &lisp_gpe_main;
1209 lisp_gpe_fwd_entry_t *lfe;
1211 lfe = pool_elt_at_index (lgm->lisp_fwd_entry_pool, index);
1213 return (&(lfe->node));
1217 * @brief An indication from the graph that the last lock has gone
1220 lisp_gpe_fwd_entry_fib_node_last_lock_gone (fib_node_t * node)
1222 /* We don't manage the locks of the LISP objects via the graph, since
1223 * this object has no children. so this is a no-op. */
1227 * @brief Virtual function table to register with FIB for the LISP type
1229 const static fib_node_vft_t lisp_fwd_vft = {
1230 .fnv_get = lisp_gpe_fwd_entry_get_fib_node,
1231 .fnv_last_lock = lisp_gpe_fwd_entry_fib_node_last_lock_gone,
1232 .fnv_back_walk = lisp_gpe_fib_node_back_walk,
1236 * @brief Forwarding entry create/remove dispatcher.
1238 * Calls l2 or l3 forwarding entry add/del function based on input data.
1240 * @param[in] a Forwarding entry parameters.
1241 * @param[out] hw_if_indexp NOT USED
1243 * @return 0 on success.
1246 vnet_lisp_gpe_add_del_fwd_entry (vnet_lisp_gpe_add_del_fwd_entry_args_t * a,
1249 lisp_gpe_main_t *lgm = &lisp_gpe_main;
1252 if (vnet_lisp_gpe_enable_disable_status () == 0)
1254 clib_warning ("LISP is disabled!");
1255 return VNET_API_ERROR_LISP_DISABLED;
1258 type = gid_address_type (&a->rmt_eid);
1261 case GID_ADDR_IP_PREFIX:
1263 return add_ip_fwd_entry (lgm, a);
1265 return del_ip_fwd_entry (lgm, a);
1269 return add_l2_fwd_entry (lgm, a);
1271 return del_l2_fwd_entry (lgm, a);
1274 return add_nsh_fwd_entry (lgm, a);
1276 return del_nsh_fwd_entry (lgm, a);
1278 clib_warning ("Forwarding entries for type %d not supported!", type);
1284 vnet_lisp_flush_stats (void)
1286 lisp_gpe_main_t *lgm = vnet_lisp_gpe_get_main ();
1287 vlib_combined_counter_main_t *cm = &lgm->counters;
1290 for (i = 0; i < vlib_combined_counter_n_counters (cm); i++)
1291 vlib_zero_combined_counter (cm, i);
1297 lisp_del_adj_stats (lisp_gpe_main_t * lgm, u32 fwd_entry_index, u32 ti)
1300 lisp_stats_key_t key;
1305 memset (&key, 0, sizeof (key));
1306 key.fwd_entry_index = fwd_entry_index;
1307 key.tunnel_index = ti;
1309 p = hash_get_mem (lgm->lisp_stats_index_by_key, &key);
1312 s = pool_elt_at_index (lgm->dummy_stats_pool, p[0]);
1313 hp = hash_get_pair (lgm->lisp_stats_index_by_key, &key);
1314 key_copy = (void *) (hp->key);
1315 hash_unset_mem (lgm->lisp_stats_index_by_key, &key);
1316 clib_mem_free (key_copy);
1317 pool_put (lgm->dummy_stats_pool, s);
1322 vnet_lisp_gpe_del_fwd_counters (vnet_lisp_gpe_add_del_fwd_entry_args_t * a,
1323 u32 fwd_entry_index)
1325 lisp_gpe_main_t *lgm = &lisp_gpe_main;
1326 lisp_gpe_fwd_entry_key_t fe_key;
1327 lisp_gpe_fwd_entry_t *lfe;
1328 lisp_fwd_path_t *path;
1329 const lisp_gpe_adjacency_t *ladj;
1331 lfe = find_fwd_entry (lgm, a, &fe_key);
1335 if (LISP_GPE_FWD_ENTRY_TYPE_NORMAL != lfe->type)
1338 vec_foreach (path, lfe->paths)
1340 ladj = lisp_gpe_adjacency_get (path->lisp_adj);
1341 lisp_del_adj_stats (lgm, fwd_entry_index, ladj->tunnel_index);
1346 * @brief Flush all the forwrding entries
1349 vnet_lisp_gpe_fwd_entry_flush (void)
1351 lisp_gpe_main_t *lgm = &lisp_gpe_main;
1352 lisp_gpe_fwd_entry_t *lfe;
1355 pool_foreach (lfe, lgm->lisp_fwd_entry_pool,
1357 switch (fid_addr_type(&lfe->key->rmt))
1360 del_l2_fwd_entry_i (lgm, lfe);
1362 case FID_ADDR_IP_PREF:
1363 del_ip_fwd_entry_i (lgm, lfe);
1366 del_nsh_fwd_entry_i (lgm, lfe);
1374 format_lisp_fwd_path (u8 * s, va_list * ap)
1376 lisp_fwd_path_t *lfp = va_arg (*ap, lisp_fwd_path_t *);
1378 s = format (s, "weight:%d ", lfp->weight);
1379 s = format (s, "adj:[%U]\n",
1380 format_lisp_gpe_adjacency,
1381 lisp_gpe_adjacency_get (lfp->lisp_adj),
1382 LISP_GPE_ADJ_FORMAT_FLAG_NONE);
1387 typedef enum lisp_gpe_fwd_entry_format_flag_t_
1389 LISP_GPE_FWD_ENTRY_FORMAT_NONE = (0 << 0),
1390 LISP_GPE_FWD_ENTRY_FORMAT_DETAIL = (1 << 1),
1391 } lisp_gpe_fwd_entry_format_flag_t;
1395 format_lisp_gpe_fwd_entry (u8 * s, va_list * ap)
1397 lisp_gpe_main_t *lgm = &lisp_gpe_main;
1398 lisp_gpe_fwd_entry_t *lfe = va_arg (*ap, lisp_gpe_fwd_entry_t *);
1399 lisp_gpe_fwd_entry_format_flag_t flags =
1400 va_arg (*ap, lisp_gpe_fwd_entry_format_flag_t);
1402 s = format (s, "VNI:%d VRF:%d EID: %U -> %U [index:%d]",
1403 lfe->key->vni, lfe->eid_table_id,
1404 format_fid_address, &lfe->key->lcl,
1405 format_fid_address, &lfe->key->rmt,
1406 lfe - lgm->lisp_fwd_entry_pool);
1408 if (LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE == lfe->type)
1410 s = format (s, "\n Negative - action:%U",
1411 format_negative_mapping_action, lfe->action);
1415 lisp_fwd_path_t *path;
1417 s = format (s, "\n via:");
1418 vec_foreach (path, lfe->paths)
1420 s = format (s, "\n %U", format_lisp_fwd_path, path);
1424 if (flags & LISP_GPE_FWD_ENTRY_FORMAT_DETAIL)
1426 switch (fid_addr_type (&lfe->key->rmt))
1429 s = format (s, " fib-path-list:%d\n", lfe->l2.path_list_index);
1430 s = format (s, " dpo:%U\n", format_dpo_id, &lfe->l2.dpo, 0);
1433 s = format (s, " fib-path-list:%d\n", lfe->nsh.path_list_index);
1434 s = format (s, " dpo:%U\n", format_dpo_id, &lfe->nsh.dpo, 0);
1436 case FID_ADDR_IP_PREF:
1444 static clib_error_t *
1445 lisp_gpe_fwd_entry_show (vlib_main_t * vm,
1446 unformat_input_t * input, vlib_cli_command_t * cmd)
1448 lisp_gpe_main_t *lgm = &lisp_gpe_main;
1449 lisp_gpe_fwd_entry_t *lfe;
1453 if (unformat (input, "vni %d", &vni))
1455 else if (unformat (input, "%d", &index))
1457 if (!pool_is_free_index (lgm->lisp_fwd_entry_pool, index))
1459 lfe = pool_elt_at_index (lgm->lisp_fwd_entry_pool, index);
1461 vlib_cli_output (vm, "[%d@] %U",
1463 format_lisp_gpe_fwd_entry, lfe,
1464 LISP_GPE_FWD_ENTRY_FORMAT_DETAIL);
1468 vlib_cli_output (vm, "entry %d invalid", index);
1475 pool_foreach (lfe, lgm->lisp_fwd_entry_pool,
1478 (lfe->key->vni == vni))
1479 vlib_cli_output (vm, "%U", format_lisp_gpe_fwd_entry, lfe,
1480 LISP_GPE_FWD_ENTRY_FORMAT_NONE);
1488 VLIB_CLI_COMMAND (lisp_gpe_fwd_entry_show_command, static) = {
1489 .path = "show gpe entry",
1490 .short_help = "show gpe entry vni <vni> vrf <vrf> [leid <leid>] reid <reid>",
1491 .function = lisp_gpe_fwd_entry_show,
1496 lisp_gpe_fwd_entry_init (vlib_main_t * vm)
1498 lisp_gpe_main_t *lgm = &lisp_gpe_main;
1499 clib_error_t *error = NULL;
1501 if ((error = vlib_call_init_function (vm, lisp_cp_dpo_module_init)))
1507 fib_node_register_type (FIB_NODE_TYPE_LISP_GPE_FWD_ENTRY, &lisp_fwd_vft);
1513 vnet_lisp_gpe_get_fwd_entry_vnis (void)
1515 lisp_gpe_main_t *lgm = vnet_lisp_gpe_get_main ();
1516 lisp_gpe_fwd_entry_t *lfe;
1520 pool_foreach (lfe, lgm->lisp_fwd_entry_pool,
1522 hash_set (vnis, lfe->key->vni, 0);
1529 lisp_api_gpe_fwd_entry_t *
1530 vnet_lisp_gpe_fwd_entries_get_by_vni (u32 vni)
1532 lisp_gpe_main_t *lgm = &lisp_gpe_main;
1533 lisp_gpe_fwd_entry_t *lfe;
1534 lisp_api_gpe_fwd_entry_t *entries = 0, e;
1537 pool_foreach (lfe, lgm->lisp_fwd_entry_pool,
1539 if (lfe->key->vni == vni)
1541 memset (&e, 0, sizeof (e));
1542 e.dp_table = lfe->eid_table_id;
1543 e.vni = lfe->key->vni;
1544 if (lfe->type == LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE)
1545 e.action = lfe->action;
1546 e.fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
1547 memcpy (&e.reid, &lfe->key->rmt, sizeof (e.reid));
1548 memcpy (&e.leid, &lfe->key->lcl, sizeof (e.leid));
1549 vec_add1 (entries, e);
1558 vnet_lisp_gpe_get_fwd_stats (vnet_lisp_gpe_add_del_fwd_entry_args_t * a,
1561 lisp_gpe_main_t *lgm = vnet_lisp_gpe_get_main ();
1562 lisp_gpe_fwd_entry_t *lfe;
1563 lisp_gpe_fwd_entry_key_t unused;
1565 lfe = find_fwd_entry (lgm, a, &unused);
1569 if (LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE == lfe->type)
1572 if (~0 == lfe->dpoi_index)
1575 vlib_get_combined_counter (&load_balance_main.lbm_to_counters,
1576 lfe->dpoi_index, c);
1580 VLIB_INIT_FUNCTION (lisp_gpe_fwd_entry_init);
1583 * fd.io coding-style-patch-verification: ON
1586 * eval: (c-set-style "gnu")