From 34883ae53b4aa7be68d9750fa0f33fc7a5c8f17a Mon Sep 17 00:00:00 2001 From: Alberto Compagno Date: Fri, 7 Jun 2019 20:20:08 +0200 Subject: [HICN-216] Fixed dpo initializatino Change-Id: I45104ab815cf93969d1f25a77ea7e79ef295acdc Signed-off-by: Alberto Compagno --- hicn-plugin/src/strategy_dpo_ctx.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'hicn-plugin/src/strategy_dpo_ctx.h') diff --git a/hicn-plugin/src/strategy_dpo_ctx.h b/hicn-plugin/src/strategy_dpo_ctx.h index 5d2dbc47c..c6de6b78c 100644 --- a/hicn-plugin/src/strategy_dpo_ctx.h +++ b/hicn-plugin/src/strategy_dpo_ctx.h @@ -29,6 +29,7 @@ #define NEXT_HOP_INVALID DPO_INVALID +#define INIT_SEQ 0 /* * An hicn dpo is a list of next hops (face + weight). */ @@ -57,6 +58,28 @@ typedef struct __attribute__ ((packed)) hicn_dpo_ctx_s } hicn_dpo_ctx_t; +always_inline void +init_dpo_ctx (hicn_dpo_ctx_t * dpo_ctx) +{ + dpo_id_t invalid = NEXT_HOP_INVALID; + + for (int i = 0; i < HICN_PARAM_FIB_ENTRY_NHOPS_MAX; i++) + { + dpo_ctx->next_hops[i] = invalid; + } + + dpo_ctx->entry_count = 0; + dpo_ctx->locks = 0; + + dpo_ctx->tfib_entry_count = 0; + +#ifdef HICN_MAPME_NOTIFICATIONS + last_iu_ack = 0; +#endif + + dpo_ctx->seq = INIT_SEQ; +} + STATIC_ASSERT (sizeof (hicn_dpo_ctx_t) <= CLIB_CACHE_LINE_BYTES, "sizeof hicn_dpo_ctx_t is greater than 64B"); -- cgit 1.2.3-korg