mem: get hugepages config
authorDamien Millescamps <damien.millescamps@6wind.com>
Fri, 29 Mar 2013 10:34:00 +0000 (11:34 +0100)
committerDavid Marchand <david.marchand@6wind.com>
Wed, 26 Feb 2014 10:07:27 +0000 (11:07 +0100)
Allow external libraries and applications to know if hugepages
are enabled.

Signed-off-by: Damien Millescamps <damien.millescamps@6wind.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
lib/librte_eal/common/include/rte_eal.h
lib/librte_eal/linuxapp/eal/eal.c

index faa27f9..fe1323d 100644 (file)
@@ -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
index 76c2f3c..08a96f1 100644 (file)
@@ -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;
+}