From da5b7d29648fd6acfa527a83f0b66d2f52452033 Mon Sep 17 00:00:00 2001 From: Alberto Compagno Date: Mon, 13 Jan 2020 17:02:27 +0100 Subject: [HICN-474] Enabling print of FIB and TFIB status Change-Id: I0bf56393fe53a4a52753501134cfe2b4b6c75c08 Signed-off-by: Alberto Compagno --- hicn-plugin/src/strategies/dpo_mw.c | 8 ++++++++ hicn-plugin/src/strategies/dpo_rr.c | 10 ++++++++++ hicn-plugin/src/strategies/strategy_mw.c | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) 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])) { -- cgit 1.2.3-korg