* INTC Contribution to the O-RAN F Release for O-DU Low
[o-du/phy.git] / fapi_5g / source / include / nr5g_fapi_config_loader.h
1 /******************************************************************************
2 *
3 *   Copyright (c) 2021 Intel.
4 *
5 *   Licensed under the Apache License, Version 2.0 (the "License");
6 *   you may not use this file except in compliance with the License.
7 *   You may obtain a copy of the License at
8 *
9 *       http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *   Unless required by applicable law or agreed to in writing, software
12 *   distributed under the License is distributed on an "AS IS" BASIS,
13 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *   See the License for the specific language governing permissions and
15 *   limitations under the License.
16 *
17 *******************************************************************************/
18
19 /**
20  * @file This file consist of FAPI internal functions.
21  *
22  **/
23
24 #ifndef NR5G_FAPI_CONFIG_LOADER_H_
25 #define NR5G_FAPI_CONFIG_LOADER_H_
26
27 #include "nr5g_fapi_std.h"
28 #include "nr5g_fapi_common_types.h"
29 #include "nr5g_fapi_dpdk.h"
30 #include "nr5g_fapi_log.h"
31
32 #define NR5G_FAPI_DEVICE_NAME_LEN   512
33 #define NR5G_FAPI_MEMORY_ZONE_NAME_LEN  512
34
35 enum {
36     DPDK_IOVA_PA_MODE = 0,
37     DPDK_IOVA_VA_MODE,
38     DPDK_IOVA_MAX_MODE
39 };
40
41 typedef struct _nr5g_fapi_thread_info {
42     pthread_t thread_id;        /* ID returned by pthread_create() */
43     pthread_attr_t thread_attr;
44 } nr5g_fapi_thread_info_t;
45
46 typedef struct _nr5g_fapi_config_worker_cfg {
47     uint8_t core_id;
48     uint8_t thread_priority;
49     uint8_t thread_sched_policy;
50 } nr5g_fapi_config_worker_cfg_t;
51
52 typedef struct _nr5g_fapi_config_wls_cfg {
53     char device_name[NR5G_FAPI_DEVICE_NAME_LEN];
54     uint64_t shmem_size;
55 } nr5g_fapi_config_wls_cfg_t;
56
57 typedef struct nr5g_fapi_config_dpdk_cfg_t {
58     uint8_t iova_mode;          /*0 - PA mode, 1 - VA mode */
59     char memory_zone[NR5G_FAPI_MEMORY_ZONE_NAME_LEN];
60 } nr5g_fapi_config_dpdk_cft_t;
61
62 typedef struct _nr5g_fapi_config_log_cfg {
63     nr5g_fapi_log_types_t level;
64 } nr5g_fapi_config_log_cfg_t;
65
66 typedef struct _nr5g_fapi_thread_params_t {
67     nr5g_fapi_config_worker_cfg_t thread_worker;
68     nr5g_fapi_thread_info_t thread_info;
69 } nr5g_fapi_thread_params_t;
70
71 typedef struct _nr5g_fapi_cfg {
72     char *prgname;
73     nr5g_fapi_thread_params_t mac2phy_thread_params;
74     nr5g_fapi_thread_params_t phy2mac_thread_params;
75     nr5g_fapi_thread_params_t urllc_mac2phy_thread_params;
76     nr5g_fapi_thread_params_t urllc_phy2mac_thread_params;
77     bool is_urllc_enabled;
78     nr5g_fapi_config_wls_cfg_t wls;
79     nr5g_fapi_config_log_cfg_t logger;
80     nr5g_fapi_config_dpdk_cft_t dpdk;
81 } nr5g_fapi_cfg_t,
82 *p_nr5g_fapi_cfg_t;
83
84 p_nr5g_fapi_cfg_t nr5g_fapi_config_loader(
85     char *prgname,
86     const char *cfg_fname);
87
88 #endif                          // NR5G_FAPI_CONFIG_LOADER_H_