blob: b795d0209f3a873a684e24ebff3c05a41a53ae61 [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
Madan Mohan Koyyalamudif33324b2012-11-06 19:16:17 -0800849 if((mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE) ||
850 (mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_FAILURE))
Jeff Johnsone7245742012-09-05 17:12:55 -0700851 {
852 if(mlmStaContext.resultCode != eSIR_SME_SUCCESS )
853 {
854 peDeleteSession(pMac, psessionEntry);
855 psessionEntry = NULL;
856 }
857
858 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
859 mlmStaContext.resultCode, mlmStaContext.protStatusCode, psessionEntry,
860 smesessionId, smetransactionId);
861 }
862 else
863 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700864 palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq);
865 psessionEntry->pLimJoinReq = NULL;
866
867 if(mlmStaContext.resultCode != eSIR_SME_SUCCESS)
868 {
869 peDeleteSession(pMac,psessionEntry);
870 psessionEntry = NULL;
871 }
872
873 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, mlmStaContext.resultCode, mlmStaContext.protStatusCode,
874 psessionEntry, smesessionId, smetransactionId);
Jeff Johnsone7245742012-09-05 17:12:55 -0700875 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700876
877 }
878
879 if((NULL != psessionEntry)
880#ifdef WLAN_SOFTAP_FEATURE
881 && (eLIM_AP_ROLE != psessionEntry->limSystemRole )
882#endif
883 )
884 {
885 peDeleteSession(pMac,psessionEntry);
886 psessionEntry = NULL;
887 }
888}
889
890/**
891 * limRejectAssociation()
892 *
893 *FUNCTION:
894 * This function is called whenever Re/Association Request need
895 * to be rejected due to failure in assigning an AID or failure
896 * in adding STA context at Polaris or reject by applications.
897 *
898 *LOGIC:
899 * Resources allocated if any are freedup and (Re) Association
900 * Response frame is sent to requesting STA. Pre-Auth context
901 * will be added for this STA if it does not exist already
902 *
903 *ASSUMPTIONS:
904 *
905 *NOTE:
906 *
907 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
908 * @param subType - Indicates whether it is Association Request (=0) or
909 * Reassociation Request (=1) frame
910 * @param addPreAuthContext - Indicates whether pre-auth context
911 * to be added for this STA
912 * @param authType - Indicates auth type to be added
913 * @param staId - Indicates staId of the STA being rejected
914 * association
915 * @param deleteSta - Indicates whether to delete STA context
916 * at Polaris
917 * @param rCode - Indicates what reasonCode to be sent in
918 * Re/Assoc response to STA
919 *
920 * @return None
921 */
922
923void
924limRejectAssociation(tpAniSirGlobal pMac, tSirMacAddr peerAddr, tANI_U8 subType,
925 tANI_U8 addPreAuthContext, tAniAuthType authType,
926 tANI_U16 staId, tANI_U8 deleteSta, tSirResultCodes rCode, tpPESession psessionEntry )
927{
928 tpDphHashNode pStaDs;
929
930 if (addPreAuthContext)
931 {
932 // Create entry for this STA in pre-auth list
933 struct tLimPreAuthNode *pAuthNode;
934
935 pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable);
936
937 if (pAuthNode)
938 {
939 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAuthNode->peerMacAddr,
940 peerAddr,
941 sizeof(tSirMacAddr));
942 pAuthNode->fTimerStarted = 0;
943 pAuthNode->mlmState = eLIM_MLM_AUTHENTICATED_STATE;
944 pAuthNode->authType = (tAniAuthType) authType;
945 limAddPreAuthNode(pMac, pAuthNode);
946 }
947 }
948
949 if (deleteSta == true)
950 {
951 pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable);
952
953 if (pStaDs == NULL)
954 {
955 limLog(pMac, LOGW,
956 FL("No STA context, yet rejecting Association\n"));
957
958 return;
959 }
960
961 /**
962 * Polaris has state for this STA.
963 * Trigger cleanup.
964 */
965 pStaDs->mlmStaContext.cleanupTrigger = eLIM_REASSOC_REJECT;
966
967 // Receive path cleanup
968 limCleanupRxPath(pMac, pStaDs, psessionEntry);
969
970 // Send Re/Association Response with
971 // status code to requesting STA.
972 limSendAssocRspMgmtFrame(pMac,
973 rCode,
974 0,
975 peerAddr,
976 subType, 0,psessionEntry);
977
978 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL)
979 {
980 // Assoction confirmation is complete, free the copy of association request frame
981 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
982 {
983 palFreeMemory(pMac->hHdd,((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
984 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
985 }
986 palFreeMemory(pMac->hHdd, psessionEntry->parsedAssocReq[pStaDs->assocId]);
987 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
988 }
989 }
990 else
991 {
992 limSendAssocRspMgmtFrame(pMac,
993 eSIR_MAC_MAX_ASSOC_STA_REACHED_STATUS,
994 1,
995 peerAddr,
996 subType, 0,psessionEntry);
997 // Log error
998 limLog(pMac, LOGW,
999 FL("received Re/Assoc req when max associated STAs reached from \n"));
1000 limPrintMacAddr(pMac, peerAddr, LOGW);
1001 limSendSmeMaxAssocExceededNtf(pMac, peerAddr, psessionEntry->smeSessionId);
1002 }
1003} /*** end limRejectAssociation() ***/
1004
1005#ifdef WLAN_SOFTAP_FEATURE
1006
1007/** -------------------------------------------------------------
1008\fn limDecideApProtectionOnHt20Delete
1009\brief protection related function while HT20 station is getting deleted.
1010\param tpAniSirGlobal pMac
1011\param tpDphHashNode pStaDs
1012\param tpUpdateBeaconParams pBeaconParams
1013\return None
1014 -------------------------------------------------------------*/
1015static void
1016limDecideApProtectionOnHt20Delete(tpAniSirGlobal pMac,
1017 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1018{
1019 tANI_U32 i = 0;
1020 PELOG1( limLog(pMac, LOG1, FL("(%d) A HT 20 STA is disassociated. Addr is "),
1021 psessionEntry->gLimHt20Params.numSta);
1022 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1023 if (psessionEntry->gLimHt20Params.numSta > 0)
1024 {
1025 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1026 {
1027 if (psessionEntry->protStaCache[i].active)
1028 {
1029 if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
1030 pStaDs->staAddr, sizeof(tSirMacAddr)))
1031 {
1032 psessionEntry->gLimHt20Params.numSta--;
1033 psessionEntry->protStaCache[i].active = false;
1034 break;
1035 }
1036 }
1037 }
1038 }
1039
1040 if (psessionEntry->gLimHt20Params.numSta == 0)
1041 {
1042 // disable protection
1043 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
1044 }
1045}
1046/** -------------------------------------------------------------
1047\fn limDecideApProtectionOnDelete
1048\brief Decides about protection related settings when a station is getting deleted.
1049\param tpAniSirGlobal pMac
1050\param tpDphHashNode pStaDs
1051\param tpUpdateBeaconParams pBeaconParams
1052\return None
1053 -------------------------------------------------------------*/
1054void
1055limDecideApProtectionOnDelete(tpAniSirGlobal pMac,
1056 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1057{
1058 tANI_U32 phyMode;
1059 tHalBitVal erpEnabled = eHAL_CLEAR;
1060 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1061 tANI_U32 i;
1062
1063 if(NULL == pStaDs)
1064 return;
1065
1066 limGetRfBand(pMac, &rfBand, psessionEntry);
1067 if(SIR_BAND_5_GHZ == rfBand)
1068 {
1069 //we are HT. if we are 11A, then protection is not required.
Jeff Johnsone7245742012-09-05 17:12:55 -07001070 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001071 {
1072 //we are HT and 11A station is leaving.
1073 //protection consideration required.
1074 //HT station leaving ==> this case is commonly handled between both the bands below.
1075 if((psessionEntry->beaconParams.llaCoexist) &&
1076 (false == pStaDs->mlmStaContext.htCapability))
1077 {
1078 PELOG1(limLog(pMac, LOG1, FL("(%d) A 11A STA is disassociated. Addr is "),
1079 psessionEntry->gLim11aParams.numSta);
1080 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1081 if (psessionEntry->gLim11aParams.numSta > 0)
1082 {
1083 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1084 {
1085 if (psessionEntry->protStaCache[i].active)
1086 {
1087 if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
1088 pStaDs->staAddr, sizeof(tSirMacAddr)))
1089 {
1090 psessionEntry->gLim11aParams.numSta--;
1091 psessionEntry->protStaCache[i].active = false;
1092 break;
1093 }
1094 }
1095 }
1096 }
1097
1098 if(psessionEntry->gLim11aParams.numSta == 0)
1099 {
1100 // disable protection
1101 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
1102 }
1103 }
1104 }
1105 }
1106 else if(SIR_BAND_2_4_GHZ == rfBand)
1107 {
1108 limGetPhyMode(pMac, &phyMode, psessionEntry);
1109
1110 erpEnabled = pStaDs->erpEnabled;
1111 //we are HT or 11G and 11B station is getting deleted.
1112 if (((phyMode == WNI_CFG_PHY_MODE_11G) ||
Jeff Johnsone7245742012-09-05 17:12:55 -07001113 psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001114 (erpEnabled == eHAL_CLEAR))
1115 {
1116 PELOG1(limLog(pMac, LOG1, FL("(%d) A legacy STA is disassociated. Addr is "),
1117 psessionEntry->gLim11bParams.numSta);
1118 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1119 if (psessionEntry->gLim11bParams.numSta > 0)
1120 {
1121 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1122 {
1123 if (psessionEntry->protStaCache[i].active)
1124 {
1125 if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
1126 pStaDs->staAddr, sizeof(tSirMacAddr)))
1127 {
1128 psessionEntry->gLim11bParams.numSta--;
1129 psessionEntry->protStaCache[i].active = false;
1130 break;
1131 }
1132 }
1133 }
1134 }
1135
1136 if (psessionEntry->gLim11bParams.numSta == 0)
1137 {
1138 // disable protection
1139 PELOG1(limLog(pMac, LOG1, FL("No 11B STA exists\n"));)
1140 limEnable11gProtection(pMac, false, false, pBeaconParams,psessionEntry);
1141 }
1142 }
1143 //(non-11B station is leaving) or (we are not 11G or HT AP)
Jeff Johnsone7245742012-09-05 17:12:55 -07001144 else if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001145 { //we are HT AP and non-11B station is leaving.
1146
1147 //11g station is leaving
1148 if(!pStaDs->mlmStaContext.htCapability)
1149 {
1150 PELOG1(limLog(pMac, LOG1, FL("(%d) A 11g STA is disassociated. Addr is "),
1151 psessionEntry->gLim11bParams.numSta);
1152 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1153 if (psessionEntry->gLim11gParams.numSta > 0)
1154 {
1155 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1156 {
1157 if (psessionEntry->protStaCache[i].active)
1158 {
1159 if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
1160 pStaDs->staAddr, sizeof(tSirMacAddr)))
1161 {
1162 psessionEntry->gLim11gParams.numSta--;
1163 psessionEntry->protStaCache[i].active = false;
1164 break;
1165 }
1166 }
1167 }
1168 }
1169
1170 if (psessionEntry->gLim11gParams.numSta == 0)
1171 {
1172 // disable protection
1173 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
1174 }
1175 }
1176 }
1177 }
1178
1179 //LSIG TXOP not supporting staiton leaving. applies to 2.4 as well as 5 GHZ.
Jeff Johnsone7245742012-09-05 17:12:55 -07001180 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001181 (true == pStaDs->mlmStaContext.htCapability))
1182 {
1183 //HT non-GF leaving
1184 if(!pStaDs->htGreenfield)
1185 {
1186 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-GF STA is disassociated. Addr is "),
1187 psessionEntry->gLimNonGfParams.numSta);
1188 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1189 if (psessionEntry->gLimNonGfParams.numSta > 0)
1190 {
1191 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1192 {
1193 if (psessionEntry->protStaCache[i].active)
1194 {
1195 if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
1196 pStaDs->staAddr, sizeof(tSirMacAddr)))
1197 {
1198 psessionEntry->gLimNonGfParams.numSta--;
1199 psessionEntry->protStaCache[i].active = false;
1200 break;
1201 }
1202 }
1203 }
1204 }
1205
1206 if (psessionEntry->gLimNonGfParams.numSta == 0)
1207 {
1208 // disable protection
1209 limEnableHTNonGfProtection(pMac, false, false, pBeaconParams,psessionEntry);
1210 }
1211 }
1212 //HT 20Mhz station leaving.
1213 if(psessionEntry->beaconParams.ht20Coexist &&
1214 (eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet))
1215 {
1216 limDecideApProtectionOnHt20Delete(pMac, pStaDs, pBeaconParams,psessionEntry);
1217 }
1218
1219 if(false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport &&
1220 (false == pStaDs->htLsigTXOPProtection))
1221 {
1222 PELOG1( limLog(pMac, LOG1, FL("(%d) A HT LSIG not supporting STA is disassociated. Addr is "),
1223 psessionEntry->gLimLsigTxopParams.numSta);
1224 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1225 if (psessionEntry->gLimLsigTxopParams.numSta > 0)
1226 {
1227 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1228 {
1229 if (psessionEntry->protStaCache[i].active)
1230 {
1231 if (palEqualMemory( pMac->hHdd,psessionEntry->protStaCache[i].addr,
1232 pStaDs->staAddr, sizeof(tSirMacAddr)))
1233 {
1234 psessionEntry->gLimLsigTxopParams.numSta--;
1235 psessionEntry->protStaCache[i].active = false;
1236 break;
1237 }
1238 }
1239 }
1240 }
1241
1242 if (psessionEntry->gLimLsigTxopParams.numSta == 0)
1243 {
1244 // disable protection
1245 limEnableHTLsigTxopProtection(pMac, true, false, pBeaconParams,psessionEntry);
1246 }
1247 }
1248 }
1249}
1250
1251#endif
1252
1253
1254/** -------------------------------------------------------------
1255\fn limDecideShortPreamble
1256\brief Decides about any short preamble reated change because of new station joining.
1257\param tpAniSirGlobal pMac
1258\param tpDphHashNode pStaDs
1259\param tpUpdateBeaconParams pBeaconParams
1260\return None
1261 -------------------------------------------------------------*/
1262void limDecideShortPreamble(tpAniSirGlobal pMac,
1263 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry )
1264{
1265 tANI_U32 i;
1266
1267 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
1268 {
1269 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-short preamble STA is disassociated. Addr is "),
1270 psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
1271 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1272 if (psessionEntry->gLimNoShortParams.numNonShortPreambleSta > 0)
1273 {
1274 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1275 {
1276 if (psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
1277 {
1278 if (palEqualMemory( pMac->hHdd, psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
1279 pStaDs->staAddr, sizeof(tSirMacAddr)))
1280 {
1281 psessionEntry->gLimNoShortParams.numNonShortPreambleSta--;
1282 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = false;
1283 break;
1284 }
1285 }
1286 }
1287 }
1288
1289 if (psessionEntry->gLimNoShortParams.numNonShortPreambleSta == 0)
1290 {
1291 // enable short preamble
1292 PELOG1(limLog(pMac, LOG1, FL("All associated STAs have short preamble support now.\n"));)
1293 //reset the cache
1294 palZeroMemory( pMac->hHdd, (tANI_U8 *)&psessionEntry->gLimNoShortParams , sizeof(tLimNoShortParams));
1295 if (limEnableShortPreamble(pMac, true, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
1296 PELOGE(limLog(pMac, LOGE, FL("Cannot enable short preamble\n"));)
1297 }
1298 }
1299}
1300
1301/** -------------------------------------------------------------
1302\fn limDecideShortSlot
1303\brief Decides about any short slot time related change because of station leaving the BSS.
1304\param tpAniSirGlobal pMac
1305\param tpDphHashNode pStaDs
1306\return None
1307 -------------------------------------------------------------*/
1308
1309void
1310limDecideShortSlot(tpAniSirGlobal pMac, tpDphHashNode pStaDs,
1311 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
1312{
1313 tANI_U32 i, val;
1314 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
1315 {
1316 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-short slottime STA is disassociated. Addr is "),
1317 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
1318 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1319
1320#ifdef WLAN_SOFTAP_FEATURE
1321 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
1322 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta> 0)
1323 {
1324 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1325 {
1326 if (psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
1327 {
1328 if (palEqualMemory( pMac->hHdd, psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
1329 pStaDs->staAddr, sizeof(tSirMacAddr)))
1330 {
1331 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta--;
1332 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = false;
1333 break;
1334 }
1335 }
1336 }
1337 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001338 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001339#endif
1340 {
1341 if (pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta> 0)
1342 {
1343 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1344 {
1345 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
1346 {
1347 if (palEqualMemory( pMac->hHdd, pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
1348 pStaDs->staAddr, sizeof(tSirMacAddr)))
1349 {
1350 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta--;
1351 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = false;
1352 break;
1353 }
1354 }
1355 }
1356 }
1357 }
1358
1359 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
1360
1361#ifdef WLAN_SOFTAP_FEATURE
1362 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
1363 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta == 0))
1364 {
1365 // enable short slot time
1366 PELOG1(limLog(pMac, LOG1, FL("All associated STAs have short slot time support now.\n"));)
1367 //reset the cache
1368 palZeroMemory( pMac->hHdd, (tANI_U8 *)&psessionEntry->gLimNoShortSlotParams , sizeof(tLimNoShortSlotParams));
1369 // in case of AP set SHORT_SLOT_TIME to enable
1370 if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
1371 {
1372 pBeaconParams->fShortSlotTime = true;
1373 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnsone7245742012-09-05 17:12:55 -07001374 psessionEntry->shortSlotTimeSupported = true;
Jeff Johnson295189b2012-06-20 16:38:30 -07001375 }
1376 }
1377 else
1378#endif
1379 {
1380 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta == 0)
1381 {
1382 // enable short slot time
1383 PELOG1(limLog(pMac, LOG1, FL("All associated STAs have short slot time support now.\n"));)
1384 //reset the cache
1385 palZeroMemory( pMac->hHdd, (tANI_U8 *)&pMac->lim.gLimNoShortSlotParams , sizeof(tLimNoShortSlotParams));
1386 // in case of AP set SHORT_SLOT_TIME to enable
1387 if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
1388 {
1389 pBeaconParams->fShortSlotTime = true;
1390 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnsone7245742012-09-05 17:12:55 -07001391 psessionEntry->shortSlotTimeSupported = true;
1392 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001393 }
1394 }
1395 }
1396}
1397
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -07001398void
1399limPostReassocFailure(tpAniSirGlobal pMac,
1400 tSirResultCodes resultCode,
1401 tANI_U16 protStatusCode,tpPESession psessionEntry)
1402{
1403 tLimMlmReassocCnf mlmReassocCnf;
1404
1405 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
1406 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE));
1407
1408 // 'Change' timer for future activations
1409 limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
1410
1411 mlmReassocCnf.resultCode = resultCode;
1412 mlmReassocCnf.protStatusCode = protStatusCode;
1413 /* Update PE session Id */
1414 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
1415 limPostSmeMessage(pMac,
1416 LIM_MLM_REASSOC_CNF,
1417 (tANI_U32 *) &mlmReassocCnf);
1418} /*** end limPostReassocFailure() ***/
1419
Jeff Johnson295189b2012-06-20 16:38:30 -07001420/**
1421 * limRestorePreReassocState()
1422 *
1423 *FUNCTION:
1424 * This function is called on STA role whenever Reasociation
1425 * Response with a reject code is received from AP.
1426 *
1427 *LOGIC:
1428 * Reassociation failure timer is stopped, Old (or current) AP's
1429 * context is restored both at Polaris & software
1430 *
1431 *ASSUMPTIONS:
1432 *
1433 *NOTE:
1434 *
1435 * @param pMac - Pointer to Global MAC structure
1436 * @param resultCode - Result code that specifies why Reassociation
1437 * attemp failed
1438 *
1439 * @return None
1440 */
1441
1442void
1443limRestorePreReassocState(tpAniSirGlobal pMac,
1444 tSirResultCodes resultCode,
1445 tANI_U16 protStatusCode,tpPESession psessionEntry)
1446{
Jeff Johnsone7245742012-09-05 17:12:55 -07001447 tANI_U8 chanNum, secChanOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07001448 tLimMlmReassocCnf mlmReassocCnf;
1449
Jeff Johnson295189b2012-06-20 16:38:30 -07001450 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001451 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07001452
1453 // 'Change' timer for future activations
1454 limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
1455
1456 // Update BSSID at CFG database
1457 #if 0
1458 if (cfgSetStr(pMac, WNI_CFG_BSSID,
1459 pMac->lim.gLimCurrentBssId,
1460 sizeof(tSirMacAddr)) != eSIR_SUCCESS)
1461 {
1462 /// Could not update BSSID at CFG. Log error.
1463 limLog(pMac, LOGP, FL("could not update BSSID at CFG\n"));
1464 return;
1465 }
Madan Mohan Koyyalamudi70322d52012-10-18 20:07:33 -07001466 #endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001467
1468 // chanNum = pMac->lim.gLimCurrentChannelId;
1469
1470 /* To support BT-AMP */
1471 chanNum = psessionEntry->currentOperChannel;
Jeff Johnsone7245742012-09-05 17:12:55 -07001472 secChanOffset = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07001473
Jeff Johnsone7245742012-09-05 17:12:55 -07001474 limSetChannel(pMac, chanNum, secChanOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001475
1476 /** @ToDo : Need to Integrate the STOP the DataTransfer to the AP from 11H code */
1477
1478 mlmReassocCnf.resultCode = resultCode;
1479 mlmReassocCnf.protStatusCode = protStatusCode;
1480 /* Update PE session Id */
1481 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
1482 limPostSmeMessage(pMac,
1483 LIM_MLM_REASSOC_CNF,
1484 (tANI_U32 *) &mlmReassocCnf);
1485} /*** end limRestorePreReassocState() ***/
1486
1487
1488
1489/**
1490 * limIsReassocInProgress()
1491 *
1492 *FUNCTION:
1493 * This function is called to see if STA is in wt-reassoc-rsp state.
1494 *
1495 *LOGIC:
1496 *
1497 *ASSUMPTIONS:
1498 *
1499 *NOTE:
1500 *
1501 * @param pMac - Pointer to Global MAC structure
1502 *
1503 * @return eANI_BOOLEAN_TRUE When STA is waiting for Reassoc response from AP \n
1504 * else eANI_BOOLEAN_FALSE
1505 */
1506
1507eAniBoolean
1508limIsReassocInProgress(tpAniSirGlobal pMac,tpPESession psessionEntry)
1509{
1510 if(((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
1511 ((psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE) ||
1512 (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_LINK_FAIL_STATE)))
1513 return eANI_BOOLEAN_TRUE;
1514
1515 return eANI_BOOLEAN_FALSE;
1516} /*** end limIsReassocInProgress() ***/
1517
Jeff Johnsone7245742012-09-05 17:12:55 -07001518#ifdef WLAN_FEATURE_11AC
1519tSirRetStatus limPopulateVhtMcsSet(tpAniSirGlobal pMac,
1520 tpSirSupportedRates pRates,
1521 tDot11fIEVHTCaps *pPeerVHTCaps,
1522 tpPESession psessionEntry)
1523{
1524 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07001525
Jeff Johnsone7245742012-09-05 17:12:55 -07001526 if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
1527 {
1528 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_MCS_MAP,&val) !=
1529 eSIR_SUCCESS )
1530 {
1531 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX MCS MAP\n"));)
1532 goto error;
1533 }
1534 pRates->vhtRxMCSMap = (tANI_U16)val;
1535
1536 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_MCS_MAP,&val ) !=
1537 eSIR_SUCCESS )
1538 {
1539 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT TX MCS MAP\n"));)
1540 goto error;
1541 }
1542 pRates->vhtTxMCSMap = (tANI_U16)val;
1543
1544 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,&val ) !=
1545 eSIR_SUCCESS )
1546 {
1547 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP\n"));)
1548 goto error;
1549 }
1550 pRates->vhtRxHighestDataRate = (tANI_U16)val;
1551
1552 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,&val ) !=
1553 eSIR_SUCCESS )
1554 {
1555 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP\n"));)
1556 goto error;
1557 }
1558 pRates->vhtTxHighestDataRate = (tANI_U16)val;
1559
1560 if( pPeerVHTCaps != NULL)
1561 {
1562 pRates->vhtTxHighestDataRate = SIR_MIN(pRates->vhtTxHighestDataRate, pPeerVHTCaps->txSupDataRate);
1563 pRates->vhtRxHighestDataRate = SIR_MIN(pRates->vhtRxHighestDataRate, pPeerVHTCaps->rxHighSupDataRate);
1564
1565 // Aquire PEER MCS map if we exceed.
1566 // We compare/update only the last 2 bits of the map as we support only single BSS.
1567 // Firmware takes care of this comparison
1568 pRates->vhtRxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap
1569 pRates->vhtRxMCSMap |= (pPeerVHTCaps->rxMCSMap & 0x3); // Updating the last 2 bits in the bitmap
1570
1571 // Firmware takes care of this comparison
1572 pRates->vhtTxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap
1573 pRates->vhtTxMCSMap |= (pPeerVHTCaps->txMCSMap & 0x3); // Updating the last 2 bits in the bitmap
1574 }
1575 }
1576 return eSIR_SUCCESS;
1577error:
1578
1579 return eSIR_FAILURE;
1580
1581}
1582#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001583
1584/**
1585 * limPopulateOwnRateSet
1586 *
1587 * FUNCTION:
1588 * This function is called by limProcessAssocRsp() or
1589 * limAddStaInIBSS()
1590 * - It creates a combined rate set of 12 rates max which
1591 * comprises the basic and extended rates read from CFG
1592 * - It sorts the combined rate Set and copy it in the
1593 * rate array of the pSTA descriptor
1594 * - It sets the erpEnabled bit of the STA descriptor
1595 *
1596 * NOTE:
1597 * ERP bit is set iff the dph PHY mode is 11G and there is at least
1598 * an A rate in the supported or extended rate sets
1599 *
1600 * @param pMac - Pointer to Global MAC structure
1601 * @param basicOnly - When passed value is true, only basic
1602 * rates are copied to DPH node else
1603 * all supported rates are copied
1604 * @return eSIR_SUCCESS or eSIR_FAILURE
1605 *
1606 */
Jeff Johnsone7245742012-09-05 17:12:55 -07001607#ifdef WLAN_FEATURE_11AC
1608tSirRetStatus
1609limPopulateOwnRateSet(tpAniSirGlobal pMac,
1610 tpSirSupportedRates pRates,
1611 tANI_U8* pSupportedMCSSet,
1612 tANI_U8 basicOnly,
1613 tpPESession psessionEntry,
1614 tDot11fIEVHTCaps *pVHTCaps)
1615#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001616tSirRetStatus
1617limPopulateOwnRateSet(tpAniSirGlobal pMac,
1618 tpSirSupportedRates pRates,
1619 tANI_U8* pSupportedMCSSet,
1620 tANI_U8 basicOnly,
1621 tpPESession psessionEntry)
Jeff Johnsone7245742012-09-05 17:12:55 -07001622#endif
1623
Jeff Johnson295189b2012-06-20 16:38:30 -07001624{
1625 tSirMacRateSet tempRateSet;
1626 tSirMacRateSet tempRateSet2;
1627 tANI_U32 i,j,val,min,isArate;
1628 tANI_U32 phyMode = 0;
1629
1630 isArate = 0;
1631
1632 limGetPhyMode(pMac, &phyMode, psessionEntry);
1633
1634 // Get own rate set
1635 #if 0
1636 val = WNI_CFG_OPERATIONAL_RATE_SET_LEN;
1637 if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1638 (tANI_U8 *) &tempRateSet.rate,
1639 &val) != eSIR_SUCCESS)
1640 {
1641 /// Could not get rateset from CFG. Log error.
1642 limLog(pMac, LOGP, FL("could not retrieve rateset\n"));
1643 }
1644 #endif // TO SUPPORT BT-AMP
1645
1646 /* copy operational rate set from psessionEntry */
1647 palCopyMemory(pMac->hHdd,(tANI_U8 *)tempRateSet.rate,(tANI_U8*)(psessionEntry->rateSet.rate), psessionEntry->rateSet.numRates);
1648 tempRateSet.numRates = psessionEntry->rateSet.numRates;
1649
1650 if (phyMode == WNI_CFG_PHY_MODE_11G)
1651 {
1652
1653 // get own extended rate set
1654 #if 0
1655 val = WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN;
1656 if (wlan_cfgGetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
1657 (tANI_U8 *) &tempRateSet2.rate,
1658 &val) != eSIR_SUCCESS)
1659 {
1660 /// Could not get extended rateset from CFG. Log error.
1661 limLog(pMac, LOGP, FL("could not retrieve extended rateset\n"));
1662 }
1663 tempRateSet2.numRates = (tANI_U8) val;
1664 #endif
1665
1666 palCopyMemory(pMac->hHdd,(tANI_U8 *)tempRateSet2.rate, (tANI_U8*)(psessionEntry->extRateSet.rate), psessionEntry->extRateSet.numRates);
1667 tempRateSet2.numRates = psessionEntry->extRateSet.numRates;
1668
1669 }
1670 else
1671 tempRateSet2.numRates = 0;
1672
1673
1674 if ((tempRateSet.numRates + tempRateSet2.numRates) > 12)
1675 {
1676 //we are in big trouble
1677 limLog(pMac, LOGP, FL("more than 12 rates in CFG\n"));
1678 //panic
1679 goto error;
1680 }
1681
1682
1683 //copy all rates in tempRateSet, there are 12 rates max
1684 for (i = 0;i < tempRateSet2.numRates; i++)
1685 tempRateSet.rate[i + tempRateSet.numRates] = tempRateSet2.rate[i];
1686 tempRateSet.numRates += tempRateSet2.numRates;
1687
1688 /**
1689 * Sort rates in tempRateSet (they are likely to be already sorted)
1690 * put the result in pSupportedRates
1691 */
1692 {
1693 tANI_U8 aRateIndex = 0;
1694 tANI_U8 bRateIndex = 0;
1695
1696 palZeroMemory( pMac->hHdd, (tANI_U8 *) pRates, sizeof(tSirSupportedRates));
1697 for(i = 0;i < tempRateSet.numRates; i++)
1698 {
1699 min = 0;
1700 val = 0xff;
1701 isArate = 0;
1702 for(j = 0;j < tempRateSet.numRates; j++)
1703 {
1704 if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
1705 {
1706 val = tempRateSet.rate[j] & 0x7f;
1707 min = j;
1708 }
1709 }
1710
1711 if (sirIsArate(tempRateSet.rate[min] & 0x7f))
1712 isArate = 1;
1713
1714 /*
1715 * HAL needs to know whether the rate is basic rate or not, as it needs to
1716 * update the response rate table accordingly. e.g. if one of the 11a rates is
1717 * basic rate, then that rate can be used for sending control frames.
1718 * HAL updates the response rate table whenever basic rate set is changed.
1719 */
1720 if (basicOnly)
1721 {
1722 if (tempRateSet.rate[min] & 0x80)
1723 {
1724 if (isArate)
1725 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1726 else
1727 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1728 }
1729 }
1730 else
1731 {
1732 if (isArate)
1733 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1734 else
1735 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1736 }
1737 tempRateSet.rate[min] = 0xff;
1738 }
1739
1740 }
1741
1742
1743 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode))
1744 {
1745 val = SIZE_OF_SUPPORTED_MCS_SET;
1746 if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
1747 pRates->supportedMCSSet,
1748 &val) != eSIR_SUCCESS)
1749 {
1750 /// Could not get rateset from CFG. Log error.
1751 PELOGE(limLog(pMac, LOGE, FL("could not retrieve supportedMCSSet\n"));)
1752 goto error;
1753 }
1754
1755
1756 //if supported MCS Set of the peer is passed in, then do the intersection
1757 //else use the MCS set from local CFG.
1758
1759 if(pSupportedMCSSet != NULL)
1760 {
1761 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
1762 pRates->supportedMCSSet[i] &= pSupportedMCSSet[i];
1763
1764 }
1765
1766 PELOG2(limLog(pMac, LOG2, FL("MCS Rate Set Bitmap: \n"));)
1767 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
1768 PELOGW(limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);)
1769 }
1770
Jeff Johnsone7245742012-09-05 17:12:55 -07001771#ifdef WLAN_FEATURE_11AC
1772 limPopulateVhtMcsSet(pMac, pRates , pVHTCaps,psessionEntry);
1773#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001774
1775 return eSIR_SUCCESS;
1776
1777 error:
1778
1779 return eSIR_FAILURE;
1780} /*** limPopulateOwnRateSet() ***/
1781
Jeff Johnson295189b2012-06-20 16:38:30 -07001782/**
1783 * limPopulateMatchingRateSet
1784 * FUNCTION:
1785 * This is called at the time of Association Request
1786 * processing on AP and while adding peer's context
1787 * in IBSS role to process the CFG rate sets and
1788 * the rate sets received in the Assoc request on AP
1789 * or Beacon/Probe Response from peer in IBSS.
1790 *
1791 * LOGIC:
1792 * 1. It makes the intersection between our own rate Sat
1793 * and extemcded rate set and the ones received in the
1794 * association request.
1795 * 2. It creates a combined rate set of 12 rates max which
1796 * comprised the basic and extended rates
1797 * 3. It sorts the combined rate Set and copy it in the
1798 * rate array of the pSTA descriptor
1799 *
1800 * ASSUMPTION:
1801 * The parser has already ensured unicity of the rates in the
1802 * association request structure
1803 *
1804 * @param: pMac - Pointer to Global MAC structure
1805 * pStaDs - Pointer to DPH node
1806 * pOperRateSet - Pointer to peer's supported rateset
1807 * pExtRateSet - Pointer to peer's extended rateset
1808 *
1809 * @return: eSIR_SUCCESS or eSIR_FAILURE
1810 */
Jeff Johnsone7245742012-09-05 17:12:55 -07001811#ifdef WLAN_FEATURE_11AC
1812tSirRetStatus
1813limPopulateMatchingRateSet(tpAniSirGlobal pMac,
1814 tpDphHashNode pStaDs,
1815 tSirMacRateSet *pOperRateSet,
1816 tSirMacRateSet *pExtRateSet,
1817 tANI_U8* pSupportedMCSSet,
1818 tSirMacPropRateSet *pAniLegRateSet,
1819 tpPESession psessionEntry,
1820 tDot11fIEVHTCaps *pVHTCaps)
Jeff Johnson295189b2012-06-20 16:38:30 -07001821
Jeff Johnsone7245742012-09-05 17:12:55 -07001822#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001823tSirRetStatus
1824limPopulateMatchingRateSet(tpAniSirGlobal pMac,
1825 tpDphHashNode pStaDs,
1826 tSirMacRateSet *pOperRateSet,
1827 tSirMacRateSet *pExtRateSet,
1828 tANI_U8* pSupportedMCSSet,
1829 tSirMacPropRateSet *pAniLegRateSet,
1830 tpPESession psessionEntry)
Jeff Johnsone7245742012-09-05 17:12:55 -07001831#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001832{
1833 tSirMacRateSet tempRateSet;
1834 tSirMacRateSet tempRateSet2;
1835 tANI_U32 i,j,val,min,isArate;
1836 tANI_U32 phyMode;
1837 tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET];
1838
1839 isArate=0;
1840
1841 // limGetPhyMode(pMac, &phyMode);
1842 limGetPhyMode(pMac, &phyMode, psessionEntry);
1843
1844 // get own rate set
1845 // val = WNI_CFG_OPERATIONAL_RATE_SET_LEN;
1846 #if 0
1847 if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1848 (tANI_U8 *) &tempRateSet.rate,
1849 &val) != eSIR_SUCCESS)
1850 {
1851 /// Could not get rateset from CFG. Log error.
1852 limLog(pMac, LOGP, FL("could not retrieve rateset\n"));
1853 }
1854
1855 #endif // TO SUPPORT BT-AMP
1856
1857 /* copy operational rate set from psessionEntry */
1858 palCopyMemory(pMac->hHdd,(tempRateSet.rate),(psessionEntry->rateSet.rate),psessionEntry->rateSet.numRates);
1859 tempRateSet.numRates = (tANI_U8) psessionEntry->rateSet.numRates;
1860
1861 if (phyMode == WNI_CFG_PHY_MODE_11G)
1862 {
1863
1864 #if 0
1865 // get own extended rate set
1866 val = WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN;
1867 if (wlan_cfgGetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
1868 (tANI_U8 *) &tempRateSet2.rate,
1869 &val) != eSIR_SUCCESS)
1870 #endif
1871 palCopyMemory(pMac->hHdd,(tempRateSet2.rate),(psessionEntry->extRateSet.rate),psessionEntry->extRateSet.numRates);
1872 tempRateSet2.numRates = (tANI_U8) psessionEntry->extRateSet.numRates;
1873 }
1874 else
1875 tempRateSet2.numRates = 0;
1876
1877 if ((tempRateSet.numRates + tempRateSet2.numRates) > 12)
1878 {
1879 PELOGE(limLog(pMac, LOGE, FL("more than 12 rates in CFG\n"));)
1880 goto error;
1881 }
1882
1883 /**
1884 * Handling of the rate set IEs is the following:
1885 * - keep only rates that we support and that the station supports
1886 * - sort and the rates into the pSta->rate array
1887 */
1888
1889 // Copy all rates in tempRateSet, there are 12 rates max
1890 for(i = 0; i < tempRateSet2.numRates; i++)
1891 tempRateSet.rate[i + tempRateSet.numRates] =
1892 tempRateSet2.rate[i];
1893
1894 tempRateSet.numRates += tempRateSet2.numRates;
1895
1896 /**
1897 * Sort rates in tempRateSet (they are likely to be already sorted)
1898 * put the result in tempRateSet2
1899 */
1900 tempRateSet2.numRates = 0;
1901
1902 for(i = 0;i < tempRateSet.numRates; i++)
1903 {
1904 min = 0;
1905 val = 0xff;
1906
1907 for(j = 0;j < tempRateSet.numRates; j++)
1908 if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
1909 {
1910 val = tempRateSet.rate[j] & 0x7f;
1911 min = j;
1912 }
1913
1914 tempRateSet2.rate[tempRateSet2.numRates++] =
1915 tempRateSet.rate[min];
1916 tempRateSet.rate[min] = 0xff;
1917 }
1918
1919
1920 /**
1921 * Copy received rates in tempRateSet, the parser has ensured
1922 * unicity of the rates so there cannot be more than 12
1923 */
1924 for(i = 0; i < pOperRateSet->numRates; i++)
1925 {
1926 tempRateSet.rate[i] = pOperRateSet->rate[i];
1927 }
1928
1929 tempRateSet.numRates = pOperRateSet->numRates;
1930
1931 if (pExtRateSet->numRates)
1932 {
1933 if((tempRateSet.numRates + pExtRateSet->numRates) > 12 )
1934 {
1935 limLog( pMac, LOG2,
1936 "Sum of SUPPORTED and EXTENDED Rate Set (%1d) exceeds 12!",
1937 tempRateSet.numRates + pExtRateSet->numRates );
1938
1939 if( tempRateSet.numRates < 12 )
1940 {
1941 int found = 0;
1942 int tail = tempRateSet.numRates;
1943
1944 for( i = 0; i < pExtRateSet->numRates; i++ )
1945 {
1946 found = 0;
1947 for( j = 0; j < (tANI_U32) tail; j++ )
1948 {
1949 if((tempRateSet.rate[j] & 0x7F) ==
1950 (pExtRateSet->rate[i] & 0x7F))
1951 {
1952 found = 1;
1953 break;
1954 }
1955 }
1956
1957 if( !found )
1958 {
1959 tempRateSet.rate[tempRateSet.numRates++] =
1960 pExtRateSet->rate[i];
1961
1962 if( tempRateSet.numRates >= 12 )
1963 break;
1964 }
1965 }
1966 }
1967 else
1968 limLog( pMac, LOG2,
1969 "Relying only on the SUPPORTED Rate Set IE..." );
1970 }
1971 else
1972 {
1973 for(j = 0; j < pExtRateSet->numRates; j++)
1974 tempRateSet.rate[i+j] = pExtRateSet->rate[j];
1975
1976 tempRateSet.numRates += pExtRateSet->numRates;
1977 }
1978 }
1979
1980 {
1981 tpSirSupportedRates rates = &pStaDs->supportedRates;
1982 tANI_U8 aRateIndex = 0;
1983 tANI_U8 bRateIndex = 0;
1984 palZeroMemory( pMac->hHdd, (tANI_U8 *) rates, sizeof(tSirSupportedRates));
1985 for(i = 0;i < tempRateSet2.numRates; i++)
1986 {
1987 for(j = 0;j < tempRateSet.numRates; j++)
1988 {
1989 if ((tempRateSet2.rate[i] & 0x7F) ==
1990 (tempRateSet.rate[j] & 0x7F))
1991 {
1992#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
1993 if ((bRateIndex > HAL_NUM_11B_RATES) || (aRateIndex > HAL_NUM_11A_RATES))
1994 {
1995 limLog(pMac, LOGE, FL("Invalid number of rates (11b->%d, 11a->%d)\n"),
1996 bRateIndex, aRateIndex);
1997 return eSIR_FAILURE;
1998 }
1999#endif
2000 if (sirIsArate(tempRateSet2.rate[i] & 0x7f))
2001 {
2002 isArate=1;
2003 rates->llaRates[aRateIndex++] = tempRateSet2.rate[i];
2004 }
2005 else
2006 rates->llbRates[bRateIndex++] = tempRateSet2.rate[i];
2007 break;
2008 }
2009 }
2010 }
2011
2012
2013 //Now add the Polaris rates only when Proprietary rates are enabled.
2014 val = 0;
2015 if(wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_RATES_ENABLED, &val) != eSIR_SUCCESS)
2016 {
2017 limLog(pMac, LOGP, FL("could not retrieve prop rate enabled flag from CFG\n"));
2018 }
2019 else if(val)
2020 {
2021 for(i=0; i<pAniLegRateSet->numPropRates; i++)
2022 rates->aniLegacyRates[i] = pAniLegRateSet->propRate[i];
2023 }
2024
2025 }
2026
2027
2028 //compute the matching MCS rate set, if peer is 11n capable and self mode is 11n
2029 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
2030 (pStaDs->mlmStaContext.htCapability))
2031 {
2032 val = SIZE_OF_SUPPORTED_MCS_SET;
2033 if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
2034 mcsSet,
2035 &val) != eSIR_SUCCESS)
2036 {
2037 /// Could not get rateset from CFG. Log error.
2038 limLog(pMac, LOGP, FL("could not retrieve supportedMCSSet\n"));
2039 goto error;
2040 }
2041
2042 for(i=0; i<val; i++)
2043 pStaDs->supportedRates.supportedMCSSet[i] = mcsSet[i] & pSupportedMCSSet[i];
2044
2045 PELOG2(limLog(pMac, LOG2, FL("limPopulateMatchingRateSet: MCS Rate Set Bitmap from CFG and DPH : \n"));)
2046 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
2047 {
2048 PELOG2(limLog(pMac, LOG2,FL("%x %x "), mcsSet[i], pStaDs->supportedRates.supportedMCSSet[i]);)
2049 }
2050 }
2051
Jeff Johnsone7245742012-09-05 17:12:55 -07002052#ifdef WLAN_FEATURE_11AC
2053 limPopulateVhtMcsSet(pMac, &pStaDs->supportedRates, pVHTCaps, psessionEntry);
2054#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002055 /**
2056 * Set the erpEnabled bit iff the phy is in G mode and at least
2057 * one A rate is supported
2058 */
2059 if ((phyMode == WNI_CFG_PHY_MODE_11G) && isArate)
2060 pStaDs->erpEnabled = eHAL_SET;
2061
2062
2063
2064 return eSIR_SUCCESS;
2065
2066 error:
2067
2068 return eSIR_FAILURE;
2069} /*** limPopulateMatchingRateSet() ***/
2070
2071
2072
2073/**
2074 * limAddSta()
2075 *
2076 *FUNCTION:
2077 * This function is called to add an STA context at hardware
2078 * whenever a STA is (Re) Associated.
2079 *
2080 *LOGIC:
2081 *
2082 *ASSUMPTIONS:
2083 * NA
2084 *
2085 *NOTE:
2086 * NA
2087 *
2088 * @param pMac - Pointer to Global MAC structure
2089 * @param pStaDs - Pointer to the STA datastructure created by
2090 * LIM and maintained by DPH
2091 * @return retCode - Indicates success or failure return code
2092 */
2093
2094tSirRetStatus
2095limAddSta(
2096 tpAniSirGlobal pMac,
2097 tpDphHashNode pStaDs,tpPESession psessionEntry)
2098{
2099 tpAddStaParams pAddStaParams = NULL;
2100 tSirMsgQ msgQ;
2101 tSirRetStatus retCode = eSIR_SUCCESS;
2102 tSirMacAddr staMac, *pStaAddr;
2103 tANI_U8 i;
2104#ifdef WLAN_FEATURE_P2P
2105 tpSirAssocReq pAssocReq;
2106 tANI_U8 *p2pIe = NULL;
2107#endif
2108 #if 0
2109 retCode = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg);
2110 if (retCode != eSIR_SUCCESS)
2111 limLog(pMac, LOGP, FL("could not retrieve STA MAC\n"));
2112 #endif //To SUPPORT BT-AMP
2113
2114
2115 sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
2116
2117 if( eHAL_STATUS_SUCCESS !=
2118 palAllocateMemory( pMac->hHdd, (void **) &pAddStaParams, sizeof( tAddStaParams )))
2119 {
2120 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA\n" ));
2121 return eSIR_MEM_ALLOC_FAILED;
2122 }
2123 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams, sizeof(tAddStaParams));
2124
2125 if ((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||
2126 (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE) ||
2127 (limGetSystemRole(psessionEntry) == eLIM_BT_AMP_AP_ROLE) )
2128 pStaAddr = &pStaDs->staAddr;
2129 else
2130 pStaAddr = &staMac;
2131
2132 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->staMac,
2133 (tANI_U8 *) *pStaAddr, sizeof(tSirMacAddr));
2134 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->bssId,
2135 psessionEntry->bssId, sizeof(tSirMacAddr));
2136
2137 limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
2138
2139 //Copy legacy rates
2140 palCopyMemory(pMac->hHdd, (tANI_U8*)&pAddStaParams->supportedRates,
2141 (tANI_U8*)&pStaDs->supportedRates, sizeof(tSirSupportedRates));
2142
2143 pAddStaParams->assocId = pStaDs->assocId;
2144
2145 pAddStaParams->wmmEnabled = pStaDs->qosMode;
2146 pAddStaParams->listenInterval = pStaDs->mlmStaContext.listenInterval;
2147 pAddStaParams->shortPreambleSupported = pStaDs->shortPreambleEnabled;
2148#ifdef WLAN_SOFTAP_FEATURE
2149 if((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) && (pStaDs->mlmStaContext.subType == LIM_REASSOC))
2150 {
2151 /* TBD - need to remove this REASSOC check after fixinf rmmod issue */
2152 pAddStaParams->updateSta = pStaDs->mlmStaContext.updateContext;
2153 }
2154#endif
2155 pStaDs->valid = 0;
2156 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
2157
2158 // This will indicate HAL to "allocate" a new STA index
2159 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
2160 pAddStaParams->staType = pStaDs->staType;
2161
2162 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2163 pAddStaParams->respReqd = 1;
2164 //Update HT Capability
2165
2166 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 -07002167 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002168 pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability;
Jeff Johnsone7245742012-09-05 17:12:55 -07002169#ifdef WLAN_FEATURE_11AC
2170 pAddStaParams->vhtCapable = pStaDs->mlmStaContext.vhtCapability;
2171#endif
2172 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002173 else
Jeff Johnsone7245742012-09-05 17:12:55 -07002174 {
2175 pAddStaParams->htCapable = psessionEntry->htCapability;
2176#ifdef WLAN_FEATURE_11AC
2177 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
2178#endif
2179
2180 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002181
2182 pAddStaParams->greenFieldCapable = pStaDs->htGreenfield;
2183 pAddStaParams->maxAmpduDensity= pStaDs->htAMpduDensity;
2184 pAddStaParams->maxAmpduSize = pStaDs->htMaxRxAMpduFactor;
2185 pAddStaParams->fDsssCckMode40Mhz = pStaDs->htDsssCckRate40MHzSupport;
2186 pAddStaParams->fShortGI20Mhz = pStaDs->htShortGI20Mhz;
2187 pAddStaParams->fShortGI40Mhz = pStaDs->htShortGI40Mhz;
2188 pAddStaParams->lsigTxopProtection = pStaDs->htLsigTXOPProtection;
2189 pAddStaParams->maxAmsduSize = pStaDs->htMaxAmsduLength;
2190 pAddStaParams->txChannelWidthSet = pStaDs->htSupportedChannelWidthSet;
2191 pAddStaParams->mimoPS = pStaDs->htMIMOPSState;
Jeff Johnsone7245742012-09-05 17:12:55 -07002192
2193#ifdef WLAN_FEATURE_11AC
2194 if(pAddStaParams->vhtCapable)
2195 {
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002196 pAddStaParams->vhtTxChannelWidthSet = pStaDs->vhtSupportedChannelWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07002197 }
2198#endif
2199
Jeff Johnson295189b2012-06-20 16:38:30 -07002200 /* Update PE session ID*/
2201 pAddStaParams->sessionId = psessionEntry->peSessionId;
2202
2203 if (psessionEntry->parsedAssocReq != NULL)
2204 {
2205#ifdef WLAN_FEATURE_P2P
2206 // Get a copy of the already parsed Assoc Request
2207 pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
2208 if ( pAssocReq && pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
2209 p2pIe = limGetP2pIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
2210 }
2211 pAddStaParams->p2pCapableSta = (p2pIe != NULL);
2212#endif
2213 }
2214
2215 //Disable BA. It will be set as part of ADDBA negotiation.
2216 for( i = 0; i < STACFG_MAX_TC; i++ )
2217 {
2218 pAddStaParams->staTCParams[i].txUseBA = eBA_DISABLE;
2219 pAddStaParams->staTCParams[i].rxUseBA = eBA_DISABLE;
2220 }
2221
2222#ifdef WLAN_SOFTAP_FEATURE
2223 if(pStaDs->wmeEnabled && (eLIM_AP_ROLE == psessionEntry->limSystemRole))
2224 {
2225 pAddStaParams->uAPSD = 0;
2226 /* update UAPSD and send it to LIM to add STA */
2227 // bitmap MSB <- LSB MSB 4 bits are for
2228 // trigger enabled AC setting and LSB 4 bits
2229 // are for delivery enabled AC setting
2230 // 7 6 5 4 3 2 1 0
2231 // BE BK VI VO BE BK VI VO
2232 pAddStaParams->uAPSD |= pStaDs->qos.capability.qosInfo.acvo_uapsd;
2233 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acvi_uapsd << 1);
2234 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbk_uapsd << 2);
2235 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbe_uapsd << 3);
2236 //making delivery enabled and trigger enabled setting the same.
2237 pAddStaParams->uAPSD |= pAddStaParams->uAPSD << 4;
2238
2239 pAddStaParams->maxSPLen = pStaDs->qos.capability.qosInfo.maxSpLen;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002240 limLog( pMac, LOG1, FL( "uAPSD = 0x%x, maxSpLen = %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 pAddStaParams->uAPSD, pAddStaParams->maxSPLen);
2242 }
2243#endif
2244 //we need to defer the message until we get the response back from HAL.
2245 if (pAddStaParams->respReqd)
2246 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07002247
2248 msgQ.type = WDA_ADD_STA_REQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07002249
2250 msgQ.reserved = 0;
2251 msgQ.bodyptr = pAddStaParams;
2252 msgQ.bodyval = 0;
2253
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002254 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_STA_REQ for assocId %d\n" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002255 pStaDs->assocId);
Jeff Johnsone7245742012-09-05 17:12:55 -07002256 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002257
2258 retCode = wdaPostCtrlMsg( pMac, &msgQ );
2259 if( eSIR_SUCCESS != retCode)
2260 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002261 if (pAddStaParams->respReqd)
2262 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07002263 limLog( pMac, LOGE, FL("ADD_STA_REQ for aId %d failed (reason %X)\n"),
2264 pStaDs->assocId, retCode );
2265 palFreeMemory(pMac->hHdd, (void*)pAddStaParams);
2266 }
2267
2268 return retCode;
2269}
2270
2271
2272/**
2273 * limDelSta()
2274 *
2275 *FUNCTION:
2276 * This function is called to delete an STA context at hardware
2277 * whenever a STA is disassociated
2278 *
2279 *LOGIC:
2280 *
2281 *ASSUMPTIONS:
2282 * NA
2283 *
2284 *NOTE:
2285 * NA
2286 *
2287 * @param pMac - Pointer to Global MAC structure
2288 * @param pStaDs - Pointer to the STA datastructure created by
2289 * LIM and maintained by DPH
2290 * @param fRespReqd - flag to indicate whether the delete is synchronous (true)
2291 * or not (false)
2292 * @return retCode - Indicates success or failure return code
2293 */
2294
2295tSirRetStatus
2296limDelSta(
2297 tpAniSirGlobal pMac,
2298 tpDphHashNode pStaDs,
2299 tANI_BOOLEAN fRespReqd,
2300 tpPESession psessionEntry)
2301{
2302 tpDeleteStaParams pDelStaParams = NULL;
2303 tSirMsgQ msgQ;
2304 tSirRetStatus retCode = eSIR_SUCCESS;
2305
2306 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **) &pDelStaParams, sizeof( tDeleteStaParams )))
2307 {
2308 limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA\n" ));
2309 return eSIR_MEM_ALLOC_FAILED;
2310 }
2311
2312 palZeroMemory( pMac->hHdd, (tANI_U8 *) pDelStaParams, sizeof(tDeleteStaParams));
2313
2314 //
2315 // DPH contains the STA index only for "peer" STA entries.
2316 // LIM global contains "self" STA index
2317 // Thus,
2318 // if( STA role )
2319 // get STA index from LIM global
2320 // else
2321 // get STA index from DPH
2322 //
2323
2324#if 0
2325 /* Since we have not created any STA, no need to send msg to delete
2326 * STA to HAL */
2327 if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) {
2328 pDelStaParams->staIdx = 1; /* TODO : This is workaround. Need to find right STA Index before sending to HAL */
2329 //return retCode;
2330 }
2331#endif
2332
2333 if( (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) ||(eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) )
2334 pDelStaParams->staIdx= psessionEntry->staId;
2335
2336 else
2337 pDelStaParams->staIdx= pStaDs->staIndex;
2338
2339 pDelStaParams->assocId = pStaDs->assocId;
2340 pStaDs->valid = 0;
2341
2342 if (! fRespReqd)
2343 pDelStaParams->respReqd = 0;
2344 else
2345 {
2346 //when limDelSta is called from processSmeAssocCnf then mlmState is already set properly.
2347 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs))
2348 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002349 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002350 SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs, eLIM_MLM_WT_DEL_STA_RSP_STATE);
2351 }
2352 if ( (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) ||
2353 (eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) )
2354 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002355 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002356
2357 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
2358
2359 }
2360 pDelStaParams->respReqd = 1;
2361 //we need to defer the message until we get the response back from HAL.
2362 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
2363 }
2364
2365 /* Update PE session ID*/
2366 pDelStaParams->sessionId = psessionEntry->peSessionId;
2367
2368 pDelStaParams->status = eHAL_STATUS_SUCCESS;
2369 msgQ.type = WDA_DELETE_STA_REQ;
2370 msgQ.reserved = 0;
2371 msgQ.bodyptr = pDelStaParams;
2372 msgQ.bodyval = 0;
2373
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002374 limLog( pMac, LOG1, FL( "Sending SIR_HAL_DELETE_STA_REQ for STAID: %X and AssocID: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002375 pDelStaParams->staIdx, pDelStaParams->assocId);
Jeff Johnsone7245742012-09-05 17:12:55 -07002376 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002377 retCode = wdaPostCtrlMsg( pMac, &msgQ );
2378 if( eSIR_SUCCESS != retCode)
2379 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002380 if(fRespReqd)
2381 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07002382 limLog( pMac, LOGE, FL("Posting DELETE_STA_REQ to HAL failed, reason=%X\n"),
2383 retCode );
2384 palFreeMemory(pMac->hHdd, (void*)pDelStaParams);
2385 }
2386
2387 return retCode;
2388}
2389
2390#if defined WLAN_FEATURE_VOWIFI_11R
2391/*------------------------------------------------------------------------
2392 * limAddFTStaSelf()
2393 *
2394 * FUNCTION:
2395 *
2396 * This function is called to add a STA once we have connected with a new
2397 * AP, that we have performed an FT to.
2398 *
2399 * The Add STA Response is created and now after the ADD Bss Is Successful
2400 * we add the self sta. We update with the association id from the reassoc
2401 * response from the AP.
2402 *------------------------------------------------------------------------
2403 */
2404tSirRetStatus limAddFTStaSelf(tpAniSirGlobal pMac, tANI_U16 assocId, tpPESession psessionEntry)
2405{
2406 tpAddStaParams pAddStaParams = NULL;
2407 tSirMsgQ msgQ;
2408 tSirRetStatus retCode = eSIR_SUCCESS;
2409
2410 pAddStaParams = pMac->ft.ftPEContext.pAddStaReq;
2411 pAddStaParams->assocId = assocId;
2412
2413 msgQ.type = SIR_HAL_ADD_STA_REQ;
2414 msgQ.reserved = 0;
2415 msgQ.bodyptr = pAddStaParams;
2416 msgQ.bodyval = 0;
2417
2418
2419#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
2420 limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ), pAddStaParams->assocId);
2421#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002422 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002423
2424 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2425 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
2426 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
2427 {
2428 limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X\n"), retCode );
2429 palFreeMemory(pMac->hHdd, (void*)pAddStaParams);
2430 }
2431 //
2432 // Dont need it any more
2433 pMac->ft.ftPEContext.pAddStaReq = NULL;
2434 return retCode;
2435}
2436
2437#endif /* WLAN_FEATURE_VOWIFI_11R */
2438
2439/**
2440 * limAddStaSelf()
2441 *
2442 *FUNCTION:
2443 * This function is called to add an STA context at hardware
2444 * whenever a STA is (Re) Associated.
2445 *
2446 *LOGIC:
2447 *
2448 *ASSUMPTIONS:
2449 * NA
2450 *
2451 *NOTE:
2452 * NA
2453 *
2454 * @param pMac - Pointer to Global MAC structure
2455 * @param pStaDs - Pointer to the STA datastructure created by
2456 * LIM and maintained by DPH
2457 * @return retCode - Indicates success or failure return code
2458 */
2459
2460tSirRetStatus
2461limAddStaSelf(tpAniSirGlobal pMac,tANI_U16 staIdx, tANI_U8 updateSta, tpPESession psessionEntry)
2462{
2463 tpAddStaParams pAddStaParams = NULL;
2464 tSirMsgQ msgQ;
2465 tSirRetStatus retCode = eSIR_SUCCESS;
2466 tSirMacAddr staMac;
2467 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
2468
2469 #if 0
2470 retCode =wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg);
2471 if (retCode != eSIR_SUCCESS)
2472 {
2473 /// Could not get BSSID from CFG. Log error.
2474 limLog(pMac, LOGP, FL("could not retrieve STA MAC\n"));
2475 return retCode;
2476 }
2477 #endif //TO SUPPORT BT-AMP
2478 sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
2479
2480 if( eHAL_STATUS_SUCCESS !=
2481 palAllocateMemory( pMac->hHdd, (void **) &pAddStaParams, sizeof( tAddStaParams )))
2482 {
2483 limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA\n" ));
2484 return eSIR_MEM_ALLOC_FAILED;
2485 }
2486 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams, sizeof(tAddStaParams));
2487
2488 /// Add STA context at MAC HW (BMU, RHP & TFP)
2489 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->staMac,
2490 (tANI_U8 *) staMac, sizeof(tSirMacAddr));
2491
2492 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->bssId,
2493 psessionEntry->bssId, sizeof(tSirMacAddr));
2494
2495 pAddStaParams->assocId = psessionEntry->limAID;
2496 pAddStaParams->staType = STA_ENTRY_SELF;
2497 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2498 pAddStaParams->respReqd = 1;
2499
2500 /* Update PE session ID */
2501 pAddStaParams->sessionId = psessionEntry->peSessionId;
2502
2503 // This will indicate HAL to "allocate" a new STA index
2504 pAddStaParams->staIdx = staIdx;
2505 pAddStaParams->updateSta = updateSta;
2506
2507 pAddStaParams->shortPreambleSupported = psessionEntry->beaconParams.fShortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -07002508
Jeff Johnsone7245742012-09-05 17:12:55 -07002509#ifdef WLAN_FEATURE_11AC
2510 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry,NULL);
2511#else
2512 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
2513#endif
2514 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07002515 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002516 pAddStaParams->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -07002517#ifdef DISABLE_GF_FOR_INTEROP
2518 /*
2519 * To resolve the interop problem with Broadcom AP,
2520 * where TQ STA could not pass traffic with GF enabled,
2521 * TQ STA will do Greenfield only with TQ AP, for
2522 * everybody else it will be turned off.
2523 */
2524 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2525 {
2526 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
2527 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
2528 }
2529 else
2530#endif
2531
2532#ifdef WLAN_SOFTAP_FEATURE
2533 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
2534 pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
2535 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
2536 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
2537 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
2538 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
2539 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
2540 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
2541 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
2542 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
2543 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
2544 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
2545#else
2546 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD );
2547 pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET );
2548 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE );
2549 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE );
2550 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION );
2551 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA );
2552 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY );
2553 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR);
2554 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH );
2555 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ);
2556 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ);
2557 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ);
2558#endif
2559 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002560#ifdef WLAN_FEATURE_11AC
2561 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002562 pAddStaParams->vhtTxChannelWidthSet = psessionEntry->apChanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -07002563#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002564 if(wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
2565 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL\n"));
2566 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
2567
2568#ifdef WLAN_FEATURE_P2P
2569 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona)
2570 {
2571 pAddStaParams->p2pCapableSta = 1;
2572 }
2573#endif
2574
2575 limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
2576
2577 msgQ.type = WDA_ADD_STA_REQ;
2578 //
2579 // FIXME_GEN4
2580 // A global counter (dialog token) is required to keep track of
2581 // all PE <-> HAL communication(s)
2582 //
2583 msgQ.reserved = 0;
2584 msgQ.bodyptr = pAddStaParams;
2585 msgQ.bodyval = 0;
2586
2587 limLog( pMac, LOGW, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ),
2588 pAddStaParams->assocId);
Jeff Johnsone7245742012-09-05 17:12:55 -07002589 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002590
2591 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
2592 {
2593 limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X\n"), retCode );
2594 palFreeMemory(pMac->hHdd, (void*)pAddStaParams);
2595 }
2596 return retCode;
2597}
2598
2599
2600/**
2601 * limTeardownInfraBSS()
2602 *
2603 *FUNCTION:
2604 * This function is called by various LIM functions to teardown
2605 * an established Infrastructure BSS
2606 *
2607 *LOGIC:
2608 *
2609 *ASSUMPTIONS:
2610 *
2611 *NOTE:
2612 *
2613 * @param pMac - Pointer to Global MAC structure
2614 * @return None
2615 */
2616
2617void
2618limTeardownInfraBss(tpAniSirGlobal pMac,tpPESession psessionEntry)
2619{
2620 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
2621
2622 /**
2623 * Send Broadcast Disassociate frame with
2624 * 'leaving BSS' reason.
2625 */
2626 limSendDisassocMgmtFrame(pMac,
2627 eSIR_MAC_DISASSOC_LEAVING_BSS_REASON,
2628 bcAddr,psessionEntry);
2629} /*** end limTeardownInfraBss() ***/
2630
2631
2632/**
2633 * limHandleCnfWaitTimeout()
2634 *
2635 *FUNCTION:
2636 * This function is called by limProcessMessageQueue to handle
2637 * various confirmation failure cases.
2638 *
2639 *LOGIC:
2640 *
2641 *ASSUMPTIONS:
2642 *
2643 *NOTE:
2644 *
2645 * @param pMac - Pointer to Global MAC structure
2646 * @param pStaDs - Pointer to a sta descriptor
2647 * @return None
2648 */
2649
2650void limHandleCnfWaitTimeout(tpAniSirGlobal pMac, tANI_U16 staId)
2651{
2652 tpDphHashNode pStaDs;
2653 tLimSystemRole systemRole;
2654 tpPESession psessionEntry = NULL;
2655
2656 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId))== NULL)
2657 {
2658 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
2659 return;
2660 }
2661 systemRole = limGetSystemRole(psessionEntry);
2662 pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable);
2663
2664 if (pStaDs == NULL)
2665 {
2666 PELOGW(limLog(pMac, LOGW, FL("No STA context in SIR_LIM_CNF_WAIT_TIMEOUT.\n"));)
2667 return;
2668 }
2669
2670 switch (pStaDs->mlmStaContext.mlmState) {
2671 case eLIM_MLM_WT_ASSOC_CNF_STATE:
2672 PELOGW(limLog(pMac, LOGW, FL("Did not receive Assoc Cnf in eLIM_MLM_WT_ASSOC_CNF_STATE sta Assoc id %d\n"), pStaDs->assocId);)
2673 limPrintMacAddr(pMac, pStaDs->staAddr, LOGW);
2674
2675 if ( (systemRole == eLIM_AP_ROLE)|| (systemRole == eLIM_BT_AMP_AP_ROLE) )
2676 {
2677 limRejectAssociation(
2678 pMac,
2679 pStaDs->staAddr,
2680 pStaDs->mlmStaContext.subType,
2681 true,
2682 pStaDs->mlmStaContext.authType,
2683 pStaDs->assocId,
2684 true,
2685 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2686 psessionEntry);
2687 }
2688 break;
2689
2690 default:
2691 limLog(pMac, LOGW, FL("Received CNF_WAIT_TIMEOUT in state %d\n"),
2692 pStaDs->mlmStaContext.mlmState);
2693 }
2694}
2695
2696
2697/**
2698 * limDeleteDphHashEntry()
2699 *
2700 *FUNCTION:
2701 * This function is called whenever we need to delete
2702 * the dph hash entry
2703 *
2704 *LOGIC:
2705 *
2706 *ASSUMPTIONS:
2707 *
2708 *NOTE:
2709 *
2710 * @param pMac Pointer to Global MAC structure
2711 * @param tANI_U16 staId
2712 * @return None
2713 */
2714
2715void
2716limDeleteDphHashEntry(tpAniSirGlobal pMac, tSirMacAddr staAddr, tANI_U16 staId,tpPESession psessionEntry)
2717{
2718 tANI_U16 aid;
2719 tpDphHashNode pStaDs;
2720 tUpdateBeaconParams beaconParams;
2721 tLimSystemRole systemRole;
2722
2723 beaconParams.paramChangeBitmap = 0;
2724 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, staId);
2725 if (NULL == psessionEntry)
2726 {
2727 PELOGE(limLog(pMac, LOGE, FL("NULL psessionEntry"));)
2728 return;
2729 }
2730 systemRole = limGetSystemRole(psessionEntry);
2731 beaconParams.bssIdx = psessionEntry->bssIdx;
2732 pStaDs = dphLookupHashEntry(pMac, staAddr, &aid, &psessionEntry->dph.dphHashTable);
2733 if (pStaDs != NULL)
2734 {
2735 PELOGW(limLog(pMac, LOGW, FL("Deleting DPH Hash entry for STAID: %X\n "), staId);)
2736 // update the station count and perform associated actions
2737 // do this before deleting the dph hash entry
2738 limUtilCountStaDel(pMac, pStaDs, psessionEntry);
2739
2740 if((eLIM_AP_ROLE == psessionEntry->limSystemRole) ||
2741 (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole))
2742 {
2743#ifdef WLAN_SOFTAP_FEATURE
2744 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
2745 if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE){
2746 limDecideApProtectionOnDelete(pMac, pStaDs, &beaconParams,psessionEntry);
2747 }
2748 }
2749#endif
2750
2751 if(eLIM_STA_IN_IBSS_ROLE == systemRole)
2752 limIbssDecideProtectionOnDelete(pMac, pStaDs, &beaconParams, psessionEntry);
2753
2754 limDecideShortPreamble(pMac, pStaDs, &beaconParams, psessionEntry);
2755 limDecideShortSlot(pMac, pStaDs, &beaconParams, psessionEntry);
2756
2757 //Send message to HAL about beacon parameter change.
2758 PELOGW(limLog(pMac, LOGW, FL("param bitmap = %d \n"), beaconParams.paramChangeBitmap);)
2759 if(beaconParams.paramChangeBitmap)
2760 {
2761 schSetFixedBeaconFields(pMac,psessionEntry);
2762 limSendBeaconParams(pMac, &beaconParams, psessionEntry );
2763 }
2764 }
2765 if (dphDeleteHashEntry(pMac, staAddr, staId, &psessionEntry->dph.dphHashTable) != eSIR_SUCCESS)
2766 limLog(pMac, LOGP, FL("error deleting hash entry\n"));
2767 }
2768}
2769
2770
2771
2772/**
2773 * limCheckAndAnnounceJoinSuccess()
2774 *
2775 *FUNCTION:
2776 * This function is called upon receiving Beacon/Probe Response
2777 * frame in WT_JOIN_BEACON_STATE to check if the received
2778 * Beacon/Probe Response is from the BSS that we're attempting
2779 * to join.
2780 *
2781 *LOGIC:
2782 * If the Beacon/Probe Response is indeed from the BSS we're
2783 * attempting to join, join success is sent to SME.
2784 *
2785 *ASSUMPTIONS:
2786 *
2787 *NOTE:
2788 *
2789 * @param pMac Pointer to Global MAC structure
2790 * @param pBPR Pointer to received Beacon/Probe Response
2791 * @param pHdr Pointer to received Beacon/Probe Response
2792 * MAC header
2793 * @return None
2794 */
2795
2796void
2797limCheckAndAnnounceJoinSuccess(tpAniSirGlobal pMac,
2798 tSirProbeRespBeacon *pBPR,
2799 tpSirMacMgmtHdr pHdr,tpPESession psessionEntry)
2800{
2801 tSirMacSSid currentSSID;
2802 tLimMlmJoinCnf mlmJoinCnf;
2803
2804 palCopyMemory( pMac->hHdd, currentSSID.ssId,
2805 psessionEntry->ssId.ssId,
2806 psessionEntry->ssId.length);
2807
2808 currentSSID.length = (tANI_U8)psessionEntry->ssId.length ;
2809
2810 if (
2811 /* Check for SSID only in probe response. Beacons may not carry
2812 SSID information in hidden SSID case */
2813 ( (SIR_MAC_MGMT_FRAME == pHdr->fc.type) &&
2814 (SIR_MAC_MGMT_PROBE_RSP == pHdr->fc.subType) ) &&
2815 currentSSID.length &&
2816 (!palEqualMemory( pMac->hHdd,(tANI_U8 *) &pBPR->ssId,
2817 (tANI_U8 *) &currentSSID,
2818 (tANI_U8) (1 + currentSSID.length)) ))
2819 {
2820 /**
2821 * Received SSID does not match with the one we've.
2822 * Ignore received Beacon frame
2823 */
2824 PELOG1(limLog(pMac, LOG1, FL("SSID received in Beacon does not match\n"));)
2825#ifdef WLAN_DEBUG
2826 pMac->lim.gLimBcnSSIDMismatchCnt++;
2827#endif
2828 return;
2829 }
2830
2831 if( (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_STA_ROLE))
2832 {
2833 PELOG1(limLog(pMac, LOG1, FL("Received Beacon/PR with matching BSSID\n"));)
2834
2835 // Deactivate Join Failure timer
2836 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
2837
2838 // Update Beacon Interval at CFG database
2839
2840 if ( pBPR->HTCaps.present )
2841 limUpdateStaRunTimeHTCapability( pMac, &pBPR->HTCaps );
2842 if ( pBPR->HTInfo.present )
2843 limUpdateStaRunTimeHTInfo( pMac, &pBPR->HTInfo, psessionEntry);
2844 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002845 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002846
2847#if (WNI_POLARIS_FW_PRODUCT == AP)
2848 // In case of BP, we need to adopt to all rates
2849 // advertised by AP. Update the operational rates at CFG
2850 if (cfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
2851 (tANI_U8 *) &pBPR->supportedRates.rate,
2852 pBPR->supportedRates.numRates)
2853 != eSIR_SUCCESS)
2854 limLog(pMac, LOGP, FL("could not update Oper.rates at CFG\n"));
2855
2856#endif
2857
2858 /**
2859 * Announce join success by sending
2860 * Join confirm to SME.
2861 */
2862 mlmJoinCnf.resultCode = eSIR_SME_SUCCESS;
2863 mlmJoinCnf.protStatusCode = eSIR_MAC_SUCCESS_STATUS;
2864 /* Update PE sessionId*/
2865 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
2866 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
2867 } // if ((pMac->lim.gLimSystemRole == IBSS....
2868}
2869
2870/**
2871 * limExtractApCapabilities()
2872 *
2873 *FUNCTION:
2874 * This function is called to extract all of the AP's capabilities
2875 * from the IEs received from it in Beacon/Probe Response frames
2876 *
2877 *LOGIC:
2878 * This routine mimics the limExtractApCapability() API. The difference here
2879 * is that this API returns the entire tSirProbeRespBeacon info as is. It is
2880 * left to the caller of this API to use this info as required
2881 *
2882 *ASSUMPTIONS:
2883 * NA
2884 *
2885 *NOTE:
2886 *
2887 * @param pMac Pointer to Global MAC structure
2888 * @param pIE Pointer to starting IE in Beacon/Probe Response
2889 * @param ieLen Length of all IEs combined
2890 * @param beaconStruct A pointer to tSirProbeRespBeacon that needs to be
2891 * populated
2892 * @return status A status reporting eSIR_SUCCESS or eSIR_FAILURE
2893 */
2894tSirRetStatus limExtractApCapabilities( tpAniSirGlobal pMac,
2895 tANI_U8 *pIE,
2896 tANI_U16 ieLen,
2897 tpSirProbeRespBeacon beaconStruct )
2898{
2899 palZeroMemory( pMac->hHdd, (tANI_U8 *) beaconStruct, sizeof( tSirProbeRespBeacon ));
2900
2901 PELOG3(limLog( pMac, LOG3,
2902 FL( "In limExtractApCapabilities: The IE's being received are:\n" ));
2903 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG3, pIE, ieLen );)
2904
2905 // Parse the Beacon IE's, Don't try to parse if we dont have anything in IE
2906 if (ieLen > 0) {
2907 if( eSIR_SUCCESS != sirParseBeaconIE( pMac, beaconStruct, pIE, (tANI_U32)ieLen ))
2908 {
2909 limLog( pMac, LOGE, FL("APCapExtract: Beacon parsing error!\n"));
2910 return eSIR_FAILURE;
2911 }
2912 }
2913
2914 return eSIR_SUCCESS;
2915}
2916
2917
2918/**
2919 * limDelBss()
2920 *
2921 *FUNCTION:
2922 * This function is called to delete BSS context at hardware
2923 * whenever a STA is disassociated
2924 *
2925 *LOGIC:
2926 *
2927 *ASSUMPTIONS:
2928 * NA
2929 *
2930 *NOTE:
2931 * NA
2932 *
2933 * @param pMac - Pointer to Global MAC structure
2934 * @param pStaDs - Pointer to the STA datastructure created by
2935 * LIM and maintained by DPH
2936 * @return retCode - Indicates success or failure return code
2937 */
2938
2939tSirRetStatus
2940limDelBss(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tANI_U16 bssIdx,tpPESession psessionEntry)
2941{
2942 tpDeleteBssParams pDelBssParams = NULL;
2943 tSirMsgQ msgQ;
2944 tSirRetStatus retCode = eSIR_SUCCESS;
2945
2946 if( eHAL_STATUS_SUCCESS !=
2947 palAllocateMemory( pMac->hHdd, (void **) &pDelBssParams, sizeof( tDeleteBssParams )))
2948 {
2949 limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_BSS\n" ));
2950 return eSIR_MEM_ALLOC_FAILED;
2951 }
2952 palZeroMemory( pMac->hHdd, (tANI_U8 *) pDelBssParams, sizeof(tDeleteBssParams));
2953
2954
2955 pDelBssParams->sessionId = psessionEntry->peSessionId; //update PE session Id
2956
2957 //DPH was storing the AssocID in staID field,
2958 //staID is actually assigned by HAL when AddSTA message is sent.
2959 if (pStaDs != NULL)
2960 {
2961 pDelBssParams->bssIdx= pStaDs->bssId;
2962 pStaDs->valid = 0;
2963 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
2964 }
2965 else
2966 pDelBssParams->bssIdx = bssIdx;
2967 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002968 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_BSS_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002969
2970 pDelBssParams->status= eHAL_STATUS_SUCCESS;
2971 pDelBssParams->respReqd = 1;
2972 PELOGW(limLog( pMac, LOGW, FL("Sending HAL_DELETE_BSS_REQ for BSSID: %X\n"),
2973 pDelBssParams->bssIdx);)
2974
2975 //we need to defer the message until we get the response back from HAL.
2976 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
2977
2978 msgQ.type = WDA_DELETE_BSS_REQ;
2979 msgQ.reserved = 0;
2980 msgQ.bodyptr = pDelBssParams;
2981 msgQ.bodyval = 0;
2982
Jeff Johnsone7245742012-09-05 17:12:55 -07002983 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002984
2985 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
2986 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002987 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07002988 limLog( pMac, LOGE, FL("Posting DELETE_BSS_REQ to HAL failed, reason=%X\n"), retCode );
2989 palFreeMemory(pMac->hHdd, (void*)pDelBssParams);
2990 }
2991
2992 return retCode;
2993}
2994
2995
2996#ifdef ANI_PRODUCT_TYPE_CLIENT
2997
2998/**
2999 * limSendAddBss()
3000 *
3001 *FUNCTION:
3002 *
3003 *LOGIC:
3004 * 1) LIM receives eWNI_SME_JOIN_REQ
3005 * 2) For a valid eWNI_SME_JOIN_REQ, LIM sends
3006 * SIR_HAL_ADD_BSS_REQ to HAL
3007 *
3008 *ASSUMPTIONS:
3009 * JOIN REQ parameters are saved in pMac->lim.gLimMlmJoinReq
3010 * ADD BSS parameters can be obtained from two sources:
3011 * 1) pMac->lim.gLimMlmJoinReq
3012 * 2) beaconStruct, passed as paramter
3013 * So, if a reqd parameter is found in bssDescriptions
3014 * then it is given preference over beaconStruct
3015 *
3016 *NOTE:
3017 *
3018 * @param pMac Pointer to Global MAC structure
3019 * pAssocRsp contains the structured assoc/reassoc Response got from AP
3020 * beaconstruct Has the ProbeRsp/Beacon structured details
3021 * bssDescription bssDescription passed to PE from the SME
3022 * @return None
3023 */
3024
3025tSirRetStatus limStaSendAddBss( tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,
3026 tpSchBeaconStruct pBeaconStruct, tpSirBssDescription bssDescription, tANI_U8 updateEntry,
3027 tpPESession psessionEntry)
3028
3029{
3030 tSirMsgQ msgQ;
3031 tpAddBssParams pAddBssParams = NULL;
3032 tANI_U32 retCode;
3033 tANI_U8 i;
3034 tpDphHashNode pStaDs = NULL;
3035 tANI_U8 chanWidthSupp = 0;
3036 // Package SIR_HAL_ADD_BSS_REQ message parameters
3037 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
3038 (void **) &pAddBssParams,
3039 sizeof( tAddBssParams )))
3040 {
3041 limLog( pMac, LOGP,
3042 FL( "Unable to PAL allocate memory during ADD_BSS\n" ));
3043 retCode = eSIR_MEM_ALLOC_FAILED;
3044 goto returnFailure;
3045 }
3046 else
3047 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
3048
3049 palCopyMemory( pMac->hHdd, pAddBssParams->bssId,bssDescription->bssId,
3050 sizeof( tSirMacAddr ));
3051 // Fill in tAddBssParams selfMacAddr
3052 palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr,
3053 psessionEntry->selfMacAddr,
3054 sizeof( tSirMacAddr ));
3055
3056 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3057 {
3058 pAddBssParams->bssType = eSIR_BTAMP_AP_MODE;
3059 }
3060 else
3061 {
3062 pAddBssParams->bssType = eSIR_INFRASTRUCTURE_MODE;
3063 }
3064
3065 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
3066
3067 /* Update PE session ID */
3068 pAddBssParams->sessionId = psessionEntry->peSessionId;
3069
3070 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
3071
3072 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
3073 pAddBssParams->updateBss = updateEntry;
3074
3075
3076 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
3077 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
3078 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
3079 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
3080
3081 pAddBssParams->rateSet.numRates = pAssocRsp->supportedRates.numRates;
3082 palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
3083 pAssocRsp->supportedRates.rate, pAssocRsp->supportedRates.numRates );
3084
3085 pAddBssParams->nwType = bssDescription->nwType;
3086
Jeff Johnsone7245742012-09-05 17:12:55 -07003087 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -07003088 pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
3089 pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
3090 pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
3091 pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
3092
3093
3094 // Use the advertised capabilities from the received beacon/PR
3095
3096
3097 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pAssocRsp->HTCaps.present ))
3098 {
3099 pAddBssParams->htCapable = pAssocRsp->HTCaps.present;
3100
3101 if ( pBeaconStruct->HTInfo.present )
3102 {
3103 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pAssocRsp->HTInfo.opMode;
3104 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pAssocRsp->HTInfo.dualCTSProtection;
3105#ifdef WLAN_SOFTAP_FEATURE
3106 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
3107#else
3108 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET);
3109#endif
3110 if( (pAssocRsp->HTCaps.supportedChannelWidthSet) &&
3111 (chanWidthSupp) )
3112 {
3113 pAddBssParams->txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
3114 pAddBssParams->currentExtChannel = pAssocRsp->HTInfo.secondaryChannelOffset;
3115 }
3116 else
3117 {
3118 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003119 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003120 }
3121 pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent;
3122 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport;
3123 pAddBssParams->fRIFSMode = pAssocRsp->HTInfo.rifsMode;
3124 }
3125 }
3126
3127 pAddBssParams->currentOperChannel = bssDescription->channelId;
3128
Jeff Johnsone7245742012-09-05 17:12:55 -07003129#ifdef WLAN_FEATURE_11AC
3130 if (psessionEntry->vhtCapability && ( pAssocRsp->VHTCaps.present ))
3131 {
3132 pAddBssParams->vhtCapable = pAssocRsp->VHTCaps.present;
3133 pAddBssParams->vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth;
3134 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003135 pAddBssParams->currentOperChannel,
3136 pAddBssParams->currentExtChannel,
3137 psessionEntry->apCenterChan,
3138 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003139 }
3140 else
3141 {
3142 pAddBssParams->vhtCapable = 0;
3143 }
3144#endif
3145
3146
Jeff Johnson295189b2012-06-20 16:38:30 -07003147 // Populate the STA-related parameters here
3148 // Note that the STA here refers to the AP
3149 {
3150 /* staType = PEER*/
3151 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
3152
3153 palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId,
3154 bssDescription->bssId,
3155 sizeof( tSirMacAddr ));
3156 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
3157
3158 /* Fill Assoc id from the dph table */
3159 pStaDs = dphLookupHashEntry(pMac, pAddBssParams->staContext.bssId,
3160 &pAddBssParams->staContext.assocId, &psessionEntry->dph.dphHashTable);
3161 if (pStaDs == NULL)
3162 {
3163 PELOGE(limLog(pMac, LOGE, FL("Couldn't get assoc id for"
3164 "MAC ADDR: %02x:%02x:%02x:%02x:%02x:%02x"),
3165 pAddBssParams->staContext.staMac[0],
3166 pAddBssParams->staContext.staMac[1],
3167 pAddBssParams->staContext.staMac[2],
3168 pAddBssParams->staContext.staMac[3],
3169 pAddBssParams->staContext.staMac[4],
3170 pAddBssParams->staContext.staMac[5]
3171 );)
3172 }
3173 pAddBssParams->staContext.uAPSD = 0;
3174 pAddBssParams->staContext.maxSPLen = 0;
3175 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortPreamble;
3176 pAddBssParams->staContext.updateSta = updateEntry;
3177
3178 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
3179 {
3180 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
3181 pAddBssParams->staContext.htCapable = 1;
3182 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 )pAssocRsp->HTCaps.greenField;
3183 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 )pAssocRsp->HTCaps.lsigTXOPProtection;
3184 if( (pAssocRsp->HTCaps.supportedChannelWidthSet) &&
3185 (chanWidthSupp) )
3186 {
3187 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07003188
3189#ifdef WLAN_FEATURE_11AC
3190 if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present ))
3191 {
3192 pAddBssParams->staContext.vhtCapable = 1;
3193 pAddBssParams->staContext.vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth; //pMac->lim.apChanWidth;
3194 }
3195#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003196 }
3197 else
3198 {
3199 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3200 }
3201 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pAssocRsp->HTCaps.mimoPowerSave;
3202 pAddBssParams->staContext.delBASupport = ( tANI_U8 )pAssocRsp->HTCaps.delayedBA;
3203 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 )pAssocRsp->HTCaps.maximalAMSDUsize;
3204 pAddBssParams->staContext.maxAmpduDensity = pAssocRsp->HTCaps.mpduDensity;
3205 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz;
3206 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz;
3207 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz;
3208 pAddBssParams->staContext.maxAmpduSize= pAssocRsp->HTCaps.maxRxAMPDUFactor;
3209
3210 if( pBeaconStruct->HTInfo.present )
3211 pAddBssParams->staContext.rifsMode = pAssocRsp->HTInfo.rifsMode;
3212 }
3213
3214 if ((psessionEntry->limWmeEnabled && pAssocRsp->wmeEdcaPresent) ||
3215 (psessionEntry->limQosEnabled && pAssocRsp->edcaPresent))
3216 pAddBssParams->staContext.wmmEnabled = 1;
3217 else
3218 pAddBssParams->staContext.wmmEnabled = 0;
3219
3220 //Update the rates
3221
3222 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3223 if (pStaDs != NULL)
3224 {
3225 limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
3226 palCopyMemory(pMac->hHdd, (tANI_U8*)&pAddBssParams->staContext.supportedRates,
3227 (tANI_U8*)&pStaDs->supportedRates,
3228 sizeof(tSirSupportedRates));
3229 }
3230 else
3231 PELOGE(limLog(pMac, LOGE, FL("could not Update the supported rates.\n"));)
3232
3233 }
3234
3235 //Disable BA. It will be set as part of ADDBA negotiation.
3236 for( i = 0; i < STACFG_MAX_TC; i++ )
3237 {
3238 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
3239 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
3240 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
3241 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
3242 }
3243
3244 pAddBssParams->staContext.encryptType = psessionEntry->encryptType;
3245
3246#if defined WLAN_FEATURE_VOWIFI
3247 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
3248#endif
3249 // FIXME_GEN4 - Any other value that can be used for initialization?
3250 pAddBssParams->status = eHAL_STATUS_SUCCESS;
3251 pAddBssParams->respReqd = true;
3252
3253 pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
3254
3255#ifdef WLAN_FEATURE_P2P
3256 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona)
3257 {
3258 pAddBssParams->staContext.p2pCapableSta = 1;
3259 }
3260#endif
3261
Jeff Johnsone7245742012-09-05 17:12:55 -07003262 pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled ||
3263 limIsconnectedOnDFSChannel(bssDescription->channelId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003264
3265#if defined WLAN_FEATURE_VOWIFI_11R
3266 pAddBssParams->extSetStaKeyParamValid = 0;
3267#endif
3268
3269 // Set a new state for MLME
3270 if( eLIM_MLM_WT_ASSOC_RSP_STATE == psessionEntry->limMlmState )
3271 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE;
3272 else
3273 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003274 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003275
3276 //we need to defer the message until we get the response back from HAL.
3277 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
3278
3279 msgQ.type = WDA_ADD_BSS_REQ;
3280 /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
3281 msgQ.reserved = 0;
3282 msgQ.bodyptr = pAddBssParams;
3283 msgQ.bodyval = 0;
3284
3285 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003286 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003287
3288 retCode = wdaPostCtrlMsg( pMac, &msgQ );
3289 if( eSIR_SUCCESS != retCode)
3290 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003291 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07003292 palFreeMemory(pMac->hHdd, pAddBssParams);
3293 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
3294 retCode );
3295 goto returnFailure;
3296
3297 }
3298 else
3299 return retCode;
3300
3301 returnFailure:
3302 // Clean-up will be done by the caller...
3303 return retCode;
3304}
3305
3306
3307
3308
3309tSirRetStatus limStaSendAddBssPreAssoc( tpAniSirGlobal pMac, tANI_U8 updateEntry, tpPESession psessionEntry)
3310{
3311 tSirMsgQ msgQ;
3312 tpAddBssParams pAddBssParams = NULL;
3313 tANI_U32 retCode;
3314 tANI_U8 i;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003315 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -07003316 tANI_U8 chanWidthSupp = 0;
3317 tpSirBssDescription bssDescription = &psessionEntry->pLimJoinReq->bssDescription;
3318
Jeff Johnson32d95a32012-09-10 13:15:23 -07003319 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
3320 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
3321 {
3322 limLog(pMac, LOGE, FL("Unable to PAL allocate memory during ADD_BSS\n") );
3323 return eSIR_MEM_ALLOC_FAILED;
3324 }
3325
Jeff Johnson295189b2012-06-20 16:38:30 -07003326
3327 // Package SIR_HAL_ADD_BSS_REQ message parameters
3328 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
3329 (void **) &pAddBssParams,
3330 sizeof( tAddBssParams )))
3331 {
3332 limLog( pMac, LOGP,
3333 FL( "Unable to PAL allocate memory during ADD_BSS\n" ));
3334 retCode = eSIR_MEM_ALLOC_FAILED;
3335 goto returnFailure;
3336 }
3337
3338 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
3339
3340
3341 limExtractApCapabilities( pMac,
3342 (tANI_U8 *) bssDescription->ieFields,
3343 limGetIElenFromBssDescription( bssDescription ),
Jeff Johnson32d95a32012-09-10 13:15:23 -07003344 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07003345
3346 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Jeff Johnson32d95a32012-09-10 13:15:23 -07003347 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003348 palCopyMemory( pMac->hHdd, pAddBssParams->bssId,bssDescription->bssId,
3349 sizeof( tSirMacAddr ));
3350
3351 // Fill in tAddBssParams selfMacAddr
3352 palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr,
3353 psessionEntry->selfMacAddr,
3354 sizeof( tSirMacAddr ));
3355
3356 /* Incorrect BSS Type which caused UMA Descriptor to be overwritten on
3357 * top of an already established Infra link. This lead to issues in
3358 * concurrent data transfer.
3359 */
3360
3361 pAddBssParams->bssType = psessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
3362 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
3363
3364 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
3365
Jeff Johnson32d95a32012-09-10 13:15:23 -07003366 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07003367 pAddBssParams->updateBss = updateEntry;
3368
3369
Jeff Johnson32d95a32012-09-10 13:15:23 -07003370 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
3371 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
3372 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
3373 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -07003374
3375
Jeff Johnson32d95a32012-09-10 13:15:23 -07003376 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -07003377 palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003378 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003379
3380 pAddBssParams->nwType = bssDescription->nwType;
3381
Jeff Johnson32d95a32012-09-10 13:15:23 -07003382 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -07003383 pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
3384 pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
3385 pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
3386 pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
3387
3388 // Use the advertised capabilities from the received beacon/PR
Jeff Johnson32d95a32012-09-10 13:15:23 -07003389 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -07003390 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003391 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -07003392
Jeff Johnson32d95a32012-09-10 13:15:23 -07003393 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003394 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003395 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
3396 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -07003397
3398#ifdef WLAN_SOFTAP_FEATURE
3399 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
3400#else
3401 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET);
3402#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07003403 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003404 (chanWidthSupp) )
3405 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003406 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
3407 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003408 }
3409 else
3410 {
3411 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003412 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003413 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003414 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
3415 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
3416 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07003417 }
3418 }
3419
3420 pAddBssParams->currentOperChannel = bssDescription->channelId;
3421
Jeff Johnsone7245742012-09-05 17:12:55 -07003422#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003423 if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present ))
Jeff Johnsone7245742012-09-05 17:12:55 -07003424 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003425 pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
3426 pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003427 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
3428 pAddBssParams->currentOperChannel,
3429 pAddBssParams->currentExtChannel,
3430 psessionEntry->apCenterChan,
3431 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003432 }
3433 else
3434 {
3435 pAddBssParams->vhtCapable = 0;
3436 }
3437#endif
3438
Jeff Johnson295189b2012-06-20 16:38:30 -07003439 // Populate the STA-related parameters here
3440 // Note that the STA here refers to the AP
3441 {
3442 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
3443
3444 palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId,
3445 bssDescription->bssId,
3446 sizeof( tSirMacAddr ));
3447 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
3448
3449 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
3450 pAddBssParams->staContext.uAPSD = 0;
3451 pAddBssParams->staContext.maxSPLen = 0;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003452 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -07003453 pAddBssParams->staContext.updateSta = updateEntry;
3454
Jeff Johnson32d95a32012-09-10 13:15:23 -07003455 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -07003456 {
3457 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
3458 pAddBssParams->staContext.htCapable = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003459 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
3460 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
3461 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003462 (chanWidthSupp) )
3463 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003464 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07003465 #ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003466 if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present ))
Jeff Johnsone7245742012-09-05 17:12:55 -07003467 {
3468 pAddBssParams->staContext.vhtCapable = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003469 pAddBssParams->staContext.vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -07003470 }
3471 #endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003472 }
3473 else
3474 {
3475 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3476 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003477 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
3478 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
3479 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
3480 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
3481 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
3482 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
3483 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
3484 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -07003485
Jeff Johnson32d95a32012-09-10 13:15:23 -07003486 if( pBeaconStruct->HTInfo.present )
3487 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07003488 }
3489
Jeff Johnson32d95a32012-09-10 13:15:23 -07003490 if ((psessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
3491 (psessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -07003492 pAddBssParams->staContext.wmmEnabled = 1;
3493 else
3494 pAddBssParams->staContext.wmmEnabled = 0;
3495
3496 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -07003497#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -07003498 limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003499 pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry,
3500 &pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -07003501#else
3502 limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003503 pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003504#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003505 limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,psessionEntry);
3506
3507 }
3508
3509
3510 //Disable BA. It will be set as part of ADDBA negotiation.
3511 for( i = 0; i < STACFG_MAX_TC; i++ )
3512 {
3513 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
3514 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
3515 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
3516 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
3517 }
3518
3519 pAddBssParams->staContext.encryptType = psessionEntry->encryptType;
3520
3521#if defined WLAN_FEATURE_VOWIFI
3522 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
3523#endif
3524
3525 pAddBssParams->status = eHAL_STATUS_SUCCESS;
3526 pAddBssParams->respReqd = true;
3527
3528 pAddBssParams->staContext.sessionId = psessionEntry->peSessionId;
3529 pAddBssParams->sessionId = psessionEntry->peSessionId;
3530
3531 pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
3532
Jeff Johnsone7245742012-09-05 17:12:55 -07003533 pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled ||
3534 limIsconnectedOnDFSChannel(bssDescription->channelId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003535
3536#if defined WLAN_FEATURE_VOWIFI_11R
3537 pAddBssParams->extSetStaKeyParamValid = 0;
3538#endif
3539
3540 // Set a new state for MLME
3541
3542 //pMac->lim.gLimMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
3543 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
3544
Jeff Johnsone7245742012-09-05 17:12:55 -07003545 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003546
3547 //we need to defer the message until we get the response back from HAL.
3548 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
3549
3550 msgQ.type = WDA_ADD_BSS_REQ;
3551 /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
3552 msgQ.reserved = 0;
3553 msgQ.bodyptr = pAddBssParams;
3554 msgQ.bodyval = 0;
3555
3556 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003557 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003558
3559 retCode = wdaPostCtrlMsg( pMac, &msgQ );
3560 if( eSIR_SUCCESS != retCode)
3561 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003562 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07003563 palFreeMemory(pMac->hHdd, pAddBssParams);
3564 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
3565 retCode );
3566 goto returnFailure;
3567
3568 }
3569 else
Jeff Johnson32d95a32012-09-10 13:15:23 -07003570 {
3571 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07003572 return retCode;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003573 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003574
3575 returnFailure:
3576 // Clean-up will be done by the caller...
Jeff Johnson32d95a32012-09-10 13:15:23 -07003577 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07003578 return retCode;
3579}
3580
3581
3582
3583
3584
3585#elif defined(ANI_AP_CLIENT_SDK)
3586tSirRetStatus limStaSendAddBss( tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,
3587 tpSirNeighborBssInfo neighborBssInfo, tANI_U8 updateEntry,
3588 tpPESession psessionEntry)
3589{
3590 tSirMsgQ msgQ;
3591 tpAddBssParams pAddBssParams = NULL;
3592 tANI_U32 retCode;
3593 tANI_U8 i;
3594 tpDphHashNode pStaDs = NULL;
3595
3596 // Package SIR_HAL_ADD_BSS_REQ message parameters
3597 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
3598 (void **) &pAddBssParams,
3599 sizeof( tAddBssParams )))
3600 {
3601 limLog( pMac, LOGP,
3602 FL( "Unable to PAL allocate memory during ADD_BSS\n" ));
3603 retCode = eSIR_MEM_ALLOC_FAILED;
3604 goto returnFailure;
3605 }
3606 else
3607 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
3608
3609 palCopyMemory( pMac->hHdd, pAddBssParams->bssId,neighborBssInfo->bssId,
3610 sizeof( tSirMacAddr ));
3611
3612#ifdef WLAN_SOFTAP_FEATURE
3613 // Fill in tAddBssParams selfMacAddr
3614 palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr, psessionEntry->selfMacAddr,
3615 sizeof( tSirMacAddr ));
3616#endif
3617
3618 pAddBssParams->bssType = eSIR_INFRASTRUCTURE_MODE;
3619 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
3620 pAddBssParams->beaconInterval = (tANI_U16) neighborBssInfo->beaconInterval;
3621 pAddBssParams->dtimPeriod = neighborBssInfo->dtimPeriod;
3622 pAddBssParams->updateBss = updateEntry;
3623
3624
3625 /* The following parameters are commented since the information is not available from the
3626 * neighborBssInfo. This needs to be fixed later */
3627#if 0
3628
3629 pAddBssParams->cfParamSet.cfpCount = beaconStruct.cfParamSet.cfpCount;
3630 pAddBssParams->cfParamSet.cfpPeriod = beaconStruct.cfParamSet.cfpPeriod;
3631 pAddBssParams->cfParamSet.cfpMaxDuration = beaconStruct.cfParamSet.cfpMaxDuration;
3632 pAddBssParams->cfParamSet.cfpDurRemaining = beaconStruct.cfParamSet.cfpDurRemaining;
3633#endif
3634 pAddBssParams->rateSet.numRates = pAssocRsp->supportedRates.numRates;
3635 palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
3636 pAssocRsp->supportedRates.rate, pAssocRsp->supportedRates.numRates );
3637
3638 /* Update PE session ID */
3639 pAddBssParams->sessionId = psessionEntry->peSessionId;
3640
3641 pAddBssParams->nwType = neighborBssInfo->nwType;
3642
3643 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime;
3644 pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
3645 pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
3646 pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
3647 pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
3648
3649 // Use the advertised capabilities from the received beacon/PR
3650 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( neighborBssInfo->HTCapsPresent ))
3651 {
3652 pAddBssParams->htCapable = pAssocRsp->HTCaps.present;
3653
3654 if ( neighborBssInfo->HTInfoPresent )
3655 {
3656 pAddBssParams->htOperMode = pAssocRsp->HTInfo.opMode;
3657 pAddBssParams->dualCTSProtection = ( tANI_U8 )pAssocRsp->HTInfo.dualCTSProtection;
3658
3659 if(pAssocRsp->HTCaps.supportedChannelWidthSet)
3660 {
3661 pAddBssParams->txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
3662 pAddBssParams->currentExtChannel = pAssocRsp->HTInfo.secondaryChannelOffset;
3663 }
3664 else
3665 {
3666 pAddBssParams->txChannelWidthSet = (tANI_U8)pAssocRsp->HTCaps.supportedChannelWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07003667 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003668 }
3669 pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent;
3670 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport;
3671 pAddBssParams->fRIFSMode = pAssocRsp->HTInfo.rifsMode;
3672 }
3673 }
3674
3675 pAddBssParams->currentOperChannel = neighborBssInfo->channelId;
3676
3677 // Populate the STA-related parameters here
3678 // Note that the STA here refers to the AP
3679 {
3680 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
3681
3682 palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId,
3683 neighborBssInfo->bssId,
3684 sizeof( tSirMacAddr ));
3685 pAddBssParams->staContext.listenInterval = (tANI_U8) neighborBssInfo->beaconInterval;
3686
3687 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
3688 pAddBssParams->staContext.uAPSD = 0;
3689 pAddBssParams->staContext.maxSPLen = 0;
3690 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortPreamble;
3691 pAddBssParams->staContext.updateSta = updateEntry;
3692
3693
3694 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pAssocRsp->HTCaps.present ))
3695 {
3696 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
3697 pAddBssParams->staContext.htCapable = 1;
3698 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 )pAssocRsp->HTCaps.greenField;
3699 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 )pAssocRsp->HTCaps.lsigTXOPProtection;
3700 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )(pAssocRsp->HTCaps.supportedChannelWidthSet ?
3701 pAssocRsp->HTInfo.recommendedTxWidthSet :
3702 pAssocRsp->HTCaps.supportedChannelWidthSet );
3703 pAddBssParams->staContext.mimoPS = pAssocRsp->HTCaps.mimoPowerSave;
3704 pAddBssParams->staContext.delBASupport = ( tANI_U8 )pAssocRsp->HTCaps.delayedBA;
3705 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 )pAssocRsp->HTCaps.maximalAMSDUsize;
3706 pAddBssParams->staContext.maxAmpduDensity = pAssocRsp->HTCaps.mpduDensity;
3707 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz;
3708 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz;
3709 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz;
3710 pAddBssParams->staContext.maxAmpduSize= pAssocRsp->HTCaps.maxRxAMPDUFactor;
3711
3712 if( pAssocRsp->HTInfo.present )
3713 pAddBssParams->staContext.rifsMode = pAssocRsp->HTInfo.rifsMode;
3714 }
3715
3716 if ((psessionEntry->limWmeEnabled && pAssocRsp->wmeEdcaPresent) ||
3717 (psessionEntry->limQosEnabled && pAssocRsp->edcaPresent))
3718 pAddBssParams->staContext.wmmEnabled = 1;
3719 else
3720 pAddBssParams->staContext.wmmEnabled = 0;
3721
3722 //Update the rates
3723
3724 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3725 if (pStaDs != NULL)
3726 {
3727 limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
3728 palCopyMemory(pMac->hHdd, (tANI_U8*)&pAddBssParams->staContext.supportedRates,
3729 (tANI_U8*)&pStaDs->supportedRates,
3730 sizeof(tSirSupportedRates));
3731 }
3732 else
3733 PELOGE(limLog(pMac, LOGE, FL("could not Update the supported rates.\n"));)
3734
3735 }
3736
3737 //Disable BA. It will be set as part of ADDBA negotiation.
3738 for( i = 0; i < SMAC_STACFG_MAX_TC; i++ )
3739 {
3740 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
3741 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
3742 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
3743 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
3744 }
3745
3746#if defined WLAN_FEATURE_VOWIFI
3747 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
3748#endif
3749 // FIXME_GEN4 - Any other value that can be used for initialization?
3750 pAddBssParams->status = eHAL_STATUS_SUCCESS;
3751 pAddBssParams->respReqd = true;
3752
3753 pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
3754
3755#if defined WLAN_FEATURE_VOWIFI_11R
3756 pAddBssParams->extSetStaKeyParamValid = 0;
3757#endif
3758
3759 // Set a new state for MLME
3760 if( eLIM_MLM_WT_ASSOC_RSP_STATE == psessionEntry->limMlmState )
3761 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE;
3762 else
3763 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003764 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003765
3766 //we need to defer the message until we get the response back from HAL.
3767 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
3768
3769 msgQ.type = SIR_HAL_ADD_BSS_REQ;
3770 /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
3771 msgQ.reserved = 0;
3772 msgQ.bodyptr = pAddBssParams;
3773 msgQ.bodyval = 0;
3774
3775 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003776 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003777
3778 retCode = halPostMsgApi( pMac, &msgQ );
3779 if( eSIR_SUCCESS != retCode)
3780 {
3781 palFreeMemory(pMac->hHdd, pAddBssParams);
3782 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
3783 retCode );
3784 }
3785 else
3786 return retCode;
3787
3788 returnFailure:
3789 // Clean-up will be done by the caller...
3790 return retCode;
3791}
3792
3793#endif // ANI_PRODUCT_TYPE_CLIENT
3794
3795/** -------------------------------------------------------------
3796\fn limPrepareAndSendDelStaCnf
3797\brief deletes DPH entry
3798 changes the MLM mode for station.
3799 calls limSendDelStaCnf
3800\param tpAniSirGlobal pMac
3801\param tpDphHashNode pStaDs
3802\return none
3803 -------------------------------------------------------------*/
3804
3805
3806void
3807limPrepareAndSendDelStaCnf(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tSirResultCodes statusCode,tpPESession psessionEntry)
3808{
3809 tANI_U16 staDsAssocId = 0;
3810 tSirMacAddr staDsAddr;
3811 tLimMlmStaContext mlmStaContext;
3812
3813 if(pStaDs == NULL)
3814 {
3815 PELOGW(limLog(pMac, LOGW, FL("pStaDs is NULL\n"));)
3816 return;
3817 }
3818 staDsAssocId = pStaDs->assocId;
3819 palCopyMemory( pMac->hHdd, (tANI_U8 *)staDsAddr,
3820 pStaDs->staAddr,
3821 sizeof(tSirMacAddr));
3822
3823 mlmStaContext = pStaDs->mlmStaContext;
3824 if(eSIR_SME_SUCCESS == statusCode)
3825 {
3826 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
3827 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
3828 {
3829 limReleaseAID(pMac, pStaDs->assocId);
3830 }
3831
3832 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
3833 }
3834 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
3835 {
3836 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003837 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003838 }
3839
3840 limSendDelStaCnf(pMac, staDsAddr, staDsAssocId, mlmStaContext, statusCode,psessionEntry);
3841}
3842
3843/** -------------------------------------------------------------
3844\fn limGetStaRateMode
3845\brief Gets the Station Rate Mode.
3846\param tANI_U8 dot11Mode
3847\return none
3848 -------------------------------------------------------------*/
3849tStaRateMode limGetStaRateMode(tANI_U8 dot11Mode)
3850{
3851 switch(dot11Mode)
3852 {
3853 case WNI_CFG_DOT11_MODE_11A:
3854 return eSTA_11a;
3855 case WNI_CFG_DOT11_MODE_11B:
3856 return eSTA_11b;
3857 case WNI_CFG_DOT11_MODE_11G:
3858 return eSTA_11bg;
3859 case WNI_CFG_DOT11_MODE_11N:
3860 return eSTA_11n;
Jeff Johnsone7245742012-09-05 17:12:55 -07003861#ifdef WLAN_FEATURE_11AC
3862 case WNI_CFG_DOT11_MODE_11AC:
3863 return eSTA_11ac;
3864#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003865 case WNI_CFG_DOT11_MODE_ALL:
3866 default:
3867 return eSTA_11n;
3868
3869 }
3870}
3871
3872/** -------------------------------------------------------------
3873\fn limInitPreAuthTimerTable
3874\brief Initialize the Pre Auth Tanle and creates the timer for
3875 each node for the timeout value got from cfg.
3876\param tpAniSirGlobal pMac
3877\param tpLimPreAuthTable pPreAuthTimerTable
3878\return none
3879 -------------------------------------------------------------*/
3880void limInitPreAuthTimerTable(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable)
3881{
3882 tANI_U32 cfgValue;
3883 tANI_U32 authNodeIdx;
3884 tpLimPreAuthNode pAuthNode = pPreAuthTimerTable->pTable;
3885
3886 // Get AUTH_RSP Timers value
3887
3888 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT,
3889 &cfgValue) != eSIR_SUCCESS)
3890 {
3891 /*
3892 ** Could not get AUTH_RSP timeout value
3893 ** from CFG. Log error.
3894 **/
3895 limLog(pMac, LOGP,
3896 FL("could not retrieve AUTH_RSP timeout value\n"));
3897 return;
3898 }
3899
3900 cfgValue = SYS_MS_TO_TICKS(cfgValue);
3901 for(authNodeIdx=0; authNodeIdx<pPreAuthTimerTable->numEntry; authNodeIdx++, pAuthNode++)
3902 {
3903 if (tx_timer_create(&pAuthNode->timer,
3904 "AUTH RESPONSE TIMEOUT",
3905 limAuthResponseTimerHandler,
3906 authNodeIdx,
3907 cfgValue,
3908 0,
3909 TX_NO_ACTIVATE) != TX_SUCCESS)
3910 {
3911 // Cannot create timer. Log error.
3912 limLog(pMac, LOGP, FL("Cannot create Auth Rsp timer of Index :%d.\n"), authNodeIdx);
3913 return;
3914 }
3915 pAuthNode->authNodeIdx = (tANI_U8)authNodeIdx;
3916 pAuthNode->fFree = 1;
3917 }
3918
3919}
3920
3921/** -------------------------------------------------------------
3922\fn limAcquireFreePreAuthNode
3923\brief Retrives a free Pre Auth node from Pre Auth Table.
3924\param tpAniSirGlobal pMac
3925\param tpLimPreAuthTable pPreAuthTimerTable
3926\return none
3927 -------------------------------------------------------------*/
3928tLimPreAuthNode * limAcquireFreePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable)
3929{
3930 tANI_U32 i;
3931 tLimPreAuthNode *pTempNode = pPreAuthTimerTable->pTable;
3932 for (i=0; i<pPreAuthTimerTable->numEntry; i++,pTempNode++)
3933 {
3934 if (pTempNode->fFree == 1)
3935 {
3936 pTempNode->fFree = 0;
3937 return pTempNode;
3938 }
3939 }
3940
3941 return NULL;
3942}
3943
3944/** -------------------------------------------------------------
3945\fn limGetPreAuthNodeFromIndex
3946\brief Depending on the Index this retrives the pre auth node.
3947\param tpAniSirGlobal pMac
3948\param tpLimPreAuthTable pAuthTable
3949\param tANI_U32 authNodeIdx
3950\return none
3951 -------------------------------------------------------------*/
3952tLimPreAuthNode * limGetPreAuthNodeFromIndex(tpAniSirGlobal pMac,
3953 tpLimPreAuthTable pAuthTable, tANI_U32 authNodeIdx)
3954{
3955 if ((authNodeIdx >= pAuthTable->numEntry) || (pAuthTable->pTable == NULL))
3956 {
3957 limLog(pMac, LOGE, FL("Invalid Auth Timer Index : %d NumEntry : %d\n"),
3958 authNodeIdx, pAuthTable->numEntry);
3959 return NULL;
3960 }
3961
3962 return pAuthTable->pTable + authNodeIdx;
3963}
3964
3965/* Util API to check if the channels supported by STA is within range */
3966tSirRetStatus limIsDot11hSupportedChannelsValid(tpAniSirGlobal pMac, tSirAssocReq *assoc)
3967{
3968 /*
3969 * Allow all the stations to join with us.
3970 * 802.11h-2003 11.6.1 => An AP may use the supported channels list for associated STAs
3971 * as an input into an algorithm used to select a new channel for the BSS.
3972 * The specification of the algorithm is beyond the scope of this amendment.
3973 */
3974
3975 return (eSIR_SUCCESS);
3976}
3977
3978/* Util API to check if the txpower supported by STA is within range */
3979tSirRetStatus limIsDot11hPowerCapabilitiesInRange(tpAniSirGlobal pMac, tSirAssocReq *assoc,tpPESession psessionEntry)
3980{
3981 tPowerdBm localMaxTxPower;
3982 tANI_U32 localPwrConstraint;
3983
3984 localMaxTxPower = cfgGetRegulatoryMaxTransmitPower(pMac, psessionEntry->currentOperChannel);
3985
3986 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
3987 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg\n" ));
3988 return eSIR_FAILURE;
3989 }
3990 localMaxTxPower -= (tPowerdBm)localPwrConstraint;
3991
3992 /**
3993 * The min Tx Power of the associating station should not be greater than (regulatory
3994 * max tx power - local power constraint configured on AP).
3995 */
3996 if(assoc->powerCapability.minTxPower > localMaxTxPower)
3997 {
3998 limLog(pMac, LOGW, FL("minTxPower (STA) = %d, localMaxTxPower (AP) = %d\n"),
3999 assoc->powerCapability.minTxPower, localMaxTxPower);
4000 return (eSIR_FAILURE);
4001 }
4002
4003 return (eSIR_SUCCESS);
4004}
4005
4006/** -------------------------------------------------------------
4007\fn limFillRxHighestSupportedRate
4008\brief Fills in the Rx Highest Supported Data Rate field from
4009\ the 'supported MCS set' field in HT capability element.
4010\param tpAniSirGlobal pMac
4011\param tpSirSupportedRates pRates
4012\param tANI_U8* pSupportedMCSSet
4013\return none
4014 -------------------------------------------------------------*/
4015void limFillRxHighestSupportedRate(tpAniSirGlobal pMac, tANI_U16 *rxHighestRate, tANI_U8* pSupportedMCSSet)
4016{
4017 tSirMacRxHighestSupportRate *pRxHighestRate;
4018 tANI_U8 *pBuf;
4019 tANI_U16 rate=0;
4020
4021 pBuf = pSupportedMCSSet + MCS_RX_HIGHEST_SUPPORTED_RATE_BYTE_OFFSET;
4022 rate = limGetU16(pBuf);
4023
4024 pRxHighestRate = (tSirMacRxHighestSupportRate *) &rate;
4025 *rxHighestRate = pRxHighestRate->rate;
4026
4027 return;
4028}