aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/params.h
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-04-11 18:54:52 +0200
committerAlberto Compagno <acompagn+fdio@cisco.com>2019-04-11 19:02:05 +0200
commitd75c88d2c066e7886cf0bc4ebeceee073588b750 (patch)
tree26e0722f0adad8ec0e33cc788f8b2106e8b342b4 /hicn-plugin/src/params.h
parente3533af73ab35a66530292f698b3e2a8fff2d80d (diff)
[HICN-176] Fixed bitmap size in pit entry and added static assert to avoid misconfiguration of parameters in param.h
Change-Id: Ia64eaebe267f87bd5f93abf3e5a9e80bab735765 Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'hicn-plugin/src/params.h')
-rw-r--r--hicn-plugin/src/params.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/hicn-plugin/src/params.h b/hicn-plugin/src/params.h
index f3af714ec..1ca9ba08b 100644
--- a/hicn-plugin/src/params.h
+++ b/hicn-plugin/src/params.h
@@ -16,6 +16,8 @@
#ifndef __HICN_PARAM_H__
#define __HICN_PARAM_H__
+#include <math.h>
+
/*
* Features
*/
@@ -50,9 +52,13 @@ STATIC_ASSERT ((HICN_PARAM_FACES_MAX & (HICN_PARAM_FACES_MAX - 1)) == 0,
// aggregation limit(interest previous hops)
// Supported up to 516. For more than 4 faces this param must
-// satisfy the equation (HICN_PARAM_PIT_ENTRY_PHOPS_MAX - 4) % 2 = 0
+// HICN_PARAM_PIT_ENTRY_PHOPS_MAX - 4 must be a power of two
#define HICN_PARAM_PIT_ENTRY_PHOPS_MAX 20
+STATIC_ASSERT ((ceil (log2 ((HICN_PARAM_PIT_ENTRY_PHOPS_MAX - 4)))) ==
+ (floor (log2 ((HICN_PARAM_PIT_ENTRY_PHOPS_MAX - 4)))),
+ "HICN_PARAM_PIT_ENTRY_PHOPS_MAX - 4 must be a power of two");
+
STATIC_ASSERT ((HICN_PARAM_PIT_ENTRY_PHOPS_MAX <= HICN_PARAM_FACES_MAX),
"HICN_PARAM_PIT_ENTRY_PHOP_MAX must be <= than HICN_PARAM_FACES_MAX");