vppinfra: make default hugepage size configurable

i.e.

memory {
  default-hugepage-size 1G
}

Type: improvement
Change-Id: I822afb51712ae92f4e4992b8ffa33dcb15ccaef1
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vppinfra/mem.h b/src/vppinfra/mem.h
index 1cab0ae..dfe8de9 100644
--- a/src/vppinfra/mem.h
+++ b/src/vppinfra/mem.h
@@ -130,9 +130,12 @@
   /* log2 system page size */
   clib_mem_page_sz_t log2_page_sz;
 
-  /* log2 system default hugepage size */
+  /* log2 default hugepage size */
   clib_mem_page_sz_t log2_default_hugepage_sz;
 
+  /* log2 system default hugepage size */
+  clib_mem_page_sz_t log2_sys_default_hugepage_sz;
+
   /* bitmap of available numa nodes */
   u32 numa_node_bitmap;
 
@@ -470,15 +473,26 @@
   return 1ULL << clib_mem_main.log2_page_sz;
 }
 
+static_always_inline void
+clib_mem_set_log2_default_hugepage_size (clib_mem_page_sz_t log2_page_sz)
+{
+  clib_mem_main.log2_default_hugepage_sz = log2_page_sz;
+}
+
 static_always_inline clib_mem_page_sz_t
 clib_mem_get_log2_default_hugepage_size ()
 {
   return clib_mem_main.log2_default_hugepage_sz;
 }
 
+static_always_inline uword
+clib_mem_get_default_hugepage_size (void)
+{
+  return 1ULL << clib_mem_main.log2_default_hugepage_sz;
+}
+
 int clib_mem_vm_create_fd (clib_mem_page_sz_t log2_page_size, char *fmt, ...);
 uword clib_mem_get_fd_page_size (int fd);
-uword clib_mem_get_default_hugepage_size (void);
 clib_mem_page_sz_t clib_mem_get_fd_log2_page_size (int fd);
 uword clib_mem_vm_reserve (uword start, uword size,
 			   clib_mem_page_sz_t log2_page_sz);