Branch data Line data Source code
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 */ 11 : : static struct rte_mem_config early_mem_config; 12 : : 13 : : /* Address of global and public configuration */ 14 : : static struct rte_config rte_config = { 15 : : .mem_config = &early_mem_config, 16 : : }; 17 : : 18 : : /* platform-specific runtime dir */ 19 : : static char runtime_dir[PATH_MAX]; 20 : : 21 : : /* internal configuration */ 22 : : static struct internal_config internal_config; 23 : : 24 : : const char * 25 : 2435 : rte_eal_get_runtime_dir(void) 26 : : { 27 : 2435 : return runtime_dir; 28 : : } 29 : : 30 : : int 31 [ - + ]: 190 : eal_set_runtime_dir(const char *run_dir) 32 : : { 33 [ - + ]: 190 : if (strlcpy(runtime_dir, run_dir, PATH_MAX) >= PATH_MAX) { 34 : 0 : EAL_LOG(ERR, "Runtime directory string too long"); 35 : 0 : return -1; 36 : : } 37 : : 38 : : return 0; 39 : : } 40 : : 41 : : /* Return a pointer to the configuration structure */ 42 : : struct rte_config * 43 : 117041382 : rte_eal_get_configuration(void) 44 : : { 45 : 117041382 : return &rte_config; 46 : : } 47 : : 48 : : /* Return a pointer to the internal configuration structure */ 49 : : struct internal_config * 50 : 487908 : eal_get_internal_configuration(void) 51 : : { 52 : 487908 : return &internal_config; 53 : : } 54 : : 55 : : enum rte_iova_mode 56 : 42597072 : rte_eal_iova_mode(void) 57 : : { 58 : 42597072 : return rte_eal_get_configuration()->iova_mode; 59 : : } 60 : : 61 : : /* Get the EAL base address */ 62 : : uint64_t 63 : 0 : rte_eal_get_baseaddr(void) 64 : : { 65 : 0 : return (internal_config.base_virtaddr != 0) ? 66 [ # # ]: 0 : (uint64_t) internal_config.base_virtaddr : 67 : 0 : eal_get_baseaddr(); 68 : : } 69 : : 70 : : enum rte_proc_type_t 71 : 15483 : rte_eal_process_type(void) 72 : : { 73 : 15483 : return rte_config.process_type; 74 : : } 75 : : 76 : : /* Return user provided mbuf pool ops name */ 77 : : const char * 78 : 27 : rte_eal_mbuf_user_pool_ops(void) 79 : : { 80 : 27 : return internal_config.user_mbuf_pool_ops_name; 81 : : } 82 : : 83 : : /* return non-zero if hugepages are enabled. */ 84 : : int 85 : 192605 : rte_eal_has_hugepages(void) 86 : : { 87 : 192605 : return !internal_config.no_hugetlbfs; 88 : : } 89 : : 90 : : int 91 : 169 : rte_eal_has_pci(void) 92 : : { 93 : 169 : return !internal_config.no_pci; 94 : : }