1 /*
2  * Copyright (c) 2012-2020 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: This file contains centralized definitions of converged configuration.
22  */
23 
24 #ifndef __CFG_MLME_RATES_H
25 #define __CFG_MLME_RATES_H
26 
27 #define CFG_SUPPORTED_RATES_11B_LEN    4
28 #define CFG_SUPPORTED_RATES_11A_LEN    8
29 #define CFG_OPERATIONAL_RATE_SET_LEN    12
30 #define CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN    8
31 #define CFG_SUPPORTED_MCS_SET_LEN    16
32 #define CFG_BASIC_MCS_SET_LEN    16
33 #define CFG_CURRENT_MCS_SET_LEN    16
34 #define CFG_MLME_RATE_MASK_LEN    4
35 
36 /*
37  * <ini>
38  * gMaxHTMCSForTxData - max HT mcs for TX
39  * @Min: 0
40  * @Max: 383
41  * @Default: 0
42  *
43  * This ini is used to configure the max HT mcs
44  * for tx data.
45  *
46  * Usage: External
47  *
48  * bits 0-15:  max HT mcs
49  * bits 16-31: zero to disable, otherwise enable.
50  *
51  * </ini>
52  */
53 #define CFG_MAX_HT_MCS_FOR_TX_DATA CFG_INI_UINT( \
54 		"gMaxHTMCSForTxData", \
55 		0, \
56 		0x17f, \
57 		0, \
58 		CFG_VALUE_OR_DEFAULT, \
59 		"Max HT Mcs for Tx Data")
60 
61 /*
62  * <ini>
63  * gDisableABGRateForTxData - disable abg rate for tx data
64  * @Min: 0
65  * @Max: 1
66  * @Default: 0
67  *
68  * This ini is used to disable abg rate for tx data.
69  *
70  * Usage: External
71  *
72  * </ini>
73  */
74 #define CFG_DISABLE_ABG_RATE_FOR_TX_DATA CFG_INI_BOOL( \
75 		"gDisableABGRateForTxData", \
76 		0, \
77 		"Disable ABG RATE for TX Data")
78 
79 /*
80  * <ini>
81  * gSapMaxMCSForTxData - sap 11n max mcs
82  * @Min: 0
83  * @Max: 383
84  * @Default: 0
85  *
86  * This ini configure SAP 11n max mcs
87  *
88  * Usage: External
89  *
90  * </ini>
91  */
92 #define CFG_SAP_MAX_MCS_FOR_TX_DATA CFG_INI_UINT( \
93 		"gSapMaxMCSForTxData", \
94 		0, \
95 		383, \
96 		0, \
97 		CFG_VALUE_OR_DEFAULT, \
98 		"SAP Max MCS for TX Data")
99 
100 /*
101  * <ini>
102  * disable_high_ht_mcs_2x2 - disable high mcs index for 2nd stream in 2.4G
103  * @Min: 0
104  * @Max: 8
105  * @Default: 0
106  *
107  * This ini is used to disable high HT MCS index for 2.4G STA connection.
108  * It has been introduced to resolve IOT issue with one of the vendor.
109  *
110  * Note: This INI is not useful with 1x1 setting. If some platform supports
111  * only 1x1 then this INI is not useful.
112  *
113  * 0 - It won't disable any HT MCS index (just like normal HT MCS)
114  * 1 - It will disable 15th bit from HT RX MCS set (from 8-15 bits slot)
115  * 2 - It will disable 14th & 15th bits from HT RX MCS set
116  * 3 - It will disable 13th, 14th, & 15th bits from HT RX MCS set
117  * and so on.
118  *
119  * Related: STA
120  *
121  * Supported Feature: 11n
122  *
123  * Usage: External
124  */
125 #define CFG_DISABLE_HIGH_HT_RX_MCS_2x2 CFG_INI_UINT( \
126 		"disable_high_ht_mcs_2x2", \
127 		0, \
128 		8, \
129 		0, \
130 		CFG_VALUE_OR_DEFAULT, \
131 		"Disable high MCS index for 2x2")
132 
133 #define CFG_CFP_PERIOD CFG_UINT( \
134 		"cfpPeriod", \
135 		0, \
136 		255, \
137 		1, \
138 		CFG_VALUE_OR_DEFAULT, \
139 		"CFP Period")
140 
141 #define CFG_CFP_MAX_DURATION CFG_UINT( \
142 		"cfpMaxDuration", \
143 		0, \
144 		65535, \
145 		30000, \
146 		CFG_VALUE_OR_DEFAULT, \
147 		"CFP Max Duration")
148 /*
149  * <cfg>
150  * supported_rates_11b - supported rates for 11b
151  * @Min: 0 minimum length of supported rates
152  * @Max: default data length of supported rates in string format
153  * @Default: 2, 4, 11, 22
154  */
155 #define CFG_SUPPORTED_RATES_11B_DATA "2, 4, 11, 22"
156 #define CFG_SUPPORTED_RATES_11B CFG_STRING( \
157 		"supported_rates_11b", \
158 		0, \
159 		sizeof(CFG_SUPPORTED_RATES_11B_DATA) - 1, \
160 		CFG_SUPPORTED_RATES_11B_DATA, \
161 		"Supported rates for 11B")
162 
163 /*
164  * <cfg>
165  * supported_rates_11a - supported rates for 11a
166  * @Min: 0 minimum length of supported rates
167  * @Max: default data length of supported rates in string format
168  * @Default: 12, 18, 24, 36, 48, 72, 96, 108
169  */
170 #define CFG_SUPPORTED_RATES_11A_DATA "12, 18, 24, 36, 48, 72, 96, 108"
171 #define CFG_SUPPORTED_RATES_11A CFG_STRING( \
172 		"supported_rates_11a", \
173 		0, \
174 		sizeof(CFG_SUPPORTED_RATES_11A_DATA) - 1, \
175 		CFG_SUPPORTED_RATES_11A_DATA, \
176 		"Supported rates for 11A")
177 
178 /*
179  * <cfg>
180  * supported_mcs_set - supported MCS set data
181  * @Min: 0 minimum length of supported MCS set
182  * @Max: default data length of supported mcs set in string format
183  * @Default: 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
184  * 0x0, 0x0, 0x0
185  */
186 #define CFG_SUPPORTED_MCS_SET_DATA "0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0"
187 #define CFG_SUPPORTED_MCS_SET CFG_STRING( \
188 		"supported_mcs_set", \
189 		0, \
190 		sizeof(CFG_SUPPORTED_MCS_SET_DATA) - 1, \
191 		CFG_SUPPORTED_MCS_SET_DATA, \
192 		"supported MCS set")
193 
194 /*
195  * <cfg>
196  * basic_mcs_set - basic MCS set data
197  * @Min: 0 minimum length of basic MCS set
198  * @Max: default data length of basic mcs set in string format
199  * @Default: 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
200  * 0x0, 0x0, 0x0
201  */
202 #define CFG_BASIC_MCS_SET_DATA "0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0"
203 #define CFG_BASIC_MCS_SET CFG_STRING( \
204 		"basic_mcs_set", \
205 		0, \
206 		sizeof(CFG_BASIC_MCS_SET_DATA) - 1, \
207 		CFG_BASIC_MCS_SET_DATA, \
208 		"basic MCS set")
209 
210 /*
211  * <cfg>
212  * current_mcs_set - current MCS set data
213  * @Min: 0 minimum length of current MCS set
214  * @Max: default data length of current mcs set in string format
215  * @Default: 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
216  * 0x0, 0x0, 0x0
217  */
218 #define CFG_CURRENT_MCS_SET_DATA "0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0"
219 #define CFG_CURRENT_MCS_SET CFG_STRING( \
220 		"current_mcs_set", \
221 		0, \
222 		sizeof(CFG_CURRENT_MCS_SET_DATA) - 1, \
223 		CFG_CURRENT_MCS_SET_DATA, \
224 		"current MCS set")
225 
226 /*
227  * <cfg>
228  * ratemask_type - PHY type for the ratemask.
229  * @Min: 0 No rate mask set defined - disabled the configuration
230  * @Max: 4
231  * @Default: 0
232  *
233  * This ini is used to set the PHY type for ratemask in rate selection.
234  *
235  * 0 = Disables the configuration
236  * 1 = The rate mask specified is for CCK/OFDM configuration
237  * 2 = The rate mask specified is for HT configuration
238  * 3 = The rate mask specified is for VHT configuration
239  * 4 = The rate mask specified is for HE/11ax configuration
240  *
241  * Related: CFG_RATEMASK_SET
242  *
243  * Usage: External
244  */
245 #define CFG_RATEMASK_TYPE CFG_INI_UINT( \
246 		"ratemask_type", \
247 		0, \
248 		4, \
249 		0, \
250 		CFG_VALUE_OR_DEFAULT, \
251 		"Ratemask type")
252 
253 /*
254  * <cfg>
255  * ratemask_set - ratemasks for a PHY type used in rate selection
256  * @Min: default data length of ratemask in string format
257  * @Max: default data length of ratemask in string format
258  * @Default: 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, 0xFFFFFFFF
259  *
260  * This is used to set the rate mask value to be used in rate selection.
261  * Each of the four words must be configured.
262  * A bit value of 1 represents rate is enabled
263  * A bit value of 0 represents rate is disabled
264  *
265  * [b31-b0],[b63-b32],[b95-b64],[b127-b96]
266  * For HE targets, 12 bits correpond to one NSS setting. Ex:
267  * b0-13  => NSS1, MCS 0-13
268  * b14-27 => NSS2, MCS 0-13 and so on for other NSS.
269  * Note that the bit representation is continuous.
270  *
271  * For VHT targets, 12 bits correspond to one NSS setting.
272  * b0-11   => NSS1, MCS 0-11
273  * b12-23 => NSS2, MCS 0-11 and so on for other NSS.
274  *
275  * For HT targets, 8 bits correspond to one NSS setting.
276  * b0-7  => NSS1, MCS 0-7
277  * b8-15 => NSS2, MCS 0-7 and so on for other NSS.
278  *
279  * For OFDM/CCK targets, 8 bits correspond to one NSS setting.
280  * Bit position  |-b3-|-b2-|-b1-|-b0-|
281  * Rates in Mbps |-1 -|-2 -|-5.5|-11-| CCK Rates
282  *
283  * Bit position  |-b11-|-b10-|-b09-|-b08-|-b07-|-b06-|-b05-|-b04-|
284  * Rates in Mbps |- 9 -|- 18-|-36 -|-54 -|- 6 -|-12 -| -24-|-48- | OFDM Rates
285  *
286  * Related: CFG_RATEMASK_TYPE
287  *
288  * Usage: External
289  */
290 #define CFG_RATEMASK_DATA "0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF"
291 #define CFG_RATEMASK_SET CFG_INI_STRING( \
292 		"ratemask_set", \
293 		0, \
294 		sizeof(CFG_RATEMASK_DATA) - 1, \
295 		CFG_RATEMASK_DATA, \
296 		"Ratemasks for rate selection")
297 
298 #define CFG_RATES_ALL \
299 	CFG(CFG_MAX_HT_MCS_FOR_TX_DATA) \
300 	CFG(CFG_DISABLE_ABG_RATE_FOR_TX_DATA) \
301 	CFG(CFG_SAP_MAX_MCS_FOR_TX_DATA) \
302 	CFG(CFG_DISABLE_HIGH_HT_RX_MCS_2x2) \
303 	CFG(CFG_CFP_PERIOD) \
304 	CFG(CFG_CFP_MAX_DURATION) \
305 	CFG(CFG_SUPPORTED_RATES_11B) \
306 	CFG(CFG_SUPPORTED_RATES_11A) \
307 	CFG(CFG_SUPPORTED_MCS_SET) \
308 	CFG(CFG_BASIC_MCS_SET) \
309 	CFG(CFG_CURRENT_MCS_SET) \
310 	CFG(CFG_RATEMASK_TYPE) \
311 	CFG(CFG_RATEMASK_SET)
312 
313 #endif /* __CFG_MLME_RATES_H */
314