aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/mapme.h
diff options
context:
space:
mode:
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;