xref: /wlan-driver/qca-wifi-host-cmn/cfg/inc/cfg_define.h (revision 5113495b16420b49004c444715d2daae2066e7dc) !
1 /*
2  * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: APIs and macros for defining configuration.
22  */
23 
24 #ifndef __CFG_DEFINE_H
25 #define __CFG_DEFINE_H
26 
27 enum cfg_fallback_behavior {
28 	CFG_VALUE_OR_CLAMP,
29 	CFG_VALUE_OR_DEFAULT,
30 };
31 
32 #define rm_parens(...) __VA_ARGS__
33 #define __CFG(id, is_ini, mtype, args...) \
34 	__CFG_##is_ini##_##mtype(id, mtype, args)
35 #define _CFG(id, args) __CFG(id, args)
36 #define CFG(id) _CFG(__##id, rm_parens id)
37 
38 #define __CFG_INI_INT(args...) __CFG_INI(args)
39 #define __CFG_INI_UINT(args...) __CFG_INI(args)
40 #define __CFG_INI_BOOL(args...) __CFG_INI(args)
41 #define __CFG_INI_STRING(args...) __CFG_INI(args)
42 #define __CFG_INI_MAC(args...) __CFG_INI(args)
43 #define __CFG_INI_IPV4(args...) __CFG_INI(args)
44 #define __CFG_INI_IPV6(args...) __CFG_INI(args)
45 #define __CFG_INI(args...) (args)
46 
47 #define __CFG_NON_INI_INT(args...) __CFG_NON_INI(args)
48 #define __CFG_NON_INI_UINT(args...) __CFG_NON_INI(args)
49 #define __CFG_NON_INI_BOOL(args...) __CFG_NON_INI(args)
50 #define __CFG_NON_INI_STRING(args...) __CFG_NON_INI(args)
51 #define __CFG_NON_INI_MAC(args...) __CFG_NON_INI(args)
52 #define __CFG_NON_INI_IPV4(args...) __CFG_NON_INI(args)
53 #define __CFG_NON_INI_IPV6(args...) __CFG_NON_INI(args)
54 #define __CFG_NON_INI(args...)
55 
56 /* configuration available in ini */
57 #define CFG_INI_INT(name, min, max, def, fallback, desc) \
58 	(INI, INT, int32_t, name, min, max, fallback, desc, def)
59 #define CFG_INI_UINT(name, min, max, def, fallback, desc) \
60 	(INI, UINT, uint32_t, name, min, max, fallback, desc, def)
61 #define CFG_INI_BOOL(name, def, desc) \
62 	(INI, BOOL, bool, name, false, true, -1, desc, def)
63 #define CFG_INI_STRING(name, min_len, max_len, def, desc) \
64 	(INI, STRING, char *, name, min_len, max_len, -1, desc, def)
65 #define CFG_INI_MAC(name, def, desc) \
66 	(INI, MAC, struct qdf_mac_addr, name, -1, -1, -1, desc, def)
67 #define CFG_INI_IPV4(name, def, desc) \
68 	(INI, IPV4, struct qdf_ipv4_addr, name, -1, -1, -1, desc, def)
69 #define CFG_INI_IPV6(name, def, desc) \
70 	(INI, IPV6, struct qdf_ipv6_addr, name, -1, -1, -1, desc, def)
71 
72 /* configuration *not* available in ini */
73 #define CFG_INT(name, min, max, def, fallback, desc) \
74 	(NON_INI, INT, int32_t, name, min, max, fallback, desc, def)
75 #define CFG_UINT(name, min, max, def, fallback, desc) \
76 	(NON_INI, UINT, uint32_t, name, min, max, fallback, desc, def)
77 #define CFG_BOOL(name, def, desc) \
78 	(NON_INI, BOOL, bool, name, false, true, false, desc, def)
79 #define CFG_STRING(name, min_len, max_len, def, desc) \
80 	(NON_INI, STRING, char *, name, min_len, max_len, -1, desc, def)
81 #define CFG_MAC(name, def, desc) \
82 	(NON_INI, MAC, struct qdf_mac_addr, name, -1, -1, -1, desc, def)
83 #define CFG_IPV4(name, def, desc) \
84 	(NON_INI, IPV4, struct qdf_ipv4_addr, name, -1, -1, -1, desc, def)
85 #define CFG_IPV6(name, def, desc) \
86 	(NON_INI, IPV6, struct qdf_ipv6_addr, name, -1, -1, -1, desc, def)
87 
88 /* utility macros/functions */
89 #ifdef CONFIG_AP_PLATFORM
90 #define PLATFORM_VALUE(non_ap_value, ap_value) ap_value
91 #else
92 #define PLATFORM_VALUE(non_ap_value, ap_value) non_ap_value
93 #endif
94 
95 #ifdef WLAN_USE_CONFIG_PARAMS
96 /* Section Parsing - section names to be parsed */
97 #define CFG_256M_SECTION "256M"
98 #define CFG_512M_SECTION "512M"
99 #define CFG_512M_E_SECTION "512M-E"
100 #define CFG_512M_P_SECTION "512M-P"
101 
102 #define CFG_2G_SECTION "2G"
103 #define CFG_5G_SECTION "5G"
104 #define CFG_5G_LOW_SECTION "5GL"
105 #define CFG_5G_HIGH_SECTION "5GH"
106 #define CFG_6G_HIGH_SECTION "6GH"
107 #define CFG_6G_LOW_SECTION "6GL"
108 #define CFG_6G_SECTION "6G"
109 
110 #define CFG_256M_2G_SECTION "2G-256M"
111 #define CFG_256M_5G_SECTION "5G-256M"
112 #define CFG_256M_5G_LOW_SECTION "5GL-256M"
113 #define CFG_256M_5G_HIGH_SECTION "5GH-256M"
114 #define CFG_256M_6G_LOW_SECTION "6GL-256M"
115 #define CFG_256M_6G_HIGH_SECTION "6GH-256M"
116 #define CFG_256M_6G_SECTION "6G-256M"
117 
118 #define CFG_512ME_2G_SECTION "2G-512M-E"
119 #define CFG_512ME_5G_SECTION "5G-512M-E"
120 #define CFG_512ME_5G_LOW_SECTION "5GL-512M-E"
121 #define CFG_512ME_5G_LOW_SECTION "5GL-512M-E"
122 #define CFG_512ME_6G_HIGH_SECTION "6GH-512M-E"
123 #define CFG_512ME_6G_HIGH_SECTION "6GH-512M-E"
124 #define CFG_512ME_6G_SECTION "6G-512M-E"
125 
126 #define CFG_512MP_2G_SECTION "2G-512M-P"
127 #define CFG_512MP_5G_LOW_SECTION "5GL-512M-P"
128 #define CFG_512MP_5G_HIGH_SECTION "5GH-512M-P"
129 #define CFG_512MP_5G_SECTION "5G-512M-P"
130 #define CFG_512MP_6G_LOW_SECTION "6GL-512M-P"
131 #define CFG_512MP_6G_HIGH_SECTION "6GH-512M-P"
132 #define CFG_512MP_6G_SECTION "6G-512M-P"
133 
134 #define CFG_1G_2G_SECTION "1G-2G"
135 #define CFG_1G_5G_SECTION "1G-5G"
136 #define CFG_1G_5G_LOW_SECTION "1G-5GL"
137 #define CFG_1G_5G_HIGH_SECTION "1G-5GH"
138 #define CFG_1G_6G_LOW_SECTION "1G-6GL"
139 #define CFG_1G_6G_HIGH_SECTION "1G-6GH"
140 #define CFG_1G_6G_SECTION "1G-6G"
141 
142 #define CFG_SCAN_RADIO_SECTION "SCAN-RADIO"
143 
144 #define CFG_SBS_NSS_RING_SECTION "SBS-NSS-RING"
145 #define CFG_DBS_NSS_RING_SECTION "DBS-NSS-RING"
146 
147 #define CFG_DP_TX_DESC_512P_SECTION "512M_REDUCED_DESC"
148 #define CFG_DP_TX_DESC_1G_SECTION "1G-TX-DESC"
149 #define CFG_DP_MON_512M_SECTION "DP_MON_512M_RING"
150 #define CFG_NSS_3DEV_RING_SECTION "DP_NSS_3DEV_RING_SIZE"
151 #define CFG_DP_4RADIO_REO_SECTION "DP_NSS_4RADIO_REO_MAP"
152 
153 #define CFG_512M_OR_4CHAIN_SECTION "512M_OR_DP_MON_4CHAIN"
154 #define CFG_DP_MON_2CHAIN_SECTION "DP_MON_2CHAIN"
155 
156 #define CFG_SOC_SINGLE_PHY_2G_SECTION "SINGLE_PHY_2G"
157 #define CFG_SOC_SINGLE_PHY_5G_SECTION "SINGLE_PHY_5G"
158 #define CFG_SOC_SINGLE_PHY_6G_SECTION "SINGLE_PHY_6G"
159 #define CFG_SOC_SPLIT_PHY_2G_5G_LOW_SECTION "SPLIT_PHY_2G_5G_LOW"
160 #define CFG_SOC_SPLIT_PHY_6G_5G_HIGH_SECTION "SPLIT_PHY_6G_5G_HIGH"
161 #endif /* WLAN_USE_CONFIG_PARAMS */
162 
163 #endif /* __CFG_DEFINE_H */
164 
165