diff options
author | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-06-07 20:20:08 +0200 |
---|---|---|
committer | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-06-07 20:20:08 +0200 |
commit | 34883ae53b4aa7be68d9750fa0f33fc7a5c8f17a (patch) | |
tree | 134fd66dd902f7a24cb289b50bbde5fab777c0cf /hicn-plugin/src/strategies/dpo_rr.c | |
parent | 29152d6ca85e31b279ee004f36b5bcf709ae330a (diff) |
[HICN-216] Fixed dpo initializatino
Change-Id: I45104ab815cf93969d1f25a77ea7e79ef295acdc
Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'hicn-plugin/src/strategies/dpo_rr.c')
-rw-r--r-- | hicn-plugin/src/strategies/dpo_rr.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/hicn-plugin/src/strategies/dpo_rr.c b/hicn-plugin/src/strategies/dpo_rr.c index c9ec50445..027087f7b 100644 --- a/hicn-plugin/src/strategies/dpo_rr.c +++ b/hicn-plugin/src/strategies/dpo_rr.c @@ -162,19 +162,13 @@ hicn_strategy_rr_ctx_create (dpo_proto_t proto, const dpo_id_t * next_hop, { hicn_strategy_rr_ctx_t *hicn_strategy_rr_ctx; int ret = HICN_ERROR_NONE, i; - dpo_id_t invalid = NEXT_HOP_INVALID; /* Allocate a hicn_dpo_ctx on the vpp pool and initialize it */ pool_get (hicn_strategy_rr_ctx_pool, hicn_strategy_rr_ctx); *dpo_idx = hicn_strategy_rr_ctx_get_index (hicn_strategy_rr_ctx); - for (int i = 0; i < HICN_PARAM_FIB_ENTRY_NHOPS_MAX; i++) - { - hicn_strategy_rr_ctx->default_ctx.next_hops[i] = invalid; - } - hicn_strategy_rr_ctx->default_ctx.entry_count = 0; - hicn_strategy_rr_ctx->default_ctx.locks = 0; + init_dpo_ctx (&(hicn_strategy_rr_ctx->default_ctx)); for (i = 0; i < HICN_PARAM_FIB_ENTRY_NHOPS_MAX && i < nh_len; i++) { @@ -220,8 +214,8 @@ hicn_strategy_rr_ctx_add_nh (const dpo_id_t * nh, index_t dpo_idx) { /* If face is marked as deleted, ignore it */ hicn_face_t *face = - hicn_dpoi_get_from_idx (hicn_strategy_rr_ctx-> - default_ctx.next_hops[i].dpoi_index); + hicn_dpoi_get_from_idx (hicn_strategy_rr_ctx->default_ctx. + next_hops[i].dpoi_index); if (face->shared.flags & HICN_FACE_FLAGS_DELETED) { continue; @@ -266,8 +260,8 @@ hicn_strategy_rr_ctx_del_nh (hicn_face_id_t face_id, index_t dpo_idx, face_id) { nh_id = i; - hicn_face_unlock (&hicn_strategy_rr_ctx->default_ctx. - next_hops[i]); + hicn_face_unlock (&hicn_strategy_rr_ctx-> + default_ctx.next_hops[i]); hicn_strategy_rr_ctx->default_ctx.next_hops[i] = invalid; hicn_strategy_rr_ctx->default_ctx.entry_count--; } |