From 6a268308c499edf4b5d72531388269114802de29 Mon Sep 17 00:00:00 2001 From: Alberto Compagno Date: Mon, 13 Jan 2020 17:03:55 +0100 Subject: [HICN-475] Adding multihoming in case the producer is facing the producer Change-Id: I9ec9d43083379ed8961532f2b9d20f03fd1fa45e Signed-off-by: Alberto Compagno --- hicn-plugin/src/mapme.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'hicn-plugin/src/mapme.h') 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 @@ -121,6 +121,28 @@ hicn_mapme_tfib_add (hicn_mapme_tfib_t * tfib, dpo_id_t * face_id) return 0; } +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) { -- cgit 1.2.3-korg