diff options
author | Alberto Compagno <acompagn+fdio@cisco.com> | 2020-04-07 11:43:39 +0200 |
---|---|---|
committer | Alberto Compagno <acompagn+fdio@cisco.com> | 2020-05-04 11:16:59 +0200 |
commit | c61e2e149421b849888bea0239c50607edce35ac (patch) | |
tree | f1191d338c9e27c77484c0d8bed6118c6d4612b6 /hicn-plugin/src/strategy_dpo_ctx.c | |
parent | dee66271e7f84cb756dae31d154982d5b6bb9807 (diff) |
[HICN-590] Removed andjacency type specific face implementation
Changes in the new implementation are:
- the adjacency index is replaced with a dpo that allows the single face node
to dispatch the packet to the right vlib node.
- local and remote address in the face are replaced with a single nat address
which is used to perform the nat operation when rewriting an interest or a
data (in case of tunnels the nat address will be equal to 0)
- the list of next hop in the load balance is no longer a list of dpos but
a list of face id (this makes the code easier and increases the number of
next hop we supports)
Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Change-Id: I4ac2b4eb09425bfe1b3ca9f82d7d0ff564297b0d
Diffstat (limited to 'hicn-plugin/src/strategy_dpo_ctx.c')
-rw-r--r-- | hicn-plugin/src/strategy_dpo_ctx.c | 17 |
1 files changed, 9 insertions, 8 deletions
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; |