summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--hicn-plugin/src/mapme.h22
-rw-r--r--hicn-plugin/src/mapme_ctrl_node.c6
-rw-r--r--hicn-plugin/src/mapme_eventmgr.c23
-rw-r--r--hicn-plugin/src/mapme_eventmgr.h3
-rw-r--r--hicn-plugin/src/params.h3
5 files changed, 49 insertions, 8 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;
diff --git a/hicn-plugin/src/mapme_ctrl_node.c b/hicn-plugin/src/mapme_ctrl_node.c
index 22a50d49e..57f63dbe1 100644
--- a/hicn-plugin/src/mapme_ctrl_node.c
+++ b/hicn-plugin/src/mapme_ctrl_node.c
@@ -152,7 +152,11 @@ hicn_mapme_process_ctrl (vlib_main_t * vm, vlib_buffer_t * b,
for (u8 pos = 0; pos < tfib->entry_count; pos++)
{
if (dpo_cmp (&tfib->next_hops[pos], in_face) == 0)
- continue;
+ {
+ tfib->entry_count = 0;
+ break;
+ }
+ DEBUG ("Adding nexthop to the tfib, dpo index in_face %d, dpo index tfib %d", in_face->dpoi_index, tfib->next_hops[pos].dpoi_index);
hicn_mapme_tfib_add (tfib, &tfib->next_hops[pos]);
}
diff --git a/hicn-plugin/src/mapme_eventmgr.c b/hicn-plugin/src/mapme_eventmgr.c
index ce9c0a4b4..93168d059 100644
--- a/hicn-plugin/src/mapme_eventmgr.c
+++ b/hicn-plugin/src/mapme_eventmgr.c
@@ -322,6 +322,7 @@ hicn_mapme_eventmgr_process (vlib_main_t * vm,
u8 idle = 0;
retx_t retx_array[NUM_RETX_SLOT][NUM_RETX_ENTRIES];
+ memset(retx_array, 0, NUM_RETX_SLOT*NUM_RETX_ENTRIES);
u8 retx_len[NUM_RETX_SLOT] = { 0 };
u8 cur = 0; /* current slot */
@@ -415,6 +416,7 @@ hicn_mapme_eventmgr_process (vlib_main_t * vm,
*/
retx_t *retx = (retx_t *) & retx_events[i];
+ retx->rtx_count = 0;
/*
* Transmit IU for all TFIB entries with latest seqno (we have
* at least one for sure!)
@@ -510,12 +512,21 @@ hicn_mapme_eventmgr_process (vlib_main_t * vm,
hicn_mapme_send_updates (vm, &retx->prefix, retx->dpo, true);
- /*
- * We did some retransmissions, so let's reschedule a check in the
- * next slot
- */
- NXT[NXTLEN++] = CUR[pos];
- idle = 0;
+ retx->rtx_count++;
+ // If we exceed the numver of retransmittion it means that all tfib entries have seens at least HICN_PARAM_RTX_MAX of retransmission
+ if (retx->rtx_count < HICN_PARAM_RTX_MAX)
+ {
+ /*
+ * We did some retransmissions, so let's reschedule a check in the
+ * next slot
+ */
+ NXT[NXTLEN++] = CUR[pos];
+ idle = 0;
+ }
+ else
+ {
+ hicn_mapme_tfib_clear(tfib);
+ }
}
/* Reset events in this slot and prepare for next one */
diff --git a/hicn-plugin/src/mapme_eventmgr.h b/hicn-plugin/src/mapme_eventmgr.h
index 2f8106d6c..338915d63 100644
--- a/hicn-plugin/src/mapme_eventmgr.h
+++ b/hicn-plugin/src/mapme_eventmgr.h
@@ -15,7 +15,7 @@
#include <vlib/vlib.h> // vlib_node_registration_t (vlib/node.h)
-/*
+/*
* Structure carrying all necessary information for managing Special Interest
* (re)transmissions.
*/
@@ -23,6 +23,7 @@ typedef struct
{
hicn_prefix_t prefix;
dpo_id_t dpo;
+ u8 rtx_count; // Number of retransmissions since last tfib addition
} retx_t;
#define HASH32(x) ((u16)x ^ (x << 16))
diff --git a/hicn-plugin/src/params.h b/hicn-plugin/src/params.h
index a484d076a..56aff30b6 100644
--- a/hicn-plugin/src/params.h
+++ b/hicn-plugin/src/params.h
@@ -62,6 +62,9 @@ STATIC_ASSERT ((ceil (log2 ((HICN_PARAM_PIT_ENTRY_PHOPS_MAX - 4)))) ==
STATIC_ASSERT ((HICN_PARAM_PIT_ENTRY_PHOPS_MAX <= HICN_PARAM_FACES_MAX),
"HICN_PARAM_PIT_ENTRY_PHOP_MAX must be <= than HICN_PARAM_FACES_MAX");
+//tFIB parameters
+#define HICN_PARAM_RTX_MAX 10
+
// PIT lifetime limits on API override this(in seconds, integer type)
#define HICN_PARAM_PIT_LIFETIME_BOUND_MIN_SEC 0
#define HICN_PARAM_PIT_LIFETIME_BOUND_MAX_SEC 200