blob: a98e214fab0319753a9a0a365571f22d371a7d32 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
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.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/*
43 * Airgo Networks, Inc proprietary. All rights reserved.
44 * This file limProcessCfgUpdates.cc contains the utility functions
45 * to handle various CFG parameter update events
46 * Author: Chandra Modumudi
47 * Date: 01/20/03
48 * History:-
49 * Date Modified by Modification Information
50 * --------------------------------------------------------------------
51 */
52
53#include "aniGlobal.h"
54
55#if (WNI_POLARIS_FW_PRODUCT == AP)
56#include "wniCfgAp.h"
57#else
58#include "wniCfgSta.h"
59#endif
60#include "sirMacProtDef.h"
61#include "cfgApi.h"
62#include "limTypes.h"
63#include "limUtils.h"
64#include "limPropExtsUtils.h"
65#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
66#include "halCommonApi.h"
67#endif
68#include "schApi.h"
69#include "pmmApi.h"
70#if defined WLAN_FEATURE_VOWIFI
71#include "rrmApi.h"
72#endif
73
74static void limUpdateConfig(tpAniSirGlobal pMac,tpPESession psessionEntry);
75
76#if 0
77/**
78 * limGetCfgIdOfDefaultKeyid()
79 *
80 *FUNCTION:
81 * This function is called to get CFG ID of default key id
82 *
83 *PARAMS:
84 *
85 *LOGIC:
86 *
87 *ASSUMPTIONS:
88 * NA
89 *
90 *NOTE:
91 * NA
92 *
93 * @param dkid - Value of default key id
94 * @return dkCfgId - CFG ID of key corresponding to default key Id
95 */
96
97static tANI_U32
98limGetCfgIdOfDefaultKeyid(tANI_U32 dkid)
99{
100 if (dkid == WNI_CFG_WEP_DEFAULT_KEYID_0)
101 return WNI_CFG_WEP_DEFAULT_KEY_1;
102 else if (dkid == WNI_CFG_WEP_DEFAULT_KEYID_1)
103 return WNI_CFG_WEP_DEFAULT_KEY_2;
104 else if (dkid == WNI_CFG_WEP_DEFAULT_KEYID_2)
105 return WNI_CFG_WEP_DEFAULT_KEY_3;
106 else // dkid == WNI_CFG_WEP_DEFAULT_KEYID_3
107 return WNI_CFG_WEP_DEFAULT_KEY_4;
108} /*** end limGetCfgIdOfDefaultKeyid() ***/
109#endif
110
111
112/**
113 * limSetDefaultKeyIdAndKeys()
114 *
115 *FUNCTION:
116 * This function is called while applying configuration
117 * during JOIN/REASSOC/START_BSS.
118 *
119 *PARAMS:
120 *
121 *LOGIC:
122 *
123 *ASSUMPTIONS:
124 * NA
125 *
126 *NOTE:
127 *
128 * @param pMac - Pointer to Global MAC structure
129 * @return None
130 */
131
132static void
133limSetDefaultKeyIdAndKeys(tpAniSirGlobal pMac)
134{
135#ifdef FIXME_GEN6
136 tANI_U32 val;
137 tANI_U32 dkCfgId;
138
139 PELOG1(limLog(pMac, LOG1, FL("Setting default keys at SP\n"));)
140
141 if (wlan_cfgGetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID,
142 &val) != eSIR_SUCCESS)
143 {
144 limLog(pMac, LOGP,
145 FL("Unable to retrieve defaultKeyId from CFG\n"));
146 }
147 dkCfgId = limGetCfgIdOfDefaultKeyid(val);
148#endif
149
150} /*** end limSetDefaultKeyIdAndKeys() ***/
151
Jeff Johnson295189b2012-06-20 16:38:30 -0700152/** -------------------------------------------------------------
153\fn limSetCfgProtection
154\brief sets lim global cfg cache from the config.
155\param tpAniSirGlobal pMac
156\return None
157 -------------------------------------------------------------*/
158#ifdef WLAN_SOFTAP_FEATURE
159void limSetCfgProtection(tpAniSirGlobal pMac, tpPESession pesessionEntry)
160#else
161void limSetCfgProtection(tpAniSirGlobal pMac)
162#endif
163{
164 tANI_U32 val = 0;
165
166#ifdef WLAN_SOFTAP_FEATURE
167 if(( pesessionEntry != NULL ) && (pesessionEntry->limSystemRole == eLIM_AP_ROLE )){
168 if (pesessionEntry->gLimProtectionControl == WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE )
169 palZeroMemory( pMac->hHdd, (void *)&pesessionEntry->cfgProtection , sizeof(tCfgProtection));
170 else{
171 limLog(pMac, LOG1, FL(" frm11a = %d, from11b = %d, frm11g = %d, "
172 "ht20 = %d, nongf = %d, lsigTxop = %d, "
173 "rifs = %d, obss = %d\n"),
174 pesessionEntry->cfgProtection.fromlla,
175 pesessionEntry->cfgProtection.fromllb,
176 pesessionEntry->cfgProtection.fromllg,
177 pesessionEntry->cfgProtection.ht20,
178 pesessionEntry->cfgProtection.nonGf,
179 pesessionEntry->cfgProtection.lsigTxop,
180 pesessionEntry->cfgProtection.rifs,
181 pesessionEntry->cfgProtection.obss);
182 }
183 }
184 else{
185#endif
186 if (wlan_cfgGetInt(pMac, WNI_CFG_FORCE_POLICY_PROTECTION, &val) != eSIR_SUCCESS)
187 {
188 limLog(pMac, LOGP, FL("reading WNI_CFG_FORCE_POLICY_PROTECTION cfg failed\n"));
189 return;
190 }
191 else
192 pMac->lim.gLimProtectionControl = (tANI_U8)val;
193
194 if (wlan_cfgGetInt(pMac, WNI_CFG_PROTECTION_ENABLED, &val) != eSIR_SUCCESS)
195 {
196 limLog(pMac, LOGP, FL("reading protection cfg failed\n"));
197 return;
198 }
199
200 if(pMac->lim.gLimProtectionControl == WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
201 palZeroMemory( pMac->hHdd, (void *)&pMac->lim.cfgProtection , sizeof(tCfgProtection));
202 else
203 {
204#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
205 {
206 pMac->lim.cfgProtection.overlapFromlla = (val >> WNI_CFG_PROTECTION_ENABLED_OLBC_FROM_llA) & 1;
207 pMac->lim.cfgProtection.overlapFromllb = (val >> WNI_CFG_PROTECTION_ENABLED_OLBC_FROM_llB) & 1;
208 pMac->lim.cfgProtection.overlapFromllg = (val >> WNI_CFG_PROTECTION_ENABLED_OLBC_FROM_llG) & 1;
209 pMac->lim.cfgProtection.overlapHt20 = (val >> WNI_CFG_PROTECTION_ENABLED_OLBC_HT20) & 1;
210 pMac->lim.cfgProtection.overlapNonGf = (val >> WNI_CFG_PROTECTION_ENABLED_OLBC_NON_GF) & 1;
211 pMac->lim.cfgProtection.overlapLsigTxop = (val >> WNI_CFG_PROTECTION_ENABLED_OLBC_LSIG_TXOP) & 1;
212 pMac->lim.cfgProtection.overlapRifs = (val >> WNI_CFG_PROTECTION_ENABLED_OLBC_RIFS) & 1;
213 pMac->lim.cfgProtection.overlapOBSS = (val>> WNI_CFG_PROTECTION_ENABLED_OLBC_OBSS )&1;
214
215 }
216 #endif
217 pMac->lim.cfgProtection.fromlla = (val >> WNI_CFG_PROTECTION_ENABLED_FROM_llA) & 1;
218 pMac->lim.cfgProtection.fromllb = (val >> WNI_CFG_PROTECTION_ENABLED_FROM_llB) & 1;
219 pMac->lim.cfgProtection.fromllg = (val >> WNI_CFG_PROTECTION_ENABLED_FROM_llG) & 1;
220 pMac->lim.cfgProtection.ht20 = (val >> WNI_CFG_PROTECTION_ENABLED_HT_20) & 1;
221 pMac->lim.cfgProtection.nonGf = (val >> WNI_CFG_PROTECTION_ENABLED_NON_GF) & 1;
222 pMac->lim.cfgProtection.lsigTxop = (val >> WNI_CFG_PROTECTION_ENABLED_LSIG_TXOP) & 1;
223 pMac->lim.cfgProtection.rifs = (val >> WNI_CFG_PROTECTION_ENABLED_RIFS) & 1;
224 pMac->lim.cfgProtection.obss= (val >> WNI_CFG_PROTECTION_ENABLED_OBSS) & 1;
225
226 }
227#ifdef WLAN_SOFTAP_FEATURE
228}
229#endif
230}
231
232
233
234/**
235 * limUpdateTriggerStaBkScanFlag
236 *
237 * FUNCTION:
238 * This function updates the lim global gLimTriggerBackgroundScanDuringQuietBss
239 * based on cfg configuration. Usually triggered after a cfgSetInt call.
240 *
241 * PARAMS:
242 * pMac - Pointer to Global MAC structure
243 *
244 */
245static tSirRetStatus limUpdateTriggerStaBkScanFlag(tpAniSirGlobal pMac)
246{
247 tANI_U32 val;
248 tANI_U8 flag;
249
250 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
251 {
252 PELOG1(limLog(pMac, LOG1, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN from cfg\n"));)
253 return eSIR_FAILURE;
254 }
255
256 flag = (val) ? 1 : 0;
257 if(flag != pMac->lim.gLimTriggerBackgroundScanDuringQuietBss)
258 {
259 /* Update global flag */
260 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = flag;
261 /*Update beacon prop IE also if we're an AP */
262
263 //call a wrapper and if the session role is other than the sta call this function schsetfixedbeacon fields function
264 limUpdateBeacon(pMac);
265
266 }
267
268 return eSIR_FAILURE;
269}
270
271
272/**
273 * limHandleCFGparamUpdate()
274 *
275 *FUNCTION:
276 * This function is called by limProcessMessages() to
277 * whenever SIR_CFG_PARAM_UPDATE_IND message is posted
278 * to LIM (due to a set operation on a CFG parameter).
279 *
280 *PARAMS:
281 *
282 *LOGIC:
283 *
284 *ASSUMPTIONS:
285 * NA
286 *
287 *NOTE:
288 *
289 * @param pMac - Pointer to Global MAC structure
290 * @param cfgId - ID of CFG parameter that got updated
291 * @return None
292 */
293
294void
295limHandleCFGparamUpdate(tpAniSirGlobal pMac, tANI_U32 cfgId)
296{
297 tANI_U32 val1, val2;
298 tANI_U16 val16;
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 tSirMacHTCapabilityInfo *pHTCapabilityInfo;
300 tSirMacHTParametersInfo *pAmpduParamInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700301
302 PELOG3(limLog(pMac, LOG3, FL("Handling CFG parameter id %X update\n"), cfgId);)
303 switch (cfgId)
304 {
305 case WNI_CFG_WEP_DEFAULT_KEYID:
306
307 // !!LAC - when the default KeyID is changed, force all of the
308 // keys and the keyID to be reprogrammed. this allows the
309 // keys to change after the initial setting of the keys when the CFG was
310 // applied at association time through CFG changes of the keys.
311 limSetDefaultKeyIdAndKeys( pMac );
312
313 break;
314
315 case WNI_CFG_EXCLUDE_UNENCRYPTED:
316 if (wlan_cfgGetInt(pMac, WNI_CFG_EXCLUDE_UNENCRYPTED,
317 &val1) != eSIR_SUCCESS)
318 {
319 limLog(pMac, LOGP,
320 FL("Unable to retrieve excludeUnencr from CFG\n"));
321 }
322#if 0
323 halSetSpExclUndecrypted(pMac, (tHalBitVal) val);
324#else
325 limLog(pMac, LOGE,
326 FL("Unsupported CFG: WNI_CFG_EXCLUDE_UNENCRYPTED\n"));
327#endif
328
329 break;
330
331 case WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT:
332 if (pMac->lim.gLimMlmState != eLIM_MLM_WT_ASSOC_RSP_STATE)
333 {
334 // 'Change' timer for future activations
335 limDeactivateAndChangeTimer(pMac,
336 eLIM_ASSOC_FAIL_TIMER);
337 }
338
339 break;
340
341#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA) || defined(ANI_AP_CLIENT_SDK)
342 case WNI_CFG_BACKGROUND_SCAN_PERIOD:
343
344
345 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
346
347 if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD, &val1) != eSIR_SUCCESS)
348 {
349 limLog(pMac, LOGP, FL("could not retrieve Background scan period value\n"));
350 break;
351 }
352 if (val1 == 0)
353 break;
354
355
356
357 if ( (pMac->lim.gLimSystemRole == eLIM_STA_ROLE) ||
358 ( (pMac->lim.gLimSystemRole == eLIM_STA_IN_IBSS_ROLE) &&
359 (pMac->lim.gLimSmeState == eLIM_SME_NORMAL_STATE)))
360 {
361 // Reactivate Background scan timer
Jeff Johnsone7245742012-09-05 17:12:55 -0700362 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700363 if (tx_timer_activate(
364 &pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
365 {
366 /// Could not activate background scan timer.
367 // Log error
368 limLog(pMac, LOGP,
369 FL("could not activate background scan timer\n"));
370 pMac->lim.gLimBackgroundScanStarted = FALSE;
371 pMac->lim.gLimBackgroundScanTerminate = TRUE;
372 }
373 else
374 {
375 pMac->lim.gLimBackgroundScanStarted = TRUE;
376 pMac->lim.gLimBackgroundScanTerminate = FALSE;
377 }
378
379 PELOG3(limLog(pMac, LOG3,
380 FL("Updated Background scan period\n"));)
381 }
382
383 break;
384#endif
385#if (WNI_POLARIS_FW_PRODUCT == AP)
386 case WNI_CFG_PREAUTH_CLNUP_TIMEOUT:
387 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
388 {
389 limDeactivateAndChangeTimer(pMac,
390 eLIM_PRE_AUTH_CLEANUP_TIMER);
391
392#ifdef GEN6_TODO
393 /* revisit this piece of code to assign the appropriate sessionId below
394 * priority - MEDIUM
395 */
396 pMac->lim.limTimers.gLimPreAuthClnupTimer.sessionId = sessionId;
397#endif
398 // Reactivate pre-auth cleanup timer
Jeff Johnsone7245742012-09-05 17:12:55 -0700399 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_PRE_AUTH_CLEANUP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 if (tx_timer_activate(&pMac->lim.limTimers.gLimPreAuthClnupTimer)
401 != TX_SUCCESS)
402 {
403 /// Could not activate pre-auth cleanup timer.
404 // Log error
405 limLog(pMac, LOGP,
406 FL("could not activate preauth cleanup timer\n"));
407 }
408 PELOG3(limLog(pMac, LOG3,
409 FL("Updated pre-auth cleanup timeout\n"));)
410 }
411
412 break;
413
414#endif
415
416 case WNI_CFG_BG_SCAN_CHANNEL_LIST:
417#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA) || defined(ANI_AP_CLIENT_SDK)
418 PELOG1(limLog(pMac, LOG1,
419 FL("VALID_CHANNEL_LIST has changed, reset next bg scan channel\n"));)
420 pMac->lim.gLimBackgroundScanChannelId = 0;
421#endif
422
423 break;
424
Jeff Johnson295189b2012-06-20 16:38:30 -0700425 case WNI_CFG_TRIG_STA_BK_SCAN:
426 if(limUpdateTriggerStaBkScanFlag(pMac) != eSIR_SUCCESS)
427 {
428 PELOG2(limLog(pMac, LOG2,
429 FL("Updating lim trigger sta bk scan global flag failed!\n"));)
430 }
431 break;
432
433 case WNI_CFG_PROTECTION_ENABLED:
434#ifdef WLAN_SOFTAP_FEATURE
435 limSetCfgProtection(pMac, NULL);
436#else
437 limSetCfgProtection(pMac);
438#endif
439 break;
440 case WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG:
441 {
442 tSirMsgQ msg = {0};
443 tANI_U32 status;
444
445 msg.type = SIR_LIM_UPDATE_BEACON;
446
447 status = limPostMsgApi(pMac, &msg);
448
449 if (status != TX_SUCCESS)
450 PELOGE(limLog(pMac, LOGE, FL("Failed limPostMsgApi\n"), status);)
451 break;
452 }
453 case WNI_CFG_GREENFIELD_CAPABILITY:
454 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
455 {
456 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap Info CFG\n"));)
457 break;
458 }
459 if (wlan_cfgGetInt(pMac, WNI_CFG_GREENFIELD_CAPABILITY, &val2) != eSIR_SUCCESS)
460 {
461 PELOGE(limLog(pMac, LOGE, FL("could not retrieve GreenField CFG\n"));)
462 break;
463 }
464 val16 = ( tANI_U16 ) val1;
465 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
466 pHTCapabilityInfo->greenField = (tANI_U16)val2;
467 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) != eSIR_SUCCESS)
468 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
469 break;
470
471 case WNI_CFG_HT_RX_STBC:
472 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
473 {
474 PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HT_CAP_INFO \n"));)
475 break;
476 }
477 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_RX_STBC, &val2) != eSIR_SUCCESS)
478 {
479 PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HT_RX_STBC\n"));)
480 break;
481 }
482 val16 = ( tANI_U16 ) val1;
483 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
484 pHTCapabilityInfo->rxSTBC = (tANI_U16)val2;
485 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) != eSIR_SUCCESS)
486 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
487 break;
488
489 case WNI_CFG_MAX_AMSDU_LENGTH:
490 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
491 {
492 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap Info CFG\n"));)
493 break;
494 }
495 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_AMSDU_LENGTH, &val2) != eSIR_SUCCESS)
496 {
497 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max AMSDU Length CFG\n"));)
498 break;
499 }
500 val16 = ( tANI_U16 ) val1;
501 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
502 pHTCapabilityInfo->maximalAMSDUsize = (tANI_U16)val2;
503 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) != eSIR_SUCCESS)
504 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
505 break;
506
507 case WNI_CFG_SHORT_GI_20MHZ:
508 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
509 {
510 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
511 break;
512 }
513 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val2) != eSIR_SUCCESS)
514 {
515 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz CFG\n"));)
516 break;
517 }
518 val16 = ( tANI_U16 ) val1;
519 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
520 pHTCapabilityInfo->shortGI20MHz = (tANI_U16)val2;
521 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) != eSIR_SUCCESS)
522 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
523 break;
524 case WNI_CFG_SHORT_GI_40MHZ:
525 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
526 {
527 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
528 break;
529 }
530 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val2) != eSIR_SUCCESS)
531 {
532 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz CFG\n"));)
533 break;
534 }
535 val16 = ( tANI_U16 ) val1;
536 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
537 pHTCapabilityInfo->shortGI40MHz = (tANI_U16)val2;
538 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) != eSIR_SUCCESS)
539 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
540 break;
541 case WNI_CFG_MPDU_DENSITY:
542 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
543 {
544 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG\n"));)
545 break;
546 }
547 if (wlan_cfgGetInt(pMac, WNI_CFG_MPDU_DENSITY, &val2) != eSIR_SUCCESS)
548 {
549 PELOGE(limLog(pMac, LOGE, FL("could not retrieve MPDU Density CFG\n"));)
550 break;
551 }
552 val16 = ( tANI_U16 ) val1;
553 pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
554 pAmpduParamInfo->mpduDensity = (tANI_U8)val2;
555 if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) != eSIR_SUCCESS)
556 PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG\n"));)
557
558 break;
559 case WNI_CFG_MAX_RX_AMPDU_FACTOR:
560 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
561 {
562 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG\n"));)
563 break;
564 }
565 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != eSIR_SUCCESS)
566 {
567 PELOGE(limLog(pMac, LOGE, FL("could not retrieve AMPDU Factor CFG\n"));)
568 break;
569 }
570 val16 = ( tANI_U16 ) val1;
571 pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
572 pAmpduParamInfo->maxRxAMPDUFactor = (tANI_U8)val2;
573 if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) != eSIR_SUCCESS)
574 PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG\n"));)
575 break;
576
577 case WNI_CFG_HEART_BEAT_THRESHOLD:
578 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) != eSIR_SUCCESS)
579 {
580 PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG\n"));)
581 break;
582 }
583 if(!val1)
584 {
585 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
586 pMac->sys.gSysEnableLinkMonitorMode = 0;
587 PELOGE(limLog(pMac, LOGE, "Deactivating heartbeat link monitoring\n");)
588 }
589 else
590 {
Madan Mohan Koyyalamudi49a7c0f2012-11-06 18:57:59 -0800591 tANI_U16 sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700592 pMac->sys.gSysEnableLinkMonitorMode = 1;
Srikant Kuppae6812eb2012-12-27 17:34:52 -0800593 PELOGE(limLog(pMac, LOGE, "Reactivating heartbeat link monitoring\n");)
Madan Mohan Koyyalamudi49a7c0f2012-11-06 18:57:59 -0800594 for(sessionId = 0; sessionId < pMac->lim.maxBssId; sessionId++)
595 {
596 if( (pMac->lim.gpSession[sessionId].valid )&&
597 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[sessionId].limMlmState) &&
Yathish9f22e662012-12-10 14:21:35 -0800598 ( pMac->pmm.gPmmState != ePMM_STATE_BMPS_SLEEP) &&
599 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Madan Mohan Koyyalamudi49a7c0f2012-11-06 18:57:59 -0800600 {
Srikant Kuppae6812eb2012-12-27 17:34:52 -0800601 PELOG2(limLog(pMac, LOG2, "HB link monitoring reactivated"
602 " for session=%d", sessionId);)
Madan Mohan Koyyalamudi49a7c0f2012-11-06 18:57:59 -0800603 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[sessionId]);
604 }
Srikant Kuppae6812eb2012-12-27 17:34:52 -0800605 else if ( pMac->lim.gpSession[sessionId].valid )
606 {
607 PELOG2(limLog(pMac, LOG2, "HB link monitoring not reactivated-"
608 "session=%d, limMlmState=%d, gPmmState=%d",
609 sessionId, pMac->lim.gpSession[sessionId].limMlmState,
610 pMac->pmm.gPmmState);)
611 }
Madan Mohan Koyyalamudi49a7c0f2012-11-06 18:57:59 -0800612 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700613 }
614 case WNI_CFG_MAX_PS_POLL:
615 case WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE:
616 case WNI_CFG_MIN_RSSI_THRESHOLD:
617 case WNI_CFG_NTH_BEACON_FILTER:
618 case WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE:
619 {
620 tpSirPowerSaveCfg pPowerSaveConfig;
621
622 /* Allocate and fill in power save configuration. */
623 if (palAllocateMemory(pMac->hHdd, (void **)&pPowerSaveConfig,
624 sizeof(tSirPowerSaveCfg)) != eHAL_STATUS_SUCCESS)
625 {
626 PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save configuration\n"));)
627 break;
628 }
629
630 /* This context should be valid if power-save configuration message has been already dispathed
631 * during initialization process. Re-using the present configuration mask
632 */
633 palCopyMemory(pMac->hHdd, pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg, sizeof(tSirPowerSaveCfg));
634
635 if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
636 {
637 PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed \n"));)
638 }
639 }
640 break;
641
642
643 case WNI_CFG_DOT11_MODE:
644 if (wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &val1) != eSIR_SUCCESS)
645 {
646 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Dot11 Mode CFG\n"));)
647 break;
648 }
649 /* TODO */
650 //psessionEntry->dot11mode = val1; //// un comment this line ...FORBUILD -TEMPFIX.. HOW TO GET sessionEntry?????
651 break;
652 case WNI_CFG_ADDBA_REQ_DECLINE:
653 if(wlan_cfgGetInt(pMac, WNI_CFG_ADDBA_REQ_DECLINE, &val1) != eSIR_SUCCESS) {
654 limLog( pMac, LOGE, FL( "Unable to get ADDBA_REQ_DECLINE cfg\n" ));
655 break;
656 }
657 pMac->lim.gAddBA_Declined = (tANI_U8)val1;
658 break;
659
660 case WNI_CFG_SCAN_IN_POWERSAVE:
661 if(wlan_cfgGetInt(pMac, WNI_CFG_SCAN_IN_POWERSAVE, &val1) != eSIR_SUCCESS) {
662 limLog( pMac, LOGE, FL( "Unable to get WNI_CFG_SCAN_IN_POWERSAVE \n" ));
663 break;
664 }
665 pMac->lim.gScanInPowersave = (tANI_U8)val1;
666 break;
667
668
669 case WNI_CFG_ASSOC_STA_LIMIT:
670 if(wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_STA_LIMIT, &val1) != eSIR_SUCCESS) {
671 limLog( pMac, LOGE, FL( "Unable to get WNI_CFG_ASSOC_STA_LIMIT" ));
672 break;
673 }
674 pMac->lim.gLimAssocStaLimit = (tANI_U16)val1;
675 break;
676
677 default:
678 break;
679 }
680} /*** end limHandleCFGparamUpdate() ***/
681
682
683
684/**
685 * limApplyConfiguration()
686 *
687 *FUNCTION:
688 * This function is called to apply the configured parameters
689 * before joining or reassociating with a BSS or starting a BSS.
690 *
691 *PARAMS:
692 *
693 *LOGIC:
694 *
695 *ASSUMPTIONS:
696 * NA
697 *
698 *NOTE:
699 *
700 * @param pMac - Pointer to Global MAC structure
701 * @return None
702 */
703
704void
705limApplyConfiguration(tpAniSirGlobal pMac,tpPESession psessionEntry)
706{
707 tANI_U32 val=0, phyMode;
708
709 PELOG2(limLog(pMac, LOG2, FL("Applying config\n"));)
710
711#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
712 limCleanupMeasResources(pMac);
713#endif
714 limInitWdsInfoParams(pMac);
715
716 psessionEntry->limSentCapsChangeNtf = false;
717
718 limGetPhyMode(pMac, &phyMode, psessionEntry);
719
720 // Set default keyId and keys
721 limSetDefaultKeyIdAndKeys(pMac);
722
723 limUpdateConfig(pMac,psessionEntry);
724
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -0700725 psessionEntry->shortSlotTimeSupported = limGetShortSlotFromPhyMode(pMac, psessionEntry, phyMode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700726
727#ifdef WLAN_SOFTAP_FEATURE
728 limSetCfgProtection(pMac, psessionEntry);
729#else
730 limSetCfgProtection(pMac);
731#endif
732
733
734 /* Added for BT - AMP Support */
735 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
736 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)||
737 (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)||
738 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) )
739 {
740 /* This check is required to ensure the beacon generation is not done
741 as a part of join request for a BT-AMP station */
742
743 if(psessionEntry->statypeForBss == STA_ENTRY_SELF)
744 {
745 PELOG1(limLog(pMac, LOG1, FL("Initializing BT-AMP beacon generation\n"));)
746 schSetBeaconInterval(pMac,psessionEntry);
747 schSetFixedBeaconFields(pMac,psessionEntry);
748 }
749 }
750
751 if (wlan_cfgGetInt(pMac, WNI_CFG_SCAN_IN_POWERSAVE, &val) != eSIR_SUCCESS)
752 {
753 limLog(pMac, LOGP, FL("could not retrieve WNI_CFG_SCAN_IN_POWERSAVE\n"));
754 return;
755 }
756 pMac->lim.gScanInPowersave = (tANI_U8) val;
757
758} /*** end limApplyConfiguration() ***/
759
760
761/**
762 * limUpdateConfig
763 *
764 * FUNCTION:
765 * Update the local state from CFG database
766 * (This used to be dphUpdateConfig)
767 *
768 * LOGIC:
769 *
770 * ASSUMPTIONS:
771 *
772 * NOTE:
773 *
774 * @param None
775 * @return None
776 */
777
778static void
779limUpdateConfig(tpAniSirGlobal pMac,tpPESession psessionEntry)
780{
781 tANI_U32 val;
782
783 #if 0
784 if (wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, pMac->lim.gLimMyMacAddr, &len) != eSIR_SUCCESS)
785 limLog(pMac, LOGP, FL("cfg get sta id failed\n"));
786 #endif //To SUPPORT BT-AMP
787 sirCopyMacAddr(pMac->lim.gLimMyMacAddr,psessionEntry->selfMacAddr);
788
789 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
790 limLog(pMac, LOGP, FL("cfg get short preamble failed\n"));
791 psessionEntry->beaconParams.fShortPreamble = (val) ? 1 : 0;
792
793 if (wlan_cfgGetInt(pMac, WNI_CFG_WME_ENABLED, &val) != eSIR_SUCCESS)
794 limLog(pMac, LOGP, FL("cfg get wme enabled failed\n"));
795 psessionEntry->limWmeEnabled = (val) ? 1 : 0;
796
797 if (wlan_cfgGetInt(pMac, WNI_CFG_WSM_ENABLED, &val) != eSIR_SUCCESS)
798 limLog(pMac, LOGP, FL("cfg get wsm enabled failed\n"));
799 psessionEntry->limWsmEnabled = (val) ? 1 : 0;
800
801 if ((! psessionEntry->limWmeEnabled) && (psessionEntry->limWsmEnabled))
802 {
803 PELOGE(limLog(pMac, LOGE, FL("Can't enable WSM without WME\n"));)
804 psessionEntry->limWsmEnabled = 0;
805 }
806
807 if (wlan_cfgGetInt(pMac, WNI_CFG_QOS_ENABLED, &val) != eSIR_SUCCESS)
808 limLog(pMac, LOGP, FL("cfg get qos enabled failed\n"));
809 psessionEntry->limQosEnabled = (val) ? 1 : 0;
810
811 if (wlan_cfgGetInt(pMac, WNI_CFG_HCF_ENABLED, &val) != eSIR_SUCCESS)
812 limLog(pMac, LOGP, FL("cfg get hcf enabled failed\n"));
813 psessionEntry->limHcfEnabled = (val) ? 1 : 0;
814
815 // Update the ADD BA Declined configuration
816 if(wlan_cfgGetInt(pMac, WNI_CFG_ADDBA_REQ_DECLINE, &val) != eSIR_SUCCESS)
817 limLog( pMac, LOGP, FL( "Unable to get ADDBA_REQ_DECLINE cfg\n" ));
818 pMac->lim.gAddBA_Declined = (val) ? 0xff : 0x0;
819
820 // AP: WSM should enable HCF as well, for STA enable WSM only after
821 // association response is received
822 if (psessionEntry->limWsmEnabled && psessionEntry->limSystemRole == eLIM_AP_ROLE)
823 psessionEntry->limHcfEnabled = 1;
824
825 if (wlan_cfgGetInt(pMac, WNI_CFG_11D_ENABLED, &val) != eSIR_SUCCESS)
826 limLog(pMac, LOGP, FL("cfg get 11d enabled failed\n"));
827 psessionEntry->lim11dEnabled = (val) ? 1 : 0;
828
829 if(wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_STA_LIMIT, &val) != eSIR_SUCCESS) {
830 limLog( pMac, LOGP, FL( "cfg get assoc sta limit failed" ));
831 }
832 pMac->lim.gLimAssocStaLimit = (tANI_U16)val;
833
834#if defined WLAN_FEATURE_VOWIFI
835 rrmUpdateConfig( pMac, psessionEntry );
836#endif
837 PELOG1(limLog(pMac, LOG1, FL("Updated Lim shadow state based on CFG\n"));)
838
839
840}
841
842