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/mapme.h | |
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/mapme.h')
-rw-r--r-- | hicn-plugin/src/mapme.h | 23 |
1 files changed, 13 insertions, 10 deletions
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; } |