summaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/mapme.h
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2020-01-13 17:03:55 +0100
committerAlberto Compagno <acompagn+fdio@cisco.com>2020-01-14 09:24:52 +0100
commit6a268308c499edf4b5d72531388269114802de29 (patch)
tree51c986032b4593d670d09704628d6da693ad7f2d /hicn-plugin/src/mapme.h
parentda5b7d29648fd6acfa527a83f0b66d2f52452033 (diff)
[HICN-475] Adding multihoming in case the producer is facing the producer
Change-Id: I9ec9d43083379ed8961532f2b9d20f03fd1fa45e Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'hicn-plugin/src/mapme.h')
-rw-r--r--hicn-plugin/src/mapme.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/hicn-plugin/src/mapme.h b/hicn-plugin/src/mapme.h
index d5e77f641..5b89e5709 100644
--- a/hicn-plugin/src/mapme.h
+++ b/hicn-plugin/src/mapme.h
@@ -122,6 +122,28 @@ hicn_mapme_tfib_add (hicn_mapme_tfib_t * tfib, dpo_id_t * face_id)
}
static_always_inline int
+hicn_mapme_tfib_clear (hicn_mapme_tfib_t * tfib)
+{
+ dpo_id_t invalid = NEXT_HOP_INVALID;
+ /*
+ * We need to do a linear scan of TFIB entries to find the one to
+ * remove
+ */
+ u8 start_pos = HICN_PARAM_FIB_ENTRY_NHOPS_MAX - tfib->tfib_entry_count;
+ u8 pos = ~0;
+ for (pos = start_pos; pos < HICN_PARAM_FIB_ENTRY_NHOPS_MAX; pos++)
+ {
+ hicn_face_unlock (&tfib->next_hops[pos]);
+ tfib->next_hops[pos] = invalid;
+ break;
+ }
+
+ tfib->tfib_entry_count = 0;
+
+ return 0;
+}
+
+static_always_inline int
hicn_mapme_tfib_del (hicn_mapme_tfib_t * tfib, dpo_id_t * face_id)
{
dpo_id_t invalid = NEXT_HOP_INVALID;