From 229385955109b866a23c4ac2aa03d4d11044c39d Mon Sep 17 00:00:00 2001 From: "Enrico Loparco (eloparco)" Date: Thu, 24 Jun 2021 09:15:41 +0200 Subject: [HICN-708] Rebase with master Signed-off-by: Enrico Loparco (eloparco) Change-Id: I2122e1d61dd3b2e039972624ffbdbcb3c5610159 --- hicn-plugin/src/strategy_dpo_ctx.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'hicn-plugin/src/strategy_dpo_ctx.c') diff --git a/hicn-plugin/src/strategy_dpo_ctx.c b/hicn-plugin/src/strategy_dpo_ctx.c index 6ec1407fb..342c78bb5 100644 --- a/hicn-plugin/src/strategy_dpo_ctx.c +++ b/hicn-plugin/src/strategy_dpo_ctx.c @@ -97,7 +97,7 @@ hicn_strategy_dpo_ctx_alloc () } int -hicn_strategy_dpo_ctx_add_nh (const dpo_id_t * nh, hicn_dpo_ctx_t * dpo_ctx, +hicn_strategy_dpo_ctx_add_nh (hicn_face_id_t nh, hicn_dpo_ctx_t * dpo_ctx, u8 * pos) { @@ -106,12 +106,12 @@ hicn_strategy_dpo_ctx_add_nh (const dpo_id_t * nh, hicn_dpo_ctx_t * dpo_ctx, /* Iterate through the list of faces to find if the face is already a next hop */ for (int i = 0; i < dpo_ctx->entry_count; i++) { - if (!memcmp (nh, &dpo_ctx->next_hops[i], sizeof (dpo_id_t))) + if (nh == dpo_ctx->next_hops[i]) { /* If face is marked as deleted, ignore it */ hicn_face_t *face = - hicn_dpoi_get_from_idx (dpo_ctx->next_hops[i].dpoi_index); - if (face->shared.flags & HICN_FACE_FLAGS_DELETED) + hicn_dpoi_get_from_idx (dpo_ctx->next_hops[i]); + if (face->flags & HICN_FACE_FLAGS_DELETED) { continue; } @@ -125,7 +125,8 @@ hicn_strategy_dpo_ctx_add_nh (const dpo_id_t * nh, hicn_dpo_ctx_t * dpo_ctx, return HICN_ERROR_DPO_CTX_NHOPS_NS; } - clib_memcpy (&dpo_ctx->next_hops[empty], nh, sizeof (dpo_id_t)); + dpo_ctx->next_hops[empty] = nh; + hicn_face_lock_with_id (nh); dpo_ctx->entry_count++; *pos = empty; @@ -137,13 +138,13 @@ hicn_strategy_dpo_ctx_del_nh (hicn_face_id_t face_id, hicn_dpo_ctx_t * dpo_ctx) { int ret = HICN_ERROR_DPO_CTX_NOT_FOUND; - dpo_id_t invalid = NEXT_HOP_INVALID; + hicn_face_id_t invalid = NEXT_HOP_INVALID; for (int i = 0; i < dpo_ctx->entry_count; i++) { - if (dpo_ctx->next_hops[i].dpoi_index == face_id) + if (dpo_ctx->next_hops[i] == face_id) { - hicn_face_unlock (&dpo_ctx->next_hops[i]); + hicn_face_unlock_with_id (dpo_ctx->next_hops[i]); dpo_ctx->entry_count--; dpo_ctx->next_hops[i] = dpo_ctx->next_hops[dpo_ctx->entry_count]; dpo_ctx->next_hops[dpo_ctx->entry_count] = invalid; -- cgit 1.2.3-korg