From c61e2e149421b849888bea0239c50607edce35ac Mon Sep 17 00:00:00 2001 From: Alberto Compagno Date: Tue, 7 Apr 2020 11:43:39 +0200 Subject: [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 Change-Id: I4ac2b4eb09425bfe1b3ca9f82d7d0ff564297b0d --- hicn-plugin/src/mapme.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'hicn-plugin/src/mapme.h') diff --git a/hicn-plugin/src/mapme.h b/hicn-plugin/src/mapme.h index 071590ede..7ed0af88b 100644 --- a/hicn-plugin/src/mapme.h +++ b/hicn-plugin/src/mapme.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Copyright (c) 2017-2020 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -34,6 +34,9 @@ #define INVALID_SEQ 0 +STATIC_ASSERT (sizeof(u32) == sizeof(seq_t), + "seq_t is not 4 bytes"); + typedef struct hicn_mapme_conf_s { hicn_mapme_conf_t conf; @@ -86,12 +89,12 @@ hicn_mapme_nh_set (hicn_mapme_tfib_t * tfib, dpo_id_t * face_id) * @brief Add a next hop iif it is not already a next hops */ static_always_inline int -hicn_mapme_nh_add (hicn_mapme_tfib_t * tfib, dpo_id_t * face_id) +hicn_mapme_nh_add (hicn_mapme_tfib_t * tfib, hicn_face_id_t face_id) { for (u8 pos = 0; pos < tfib->entry_count; pos++) - if (dpo_cmp (&tfib->next_hops[pos], face_id) == 0) + if (tfib->next_hops[pos] == face_id) return 0; - tfib->next_hops[tfib->entry_count++] = *face_id; + tfib->next_hops[tfib->entry_count++] = face_id; return 0; } @@ -133,7 +136,7 @@ hicn_mapme_tfib_clear (hicn_mapme_tfib_t * tfib) u8 pos = ~0; for (pos = start_pos; pos < HICN_PARAM_FIB_ENTRY_NHOPS_MAX; pos++) { - hicn_face_unlock (&tfib->next_hops[pos]); + hicn_face_unlock_with_id (&tfib->next_hops[pos]); tfib->next_hops[pos] = invalid; break; } @@ -144,9 +147,9 @@ hicn_mapme_tfib_clear (hicn_mapme_tfib_t * tfib) } static_always_inline int -hicn_mapme_tfib_del (hicn_mapme_tfib_t * tfib, dpo_id_t * face_id) +hicn_mapme_tfib_del (hicn_mapme_tfib_t * tfib, hicn_face_id_t face_id) { - dpo_id_t invalid = NEXT_HOP_INVALID; + hicn_face_id_t invalid = NEXT_HOP_INVALID; /* * We need to do a linear scan of TFIB entries to find the one to * remove @@ -154,9 +157,9 @@ hicn_mapme_tfib_del (hicn_mapme_tfib_t * tfib, dpo_id_t * face_id) u8 start_pos = HICN_PARAM_FIB_ENTRY_NHOPS_MAX - tfib->tfib_entry_count; u8 pos = ~0; for (pos = start_pos; pos < HICN_PARAM_FIB_ENTRY_NHOPS_MAX; pos++) - if (dpo_cmp (&tfib->next_hops[pos], face_id) == 0) + if (tfib->next_hops[pos] == face_id) { - hicn_face_unlock (&tfib->next_hops[pos]); + hicn_face_unlock_with_id (&tfib->next_hops[pos]); tfib->next_hops[pos] = invalid; break; } @@ -169,7 +172,7 @@ hicn_mapme_tfib_del (hicn_mapme_tfib_t * tfib, dpo_id_t * face_id) /* Likely we won't receive a new IU twice from the same face */ if (PREDICT_TRUE (pos > start_pos)) memmove (tfib->next_hops + start_pos, tfib->next_hops + start_pos + 1, - (pos - start_pos) * sizeof (dpo_id_t)); + (pos - start_pos) * sizeof (hicn_face_id_t)); return 0; } -- cgit 1.2.3-korg