net/cnxk: remove restriction on VF for PFC config
[dpdk.git] / lib / eal / common / eal_common_config.c
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 rte_eal_get_runtime_dir(void)
26 {
27         return runtime_dir;
28 }
29
30 int
31 eal_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 */
42 struct rte_config *
43 rte_eal_get_configuration(void)
44 {
45         return &rte_config;
46 }
47
48 /* Return a pointer to the internal configuration structure */
49 struct internal_config *
50 eal_get_internal_configuration(void)
51 {
52         return &internal_config;
53 }
54
55 enum rte_iova_mode
56 rte_eal_iova_mode(void)
57 {
58         return rte_eal_get_configuration()->iova_mode;
59 }
60
61 /* Get the EAL base address */
62 uint64_t
63 rte_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
70 enum rte_proc_type_t
71 rte_eal_process_type(void)
72 {
73         return rte_config.process_type;
74 }
75
76 /* Return user provided mbuf pool ops name */
77 const char *
78 rte_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. */
84 int
85 rte_eal_has_hugepages(void)
86 {
87         return !internal_config.no_hugetlbfs;
88 }
89
90 int
91 rte_eal_has_pci(void)
92 {
93         return !internal_config.no_pci;
94 }