summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--hicn-plugin/src/strategies/dpo_mw.c8
-rw-r--r--hicn-plugin/src/strategies/dpo_rr.c10
-rw-r--r--hicn-plugin/src/strategies/strategy_mw.c2
8 files changed, 68 insertions, 9 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
diff --git a/hicn-plugin/src/strategies/dpo_mw.c b/hicn-plugin/src/strategies/dpo_mw.c
index 981e5b61c..41d2f2526 100644
--- a/hicn-plugin/src/strategies/dpo_mw.c
+++ b/hicn-plugin/src/strategies/dpo_mw.c
@@ -134,6 +134,13 @@ format_hicn_strategy_mw_ctx (u8 * s, va_list * ap)
s = format (s, "hicn-mw");
for (i = 0; i < HICN_PARAM_FIB_ENTRY_NHOPS_MAX; i++)
{
+ u8 *buf = NULL;
+ if (i < dpo->default_ctx.entry_count)
+ buf = format(NULL, "FIB");
+ else if (i >= HICN_PARAM_FIB_ENTRY_NHOPS_MAX - dpo->default_ctx.tfib_entry_count)
+ buf = format(NULL, "TFIB");
+ else
+ continue;
next_hop = &dpo->default_ctx.next_hops[i];
face_vft = hicn_face_get_vft (next_hop->dpoi_type);
if (face_vft != NULL)
@@ -143,6 +150,7 @@ format_hicn_strategy_mw_ctx (u8 * s, va_list * ap)
format (s, "%U ", face_vft->format_face, next_hop->dpoi_index,
indent);
s = format (s, "weight %u", dpo->weight[i]);
+ s = format (s, " %s", buf);
}
}
diff --git a/hicn-plugin/src/strategies/dpo_rr.c b/hicn-plugin/src/strategies/dpo_rr.c
index 027087f7b..447a25c52 100644
--- a/hicn-plugin/src/strategies/dpo_rr.c
+++ b/hicn-plugin/src/strategies/dpo_rr.c
@@ -134,8 +134,17 @@ format_hicn_strategy_rr_ctx (u8 * s, va_list * ap)
s =
format (s, "hicn-rr, next hop Face %d",
dpo->default_ctx.next_hops[dpo->current_nhop].dpoi_index);
+
for (i = 0; i < HICN_PARAM_FIB_ENTRY_NHOPS_MAX; i++)
{
+ u8 *buf = NULL;
+ if (i < dpo->default_ctx.entry_count)
+ buf = format(NULL, "FIB");
+ else if (i >= HICN_PARAM_FIB_ENTRY_NHOPS_MAX - dpo->default_ctx.tfib_entry_count)
+ buf = format(NULL, "TFIB");
+ else
+ continue;
+
next_hop = &dpo->default_ctx.next_hops[i];
face_vft = hicn_face_get_vft (next_hop->dpoi_type);
if (face_vft != NULL)
@@ -144,6 +153,7 @@ format_hicn_strategy_rr_ctx (u8 * s, va_list * ap)
s =
format (s, "%U ", face_vft->format_face, next_hop->dpoi_index,
indent);
+ s = format (s, " %s", buf);
}
}
diff --git a/hicn-plugin/src/strategies/strategy_mw.c b/hicn-plugin/src/strategies/strategy_mw.c
index 3efddc0ce..d5ff87303 100644
--- a/hicn-plugin/src/strategies/strategy_mw.c
+++ b/hicn-plugin/src/strategies/strategy_mw.c
@@ -74,7 +74,7 @@ hicn_select_next_hop_mw (index_t dpo_idx, int *nh_idx, dpo_id_t ** outface)
(hicn_strategy_mw_ctx_t *) hicn_strategy_mw_ctx_get (dpo_idx);
u8 next_hop_index = 0;
- for (int i = 0; i < HICN_PARAM_FIB_ENTRY_NHOPS_MAX; i++)
+ for (int i = 0; i < hicn_strategy_mw_ctx->default_ctx.entry_count; i++)
{
if (dpo_id_is_valid (&hicn_strategy_mw_ctx->default_ctx.next_hops[i]))
{