From c5e9eeca5a67a8272f0fdedcd0afc9b2d22be376 Mon Sep 17 00:00:00 2001 From: Damien Millescamps Date: Fri, 29 Mar 2013 11:34:00 +0100 Subject: [PATCH] mem: get hugepages config Allow external libraries and applications to know if hugepages are enabled. Signed-off-by: Damien Millescamps Signed-off-by: Thomas Monjalon Acked-by: Adrien Mazarguil --- lib/librte_eal/common/include/rte_eal.h | 13 ++++++++++++- lib/librte_eal/linuxapp/eal/eal.c | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h index faa27f95d3..fe1323df65 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -251,7 +251,18 @@ rte_set_application_usage_hook( rte_usage_hook_t usage_func ); } \ } while(0) - +/** + * Whether EAL is using huge pages (disabled by --no-huge option). + * The no-huge mode cannot be used with UIO poll-mode drivers like igb/ixgbe. + * It is useful for NIC drivers (e.g. librte_pmd_mlx4, librte_pmd_vmxnet3) or + * crypto drivers (e.g. librte_crypto_nitrox) provided by third-parties such + * as 6WIND. + * + * @return + * Nonzero if hugepages are enabled. + */ +int rte_eal_has_hugepages(void); + #ifdef __cplusplus } #endif diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 76c2f3cc07..08a96f126e 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -1086,3 +1086,7 @@ rte_eal_process_type(void) return (rte_config.process_type); } +int rte_eal_has_hugepages(void) +{ + return ! internal_config.no_hugetlbfs; +} -- 2.20.1