blob: dd105322ade039725118a1f1e7c84157418359de [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Jeff Johnson32d95a32012-09-10 13:15:23 -07002 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -07003 *
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
22/*
23 * Airgo Networks, Inc proprietary. All rights reserved.
24 * This file limAssocUtils.cc contains the utility functions
25 * LIM uses while processing (Re) Association messages.
26 * Author: Chandra Modumudi
27 * Date: 02/13/02
28 * History:-
29 * Date Modified by Modification Information
30 * --------------------------------------------------------------------
31 * 05/26/10 js WPA handling in (Re)Assoc frames
32 *
33 */
34
35#include "palTypes.h"
36#include "aniGlobal.h"
37#include "wniApi.h"
38#include "sirCommon.h"
39
40#if (WNI_POLARIS_FW_PRODUCT == AP)
41#include "wniCfgAp.h"
42#else
43#include "wniCfgSta.h"
44#endif
45#include "pmmApi.h"
46#include "cfgApi.h"
47
48#include "schApi.h"
49#include "utilsApi.h"
50#include "limUtils.h"
51#include "limAssocUtils.h"
52#include "limSecurityUtils.h"
53#include "limSerDesUtils.h"
54#include "limStaHashApi.h"
55#include "limAdmitControl.h"
56#include "limSendMessages.h"
57#include "limIbssPeerMgmt.h"
58#include "limSession.h"
59
60#include "vos_types.h"
61#include "wlan_qct_wda.h"
62
63/*
64 * fill up the rate info properly based on what is actually supported by the peer
65 * TBD TBD TBD
66 */
67void
68limFillSupportedRatesInfo(
69 tpAniSirGlobal pMac,
70 tpDphHashNode pSta,
71 tpSirSupportedRates pRates,
72 tpPESession psessionEntry)
73{
74 //pSta will be NULL for self entry, so get the opRateMode based on the self mode.
75 //For the peer entry get it from the peer Capabilities present in hash table
76 if(pSta == NULL)
77 pRates->opRateMode = limGetStaRateMode((tANI_U8)psessionEntry->dot11mode);
78 else
79 pRates->opRateMode = limGetStaPeerType(pMac, pSta, psessionEntry);
80
81}
82
83
84/**
85 * limCmpSSid()
86 *
87 *FUNCTION:
88 * This function is called in various places within LIM code
89 * to determine whether received SSid is same as SSID in use.
90 *
91 *LOGIC:
92 *
93 *ASSUMPTIONS:
94 * NA
95 *
96 *NOTE:
97 * NA
98 *
99 * @param *prxSSid - pointer to SSID structure
100 *
101 * @return status - true for SSID match else false.
102 */
103
104tANI_U8
105limCmpSSid(tpAniSirGlobal pMac, tSirMacSSid *prxSSid,tpPESession psessionEntry)
106{
107
108 if( palEqualMemory( pMac->hHdd, (tANI_U8* ) prxSSid, (tANI_U8 *) &psessionEntry->ssId,
109 (tANI_U8) (psessionEntry->ssId.length + 1)))
110 return true;
111 else
112 return false;
113
114} /****** end limCmpSSid() ******/
115
116
117
118/**
119 * limCompareCapabilities()
120 *
121 *FUNCTION:
122 * This function is called during Association/Reassociation
123 * frame handling to determine whether received capabilities
124 * match with local capabilities or not.
125 *
126 *LOGIC:
127 *
128 *ASSUMPTIONS:
129 * NA
130 *
131 *NOTE:
132 * NA
133 *
134 * @param pMac - Pointer to Global MAC structure
135 * @param pAssocReq - Pointer to received Assoc Req frame
136 * @param pLocalCapabs - Pointer to local capabilities
137 *
138 * @return status - true for Capabilitity match else false.
139 */
140
141tANI_U8
142limCompareCapabilities(tpAniSirGlobal pMac,
143 tSirAssocReq *pAssocReq,
144 tSirMacCapabilityInfo *pLocalCapabs,tpPESession psessionEntry)
145{
146 tANI_U32 val;
147
148
149 if ( ((psessionEntry->limSystemRole == eLIM_AP_ROLE)||
150 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
151 (pAssocReq->capabilityInfo.ibss) )
152 {
153 // Requesting STA asserting IBSS capability.
154 return false;
155 }
156
157 // Compare CF capabilities
158 if (pAssocReq->capabilityInfo.cfPollable ||
159 pAssocReq->capabilityInfo.cfPollReq)
160 {
161 // AP does not support PCF functionality
162 return false;
163 }
164
165#if 0 //See CR24696 for analysis
166 // Compare privacy capability
167 if (pAssocReq->capabilityInfo.privacy != pLocalCapabs->privacy)
168 {
169 // AP does not support privacy
170 return false;
171 }
172#endif
173
174 // Compare short preamble capability
175 if (pAssocReq->capabilityInfo.shortPreamble &&
176 (pAssocReq->capabilityInfo.shortPreamble !=
177 pLocalCapabs->shortPreamble))
178 {
179 PELOG1(limLog(pMac, LOG1,
180 FL("Allowing a STA requesting short preamble while AP does not support it\n"));)
181#if 0
182 // AP does not support short preamable
183 return false;
184#endif
185 }
186
187
188 limLog(pMac, LOGW, "QoS in AssocReq: %d, local ShortP: %d\n",
189 pAssocReq->capabilityInfo.qos,
190 pLocalCapabs->qos);
191
192 // Compare QoS capability
193 if (pAssocReq->capabilityInfo.qos &&
194 (pAssocReq->capabilityInfo.qos != pLocalCapabs->qos))
195 {
196 /*Temporary hack for UPF to skip 11e capability check in order to interop with
197 CSR - proper fix needs to be put in place*/
198 if ( 0 != vos_get_skip_11e_check())
199 {
200 limLog(pMac, LOG1, FL("Received unmatched QOS but cfg to suppress - continuing\n"));
201 }
202 else
203 {
204 // AP does not support QoS capability
205 return false;
206 }
207 }
208
209
210 /*
211 * If AP supports shortSlot and if apple user has
212 * enforced association only from shortSlot station,
213 * then AP must reject any station that does not support
214 * shortSlot
215 */
216 if ( ((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) && (pLocalCapabs->shortSlotTime == 1) )
217
218 {
219 if (wlan_cfgGetInt(pMac, WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY, &val) != eSIR_SUCCESS)
220 {
221 limLog(pMac, LOGP, FL("error getting WNI_CFG_FORCE_SHORT_SLOT_ASSOC_ONLY \n"));
222 return false;
223 }
224 if(val)
225 {
226 if (pAssocReq->capabilityInfo.shortSlotTime != pLocalCapabs->shortSlotTime)
227 return false;
228 }
229 }
230
231 return true;
232} /****** end limCompareCapabilities() ******/
233
234
235/**
236 * limCheckRxBasicRates()
237 *
238 *FUNCTION:
239 * This function is called during Association/Reassociation
240 * frame handling to determine whether received rates in
241 * Assoc/Reassoc request frames include all BSS basic rates
242 * or not.
243 *
244 *LOGIC:
245 *
246 *ASSUMPTIONS:
247 * NA
248 *
249 *NOTE:
250 * NA
251 *
252 * @param rxRateSet - pointer to SSID structure
253 *
254 * @return status - true if ALL BSS basic rates are present in the
255 * received rateset else false.
256 */
257
258tANI_U8
259limCheckRxBasicRates(tpAniSirGlobal pMac, tSirMacRateSet rxRateSet,tpPESession psessionEntry)
260{
261 tSirMacRateSet *pRateSet, basicRate;
262 tANI_U8 i, j, k, match;
263
264 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pRateSet, sizeof(tSirMacRateSet)))
265 {
266 // Log error
267 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for RATESET\n"));
268
269 return false;
270 }
271
272
273 #if 0
274 if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
275 (tANI_U8 *) &pRateSet->rate,
276 (tANI_U32 *) &cfgLen) != eSIR_SUCCESS)
277 {
278 /// Could not get Operational rateset from CFG. Log error.
279 limLog(pMac, LOGP, FL("could not retrieve Operational rateset\n"));
280
281 // Free up memory allocated for rateset
282 palFreeMemory( pMac->hHdd, (tANI_U8 *) pRateSet);
283
284 return false;
285 }
286 #endif //TO SUPPORT BT-AMP
287
288 /* Copy operational rate set from session Entry */
289 palCopyMemory(pMac->hHdd, pRateSet->rate, (psessionEntry->rateSet.rate), psessionEntry->rateSet.numRates);
290
291 pRateSet->numRates = psessionEntry->rateSet.numRates;
292
293 // Extract BSS basic rateset from operational rateset
294 for (i = 0, j = 0; i < pRateSet->numRates; i++)
295 {
296 if ((pRateSet->rate[i] & 0x80) == 0x80)
297 {
298 // msb is set, so this is a basic rate
299 basicRate.rate[j++] = pRateSet->rate[i];
300 }
301 }
302
303 /*
304 * For each BSS basic rate, find if it is present in the
305 * received rateset.
306 */
307 for (k = 0; k < j; k++)
308 {
309 match = 0;
310 for (i = 0; i < rxRateSet.numRates; i++)
311 {
312 if ((rxRateSet.rate[i] | 0x80) == basicRate.rate[k])
313 match = 1;
314 }
315
316 if (!match)
317 {
318 // Free up memory allocated for rateset
319 palFreeMemory( pMac->hHdd, (tANI_U8 *) pRateSet);
320
321 return false;
322 }
323 }
324
325 // Free up memory allocated for rateset
326 palFreeMemory( pMac->hHdd, (tANI_U8 *) pRateSet);
327
328 return true;
329} /****** end limCheckRxBasicRates() ******/
330
331
332
333/**
334 * limCheckMCSSet()
335 *
336 *FUNCTION:
337 * This function is called during Association/Reassociation
338 * frame handling to determine whether received MCS rates in
339 * Assoc/Reassoc request frames includes all Basic MCS Rate Set or not.
340 *
341 *LOGIC:
342 *
343 *ASSUMPTIONS:
344 * NA
345 *
346 *NOTE:
347 * NA
348 *
349 * @param supportedMCSSet - pointer to Supported MCS Rate Set
350 *
351 * @return status - true if ALL MCS Basic Rate Set rates are present in the
352 * received rateset else false.
353 */
354
355tANI_U8
356limCheckMCSSet(tpAniSirGlobal pMac, tANI_U8* supportedMCSSet)
357{
358 tANI_U8 basicMCSSet[SIZE_OF_BASIC_MCS_SET] = {0};
359 tANI_U32 cfgLen = 0;
360 tANI_U8 i;
361 tANI_U8 validBytes;
362 tANI_U8 lastByteMCSMask = 0x1f;
363
364
365 cfgLen = WNI_CFG_BASIC_MCS_SET_LEN;
366 if (wlan_cfgGetStr(pMac, WNI_CFG_BASIC_MCS_SET,
367 (tANI_U8 *) basicMCSSet,
368 (tANI_U32 *) &cfgLen) != eSIR_SUCCESS)
369 {
370 /// Could not get Basic MCS rateset from CFG. Log error.
371 limLog(pMac, LOGP, FL("could not retrieve Basic MCS rateset\n"));
372 return false;
373 }
374
375 validBytes = VALID_MCS_SIZE/8;
376
377 //check if all the Basic MCS Bits are set in supported MCS bitmap
378 for(i=0; i<validBytes; i++)
379 {
380 if( (basicMCSSet[i] & supportedMCSSet[i]) != basicMCSSet[i])
381 {
382 PELOGW(limLog(pMac, LOGW, FL("One of Basic MCS Set Rates is not supported by the Station."));)
383 return false;
384 }
385 }
386
387 //check the last 5 bits of the valid MCS bitmap
388 if( ((basicMCSSet[i] & lastByteMCSMask) & (supportedMCSSet[i] & lastByteMCSMask)) !=
389 (basicMCSSet[i] & lastByteMCSMask))
390 {
391 PELOGW(limLog(pMac, LOGW, FL("One of Basic MCS Set Rates is not supported by the Station."));)
392 return false;
393 }
394
395 return true;
396}
397
398#ifdef WLAN_SOFTAP_FEATURE
399
400#define SECURITY_SUITE_TYPE_MASK 0xFF
401#define SECURITY_SUITE_TYPE_WEP40 0x1
402#define SECURITY_SUITE_TYPE_TKIP 0x2
403#define SECURITY_SUITE_TYPE_CCMP 0x4
404#define SECURITY_SUITE_TYPE_WEP104 0x4
405
406/**
407 * limCheckRxRSNIeMatch()
408 *
409 *FUNCTION:
410 * This function is called during Association/Reassociation
411 * frame handling to determine whether received RSN in
412 * Assoc/Reassoc request frames include supported cipher suites or not.
413 *
414 *LOGIC:
415 *
416 *ASSUMPTIONS:
417 * NA
418 *
419 *NOTE:
420 * NA
421 *
422 * @param rxRSNIe - received RSN IE in (Re)Assco req
423 *
424 * @return status - true if ALL BSS basic rates are present in the
425 * received rateset else false.
426 */
427
428tANI_U8
429limCheckRxRSNIeMatch(tpAniSirGlobal pMac, tDot11fIERSN rxRSNIe,tpPESession pSessionEntry, tANI_U8 staIsHT)
430{
431 tDot11fIERSN *pRSNIe;
432 tANI_U8 i, j, match, onlyNonHtCipher = 1;
433
434
435 //RSN IE should be received from PE
436 pRSNIe = &pSessionEntry->gStartBssRSNIe;
437
438 // Check groupwise cipher suite
439 for (i = 0; i < sizeof(rxRSNIe.gp_cipher_suite); i++)
440 {
441 if (pRSNIe->gp_cipher_suite[i] != rxRSNIe.gp_cipher_suite[i])
442 {
443 return eSIR_MAC_INVALID_GROUP_CIPHER_STATUS;
444 }
445 }
446
447 /*
448 * For each Pairwise cipher suite check whether we support
449 * received pairwise
450 */
451 match = 0;
452 for (i = 0; i < rxRSNIe.pwise_cipher_suite_count; i++)
453 {
454 for(j = 0; j < pRSNIe->pwise_cipher_suite_count; j++)
455 {
456 if(palEqualMemory(pMac,&rxRSNIe.pwise_cipher_suites[i],
457 &pRSNIe->pwise_cipher_suites[j],
458 sizeof(pRSNIe->pwise_cipher_suites[j])))
459 {
460 match = 1;
461 break;
462 }
463 }
464
465 if ((staIsHT)
466#ifdef ANI_LITTLE_BYTE_ENDIAN
467 &&( (rxRSNIe.pwise_cipher_suites[i][3] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP))
468#else
469 &&( (rxRSNIe.pwise_cipher_suites[i][0] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP))
470#endif
471 {
472 onlyNonHtCipher=0;
473 }
474
475 }
476
477 if ((!match) || ((staIsHT) && onlyNonHtCipher))
478 {
479 return eSIR_MAC_INVALID_PAIRWISE_CIPHER_STATUS;
480 }
481 /* Check RSN capabilities */
482 if(rxRSNIe.preauth == true) //this is supported by AP only
483 {
484 return eSIR_MAC_INVALID_RSN_IE_CAPABILITIES_STATUS;
485 }
486
487 return eSIR_SUCCESS;
488} /****** end limCheckRxRSNIeMatch() ******/
489
490/**
491 * limCheckRxWPAIeMatch()
492 *
493 *FUNCTION:
494 * This function is called during Association/Reassociation
495 * frame handling to determine whether received RSN in
496 * Assoc/Reassoc request frames include supported cipher suites or not.
497 *
498 *LOGIC:
499 *
500 *ASSUMPTIONS:
501 * NA
502 *
503 *NOTE:
504 * NA
505 *
506 * @param rxWPAIe - Received WPA IE in (Re)Assco req
507 *
508 * @return status - true if ALL BSS basic rates are present in the
509 * received rateset else false.
510 */
511
512tANI_U8
513limCheckRxWPAIeMatch(tpAniSirGlobal pMac, tDot11fIEWPA rxWPAIe,tpPESession pSessionEntry, tANI_U8 staIsHT)
514{
515 tDot11fIEWPA *pWPAIe;
516 tANI_U8 i, j, match, onlyNonHtCipher = 1;
517
518 // WPA IE should be received from PE
519 pWPAIe = &pSessionEntry->gStartBssWPAIe;
520
521 // Check groupwise cipher suite
522 for (i = 0; i < 4; i++)
523 {
524 if (pWPAIe->multicast_cipher[i] != rxWPAIe.multicast_cipher[i])
525 {
526 return eSIR_MAC_INVALID_GROUP_CIPHER_STATUS;
527 }
528 }
529
530 /*
531 * For each Pairwise cipher suite check whether we support
532 * received pairwise
533 */
534 match = 0;
535 for (i = 0; i < rxWPAIe.unicast_cipher_count; i++)
536 {
537 for(j = 0; j < pWPAIe->unicast_cipher_count; j++)
538 {
539 if(palEqualMemory(pMac,rxWPAIe.unicast_ciphers[i],
540 pWPAIe->unicast_ciphers[j],
541 4))
542 {
543 match = 1;
544 break;
545 }
546 }
547
548 if ((staIsHT)
549#ifdef ANI_LITTLE_BYTE_ENDIAN
550 &&( (rxWPAIe.unicast_ciphers[i][3] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP))
551#else
552 &&( (rxWPAIe.unicast_ciphers[i][0] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP))
553#endif
554 {
555 onlyNonHtCipher=0;
556 }
557
558 }
559
560 if ((!match) || ((staIsHT) && onlyNonHtCipher))
561 {
562 return eSIR_MAC_CIPHER_SUITE_REJECTED_STATUS;
563 }
564
565 return eSIR_SUCCESS;
566} /****** end limCheckRxWPAIeMatch() ******/
567
568#endif /* WLAN_SOFTAP_FEATURE */
569
570/**
571 * limCleanupRxPath()
572 *
573 *FUNCTION:
574 * This function is called to cleanup STA state at SP & RFP.
575 *
576 *LOGIC:
577 * To circumvent RFP's handling of dummy packet when it does not
578 * have an incomplete packet for the STA to be deleted, a packet
579 * with 'more framgents' bit set will be queued to RFP's WQ before
580 * queuing 'dummy packet'.
581 * A 'dummy' BD is pushed into RFP's WQ with type=00, subtype=1010
582 * (Disassociation frame) and routing flags in BD set to eCPU's
583 * Low Priority WQ.
584 * RFP cleans up its local context for the STA id mentioned in the
585 * BD and then pushes BD to eCPU's low priority WQ.
586 *
587 *ASSUMPTIONS:
588 * NA
589 *
590 *NOTE:
591 * NA
592 *
593 * @param pMac Pointer to Global MAC structure
594 * @param pStaDs Pointer to the per STA data structure
595 * initialized by LIM and maintained at DPH
596 *
597 * @return None
598 */
599
600tSirRetStatus
601limCleanupRxPath(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
602{
603 tSirRetStatus retCode = eSIR_SUCCESS;
604
605
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700606 PELOG2(limLog( pMac, LOG2, FL("**Initiate cleanup"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700607
608 limAbortBackgroundScan( pMac );
609
610 if (pMac->lim.gLimAddtsSent)
611 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700612 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700613 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
614 }
615
616 if (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_ASSOC_CNF_STATE)
617 {
618 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER,
619 pStaDs->assocId);
620
621 if (!pStaDs->mlmStaContext.updateContext)
622 {
623 /**
624 * There is no context at Polaris to delete.
625 * Release our assigned AID back to the free pool
626 */
627 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
628 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
629 {
630 limReleaseAID(pMac, pStaDs->assocId);
631 }
632 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
633
634 return retCode;
635 }
636 }
637
638 //delete all tspecs associated with this sta.
639 limAdmitControlDeleteSta(pMac, pStaDs->assocId);
640
641#if (WNI_POLARIS_FW_PRODUCT==AP)
642 // Reset PMM state for this STA if it exists
643 if (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
644 pmmUpdatePMMode(pMac, pStaDs->assocId, 0);
645#endif
646
647 /**
648 * Make STA hash entry invalid at eCPU so that DPH
649 * does not process any more data packets and
650 * releases those BDs
651 */
652 pStaDs->valid = 0;
653 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
654
655 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
656 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700657 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700658 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700659 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 /* Deactivating probe after heart beat timer */
661 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
662 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
663 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
664 pMac->lim.gLastBeaconDtimCount = 0;
665 pMac->lim.gLastBeaconDtimPeriod = 0;
666
667#ifdef FEATURE_WLAN_CCX
668 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
669#endif
670
671 /**
672 * Update the status for PMM module
673 */
674 pmmResetPmmState(pMac);
675 }
676#ifdef WLAN_DEBUG
677 // increment a debug count
678 pMac->lim.gLimNumRxCleanup++;
679#endif
680
681 if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) {
682 retCode = limDelBss( pMac, pStaDs, psessionEntry->bssIdx, psessionEntry);
683 }
684 else
685 retCode = limDelSta( pMac, pStaDs, true, psessionEntry);
686
687 return retCode;
688
689} /*** end limCleanupRxPath() ***/
690
691
692/**
693 * limSendDelStaCnf()
694 *
695 *FUNCTION:
696 * This function is called to send appropriate CNF message to SME
697 *
698 *LOGIC:
699 *
700 *
701 *ASSUMPTIONS:
702 * NA
703 *
704 *NOTE:
705 * NA
706 *
707 * @param pMac Pointer to Global MAC structure
708 * @param tpAniSirGlobal pMac,
709 * @param tSirMacAddr staDsAddr,
710 * @param tANI_U16 staDsAssocId,
711 * @param tLimMlmStaContext mlmStaContext,
712 * @param tSirResultCodes statusCode
713 *
714 * @return None
715 */
716
717void
718limSendDelStaCnf(tpAniSirGlobal pMac, tSirMacAddr staDsAddr,
719 tANI_U16 staDsAssocId, tLimMlmStaContext mlmStaContext, tSirResultCodes statusCode,tpPESession psessionEntry)
720{
721
722 tLimMlmDisassocCnf mlmDisassocCnf;
723 tLimMlmDeauthCnf mlmDeauthCnf;
724 tLimMlmPurgeStaInd mlmPurgeStaInd;
725
726 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
727 {
728 // Set BSSID at CFG to null
729 tSirMacAddr nullAddr = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
730 #if 0
731 if (cfgSetStr(pMac, WNI_CFG_BSSID, (tANI_U8 *) &nullAddr,
732 sizeof(tSirMacAddr)) != eSIR_SUCCESS)
733 {
734 /// Could not update BSSID at CFG. Log error.
735 limLog(pMac, LOGP, FL("could not update BSSID at CFG\n"));
736
737 return;
738 }
739 #endif//TO SUPPORT BT-AMP
740
741 sirCopyMacAddr(nullAddr,psessionEntry->bssId);
742
743 // Free up buffer allocated for JoinReq held by
744 // MLM state machine
745 if (psessionEntry->pLimMlmJoinReq)
746 {
747 palFreeMemory( pMac->hHdd, (tANI_U8 *) psessionEntry->pLimMlmJoinReq);
748 psessionEntry->pLimMlmJoinReq = NULL;
749 }
750
751 psessionEntry->limAID = 0;
752
753
754 }
755
756 if ((mlmStaContext.cleanupTrigger ==
757 eLIM_HOST_DISASSOC) ||
758 (mlmStaContext.cleanupTrigger ==
759 eLIM_LINK_MONITORING_DISASSOC) ||
760 (mlmStaContext.cleanupTrigger ==
761 eLIM_PROMISCUOUS_MODE_DISASSOC))
762 {
763 /**
764 * Host or LMM driven Disassociation.
765 * Issue Disassoc Confirm to SME.
766 */
767 limLog( pMac, LOGW, FL("Lim Posting DISASSOC_CNF to Sme. Trigger: %X\n"), mlmStaContext.cleanupTrigger);
768
769
770 palCopyMemory( pMac->hHdd,
771 (tANI_U8 *) &mlmDisassocCnf.peerMacAddr,
772 (tANI_U8 *) staDsAddr,
773 sizeof(tSirMacAddr));
774 mlmDisassocCnf.resultCode = statusCode;
775#if (WNI_POLARIS_FW_PRODUCT == AP)
776 mlmDisassocCnf.aid = staDsAssocId;
777#endif
778 mlmDisassocCnf.disassocTrigger =
779 mlmStaContext.cleanupTrigger;
780 /* Update PE session Id*/
781 mlmDisassocCnf.sessionId = psessionEntry->peSessionId;
782
783 limPostSmeMessage(pMac,
784 LIM_MLM_DISASSOC_CNF,
785 (tANI_U32 *) &mlmDisassocCnf);
786 }
787 else if ((mlmStaContext.cleanupTrigger ==
788 eLIM_HOST_DEAUTH) ||
789 (mlmStaContext.cleanupTrigger ==
790 eLIM_LINK_MONITORING_DEAUTH))
791 {
792 /**
793 * Host or LMM driven Deauthentication.
794 * Issue Deauth Confirm to SME.
795 */
796 limLog( pMac, LOGW, FL("Lim Posting DEAUTH_CNF to Sme. Trigger: %X\n"), mlmStaContext.cleanupTrigger);
797 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthCnf.peerMacAddr,
798 (tANI_U8 *) staDsAddr,
799 sizeof(tSirMacAddr));
800 mlmDeauthCnf.resultCode = statusCode;
801#if (WNI_POLARIS_FW_PRODUCT == AP)
802 mlmDeauthCnf.aid = staDsAssocId;
803#endif
804 mlmDeauthCnf.deauthTrigger =
805 mlmStaContext.cleanupTrigger;
806 /* PE session Id */
807 mlmDeauthCnf.sessionId = psessionEntry->peSessionId;
808
809 limPostSmeMessage(pMac,
810 LIM_MLM_DEAUTH_CNF,
811 (tANI_U32 *) &mlmDeauthCnf);
812 }
813 else if ((mlmStaContext.cleanupTrigger ==
814 eLIM_PEER_ENTITY_DISASSOC) ||
815 (mlmStaContext.cleanupTrigger ==
816 eLIM_PEER_ENTITY_DEAUTH))
817 {
818 /**
819 * Received Disassociation/Deauthentication from peer.
820 * Issue Purge Ind to SME.
821 */
822 limLog( pMac, LOGW, FL("Lim Posting PURGE_STA_IND to Sme. Trigger: %X\n"), mlmStaContext.cleanupTrigger) ;
823 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmPurgeStaInd.peerMacAddr,
824 (tANI_U8 *) staDsAddr,
825 sizeof(tSirMacAddr));
826 mlmPurgeStaInd.reasonCode = (tANI_U8) mlmStaContext.disassocReason;
827 mlmPurgeStaInd.aid = staDsAssocId;
828 mlmPurgeStaInd.purgeTrigger = mlmStaContext.cleanupTrigger;
829 mlmPurgeStaInd.sessionId = psessionEntry->peSessionId;
830
831 limPostSmeMessage(pMac,
832 LIM_MLM_PURGE_STA_IND,
833 (tANI_U32 *) &mlmPurgeStaInd);
834 }
835 else if(mlmStaContext.cleanupTrigger == eLIM_JOIN_FAILURE)
836 {
837 //PE setup the peer entry in HW upfront, right after join is completed.
838 //If there is a failure during rest of the assoc sequence, this context needs to be cleaned up.
839 tANI_U8 smesessionId;
840 tANI_U16 smetransactionId;
841
842 smesessionId = psessionEntry->smeSessionId;
843 smetransactionId = psessionEntry->transactionId;
844
845 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700846 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700847
Jeff Johnsone7245742012-09-05 17:12:55 -0700848 //if it is a reassoc failure to join new AP
849 if(mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE)
850 {
851 if(mlmStaContext.resultCode != eSIR_SME_SUCCESS )
852 {
853 peDeleteSession(pMac, psessionEntry);
854 psessionEntry = NULL;
855 }
856
857 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
858 mlmStaContext.resultCode, mlmStaContext.protStatusCode, psessionEntry,
859 smesessionId, smetransactionId);
860 }
861 else
862 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700863 palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq);
864 psessionEntry->pLimJoinReq = NULL;
865
866 if(mlmStaContext.resultCode != eSIR_SME_SUCCESS)
867 {
868 peDeleteSession(pMac,psessionEntry);
869 psessionEntry = NULL;
870 }
871
872 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, mlmStaContext.resultCode, mlmStaContext.protStatusCode,
873 psessionEntry, smesessionId, smetransactionId);
Jeff Johnsone7245742012-09-05 17:12:55 -0700874 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700875
876 }
877
878 if((NULL != psessionEntry)
879#ifdef WLAN_SOFTAP_FEATURE
880 && (eLIM_AP_ROLE != psessionEntry->limSystemRole )
881#endif
882 )
883 {
884 peDeleteSession(pMac,psessionEntry);
885 psessionEntry = NULL;
886 }
887}
888
889/**
890 * limRejectAssociation()
891 *
892 *FUNCTION:
893 * This function is called whenever Re/Association Request need
894 * to be rejected due to failure in assigning an AID or failure
895 * in adding STA context at Polaris or reject by applications.
896 *
897 *LOGIC:
898 * Resources allocated if any are freedup and (Re) Association
899 * Response frame is sent to requesting STA. Pre-Auth context
900 * will be added for this STA if it does not exist already
901 *
902 *ASSUMPTIONS:
903 *
904 *NOTE:
905 *
906 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
907 * @param subType - Indicates whether it is Association Request (=0) or
908 * Reassociation Request (=1) frame
909 * @param addPreAuthContext - Indicates whether pre-auth context
910 * to be added for this STA
911 * @param authType - Indicates auth type to be added
912 * @param staId - Indicates staId of the STA being rejected
913 * association
914 * @param deleteSta - Indicates whether to delete STA context
915 * at Polaris
916 * @param rCode - Indicates what reasonCode to be sent in
917 * Re/Assoc response to STA
918 *
919 * @return None
920 */
921
922void
923limRejectAssociation(tpAniSirGlobal pMac, tSirMacAddr peerAddr, tANI_U8 subType,
924 tANI_U8 addPreAuthContext, tAniAuthType authType,
925 tANI_U16 staId, tANI_U8 deleteSta, tSirResultCodes rCode, tpPESession psessionEntry )
926{
927 tpDphHashNode pStaDs;
928
929 if (addPreAuthContext)
930 {
931 // Create entry for this STA in pre-auth list
932 struct tLimPreAuthNode *pAuthNode;
933
934 pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable);
935
936 if (pAuthNode)
937 {
938 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAuthNode->peerMacAddr,
939 peerAddr,
940 sizeof(tSirMacAddr));
941 pAuthNode->fTimerStarted = 0;
942 pAuthNode->mlmState = eLIM_MLM_AUTHENTICATED_STATE;
943 pAuthNode->authType = (tAniAuthType) authType;
944 limAddPreAuthNode(pMac, pAuthNode);
945 }
946 }
947
948 if (deleteSta == true)
949 {
950 pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable);
951
952 if (pStaDs == NULL)
953 {
954 limLog(pMac, LOGW,
955 FL("No STA context, yet rejecting Association\n"));
956
957 return;
958 }
959
960 /**
961 * Polaris has state for this STA.
962 * Trigger cleanup.
963 */
964 pStaDs->mlmStaContext.cleanupTrigger = eLIM_REASSOC_REJECT;
965
966 // Receive path cleanup
967 limCleanupRxPath(pMac, pStaDs, psessionEntry);
968
969 // Send Re/Association Response with
970 // status code to requesting STA.
971 limSendAssocRspMgmtFrame(pMac,
972 rCode,
973 0,
974 peerAddr,
975 subType, 0,psessionEntry);
976
977 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL)
978 {
979 // Assoction confirmation is complete, free the copy of association request frame
980 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
981 {
982 palFreeMemory(pMac->hHdd,((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
983 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
984 }
985 palFreeMemory(pMac->hHdd, psessionEntry->parsedAssocReq[pStaDs->assocId]);
986 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
987 }
988 }
989 else
990 {
991 limSendAssocRspMgmtFrame(pMac,
992 eSIR_MAC_MAX_ASSOC_STA_REACHED_STATUS,
993 1,
994 peerAddr,
995 subType, 0,psessionEntry);
996 // Log error
997 limLog(pMac, LOGW,
998 FL("received Re/Assoc req when max associated STAs reached from \n"));
999 limPrintMacAddr(pMac, peerAddr, LOGW);
1000 limSendSmeMaxAssocExceededNtf(pMac, peerAddr, psessionEntry->smeSessionId);
1001 }
1002} /*** end limRejectAssociation() ***/
1003
1004#ifdef WLAN_SOFTAP_FEATURE
1005
1006/** -------------------------------------------------------------
1007\fn limDecideApProtectionOnHt20Delete
1008\brief protection related function while HT20 station is getting deleted.
1009\param tpAniSirGlobal pMac
1010\param tpDphHashNode pStaDs
1011\param tpUpdateBeaconParams pBeaconParams
1012\return None
1013 -------------------------------------------------------------*/
1014static void
1015limDecideApProtectionOnHt20Delete(tpAniSirGlobal pMac,
1016 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1017{
1018 tANI_U32 i = 0;
1019 PELOG1( limLog(pMac, LOG1, FL("(%d) A HT 20 STA is disassociated. Addr is "),
1020 psessionEntry->gLimHt20Params.numSta);
1021 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1022 if (psessionEntry->gLimHt20Params.numSta > 0)
1023 {
1024 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1025 {
1026 if (psessionEntry->protStaCache[i].active)
1027 {
1028 if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
1029 pStaDs->staAddr, sizeof(tSirMacAddr)))
1030 {
1031 psessionEntry->gLimHt20Params.numSta--;
1032 psessionEntry->protStaCache[i].active = false;
1033 break;
1034 }
1035 }
1036 }
1037 }
1038
1039 if (psessionEntry->gLimHt20Params.numSta == 0)
1040 {
1041 // disable protection
1042 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
1043 }
1044}
1045/** -------------------------------------------------------------
1046\fn limDecideApProtectionOnDelete
1047\brief Decides about protection related settings when a station is getting deleted.
1048\param tpAniSirGlobal pMac
1049\param tpDphHashNode pStaDs
1050\param tpUpdateBeaconParams pBeaconParams
1051\return None
1052 -------------------------------------------------------------*/
1053void
1054limDecideApProtectionOnDelete(tpAniSirGlobal pMac,
1055 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1056{
1057 tANI_U32 phyMode;
1058 tHalBitVal erpEnabled = eHAL_CLEAR;
1059 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1060 tANI_U32 i;
1061
1062 if(NULL == pStaDs)
1063 return;
1064
1065 limGetRfBand(pMac, &rfBand, psessionEntry);
1066 if(SIR_BAND_5_GHZ == rfBand)
1067 {
1068 //we are HT. if we are 11A, then protection is not required.
Jeff Johnsone7245742012-09-05 17:12:55 -07001069 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001070 {
1071 //we are HT and 11A station is leaving.
1072 //protection consideration required.
1073 //HT station leaving ==> this case is commonly handled between both the bands below.
1074 if((psessionEntry->beaconParams.llaCoexist) &&
1075 (false == pStaDs->mlmStaContext.htCapability))
1076 {
1077 PELOG1(limLog(pMac, LOG1, FL("(%d) A 11A STA is disassociated. Addr is "),
1078 psessionEntry->gLim11aParams.numSta);
1079 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1080 if (psessionEntry->gLim11aParams.numSta > 0)
1081 {
1082 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1083 {
1084 if (psessionEntry->protStaCache[i].active)
1085 {
1086 if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
1087 pStaDs->staAddr, sizeof(tSirMacAddr)))
1088 {
1089 psessionEntry->gLim11aParams.numSta--;
1090 psessionEntry->protStaCache[i].active = false;
1091 break;
1092 }
1093 }
1094 }
1095 }
1096
1097 if(psessionEntry->gLim11aParams.numSta == 0)
1098 {
1099 // disable protection
1100 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
1101 }
1102 }
1103 }
1104 }
1105 else if(SIR_BAND_2_4_GHZ == rfBand)
1106 {
1107 limGetPhyMode(pMac, &phyMode, psessionEntry);
1108
1109 erpEnabled = pStaDs->erpEnabled;
1110 //we are HT or 11G and 11B station is getting deleted.
1111 if (((phyMode == WNI_CFG_PHY_MODE_11G) ||
Jeff Johnsone7245742012-09-05 17:12:55 -07001112 psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001113 (erpEnabled == eHAL_CLEAR))
1114 {
1115 PELOG1(limLog(pMac, LOG1, FL("(%d) A legacy STA is disassociated. Addr is "),
1116 psessionEntry->gLim11bParams.numSta);
1117 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1118 if (psessionEntry->gLim11bParams.numSta > 0)
1119 {
1120 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1121 {
1122 if (psessionEntry->protStaCache[i].active)
1123 {
1124 if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
1125 pStaDs->staAddr, sizeof(tSirMacAddr)))
1126 {
1127 psessionEntry->gLim11bParams.numSta--;
1128 psessionEntry->protStaCache[i].active = false;
1129 break;
1130 }
1131 }
1132 }
1133 }
1134
1135 if (psessionEntry->gLim11bParams.numSta == 0)
1136 {
1137 // disable protection
1138 PELOG1(limLog(pMac, LOG1, FL("No 11B STA exists\n"));)
1139 limEnable11gProtection(pMac, false, false, pBeaconParams,psessionEntry);
1140 }
1141 }
1142 //(non-11B station is leaving) or (we are not 11G or HT AP)
Jeff Johnsone7245742012-09-05 17:12:55 -07001143 else if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001144 { //we are HT AP and non-11B station is leaving.
1145
1146 //11g station is leaving
1147 if(!pStaDs->mlmStaContext.htCapability)
1148 {
1149 PELOG1(limLog(pMac, LOG1, FL("(%d) A 11g STA is disassociated. Addr is "),
1150 psessionEntry->gLim11bParams.numSta);
1151 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1152 if (psessionEntry->gLim11gParams.numSta > 0)
1153 {
1154 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1155 {
1156 if (psessionEntry->protStaCache[i].active)
1157 {
1158 if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
1159 pStaDs->staAddr, sizeof(tSirMacAddr)))
1160 {
1161 psessionEntry->gLim11gParams.numSta--;
1162 psessionEntry->protStaCache[i].active = false;
1163 break;
1164 }
1165 }
1166 }
1167 }
1168
1169 if (psessionEntry->gLim11gParams.numSta == 0)
1170 {
1171 // disable protection
1172 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
1173 }
1174 }
1175 }
1176 }
1177
1178 //LSIG TXOP not supporting staiton leaving. applies to 2.4 as well as 5 GHZ.
Jeff Johnsone7245742012-09-05 17:12:55 -07001179 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 (true == pStaDs->mlmStaContext.htCapability))
1181 {
1182 //HT non-GF leaving
1183 if(!pStaDs->htGreenfield)
1184 {
1185 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-GF STA is disassociated. Addr is "),
1186 psessionEntry->gLimNonGfParams.numSta);
1187 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1188 if (psessionEntry->gLimNonGfParams.numSta > 0)
1189 {
1190 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1191 {
1192 if (psessionEntry->protStaCache[i].active)
1193 {
1194 if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
1195 pStaDs->staAddr, sizeof(tSirMacAddr)))
1196 {
1197 psessionEntry->gLimNonGfParams.numSta--;
1198 psessionEntry->protStaCache[i].active = false;
1199 break;
1200 }
1201 }
1202 }
1203 }
1204
1205 if (psessionEntry->gLimNonGfParams.numSta == 0)
1206 {
1207 // disable protection
1208 limEnableHTNonGfProtection(pMac, false, false, pBeaconParams,psessionEntry);
1209 }
1210 }
1211 //HT 20Mhz station leaving.
1212 if(psessionEntry->beaconParams.ht20Coexist &&
1213 (eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet))
1214 {
1215 limDecideApProtectionOnHt20Delete(pMac, pStaDs, pBeaconParams,psessionEntry);
1216 }
1217
1218 if(false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport &&
1219 (false == pStaDs->htLsigTXOPProtection))
1220 {
1221 PELOG1( limLog(pMac, LOG1, FL("(%d) A HT LSIG not supporting STA is disassociated. Addr is "),
1222 psessionEntry->gLimLsigTxopParams.numSta);
1223 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1224 if (psessionEntry->gLimLsigTxopParams.numSta > 0)
1225 {
1226 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1227 {
1228 if (psessionEntry->protStaCache[i].active)
1229 {
1230 if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
1231 pStaDs->staAddr, sizeof(tSirMacAddr)))
1232 {
1233 psessionEntry->gLimLsigTxopParams.numSta--;
1234 psessionEntry->protStaCache[i].active = false;
1235 break;
1236 }
1237 }
1238 }
1239 }
1240
1241 if (psessionEntry->gLimLsigTxopParams.numSta == 0)
1242 {
1243 // disable protection
1244 limEnableHTLsigTxopProtection(pMac, true, false, pBeaconParams,psessionEntry);
1245 }
1246 }
1247 }
1248}
1249
1250#endif
1251
1252
1253/** -------------------------------------------------------------
1254\fn limDecideShortPreamble
1255\brief Decides about any short preamble reated change because of new station joining.
1256\param tpAniSirGlobal pMac
1257\param tpDphHashNode pStaDs
1258\param tpUpdateBeaconParams pBeaconParams
1259\return None
1260 -------------------------------------------------------------*/
1261void limDecideShortPreamble(tpAniSirGlobal pMac,
1262 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry )
1263{
1264 tANI_U32 i;
1265
1266 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
1267 {
1268 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-short preamble STA is disassociated. Addr is "),
1269 psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
1270 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1271 if (psessionEntry->gLimNoShortParams.numNonShortPreambleSta > 0)
1272 {
1273 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1274 {
1275 if (psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
1276 {
1277 if (palEqualMemory( pMac->hHdd, psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
1278 pStaDs->staAddr, sizeof(tSirMacAddr)))
1279 {
1280 psessionEntry->gLimNoShortParams.numNonShortPreambleSta--;
1281 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = false;
1282 break;
1283 }
1284 }
1285 }
1286 }
1287
1288 if (psessionEntry->gLimNoShortParams.numNonShortPreambleSta == 0)
1289 {
1290 // enable short preamble
1291 PELOG1(limLog(pMac, LOG1, FL("All associated STAs have short preamble support now.\n"));)
1292 //reset the cache
1293 palZeroMemory( pMac->hHdd, (tANI_U8 *)&psessionEntry->gLimNoShortParams , sizeof(tLimNoShortParams));
1294 if (limEnableShortPreamble(pMac, true, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
1295 PELOGE(limLog(pMac, LOGE, FL("Cannot enable short preamble\n"));)
1296 }
1297 }
1298}
1299
1300/** -------------------------------------------------------------
1301\fn limDecideShortSlot
1302\brief Decides about any short slot time related change because of station leaving the BSS.
1303\param tpAniSirGlobal pMac
1304\param tpDphHashNode pStaDs
1305\return None
1306 -------------------------------------------------------------*/
1307
1308void
1309limDecideShortSlot(tpAniSirGlobal pMac, tpDphHashNode pStaDs,
1310 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
1311{
1312 tANI_U32 i, val;
1313 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
1314 {
1315 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-short slottime STA is disassociated. Addr is "),
1316 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
1317 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1318
1319#ifdef WLAN_SOFTAP_FEATURE
1320 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
1321 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta> 0)
1322 {
1323 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1324 {
1325 if (psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
1326 {
1327 if (palEqualMemory( pMac->hHdd, psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
1328 pStaDs->staAddr, sizeof(tSirMacAddr)))
1329 {
1330 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta--;
1331 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = false;
1332 break;
1333 }
1334 }
1335 }
1336 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001337 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001338#endif
1339 {
1340 if (pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta> 0)
1341 {
1342 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1343 {
1344 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
1345 {
1346 if (palEqualMemory( pMac->hHdd, pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
1347 pStaDs->staAddr, sizeof(tSirMacAddr)))
1348 {
1349 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta--;
1350 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = false;
1351 break;
1352 }
1353 }
1354 }
1355 }
1356 }
1357
1358 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
1359
1360#ifdef WLAN_SOFTAP_FEATURE
1361 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
1362 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta == 0))
1363 {
1364 // enable short slot time
1365 PELOG1(limLog(pMac, LOG1, FL("All associated STAs have short slot time support now.\n"));)
1366 //reset the cache
1367 palZeroMemory( pMac->hHdd, (tANI_U8 *)&psessionEntry->gLimNoShortSlotParams , sizeof(tLimNoShortSlotParams));
1368 // in case of AP set SHORT_SLOT_TIME to enable
1369 if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
1370 {
1371 pBeaconParams->fShortSlotTime = true;
1372 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnsone7245742012-09-05 17:12:55 -07001373 psessionEntry->shortSlotTimeSupported = true;
Jeff Johnson295189b2012-06-20 16:38:30 -07001374 }
1375 }
1376 else
1377#endif
1378 {
1379 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta == 0)
1380 {
1381 // enable short slot time
1382 PELOG1(limLog(pMac, LOG1, FL("All associated STAs have short slot time support now.\n"));)
1383 //reset the cache
1384 palZeroMemory( pMac->hHdd, (tANI_U8 *)&pMac->lim.gLimNoShortSlotParams , sizeof(tLimNoShortSlotParams));
1385 // in case of AP set SHORT_SLOT_TIME to enable
1386 if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
1387 {
1388 pBeaconParams->fShortSlotTime = true;
1389 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnsone7245742012-09-05 17:12:55 -07001390 psessionEntry->shortSlotTimeSupported = true;
1391 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001392 }
1393 }
1394 }
1395}
1396
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -07001397void
1398limPostReassocFailure(tpAniSirGlobal pMac,
1399 tSirResultCodes resultCode,
1400 tANI_U16 protStatusCode,tpPESession psessionEntry)
1401{
1402 tLimMlmReassocCnf mlmReassocCnf;
1403
1404 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
1405 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE));
1406
1407 // 'Change' timer for future activations
1408 limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
1409
1410 mlmReassocCnf.resultCode = resultCode;
1411 mlmReassocCnf.protStatusCode = protStatusCode;
1412 /* Update PE session Id */
1413 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
1414 limPostSmeMessage(pMac,
1415 LIM_MLM_REASSOC_CNF,
1416 (tANI_U32 *) &mlmReassocCnf);
1417} /*** end limPostReassocFailure() ***/
1418
Jeff Johnson295189b2012-06-20 16:38:30 -07001419/**
1420 * limRestorePreReassocState()
1421 *
1422 *FUNCTION:
1423 * This function is called on STA role whenever Reasociation
1424 * Response with a reject code is received from AP.
1425 *
1426 *LOGIC:
1427 * Reassociation failure timer is stopped, Old (or current) AP's
1428 * context is restored both at Polaris & software
1429 *
1430 *ASSUMPTIONS:
1431 *
1432 *NOTE:
1433 *
1434 * @param pMac - Pointer to Global MAC structure
1435 * @param resultCode - Result code that specifies why Reassociation
1436 * attemp failed
1437 *
1438 * @return None
1439 */
1440
1441void
1442limRestorePreReassocState(tpAniSirGlobal pMac,
1443 tSirResultCodes resultCode,
1444 tANI_U16 protStatusCode,tpPESession psessionEntry)
1445{
Jeff Johnsone7245742012-09-05 17:12:55 -07001446 tANI_U8 chanNum, secChanOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07001447 tLimMlmReassocCnf mlmReassocCnf;
1448
Jeff Johnson295189b2012-06-20 16:38:30 -07001449 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001450 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07001451
1452 // 'Change' timer for future activations
1453 limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
1454
1455 // Update BSSID at CFG database
1456 #if 0
1457 if (cfgSetStr(pMac, WNI_CFG_BSSID,
1458 pMac->lim.gLimCurrentBssId,
1459 sizeof(tSirMacAddr)) != eSIR_SUCCESS)
1460 {
1461 /// Could not update BSSID at CFG. Log error.
1462 limLog(pMac, LOGP, FL("could not update BSSID at CFG\n"));
1463 return;
1464 }
Madan Mohan Koyyalamudi70322d52012-10-18 20:07:33 -07001465 #endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001466
1467 // chanNum = pMac->lim.gLimCurrentChannelId;
1468
1469 /* To support BT-AMP */
1470 chanNum = psessionEntry->currentOperChannel;
Jeff Johnsone7245742012-09-05 17:12:55 -07001471 secChanOffset = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07001472
Jeff Johnsone7245742012-09-05 17:12:55 -07001473 limSetChannel(pMac, chanNum, secChanOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001474
1475 /** @ToDo : Need to Integrate the STOP the DataTransfer to the AP from 11H code */
1476
1477 mlmReassocCnf.resultCode = resultCode;
1478 mlmReassocCnf.protStatusCode = protStatusCode;
1479 /* Update PE session Id */
1480 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
1481 limPostSmeMessage(pMac,
1482 LIM_MLM_REASSOC_CNF,
1483 (tANI_U32 *) &mlmReassocCnf);
1484} /*** end limRestorePreReassocState() ***/
1485
1486
1487
1488/**
1489 * limIsReassocInProgress()
1490 *
1491 *FUNCTION:
1492 * This function is called to see if STA is in wt-reassoc-rsp state.
1493 *
1494 *LOGIC:
1495 *
1496 *ASSUMPTIONS:
1497 *
1498 *NOTE:
1499 *
1500 * @param pMac - Pointer to Global MAC structure
1501 *
1502 * @return eANI_BOOLEAN_TRUE When STA is waiting for Reassoc response from AP \n
1503 * else eANI_BOOLEAN_FALSE
1504 */
1505
1506eAniBoolean
1507limIsReassocInProgress(tpAniSirGlobal pMac,tpPESession psessionEntry)
1508{
1509 if(((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
1510 ((psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE) ||
1511 (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_LINK_FAIL_STATE)))
1512 return eANI_BOOLEAN_TRUE;
1513
1514 return eANI_BOOLEAN_FALSE;
1515} /*** end limIsReassocInProgress() ***/
1516
Jeff Johnsone7245742012-09-05 17:12:55 -07001517#ifdef WLAN_FEATURE_11AC
1518tSirRetStatus limPopulateVhtMcsSet(tpAniSirGlobal pMac,
1519 tpSirSupportedRates pRates,
1520 tDot11fIEVHTCaps *pPeerVHTCaps,
1521 tpPESession psessionEntry)
1522{
1523 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07001524
Jeff Johnsone7245742012-09-05 17:12:55 -07001525 if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
1526 {
1527 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_MCS_MAP,&val) !=
1528 eSIR_SUCCESS )
1529 {
1530 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX MCS MAP\n"));)
1531 goto error;
1532 }
1533 pRates->vhtRxMCSMap = (tANI_U16)val;
1534
1535 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_MCS_MAP,&val ) !=
1536 eSIR_SUCCESS )
1537 {
1538 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT TX MCS MAP\n"));)
1539 goto error;
1540 }
1541 pRates->vhtTxMCSMap = (tANI_U16)val;
1542
1543 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,&val ) !=
1544 eSIR_SUCCESS )
1545 {
1546 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP\n"));)
1547 goto error;
1548 }
1549 pRates->vhtRxHighestDataRate = (tANI_U16)val;
1550
1551 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,&val ) !=
1552 eSIR_SUCCESS )
1553 {
1554 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP\n"));)
1555 goto error;
1556 }
1557 pRates->vhtTxHighestDataRate = (tANI_U16)val;
1558
1559 if( pPeerVHTCaps != NULL)
1560 {
1561 pRates->vhtTxHighestDataRate = SIR_MIN(pRates->vhtTxHighestDataRate, pPeerVHTCaps->txSupDataRate);
1562 pRates->vhtRxHighestDataRate = SIR_MIN(pRates->vhtRxHighestDataRate, pPeerVHTCaps->rxHighSupDataRate);
1563
1564 // Aquire PEER MCS map if we exceed.
1565 // We compare/update only the last 2 bits of the map as we support only single BSS.
1566 // Firmware takes care of this comparison
1567 pRates->vhtRxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap
1568 pRates->vhtRxMCSMap |= (pPeerVHTCaps->rxMCSMap & 0x3); // Updating the last 2 bits in the bitmap
1569
1570 // Firmware takes care of this comparison
1571 pRates->vhtTxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap
1572 pRates->vhtTxMCSMap |= (pPeerVHTCaps->txMCSMap & 0x3); // Updating the last 2 bits in the bitmap
1573 }
1574 }
1575 return eSIR_SUCCESS;
1576error:
1577
1578 return eSIR_FAILURE;
1579
1580}
1581#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001582
1583/**
1584 * limPopulateOwnRateSet
1585 *
1586 * FUNCTION:
1587 * This function is called by limProcessAssocRsp() or
1588 * limAddStaInIBSS()
1589 * - It creates a combined rate set of 12 rates max which
1590 * comprises the basic and extended rates read from CFG
1591 * - It sorts the combined rate Set and copy it in the
1592 * rate array of the pSTA descriptor
1593 * - It sets the erpEnabled bit of the STA descriptor
1594 *
1595 * NOTE:
1596 * ERP bit is set iff the dph PHY mode is 11G and there is at least
1597 * an A rate in the supported or extended rate sets
1598 *
1599 * @param pMac - Pointer to Global MAC structure
1600 * @param basicOnly - When passed value is true, only basic
1601 * rates are copied to DPH node else
1602 * all supported rates are copied
1603 * @return eSIR_SUCCESS or eSIR_FAILURE
1604 *
1605 */
Jeff Johnsone7245742012-09-05 17:12:55 -07001606#ifdef WLAN_FEATURE_11AC
1607tSirRetStatus
1608limPopulateOwnRateSet(tpAniSirGlobal pMac,
1609 tpSirSupportedRates pRates,
1610 tANI_U8* pSupportedMCSSet,
1611 tANI_U8 basicOnly,
1612 tpPESession psessionEntry,
1613 tDot11fIEVHTCaps *pVHTCaps)
1614#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001615tSirRetStatus
1616limPopulateOwnRateSet(tpAniSirGlobal pMac,
1617 tpSirSupportedRates pRates,
1618 tANI_U8* pSupportedMCSSet,
1619 tANI_U8 basicOnly,
1620 tpPESession psessionEntry)
Jeff Johnsone7245742012-09-05 17:12:55 -07001621#endif
1622
Jeff Johnson295189b2012-06-20 16:38:30 -07001623{
1624 tSirMacRateSet tempRateSet;
1625 tSirMacRateSet tempRateSet2;
1626 tANI_U32 i,j,val,min,isArate;
1627 tANI_U32 phyMode = 0;
1628
1629 isArate = 0;
1630
1631 limGetPhyMode(pMac, &phyMode, psessionEntry);
1632
1633 // Get own rate set
1634 #if 0
1635 val = WNI_CFG_OPERATIONAL_RATE_SET_LEN;
1636 if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1637 (tANI_U8 *) &tempRateSet.rate,
1638 &val) != eSIR_SUCCESS)
1639 {
1640 /// Could not get rateset from CFG. Log error.
1641 limLog(pMac, LOGP, FL("could not retrieve rateset\n"));
1642 }
1643 #endif // TO SUPPORT BT-AMP
1644
1645 /* copy operational rate set from psessionEntry */
1646 palCopyMemory(pMac->hHdd,(tANI_U8 *)tempRateSet.rate,(tANI_U8*)(psessionEntry->rateSet.rate), psessionEntry->rateSet.numRates);
1647 tempRateSet.numRates = psessionEntry->rateSet.numRates;
1648
1649 if (phyMode == WNI_CFG_PHY_MODE_11G)
1650 {
1651
1652 // get own extended rate set
1653 #if 0
1654 val = WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN;
1655 if (wlan_cfgGetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
1656 (tANI_U8 *) &tempRateSet2.rate,
1657 &val) != eSIR_SUCCESS)
1658 {
1659 /// Could not get extended rateset from CFG. Log error.
1660 limLog(pMac, LOGP, FL("could not retrieve extended rateset\n"));
1661 }
1662 tempRateSet2.numRates = (tANI_U8) val;
1663 #endif
1664
1665 palCopyMemory(pMac->hHdd,(tANI_U8 *)tempRateSet2.rate, (tANI_U8*)(psessionEntry->extRateSet.rate), psessionEntry->extRateSet.numRates);
1666 tempRateSet2.numRates = psessionEntry->extRateSet.numRates;
1667
1668 }
1669 else
1670 tempRateSet2.numRates = 0;
1671
1672
1673 if ((tempRateSet.numRates + tempRateSet2.numRates) > 12)
1674 {
1675 //we are in big trouble
1676 limLog(pMac, LOGP, FL("more than 12 rates in CFG\n"));
1677 //panic
1678 goto error;
1679 }
1680
1681
1682 //copy all rates in tempRateSet, there are 12 rates max
1683 for (i = 0;i < tempRateSet2.numRates; i++)
1684 tempRateSet.rate[i + tempRateSet.numRates] = tempRateSet2.rate[i];
1685 tempRateSet.numRates += tempRateSet2.numRates;
1686
1687 /**
1688 * Sort rates in tempRateSet (they are likely to be already sorted)
1689 * put the result in pSupportedRates
1690 */
1691 {
1692 tANI_U8 aRateIndex = 0;
1693 tANI_U8 bRateIndex = 0;
1694
1695 palZeroMemory( pMac->hHdd, (tANI_U8 *) pRates, sizeof(tSirSupportedRates));
1696 for(i = 0;i < tempRateSet.numRates; i++)
1697 {
1698 min = 0;
1699 val = 0xff;
1700 isArate = 0;
1701 for(j = 0;j < tempRateSet.numRates; j++)
1702 {
1703 if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
1704 {
1705 val = tempRateSet.rate[j] & 0x7f;
1706 min = j;
1707 }
1708 }
1709
1710 if (sirIsArate(tempRateSet.rate[min] & 0x7f))
1711 isArate = 1;
1712
1713 /*
1714 * HAL needs to know whether the rate is basic rate or not, as it needs to
1715 * update the response rate table accordingly. e.g. if one of the 11a rates is
1716 * basic rate, then that rate can be used for sending control frames.
1717 * HAL updates the response rate table whenever basic rate set is changed.
1718 */
1719 if (basicOnly)
1720 {
1721 if (tempRateSet.rate[min] & 0x80)
1722 {
1723 if (isArate)
1724 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1725 else
1726 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1727 }
1728 }
1729 else
1730 {
1731 if (isArate)
1732 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1733 else
1734 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1735 }
1736 tempRateSet.rate[min] = 0xff;
1737 }
1738
1739 }
1740
1741
1742 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode))
1743 {
1744 val = SIZE_OF_SUPPORTED_MCS_SET;
1745 if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
1746 pRates->supportedMCSSet,
1747 &val) != eSIR_SUCCESS)
1748 {
1749 /// Could not get rateset from CFG. Log error.
1750 PELOGE(limLog(pMac, LOGE, FL("could not retrieve supportedMCSSet\n"));)
1751 goto error;
1752 }
1753
1754
1755 //if supported MCS Set of the peer is passed in, then do the intersection
1756 //else use the MCS set from local CFG.
1757
1758 if(pSupportedMCSSet != NULL)
1759 {
1760 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
1761 pRates->supportedMCSSet[i] &= pSupportedMCSSet[i];
1762
1763 }
1764
1765 PELOG2(limLog(pMac, LOG2, FL("MCS Rate Set Bitmap: \n"));)
1766 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
1767 PELOGW(limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);)
1768 }
1769
Jeff Johnsone7245742012-09-05 17:12:55 -07001770#ifdef WLAN_FEATURE_11AC
1771 limPopulateVhtMcsSet(pMac, pRates , pVHTCaps,psessionEntry);
1772#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001773
1774 return eSIR_SUCCESS;
1775
1776 error:
1777
1778 return eSIR_FAILURE;
1779} /*** limPopulateOwnRateSet() ***/
1780
Jeff Johnson295189b2012-06-20 16:38:30 -07001781/**
1782 * limPopulateMatchingRateSet
1783 * FUNCTION:
1784 * This is called at the time of Association Request
1785 * processing on AP and while adding peer's context
1786 * in IBSS role to process the CFG rate sets and
1787 * the rate sets received in the Assoc request on AP
1788 * or Beacon/Probe Response from peer in IBSS.
1789 *
1790 * LOGIC:
1791 * 1. It makes the intersection between our own rate Sat
1792 * and extemcded rate set and the ones received in the
1793 * association request.
1794 * 2. It creates a combined rate set of 12 rates max which
1795 * comprised the basic and extended rates
1796 * 3. It sorts the combined rate Set and copy it in the
1797 * rate array of the pSTA descriptor
1798 *
1799 * ASSUMPTION:
1800 * The parser has already ensured unicity of the rates in the
1801 * association request structure
1802 *
1803 * @param: pMac - Pointer to Global MAC structure
1804 * pStaDs - Pointer to DPH node
1805 * pOperRateSet - Pointer to peer's supported rateset
1806 * pExtRateSet - Pointer to peer's extended rateset
1807 *
1808 * @return: eSIR_SUCCESS or eSIR_FAILURE
1809 */
Jeff Johnsone7245742012-09-05 17:12:55 -07001810#ifdef WLAN_FEATURE_11AC
1811tSirRetStatus
1812limPopulateMatchingRateSet(tpAniSirGlobal pMac,
1813 tpDphHashNode pStaDs,
1814 tSirMacRateSet *pOperRateSet,
1815 tSirMacRateSet *pExtRateSet,
1816 tANI_U8* pSupportedMCSSet,
1817 tSirMacPropRateSet *pAniLegRateSet,
1818 tpPESession psessionEntry,
1819 tDot11fIEVHTCaps *pVHTCaps)
Jeff Johnson295189b2012-06-20 16:38:30 -07001820
Jeff Johnsone7245742012-09-05 17:12:55 -07001821#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001822tSirRetStatus
1823limPopulateMatchingRateSet(tpAniSirGlobal pMac,
1824 tpDphHashNode pStaDs,
1825 tSirMacRateSet *pOperRateSet,
1826 tSirMacRateSet *pExtRateSet,
1827 tANI_U8* pSupportedMCSSet,
1828 tSirMacPropRateSet *pAniLegRateSet,
1829 tpPESession psessionEntry)
Jeff Johnsone7245742012-09-05 17:12:55 -07001830#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001831{
1832 tSirMacRateSet tempRateSet;
1833 tSirMacRateSet tempRateSet2;
1834 tANI_U32 i,j,val,min,isArate;
1835 tANI_U32 phyMode;
1836 tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET];
1837
1838 isArate=0;
1839
1840 // limGetPhyMode(pMac, &phyMode);
1841 limGetPhyMode(pMac, &phyMode, psessionEntry);
1842
1843 // get own rate set
1844 // val = WNI_CFG_OPERATIONAL_RATE_SET_LEN;
1845 #if 0
1846 if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1847 (tANI_U8 *) &tempRateSet.rate,
1848 &val) != eSIR_SUCCESS)
1849 {
1850 /// Could not get rateset from CFG. Log error.
1851 limLog(pMac, LOGP, FL("could not retrieve rateset\n"));
1852 }
1853
1854 #endif // TO SUPPORT BT-AMP
1855
1856 /* copy operational rate set from psessionEntry */
1857 palCopyMemory(pMac->hHdd,(tempRateSet.rate),(psessionEntry->rateSet.rate),psessionEntry->rateSet.numRates);
1858 tempRateSet.numRates = (tANI_U8) psessionEntry->rateSet.numRates;
1859
1860 if (phyMode == WNI_CFG_PHY_MODE_11G)
1861 {
1862
1863 #if 0
1864 // get own extended rate set
1865 val = WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN;
1866 if (wlan_cfgGetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
1867 (tANI_U8 *) &tempRateSet2.rate,
1868 &val) != eSIR_SUCCESS)
1869 #endif
1870 palCopyMemory(pMac->hHdd,(tempRateSet2.rate),(psessionEntry->extRateSet.rate),psessionEntry->extRateSet.numRates);
1871 tempRateSet2.numRates = (tANI_U8) psessionEntry->extRateSet.numRates;
1872 }
1873 else
1874 tempRateSet2.numRates = 0;
1875
1876 if ((tempRateSet.numRates + tempRateSet2.numRates) > 12)
1877 {
1878 PELOGE(limLog(pMac, LOGE, FL("more than 12 rates in CFG\n"));)
1879 goto error;
1880 }
1881
1882 /**
1883 * Handling of the rate set IEs is the following:
1884 * - keep only rates that we support and that the station supports
1885 * - sort and the rates into the pSta->rate array
1886 */
1887
1888 // Copy all rates in tempRateSet, there are 12 rates max
1889 for(i = 0; i < tempRateSet2.numRates; i++)
1890 tempRateSet.rate[i + tempRateSet.numRates] =
1891 tempRateSet2.rate[i];
1892
1893 tempRateSet.numRates += tempRateSet2.numRates;
1894
1895 /**
1896 * Sort rates in tempRateSet (they are likely to be already sorted)
1897 * put the result in tempRateSet2
1898 */
1899 tempRateSet2.numRates = 0;
1900
1901 for(i = 0;i < tempRateSet.numRates; i++)
1902 {
1903 min = 0;
1904 val = 0xff;
1905
1906 for(j = 0;j < tempRateSet.numRates; j++)
1907 if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
1908 {
1909 val = tempRateSet.rate[j] & 0x7f;
1910 min = j;
1911 }
1912
1913 tempRateSet2.rate[tempRateSet2.numRates++] =
1914 tempRateSet.rate[min];
1915 tempRateSet.rate[min] = 0xff;
1916 }
1917
1918
1919 /**
1920 * Copy received rates in tempRateSet, the parser has ensured
1921 * unicity of the rates so there cannot be more than 12
1922 */
1923 for(i = 0; i < pOperRateSet->numRates; i++)
1924 {
1925 tempRateSet.rate[i] = pOperRateSet->rate[i];
1926 }
1927
1928 tempRateSet.numRates = pOperRateSet->numRates;
1929
1930 if (pExtRateSet->numRates)
1931 {
1932 if((tempRateSet.numRates + pExtRateSet->numRates) > 12 )
1933 {
1934 limLog( pMac, LOG2,
1935 "Sum of SUPPORTED and EXTENDED Rate Set (%1d) exceeds 12!",
1936 tempRateSet.numRates + pExtRateSet->numRates );
1937
1938 if( tempRateSet.numRates < 12 )
1939 {
1940 int found = 0;
1941 int tail = tempRateSet.numRates;
1942
1943 for( i = 0; i < pExtRateSet->numRates; i++ )
1944 {
1945 found = 0;
1946 for( j = 0; j < (tANI_U32) tail; j++ )
1947 {
1948 if((tempRateSet.rate[j] & 0x7F) ==
1949 (pExtRateSet->rate[i] & 0x7F))
1950 {
1951 found = 1;
1952 break;
1953 }
1954 }
1955
1956 if( !found )
1957 {
1958 tempRateSet.rate[tempRateSet.numRates++] =
1959 pExtRateSet->rate[i];
1960
1961 if( tempRateSet.numRates >= 12 )
1962 break;
1963 }
1964 }
1965 }
1966 else
1967 limLog( pMac, LOG2,
1968 "Relying only on the SUPPORTED Rate Set IE..." );
1969 }
1970 else
1971 {
1972 for(j = 0; j < pExtRateSet->numRates; j++)
1973 tempRateSet.rate[i+j] = pExtRateSet->rate[j];
1974
1975 tempRateSet.numRates += pExtRateSet->numRates;
1976 }
1977 }
1978
1979 {
1980 tpSirSupportedRates rates = &pStaDs->supportedRates;
1981 tANI_U8 aRateIndex = 0;
1982 tANI_U8 bRateIndex = 0;
1983 palZeroMemory( pMac->hHdd, (tANI_U8 *) rates, sizeof(tSirSupportedRates));
1984 for(i = 0;i < tempRateSet2.numRates; i++)
1985 {
1986 for(j = 0;j < tempRateSet.numRates; j++)
1987 {
1988 if ((tempRateSet2.rate[i] & 0x7F) ==
1989 (tempRateSet.rate[j] & 0x7F))
1990 {
1991#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
1992 if ((bRateIndex > HAL_NUM_11B_RATES) || (aRateIndex > HAL_NUM_11A_RATES))
1993 {
1994 limLog(pMac, LOGE, FL("Invalid number of rates (11b->%d, 11a->%d)\n"),
1995 bRateIndex, aRateIndex);
1996 return eSIR_FAILURE;
1997 }
1998#endif
1999 if (sirIsArate(tempRateSet2.rate[i] & 0x7f))
2000 {
2001 isArate=1;
2002 rates->llaRates[aRateIndex++] = tempRateSet2.rate[i];
2003 }
2004 else
2005 rates->llbRates[bRateIndex++] = tempRateSet2.rate[i];
2006 break;
2007 }
2008 }
2009 }
2010
2011
2012 //Now add the Polaris rates only when Proprietary rates are enabled.
2013 val = 0;
2014 if(wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_RATES_ENABLED, &val) != eSIR_SUCCESS)
2015 {
2016 limLog(pMac, LOGP, FL("could not retrieve prop rate enabled flag from CFG\n"));
2017 }
2018 else if(val)
2019 {
2020 for(i=0; i<pAniLegRateSet->numPropRates; i++)
2021 rates->aniLegacyRates[i] = pAniLegRateSet->propRate[i];
2022 }
2023
2024 }
2025
2026
2027 //compute the matching MCS rate set, if peer is 11n capable and self mode is 11n
2028 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
2029 (pStaDs->mlmStaContext.htCapability))
2030 {
2031 val = SIZE_OF_SUPPORTED_MCS_SET;
2032 if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
2033 mcsSet,
2034 &val) != eSIR_SUCCESS)
2035 {
2036 /// Could not get rateset from CFG. Log error.
2037 limLog(pMac, LOGP, FL("could not retrieve supportedMCSSet\n"));
2038 goto error;
2039 }
2040
2041 for(i=0; i<val; i++)
2042 pStaDs->supportedRates.supportedMCSSet[i] = mcsSet[i] & pSupportedMCSSet[i];
2043
2044 PELOG2(limLog(pMac, LOG2, FL("limPopulateMatchingRateSet: MCS Rate Set Bitmap from CFG and DPH : \n"));)
2045 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
2046 {
2047 PELOG2(limLog(pMac, LOG2,FL("%x %x "), mcsSet[i], pStaDs->supportedRates.supportedMCSSet[i]);)
2048 }
2049 }
2050
Jeff Johnsone7245742012-09-05 17:12:55 -07002051#ifdef WLAN_FEATURE_11AC
2052 limPopulateVhtMcsSet(pMac, &pStaDs->supportedRates, pVHTCaps, psessionEntry);
2053#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002054 /**
2055 * Set the erpEnabled bit iff the phy is in G mode and at least
2056 * one A rate is supported
2057 */
2058 if ((phyMode == WNI_CFG_PHY_MODE_11G) && isArate)
2059 pStaDs->erpEnabled = eHAL_SET;
2060
2061
2062
2063 return eSIR_SUCCESS;
2064
2065 error:
2066
2067 return eSIR_FAILURE;
2068} /*** limPopulateMatchingRateSet() ***/
2069
2070
2071
2072/**
2073 * limAddSta()
2074 *
2075 *FUNCTION:
2076 * This function is called to add an STA context at hardware
2077 * whenever a STA is (Re) Associated.
2078 *
2079 *LOGIC:
2080 *
2081 *ASSUMPTIONS:
2082 * NA
2083 *
2084 *NOTE:
2085 * NA
2086 *
2087 * @param pMac - Pointer to Global MAC structure
2088 * @param pStaDs - Pointer to the STA datastructure created by
2089 * LIM and maintained by DPH
2090 * @return retCode - Indicates success or failure return code
2091 */
2092
2093tSirRetStatus
2094limAddSta(
2095 tpAniSirGlobal pMac,
2096 tpDphHashNode pStaDs,tpPESession psessionEntry)
2097{
2098 tpAddStaParams pAddStaParams = NULL;
2099 tSirMsgQ msgQ;
2100 tSirRetStatus retCode = eSIR_SUCCESS;
2101 tSirMacAddr staMac, *pStaAddr;
2102 tANI_U8 i;
2103#ifdef WLAN_FEATURE_P2P
2104 tpSirAssocReq pAssocReq;
2105 tANI_U8 *p2pIe = NULL;
2106#endif
2107 #if 0
2108 retCode = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg);
2109 if (retCode != eSIR_SUCCESS)
2110 limLog(pMac, LOGP, FL("could not retrieve STA MAC\n"));
2111 #endif //To SUPPORT BT-AMP
2112
2113
2114 sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
2115
2116 if( eHAL_STATUS_SUCCESS !=
2117 palAllocateMemory( pMac->hHdd, (void **) &pAddStaParams, sizeof( tAddStaParams )))
2118 {
2119 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA\n" ));
2120 return eSIR_MEM_ALLOC_FAILED;
2121 }
2122 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams, sizeof(tAddStaParams));
2123
2124 if ((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||
2125 (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE) ||
2126 (limGetSystemRole(psessionEntry) == eLIM_BT_AMP_AP_ROLE) )
2127 pStaAddr = &pStaDs->staAddr;
2128 else
2129 pStaAddr = &staMac;
2130
2131 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->staMac,
2132 (tANI_U8 *) *pStaAddr, sizeof(tSirMacAddr));
2133 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->bssId,
2134 psessionEntry->bssId, sizeof(tSirMacAddr));
2135
2136 limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
2137
2138 //Copy legacy rates
2139 palCopyMemory(pMac->hHdd, (tANI_U8*)&pAddStaParams->supportedRates,
2140 (tANI_U8*)&pStaDs->supportedRates, sizeof(tSirSupportedRates));
2141
2142 pAddStaParams->assocId = pStaDs->assocId;
2143
2144 pAddStaParams->wmmEnabled = pStaDs->qosMode;
2145 pAddStaParams->listenInterval = pStaDs->mlmStaContext.listenInterval;
2146 pAddStaParams->shortPreambleSupported = pStaDs->shortPreambleEnabled;
2147#ifdef WLAN_SOFTAP_FEATURE
2148 if((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) && (pStaDs->mlmStaContext.subType == LIM_REASSOC))
2149 {
2150 /* TBD - need to remove this REASSOC check after fixinf rmmod issue */
2151 pAddStaParams->updateSta = pStaDs->mlmStaContext.updateContext;
2152 }
2153#endif
2154 pStaDs->valid = 0;
2155 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
2156
2157 // This will indicate HAL to "allocate" a new STA index
2158 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
2159 pAddStaParams->staType = pStaDs->staType;
2160
2161 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2162 pAddStaParams->respReqd = 1;
2163 //Update HT Capability
2164
2165 if ((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||(limGetSystemRole(psessionEntry) == eLIM_BT_AMP_AP_ROLE) || (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE))
Jeff Johnsone7245742012-09-05 17:12:55 -07002166 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability;
Jeff Johnsone7245742012-09-05 17:12:55 -07002168#ifdef WLAN_FEATURE_11AC
2169 pAddStaParams->vhtCapable = pStaDs->mlmStaContext.vhtCapability;
2170#endif
2171 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002172 else
Jeff Johnsone7245742012-09-05 17:12:55 -07002173 {
2174 pAddStaParams->htCapable = psessionEntry->htCapability;
2175#ifdef WLAN_FEATURE_11AC
2176 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
2177#endif
2178
2179 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002180
2181 pAddStaParams->greenFieldCapable = pStaDs->htGreenfield;
2182 pAddStaParams->maxAmpduDensity= pStaDs->htAMpduDensity;
2183 pAddStaParams->maxAmpduSize = pStaDs->htMaxRxAMpduFactor;
2184 pAddStaParams->fDsssCckMode40Mhz = pStaDs->htDsssCckRate40MHzSupport;
2185 pAddStaParams->fShortGI20Mhz = pStaDs->htShortGI20Mhz;
2186 pAddStaParams->fShortGI40Mhz = pStaDs->htShortGI40Mhz;
2187 pAddStaParams->lsigTxopProtection = pStaDs->htLsigTXOPProtection;
2188 pAddStaParams->maxAmsduSize = pStaDs->htMaxAmsduLength;
2189 pAddStaParams->txChannelWidthSet = pStaDs->htSupportedChannelWidthSet;
2190 pAddStaParams->mimoPS = pStaDs->htMIMOPSState;
Jeff Johnsone7245742012-09-05 17:12:55 -07002191
2192#ifdef WLAN_FEATURE_11AC
2193 if(pAddStaParams->vhtCapable)
2194 {
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002195 pAddStaParams->vhtTxChannelWidthSet = pStaDs->vhtSupportedChannelWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07002196 }
2197#endif
2198
Jeff Johnson295189b2012-06-20 16:38:30 -07002199 /* Update PE session ID*/
2200 pAddStaParams->sessionId = psessionEntry->peSessionId;
2201
2202 if (psessionEntry->parsedAssocReq != NULL)
2203 {
2204#ifdef WLAN_FEATURE_P2P
2205 // Get a copy of the already parsed Assoc Request
2206 pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
2207 if ( pAssocReq && pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
2208 p2pIe = limGetP2pIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
2209 }
2210 pAddStaParams->p2pCapableSta = (p2pIe != NULL);
2211#endif
2212 }
2213
2214 //Disable BA. It will be set as part of ADDBA negotiation.
2215 for( i = 0; i < STACFG_MAX_TC; i++ )
2216 {
2217 pAddStaParams->staTCParams[i].txUseBA = eBA_DISABLE;
2218 pAddStaParams->staTCParams[i].rxUseBA = eBA_DISABLE;
2219 }
2220
2221#ifdef WLAN_SOFTAP_FEATURE
2222 if(pStaDs->wmeEnabled && (eLIM_AP_ROLE == psessionEntry->limSystemRole))
2223 {
2224 pAddStaParams->uAPSD = 0;
2225 /* update UAPSD and send it to LIM to add STA */
2226 // bitmap MSB <- LSB MSB 4 bits are for
2227 // trigger enabled AC setting and LSB 4 bits
2228 // are for delivery enabled AC setting
2229 // 7 6 5 4 3 2 1 0
2230 // BE BK VI VO BE BK VI VO
2231 pAddStaParams->uAPSD |= pStaDs->qos.capability.qosInfo.acvo_uapsd;
2232 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acvi_uapsd << 1);
2233 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbk_uapsd << 2);
2234 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbe_uapsd << 3);
2235 //making delivery enabled and trigger enabled setting the same.
2236 pAddStaParams->uAPSD |= pAddStaParams->uAPSD << 4;
2237
2238 pAddStaParams->maxSPLen = pStaDs->qos.capability.qosInfo.maxSpLen;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002239 limLog( pMac, LOG1, FL( "uAPSD = 0x%x, maxSpLen = %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002240 pAddStaParams->uAPSD, pAddStaParams->maxSPLen);
2241 }
2242#endif
2243 //we need to defer the message until we get the response back from HAL.
2244 if (pAddStaParams->respReqd)
2245 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07002246
2247 msgQ.type = WDA_ADD_STA_REQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07002248
2249 msgQ.reserved = 0;
2250 msgQ.bodyptr = pAddStaParams;
2251 msgQ.bodyval = 0;
2252
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002253 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_STA_REQ for assocId %d\n" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002254 pStaDs->assocId);
Jeff Johnsone7245742012-09-05 17:12:55 -07002255 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002256
2257 retCode = wdaPostCtrlMsg( pMac, &msgQ );
2258 if( eSIR_SUCCESS != retCode)
2259 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002260 if (pAddStaParams->respReqd)
2261 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07002262 limLog( pMac, LOGE, FL("ADD_STA_REQ for aId %d failed (reason %X)\n"),
2263 pStaDs->assocId, retCode );
2264 palFreeMemory(pMac->hHdd, (void*)pAddStaParams);
2265 }
2266
2267 return retCode;
2268}
2269
2270
2271/**
2272 * limDelSta()
2273 *
2274 *FUNCTION:
2275 * This function is called to delete an STA context at hardware
2276 * whenever a STA is disassociated
2277 *
2278 *LOGIC:
2279 *
2280 *ASSUMPTIONS:
2281 * NA
2282 *
2283 *NOTE:
2284 * NA
2285 *
2286 * @param pMac - Pointer to Global MAC structure
2287 * @param pStaDs - Pointer to the STA datastructure created by
2288 * LIM and maintained by DPH
2289 * @param fRespReqd - flag to indicate whether the delete is synchronous (true)
2290 * or not (false)
2291 * @return retCode - Indicates success or failure return code
2292 */
2293
2294tSirRetStatus
2295limDelSta(
2296 tpAniSirGlobal pMac,
2297 tpDphHashNode pStaDs,
2298 tANI_BOOLEAN fRespReqd,
2299 tpPESession psessionEntry)
2300{
2301 tpDeleteStaParams pDelStaParams = NULL;
2302 tSirMsgQ msgQ;
2303 tSirRetStatus retCode = eSIR_SUCCESS;
2304
2305 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **) &pDelStaParams, sizeof( tDeleteStaParams )))
2306 {
2307 limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA\n" ));
2308 return eSIR_MEM_ALLOC_FAILED;
2309 }
2310
2311 palZeroMemory( pMac->hHdd, (tANI_U8 *) pDelStaParams, sizeof(tDeleteStaParams));
2312
2313 //
2314 // DPH contains the STA index only for "peer" STA entries.
2315 // LIM global contains "self" STA index
2316 // Thus,
2317 // if( STA role )
2318 // get STA index from LIM global
2319 // else
2320 // get STA index from DPH
2321 //
2322
2323#if 0
2324 /* Since we have not created any STA, no need to send msg to delete
2325 * STA to HAL */
2326 if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) {
2327 pDelStaParams->staIdx = 1; /* TODO : This is workaround. Need to find right STA Index before sending to HAL */
2328 //return retCode;
2329 }
2330#endif
2331
2332 if( (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) ||(eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) )
2333 pDelStaParams->staIdx= psessionEntry->staId;
2334
2335 else
2336 pDelStaParams->staIdx= pStaDs->staIndex;
2337
2338 pDelStaParams->assocId = pStaDs->assocId;
2339 pStaDs->valid = 0;
2340
2341 if (! fRespReqd)
2342 pDelStaParams->respReqd = 0;
2343 else
2344 {
2345 //when limDelSta is called from processSmeAssocCnf then mlmState is already set properly.
2346 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs))
2347 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002348 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002349 SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs, eLIM_MLM_WT_DEL_STA_RSP_STATE);
2350 }
2351 if ( (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) ||
2352 (eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) )
2353 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002354 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002355
2356 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
2357
2358 }
2359 pDelStaParams->respReqd = 1;
2360 //we need to defer the message until we get the response back from HAL.
2361 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
2362 }
2363
2364 /* Update PE session ID*/
2365 pDelStaParams->sessionId = psessionEntry->peSessionId;
2366
2367 pDelStaParams->status = eHAL_STATUS_SUCCESS;
2368 msgQ.type = WDA_DELETE_STA_REQ;
2369 msgQ.reserved = 0;
2370 msgQ.bodyptr = pDelStaParams;
2371 msgQ.bodyval = 0;
2372
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002373 limLog( pMac, LOG1, FL( "Sending SIR_HAL_DELETE_STA_REQ for STAID: %X and AssocID: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002374 pDelStaParams->staIdx, pDelStaParams->assocId);
Jeff Johnsone7245742012-09-05 17:12:55 -07002375 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002376 retCode = wdaPostCtrlMsg( pMac, &msgQ );
2377 if( eSIR_SUCCESS != retCode)
2378 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002379 if(fRespReqd)
2380 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07002381 limLog( pMac, LOGE, FL("Posting DELETE_STA_REQ to HAL failed, reason=%X\n"),
2382 retCode );
2383 palFreeMemory(pMac->hHdd, (void*)pDelStaParams);
2384 }
2385
2386 return retCode;
2387}
2388
2389#if defined WLAN_FEATURE_VOWIFI_11R
2390/*------------------------------------------------------------------------
2391 * limAddFTStaSelf()
2392 *
2393 * FUNCTION:
2394 *
2395 * This function is called to add a STA once we have connected with a new
2396 * AP, that we have performed an FT to.
2397 *
2398 * The Add STA Response is created and now after the ADD Bss Is Successful
2399 * we add the self sta. We update with the association id from the reassoc
2400 * response from the AP.
2401 *------------------------------------------------------------------------
2402 */
2403tSirRetStatus limAddFTStaSelf(tpAniSirGlobal pMac, tANI_U16 assocId, tpPESession psessionEntry)
2404{
2405 tpAddStaParams pAddStaParams = NULL;
2406 tSirMsgQ msgQ;
2407 tSirRetStatus retCode = eSIR_SUCCESS;
2408
2409 pAddStaParams = pMac->ft.ftPEContext.pAddStaReq;
2410 pAddStaParams->assocId = assocId;
2411
2412 msgQ.type = SIR_HAL_ADD_STA_REQ;
2413 msgQ.reserved = 0;
2414 msgQ.bodyptr = pAddStaParams;
2415 msgQ.bodyval = 0;
2416
2417
2418#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
2419 limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ), pAddStaParams->assocId);
2420#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002421 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002422
2423 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2424 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
2425 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
2426 {
2427 limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X\n"), retCode );
2428 palFreeMemory(pMac->hHdd, (void*)pAddStaParams);
2429 }
2430 //
2431 // Dont need it any more
2432 pMac->ft.ftPEContext.pAddStaReq = NULL;
2433 return retCode;
2434}
2435
2436#endif /* WLAN_FEATURE_VOWIFI_11R */
2437
2438/**
2439 * limAddStaSelf()
2440 *
2441 *FUNCTION:
2442 * This function is called to add an STA context at hardware
2443 * whenever a STA is (Re) Associated.
2444 *
2445 *LOGIC:
2446 *
2447 *ASSUMPTIONS:
2448 * NA
2449 *
2450 *NOTE:
2451 * NA
2452 *
2453 * @param pMac - Pointer to Global MAC structure
2454 * @param pStaDs - Pointer to the STA datastructure created by
2455 * LIM and maintained by DPH
2456 * @return retCode - Indicates success or failure return code
2457 */
2458
2459tSirRetStatus
2460limAddStaSelf(tpAniSirGlobal pMac,tANI_U16 staIdx, tANI_U8 updateSta, tpPESession psessionEntry)
2461{
2462 tpAddStaParams pAddStaParams = NULL;
2463 tSirMsgQ msgQ;
2464 tSirRetStatus retCode = eSIR_SUCCESS;
2465 tSirMacAddr staMac;
2466 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
2467
2468 #if 0
2469 retCode =wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg);
2470 if (retCode != eSIR_SUCCESS)
2471 {
2472 /// Could not get BSSID from CFG. Log error.
2473 limLog(pMac, LOGP, FL("could not retrieve STA MAC\n"));
2474 return retCode;
2475 }
2476 #endif //TO SUPPORT BT-AMP
2477 sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
2478
2479 if( eHAL_STATUS_SUCCESS !=
2480 palAllocateMemory( pMac->hHdd, (void **) &pAddStaParams, sizeof( tAddStaParams )))
2481 {
2482 limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA\n" ));
2483 return eSIR_MEM_ALLOC_FAILED;
2484 }
2485 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams, sizeof(tAddStaParams));
2486
2487 /// Add STA context at MAC HW (BMU, RHP & TFP)
2488 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->staMac,
2489 (tANI_U8 *) staMac, sizeof(tSirMacAddr));
2490
2491 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->bssId,
2492 psessionEntry->bssId, sizeof(tSirMacAddr));
2493
2494 pAddStaParams->assocId = psessionEntry->limAID;
2495 pAddStaParams->staType = STA_ENTRY_SELF;
2496 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2497 pAddStaParams->respReqd = 1;
2498
2499 /* Update PE session ID */
2500 pAddStaParams->sessionId = psessionEntry->peSessionId;
2501
2502 // This will indicate HAL to "allocate" a new STA index
2503 pAddStaParams->staIdx = staIdx;
2504 pAddStaParams->updateSta = updateSta;
2505
2506 pAddStaParams->shortPreambleSupported = psessionEntry->beaconParams.fShortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -07002507
Jeff Johnsone7245742012-09-05 17:12:55 -07002508#ifdef WLAN_FEATURE_11AC
2509 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry,NULL);
2510#else
2511 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
2512#endif
2513 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07002514 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002515 pAddStaParams->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -07002516#ifdef DISABLE_GF_FOR_INTEROP
2517 /*
2518 * To resolve the interop problem with Broadcom AP,
2519 * where TQ STA could not pass traffic with GF enabled,
2520 * TQ STA will do Greenfield only with TQ AP, for
2521 * everybody else it will be turned off.
2522 */
2523 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2524 {
2525 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
2526 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
2527 }
2528 else
2529#endif
2530
2531#ifdef WLAN_SOFTAP_FEATURE
2532 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
2533 pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
2534 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
2535 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
2536 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
2537 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
2538 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
2539 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
2540 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
2541 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
2542 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
2543 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
2544#else
2545 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD );
2546 pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET );
2547 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE );
2548 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE );
2549 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION );
2550 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA );
2551 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY );
2552 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR);
2553 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH );
2554 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ);
2555 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ);
2556 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ);
2557#endif
2558 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002559#ifdef WLAN_FEATURE_11AC
2560 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002561 pAddStaParams->vhtTxChannelWidthSet = psessionEntry->apChanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -07002562#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002563 if(wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
2564 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL\n"));
2565 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
2566
2567#ifdef WLAN_FEATURE_P2P
2568 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona)
2569 {
2570 pAddStaParams->p2pCapableSta = 1;
2571 }
2572#endif
2573
2574 limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
2575
2576 msgQ.type = WDA_ADD_STA_REQ;
2577 //
2578 // FIXME_GEN4
2579 // A global counter (dialog token) is required to keep track of
2580 // all PE <-> HAL communication(s)
2581 //
2582 msgQ.reserved = 0;
2583 msgQ.bodyptr = pAddStaParams;
2584 msgQ.bodyval = 0;
2585
2586 limLog( pMac, LOGW, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ),
2587 pAddStaParams->assocId);
Jeff Johnsone7245742012-09-05 17:12:55 -07002588 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002589
2590 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
2591 {
2592 limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X\n"), retCode );
2593 palFreeMemory(pMac->hHdd, (void*)pAddStaParams);
2594 }
2595 return retCode;
2596}
2597
2598
2599/**
2600 * limTeardownInfraBSS()
2601 *
2602 *FUNCTION:
2603 * This function is called by various LIM functions to teardown
2604 * an established Infrastructure BSS
2605 *
2606 *LOGIC:
2607 *
2608 *ASSUMPTIONS:
2609 *
2610 *NOTE:
2611 *
2612 * @param pMac - Pointer to Global MAC structure
2613 * @return None
2614 */
2615
2616void
2617limTeardownInfraBss(tpAniSirGlobal pMac,tpPESession psessionEntry)
2618{
2619 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
2620
2621 /**
2622 * Send Broadcast Disassociate frame with
2623 * 'leaving BSS' reason.
2624 */
2625 limSendDisassocMgmtFrame(pMac,
2626 eSIR_MAC_DISASSOC_LEAVING_BSS_REASON,
2627 bcAddr,psessionEntry);
2628} /*** end limTeardownInfraBss() ***/
2629
2630
2631/**
2632 * limHandleCnfWaitTimeout()
2633 *
2634 *FUNCTION:
2635 * This function is called by limProcessMessageQueue to handle
2636 * various confirmation failure cases.
2637 *
2638 *LOGIC:
2639 *
2640 *ASSUMPTIONS:
2641 *
2642 *NOTE:
2643 *
2644 * @param pMac - Pointer to Global MAC structure
2645 * @param pStaDs - Pointer to a sta descriptor
2646 * @return None
2647 */
2648
2649void limHandleCnfWaitTimeout(tpAniSirGlobal pMac, tANI_U16 staId)
2650{
2651 tpDphHashNode pStaDs;
2652 tLimSystemRole systemRole;
2653 tpPESession psessionEntry = NULL;
2654
2655 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId))== NULL)
2656 {
2657 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
2658 return;
2659 }
2660 systemRole = limGetSystemRole(psessionEntry);
2661 pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable);
2662
2663 if (pStaDs == NULL)
2664 {
2665 PELOGW(limLog(pMac, LOGW, FL("No STA context in SIR_LIM_CNF_WAIT_TIMEOUT.\n"));)
2666 return;
2667 }
2668
2669 switch (pStaDs->mlmStaContext.mlmState) {
2670 case eLIM_MLM_WT_ASSOC_CNF_STATE:
2671 PELOGW(limLog(pMac, LOGW, FL("Did not receive Assoc Cnf in eLIM_MLM_WT_ASSOC_CNF_STATE sta Assoc id %d\n"), pStaDs->assocId);)
2672 limPrintMacAddr(pMac, pStaDs->staAddr, LOGW);
2673
2674 if ( (systemRole == eLIM_AP_ROLE)|| (systemRole == eLIM_BT_AMP_AP_ROLE) )
2675 {
2676 limRejectAssociation(
2677 pMac,
2678 pStaDs->staAddr,
2679 pStaDs->mlmStaContext.subType,
2680 true,
2681 pStaDs->mlmStaContext.authType,
2682 pStaDs->assocId,
2683 true,
2684 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2685 psessionEntry);
2686 }
2687 break;
2688
2689 default:
2690 limLog(pMac, LOGW, FL("Received CNF_WAIT_TIMEOUT in state %d\n"),
2691 pStaDs->mlmStaContext.mlmState);
2692 }
2693}
2694
2695
2696/**
2697 * limDeleteDphHashEntry()
2698 *
2699 *FUNCTION:
2700 * This function is called whenever we need to delete
2701 * the dph hash entry
2702 *
2703 *LOGIC:
2704 *
2705 *ASSUMPTIONS:
2706 *
2707 *NOTE:
2708 *
2709 * @param pMac Pointer to Global MAC structure
2710 * @param tANI_U16 staId
2711 * @return None
2712 */
2713
2714void
2715limDeleteDphHashEntry(tpAniSirGlobal pMac, tSirMacAddr staAddr, tANI_U16 staId,tpPESession psessionEntry)
2716{
2717 tANI_U16 aid;
2718 tpDphHashNode pStaDs;
2719 tUpdateBeaconParams beaconParams;
2720 tLimSystemRole systemRole;
2721
2722 beaconParams.paramChangeBitmap = 0;
2723 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, staId);
2724 if (NULL == psessionEntry)
2725 {
2726 PELOGE(limLog(pMac, LOGE, FL("NULL psessionEntry"));)
2727 return;
2728 }
2729 systemRole = limGetSystemRole(psessionEntry);
2730 beaconParams.bssIdx = psessionEntry->bssIdx;
2731 pStaDs = dphLookupHashEntry(pMac, staAddr, &aid, &psessionEntry->dph.dphHashTable);
2732 if (pStaDs != NULL)
2733 {
2734 PELOGW(limLog(pMac, LOGW, FL("Deleting DPH Hash entry for STAID: %X\n "), staId);)
2735 // update the station count and perform associated actions
2736 // do this before deleting the dph hash entry
2737 limUtilCountStaDel(pMac, pStaDs, psessionEntry);
2738
2739 if((eLIM_AP_ROLE == psessionEntry->limSystemRole) ||
2740 (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole))
2741 {
2742#ifdef WLAN_SOFTAP_FEATURE
2743 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
2744 if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE){
2745 limDecideApProtectionOnDelete(pMac, pStaDs, &beaconParams,psessionEntry);
2746 }
2747 }
2748#endif
2749
2750 if(eLIM_STA_IN_IBSS_ROLE == systemRole)
2751 limIbssDecideProtectionOnDelete(pMac, pStaDs, &beaconParams, psessionEntry);
2752
2753 limDecideShortPreamble(pMac, pStaDs, &beaconParams, psessionEntry);
2754 limDecideShortSlot(pMac, pStaDs, &beaconParams, psessionEntry);
2755
2756 //Send message to HAL about beacon parameter change.
2757 PELOGW(limLog(pMac, LOGW, FL("param bitmap = %d \n"), beaconParams.paramChangeBitmap);)
2758 if(beaconParams.paramChangeBitmap)
2759 {
2760 schSetFixedBeaconFields(pMac,psessionEntry);
2761 limSendBeaconParams(pMac, &beaconParams, psessionEntry );
2762 }
2763 }
2764 if (dphDeleteHashEntry(pMac, staAddr, staId, &psessionEntry->dph.dphHashTable) != eSIR_SUCCESS)
2765 limLog(pMac, LOGP, FL("error deleting hash entry\n"));
2766 }
2767}
2768
2769
2770
2771/**
2772 * limCheckAndAnnounceJoinSuccess()
2773 *
2774 *FUNCTION:
2775 * This function is called upon receiving Beacon/Probe Response
2776 * frame in WT_JOIN_BEACON_STATE to check if the received
2777 * Beacon/Probe Response is from the BSS that we're attempting
2778 * to join.
2779 *
2780 *LOGIC:
2781 * If the Beacon/Probe Response is indeed from the BSS we're
2782 * attempting to join, join success is sent to SME.
2783 *
2784 *ASSUMPTIONS:
2785 *
2786 *NOTE:
2787 *
2788 * @param pMac Pointer to Global MAC structure
2789 * @param pBPR Pointer to received Beacon/Probe Response
2790 * @param pHdr Pointer to received Beacon/Probe Response
2791 * MAC header
2792 * @return None
2793 */
2794
2795void
2796limCheckAndAnnounceJoinSuccess(tpAniSirGlobal pMac,
2797 tSirProbeRespBeacon *pBPR,
2798 tpSirMacMgmtHdr pHdr,tpPESession psessionEntry)
2799{
2800 tSirMacSSid currentSSID;
2801 tLimMlmJoinCnf mlmJoinCnf;
2802
2803 palCopyMemory( pMac->hHdd, currentSSID.ssId,
2804 psessionEntry->ssId.ssId,
2805 psessionEntry->ssId.length);
2806
2807 currentSSID.length = (tANI_U8)psessionEntry->ssId.length ;
2808
2809 if (
2810 /* Check for SSID only in probe response. Beacons may not carry
2811 SSID information in hidden SSID case */
2812 ( (SIR_MAC_MGMT_FRAME == pHdr->fc.type) &&
2813 (SIR_MAC_MGMT_PROBE_RSP == pHdr->fc.subType) ) &&
2814 currentSSID.length &&
2815 (!palEqualMemory( pMac->hHdd,(tANI_U8 *) &pBPR->ssId,
2816 (tANI_U8 *) &currentSSID,
2817 (tANI_U8) (1 + currentSSID.length)) ))
2818 {
2819 /**
2820 * Received SSID does not match with the one we've.
2821 * Ignore received Beacon frame
2822 */
2823 PELOG1(limLog(pMac, LOG1, FL("SSID received in Beacon does not match\n"));)
2824#ifdef WLAN_DEBUG
2825 pMac->lim.gLimBcnSSIDMismatchCnt++;
2826#endif
2827 return;
2828 }
2829
2830 if( (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_STA_ROLE))
2831 {
2832 PELOG1(limLog(pMac, LOG1, FL("Received Beacon/PR with matching BSSID\n"));)
2833
2834 // Deactivate Join Failure timer
2835 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
2836
2837 // Update Beacon Interval at CFG database
2838
2839 if ( pBPR->HTCaps.present )
2840 limUpdateStaRunTimeHTCapability( pMac, &pBPR->HTCaps );
2841 if ( pBPR->HTInfo.present )
2842 limUpdateStaRunTimeHTInfo( pMac, &pBPR->HTInfo, psessionEntry);
2843 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002844 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002845
2846#if (WNI_POLARIS_FW_PRODUCT == AP)
2847 // In case of BP, we need to adopt to all rates
2848 // advertised by AP. Update the operational rates at CFG
2849 if (cfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
2850 (tANI_U8 *) &pBPR->supportedRates.rate,
2851 pBPR->supportedRates.numRates)
2852 != eSIR_SUCCESS)
2853 limLog(pMac, LOGP, FL("could not update Oper.rates at CFG\n"));
2854
2855#endif
2856
2857 /**
2858 * Announce join success by sending
2859 * Join confirm to SME.
2860 */
2861 mlmJoinCnf.resultCode = eSIR_SME_SUCCESS;
2862 mlmJoinCnf.protStatusCode = eSIR_MAC_SUCCESS_STATUS;
2863 /* Update PE sessionId*/
2864 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
2865 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
2866 } // if ((pMac->lim.gLimSystemRole == IBSS....
2867}
2868
2869/**
2870 * limExtractApCapabilities()
2871 *
2872 *FUNCTION:
2873 * This function is called to extract all of the AP's capabilities
2874 * from the IEs received from it in Beacon/Probe Response frames
2875 *
2876 *LOGIC:
2877 * This routine mimics the limExtractApCapability() API. The difference here
2878 * is that this API returns the entire tSirProbeRespBeacon info as is. It is
2879 * left to the caller of this API to use this info as required
2880 *
2881 *ASSUMPTIONS:
2882 * NA
2883 *
2884 *NOTE:
2885 *
2886 * @param pMac Pointer to Global MAC structure
2887 * @param pIE Pointer to starting IE in Beacon/Probe Response
2888 * @param ieLen Length of all IEs combined
2889 * @param beaconStruct A pointer to tSirProbeRespBeacon that needs to be
2890 * populated
2891 * @return status A status reporting eSIR_SUCCESS or eSIR_FAILURE
2892 */
2893tSirRetStatus limExtractApCapabilities( tpAniSirGlobal pMac,
2894 tANI_U8 *pIE,
2895 tANI_U16 ieLen,
2896 tpSirProbeRespBeacon beaconStruct )
2897{
2898 palZeroMemory( pMac->hHdd, (tANI_U8 *) beaconStruct, sizeof( tSirProbeRespBeacon ));
2899
2900 PELOG3(limLog( pMac, LOG3,
2901 FL( "In limExtractApCapabilities: The IE's being received are:\n" ));
2902 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG3, pIE, ieLen );)
2903
2904 // Parse the Beacon IE's, Don't try to parse if we dont have anything in IE
2905 if (ieLen > 0) {
2906 if( eSIR_SUCCESS != sirParseBeaconIE( pMac, beaconStruct, pIE, (tANI_U32)ieLen ))
2907 {
2908 limLog( pMac, LOGE, FL("APCapExtract: Beacon parsing error!\n"));
2909 return eSIR_FAILURE;
2910 }
2911 }
2912
2913 return eSIR_SUCCESS;
2914}
2915
2916
2917/**
2918 * limDelBss()
2919 *
2920 *FUNCTION:
2921 * This function is called to delete BSS context at hardware
2922 * whenever a STA is disassociated
2923 *
2924 *LOGIC:
2925 *
2926 *ASSUMPTIONS:
2927 * NA
2928 *
2929 *NOTE:
2930 * NA
2931 *
2932 * @param pMac - Pointer to Global MAC structure
2933 * @param pStaDs - Pointer to the STA datastructure created by
2934 * LIM and maintained by DPH
2935 * @return retCode - Indicates success or failure return code
2936 */
2937
2938tSirRetStatus
2939limDelBss(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tANI_U16 bssIdx,tpPESession psessionEntry)
2940{
2941 tpDeleteBssParams pDelBssParams = NULL;
2942 tSirMsgQ msgQ;
2943 tSirRetStatus retCode = eSIR_SUCCESS;
2944
2945 if( eHAL_STATUS_SUCCESS !=
2946 palAllocateMemory( pMac->hHdd, (void **) &pDelBssParams, sizeof( tDeleteBssParams )))
2947 {
2948 limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_BSS\n" ));
2949 return eSIR_MEM_ALLOC_FAILED;
2950 }
2951 palZeroMemory( pMac->hHdd, (tANI_U8 *) pDelBssParams, sizeof(tDeleteBssParams));
2952
2953
2954 pDelBssParams->sessionId = psessionEntry->peSessionId; //update PE session Id
2955
2956 //DPH was storing the AssocID in staID field,
2957 //staID is actually assigned by HAL when AddSTA message is sent.
2958 if (pStaDs != NULL)
2959 {
2960 pDelBssParams->bssIdx= pStaDs->bssId;
2961 pStaDs->valid = 0;
2962 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
2963 }
2964 else
2965 pDelBssParams->bssIdx = bssIdx;
2966 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002967 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_BSS_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002968
2969 pDelBssParams->status= eHAL_STATUS_SUCCESS;
2970 pDelBssParams->respReqd = 1;
2971 PELOGW(limLog( pMac, LOGW, FL("Sending HAL_DELETE_BSS_REQ for BSSID: %X\n"),
2972 pDelBssParams->bssIdx);)
2973
2974 //we need to defer the message until we get the response back from HAL.
2975 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
2976
2977 msgQ.type = WDA_DELETE_BSS_REQ;
2978 msgQ.reserved = 0;
2979 msgQ.bodyptr = pDelBssParams;
2980 msgQ.bodyval = 0;
2981
Jeff Johnsone7245742012-09-05 17:12:55 -07002982 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002983
2984 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
2985 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002986 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07002987 limLog( pMac, LOGE, FL("Posting DELETE_BSS_REQ to HAL failed, reason=%X\n"), retCode );
2988 palFreeMemory(pMac->hHdd, (void*)pDelBssParams);
2989 }
2990
2991 return retCode;
2992}
2993
2994
2995#ifdef ANI_PRODUCT_TYPE_CLIENT
2996
2997/**
2998 * limSendAddBss()
2999 *
3000 *FUNCTION:
3001 *
3002 *LOGIC:
3003 * 1) LIM receives eWNI_SME_JOIN_REQ
3004 * 2) For a valid eWNI_SME_JOIN_REQ, LIM sends
3005 * SIR_HAL_ADD_BSS_REQ to HAL
3006 *
3007 *ASSUMPTIONS:
3008 * JOIN REQ parameters are saved in pMac->lim.gLimMlmJoinReq
3009 * ADD BSS parameters can be obtained from two sources:
3010 * 1) pMac->lim.gLimMlmJoinReq
3011 * 2) beaconStruct, passed as paramter
3012 * So, if a reqd parameter is found in bssDescriptions
3013 * then it is given preference over beaconStruct
3014 *
3015 *NOTE:
3016 *
3017 * @param pMac Pointer to Global MAC structure
3018 * pAssocRsp contains the structured assoc/reassoc Response got from AP
3019 * beaconstruct Has the ProbeRsp/Beacon structured details
3020 * bssDescription bssDescription passed to PE from the SME
3021 * @return None
3022 */
3023
3024tSirRetStatus limStaSendAddBss( tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,
3025 tpSchBeaconStruct pBeaconStruct, tpSirBssDescription bssDescription, tANI_U8 updateEntry,
3026 tpPESession psessionEntry)
3027
3028{
3029 tSirMsgQ msgQ;
3030 tpAddBssParams pAddBssParams = NULL;
3031 tANI_U32 retCode;
3032 tANI_U8 i;
3033 tpDphHashNode pStaDs = NULL;
3034 tANI_U8 chanWidthSupp = 0;
3035 // Package SIR_HAL_ADD_BSS_REQ message parameters
3036 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
3037 (void **) &pAddBssParams,
3038 sizeof( tAddBssParams )))
3039 {
3040 limLog( pMac, LOGP,
3041 FL( "Unable to PAL allocate memory during ADD_BSS\n" ));
3042 retCode = eSIR_MEM_ALLOC_FAILED;
3043 goto returnFailure;
3044 }
3045 else
3046 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
3047
3048 palCopyMemory( pMac->hHdd, pAddBssParams->bssId,bssDescription->bssId,
3049 sizeof( tSirMacAddr ));
3050 // Fill in tAddBssParams selfMacAddr
3051 palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr,
3052 psessionEntry->selfMacAddr,
3053 sizeof( tSirMacAddr ));
3054
3055 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3056 {
3057 pAddBssParams->bssType = eSIR_BTAMP_AP_MODE;
3058 }
3059 else
3060 {
3061 pAddBssParams->bssType = eSIR_INFRASTRUCTURE_MODE;
3062 }
3063
3064 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
3065
3066 /* Update PE session ID */
3067 pAddBssParams->sessionId = psessionEntry->peSessionId;
3068
3069 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
3070
3071 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
3072 pAddBssParams->updateBss = updateEntry;
3073
3074
3075 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
3076 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
3077 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
3078 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
3079
3080 pAddBssParams->rateSet.numRates = pAssocRsp->supportedRates.numRates;
3081 palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
3082 pAssocRsp->supportedRates.rate, pAssocRsp->supportedRates.numRates );
3083
3084 pAddBssParams->nwType = bssDescription->nwType;
3085
Jeff Johnsone7245742012-09-05 17:12:55 -07003086 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -07003087 pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
3088 pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
3089 pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
3090 pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
3091
3092
3093 // Use the advertised capabilities from the received beacon/PR
3094
3095
3096 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pAssocRsp->HTCaps.present ))
3097 {
3098 pAddBssParams->htCapable = pAssocRsp->HTCaps.present;
3099
3100 if ( pBeaconStruct->HTInfo.present )
3101 {
3102 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pAssocRsp->HTInfo.opMode;
3103 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pAssocRsp->HTInfo.dualCTSProtection;
3104#ifdef WLAN_SOFTAP_FEATURE
3105 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
3106#else
3107 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET);
3108#endif
3109 if( (pAssocRsp->HTCaps.supportedChannelWidthSet) &&
3110 (chanWidthSupp) )
3111 {
3112 pAddBssParams->txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
3113 pAddBssParams->currentExtChannel = pAssocRsp->HTInfo.secondaryChannelOffset;
3114 }
3115 else
3116 {
3117 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003118 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003119 }
3120 pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent;
3121 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport;
3122 pAddBssParams->fRIFSMode = pAssocRsp->HTInfo.rifsMode;
3123 }
3124 }
3125
3126 pAddBssParams->currentOperChannel = bssDescription->channelId;
3127
Jeff Johnsone7245742012-09-05 17:12:55 -07003128#ifdef WLAN_FEATURE_11AC
3129 if (psessionEntry->vhtCapability && ( pAssocRsp->VHTCaps.present ))
3130 {
3131 pAddBssParams->vhtCapable = pAssocRsp->VHTCaps.present;
3132 pAddBssParams->vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth;
3133 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003134 pAddBssParams->currentOperChannel,
3135 pAddBssParams->currentExtChannel,
3136 psessionEntry->apCenterChan,
3137 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003138 }
3139 else
3140 {
3141 pAddBssParams->vhtCapable = 0;
3142 }
3143#endif
3144
3145
Jeff Johnson295189b2012-06-20 16:38:30 -07003146 // Populate the STA-related parameters here
3147 // Note that the STA here refers to the AP
3148 {
3149 /* staType = PEER*/
3150 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
3151
3152 palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId,
3153 bssDescription->bssId,
3154 sizeof( tSirMacAddr ));
3155 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
3156
3157 /* Fill Assoc id from the dph table */
3158 pStaDs = dphLookupHashEntry(pMac, pAddBssParams->staContext.bssId,
3159 &pAddBssParams->staContext.assocId, &psessionEntry->dph.dphHashTable);
3160 if (pStaDs == NULL)
3161 {
3162 PELOGE(limLog(pMac, LOGE, FL("Couldn't get assoc id for"
3163 "MAC ADDR: %02x:%02x:%02x:%02x:%02x:%02x"),
3164 pAddBssParams->staContext.staMac[0],
3165 pAddBssParams->staContext.staMac[1],
3166 pAddBssParams->staContext.staMac[2],
3167 pAddBssParams->staContext.staMac[3],
3168 pAddBssParams->staContext.staMac[4],
3169 pAddBssParams->staContext.staMac[5]
3170 );)
3171 }
3172 pAddBssParams->staContext.uAPSD = 0;
3173 pAddBssParams->staContext.maxSPLen = 0;
3174 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortPreamble;
3175 pAddBssParams->staContext.updateSta = updateEntry;
3176
3177 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
3178 {
3179 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
3180 pAddBssParams->staContext.htCapable = 1;
3181 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 )pAssocRsp->HTCaps.greenField;
3182 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 )pAssocRsp->HTCaps.lsigTXOPProtection;
3183 if( (pAssocRsp->HTCaps.supportedChannelWidthSet) &&
3184 (chanWidthSupp) )
3185 {
3186 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07003187
3188#ifdef WLAN_FEATURE_11AC
3189 if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present ))
3190 {
3191 pAddBssParams->staContext.vhtCapable = 1;
3192 pAddBssParams->staContext.vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth; //pMac->lim.apChanWidth;
3193 }
3194#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003195 }
3196 else
3197 {
3198 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3199 }
3200 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pAssocRsp->HTCaps.mimoPowerSave;
3201 pAddBssParams->staContext.delBASupport = ( tANI_U8 )pAssocRsp->HTCaps.delayedBA;
3202 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 )pAssocRsp->HTCaps.maximalAMSDUsize;
3203 pAddBssParams->staContext.maxAmpduDensity = pAssocRsp->HTCaps.mpduDensity;
3204 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz;
3205 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz;
3206 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz;
3207 pAddBssParams->staContext.maxAmpduSize= pAssocRsp->HTCaps.maxRxAMPDUFactor;
3208
3209 if( pBeaconStruct->HTInfo.present )
3210 pAddBssParams->staContext.rifsMode = pAssocRsp->HTInfo.rifsMode;
3211 }
3212
3213 if ((psessionEntry->limWmeEnabled && pAssocRsp->wmeEdcaPresent) ||
3214 (psessionEntry->limQosEnabled && pAssocRsp->edcaPresent))
3215 pAddBssParams->staContext.wmmEnabled = 1;
3216 else
3217 pAddBssParams->staContext.wmmEnabled = 0;
3218
3219 //Update the rates
3220
3221 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3222 if (pStaDs != NULL)
3223 {
3224 limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
3225 palCopyMemory(pMac->hHdd, (tANI_U8*)&pAddBssParams->staContext.supportedRates,
3226 (tANI_U8*)&pStaDs->supportedRates,
3227 sizeof(tSirSupportedRates));
3228 }
3229 else
3230 PELOGE(limLog(pMac, LOGE, FL("could not Update the supported rates.\n"));)
3231
3232 }
3233
3234 //Disable BA. It will be set as part of ADDBA negotiation.
3235 for( i = 0; i < STACFG_MAX_TC; i++ )
3236 {
3237 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
3238 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
3239 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
3240 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
3241 }
3242
3243 pAddBssParams->staContext.encryptType = psessionEntry->encryptType;
3244
3245#if defined WLAN_FEATURE_VOWIFI
3246 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
3247#endif
3248 // FIXME_GEN4 - Any other value that can be used for initialization?
3249 pAddBssParams->status = eHAL_STATUS_SUCCESS;
3250 pAddBssParams->respReqd = true;
3251
3252 pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
3253
3254#ifdef WLAN_FEATURE_P2P
3255 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona)
3256 {
3257 pAddBssParams->staContext.p2pCapableSta = 1;
3258 }
3259#endif
3260
Jeff Johnsone7245742012-09-05 17:12:55 -07003261 pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled ||
3262 limIsconnectedOnDFSChannel(bssDescription->channelId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003263
3264#if defined WLAN_FEATURE_VOWIFI_11R
3265 pAddBssParams->extSetStaKeyParamValid = 0;
3266#endif
3267
3268 // Set a new state for MLME
3269 if( eLIM_MLM_WT_ASSOC_RSP_STATE == psessionEntry->limMlmState )
3270 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE;
3271 else
3272 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003273 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003274
3275 //we need to defer the message until we get the response back from HAL.
3276 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
3277
3278 msgQ.type = WDA_ADD_BSS_REQ;
3279 /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
3280 msgQ.reserved = 0;
3281 msgQ.bodyptr = pAddBssParams;
3282 msgQ.bodyval = 0;
3283
3284 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003285 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003286
3287 retCode = wdaPostCtrlMsg( pMac, &msgQ );
3288 if( eSIR_SUCCESS != retCode)
3289 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003290 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07003291 palFreeMemory(pMac->hHdd, pAddBssParams);
3292 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
3293 retCode );
3294 goto returnFailure;
3295
3296 }
3297 else
3298 return retCode;
3299
3300 returnFailure:
3301 // Clean-up will be done by the caller...
3302 return retCode;
3303}
3304
3305
3306
3307
3308tSirRetStatus limStaSendAddBssPreAssoc( tpAniSirGlobal pMac, tANI_U8 updateEntry, tpPESession psessionEntry)
3309{
3310 tSirMsgQ msgQ;
3311 tpAddBssParams pAddBssParams = NULL;
3312 tANI_U32 retCode;
3313 tANI_U8 i;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003314 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -07003315 tANI_U8 chanWidthSupp = 0;
3316 tpSirBssDescription bssDescription = &psessionEntry->pLimJoinReq->bssDescription;
3317
Jeff Johnson32d95a32012-09-10 13:15:23 -07003318 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
3319 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
3320 {
3321 limLog(pMac, LOGE, FL("Unable to PAL allocate memory during ADD_BSS\n") );
3322 return eSIR_MEM_ALLOC_FAILED;
3323 }
3324
Jeff Johnson295189b2012-06-20 16:38:30 -07003325
3326 // Package SIR_HAL_ADD_BSS_REQ message parameters
3327 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
3328 (void **) &pAddBssParams,
3329 sizeof( tAddBssParams )))
3330 {
3331 limLog( pMac, LOGP,
3332 FL( "Unable to PAL allocate memory during ADD_BSS\n" ));
3333 retCode = eSIR_MEM_ALLOC_FAILED;
3334 goto returnFailure;
3335 }
3336
3337 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
3338
3339
3340 limExtractApCapabilities( pMac,
3341 (tANI_U8 *) bssDescription->ieFields,
3342 limGetIElenFromBssDescription( bssDescription ),
Jeff Johnson32d95a32012-09-10 13:15:23 -07003343 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07003344
3345 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Jeff Johnson32d95a32012-09-10 13:15:23 -07003346 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003347 palCopyMemory( pMac->hHdd, pAddBssParams->bssId,bssDescription->bssId,
3348 sizeof( tSirMacAddr ));
3349
3350 // Fill in tAddBssParams selfMacAddr
3351 palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr,
3352 psessionEntry->selfMacAddr,
3353 sizeof( tSirMacAddr ));
3354
3355 /* Incorrect BSS Type which caused UMA Descriptor to be overwritten on
3356 * top of an already established Infra link. This lead to issues in
3357 * concurrent data transfer.
3358 */
3359
3360 pAddBssParams->bssType = psessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
3361 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
3362
3363 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
3364
Jeff Johnson32d95a32012-09-10 13:15:23 -07003365 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07003366 pAddBssParams->updateBss = updateEntry;
3367
3368
Jeff Johnson32d95a32012-09-10 13:15:23 -07003369 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
3370 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
3371 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
3372 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -07003373
3374
Jeff Johnson32d95a32012-09-10 13:15:23 -07003375 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -07003376 palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003377 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003378
3379 pAddBssParams->nwType = bssDescription->nwType;
3380
Jeff Johnson32d95a32012-09-10 13:15:23 -07003381 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -07003382 pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
3383 pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
3384 pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
3385 pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
3386
3387 // Use the advertised capabilities from the received beacon/PR
Jeff Johnson32d95a32012-09-10 13:15:23 -07003388 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -07003389 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003390 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -07003391
Jeff Johnson32d95a32012-09-10 13:15:23 -07003392 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003393 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003394 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
3395 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -07003396
3397#ifdef WLAN_SOFTAP_FEATURE
3398 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
3399#else
3400 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET);
3401#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07003402 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003403 (chanWidthSupp) )
3404 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003405 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
3406 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003407 }
3408 else
3409 {
3410 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003411 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003413 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
3414 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
3415 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07003416 }
3417 }
3418
3419 pAddBssParams->currentOperChannel = bssDescription->channelId;
3420
Jeff Johnsone7245742012-09-05 17:12:55 -07003421#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003422 if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present ))
Jeff Johnsone7245742012-09-05 17:12:55 -07003423 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003424 pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
3425 pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003426 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
3427 pAddBssParams->currentOperChannel,
3428 pAddBssParams->currentExtChannel,
3429 psessionEntry->apCenterChan,
3430 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003431 }
3432 else
3433 {
3434 pAddBssParams->vhtCapable = 0;
3435 }
3436#endif
3437
Jeff Johnson295189b2012-06-20 16:38:30 -07003438 // Populate the STA-related parameters here
3439 // Note that the STA here refers to the AP
3440 {
3441 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
3442
3443 palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId,
3444 bssDescription->bssId,
3445 sizeof( tSirMacAddr ));
3446 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
3447
3448 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
3449 pAddBssParams->staContext.uAPSD = 0;
3450 pAddBssParams->staContext.maxSPLen = 0;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003451 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -07003452 pAddBssParams->staContext.updateSta = updateEntry;
3453
Jeff Johnson32d95a32012-09-10 13:15:23 -07003454 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -07003455 {
3456 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
3457 pAddBssParams->staContext.htCapable = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003458 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
3459 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
3460 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003461 (chanWidthSupp) )
3462 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003463 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07003464 #ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003465 if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present ))
Jeff Johnsone7245742012-09-05 17:12:55 -07003466 {
3467 pAddBssParams->staContext.vhtCapable = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003468 pAddBssParams->staContext.vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -07003469 }
3470 #endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003471 }
3472 else
3473 {
3474 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3475 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003476 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
3477 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
3478 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
3479 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
3480 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
3481 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
3482 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
3483 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -07003484
Jeff Johnson32d95a32012-09-10 13:15:23 -07003485 if( pBeaconStruct->HTInfo.present )
3486 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07003487 }
3488
Jeff Johnson32d95a32012-09-10 13:15:23 -07003489 if ((psessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
3490 (psessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -07003491 pAddBssParams->staContext.wmmEnabled = 1;
3492 else
3493 pAddBssParams->staContext.wmmEnabled = 0;
3494
3495 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -07003496#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -07003497 limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003498 pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry,
3499 &pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -07003500#else
3501 limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003502 pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003503#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003504 limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,psessionEntry);
3505
3506 }
3507
3508
3509 //Disable BA. It will be set as part of ADDBA negotiation.
3510 for( i = 0; i < STACFG_MAX_TC; i++ )
3511 {
3512 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
3513 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
3514 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
3515 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
3516 }
3517
3518 pAddBssParams->staContext.encryptType = psessionEntry->encryptType;
3519
3520#if defined WLAN_FEATURE_VOWIFI
3521 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
3522#endif
3523
3524 pAddBssParams->status = eHAL_STATUS_SUCCESS;
3525 pAddBssParams->respReqd = true;
3526
3527 pAddBssParams->staContext.sessionId = psessionEntry->peSessionId;
3528 pAddBssParams->sessionId = psessionEntry->peSessionId;
3529
3530 pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
3531
Jeff Johnsone7245742012-09-05 17:12:55 -07003532 pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled ||
3533 limIsconnectedOnDFSChannel(bssDescription->channelId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003534
3535#if defined WLAN_FEATURE_VOWIFI_11R
3536 pAddBssParams->extSetStaKeyParamValid = 0;
3537#endif
3538
3539 // Set a new state for MLME
3540
3541 //pMac->lim.gLimMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
3542 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
3543
Jeff Johnsone7245742012-09-05 17:12:55 -07003544 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003545
3546 //we need to defer the message until we get the response back from HAL.
3547 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
3548
3549 msgQ.type = WDA_ADD_BSS_REQ;
3550 /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
3551 msgQ.reserved = 0;
3552 msgQ.bodyptr = pAddBssParams;
3553 msgQ.bodyval = 0;
3554
3555 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003556 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003557
3558 retCode = wdaPostCtrlMsg( pMac, &msgQ );
3559 if( eSIR_SUCCESS != retCode)
3560 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003561 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07003562 palFreeMemory(pMac->hHdd, pAddBssParams);
3563 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
3564 retCode );
3565 goto returnFailure;
3566
3567 }
3568 else
Jeff Johnson32d95a32012-09-10 13:15:23 -07003569 {
3570 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07003571 return retCode;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003572 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003573
3574 returnFailure:
3575 // Clean-up will be done by the caller...
Jeff Johnson32d95a32012-09-10 13:15:23 -07003576 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07003577 return retCode;
3578}
3579
3580
3581
3582
3583
3584#elif defined(ANI_AP_CLIENT_SDK)
3585tSirRetStatus limStaSendAddBss( tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,
3586 tpSirNeighborBssInfo neighborBssInfo, tANI_U8 updateEntry,
3587 tpPESession psessionEntry)
3588{
3589 tSirMsgQ msgQ;
3590 tpAddBssParams pAddBssParams = NULL;
3591 tANI_U32 retCode;
3592 tANI_U8 i;
3593 tpDphHashNode pStaDs = NULL;
3594
3595 // Package SIR_HAL_ADD_BSS_REQ message parameters
3596 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
3597 (void **) &pAddBssParams,
3598 sizeof( tAddBssParams )))
3599 {
3600 limLog( pMac, LOGP,
3601 FL( "Unable to PAL allocate memory during ADD_BSS\n" ));
3602 retCode = eSIR_MEM_ALLOC_FAILED;
3603 goto returnFailure;
3604 }
3605 else
3606 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
3607
3608 palCopyMemory( pMac->hHdd, pAddBssParams->bssId,neighborBssInfo->bssId,
3609 sizeof( tSirMacAddr ));
3610
3611#ifdef WLAN_SOFTAP_FEATURE
3612 // Fill in tAddBssParams selfMacAddr
3613 palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr, psessionEntry->selfMacAddr,
3614 sizeof( tSirMacAddr ));
3615#endif
3616
3617 pAddBssParams->bssType = eSIR_INFRASTRUCTURE_MODE;
3618 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
3619 pAddBssParams->beaconInterval = (tANI_U16) neighborBssInfo->beaconInterval;
3620 pAddBssParams->dtimPeriod = neighborBssInfo->dtimPeriod;
3621 pAddBssParams->updateBss = updateEntry;
3622
3623
3624 /* The following parameters are commented since the information is not available from the
3625 * neighborBssInfo. This needs to be fixed later */
3626#if 0
3627
3628 pAddBssParams->cfParamSet.cfpCount = beaconStruct.cfParamSet.cfpCount;
3629 pAddBssParams->cfParamSet.cfpPeriod = beaconStruct.cfParamSet.cfpPeriod;
3630 pAddBssParams->cfParamSet.cfpMaxDuration = beaconStruct.cfParamSet.cfpMaxDuration;
3631 pAddBssParams->cfParamSet.cfpDurRemaining = beaconStruct.cfParamSet.cfpDurRemaining;
3632#endif
3633 pAddBssParams->rateSet.numRates = pAssocRsp->supportedRates.numRates;
3634 palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
3635 pAssocRsp->supportedRates.rate, pAssocRsp->supportedRates.numRates );
3636
3637 /* Update PE session ID */
3638 pAddBssParams->sessionId = psessionEntry->peSessionId;
3639
3640 pAddBssParams->nwType = neighborBssInfo->nwType;
3641
3642 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime;
3643 pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
3644 pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
3645 pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
3646 pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
3647
3648 // Use the advertised capabilities from the received beacon/PR
3649 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( neighborBssInfo->HTCapsPresent ))
3650 {
3651 pAddBssParams->htCapable = pAssocRsp->HTCaps.present;
3652
3653 if ( neighborBssInfo->HTInfoPresent )
3654 {
3655 pAddBssParams->htOperMode = pAssocRsp->HTInfo.opMode;
3656 pAddBssParams->dualCTSProtection = ( tANI_U8 )pAssocRsp->HTInfo.dualCTSProtection;
3657
3658 if(pAssocRsp->HTCaps.supportedChannelWidthSet)
3659 {
3660 pAddBssParams->txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
3661 pAddBssParams->currentExtChannel = pAssocRsp->HTInfo.secondaryChannelOffset;
3662 }
3663 else
3664 {
3665 pAddBssParams->txChannelWidthSet = (tANI_U8)pAssocRsp->HTCaps.supportedChannelWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07003666 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003667 }
3668 pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent;
3669 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport;
3670 pAddBssParams->fRIFSMode = pAssocRsp->HTInfo.rifsMode;
3671 }
3672 }
3673
3674 pAddBssParams->currentOperChannel = neighborBssInfo->channelId;
3675
3676 // Populate the STA-related parameters here
3677 // Note that the STA here refers to the AP
3678 {
3679 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
3680
3681 palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId,
3682 neighborBssInfo->bssId,
3683 sizeof( tSirMacAddr ));
3684 pAddBssParams->staContext.listenInterval = (tANI_U8) neighborBssInfo->beaconInterval;
3685
3686 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
3687 pAddBssParams->staContext.uAPSD = 0;
3688 pAddBssParams->staContext.maxSPLen = 0;
3689 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortPreamble;
3690 pAddBssParams->staContext.updateSta = updateEntry;
3691
3692
3693 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pAssocRsp->HTCaps.present ))
3694 {
3695 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
3696 pAddBssParams->staContext.htCapable = 1;
3697 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 )pAssocRsp->HTCaps.greenField;
3698 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 )pAssocRsp->HTCaps.lsigTXOPProtection;
3699 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )(pAssocRsp->HTCaps.supportedChannelWidthSet ?
3700 pAssocRsp->HTInfo.recommendedTxWidthSet :
3701 pAssocRsp->HTCaps.supportedChannelWidthSet );
3702 pAddBssParams->staContext.mimoPS = pAssocRsp->HTCaps.mimoPowerSave;
3703 pAddBssParams->staContext.delBASupport = ( tANI_U8 )pAssocRsp->HTCaps.delayedBA;
3704 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 )pAssocRsp->HTCaps.maximalAMSDUsize;
3705 pAddBssParams->staContext.maxAmpduDensity = pAssocRsp->HTCaps.mpduDensity;
3706 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz;
3707 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz;
3708 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz;
3709 pAddBssParams->staContext.maxAmpduSize= pAssocRsp->HTCaps.maxRxAMPDUFactor;
3710
3711 if( pAssocRsp->HTInfo.present )
3712 pAddBssParams->staContext.rifsMode = pAssocRsp->HTInfo.rifsMode;
3713 }
3714
3715 if ((psessionEntry->limWmeEnabled && pAssocRsp->wmeEdcaPresent) ||
3716 (psessionEntry->limQosEnabled && pAssocRsp->edcaPresent))
3717 pAddBssParams->staContext.wmmEnabled = 1;
3718 else
3719 pAddBssParams->staContext.wmmEnabled = 0;
3720
3721 //Update the rates
3722
3723 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3724 if (pStaDs != NULL)
3725 {
3726 limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
3727 palCopyMemory(pMac->hHdd, (tANI_U8*)&pAddBssParams->staContext.supportedRates,
3728 (tANI_U8*)&pStaDs->supportedRates,
3729 sizeof(tSirSupportedRates));
3730 }
3731 else
3732 PELOGE(limLog(pMac, LOGE, FL("could not Update the supported rates.\n"));)
3733
3734 }
3735
3736 //Disable BA. It will be set as part of ADDBA negotiation.
3737 for( i = 0; i < SMAC_STACFG_MAX_TC; i++ )
3738 {
3739 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
3740 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
3741 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
3742 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
3743 }
3744
3745#if defined WLAN_FEATURE_VOWIFI
3746 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
3747#endif
3748 // FIXME_GEN4 - Any other value that can be used for initialization?
3749 pAddBssParams->status = eHAL_STATUS_SUCCESS;
3750 pAddBssParams->respReqd = true;
3751
3752 pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
3753
3754#if defined WLAN_FEATURE_VOWIFI_11R
3755 pAddBssParams->extSetStaKeyParamValid = 0;
3756#endif
3757
3758 // Set a new state for MLME
3759 if( eLIM_MLM_WT_ASSOC_RSP_STATE == psessionEntry->limMlmState )
3760 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE;
3761 else
3762 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003763 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003764
3765 //we need to defer the message until we get the response back from HAL.
3766 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
3767
3768 msgQ.type = SIR_HAL_ADD_BSS_REQ;
3769 /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
3770 msgQ.reserved = 0;
3771 msgQ.bodyptr = pAddBssParams;
3772 msgQ.bodyval = 0;
3773
3774 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003775 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003776
3777 retCode = halPostMsgApi( pMac, &msgQ );
3778 if( eSIR_SUCCESS != retCode)
3779 {
3780 palFreeMemory(pMac->hHdd, pAddBssParams);
3781 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
3782 retCode );
3783 }
3784 else
3785 return retCode;
3786
3787 returnFailure:
3788 // Clean-up will be done by the caller...
3789 return retCode;
3790}
3791
3792#endif // ANI_PRODUCT_TYPE_CLIENT
3793
3794/** -------------------------------------------------------------
3795\fn limPrepareAndSendDelStaCnf
3796\brief deletes DPH entry
3797 changes the MLM mode for station.
3798 calls limSendDelStaCnf
3799\param tpAniSirGlobal pMac
3800\param tpDphHashNode pStaDs
3801\return none
3802 -------------------------------------------------------------*/
3803
3804
3805void
3806limPrepareAndSendDelStaCnf(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tSirResultCodes statusCode,tpPESession psessionEntry)
3807{
3808 tANI_U16 staDsAssocId = 0;
3809 tSirMacAddr staDsAddr;
3810 tLimMlmStaContext mlmStaContext;
3811
3812 if(pStaDs == NULL)
3813 {
3814 PELOGW(limLog(pMac, LOGW, FL("pStaDs is NULL\n"));)
3815 return;
3816 }
3817 staDsAssocId = pStaDs->assocId;
3818 palCopyMemory( pMac->hHdd, (tANI_U8 *)staDsAddr,
3819 pStaDs->staAddr,
3820 sizeof(tSirMacAddr));
3821
3822 mlmStaContext = pStaDs->mlmStaContext;
3823 if(eSIR_SME_SUCCESS == statusCode)
3824 {
3825 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
3826 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
3827 {
3828 limReleaseAID(pMac, pStaDs->assocId);
3829 }
3830
3831 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
3832 }
3833 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
3834 {
3835 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003836 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003837 }
3838
3839 limSendDelStaCnf(pMac, staDsAddr, staDsAssocId, mlmStaContext, statusCode,psessionEntry);
3840}
3841
3842/** -------------------------------------------------------------
3843\fn limGetStaRateMode
3844\brief Gets the Station Rate Mode.
3845\param tANI_U8 dot11Mode
3846\return none
3847 -------------------------------------------------------------*/
3848tStaRateMode limGetStaRateMode(tANI_U8 dot11Mode)
3849{
3850 switch(dot11Mode)
3851 {
3852 case WNI_CFG_DOT11_MODE_11A:
3853 return eSTA_11a;
3854 case WNI_CFG_DOT11_MODE_11B:
3855 return eSTA_11b;
3856 case WNI_CFG_DOT11_MODE_11G:
3857 return eSTA_11bg;
3858 case WNI_CFG_DOT11_MODE_11N:
3859 return eSTA_11n;
Jeff Johnsone7245742012-09-05 17:12:55 -07003860#ifdef WLAN_FEATURE_11AC
3861 case WNI_CFG_DOT11_MODE_11AC:
3862 return eSTA_11ac;
3863#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003864 case WNI_CFG_DOT11_MODE_ALL:
3865 default:
3866 return eSTA_11n;
3867
3868 }
3869}
3870
3871/** -------------------------------------------------------------
3872\fn limInitPreAuthTimerTable
3873\brief Initialize the Pre Auth Tanle and creates the timer for
3874 each node for the timeout value got from cfg.
3875\param tpAniSirGlobal pMac
3876\param tpLimPreAuthTable pPreAuthTimerTable
3877\return none
3878 -------------------------------------------------------------*/
3879void limInitPreAuthTimerTable(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable)
3880{
3881 tANI_U32 cfgValue;
3882 tANI_U32 authNodeIdx;
3883 tpLimPreAuthNode pAuthNode = pPreAuthTimerTable->pTable;
3884
3885 // Get AUTH_RSP Timers value
3886
3887 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT,
3888 &cfgValue) != eSIR_SUCCESS)
3889 {
3890 /*
3891 ** Could not get AUTH_RSP timeout value
3892 ** from CFG. Log error.
3893 **/
3894 limLog(pMac, LOGP,
3895 FL("could not retrieve AUTH_RSP timeout value\n"));
3896 return;
3897 }
3898
3899 cfgValue = SYS_MS_TO_TICKS(cfgValue);
3900 for(authNodeIdx=0; authNodeIdx<pPreAuthTimerTable->numEntry; authNodeIdx++, pAuthNode++)
3901 {
3902 if (tx_timer_create(&pAuthNode->timer,
3903 "AUTH RESPONSE TIMEOUT",
3904 limAuthResponseTimerHandler,
3905 authNodeIdx,
3906 cfgValue,
3907 0,
3908 TX_NO_ACTIVATE) != TX_SUCCESS)
3909 {
3910 // Cannot create timer. Log error.
3911 limLog(pMac, LOGP, FL("Cannot create Auth Rsp timer of Index :%d.\n"), authNodeIdx);
3912 return;
3913 }
3914 pAuthNode->authNodeIdx = (tANI_U8)authNodeIdx;
3915 pAuthNode->fFree = 1;
3916 }
3917
3918}
3919
3920/** -------------------------------------------------------------
3921\fn limAcquireFreePreAuthNode
3922\brief Retrives a free Pre Auth node from Pre Auth Table.
3923\param tpAniSirGlobal pMac
3924\param tpLimPreAuthTable pPreAuthTimerTable
3925\return none
3926 -------------------------------------------------------------*/
3927tLimPreAuthNode * limAcquireFreePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable)
3928{
3929 tANI_U32 i;
3930 tLimPreAuthNode *pTempNode = pPreAuthTimerTable->pTable;
3931 for (i=0; i<pPreAuthTimerTable->numEntry; i++,pTempNode++)
3932 {
3933 if (pTempNode->fFree == 1)
3934 {
3935 pTempNode->fFree = 0;
3936 return pTempNode;
3937 }
3938 }
3939
3940 return NULL;
3941}
3942
3943/** -------------------------------------------------------------
3944\fn limGetPreAuthNodeFromIndex
3945\brief Depending on the Index this retrives the pre auth node.
3946\param tpAniSirGlobal pMac
3947\param tpLimPreAuthTable pAuthTable
3948\param tANI_U32 authNodeIdx
3949\return none
3950 -------------------------------------------------------------*/
3951tLimPreAuthNode * limGetPreAuthNodeFromIndex(tpAniSirGlobal pMac,
3952 tpLimPreAuthTable pAuthTable, tANI_U32 authNodeIdx)
3953{
3954 if ((authNodeIdx >= pAuthTable->numEntry) || (pAuthTable->pTable == NULL))
3955 {
3956 limLog(pMac, LOGE, FL("Invalid Auth Timer Index : %d NumEntry : %d\n"),
3957 authNodeIdx, pAuthTable->numEntry);
3958 return NULL;
3959 }
3960
3961 return pAuthTable->pTable + authNodeIdx;
3962}
3963
3964/* Util API to check if the channels supported by STA is within range */
3965tSirRetStatus limIsDot11hSupportedChannelsValid(tpAniSirGlobal pMac, tSirAssocReq *assoc)
3966{
3967 /*
3968 * Allow all the stations to join with us.
3969 * 802.11h-2003 11.6.1 => An AP may use the supported channels list for associated STAs
3970 * as an input into an algorithm used to select a new channel for the BSS.
3971 * The specification of the algorithm is beyond the scope of this amendment.
3972 */
3973
3974 return (eSIR_SUCCESS);
3975}
3976
3977/* Util API to check if the txpower supported by STA is within range */
3978tSirRetStatus limIsDot11hPowerCapabilitiesInRange(tpAniSirGlobal pMac, tSirAssocReq *assoc,tpPESession psessionEntry)
3979{
3980 tPowerdBm localMaxTxPower;
3981 tANI_U32 localPwrConstraint;
3982
3983 localMaxTxPower = cfgGetRegulatoryMaxTransmitPower(pMac, psessionEntry->currentOperChannel);
3984
3985 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
3986 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg\n" ));
3987 return eSIR_FAILURE;
3988 }
3989 localMaxTxPower -= (tPowerdBm)localPwrConstraint;
3990
3991 /**
3992 * The min Tx Power of the associating station should not be greater than (regulatory
3993 * max tx power - local power constraint configured on AP).
3994 */
3995 if(assoc->powerCapability.minTxPower > localMaxTxPower)
3996 {
3997 limLog(pMac, LOGW, FL("minTxPower (STA) = %d, localMaxTxPower (AP) = %d\n"),
3998 assoc->powerCapability.minTxPower, localMaxTxPower);
3999 return (eSIR_FAILURE);
4000 }
4001
4002 return (eSIR_SUCCESS);
4003}
4004
4005/** -------------------------------------------------------------
4006\fn limFillRxHighestSupportedRate
4007\brief Fills in the Rx Highest Supported Data Rate field from
4008\ the 'supported MCS set' field in HT capability element.
4009\param tpAniSirGlobal pMac
4010\param tpSirSupportedRates pRates
4011\param tANI_U8* pSupportedMCSSet
4012\return none
4013 -------------------------------------------------------------*/
4014void limFillRxHighestSupportedRate(tpAniSirGlobal pMac, tANI_U16 *rxHighestRate, tANI_U8* pSupportedMCSSet)
4015{
4016 tSirMacRxHighestSupportRate *pRxHighestRate;
4017 tANI_U8 *pBuf;
4018 tANI_U16 rate=0;
4019
4020 pBuf = pSupportedMCSSet + MCS_RX_HIGHEST_SUPPORTED_RATE_BYTE_OFFSET;
4021 rate = limGetU16(pBuf);
4022
4023 pRxHighestRate = (tSirMacRxHighestSupportRate *) &rate;
4024 *rxHighestRate = pRxHighestRate->rate;
4025
4026 return;
4027}