aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/strategies/strategy_mw.c
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2020-04-07 11:43:39 +0200
committerAlberto Compagno <acompagn+fdio@cisco.com>2020-05-04 11:16:59 +0200
commitc61e2e149421b849888bea0239c50607edce35ac (patch)
treef1191d338c9e27c77484c0d8bed6118c6d4612b6 /hicn-plugin/src/strategies/strategy_mw.c
parentdee66271e7f84cb756dae31d154982d5b6bb9807 (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/strategies/strategy_mw.c')
-rw-r--r--hicn-plugin/src/strategies/strategy_mw.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/hicn-plugin/src/strategies/strategy_mw.c b/hicn-plugin/src/strategies/strategy_mw.c
index 2422d4fed..fe4d5896a 100644
--- a/hicn-plugin/src/strategies/strategy_mw.c
+++ b/hicn-plugin/src/strategies/strategy_mw.c
@@ -25,7 +25,7 @@ void hicn_receive_data_mw (index_t dpo_idx, int nh_idx);
void hicn_add_interest_mw (index_t dpo_idx, hicn_hash_entry_t * pit_entry);
void hicn_on_interest_timeout_mw (index_t dpo_idx);
u32 hicn_select_next_hop_mw (index_t dpo_idx, int *nh_idx,
- dpo_id_t ** outface);
+ hicn_face_id_t* outface);
u32 get_strategy_node_index_mw (void);
u8 *hicn_strategy_format_trace_mw (u8 * s, hicn_strategy_trace_t * t);
u8 *hicn_strategy_format_mw (u8 * s, va_list * ap);
@@ -51,7 +51,7 @@ hicn_mw_strategy_get_vft (void)
/* DPO should be give in input as it containes all the information to calculate the next hops*/
u32
-hicn_select_next_hop_mw (index_t dpo_idx, int *nh_idx, dpo_id_t ** outface)
+hicn_select_next_hop_mw (index_t dpo_idx, int *nh_idx, hicn_face_id_t* outface)
{
hicn_dpo_ctx_t *dpo_ctx = hicn_strategy_dpo_ctx_get (dpo_idx);
@@ -64,20 +64,14 @@ hicn_select_next_hop_mw (index_t dpo_idx, int *nh_idx, dpo_id_t ** outface)
u8 next_hop_index = 0;
for (int i = 0; i < dpo_ctx->entry_count; i++)
{
- if (dpo_id_is_valid (&dpo_ctx->next_hops[i]))
- {
- if (hicn_strategy_mw_ctx->weight[next_hop_index] <
- hicn_strategy_mw_ctx->weight[i])
- {
- next_hop_index = i;
- }
- }
+ if (hicn_strategy_mw_ctx->weight[next_hop_index] <
+ hicn_strategy_mw_ctx->weight[i])
+ {
+ next_hop_index = i;
+ }
}
- if (!dpo_id_is_valid (&dpo_ctx->next_hops[next_hop_index]))
- return HICN_ERROR_STRATEGY_NH_NOT_FOUND;
-
- *outface = (dpo_id_t *) & dpo_ctx->next_hops[next_hop_index];
+ *outface = dpo_ctx->next_hops[next_hop_index];
return HICN_ERROR_NONE;
}