blob: b4c260b96b9eaa6d2117f6499f73799691afb609 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Padma, Santhosh Kumare4f9ade2016-03-21 13:34:49 +05302 * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080028/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 *
Jeff Johnson295189b2012-06-20 16:38:30 -070030 * This file contains the source code for CFG API functions.
31 *
32 * Author: Kevin Nguyen
33 * Date: 04/09/02
34 * History:-
35 * 04/09/02 Created.
36 * --------------------------------------------------------------------
37 */
38
39#include "palTypes.h"
40#include "cfgPriv.h"
41#include "cfgDebug.h"
42#include "wlan_qct_wda.h"
43
44//---------------------------------------------------------------------
45// Static Variables
46//----------------------------------------------------------------------
47static tCfgCtl __gCfgEntry[CFG_PARAM_MAX_NUM] ;
48static tANI_U32 __gCfgIBufMin[CFG_STA_IBUF_MAX_SIZE] ;
49static tANI_U32 __gCfgIBufMax[CFG_STA_IBUF_MAX_SIZE] ;
50static tANI_U32 __gCfgIBuf[CFG_STA_IBUF_MAX_SIZE] ;
51static tANI_U8 __gCfgSBuf[CFG_STA_SBUF_MAX_SIZE] ;
52static tANI_U8 __gSBuffer[CFG_MAX_STR_LEN] ;
Jeff Johnson295189b2012-06-20 16:38:30 -070053
Sachin Ahujaa4b33a32014-06-18 13:22:00 +053054
Jeff Johnson295189b2012-06-20 16:38:30 -070055static void Notify(tpAniSirGlobal, tANI_U16, tANI_U32);
56
Sachin Ahujaa4b33a32014-06-18 13:22:00 +053057extern tAniSirCfgStaticString cfgStaticString[CFG_MAX_STATIC_STRING];
58extern tAniSirCgStatic cfgStatic[CFG_PARAM_MAX_NUM] ;
59//---------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -070060tANI_U32 cfgNeedRestart(tpAniSirGlobal pMac, tANI_U16 cfgId)
61{
Sameer Thalappil9f746572013-07-16 15:59:34 -070062 if (!pMac->cfg.gCfgEntry)
63 {
64 PELOGE(cfgLog(pMac, LOGE, FL("gCfgEntry is NULL"));)
65 return 0;
66 }
Jeff Johnson295189b2012-06-20 16:38:30 -070067 return !!(pMac->cfg.gCfgEntry[cfgId].control & CFG_CTL_RESTART) ;
68}
69
70// ---------------------------------------------------------------------
71tANI_U32 cfgNeedReload(tpAniSirGlobal pMac, tANI_U16 cfgId)
72{
Sameer Thalappil9f746572013-07-16 15:59:34 -070073 if (!pMac->cfg.gCfgEntry)
74 {
75 PELOGE(cfgLog(pMac, LOGE, FL("gCfgEntry is NULL"));)
76 return 0;
77 }
Jeff Johnson295189b2012-06-20 16:38:30 -070078 return !!(pMac->cfg.gCfgEntry[cfgId].control & CFG_CTL_RELOAD) ;
79}
80
81// ---------------------------------------------------------------------
82/**
83 * wlan_cfgInit()
84 *
85 * FUNCTION:
86 * CFG initialization function.
87 *
88 * LOGIC:
89 * Please see Configuration & Statistic Collection Micro-Architecture
90 * specification for the pseudocode.
91 *
92 * ASSUMPTIONS:
93 * None.
94 *
95 * NOTE:
96 * This function must be called during system initialization.
97 *
98 * @param None
99 * @return None.
100 */
101
102void
103wlan_cfgInit(tpAniSirGlobal pMac)
104{
105 // Set status to not-ready
106 pMac->cfg.gCfgStatus = CFG_INCOMPLETE;
107
108 // Send CFG_DNLD_REQ to host
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700109 PELOGW(cfgLog(pMac, LOGW, FL("Sending CFG_DNLD_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700110 cfgSendHostMsg(pMac, WNI_CFG_DNLD_REQ, WNI_CFG_DNLD_REQ_LEN,
111 WNI_CFG_DNLD_REQ_NUM, 0, 0, 0);
112
113} /*** end wlan_cfgInit() ***/
114
Sachin Ahujaa4b33a32014-06-18 13:22:00 +0530115void cfgGetStrIndex(tpAniSirGlobal pMac, tANI_U16 cfgId)
116{
117 tANI_U16 i = 0;
118
119 for(i = 0; i < CFG_MAX_STATIC_STRING; i++)
120 {
121 if(cfgId == cfgStaticString[i].cfgId)
122 break;
123 }
124 if(i == CFG_MAX_STATIC_STRING)
125 {
126 PELOGE(cfgLog(pMac, LOGE, FL("Entry not found for cfg id :%d"), cfgId);)
127 cfgStatic[cfgId].pStrData = NULL;
128 return;
129 }
130 cfgStatic[cfgId].pStrData = &cfgStaticString[i];
131}
Jeff Johnson295189b2012-06-20 16:38:30 -0700132
133//---------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -0700134tSirRetStatus cfgInit(tpAniSirGlobal pMac)
135{
Sachin Ahujaa4b33a32014-06-18 13:22:00 +0530136 tANI_U16 i = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700137 pMac->cfg.gCfgIBufMin = __gCfgIBufMin;
138 pMac->cfg.gCfgIBufMax = __gCfgIBufMax;
139 pMac->cfg.gCfgIBuf = __gCfgIBuf;
140 pMac->cfg.gCfgSBuf = __gCfgSBuf;
141 pMac->cfg.gSBuffer = __gSBuffer;
142 pMac->cfg.gCfgEntry = __gCfgEntry;
Sachin Ahujaa4b33a32014-06-18 13:22:00 +0530143
144 for(i=0; i<CFG_PARAM_MAX_NUM; i++)
145 {
146 if (!(cfgStatic[i].control & CFG_CTL_INT))
147 {
148 cfgGetStrIndex(pMac, i);
149 }
150 else
151 {
152 cfgStatic[i].pStrData = NULL;
153 }
154 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700155 return (eSIR_SUCCESS);
156}
157
158//----------------------------------------------------------------------
159void cfgDeInit(tpAniSirGlobal pMac)
160{
161 pMac->cfg.gCfgIBufMin = NULL;
162 pMac->cfg.gCfgIBufMax = NULL;
163 pMac->cfg.gCfgIBuf = NULL;
164 pMac->cfg.gCfgSBuf = NULL;
165 pMac->cfg.gSBuffer = NULL;
166 pMac->cfg.gCfgEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700167}
Jeff Johnson295189b2012-06-20 16:38:30 -0700168
169// ---------------------------------------------------------------------
170/**
171 * cfgSetInt()
172 *
173 * FUNCTION:
174 * This function is called to update an integer parameter.
175 *
176 * LOGIC:
177 *
178 * ASSUMPTIONS:
179 * - Range checking is performed by the calling function. In case this
180 * function call is being triggered by a request from host, then host
181 * is responsible for performing range checking before sending the
182 * request.
183 *
184 * - Host RW permission checking should already be done prior to calling
185 * this function by the message processing function.
186 *
187 * NOTE:
188 *
189 * @param cfgId: 16-bit CFG parameter ID
190 * @param value: 32-bit unsigned value
191 *
192 * @return eSIR_SUCCESS : request completed successfully \n
193 * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID \n
194 */
195
196tSirRetStatus
197cfgSetInt(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 value)
198{
199 tANI_U32 index;
200 tANI_U32 control, mask;
201 tSirRetStatus retVal;
202
203 if (cfgId >= CFG_PARAM_MAX_NUM)
204 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700205 PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d"), cfgId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700206 return eSIR_CFG_INVALID_ID;
207 }
Sameer Thalappil9f746572013-07-16 15:59:34 -0700208 if (!pMac->cfg.gCfgEntry)
209 {
210 PELOGE(cfgLog(pMac, LOGE, FL("gCfgEntry is NULL"));)
211 return eSIR_CFG_INVALID_ID;
212 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700213
214 control = pMac->cfg.gCfgEntry[cfgId].control;
215 index = control & CFG_BUF_INDX_MASK;
216 retVal = eSIR_SUCCESS;
217
Jeff Johnson295189b2012-06-20 16:38:30 -0700218 if (index >= CFG_STA_IBUF_MAX_SIZE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700219 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700220 PELOGE(cfgLog(pMac, LOGE, FL("cfg index out of bounds %d"), index);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700221 retVal = eSIR_CFG_INVALID_ID;
222 return retVal;
223 }
224
225 // Check if parameter is valid
226 if ((control & CFG_CTL_VALID) == 0)
227 {
Ratheesh S P36dbc932015-08-07 14:28:57 +0530228 PELOGE(cfgLog(pMac, LOG3, FL("Not valid cfg id %d"), cfgId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700229 retVal = eSIR_CFG_INVALID_ID;
230 }
c_hpothu1c4405a2014-12-10 18:16:16 +0530231 else if ((pMac->cfg.gCfgIBufMin[index] < pMac->cfg.gCfgIBufMax[index]) &&
232 ((pMac->cfg.gCfgIBufMin[index] > value) ||
233 (pMac->cfg.gCfgIBufMax[index] < value)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700234 {
c_hpothu1c4405a2014-12-10 18:16:16 +0530235 PELOGE(cfgLog(pMac, LOGE, FL("Value %u out of range [%u,%u] cfgid %hu"),
236 value, pMac->cfg.gCfgIBufMin[index],
237 pMac->cfg.gCfgIBufMax[index], cfgId);)
238 retVal = eSIR_CFG_INVALID_ID;
239 }
240 else if (!(pMac->cfg.gCfgIBufMin[index] < pMac->cfg.gCfgIBufMax[index]) &&
241 (((tANI_S32)(pMac->cfg.gCfgIBufMin[index]) > (tANI_S32)value) ||
242 ((tANI_S32)(pMac->cfg.gCfgIBufMax[index]) < (tANI_S32)value)))
243 {
244 PELOGE(cfgLog(pMac, LOGE, FL("Value %d out of range [%d,%d] cfgid %hu"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700245 value, pMac->cfg.gCfgIBufMin[index],
246 pMac->cfg.gCfgIBufMax[index], cfgId);)
247 retVal = eSIR_CFG_INVALID_ID;
248 }
249 else
250 {
251 // Write integer value
252 pMac->cfg.gCfgIBuf[index] = value;
253
254 // Update hardware if necessary
255 mask = control & CFG_CTL_NTF_MASK;
256 if ((mask & CFG_CTL_NTF_HW) != 0)
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700257 PELOGE(cfgLog(pMac, LOGE, FL("CFG Notify HW not supported!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700258
259 // Notify other modules if necessary
260 if ((mask & CFG_CTL_NTF_MASK) != 0)
261 Notify(pMac, cfgId, mask);
262
263 }
264
265 return (retVal);
266
267} /*** end cfgSetInt ***/
268
269// ---------------------------------------------------------------------
270/**
271 * cfgCheckValid()
272 *
273 * FUNCTION:
274 * This function is called to check if a parameter is valid
275 *
276 * LOGIC:
277 *
278 * ASSUMPTIONS:
279 *
280 * NOTE:
281 *
282 * @param cfgId: 16-bit CFG parameter ID
283 *
284 * @return eSIR_SUCCESS: request completed successfully
285 * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID
286 */
287
288tSirRetStatus
289cfgCheckValid(tpAniSirGlobal pMac, tANI_U16 cfgId)
290{
291 tANI_U32 control;
292
293 if (cfgId >= CFG_PARAM_MAX_NUM)
294 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700295 PELOG3(cfgLog(pMac, LOG3, FL("Invalid cfg id %d"), cfgId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700296 return(eSIR_CFG_INVALID_ID);
297 }
Sameer Thalappil9f746572013-07-16 15:59:34 -0700298 if (!pMac->cfg.gCfgEntry)
299 {
300 PELOGE(cfgLog(pMac, LOGE, FL("gCfgEntry is NULL"));)
301 return eSIR_CFG_INVALID_ID;
302 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700303
304 control = pMac->cfg.gCfgEntry[cfgId].control;
305
306 // Check if parameter is valid
307 if ((control & CFG_CTL_VALID) == 0)
308 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700309 PELOG3(cfgLog(pMac, LOG3, FL("Not valid cfg id %d"), cfgId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700310 return(eSIR_CFG_INVALID_ID);
311 }
312 else
313 return(eSIR_SUCCESS);
314
315} /*** end cfgCheckValid() ***/
316
317// ---------------------------------------------------------------------
318/**
319 * wlan_cfgGetInt()
320 *
321 * FUNCTION:
322 * This function is called to read an integer parameter.
323 *
324 * LOGIC:
325 *
326 * ASSUMPTIONS:
327 *
328 * NOTE:
329 *
330 * @param cfgId: 16-bit CFG parameter ID
331 * @param pVal: address where parameter value will be written
332 *
333 * @return eSIR_SUCCESS: request completed successfully
334 * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID
335 */
336
337tSirRetStatus
338wlan_cfgGetInt(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 *pValue)
339{
340 tANI_U32 index;
341 tANI_U32 control;
342 tSirRetStatus retVal;
343
344 if (cfgId >= CFG_PARAM_MAX_NUM)
345 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700346 PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d"), cfgId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700347 retVal = eSIR_CFG_INVALID_ID;
348 return retVal;
349 }
Sameer Thalappil9f746572013-07-16 15:59:34 -0700350 if (!pMac->cfg.gCfgEntry)
351 {
352 PELOGE(cfgLog(pMac, LOGE, FL("gCfgEntry is NULL"));)
353 return eSIR_CFG_INVALID_ID;
354 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700355
356 control = pMac->cfg.gCfgEntry[cfgId].control;
357 index = control & CFG_BUF_INDX_MASK;
358 retVal = eSIR_SUCCESS;
359
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 if (index >= CFG_STA_IBUF_MAX_SIZE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700361 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700362 PELOGE(cfgLog(pMac, LOGE, FL("cfg index out of bounds %d"), index);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700363 retVal = eSIR_CFG_INVALID_ID;
364 return retVal;
365 }
366
367 // Check if parameter is valid
368 if ((control & CFG_CTL_VALID) == 0)
369 {
Ratheesh S P36dbc932015-08-07 14:28:57 +0530370 PELOGE(cfgLog(pMac, LOG3, FL("Not valid cfg id %d"), cfgId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700371 retVal = eSIR_CFG_INVALID_ID;
372 }
373 else {
374 // Get integer value
Jeff Johnson62c27982013-02-27 17:53:55 -0800375 if (index < CFG_STA_IBUF_MAX_SIZE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700376 *pValue = pMac->cfg.gCfgIBuf[index];
377 }
378
379 return (retVal);
380
381} /*** end wlan_cfgGetInt() ***/
382
383#ifdef NOT_CURRENTLY_USED
384// ---------------------------------------------------------------------
385/**
386 * cfgIncrementInt()
387 *
388 * FUNCTION:
389 * This function is called to increment an integer parameter by n.
390 *
391 * LOGIC:
392 *
393 * ASSUMPTIONS:
394 * - No range checking will be performed.
395 * - Host RW permission should be checked prior to calling this
396 * function.
397 *
398 * NOTE:
399 *
400 * @param cfgId: 16-bit CFG parameter ID
401 * @param value: increment value
402 *
403 * @return eSIR_SUCCESS: request completed successfully
404 * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID
405 */
406
407tSirRetStatus
408cfgIncrementInt(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 value)
409{
410 tANI_U32 index;
411 tANI_U32 control;
412 tSirRetStatus retVal;
413
414 if (cfgId >= CFG_PARAM_MAX_NUM)
415 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700416 PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d"), cfgId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700417 retVal = eSIR_CFG_INVALID_ID;
418 }
Sameer Thalappil9f746572013-07-16 15:59:34 -0700419 if (!pMac->cfg.gCfgEntry)
420 {
421 PELOGE(cfgLog(pMac, LOGE, FL("gCfgEntry is NULL"));)
422 return eSIR_CFG_INVALID_ID;
423 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700424
425 control = pMac->cfg.gCfgEntry[cfgId].control;
426 index = control & CFG_BUF_INDX_MASK;
427 retVal = eSIR_SUCCESS;
428
429 // Check if parameter is valid
430 if ((control & CFG_CTL_VALID) == 0)
431 {
Ratheesh S P36dbc932015-08-07 14:28:57 +0530432 PELOGE(cfgLog(pMac, LOG3, FL("Not valid cfg id %d"), cfgId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700433 retVal = eSIR_CFG_INVALID_ID;
434 }
435 else
436 {
437 // Increment integer value
438 pMac->cfg.gCfgIBuf[index] += value;
439
440 }
441
442 return (retVal);
443}
444#endif // NOT_CURRENTLY_USED
445
446// ---------------------------------------------------------------------
447/**
448 * cfgSetStr()
449 *
450 * FUNCTION:
451 * This function is called to set a string parameter.
452 *
453 * LOGIC:
454 * This function invokes the cfgSetStrNotify function passing the notify
455 * boolean value set to TRUE. This basically means that HAL needs to be
456 * notified. This is true in the case of non-integrated SOC's or Libra/Volans.
457 * In the case of Prima the cfgSetStrNotify is invoked with the boolean value
458 * set to FALSE.
459 *
460 * ASSUMPTIONS:
461 * - always Notify has to be called
462 *
463 * NOTE:
464 *
465 * @param cfgId: 16-bit CFG parameter ID
466 * @param pStr: address of string data
467 * @param len: string length
468 *
469 * @return eSIR_SUCCESS: request completed successfully
470 * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID
471 * @return eSIR_CFG_INVALID_LEN: invalid parameter length
472 *
473 */
474
475tSirRetStatus cfgSetStr(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U8 *pStr,
476 tANI_U32 length)
477{
478 return cfgSetStrNotify( pMac, cfgId, pStr, length, TRUE );
479}
480
481// ---------------------------------------------------------------------
482/**
483 * cfgSetStrNotify()
484 *
485 * FUNCTION:
486 * This function is called to set a string parameter.
487 *
488 * LOGIC:
489 *
490 * ASSUMPTIONS:
491 * - No length checking will be performed. Should be done by calling
492 * module.
493 * - Host RW permission should be checked prior to calling this
494 * function.
495 *
496 * NOTE:
497 *
498 * @param cfgId: 16-bit CFG parameter ID
499 * @param pStr: address of string data
500 * @param len: string length
501 * @param notifyMod. Notify respective Module
502 *
503 * @return eSIR_SUCCESS: request completed successfully
504 * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID
505 * @return eSIR_CFG_INVALID_LEN: invalid parameter length
506 *
507 */
508
509tSirRetStatus
510cfgSetStrNotify(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U8 *pStr,
511 tANI_U32 length, int notifyMod)
512{
513 tANI_U8 *pDst, *pDstEnd;
514 tANI_U32 index, paramLen, control, mask;
515 tSirRetStatus retVal;
516
517 if (cfgId >= CFG_PARAM_MAX_NUM)
518 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700519 PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d"), cfgId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700520 return eSIR_CFG_INVALID_ID;
521 }
Sameer Thalappil9f746572013-07-16 15:59:34 -0700522 if (!pMac->cfg.gCfgEntry)
523 {
524 PELOGE(cfgLog(pMac, LOGE, FL("gCfgEntry is NULL"));)
525 return eSIR_CFG_INVALID_ID;
526 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700527
528 control = pMac->cfg.gCfgEntry[cfgId].control;
529 index = control & CFG_BUF_INDX_MASK;
530 retVal = eSIR_SUCCESS;
531
532 // Check if parameter is valid
533 if ((control & CFG_CTL_VALID) == 0)
534 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700535 PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d"), cfgId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 retVal = eSIR_CFG_INVALID_ID;
537 }
538 else if (index >= CFG_STA_SBUF_MAX_SIZE)
539 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700540 PELOGE(cfgLog(pMac, LOGE, FL("Invalid Sbuf index %d (max size %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 index, CFG_STA_SBUF_MAX_SIZE);)
542 retVal = eSIR_CFG_INVALID_ID;
543 }
544 else
545 {
546 pDst = &pMac->cfg.gCfgSBuf[index];
547 paramLen = *pDst++;
548 if (length > paramLen)
549 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700550 PELOGE(cfgLog(pMac, LOGE, FL("Invalid length %d (>%d) cfg id %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700551 length, paramLen, cfgId);)
552 retVal = eSIR_CFG_INVALID_LEN;
553 }
554 else
555 {
556 *pDst++ = (tANI_U8)length;
557 pDstEnd = pDst + length;
558 while (pDst < pDstEnd)
559 {
560 *pDst++ = *pStr++;
561 }
562
563 if(notifyMod)
564 {
565 // Update hardware if necessary
566 mask = control & CFG_CTL_NTF_MASK;
567 if ((mask & CFG_CTL_NTF_HW) != 0)
568 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700569 PELOGE(cfgLog(pMac, LOGE, FL("CFG Notify HW not supported!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 }
571
572 // Notify other modules if necessary
573 if ( (mask & CFG_CTL_NTF_MASK) != 0)
574 {
575 Notify(pMac, cfgId, mask);
576 }
577 }
578 }
579
580 }
581
582 return (retVal);
583
584} /*** end cfgSetStrNotify() ***/
585
586// ---------------------------------------------------------------------
587/**
588 * wlan_cfgGetStr()
589 *
590 * FUNCTION:
591 * This function is called to get a string parameter.
592 *
593 * LOGIC:
594 *
595 * ASSUMPTIONS:
596 * - Host RW permission should be checked prior to calling this
597 * function.
598 *
599 * NOTE:
600 *
601 * @param cfgId: 16-bit CFG parameter ID
602 * @param pBuf: address of string buffer
603 * @param pLen: address of max buffer length
604 * actual length will be returned at this address
605 *
606 * @return eSIR_SUCCESS: request completed successfully
607 * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID
608 * @return eSIR_CFG_INVALID_LEN: invalid parameter length
609 *
610 */
611
612tSirRetStatus
613wlan_cfgGetStr(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U8 *pBuf, tANI_U32 *pLength)
614{
615 tANI_U8 *pSrc, *pSrcEnd;
616 tANI_U32 index, control;
617 tSirRetStatus retVal;
618
619 if (cfgId >= CFG_PARAM_MAX_NUM)
620 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700621 PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d"), cfgId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 retVal = eSIR_CFG_INVALID_ID;
623 return retVal;
624 }
Sameer Thalappil9f746572013-07-16 15:59:34 -0700625 if (!pMac->cfg.gCfgEntry)
626 {
627 PELOGE(cfgLog(pMac, LOGE, FL("gCfgEntry is NULL"));)
628 return eSIR_CFG_INVALID_ID;
629 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700630
631 control = pMac->cfg.gCfgEntry[cfgId].control;
632 index = control & CFG_BUF_INDX_MASK;
633 retVal = eSIR_SUCCESS;
634
Jeff Johnson295189b2012-06-20 16:38:30 -0700635 if (index >= CFG_STA_SBUF_MAX_SIZE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700636 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700637 PELOGE(cfgLog(pMac, LOGE, FL("cfg index out of bounds %d"), index);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700638 retVal = eSIR_CFG_INVALID_ID;
639 return retVal;
640 }
641
642 // Check if parameter is valid
643 if ((control & CFG_CTL_VALID) == 0)
644 {
Ratheesh S P36dbc932015-08-07 14:28:57 +0530645 PELOGE(cfgLog(pMac, LOG3, FL("Not valid cfg id %d"), cfgId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700646 retVal = eSIR_CFG_INVALID_ID;
647 }
648 else
649 {
650 // Get string
651 pSrc = &pMac->cfg.gCfgSBuf[index];
652 pSrc++; // skip over max length
653 if (*pLength < *pSrc)
654 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700655 PELOGE(cfgLog(pMac, LOGE, FL("Invalid length %d (<%d) cfg id %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700656 *pLength, *pSrc, cfgId);)
657 retVal = eSIR_CFG_INVALID_LEN;
658 }
659 else
660 {
661 *pLength = *pSrc++; // save parameter length
662 pSrcEnd = pSrc + *pLength;
663 while (pSrc < pSrcEnd)
664 *pBuf++ = *pSrc++;
665 }
666 }
667
668 return (retVal);
669
670} /*** end wlan_cfgGetStr() ***/
671
672// ---------------------------------------------------------------------
673/**
674 * wlan_cfgGetStrMaxLen()
675 *
676 * FUNCTION:
677 * This function is called to get a string maximum length.
678 *
679 * LOGIC:
680 *
681 * ASSUMPTIONS:
682 * - Host RW permission should be checked prior to calling this
683 * function.
684 *
685 * NOTE:
686 *
687 * @param cfgId: 16-bit CFG parameter ID
688 * @param pLen: maximum length will be returned at this address
689 *
690 * @return eSIR_SUCCESS: request completed successfully
691 * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID
692 *
693 */
694
695tSirRetStatus
696wlan_cfgGetStrMaxLen(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 *pLength)
697{
698 tANI_U32 index, control;
699 tSirRetStatus retVal;
700
701 if (cfgId >= CFG_PARAM_MAX_NUM)
702 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700703 PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d"), cfgId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 retVal = eSIR_CFG_INVALID_ID;
705 }
Sameer Thalappil9f746572013-07-16 15:59:34 -0700706 if (!pMac->cfg.gCfgEntry)
707 {
708 PELOGE(cfgLog(pMac, LOGE, FL("gCfgEntry is NULL"));)
709 return eSIR_CFG_INVALID_ID;
710 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700711
712 control = pMac->cfg.gCfgEntry[cfgId].control;
713 index = control & CFG_BUF_INDX_MASK;
714 retVal = eSIR_SUCCESS;
715
Jeff Johnson295189b2012-06-20 16:38:30 -0700716 if (index >= CFG_STA_SBUF_MAX_SIZE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700718 PELOGE(cfgLog(pMac, LOGE, FL("cfg index out of bounds %d"), index);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 retVal = eSIR_CFG_INVALID_ID;
720 return retVal;
721 }
722
723 // Check if parameter is valid
724 if ((control & CFG_CTL_VALID) == 0)
725 {
Ratheesh S P36dbc932015-08-07 14:28:57 +0530726 PELOGE(cfgLog(pMac, LOG3, FL("Not valid cfg id %d"), cfgId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700727 retVal = eSIR_CFG_INVALID_ID;
728 }
729 else
730 {
731 *pLength = pMac->cfg.gCfgSBuf[index];
732 }
733
734 return (retVal);
735
736} /*** end wlan_cfgGetStrMaxLen() ***/
737
738// ---------------------------------------------------------------------
739/**
740 * wlan_cfgGetStrLen()
741 *
742 * FUNCTION:
743 * This function is called to get a string length.
744 *
745 * LOGIC:
746 *
747 * ASSUMPTIONS:
748 * - Host RW permission should be checked prior to calling this
749 * function.
750 *
751 * NOTE:
752 *
753 * @param cfgId: 16-bit CFG parameter ID
754 * @param pLen: current length will be returned at this address
755 *
756 * @return eSIR_SUCCESS: request completed successfully
757 * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID
758 *
759 */
760
761tSirRetStatus
762wlan_cfgGetStrLen(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 *pLength)
763{
764 tANI_U32 index, control;
765 tSirRetStatus retVal;
766
767 if (cfgId >= CFG_PARAM_MAX_NUM)
768 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700769 PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d"), cfgId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 retVal = eSIR_CFG_INVALID_ID;
771 }
Sameer Thalappil9f746572013-07-16 15:59:34 -0700772 if (!pMac->cfg.gCfgEntry)
773 {
774 PELOGE(cfgLog(pMac, LOGE, FL("gCfgEntry is NULL"));)
775 return eSIR_CFG_INVALID_ID;
776 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700777
778 control = pMac->cfg.gCfgEntry[cfgId].control;
779 index = control & CFG_BUF_INDX_MASK;
780 retVal = eSIR_SUCCESS;
781
Jeff Johnson295189b2012-06-20 16:38:30 -0700782 if (index >= CFG_STA_SBUF_MAX_SIZE-1)
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700784 PELOGE(cfgLog(pMac, LOGE, FL("cfg index out of bounds %d"), index);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 retVal = eSIR_CFG_INVALID_ID;
786 return retVal;
787 }
788
789 // Check if parameter is valid
790 if ((control & CFG_CTL_VALID) == 0)
791 {
Ratheesh S P36dbc932015-08-07 14:28:57 +0530792 PELOGE(cfgLog(pMac, LOG3, FL("Not valid cfg id %d"), cfgId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 retVal = eSIR_CFG_INVALID_ID;
794 }
795 else
796 {
797 *pLength = pMac->cfg.gCfgSBuf[index+1];
798 }
799
800 return (retVal);
801
802} /*** end wlan_cfgGetStrLen() ***/
803
804
805
806/*-------------------------------------------------------------
807\fn cfgGetDot11dTransmitPower
808\brief This function returns the regulatory max transmit power
809\param pMac
810\return tPowerdBm - Power
811\-------------------------------------------------------------*/
812static tPowerdBm
813cfgGetDot11dTransmitPower(tpAniSirGlobal pMac, tANI_U16 cfgId,
814 tANI_U32 cfgLength, tANI_U8 channel)
815{
816 tANI_U8 *pCountryInfo = NULL;
817 tANI_U8 count = 0;
818 tPowerdBm maxTxPwr = WDA_MAX_TXPOWER_INVALID;
Jeff Johnson295189b2012-06-20 16:38:30 -0700819
820 /* At least one element is present */
821 if(cfgLength < sizeof(tSirMacChanInfo))
822 {
823 PELOGE(cfgLog(pMac, LOGE, FL("Invalid CFGLENGTH %d while getting 11d txpower"), cfgLength);)
824 goto error;
825 }
826
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530827 pCountryInfo = vos_mem_malloc(cfgLength);
828 if ( NULL == pCountryInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530830 cfgLog(pMac, LOGP, FL(" failed to allocate memory"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 goto error;
832 }
833 /* The CSR will always update this CFG. The contents will be from country IE if regulatory domain
834 * is enabled on AP else will contain EEPROM contents
835 */
836 if (wlan_cfgGetStr(pMac, cfgId, pCountryInfo, &cfgLength) != eSIR_SUCCESS)
837 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530838 vos_mem_free(pCountryInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 pCountryInfo = NULL;
840
841 cfgLog(pMac, LOGP, FL("Failed to retrieve 11d configuration parameters while retrieving 11d tuples"));
842 goto error;
843 }
844 /* Identify the channel and maxtxpower */
845 while(count <= (cfgLength - (sizeof(tSirMacChanInfo))))
846 {
847 tANI_U8 firstChannel, maxChannels;
848
849 firstChannel = pCountryInfo[count++];
850 maxChannels = pCountryInfo[count++];
851 maxTxPwr = pCountryInfo[count++];
852
853 if((channel >= firstChannel) &&
854 (channel < (firstChannel + maxChannels)))
855 {
856 break;
857 }
858 }
859
860error:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530861 if (NULL != pCountryInfo)
862 vos_mem_free(pCountryInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700863
864 return maxTxPwr;
865}
866
867
868/**----------------------------------------------------------------------
869\fn cfgGetRegulatoryMaxTransmitPower
870
871\brief Gets regulatory tx power on the current channel.
872
873\param pMac
874\param channel
875\param rfBand
876 -----------------------------------------------------------------------*/
877tPowerdBm cfgGetRegulatoryMaxTransmitPower(tpAniSirGlobal pMac, tANI_U8 channel)
878{
879 tANI_U32 cfgLength = 0;
880 tANI_U16 cfgId = 0;
881 tPowerdBm maxTxPwr;
882 eRfBandMode rfBand = eRF_BAND_UNKNOWN;
883
884 if ((channel >= SIR_11A_CHANNEL_BEGIN) &&
885 (channel <= SIR_11A_CHANNEL_END))
886 rfBand = eRF_BAND_5_GHZ;
887 else
888 rfBand = eRF_BAND_2_4_GHZ;
889
890
891 /* Get the max transmit power for current channel for the current regulatory domain */
892 switch (rfBand)
893 {
894 case eRF_BAND_2_4_GHZ:
895 cfgId = WNI_CFG_MAX_TX_POWER_2_4;
896 cfgLength = WNI_CFG_MAX_TX_POWER_2_4_LEN;
897 PELOG2(cfgLog(pMac, LOG2, FL("HAL: Reading CFG for 2.4 GHz channels to get regulatory max tx power"));)
898 break;
899
900 case eRF_BAND_5_GHZ:
901 cfgId = WNI_CFG_MAX_TX_POWER_5;
902 cfgLength = WNI_CFG_MAX_TX_POWER_5_LEN;
903 PELOG2(cfgLog(pMac, LOG2, FL("HAL: Reading CFG for 5.0 GHz channels to get regulatory max tx power"));)
904 break;
905
906 case eRF_BAND_UNKNOWN:
907 default:
908 PELOG2(cfgLog(pMac, LOG2, FL("HAL: Invalid current working band for the device"));)
909 return WDA_MAX_TXPOWER_INVALID; //Its return, not break.
910 }
911
912 maxTxPwr = cfgGetDot11dTransmitPower(pMac, cfgId, cfgLength, channel);
913
914 return (maxTxPwr);
915}
916
917// ---------------------------------------------------------------------
918/**
919 * cfgGetCapabilityInfo
920 *
921 * FUNCTION:
922 *
923 * LOGIC:
924 *
925 * ASSUMPTIONS:
926 *
927 * NOTE:
928 *
929 * @param None
930 * @return None
931 */
932
933tSirRetStatus
934cfgGetCapabilityInfo(tpAniSirGlobal pMac, tANI_U16 *pCap,tpPESession sessionEntry)
935{
936 tANI_U32 val = 0;
937 tpSirMacCapabilityInfo pCapInfo;
938 tLimSystemRole systemRole = limGetSystemRole(sessionEntry);
939
940 *pCap = 0;
941 pCapInfo = (tpSirMacCapabilityInfo) pCap;
942
943 if (systemRole == eLIM_STA_IN_IBSS_ROLE)
944 pCapInfo->ibss = 1; // IBSS bit
945 else if ( (systemRole == eLIM_AP_ROLE) ||(systemRole == eLIM_BT_AMP_AP_ROLE)||(systemRole == eLIM_BT_AMP_STA_ROLE) ||
946 (systemRole == eLIM_STA_ROLE) )
947 pCapInfo->ess = 1; // ESS bit
Jeff Johnson295189b2012-06-20 16:38:30 -0700948 else if (limGetSystemRole(sessionEntry) == eLIM_P2P_DEVICE_ROLE )
949 {
950 pCapInfo->ess = 0;
951 pCapInfo->ibss = 0;
952 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700953 else
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700954 cfgLog(pMac, LOGP, FL("can't get capability, role is UNKNOWN!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700955
Jeff Johnson295189b2012-06-20 16:38:30 -0700956
Jeff Johnson295189b2012-06-20 16:38:30 -0700957 if(systemRole == eLIM_AP_ROLE)
958 {
959 val = sessionEntry->privacy;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530960#ifdef SAP_AUTH_OFFLOAD
961 /* Support SAP Authentication Offload feature,
962 * If Auth offload security Type is not disabled
963 * driver need to enable privacy bit in beacon
964 */
965 if (pMac->sap_auth_offload && pMac->sap_auth_offload_sec_type)
966 {
967 val = 1;
968 }
969#endif
970
Jeff Johnson295189b2012-06-20 16:38:30 -0700971 }
972 else
973 {
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800974 // PRIVACY bit
975 if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, &val) != eSIR_SUCCESS)
976 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700977 cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_PRIVACY_ENABLED failed"));
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800978 return eSIR_FAILURE;
979 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700980 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700981 if (val)
982 pCapInfo->privacy = 1;
983
984 // Short preamble bit
985 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
986 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -0700987 cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_SHORT_PREAMBLE failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700988 return eSIR_FAILURE;
989 }
990 if (val)
991 pCapInfo->shortPreamble = 1;
992
993
994 // PBCC bit
995 pCapInfo->pbcc = 0;
996
997 // Channel agility bit
998 pCapInfo->channelAgility = 0;
999 //If STA/AP operating in 11B mode, don't set rest of the capability info bits.
1000 if(sessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
1001 return eSIR_SUCCESS;
1002
Jeff Johnson295189b2012-06-20 16:38:30 -07001003 // Short slot time bit
1004 if (systemRole == eLIM_AP_ROLE)
1005 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001006 pCapInfo->shortSlotTime = sessionEntry->shortSlotTimeSupported;
Jeff Johnson295189b2012-06-20 16:38:30 -07001007 }
1008 else
1009 {
1010 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
1011 != eSIR_SUCCESS)
1012 {
1013 cfgLog(pMac, LOGP,
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -07001014 FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001015 return eSIR_FAILURE;
1016 }
1017 /* When in STA mode, we need to check if short slot is enabled as well as check if the current operating
1018 * mode is short slot time and then decide whether to enable short slot or not. It is safe to check both
1019 * cfg values to determine short slot value in this funcn since this funcn is always used after assoc when
1020 * these cfg values are already set based on peer's capability. Even in case of IBSS, its value is set to
1021 * correct value either in delBSS as part of deleting the previous IBSS or in start BSS as part of coalescing
1022 */
1023 if (val)
1024 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001025 pCapInfo->shortSlotTime = sessionEntry->shortSlotTimeSupported;
1026 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001027 }
1028
1029 // Spectrum Management bit
Sandeep Puligillac12a9682014-04-25 11:00:18 +05301030 if((eLIM_STA_IN_IBSS_ROLE != systemRole) && (eLIM_AP_ROLE != systemRole) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001031 sessionEntry->lim11hEnable )
1032 {
1033 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
1034 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -07001035 cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_11H_ENABLED failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001036 return eSIR_FAILURE;
1037 }
1038 if (val)
1039 pCapInfo->spectrumMgt = 1;
1040 }
1041
1042 // QoS bit
1043 if (wlan_cfgGetInt(pMac, WNI_CFG_QOS_ENABLED, &val) != eSIR_SUCCESS)
1044 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -07001045 cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_QOS_ENABLED failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001046 return eSIR_FAILURE;
1047 }
1048 if (val)
1049 pCapInfo->qos = 1;
1050
1051 // APSD bit
1052 if (wlan_cfgGetInt(pMac, WNI_CFG_APSD_ENABLED, &val) != eSIR_SUCCESS)
1053 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -07001054 cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_APSD_ENABLED failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001055 return eSIR_FAILURE;
1056 }
1057 if (val)
1058 pCapInfo->apsd = 1;
1059
1060#if defined WLAN_FEATURE_VOWIFI
1061 if ((limGetSystemRole(sessionEntry) == eLIM_STA_ROLE) )
1062 {
1063 if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
1064 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -07001065 cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_RRM_ENABLED failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001066 return eSIR_FAILURE;
1067 }
1068#if defined WLAN_VOWIFI_DEBUG
Padma, Santhosh Kumare4f9ade2016-03-21 13:34:49 +05301069 PELOGE(cfgLog( pMac, LOG1, "RRM = %d",val );)
Jeff Johnson295189b2012-06-20 16:38:30 -07001070#endif
1071 if (val)
1072 pCapInfo->rrm = 1;
1073 }
1074#endif
1075 //DSSS-OFDM
1076 //FIXME : no config defined yet.
1077
1078 // Block ack bit
1079 if (wlan_cfgGetInt(pMac, WNI_CFG_BLOCK_ACK_ENABLED, &val) != eSIR_SUCCESS)
1080 {
Kiran Kumar Lokereaf882c82013-03-18 16:07:05 -07001081 cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_BLOCK_ACK_ENABLED failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001082 return eSIR_FAILURE;
1083 }
1084 pCapInfo->delayedBA = (tANI_U16)((val >> WNI_CFG_BLOCK_ACK_ENABLED_DELAYED) & 1);
1085 pCapInfo->immediateBA = (tANI_U16)((val >> WNI_CFG_BLOCK_ACK_ENABLED_IMMEDIATE) & 1);
1086
1087 return eSIR_SUCCESS;
1088}
1089
1090// --------------------------------------------------------------------
1091/**
1092 * cfgSetCapabilityInfo
1093 *
1094 * FUNCTION:
1095 * This function is called on BP based on the capabilities
1096 * received in SME_JOIN/REASSOC_REQ message.
1097 *
1098 * LOGIC:
1099 *
1100 * ASSUMPTIONS:
1101 *
1102 * NOTE: 1. ESS/IBSS capabilities are based on system role.
1103 * 2. Since PBCC, Channel agility and Extended capabilities
1104 * are not supported, they're not set at CFG
1105 *
1106 * @param pMac Pointer to global MAC structure
1107 * @param caps 16-bit Capability Info field
1108 * @return None
1109 */
1110
1111void
1112cfgSetCapabilityInfo(tpAniSirGlobal pMac, tANI_U16 caps)
1113{
Jeff Johnson295189b2012-06-20 16:38:30 -07001114}
1115
1116
1117// ---------------------------------------------------------------------
1118/**
1119 * cfgCleanup()
1120 *
1121 * FUNCTION:
1122 * CFG cleanup function.
1123 *
1124 * LOGIC:
1125 *
1126 * ASSUMPTIONS:
1127 * None.
1128 *
1129 * NOTE:
1130 * This function must be called during system shutdown.
1131 *
1132 * @param None
1133 *
1134 * @return None.
1135 *
1136 */
1137
1138void
1139cfgCleanup(tpAniSirGlobal pMac)
1140{
1141 // Set status to not-ready
1142 pMac->cfg.gCfgStatus = CFG_INCOMPLETE;
1143
1144} /*** end CfgCleanup() ***/
1145
1146// ---------------------------------------------------------------------
1147/**
1148 * Notify()
1149 *
1150 * FUNCTION:
1151 * This function is called to notify other modules of parameter update.
1152 *
1153 * LOGIC:
1154 *
1155 * ASSUMPTIONS:
1156 *
1157 * NOTE:
1158 *
1159 * @param cfgId: configuration parameter ID
1160 * @param mask: notification mask
1161 *
1162 * @return None.
1163 *
1164 */
1165
1166static void
1167Notify(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 ntfMask)
1168{
1169
1170 tSirMsgQ mmhMsg;
1171
1172 mmhMsg.type = SIR_CFG_PARAM_UPDATE_IND;
1173 mmhMsg.bodyval = (tANI_U32)cfgId;
1174 mmhMsg.bodyptr = NULL;
1175
Jeff Johnsone7245742012-09-05 17:12:55 -07001176 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001177
1178 if ((ntfMask & CFG_CTL_NTF_SCH) != 0)
1179 schPostMessage(pMac, &mmhMsg);
1180
1181 if ((ntfMask & CFG_CTL_NTF_LIM) != 0)
1182 limPostMsgApi(pMac, &mmhMsg);
1183
1184 if ((ntfMask & CFG_CTL_NTF_HAL) != 0)
1185 wdaPostCtrlMsg(pMac, &mmhMsg);
1186
1187 // Notify ARQ
1188
1189} /*** end Notify() ***/
1190
1191// ---------------------------------------------------------------------
1192
1193
1194
1195
1196
1197
1198