summaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/face_db.h
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/face_db.h
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/face_db.h')
-rw-r--r--hicn-plugin/src/face_db.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/hicn-plugin/src/face_db.h b/hicn-plugin/src/face_db.h
index 17c28959a..9423c59d6 100644
--- a/hicn-plugin/src/face_db.h
+++ b/hicn-plugin/src/face_db.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:
@@ -28,7 +28,7 @@
*/
/* Must be power of two */
-#define HICN_FACE_DB_INLINE_FACES 4
+#define HICN_FACE_DB_INLINE_FACES 8
#define HICN_PIT_BITMAP_SIZE_BYTE HICN_PARAM_FACES_MAX/8
#define HICN_PIT_N_HOP_BITMAP_SIZE HICN_PARAM_FACES_MAX
@@ -38,7 +38,7 @@
typedef struct hicn_face_bucket_s
{
/* Array of indexes of virtual faces */
- dpo_id_t faces[HICN_PIT_N_HOP_BUCKET];
+ hicn_face_id_t faces[HICN_PIT_N_HOP_BUCKET];
/* Used to check if interests are retransmission */
u8 bitmap[HICN_PIT_BITMAP_SIZE_BYTE];
@@ -60,7 +60,7 @@ typedef struct __attribute__ ((packed)) hicn_face_db_s
/* 24B + 32B (8*4) = 56B */
/* Array of indexes of virtual faces */
- dpo_id_t inline_faces[HICN_FACE_DB_INLINE_FACES];
+ hicn_face_id_t inline_faces[HICN_FACE_DB_INLINE_FACES];
/* 56B + 4B = 60B */
u32 next_bucket;
@@ -71,13 +71,13 @@ typedef struct __attribute__ ((packed)) hicn_face_db_s
} hicn_face_db_t;
-always_inline dpo_id_t *
+always_inline hicn_face_id_t
hicn_face_db_get_dpo_face (u32 index, hicn_face_db_t * face_db)
{
ASSERT (index < face_db->n_faces);
- return index < HICN_FACE_DB_INLINE_FACES ? &(face_db->inline_faces[index]) :
- &(pool_elt_at_index (hicn_face_bucket_pool, face_db->next_bucket)->faces
+ return index < HICN_FACE_DB_INLINE_FACES ? (face_db->inline_faces[index]) :
+ (pool_elt_at_index (hicn_face_bucket_pool, face_db->next_bucket)->faces
[(index - HICN_FACE_DB_INLINE_FACES) & (HICN_PIT_N_HOP_BUCKET - 1)]);
}
@@ -94,23 +94,23 @@ hicn_face_db_get_bucket (u32 bucket_index)
}
always_inline void
-hicn_face_db_add_face_dpo (dpo_id_t * dpo, hicn_face_db_t * face_db)
+hicn_face_db_add_face (hicn_face_id_t face_id, hicn_face_db_t * face_db)
{
- ASSERT (dpo->dpoi_index != ~0);
+ //ASSERT (dpo->dpoi_index != ~0);
hicn_face_bucket_t *faces_bkt =
pool_elt_at_index (hicn_face_bucket_pool, face_db->next_bucket);
- dpo_id_t *face =
+ hicn_face_id_t *element =
face_db->n_faces <
HICN_FACE_DB_INLINE_FACES ? &(face_db->inline_faces[face_db->n_faces]) :
&(faces_bkt->faces
[(face_db->n_faces -
HICN_FACE_DB_INLINE_FACES) & (HICN_PIT_N_HOP_BUCKET - 1)]);
- clib_memcpy (face, dpo, sizeof (dpo_id_t));
+ *element = face_id;
- u32 bitmap_index = dpo->dpoi_index % HICN_PIT_N_HOP_BITMAP_SIZE;
+ u32 bitmap_index = face_id % HICN_PIT_N_HOP_BITMAP_SIZE;
u32 position_array = bitmap_index / 8;
u8 bit_index = (u8) (bitmap_index - position_array * 8);
@@ -119,11 +119,11 @@ hicn_face_db_add_face_dpo (dpo_id_t * dpo, hicn_face_db_t * face_db)
}
always_inline u8
-hicn_face_search (dpo_id_t * dpo, hicn_face_db_t * face_db)
+hicn_face_search (hicn_face_id_t index, hicn_face_db_t * face_db)
{
hicn_face_bucket_t *faces_bkt =
pool_elt_at_index (hicn_face_bucket_pool, face_db->next_bucket);
- u32 bitmap_index = dpo->dpoi_index % HICN_PIT_N_HOP_BITMAP_SIZE;
+ u32 bitmap_index = index % HICN_PIT_N_HOP_BITMAP_SIZE;
u32 position_array = bitmap_index / 8;
u8 bit_index = bitmap_index - position_array * 8;