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