1/* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2020 Mellanox Technologies, Ltd 3 */ 4 5#include <rte_string_fns.h> 6 7#include "eal_private.h" 8#include "eal_memcfg.h" 9 10/* early configuration structure, when memory config is not mmapped */ 11static struct rte_mem_config early_mem_config; 12 13/* Address of global and public configuration */ 14static struct rte_config rte_config = { 15 .mem_config = &early_mem_config, 16}; 17 18/* platform-specific runtime dir */ 19static char runtime_dir[PATH_MAX]; 20 21/* internal configuration */ 22static struct internal_config internal_config; 23 24const char * 25rte_eal_get_runtime_dir(void) 26{ 27 return runtime_dir; 28} 29 30int 31eal_set_runtime_dir(const char *run_dir) 32{ 33 if (strlcpy(runtime_dir, run_dir, PATH_MAX) >= PATH_MAX) { 34 RTE_LOG(ERR, EAL, "Runtime directory string too long\n"); 35 return -1; 36 } 37 38 return 0; 39} 40 41/* Return a pointer to the configuration structure */ 42struct rte_config * 43rte_eal_get_configuration(void) 44{ 45 return &rte_config; 46} 47 48/* Return a pointer to the internal configuration structure */ 49struct internal_config * 50eal_get_internal_configuration(void) 51{ 52 return &internal_config; 53} 54 55enum rte_iova_mode 56rte_eal_iova_mode(void) 57{ 58 return rte_eal_get_configuration()->iova_mode; 59} 60 61/* Get the EAL base address */ 62uint64_t 63rte_eal_get_baseaddr(void) 64{ 65 return (internal_config.base_virtaddr != 0) ? 66 (uint64_t) internal_config.base_virtaddr : 67 eal_get_baseaddr(); 68} 69 70enum rte_proc_type_t 71rte_eal_process_type(void) 72{ 73 return rte_config.process_type; 74} 75 76/* Return user provided mbuf pool ops name */ 77const char * 78rte_eal_mbuf_user_pool_ops(void) 79{ 80 return internal_config.user_mbuf_pool_ops_name; 81} 82 83/* return non-zero if hugepages are enabled. */ 84int 85rte_eal_has_hugepages(void) 86{ 87 return !internal_config.no_hugetlbfs; 88} 89 90int 91rte_eal_has_pci(void) 92{ 93 return !internal_config.no_pci; 94} 95