[dpdk-dev] [PATCH 1/2] mem: get hugepages config

Damien Millescamps damien.millescamps at 6wind.com
Fri Jul 26 16:39:12 CEST 2013


Allow external libraries and applications to know if hugepages
are enabled.

Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com>
Signed-off-by: Damien Millescamps <damien.millescamps at 6wind.com>
---
 lib/librte_eal/common/include/rte_eal.h |   13 ++++++++++++-
 lib/librte_eal/linuxapp/eal/eal.c       |    4 ++++
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index 240530d..58a6f90 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -214,7 +214,18 @@ int rte_eal_init(int argc, char **argv);
 	}								\
 } 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 ed0e9b1..52de2b6 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -945,3 +945,7 @@ rte_eal_process_type(void)
 	return (rte_config.process_type);
 }
 
+int rte_eal_has_hugepages(void)
+{
+	return ! internal_config.no_hugetlbfs;
+}
-- 
1.7.2.5



More information about the dev mailing list