blob: 12af9d85a228db7bfc62714f33736366d7d7942e [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080028/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 * This file limAssocUtils.cc contains the utility functions
30 * LIM uses while processing (Re) Association messages.
31 * Author: Chandra Modumudi
32 * Date: 02/13/02
33 * History:-
34 * Date Modified by Modification Information
35 * --------------------------------------------------------------------
36 * 05/26/10 js WPA handling in (Re)Assoc frames
37 *
38 */
39
40#include "palTypes.h"
41#include "aniGlobal.h"
42#include "wniApi.h"
43#include "sirCommon.h"
44
Jeff Johnson295189b2012-06-20 16:38:30 -070045#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070046#include "pmmApi.h"
47#include "cfgApi.h"
48
49#include "schApi.h"
50#include "utilsApi.h"
51#include "limUtils.h"
52#include "limAssocUtils.h"
53#include "limSecurityUtils.h"
54#include "limSerDesUtils.h"
55#include "limStaHashApi.h"
56#include "limAdmitControl.h"
57#include "limSendMessages.h"
58#include "limIbssPeerMgmt.h"
59#include "limSession.h"
60
61#include "vos_types.h"
62#include "wlan_qct_wda.h"
63
64/*
65 * fill up the rate info properly based on what is actually supported by the peer
66 * TBD TBD TBD
67 */
68void
69limFillSupportedRatesInfo(
70 tpAniSirGlobal pMac,
71 tpDphHashNode pSta,
72 tpSirSupportedRates pRates,
73 tpPESession psessionEntry)
74{
75 //pSta will be NULL for self entry, so get the opRateMode based on the self mode.
76 //For the peer entry get it from the peer Capabilities present in hash table
77 if(pSta == NULL)
78 pRates->opRateMode = limGetStaRateMode((tANI_U8)psessionEntry->dot11mode);
79 else
80 pRates->opRateMode = limGetStaPeerType(pMac, pSta, psessionEntry);
81
82}
83
84
85/**
86 * limCmpSSid()
87 *
88 *FUNCTION:
89 * This function is called in various places within LIM code
90 * to determine whether received SSid is same as SSID in use.
91 *
92 *LOGIC:
93 *
94 *ASSUMPTIONS:
95 * NA
96 *
97 *NOTE:
98 * NA
99 *
100 * @param *prxSSid - pointer to SSID structure
101 *
102 * @return status - true for SSID match else false.
103 */
104
105tANI_U8
106limCmpSSid(tpAniSirGlobal pMac, tSirMacSSid *prxSSid,tpPESession psessionEntry)
107{
108
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530109 if (vos_mem_compare((tANI_U8* ) prxSSid, (tANI_U8 *) &psessionEntry->ssId,
110 (tANI_U8) (psessionEntry->ssId.length + 1)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700111 return true;
112 else
113 return false;
114
115} /****** end limCmpSSid() ******/
116
117
118
119/**
120 * limCompareCapabilities()
121 *
122 *FUNCTION:
123 * This function is called during Association/Reassociation
124 * frame handling to determine whether received capabilities
125 * match with local capabilities or not.
126 *
127 *LOGIC:
128 *
129 *ASSUMPTIONS:
130 * NA
131 *
132 *NOTE:
133 * NA
134 *
135 * @param pMac - Pointer to Global MAC structure
136 * @param pAssocReq - Pointer to received Assoc Req frame
137 * @param pLocalCapabs - Pointer to local capabilities
138 *
139 * @return status - true for Capabilitity match else false.
140 */
141
142tANI_U8
143limCompareCapabilities(tpAniSirGlobal pMac,
144 tSirAssocReq *pAssocReq,
145 tSirMacCapabilityInfo *pLocalCapabs,tpPESession psessionEntry)
146{
147 tANI_U32 val;
148
149
150 if ( ((psessionEntry->limSystemRole == eLIM_AP_ROLE)||
151 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
152 (pAssocReq->capabilityInfo.ibss) )
153 {
154 // Requesting STA asserting IBSS capability.
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530155 limLog(pMac, LOG1,FL("Requesting STA asserting IBSS capability"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700156 return false;
157 }
158
159 // Compare CF capabilities
160 if (pAssocReq->capabilityInfo.cfPollable ||
161 pAssocReq->capabilityInfo.cfPollReq)
162 {
163 // AP does not support PCF functionality
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530164 limLog(pMac, LOG1,FL(" AP does not support PCF functionality"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700165 return false;
166 }
167
168#if 0 //See CR24696 for analysis
169 // Compare privacy capability
170 if (pAssocReq->capabilityInfo.privacy != pLocalCapabs->privacy)
171 {
172 // AP does not support privacy
173 return false;
174 }
175#endif
176
177 // Compare short preamble capability
178 if (pAssocReq->capabilityInfo.shortPreamble &&
179 (pAssocReq->capabilityInfo.shortPreamble !=
180 pLocalCapabs->shortPreamble))
181 {
Nirav Shahbc35fb72013-12-12 18:14:06 +0530182
183 // Allowing a STA requesting short preamble while
184 // AP does not support it
Jeff Johnson295189b2012-06-20 16:38:30 -0700185#if 0
186 // AP does not support short preamable
187 return false;
188#endif
189 }
190
191
Nirav Shahbc35fb72013-12-12 18:14:06 +0530192 limLog(pMac, LOG1, "QoS in AssocReq: %d, local capabs qos: %d",
Jeff Johnson295189b2012-06-20 16:38:30 -0700193 pAssocReq->capabilityInfo.qos,
194 pLocalCapabs->qos);
195
196 // Compare QoS capability
197 if (pAssocReq->capabilityInfo.qos &&
198 (pAssocReq->capabilityInfo.qos != pLocalCapabs->qos))
199 {
200 /*Temporary hack for UPF to skip 11e capability check in order to interop with
201 CSR - proper fix needs to be put in place*/
202 if ( 0 != vos_get_skip_11e_check())
203 {
Nirav Shahbc35fb72013-12-12 18:14:06 +0530204 limLog(pMac, LOG1, FL("Received unmatched QOS but cfg to suppress"
205 " - continuing"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700206 }
207 else
208 {
209 // AP does not support QoS capability
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530210 limLog(pMac, LOG1,FL("AP does not support QoS capability"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700211 return false;
212 }
213 }
214
215
216 /*
217 * If AP supports shortSlot and if apple user has
218 * enforced association only from shortSlot station,
219 * then AP must reject any station that does not support
220 * shortSlot
221 */
222 if ( ((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) && (pLocalCapabs->shortSlotTime == 1) )
223
224 {
225 if (wlan_cfgGetInt(pMac, WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY, &val) != eSIR_SUCCESS)
226 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700227 limLog(pMac, LOGP, FL("error getting WNI_CFG_FORCE_SHORT_SLOT_ASSOC_ONLY "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700228 return false;
229 }
230 if(val)
231 {
232 if (pAssocReq->capabilityInfo.shortSlotTime != pLocalCapabs->shortSlotTime)
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530233 {
234 limLog(pMac, LOG1,FL("Received shortSlotTime %d does not "
235 "match with local %d"),pAssocReq->capabilityInfo.shortSlotTime,
236 pLocalCapabs->shortSlotTime);
237 return false;
238 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700239 }
240 }
241
242 return true;
243} /****** end limCompareCapabilities() ******/
244
245
246/**
247 * limCheckRxBasicRates()
248 *
249 *FUNCTION:
250 * This function is called during Association/Reassociation
251 * frame handling to determine whether received rates in
252 * Assoc/Reassoc request frames include all BSS basic rates
253 * or not.
254 *
255 *LOGIC:
256 *
257 *ASSUMPTIONS:
258 * NA
259 *
260 *NOTE:
261 * NA
262 *
263 * @param rxRateSet - pointer to SSID structure
264 *
265 * @return status - true if ALL BSS basic rates are present in the
266 * received rateset else false.
267 */
268
269tANI_U8
270limCheckRxBasicRates(tpAniSirGlobal pMac, tSirMacRateSet rxRateSet,tpPESession psessionEntry)
271{
272 tSirMacRateSet *pRateSet, basicRate;
273 tANI_U8 i, j, k, match;
274
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530275 pRateSet = vos_mem_malloc(sizeof(tSirMacRateSet));
276 if (NULL == pRateSet)
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530278 limLog(pMac, LOGP, FL("call to AllocateMemory failed for RATESET"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700279
280 return false;
281 }
282
283
284 #if 0
285 if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
286 (tANI_U8 *) &pRateSet->rate,
287 (tANI_U32 *) &cfgLen) != eSIR_SUCCESS)
288 {
289 /// Could not get Operational rateset from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700290 limLog(pMac, LOGP, FL("could not retrieve Operational rateset"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700291
292 // Free up memory allocated for rateset
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530293 vos_mem_free((tANI_U8 *) pRateSet);
Jeff Johnson295189b2012-06-20 16:38:30 -0700294
295 return false;
296 }
297 #endif //TO SUPPORT BT-AMP
298
299 /* Copy operational rate set from session Entry */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530300 vos_mem_copy(pRateSet->rate, (psessionEntry->rateSet.rate),
301 psessionEntry->rateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700302
303 pRateSet->numRates = psessionEntry->rateSet.numRates;
304
305 // Extract BSS basic rateset from operational rateset
Kiran Kumar Lokerea328bcd2013-04-22 22:02:05 -0700306 for (i = 0, j = 0; ((i < pRateSet->numRates) && (i < SIR_MAC_RATESET_EID_MAX)) ; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 {
308 if ((pRateSet->rate[i] & 0x80) == 0x80)
309 {
310 // msb is set, so this is a basic rate
311 basicRate.rate[j++] = pRateSet->rate[i];
312 }
313 }
314
315 /*
316 * For each BSS basic rate, find if it is present in the
317 * received rateset.
318 */
319 for (k = 0; k < j; k++)
320 {
321 match = 0;
Krunal Sonia75019a2013-05-01 01:08:22 -0700322 for (i = 0; ((i < rxRateSet.numRates) && (i < SIR_MAC_RATESET_EID_MAX)); i++)
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 {
324 if ((rxRateSet.rate[i] | 0x80) == basicRate.rate[k])
325 match = 1;
326 }
327
328 if (!match)
329 {
330 // Free up memory allocated for rateset
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530331 vos_mem_free((tANI_U8 *)pRateSet);
Jeff Johnson295189b2012-06-20 16:38:30 -0700332
333 return false;
334 }
335 }
336
337 // Free up memory allocated for rateset
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530338 vos_mem_free((tANI_U8 *)pRateSet);
Jeff Johnson295189b2012-06-20 16:38:30 -0700339
340 return true;
341} /****** end limCheckRxBasicRates() ******/
342
343
344
345/**
346 * limCheckMCSSet()
347 *
348 *FUNCTION:
349 * This function is called during Association/Reassociation
350 * frame handling to determine whether received MCS rates in
351 * Assoc/Reassoc request frames includes all Basic MCS Rate Set or not.
352 *
353 *LOGIC:
354 *
355 *ASSUMPTIONS:
356 * NA
357 *
358 *NOTE:
359 * NA
360 *
361 * @param supportedMCSSet - pointer to Supported MCS Rate Set
362 *
363 * @return status - true if ALL MCS Basic Rate Set rates are present in the
364 * received rateset else false.
365 */
366
367tANI_U8
368limCheckMCSSet(tpAniSirGlobal pMac, tANI_U8* supportedMCSSet)
369{
370 tANI_U8 basicMCSSet[SIZE_OF_BASIC_MCS_SET] = {0};
371 tANI_U32 cfgLen = 0;
372 tANI_U8 i;
373 tANI_U8 validBytes;
374 tANI_U8 lastByteMCSMask = 0x1f;
375
376
377 cfgLen = WNI_CFG_BASIC_MCS_SET_LEN;
378 if (wlan_cfgGetStr(pMac, WNI_CFG_BASIC_MCS_SET,
379 (tANI_U8 *) basicMCSSet,
380 (tANI_U32 *) &cfgLen) != eSIR_SUCCESS)
381 {
382 /// Could not get Basic MCS rateset from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700383 limLog(pMac, LOGP, FL("could not retrieve Basic MCS rateset"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 return false;
385 }
386
387 validBytes = VALID_MCS_SIZE/8;
388
389 //check if all the Basic MCS Bits are set in supported MCS bitmap
390 for(i=0; i<validBytes; i++)
391 {
392 if( (basicMCSSet[i] & supportedMCSSet[i]) != basicMCSSet[i])
393 {
Nirav Shahbc35fb72013-12-12 18:14:06 +0530394 //Log is avaiable in calling function in file limProcessAssocReqFrame.c
395 limLog(pMac, LOGW, FL("One of Basic MCS Set Rates is"
396 "not supported by the Station."));
Jeff Johnson295189b2012-06-20 16:38:30 -0700397 return false;
398 }
399 }
400
401 //check the last 5 bits of the valid MCS bitmap
402 if( ((basicMCSSet[i] & lastByteMCSMask) & (supportedMCSSet[i] & lastByteMCSMask)) !=
403 (basicMCSSet[i] & lastByteMCSMask))
404 {
Nirav Shahbc35fb72013-12-12 18:14:06 +0530405 //Log is avaiable in calling function in file limProcessAssocReqFrame.c
406 limLog(pMac, LOGW, FL("One of Basic MCS Set Rates is not"
407 "supported by the Station."));
Jeff Johnson295189b2012-06-20 16:38:30 -0700408 return false;
409 }
410
411 return true;
412}
413
Jeff Johnson295189b2012-06-20 16:38:30 -0700414
415#define SECURITY_SUITE_TYPE_MASK 0xFF
416#define SECURITY_SUITE_TYPE_WEP40 0x1
417#define SECURITY_SUITE_TYPE_TKIP 0x2
418#define SECURITY_SUITE_TYPE_CCMP 0x4
419#define SECURITY_SUITE_TYPE_WEP104 0x4
420
421/**
422 * limCheckRxRSNIeMatch()
423 *
424 *FUNCTION:
425 * This function is called during Association/Reassociation
426 * frame handling to determine whether received RSN in
427 * Assoc/Reassoc request frames include supported cipher suites or not.
428 *
429 *LOGIC:
430 *
431 *ASSUMPTIONS:
432 * NA
433 *
434 *NOTE:
435 * NA
436 *
437 * @param rxRSNIe - received RSN IE in (Re)Assco req
438 *
439 * @return status - true if ALL BSS basic rates are present in the
440 * received rateset else false.
441 */
442
443tANI_U8
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700444limCheckRxRSNIeMatch(tpAniSirGlobal pMac, tDot11fIERSN rxRSNIe,tpPESession pSessionEntry,
445 tANI_U8 staIsHT, tANI_BOOLEAN *pmfConnection)
Jeff Johnson295189b2012-06-20 16:38:30 -0700446{
447 tDot11fIERSN *pRSNIe;
448 tANI_U8 i, j, match, onlyNonHtCipher = 1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700449#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700450 tANI_BOOLEAN weArePMFCapable;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800451 tANI_BOOLEAN weRequirePMF;
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700452 tANI_BOOLEAN theyArePMFCapable;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800453 tANI_BOOLEAN theyRequirePMF;
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700454#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700455
456
457 //RSN IE should be received from PE
458 pRSNIe = &pSessionEntry->gStartBssRSNIe;
459
460 // Check groupwise cipher suite
461 for (i = 0; i < sizeof(rxRSNIe.gp_cipher_suite); i++)
462 {
463 if (pRSNIe->gp_cipher_suite[i] != rxRSNIe.gp_cipher_suite[i])
464 {
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530465 limLog(pMac, LOG1, FL("RSN group cipher suite does not match local"
466 " %d recieved %d"),pRSNIe->gp_cipher_suite[i],
467 rxRSNIe.gp_cipher_suite[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -0700468 return eSIR_MAC_INVALID_GROUP_CIPHER_STATUS;
469 }
470 }
471
472 /*
473 * For each Pairwise cipher suite check whether we support
474 * received pairwise
475 */
476 match = 0;
477 for (i = 0; i < rxRSNIe.pwise_cipher_suite_count; i++)
478 {
479 for(j = 0; j < pRSNIe->pwise_cipher_suite_count; j++)
480 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530481 if (vos_mem_compare(&rxRSNIe.pwise_cipher_suites[i],
482 &pRSNIe->pwise_cipher_suites[j],
483 sizeof(pRSNIe->pwise_cipher_suites[j])))
Jeff Johnson295189b2012-06-20 16:38:30 -0700484 {
485 match = 1;
486 break;
487 }
488 }
489
490 if ((staIsHT)
491#ifdef ANI_LITTLE_BYTE_ENDIAN
492 &&( (rxRSNIe.pwise_cipher_suites[i][3] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP))
493#else
494 &&( (rxRSNIe.pwise_cipher_suites[i][0] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP))
495#endif
496 {
497 onlyNonHtCipher=0;
498 }
499
500 }
501
502 if ((!match) || ((staIsHT) && onlyNonHtCipher))
503 {
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530504 limLog(pMac, LOG1, FL("pairwise cipher suite does not match(%d)"
505 "staIsHT %d onlyNonHtCipher %d"),match,staIsHT,
506 onlyNonHtCipher);
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 return eSIR_MAC_INVALID_PAIRWISE_CIPHER_STATUS;
508 }
Venkata Prathyusha Kuntupalliea7098e2013-01-31 16:08:13 -0800509 /* Check RSN capabilities
510 * Bit 0 of First Byte - PreAuthentication Capability
511 */
512 if(((rxRSNIe.RSN_Cap[0] >> 0) & 0x1) == true) //this is supported by AP only
Jeff Johnson295189b2012-06-20 16:38:30 -0700513 {
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530514 limLog(pMac, LOG1, FL("Preuthentication Capability is set"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 return eSIR_MAC_INVALID_RSN_IE_CAPABILITIES_STATUS;
516 }
517
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700518 *pmfConnection = eANI_BOOLEAN_FALSE;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800519
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700520#ifdef WLAN_FEATURE_11W
Chet Lanctot8cecea22014-02-11 19:09:36 -0800521 weArePMFCapable = pSessionEntry->pLimStartBssReq->pmfCapable;
522 weRequirePMF = pSessionEntry->pLimStartBssReq->pmfRequired;
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700523 theyArePMFCapable = (rxRSNIe.RSN_Cap[0] >> 7) & 0x1;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800524 theyRequirePMF = (rxRSNIe.RSN_Cap[0] >> 6) & 0x1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700525
Chet Lanctotec4de332013-10-11 15:42:22 -0700526 if ((theyRequirePMF && theyArePMFCapable && !weArePMFCapable) ||
527 (weRequirePMF && !theyArePMFCapable))
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700528 {
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530529 limLog(pMac, LOG1, FL("Association fail, robust management frames "
530 "policy violation theyRequirePMF =%d theyArePMFCapable %d "
531 "weArePMFCapable %d weRequirePMF %d theyArePMFCapable %d"),
532 theyRequirePMF,theyArePMFCapable,weArePMFCapable,weRequirePMF,
533 theyArePMFCapable);
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700534 return eSIR_MAC_ROBUST_MGMT_FRAMES_POLICY_VIOLATION;
535 }
536
537 if(theyArePMFCapable && weArePMFCapable)
538 *pmfConnection = eANI_BOOLEAN_TRUE;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800539
540 limLog(pMac, LOG1, FL("weAreCapable %d, weRequire %d, theyAreCapable %d, "
541 "theyRequire %d, PMFconnection %d"),
542 weArePMFCapable, weRequirePMF, theyArePMFCapable, theyRequirePMF, *pmfConnection);
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700543#endif
544
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 return eSIR_SUCCESS;
546} /****** end limCheckRxRSNIeMatch() ******/
547
548/**
549 * limCheckRxWPAIeMatch()
550 *
551 *FUNCTION:
552 * This function is called during Association/Reassociation
553 * frame handling to determine whether received RSN in
554 * Assoc/Reassoc request frames include supported cipher suites or not.
555 *
556 *LOGIC:
557 *
558 *ASSUMPTIONS:
559 * NA
560 *
561 *NOTE:
562 * NA
563 *
564 * @param rxWPAIe - Received WPA IE in (Re)Assco req
565 *
566 * @return status - true if ALL BSS basic rates are present in the
567 * received rateset else false.
568 */
569
570tANI_U8
571limCheckRxWPAIeMatch(tpAniSirGlobal pMac, tDot11fIEWPA rxWPAIe,tpPESession pSessionEntry, tANI_U8 staIsHT)
572{
573 tDot11fIEWPA *pWPAIe;
574 tANI_U8 i, j, match, onlyNonHtCipher = 1;
575
576 // WPA IE should be received from PE
577 pWPAIe = &pSessionEntry->gStartBssWPAIe;
578
579 // Check groupwise cipher suite
580 for (i = 0; i < 4; i++)
581 {
582 if (pWPAIe->multicast_cipher[i] != rxWPAIe.multicast_cipher[i])
583 {
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530584 limLog(pMac, LOG1, FL("WPA group cipher suite does not match local"
585 " %d recieved %d"),pWPAIe->multicast_cipher[i],
586 rxWPAIe.multicast_cipher[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 return eSIR_MAC_INVALID_GROUP_CIPHER_STATUS;
588 }
589 }
590
591 /*
592 * For each Pairwise cipher suite check whether we support
593 * received pairwise
594 */
595 match = 0;
596 for (i = 0; i < rxWPAIe.unicast_cipher_count; i++)
597 {
598 for(j = 0; j < pWPAIe->unicast_cipher_count; j++)
599 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530600 if (vos_mem_compare(rxWPAIe.unicast_ciphers[i],
601 pWPAIe->unicast_ciphers[j],
602 4))
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 {
604 match = 1;
605 break;
606 }
607 }
608
609 if ((staIsHT)
610#ifdef ANI_LITTLE_BYTE_ENDIAN
611 &&( (rxWPAIe.unicast_ciphers[i][3] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP))
612#else
613 &&( (rxWPAIe.unicast_ciphers[i][0] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP))
614#endif
615 {
616 onlyNonHtCipher=0;
617 }
618
619 }
620
621 if ((!match) || ((staIsHT) && onlyNonHtCipher))
622 {
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530623 limLog(pMac, LOG1, FL("pairwise cipher suite does not match(%d)"
624 "staIsHT %d onlyNonHtCipher %d"),match,staIsHT,
625 onlyNonHtCipher);
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 return eSIR_MAC_CIPHER_SUITE_REJECTED_STATUS;
627 }
628
629 return eSIR_SUCCESS;
630} /****** end limCheckRxWPAIeMatch() ******/
631
Jeff Johnson295189b2012-06-20 16:38:30 -0700632
633/**
634 * limCleanupRxPath()
635 *
636 *FUNCTION:
637 * This function is called to cleanup STA state at SP & RFP.
638 *
639 *LOGIC:
640 * To circumvent RFP's handling of dummy packet when it does not
641 * have an incomplete packet for the STA to be deleted, a packet
642 * with 'more framgents' bit set will be queued to RFP's WQ before
643 * queuing 'dummy packet'.
644 * A 'dummy' BD is pushed into RFP's WQ with type=00, subtype=1010
645 * (Disassociation frame) and routing flags in BD set to eCPU's
646 * Low Priority WQ.
647 * RFP cleans up its local context for the STA id mentioned in the
648 * BD and then pushes BD to eCPU's low priority WQ.
649 *
650 *ASSUMPTIONS:
651 * NA
652 *
653 *NOTE:
654 * NA
655 *
656 * @param pMac Pointer to Global MAC structure
657 * @param pStaDs Pointer to the per STA data structure
658 * initialized by LIM and maintained at DPH
659 *
660 * @return None
661 */
662
663tSirRetStatus
664limCleanupRxPath(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
665{
666 tSirRetStatus retCode = eSIR_SUCCESS;
667
668
Nirav Shahbc35fb72013-12-12 18:14:06 +0530669 limLog( pMac, LOG1, FL("**Initiate cleanup"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700670
671 limAbortBackgroundScan( pMac );
Agarwal Ashish87039eb2014-01-15 14:13:15 +0530672 psessionEntry->isCiscoVendorAP = FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700673 if (pMac->lim.gLimAddtsSent)
674 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700675 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
677 }
678
679 if (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_ASSOC_CNF_STATE)
680 {
681 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER,
682 pStaDs->assocId);
683
684 if (!pStaDs->mlmStaContext.updateContext)
685 {
686 /**
687 * There is no context at Polaris to delete.
688 * Release our assigned AID back to the free pool
689 */
690 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
691 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
692 {
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800693 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 }
695 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
696
697 return retCode;
698 }
699 }
700
701 //delete all tspecs associated with this sta.
702 limAdmitControlDeleteSta(pMac, pStaDs->assocId);
703
Jeff Johnson295189b2012-06-20 16:38:30 -0700704
705 /**
706 * Make STA hash entry invalid at eCPU so that DPH
707 * does not process any more data packets and
708 * releases those BDs
709 */
710 pStaDs->valid = 0;
711 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
712
713 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
714 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700715 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700716 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 /* Deactivating probe after heart beat timer */
718 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
Leela Venkata Kiran Kumar Reddy Chiralade5d0592013-09-20 17:09:35 -0700719 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
Jeff Johnson295189b2012-06-20 16:38:30 -0700720 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
721 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
722 pMac->lim.gLastBeaconDtimCount = 0;
723 pMac->lim.gLastBeaconDtimPeriod = 0;
724
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800725#ifdef FEATURE_WLAN_ESE
726#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700727 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
728#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800730#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700731#endif
732
733 /**
734 * Update the status for PMM module
735 */
736 pmmResetPmmState(pMac);
737 }
738#ifdef WLAN_DEBUG
739 // increment a debug count
740 pMac->lim.gLimNumRxCleanup++;
741#endif
742
743 if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) {
744 retCode = limDelBss( pMac, pStaDs, psessionEntry->bssIdx, psessionEntry);
745 }
746 else
747 retCode = limDelSta( pMac, pStaDs, true, psessionEntry);
748
749 return retCode;
750
751} /*** end limCleanupRxPath() ***/
752
753
754/**
755 * limSendDelStaCnf()
756 *
757 *FUNCTION:
758 * This function is called to send appropriate CNF message to SME
759 *
760 *LOGIC:
761 *
762 *
763 *ASSUMPTIONS:
764 * NA
765 *
766 *NOTE:
767 * NA
768 *
769 * @param pMac Pointer to Global MAC structure
770 * @param tpAniSirGlobal pMac,
771 * @param tSirMacAddr staDsAddr,
772 * @param tANI_U16 staDsAssocId,
773 * @param tLimMlmStaContext mlmStaContext,
774 * @param tSirResultCodes statusCode
775 *
776 * @return None
777 */
778
779void
780limSendDelStaCnf(tpAniSirGlobal pMac, tSirMacAddr staDsAddr,
781 tANI_U16 staDsAssocId, tLimMlmStaContext mlmStaContext, tSirResultCodes statusCode,tpPESession psessionEntry)
782{
783
784 tLimMlmDisassocCnf mlmDisassocCnf;
785 tLimMlmDeauthCnf mlmDeauthCnf;
786 tLimMlmPurgeStaInd mlmPurgeStaInd;
787
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530788 limLog(pMac, LOG1, FL("Sessionid: %d staDsAssocId: %d Trigger: %X "
789 "statusCode: %d staDsAddr: "MAC_ADDRESS_STR),psessionEntry->peSessionId,
790 staDsAssocId, mlmStaContext.cleanupTrigger, statusCode,
791 MAC_ADDR_ARRAY(staDsAddr));
792
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
794 {
795 // Set BSSID at CFG to null
796 tSirMacAddr nullAddr = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
797 #if 0
798 if (cfgSetStr(pMac, WNI_CFG_BSSID, (tANI_U8 *) &nullAddr,
799 sizeof(tSirMacAddr)) != eSIR_SUCCESS)
800 {
801 /// Could not update BSSID at CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700802 limLog(pMac, LOGP, FL("could not update BSSID at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700803
804 return;
805 }
806 #endif//TO SUPPORT BT-AMP
807
808 sirCopyMacAddr(nullAddr,psessionEntry->bssId);
809
810 // Free up buffer allocated for JoinReq held by
811 // MLM state machine
812 if (psessionEntry->pLimMlmJoinReq)
813 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530814 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700815 psessionEntry->pLimMlmJoinReq = NULL;
816 }
817
818 psessionEntry->limAID = 0;
819
820
821 }
822
823 if ((mlmStaContext.cleanupTrigger ==
824 eLIM_HOST_DISASSOC) ||
825 (mlmStaContext.cleanupTrigger ==
826 eLIM_LINK_MONITORING_DISASSOC) ||
827 (mlmStaContext.cleanupTrigger ==
828 eLIM_PROMISCUOUS_MODE_DISASSOC))
829 {
830 /**
831 * Host or LMM driven Disassociation.
832 * Issue Disassoc Confirm to SME.
833 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700834 limLog( pMac, LOGW, FL("Lim Posting DISASSOC_CNF to Sme. Trigger: %X"), mlmStaContext.cleanupTrigger);
Jeff Johnson295189b2012-06-20 16:38:30 -0700835
836
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530837 vos_mem_copy((tANI_U8 *) &mlmDisassocCnf.peerMacAddr,
838 (tANI_U8 *) staDsAddr,
839 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700840 mlmDisassocCnf.resultCode = statusCode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700841 mlmDisassocCnf.disassocTrigger =
842 mlmStaContext.cleanupTrigger;
843 /* Update PE session Id*/
844 mlmDisassocCnf.sessionId = psessionEntry->peSessionId;
845
846 limPostSmeMessage(pMac,
847 LIM_MLM_DISASSOC_CNF,
848 (tANI_U32 *) &mlmDisassocCnf);
849 }
850 else if ((mlmStaContext.cleanupTrigger ==
851 eLIM_HOST_DEAUTH) ||
852 (mlmStaContext.cleanupTrigger ==
853 eLIM_LINK_MONITORING_DEAUTH))
854 {
855 /**
856 * Host or LMM driven Deauthentication.
857 * Issue Deauth Confirm to SME.
858 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700859 limLog( pMac, LOGW, FL("Lim Posting DEAUTH_CNF to Sme. Trigger: %X"), mlmStaContext.cleanupTrigger);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530860 vos_mem_copy((tANI_U8 *) &mlmDeauthCnf.peerMacAddr,
861 (tANI_U8 *) staDsAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 sizeof(tSirMacAddr));
863 mlmDeauthCnf.resultCode = statusCode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700864 mlmDeauthCnf.deauthTrigger =
865 mlmStaContext.cleanupTrigger;
866 /* PE session Id */
867 mlmDeauthCnf.sessionId = psessionEntry->peSessionId;
868
869 limPostSmeMessage(pMac,
870 LIM_MLM_DEAUTH_CNF,
871 (tANI_U32 *) &mlmDeauthCnf);
872 }
873 else if ((mlmStaContext.cleanupTrigger ==
874 eLIM_PEER_ENTITY_DISASSOC) ||
875 (mlmStaContext.cleanupTrigger ==
876 eLIM_PEER_ENTITY_DEAUTH))
877 {
878 /**
879 * Received Disassociation/Deauthentication from peer.
880 * Issue Purge Ind to SME.
881 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700882 limLog( pMac, LOGW, FL("Lim Posting PURGE_STA_IND to Sme. Trigger: %X"), mlmStaContext.cleanupTrigger) ;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530883 vos_mem_copy((tANI_U8 *) &mlmPurgeStaInd.peerMacAddr,
884 (tANI_U8 *) staDsAddr,
885 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700886 mlmPurgeStaInd.reasonCode = (tANI_U8) mlmStaContext.disassocReason;
887 mlmPurgeStaInd.aid = staDsAssocId;
888 mlmPurgeStaInd.purgeTrigger = mlmStaContext.cleanupTrigger;
889 mlmPurgeStaInd.sessionId = psessionEntry->peSessionId;
890
891 limPostSmeMessage(pMac,
892 LIM_MLM_PURGE_STA_IND,
893 (tANI_U32 *) &mlmPurgeStaInd);
894 }
895 else if(mlmStaContext.cleanupTrigger == eLIM_JOIN_FAILURE)
896 {
897 //PE setup the peer entry in HW upfront, right after join is completed.
898 //If there is a failure during rest of the assoc sequence, this context needs to be cleaned up.
899 tANI_U8 smesessionId;
900 tANI_U16 smetransactionId;
Mukul Sharmaa052e3d2014-09-08 23:47:06 +0530901 tLimSmeStates tempLimSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700902
903 smesessionId = psessionEntry->smeSessionId;
904 smetransactionId = psessionEntry->transactionId;
905
Mukul Sharmaa052e3d2014-09-08 23:47:06 +0530906 tempLimSmeState = psessionEntry->limSmeState;
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700908 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700909
Jeff Johnsone7245742012-09-05 17:12:55 -0700910 //if it is a reassoc failure to join new AP
Mukul Sharmaa052e3d2014-09-08 23:47:06 +0530911 //eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA result code is used
912 //during assoc and reassoc, so sme state req to distinguish them
Madan Mohan Koyyalamudif33324b2012-11-06 19:16:17 -0800913 if((mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE) ||
Santhosh Kumar Padmaa2291d72014-05-23 18:08:50 +0530914 (mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_FAILURE) ||
Mukul Sharmaa052e3d2014-09-08 23:47:06 +0530915 (mlmStaContext.resultCode == eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE) ||
916 (mlmStaContext.resultCode == eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA
917 && tempLimSmeState == eLIM_SME_WT_REASSOC_STATE)
918 )
Jeff Johnsone7245742012-09-05 17:12:55 -0700919 {
920 if(mlmStaContext.resultCode != eSIR_SME_SUCCESS )
921 {
922 peDeleteSession(pMac, psessionEntry);
923 psessionEntry = NULL;
924 }
925
926 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
927 mlmStaContext.resultCode, mlmStaContext.protStatusCode, psessionEntry,
928 smesessionId, smetransactionId);
929 }
930 else
931 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530932 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700933 psessionEntry->pLimJoinReq = NULL;
934
935 if(mlmStaContext.resultCode != eSIR_SME_SUCCESS)
936 {
937 peDeleteSession(pMac,psessionEntry);
938 psessionEntry = NULL;
939 }
940
941 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, mlmStaContext.resultCode, mlmStaContext.protStatusCode,
942 psessionEntry, smesessionId, smetransactionId);
Jeff Johnsone7245742012-09-05 17:12:55 -0700943 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700944
945 }
946
947 if((NULL != psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700948 && (eLIM_AP_ROLE != psessionEntry->limSystemRole )
Jeff Johnson295189b2012-06-20 16:38:30 -0700949 )
950 {
951 peDeleteSession(pMac,psessionEntry);
952 psessionEntry = NULL;
953 }
954}
955
956/**
957 * limRejectAssociation()
958 *
959 *FUNCTION:
960 * This function is called whenever Re/Association Request need
961 * to be rejected due to failure in assigning an AID or failure
962 * in adding STA context at Polaris or reject by applications.
963 *
964 *LOGIC:
965 * Resources allocated if any are freedup and (Re) Association
966 * Response frame is sent to requesting STA. Pre-Auth context
967 * will be added for this STA if it does not exist already
968 *
969 *ASSUMPTIONS:
970 *
971 *NOTE:
972 *
973 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
974 * @param subType - Indicates whether it is Association Request (=0) or
975 * Reassociation Request (=1) frame
976 * @param addPreAuthContext - Indicates whether pre-auth context
977 * to be added for this STA
978 * @param authType - Indicates auth type to be added
979 * @param staId - Indicates staId of the STA being rejected
980 * association
981 * @param deleteSta - Indicates whether to delete STA context
982 * at Polaris
983 * @param rCode - Indicates what reasonCode to be sent in
984 * Re/Assoc response to STA
985 *
986 * @return None
987 */
988
989void
990limRejectAssociation(tpAniSirGlobal pMac, tSirMacAddr peerAddr, tANI_U8 subType,
991 tANI_U8 addPreAuthContext, tAniAuthType authType,
992 tANI_U16 staId, tANI_U8 deleteSta, tSirResultCodes rCode, tpPESession psessionEntry )
993{
994 tpDphHashNode pStaDs;
995
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530996 limLog(pMac, LOG1, FL("Sessionid: %d authType: %d subType: %d "
997 "addPreAuthContext: %d staId: %d deleteSta: %d rCode : %d "
998 "peerAddr: "MAC_ADDRESS_STR),psessionEntry->peSessionId,
999 authType, subType, addPreAuthContext, staId, deleteSta, rCode,
1000 MAC_ADDR_ARRAY(peerAddr));
1001
Jeff Johnson295189b2012-06-20 16:38:30 -07001002 if (addPreAuthContext)
1003 {
1004 // Create entry for this STA in pre-auth list
1005 struct tLimPreAuthNode *pAuthNode;
1006
1007 pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable);
1008
1009 if (pAuthNode)
1010 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301011 vos_mem_copy((tANI_U8 *) pAuthNode->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001012 peerAddr,
1013 sizeof(tSirMacAddr));
1014 pAuthNode->fTimerStarted = 0;
1015 pAuthNode->mlmState = eLIM_MLM_AUTHENTICATED_STATE;
1016 pAuthNode->authType = (tAniAuthType) authType;
1017 limAddPreAuthNode(pMac, pAuthNode);
1018 }
1019 }
1020
1021 if (deleteSta == true)
1022 {
1023 pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable);
1024
1025 if (pStaDs == NULL)
1026 {
1027 limLog(pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001028 FL("No STA context, yet rejecting Association"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001029
1030 return;
1031 }
1032
1033 /**
1034 * Polaris has state for this STA.
1035 * Trigger cleanup.
1036 */
1037 pStaDs->mlmStaContext.cleanupTrigger = eLIM_REASSOC_REJECT;
1038
1039 // Receive path cleanup
1040 limCleanupRxPath(pMac, pStaDs, psessionEntry);
1041
1042 // Send Re/Association Response with
1043 // status code to requesting STA.
1044 limSendAssocRspMgmtFrame(pMac,
1045 rCode,
1046 0,
1047 peerAddr,
1048 subType, 0,psessionEntry);
1049
1050 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL)
1051 {
1052 // Assoction confirmation is complete, free the copy of association request frame
1053 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
1054 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301055 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07001056 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
1057 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301058 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07001059 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
1060 }
1061 }
1062 else
1063 {
1064 limSendAssocRspMgmtFrame(pMac,
1065 eSIR_MAC_MAX_ASSOC_STA_REACHED_STATUS,
1066 1,
1067 peerAddr,
1068 subType, 0,psessionEntry);
1069 // Log error
1070 limLog(pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001071 FL("received Re/Assoc req when max associated STAs reached from "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001072 limPrintMacAddr(pMac, peerAddr, LOGW);
1073 limSendSmeMaxAssocExceededNtf(pMac, peerAddr, psessionEntry->smeSessionId);
1074 }
1075} /*** end limRejectAssociation() ***/
1076
Jeff Johnson295189b2012-06-20 16:38:30 -07001077
1078/** -------------------------------------------------------------
1079\fn limDecideApProtectionOnHt20Delete
1080\brief protection related function while HT20 station is getting deleted.
1081\param tpAniSirGlobal pMac
1082\param tpDphHashNode pStaDs
1083\param tpUpdateBeaconParams pBeaconParams
1084\return None
1085 -------------------------------------------------------------*/
1086static void
1087limDecideApProtectionOnHt20Delete(tpAniSirGlobal pMac,
1088 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1089{
1090 tANI_U32 i = 0;
1091 PELOG1( limLog(pMac, LOG1, FL("(%d) A HT 20 STA is disassociated. Addr is "),
1092 psessionEntry->gLimHt20Params.numSta);
1093 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1094 if (psessionEntry->gLimHt20Params.numSta > 0)
1095 {
1096 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1097 {
1098 if (psessionEntry->protStaCache[i].active)
1099 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301100 if (vos_mem_compare(psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001101 pStaDs->staAddr, sizeof(tSirMacAddr)))
1102 {
1103 psessionEntry->gLimHt20Params.numSta--;
1104 psessionEntry->protStaCache[i].active = false;
1105 break;
1106 }
1107 }
1108 }
1109 }
1110
1111 if (psessionEntry->gLimHt20Params.numSta == 0)
1112 {
1113 // disable protection
Nirav Shahbc35fb72013-12-12 18:14:06 +05301114 limLog(pMac, LOG1, FL("No 11B STA exists, PESessionID %d"),
1115 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001116 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
1117 }
1118}
1119/** -------------------------------------------------------------
1120\fn limDecideApProtectionOnDelete
1121\brief Decides about protection related settings when a station is getting deleted.
1122\param tpAniSirGlobal pMac
1123\param tpDphHashNode pStaDs
1124\param tpUpdateBeaconParams pBeaconParams
1125\return None
1126 -------------------------------------------------------------*/
1127void
1128limDecideApProtectionOnDelete(tpAniSirGlobal pMac,
1129 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1130{
1131 tANI_U32 phyMode;
1132 tHalBitVal erpEnabled = eHAL_CLEAR;
1133 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1134 tANI_U32 i;
1135
1136 if(NULL == pStaDs)
1137 return;
1138
1139 limGetRfBand(pMac, &rfBand, psessionEntry);
1140 if(SIR_BAND_5_GHZ == rfBand)
1141 {
1142 //we are HT. if we are 11A, then protection is not required.
Jeff Johnsone7245742012-09-05 17:12:55 -07001143 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001144 {
1145 //we are HT and 11A station is leaving.
1146 //protection consideration required.
1147 //HT station leaving ==> this case is commonly handled between both the bands below.
1148 if((psessionEntry->beaconParams.llaCoexist) &&
1149 (false == pStaDs->mlmStaContext.htCapability))
1150 {
1151 PELOG1(limLog(pMac, LOG1, FL("(%d) A 11A STA is disassociated. Addr is "),
1152 psessionEntry->gLim11aParams.numSta);
1153 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1154 if (psessionEntry->gLim11aParams.numSta > 0)
1155 {
1156 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1157 {
1158 if (psessionEntry->protStaCache[i].active)
1159 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301160 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001161 pStaDs->staAddr, sizeof(tSirMacAddr)))
1162 {
1163 psessionEntry->gLim11aParams.numSta--;
1164 psessionEntry->protStaCache[i].active = false;
1165 break;
1166 }
1167 }
1168 }
1169 }
1170
1171 if(psessionEntry->gLim11aParams.numSta == 0)
1172 {
1173 // disable protection
1174 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
1175 }
1176 }
1177 }
1178 }
1179 else if(SIR_BAND_2_4_GHZ == rfBand)
1180 {
1181 limGetPhyMode(pMac, &phyMode, psessionEntry);
1182
1183 erpEnabled = pStaDs->erpEnabled;
1184 //we are HT or 11G and 11B station is getting deleted.
1185 if (((phyMode == WNI_CFG_PHY_MODE_11G) ||
Jeff Johnsone7245742012-09-05 17:12:55 -07001186 psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001187 (erpEnabled == eHAL_CLEAR))
1188 {
1189 PELOG1(limLog(pMac, LOG1, FL("(%d) A legacy STA is disassociated. Addr is "),
1190 psessionEntry->gLim11bParams.numSta);
1191 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1192 if (psessionEntry->gLim11bParams.numSta > 0)
1193 {
1194 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1195 {
1196 if (psessionEntry->protStaCache[i].active)
1197 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301198 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001199 pStaDs->staAddr, sizeof(tSirMacAddr)))
1200 {
1201 psessionEntry->gLim11bParams.numSta--;
1202 psessionEntry->protStaCache[i].active = false;
1203 break;
1204 }
1205 }
1206 }
1207 }
1208
1209 if (psessionEntry->gLim11bParams.numSta == 0)
1210 {
1211 // disable protection
Jeff Johnson295189b2012-06-20 16:38:30 -07001212 limEnable11gProtection(pMac, false, false, pBeaconParams,psessionEntry);
1213 }
1214 }
1215 //(non-11B station is leaving) or (we are not 11G or HT AP)
Jeff Johnsone7245742012-09-05 17:12:55 -07001216 else if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001217 { //we are HT AP and non-11B station is leaving.
1218
1219 //11g station is leaving
1220 if(!pStaDs->mlmStaContext.htCapability)
1221 {
1222 PELOG1(limLog(pMac, LOG1, FL("(%d) A 11g STA is disassociated. Addr is "),
1223 psessionEntry->gLim11bParams.numSta);
1224 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1225 if (psessionEntry->gLim11gParams.numSta > 0)
1226 {
1227 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1228 {
1229 if (psessionEntry->protStaCache[i].active)
1230 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301231 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001232 pStaDs->staAddr, sizeof(tSirMacAddr)))
1233 {
1234 psessionEntry->gLim11gParams.numSta--;
1235 psessionEntry->protStaCache[i].active = false;
1236 break;
1237 }
1238 }
1239 }
1240 }
1241
1242 if (psessionEntry->gLim11gParams.numSta == 0)
1243 {
1244 // disable protection
1245 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
1246 }
1247 }
1248 }
1249 }
1250
1251 //LSIG TXOP not supporting staiton leaving. applies to 2.4 as well as 5 GHZ.
Jeff Johnsone7245742012-09-05 17:12:55 -07001252 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001253 (true == pStaDs->mlmStaContext.htCapability))
1254 {
1255 //HT non-GF leaving
1256 if(!pStaDs->htGreenfield)
1257 {
1258 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-GF STA is disassociated. Addr is "),
1259 psessionEntry->gLimNonGfParams.numSta);
1260 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1261 if (psessionEntry->gLimNonGfParams.numSta > 0)
1262 {
1263 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1264 {
1265 if (psessionEntry->protStaCache[i].active)
1266 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301267 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001268 pStaDs->staAddr, sizeof(tSirMacAddr)))
1269 {
1270 psessionEntry->gLimNonGfParams.numSta--;
1271 psessionEntry->protStaCache[i].active = false;
1272 break;
1273 }
1274 }
1275 }
1276 }
1277
1278 if (psessionEntry->gLimNonGfParams.numSta == 0)
1279 {
1280 // disable protection
1281 limEnableHTNonGfProtection(pMac, false, false, pBeaconParams,psessionEntry);
1282 }
1283 }
1284 //HT 20Mhz station leaving.
1285 if(psessionEntry->beaconParams.ht20Coexist &&
1286 (eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet))
1287 {
1288 limDecideApProtectionOnHt20Delete(pMac, pStaDs, pBeaconParams,psessionEntry);
1289 }
1290
1291 if(false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport &&
1292 (false == pStaDs->htLsigTXOPProtection))
1293 {
1294 PELOG1( limLog(pMac, LOG1, FL("(%d) A HT LSIG not supporting STA is disassociated. Addr is "),
1295 psessionEntry->gLimLsigTxopParams.numSta);
1296 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1297 if (psessionEntry->gLimLsigTxopParams.numSta > 0)
1298 {
1299 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1300 {
1301 if (psessionEntry->protStaCache[i].active)
1302 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301303 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001304 pStaDs->staAddr, sizeof(tSirMacAddr)))
1305 {
1306 psessionEntry->gLimLsigTxopParams.numSta--;
1307 psessionEntry->protStaCache[i].active = false;
1308 break;
1309 }
1310 }
1311 }
1312 }
1313
1314 if (psessionEntry->gLimLsigTxopParams.numSta == 0)
1315 {
1316 // disable protection
1317 limEnableHTLsigTxopProtection(pMac, true, false, pBeaconParams,psessionEntry);
1318 }
1319 }
1320 }
1321}
1322
Jeff Johnson295189b2012-06-20 16:38:30 -07001323
1324
1325/** -------------------------------------------------------------
1326\fn limDecideShortPreamble
1327\brief Decides about any short preamble reated change because of new station joining.
1328\param tpAniSirGlobal pMac
1329\param tpDphHashNode pStaDs
1330\param tpUpdateBeaconParams pBeaconParams
1331\return None
1332 -------------------------------------------------------------*/
1333void limDecideShortPreamble(tpAniSirGlobal pMac,
1334 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry )
1335{
1336 tANI_U32 i;
1337
1338 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
1339 {
1340 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-short preamble STA is disassociated. Addr is "),
1341 psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
1342 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1343 if (psessionEntry->gLimNoShortParams.numNonShortPreambleSta > 0)
1344 {
1345 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1346 {
1347 if (psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
1348 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301349 if (vos_mem_compare( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001350 pStaDs->staAddr, sizeof(tSirMacAddr)))
1351 {
1352 psessionEntry->gLimNoShortParams.numNonShortPreambleSta--;
1353 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = false;
1354 break;
1355 }
1356 }
1357 }
1358 }
1359
1360 if (psessionEntry->gLimNoShortParams.numNonShortPreambleSta == 0)
1361 {
1362 // enable short preamble
Jeff Johnson295189b2012-06-20 16:38:30 -07001363 //reset the cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301364 vos_mem_set((tANI_U8 *)&psessionEntry->gLimNoShortParams,
1365 sizeof(tLimNoShortParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001366 if (limEnableShortPreamble(pMac, true, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001367 PELOGE(limLog(pMac, LOGE, FL("Cannot enable short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001368 }
1369 }
1370}
1371
1372/** -------------------------------------------------------------
1373\fn limDecideShortSlot
1374\brief Decides about any short slot time related change because of station leaving the BSS.
1375\param tpAniSirGlobal pMac
1376\param tpDphHashNode pStaDs
1377\return None
1378 -------------------------------------------------------------*/
1379
1380void
1381limDecideShortSlot(tpAniSirGlobal pMac, tpDphHashNode pStaDs,
1382 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
1383{
1384 tANI_U32 i, val;
1385 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
1386 {
1387 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-short slottime STA is disassociated. Addr is "),
1388 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
1389 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1390
Jeff Johnson295189b2012-06-20 16:38:30 -07001391 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
1392 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta> 0)
1393 {
1394 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1395 {
1396 if (psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
1397 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301398 if (vos_mem_compare(psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001399 pStaDs->staAddr, sizeof(tSirMacAddr)))
1400 {
1401 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta--;
1402 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = false;
1403 break;
1404 }
1405 }
1406 }
1407 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001408 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001409 {
1410 if (pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta> 0)
1411 {
1412 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1413 {
1414 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
1415 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301416 if (vos_mem_compare(pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001417 pStaDs->staAddr, sizeof(tSirMacAddr)))
1418 {
1419 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta--;
1420 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = false;
1421 break;
1422 }
1423 }
1424 }
1425 }
1426 }
1427
1428 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
1429
Jeff Johnson295189b2012-06-20 16:38:30 -07001430 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
1431 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta == 0))
1432 {
1433 // enable short slot time
Jeff Johnson295189b2012-06-20 16:38:30 -07001434 //reset the cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301435 vos_mem_set((tANI_U8 *)&psessionEntry->gLimNoShortSlotParams,
1436 sizeof(tLimNoShortSlotParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001437 // in case of AP set SHORT_SLOT_TIME to enable
1438 if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
1439 {
1440 pBeaconParams->fShortSlotTime = true;
1441 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnsone7245742012-09-05 17:12:55 -07001442 psessionEntry->shortSlotTimeSupported = true;
Jeff Johnson295189b2012-06-20 16:38:30 -07001443 }
1444 }
1445 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001446 {
1447 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta == 0)
1448 {
1449 // enable short slot time
Jeff Johnson295189b2012-06-20 16:38:30 -07001450 //reset the cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301451 vos_mem_set((tANI_U8 *)&pMac->lim.gLimNoShortSlotParams,
1452 sizeof(tLimNoShortSlotParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001453 // in case of AP set SHORT_SLOT_TIME to enable
1454 if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
1455 {
1456 pBeaconParams->fShortSlotTime = true;
1457 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnsone7245742012-09-05 17:12:55 -07001458 psessionEntry->shortSlotTimeSupported = true;
1459 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 }
1461 }
1462 }
1463}
1464
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -07001465void
1466limPostReassocFailure(tpAniSirGlobal pMac,
1467 tSirResultCodes resultCode,
1468 tANI_U16 protStatusCode,tpPESession psessionEntry)
1469{
1470 tLimMlmReassocCnf mlmReassocCnf;
1471
1472 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
1473 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE));
1474
1475 // 'Change' timer for future activations
1476 limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
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 limPostReassocFailure() ***/
1486
Jeff Johnson295189b2012-06-20 16:38:30 -07001487/**
1488 * limRestorePreReassocState()
1489 *
1490 *FUNCTION:
1491 * This function is called on STA role whenever Reasociation
1492 * Response with a reject code is received from AP.
1493 *
1494 *LOGIC:
1495 * Reassociation failure timer is stopped, Old (or current) AP's
1496 * context is restored both at Polaris & software
1497 *
1498 *ASSUMPTIONS:
1499 *
1500 *NOTE:
1501 *
1502 * @param pMac - Pointer to Global MAC structure
1503 * @param resultCode - Result code that specifies why Reassociation
1504 * attemp failed
1505 *
1506 * @return None
1507 */
1508
1509void
1510limRestorePreReassocState(tpAniSirGlobal pMac,
1511 tSirResultCodes resultCode,
1512 tANI_U16 protStatusCode,tpPESession psessionEntry)
1513{
Jeff Johnsone7245742012-09-05 17:12:55 -07001514 tANI_U8 chanNum, secChanOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07001515 tLimMlmReassocCnf mlmReassocCnf;
1516
Abhishek Singhdcbd8272014-01-09 14:16:01 +05301517 limLog(pMac, LOG1, FL("sessionid: %d protStatusCode: %d resultCode: %d"),
1518 psessionEntry->smeSessionId, protStatusCode, resultCode);
1519
Jeff Johnson295189b2012-06-20 16:38:30 -07001520 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001521 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07001522
1523 // 'Change' timer for future activations
1524 limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
1525
1526 // Update BSSID at CFG database
1527 #if 0
1528 if (cfgSetStr(pMac, WNI_CFG_BSSID,
1529 pMac->lim.gLimCurrentBssId,
1530 sizeof(tSirMacAddr)) != eSIR_SUCCESS)
1531 {
1532 /// Could not update BSSID at CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001533 limLog(pMac, LOGP, FL("could not update BSSID at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001534 return;
1535 }
Madan Mohan Koyyalamudi70322d52012-10-18 20:07:33 -07001536 #endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001537
1538 // chanNum = pMac->lim.gLimCurrentChannelId;
1539
1540 /* To support BT-AMP */
1541 chanNum = psessionEntry->currentOperChannel;
Jeff Johnsone7245742012-09-05 17:12:55 -07001542 secChanOffset = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07001543
Jeff Johnsone7245742012-09-05 17:12:55 -07001544 limSetChannel(pMac, chanNum, secChanOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001545
1546 /** @ToDo : Need to Integrate the STOP the DataTransfer to the AP from 11H code */
1547
1548 mlmReassocCnf.resultCode = resultCode;
1549 mlmReassocCnf.protStatusCode = protStatusCode;
1550 /* Update PE session Id */
1551 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
1552 limPostSmeMessage(pMac,
1553 LIM_MLM_REASSOC_CNF,
1554 (tANI_U32 *) &mlmReassocCnf);
1555} /*** end limRestorePreReassocState() ***/
1556
1557
1558
1559/**
1560 * limIsReassocInProgress()
1561 *
1562 *FUNCTION:
1563 * This function is called to see if STA is in wt-reassoc-rsp state.
1564 *
1565 *LOGIC:
1566 *
1567 *ASSUMPTIONS:
1568 *
1569 *NOTE:
1570 *
1571 * @param pMac - Pointer to Global MAC structure
1572 *
1573 * @return eANI_BOOLEAN_TRUE When STA is waiting for Reassoc response from AP \n
1574 * else eANI_BOOLEAN_FALSE
1575 */
1576
1577eAniBoolean
1578limIsReassocInProgress(tpAniSirGlobal pMac,tpPESession psessionEntry)
1579{
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001580 if (psessionEntry == NULL)
1581 {
1582 return eANI_BOOLEAN_FALSE;
1583 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001584 if(((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
1585 ((psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE) ||
1586 (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_LINK_FAIL_STATE)))
1587 return eANI_BOOLEAN_TRUE;
1588
1589 return eANI_BOOLEAN_FALSE;
1590} /*** end limIsReassocInProgress() ***/
1591
Jeff Johnsone7245742012-09-05 17:12:55 -07001592#ifdef WLAN_FEATURE_11AC
1593tSirRetStatus limPopulateVhtMcsSet(tpAniSirGlobal pMac,
1594 tpSirSupportedRates pRates,
1595 tDot11fIEVHTCaps *pPeerVHTCaps,
1596 tpPESession psessionEntry)
1597{
1598 tANI_U32 val;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001599 tANI_U32 selfStaDot11Mode=0;
1600 wlan_cfgGetInt(pMac,WNI_CFG_DOT11_MODE,&selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001601
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001602// if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
1603 if (IS_DOT11_MODE_VHT(selfStaDot11Mode))
Jeff Johnsone7245742012-09-05 17:12:55 -07001604 {
1605 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_MCS_MAP,&val) !=
1606 eSIR_SUCCESS )
1607 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001608 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX MCS MAP"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001609 goto error;
1610 }
1611 pRates->vhtRxMCSMap = (tANI_U16)val;
1612
1613 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_MCS_MAP,&val ) !=
1614 eSIR_SUCCESS )
1615 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001616 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT TX MCS MAP"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001617 goto error;
1618 }
1619 pRates->vhtTxMCSMap = (tANI_U16)val;
1620
1621 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,&val ) !=
1622 eSIR_SUCCESS )
1623 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001624 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001625 goto error;
1626 }
1627 pRates->vhtRxHighestDataRate = (tANI_U16)val;
1628
1629 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,&val ) !=
1630 eSIR_SUCCESS )
1631 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001632 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001633 goto error;
1634 }
1635 pRates->vhtTxHighestDataRate = (tANI_U16)val;
1636
1637 if( pPeerVHTCaps != NULL)
1638 {
1639 pRates->vhtTxHighestDataRate = SIR_MIN(pRates->vhtTxHighestDataRate, pPeerVHTCaps->txSupDataRate);
1640 pRates->vhtRxHighestDataRate = SIR_MIN(pRates->vhtRxHighestDataRate, pPeerVHTCaps->rxHighSupDataRate);
1641
Jeff Johnson1250df42012-12-10 14:31:52 -08001642 // Acquire PEER MCS map if we exceed.
Jeff Johnsone7245742012-09-05 17:12:55 -07001643 // We compare/update only the last 2 bits of the map as we support only single BSS.
1644 // Firmware takes care of this comparison
1645 pRates->vhtRxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap
1646 pRates->vhtRxMCSMap |= (pPeerVHTCaps->rxMCSMap & 0x3); // Updating the last 2 bits in the bitmap
1647
1648 // Firmware takes care of this comparison
1649 pRates->vhtTxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap
1650 pRates->vhtTxMCSMap |= (pPeerVHTCaps->txMCSMap & 0x3); // Updating the last 2 bits in the bitmap
1651 }
1652 }
1653 return eSIR_SUCCESS;
1654error:
1655
1656 return eSIR_FAILURE;
1657
1658}
1659#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001660
1661/**
1662 * limPopulateOwnRateSet
1663 *
1664 * FUNCTION:
1665 * This function is called by limProcessAssocRsp() or
1666 * limAddStaInIBSS()
1667 * - It creates a combined rate set of 12 rates max which
1668 * comprises the basic and extended rates read from CFG
1669 * - It sorts the combined rate Set and copy it in the
1670 * rate array of the pSTA descriptor
1671 * - It sets the erpEnabled bit of the STA descriptor
1672 *
1673 * NOTE:
1674 * ERP bit is set iff the dph PHY mode is 11G and there is at least
1675 * an A rate in the supported or extended rate sets
1676 *
1677 * @param pMac - Pointer to Global MAC structure
1678 * @param basicOnly - When passed value is true, only basic
1679 * rates are copied to DPH node else
1680 * all supported rates are copied
1681 * @return eSIR_SUCCESS or eSIR_FAILURE
1682 *
1683 */
Jeff Johnsone7245742012-09-05 17:12:55 -07001684#ifdef WLAN_FEATURE_11AC
1685tSirRetStatus
1686limPopulateOwnRateSet(tpAniSirGlobal pMac,
1687 tpSirSupportedRates pRates,
1688 tANI_U8* pSupportedMCSSet,
1689 tANI_U8 basicOnly,
1690 tpPESession psessionEntry,
1691 tDot11fIEVHTCaps *pVHTCaps)
1692#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001693tSirRetStatus
1694limPopulateOwnRateSet(tpAniSirGlobal pMac,
1695 tpSirSupportedRates pRates,
1696 tANI_U8* pSupportedMCSSet,
1697 tANI_U8 basicOnly,
1698 tpPESession psessionEntry)
Jeff Johnsone7245742012-09-05 17:12:55 -07001699#endif
1700
Jeff Johnson295189b2012-06-20 16:38:30 -07001701{
1702 tSirMacRateSet tempRateSet;
1703 tSirMacRateSet tempRateSet2;
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301704 tANI_U32 i,j,val,min,isArate;
Jeff Johnson295189b2012-06-20 16:38:30 -07001705 tANI_U32 phyMode = 0;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001706 tANI_U32 selfStaDot11Mode=0;
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301707
Jeff Johnson295189b2012-06-20 16:38:30 -07001708 isArate = 0;
1709
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001710 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001711 limGetPhyMode(pMac, &phyMode, psessionEntry);
1712
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301713 /* Include 11b rates only when the device configured in
1714 auto, 11a/b/g or 11b_only */
1715 if ( (selfStaDot11Mode == WNI_CFG_DOT11_MODE_ALL) ||
1716 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11A) ||
1717 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11AC) ||
Leela Venkata Kiran Kumar Reddy Chiralac9a10e52013-08-29 16:37:15 -07001718 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11N) ||
1719 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11G) ||
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301720 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11B) )
Jeff Johnson295189b2012-06-20 16:38:30 -07001721 {
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301722 val = WNI_CFG_SUPPORTED_RATES_11B_LEN;
1723 wlan_cfgGetStr( pMac, WNI_CFG_SUPPORTED_RATES_11B,
1724 (tANI_U8 *)&tempRateSet.rate, &val );
1725 tempRateSet.numRates = (tANI_U8) val;
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07001726 }
1727 else
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301728 tempRateSet.numRates = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001729
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301730 /* Include 11a rates when the device configured in non-11b mode */
1731 if (!IS_DOT11_MODE_11B(selfStaDot11Mode))
Jeff Johnson295189b2012-06-20 16:38:30 -07001732 {
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301733 val = WNI_CFG_SUPPORTED_RATES_11A_LEN;
1734 wlan_cfgGetStr( pMac, WNI_CFG_SUPPORTED_RATES_11A,
1735 (tANI_U8 *)&tempRateSet2.rate, &val );
Jeff Johnson295189b2012-06-20 16:38:30 -07001736 tempRateSet2.numRates = (tANI_U8) val;
Jeff Johnson295189b2012-06-20 16:38:30 -07001737 }
1738 else
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301739 tempRateSet2.numRates = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001740
1741 if ((tempRateSet.numRates + tempRateSet2.numRates) > 12)
1742 {
1743 //we are in big trouble
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001744 limLog(pMac, LOGP, FL("more than 12 rates in CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001745 //panic
1746 goto error;
1747 }
1748
Jeff Johnson295189b2012-06-20 16:38:30 -07001749 //copy all rates in tempRateSet, there are 12 rates max
1750 for (i = 0;i < tempRateSet2.numRates; i++)
1751 tempRateSet.rate[i + tempRateSet.numRates] = tempRateSet2.rate[i];
1752 tempRateSet.numRates += tempRateSet2.numRates;
1753
1754 /**
1755 * Sort rates in tempRateSet (they are likely to be already sorted)
1756 * put the result in pSupportedRates
1757 */
1758 {
1759 tANI_U8 aRateIndex = 0;
1760 tANI_U8 bRateIndex = 0;
1761
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301762 vos_mem_set((tANI_U8 *) pRates, sizeof(tSirSupportedRates), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001763 for(i = 0;i < tempRateSet.numRates; i++)
1764 {
1765 min = 0;
1766 val = 0xff;
1767 isArate = 0;
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07001768 for(j = 0; (j < tempRateSet.numRates) && (j < SIR_MAC_RATESET_EID_MAX); j++)
Jeff Johnson295189b2012-06-20 16:38:30 -07001769 {
1770 if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
1771 {
1772 val = tempRateSet.rate[j] & 0x7f;
1773 min = j;
1774 }
1775 }
1776
1777 if (sirIsArate(tempRateSet.rate[min] & 0x7f))
1778 isArate = 1;
1779
1780 /*
1781 * HAL needs to know whether the rate is basic rate or not, as it needs to
1782 * update the response rate table accordingly. e.g. if one of the 11a rates is
1783 * basic rate, then that rate can be used for sending control frames.
1784 * HAL updates the response rate table whenever basic rate set is changed.
1785 */
1786 if (basicOnly)
1787 {
1788 if (tempRateSet.rate[min] & 0x80)
1789 {
1790 if (isArate)
1791 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1792 else
1793 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1794 }
1795 }
1796 else
1797 {
1798 if (isArate)
1799 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1800 else
1801 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1802 }
1803 tempRateSet.rate[min] = 0xff;
1804 }
1805
1806 }
1807
1808
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001809 //if(IS_DOT11_MODE_HT(psessionEntry->dot11mode))
1810 if (IS_DOT11_MODE_HT(selfStaDot11Mode))
Jeff Johnson295189b2012-06-20 16:38:30 -07001811 {
1812 val = SIZE_OF_SUPPORTED_MCS_SET;
1813 if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
1814 pRates->supportedMCSSet,
1815 &val) != eSIR_SUCCESS)
1816 {
1817 /// Could not get rateset from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001818 PELOGE(limLog(pMac, LOGE, FL("could not retrieve supportedMCSSet"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001819 goto error;
1820 }
1821
1822
1823 //if supported MCS Set of the peer is passed in, then do the intersection
1824 //else use the MCS set from local CFG.
1825
1826 if(pSupportedMCSSet != NULL)
1827 {
1828 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
1829 pRates->supportedMCSSet[i] &= pSupportedMCSSet[i];
1830
1831 }
1832
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001833 PELOG2(limLog(pMac, LOG2, FL("MCS Rate Set Bitmap: "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001834 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
Abhishek Singhdcbd8272014-01-09 14:16:01 +05301835 PELOG2(limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001836 }
1837
Jeff Johnsone7245742012-09-05 17:12:55 -07001838#ifdef WLAN_FEATURE_11AC
1839 limPopulateVhtMcsSet(pMac, pRates , pVHTCaps,psessionEntry);
1840#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001841
1842 return eSIR_SUCCESS;
1843
1844 error:
1845
1846 return eSIR_FAILURE;
1847} /*** limPopulateOwnRateSet() ***/
1848
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001849#ifdef WLAN_FEATURE_11AC
1850tSirRetStatus
1851limPopulatePeerRateSet(tpAniSirGlobal pMac,
1852
1853 tpSirSupportedRates pRates,
1854 tANI_U8* pSupportedMCSSet,
1855 tANI_U8 basicOnly,
1856 tpPESession psessionEntry,
1857 tDot11fIEVHTCaps *pVHTCaps)
1858#else
1859tSirRetStatus
1860limPopulatePeerRateSet(tpAniSirGlobal pMac,
1861 tpSirSupportedRates pRates,
1862 tANI_U8* pSupportedMCSSet,
1863 tANI_U8 basicOnly,
1864 tpPESession psessionEntry)
1865#endif
1866{
1867 tSirMacRateSet tempRateSet;
1868 tSirMacRateSet tempRateSet2;
1869 tANI_U32 i,j,val,min,isArate;
1870 isArate = 0;
1871
1872 /* copy operational rate set from psessionEntry */
Praveen Kumar Sirisilla8bdfac42013-10-10 17:20:48 -07001873 if ( psessionEntry->rateSet.numRates <= SIR_MAC_RATESET_EID_MAX )
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001874 {
Kiet Lam842c3e12013-11-16 22:40:57 +05301875 vos_mem_copy((tANI_U8 *)tempRateSet.rate,
1876 (tANI_U8*)(psessionEntry->rateSet.rate),
1877 psessionEntry->rateSet.numRates);
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001878 tempRateSet.numRates = psessionEntry->rateSet.numRates;
1879 }
1880 else
1881 {
1882 limLog(pMac, LOGE, FL("more than SIR_MAC_RATESET_EID_MAX rates\n"));
1883 goto error;
1884 }
Leela Venkata Kiran Kumar Reddy Chirala891bf062013-10-03 14:30:53 -07001885 if ((psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11G) ||
1886 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11A) ||
1887 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11N))
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001888 {
1889
Praveen Kumar Sirisilla8bdfac42013-10-10 17:20:48 -07001890 if (psessionEntry->extRateSet.numRates <= SIR_MAC_RATESET_EID_MAX)
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001891 {
Kiet Lam842c3e12013-11-16 22:40:57 +05301892 vos_mem_copy((tANI_U8 *)tempRateSet2.rate,
1893 (tANI_U8*)(psessionEntry->extRateSet.rate),
1894 psessionEntry->extRateSet.numRates);
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001895 tempRateSet2.numRates = psessionEntry->extRateSet.numRates;
1896 }
1897 else {
1898 limLog(pMac, LOGE, FL("psessionEntry->extRateSet.numRates more than SIR_MAC_RATESET_EID_MAX rates\n"));
1899 goto error;
1900 }
1901 }
1902 else
1903 tempRateSet2.numRates = 0;
Praveen Kumar Sirisilla8bdfac42013-10-10 17:20:48 -07001904 if ((tempRateSet.numRates + tempRateSet2.numRates) > SIR_MAC_RATESET_EID_MAX)
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001905 {
1906 //we are in big trouble
1907 limLog(pMac, LOGP, FL("more than 12 rates in CFG"));
1908 goto error;
1909 }
1910
1911
1912 //copy all rates in tempRateSet, there are 12 rates max
1913 for (i = 0;i < tempRateSet2.numRates; i++)
1914 tempRateSet.rate[i + tempRateSet.numRates] = tempRateSet2.rate[i];
1915 tempRateSet.numRates += tempRateSet2.numRates;
1916 /**
1917 * Sort rates in tempRateSet (they are likely to be already sorted)
1918 * put the result in pSupportedRates
1919 */
1920 {
1921 tANI_U8 aRateIndex = 0;
1922 tANI_U8 bRateIndex = 0;
Kiet Lam842c3e12013-11-16 22:40:57 +05301923 vos_mem_set((tANI_U8 *) pRates, sizeof(tSirSupportedRates), 0);
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001924 for(i = 0;i < tempRateSet.numRates; i++)
1925 {
1926 min = 0;
1927 val = 0xff;
1928 isArate = 0;
1929 for(j = 0; (j < tempRateSet.numRates) && (j < SIR_MAC_RATESET_EID_MAX); j++)
1930 {
1931 if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
1932 {
1933 val = tempRateSet.rate[j] & 0x7f;
1934 min = j;
1935 }
1936 }
1937 if (sirIsArate(tempRateSet.rate[min] & 0x7f))
1938 isArate = 1;
1939 /*
1940 * HAL needs to know whether the rate is basic rate or not, as it needs to
1941 * update the response rate table accordingly. e.g. if one of the 11a rates is
1942 * basic rate, then that rate can be used for sending control frames.
1943 * HAL updates the response rate table whenever basic rate set is changed.
1944 */
1945 if (basicOnly)
1946 {
1947 if (tempRateSet.rate[min] & 0x80)
1948 {
1949 if (isArate)
1950 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1951 else
1952 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1953 }
1954 }
1955 else
1956 {
1957 if (isArate)
1958 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1959 else
1960 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1961 }
1962 tempRateSet.rate[min] = 0xff;
1963 }
1964 }
1965
1966
1967 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode))
1968 {
1969 val = SIZE_OF_SUPPORTED_MCS_SET;
1970 if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
1971 pRates->supportedMCSSet,
1972 &val) != eSIR_SUCCESS)
1973 {
1974 /// Could not get rateset from CFG. Log error.
1975 PELOGE(limLog(pMac, LOGE, FL("could not retrieve supportedMCSSet"));)
1976 goto error;
1977 }
1978 //if supported MCS Set of the peer is passed in, then do the intersection
1979 //else use the MCS set from local CFG.
1980 if(pSupportedMCSSet != NULL)
1981 {
1982 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
1983 pRates->supportedMCSSet[i] &= pSupportedMCSSet[i];
1984 }
1985 PELOG2(limLog(pMac, LOG2, FL("MCS Rate Set Bitmap: "));)
1986 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
Abhishek Singhdcbd8272014-01-09 14:16:01 +05301987 PELOG2(limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);)
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001988 }
1989#ifdef WLAN_FEATURE_11AC
1990 limPopulateVhtMcsSet(pMac, pRates , pVHTCaps,psessionEntry);
1991#endif
1992 return eSIR_SUCCESS;
1993 error:
1994 return eSIR_FAILURE;
1995} /*** limPopulatePeerRateSet() ***/
1996
Jeff Johnson295189b2012-06-20 16:38:30 -07001997/**
1998 * limPopulateMatchingRateSet
1999 * FUNCTION:
2000 * This is called at the time of Association Request
2001 * processing on AP and while adding peer's context
2002 * in IBSS role to process the CFG rate sets and
2003 * the rate sets received in the Assoc request on AP
2004 * or Beacon/Probe Response from peer in IBSS.
2005 *
2006 * LOGIC:
2007 * 1. It makes the intersection between our own rate Sat
2008 * and extemcded rate set and the ones received in the
2009 * association request.
2010 * 2. It creates a combined rate set of 12 rates max which
2011 * comprised the basic and extended rates
2012 * 3. It sorts the combined rate Set and copy it in the
2013 * rate array of the pSTA descriptor
2014 *
2015 * ASSUMPTION:
2016 * The parser has already ensured unicity of the rates in the
2017 * association request structure
2018 *
2019 * @param: pMac - Pointer to Global MAC structure
2020 * pStaDs - Pointer to DPH node
2021 * pOperRateSet - Pointer to peer's supported rateset
2022 * pExtRateSet - Pointer to peer's extended rateset
2023 *
2024 * @return: eSIR_SUCCESS or eSIR_FAILURE
2025 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002026#ifdef WLAN_FEATURE_11AC
2027tSirRetStatus
2028limPopulateMatchingRateSet(tpAniSirGlobal pMac,
2029 tpDphHashNode pStaDs,
2030 tSirMacRateSet *pOperRateSet,
2031 tSirMacRateSet *pExtRateSet,
2032 tANI_U8* pSupportedMCSSet,
2033 tSirMacPropRateSet *pAniLegRateSet,
2034 tpPESession psessionEntry,
2035 tDot11fIEVHTCaps *pVHTCaps)
Jeff Johnson295189b2012-06-20 16:38:30 -07002036
Jeff Johnsone7245742012-09-05 17:12:55 -07002037#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002038tSirRetStatus
2039limPopulateMatchingRateSet(tpAniSirGlobal pMac,
2040 tpDphHashNode pStaDs,
2041 tSirMacRateSet *pOperRateSet,
2042 tSirMacRateSet *pExtRateSet,
2043 tANI_U8* pSupportedMCSSet,
2044 tSirMacPropRateSet *pAniLegRateSet,
2045 tpPESession psessionEntry)
Jeff Johnsone7245742012-09-05 17:12:55 -07002046#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002047{
2048 tSirMacRateSet tempRateSet;
2049 tSirMacRateSet tempRateSet2;
2050 tANI_U32 i,j,val,min,isArate;
2051 tANI_U32 phyMode;
2052 tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET];
2053
2054 isArate=0;
2055
2056 // limGetPhyMode(pMac, &phyMode);
2057 limGetPhyMode(pMac, &phyMode, psessionEntry);
2058
2059 // get own rate set
2060 // val = WNI_CFG_OPERATIONAL_RATE_SET_LEN;
2061 #if 0
2062 if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
2063 (tANI_U8 *) &tempRateSet.rate,
2064 &val) != eSIR_SUCCESS)
2065 {
2066 /// Could not get rateset from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002067 limLog(pMac, LOGP, FL("could not retrieve rateset"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002068 }
2069
2070 #endif // TO SUPPORT BT-AMP
2071
2072 /* copy operational rate set from psessionEntry */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302073 vos_mem_copy((tempRateSet.rate), (psessionEntry->rateSet.rate),
2074 psessionEntry->rateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07002075 tempRateSet.numRates = (tANI_U8) psessionEntry->rateSet.numRates;
2076
2077 if (phyMode == WNI_CFG_PHY_MODE_11G)
2078 {
2079
2080 #if 0
2081 // get own extended rate set
2082 val = WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN;
2083 if (wlan_cfgGetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
2084 (tANI_U8 *) &tempRateSet2.rate,
2085 &val) != eSIR_SUCCESS)
2086 #endif
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302087 vos_mem_copy((tempRateSet2.rate), (psessionEntry->extRateSet.rate),
2088 psessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07002089 tempRateSet2.numRates = (tANI_U8) psessionEntry->extRateSet.numRates;
2090 }
2091 else
2092 tempRateSet2.numRates = 0;
2093
2094 if ((tempRateSet.numRates + tempRateSet2.numRates) > 12)
2095 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002096 PELOGE(limLog(pMac, LOGE, FL("more than 12 rates in CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002097 goto error;
2098 }
2099
2100 /**
2101 * Handling of the rate set IEs is the following:
2102 * - keep only rates that we support and that the station supports
2103 * - sort and the rates into the pSta->rate array
2104 */
2105
2106 // Copy all rates in tempRateSet, there are 12 rates max
2107 for(i = 0; i < tempRateSet2.numRates; i++)
2108 tempRateSet.rate[i + tempRateSet.numRates] =
2109 tempRateSet2.rate[i];
2110
2111 tempRateSet.numRates += tempRateSet2.numRates;
2112
2113 /**
2114 * Sort rates in tempRateSet (they are likely to be already sorted)
2115 * put the result in tempRateSet2
2116 */
2117 tempRateSet2.numRates = 0;
2118
2119 for(i = 0;i < tempRateSet.numRates; i++)
2120 {
2121 min = 0;
2122 val = 0xff;
2123
2124 for(j = 0;j < tempRateSet.numRates; j++)
2125 if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
2126 {
2127 val = tempRateSet.rate[j] & 0x7f;
2128 min = j;
2129 }
2130
2131 tempRateSet2.rate[tempRateSet2.numRates++] =
2132 tempRateSet.rate[min];
2133 tempRateSet.rate[min] = 0xff;
2134 }
2135
2136
2137 /**
2138 * Copy received rates in tempRateSet, the parser has ensured
2139 * unicity of the rates so there cannot be more than 12
2140 */
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002141 for(i = 0; (i < pOperRateSet->numRates && i < SIR_MAC_RATESET_EID_MAX) ; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07002142 {
2143 tempRateSet.rate[i] = pOperRateSet->rate[i];
2144 }
2145
2146 tempRateSet.numRates = pOperRateSet->numRates;
2147
2148 if (pExtRateSet->numRates)
2149 {
2150 if((tempRateSet.numRates + pExtRateSet->numRates) > 12 )
2151 {
2152 limLog( pMac, LOG2,
2153 "Sum of SUPPORTED and EXTENDED Rate Set (%1d) exceeds 12!",
2154 tempRateSet.numRates + pExtRateSet->numRates );
2155
2156 if( tempRateSet.numRates < 12 )
2157 {
2158 int found = 0;
2159 int tail = tempRateSet.numRates;
2160
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002161 for( i = 0; (i < pExtRateSet->numRates && i < SIR_MAC_RATESET_EID_MAX); i++ )
Jeff Johnson295189b2012-06-20 16:38:30 -07002162 {
2163 found = 0;
2164 for( j = 0; j < (tANI_U32) tail; j++ )
2165 {
2166 if((tempRateSet.rate[j] & 0x7F) ==
2167 (pExtRateSet->rate[i] & 0x7F))
2168 {
2169 found = 1;
2170 break;
2171 }
2172 }
2173
2174 if( !found )
2175 {
2176 tempRateSet.rate[tempRateSet.numRates++] =
2177 pExtRateSet->rate[i];
2178
2179 if( tempRateSet.numRates >= 12 )
2180 break;
2181 }
2182 }
2183 }
2184 else
2185 limLog( pMac, LOG2,
2186 "Relying only on the SUPPORTED Rate Set IE..." );
2187 }
2188 else
2189 {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002190 for(j = 0; ((j < pExtRateSet->numRates) && (j < SIR_MAC_RATESET_EID_MAX) && ((i+j) < SIR_MAC_RATESET_EID_MAX)); j++)
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 tempRateSet.rate[i+j] = pExtRateSet->rate[j];
2192
2193 tempRateSet.numRates += pExtRateSet->numRates;
2194 }
2195 }
2196
2197 {
2198 tpSirSupportedRates rates = &pStaDs->supportedRates;
2199 tANI_U8 aRateIndex = 0;
2200 tANI_U8 bRateIndex = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302201 vos_mem_set((tANI_U8 *) rates, sizeof(tSirSupportedRates), 0);
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002202 for(i = 0;(i < tempRateSet2.numRates && i < SIR_MAC_RATESET_EID_MAX ); i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002204 for(j = 0;(j < tempRateSet.numRates && j < SIR_MAC_RATESET_EID_MAX); j++)
Jeff Johnson295189b2012-06-20 16:38:30 -07002205 {
2206 if ((tempRateSet2.rate[i] & 0x7F) ==
2207 (tempRateSet.rate[j] & 0x7F))
2208 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 if (sirIsArate(tempRateSet2.rate[i] & 0x7f))
2210 {
2211 isArate=1;
Kiran Kumar Lokerea328bcd2013-04-22 22:02:05 -07002212 if (aRateIndex < SIR_NUM_11A_RATES)
2213 rates->llaRates[aRateIndex++] = tempRateSet2.rate[i];
Jeff Johnson295189b2012-06-20 16:38:30 -07002214 }
2215 else
Kiran Kumar Lokerea328bcd2013-04-22 22:02:05 -07002216 {
2217 if (bRateIndex < SIR_NUM_11B_RATES)
2218 rates->llbRates[bRateIndex++] = tempRateSet2.rate[i];
2219 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002220 break;
2221 }
2222 }
2223 }
2224
2225
2226 //Now add the Polaris rates only when Proprietary rates are enabled.
2227 val = 0;
2228 if(wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_RATES_ENABLED, &val) != eSIR_SUCCESS)
2229 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002230 limLog(pMac, LOGP, FL("could not retrieve prop rate enabled flag from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 }
2232 else if(val)
2233 {
2234 for(i=0; i<pAniLegRateSet->numPropRates; i++)
2235 rates->aniLegacyRates[i] = pAniLegRateSet->propRate[i];
2236 }
2237
2238 }
2239
2240
2241 //compute the matching MCS rate set, if peer is 11n capable and self mode is 11n
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002242#ifdef FEATURE_WLAN_TDLS
2243 if(pStaDs->mlmStaContext.htCapability)
2244#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002245 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
2246 (pStaDs->mlmStaContext.htCapability))
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002247#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002248 {
2249 val = SIZE_OF_SUPPORTED_MCS_SET;
2250 if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
2251 mcsSet,
2252 &val) != eSIR_SUCCESS)
2253 {
2254 /// Could not get rateset from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002255 limLog(pMac, LOGP, FL("could not retrieve supportedMCSSet"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002256 goto error;
2257 }
2258
2259 for(i=0; i<val; i++)
2260 pStaDs->supportedRates.supportedMCSSet[i] = mcsSet[i] & pSupportedMCSSet[i];
2261
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002262 PELOG2(limLog(pMac, LOG2, FL("limPopulateMatchingRateSet: MCS Rate Set Bitmap from CFG and DPH : "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002263 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
2264 {
2265 PELOG2(limLog(pMac, LOG2,FL("%x %x "), mcsSet[i], pStaDs->supportedRates.supportedMCSSet[i]);)
2266 }
2267 }
2268
Jeff Johnsone7245742012-09-05 17:12:55 -07002269#ifdef WLAN_FEATURE_11AC
2270 limPopulateVhtMcsSet(pMac, &pStaDs->supportedRates, pVHTCaps, psessionEntry);
2271#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 /**
2273 * Set the erpEnabled bit iff the phy is in G mode and at least
2274 * one A rate is supported
2275 */
2276 if ((phyMode == WNI_CFG_PHY_MODE_11G) && isArate)
2277 pStaDs->erpEnabled = eHAL_SET;
2278
2279
2280
2281 return eSIR_SUCCESS;
2282
2283 error:
2284
2285 return eSIR_FAILURE;
2286} /*** limPopulateMatchingRateSet() ***/
2287
2288
2289
2290/**
2291 * limAddSta()
2292 *
2293 *FUNCTION:
2294 * This function is called to add an STA context at hardware
2295 * whenever a STA is (Re) Associated.
2296 *
2297 *LOGIC:
2298 *
2299 *ASSUMPTIONS:
2300 * NA
2301 *
2302 *NOTE:
2303 * NA
2304 *
2305 * @param pMac - Pointer to Global MAC structure
2306 * @param pStaDs - Pointer to the STA datastructure created by
2307 * LIM and maintained by DPH
2308 * @return retCode - Indicates success or failure return code
2309 */
2310
2311tSirRetStatus
2312limAddSta(
2313 tpAniSirGlobal pMac,
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002314 tpDphHashNode pStaDs, tANI_U8 updateEntry, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002315{
2316 tpAddStaParams pAddStaParams = NULL;
2317 tSirMsgQ msgQ;
2318 tSirRetStatus retCode = eSIR_SUCCESS;
2319 tSirMacAddr staMac, *pStaAddr;
2320 tANI_U8 i;
Jeff Johnson295189b2012-06-20 16:38:30 -07002321 tpSirAssocReq pAssocReq;
2322 tANI_U8 *p2pIe = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002323 #if 0
2324 retCode = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg);
2325 if (retCode != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002326 limLog(pMac, LOGP, FL("could not retrieve STA MAC"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002327 #endif //To SUPPORT BT-AMP
2328
2329
2330 sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
2331
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302332 limLog(pMac, LOG1, FL("sessionid: %d updateEntry = %d limsystemrole = %d "),
2333 psessionEntry->smeSessionId, updateEntry, psessionEntry->limSystemRole);
2334
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302335 pAddStaParams = vos_mem_malloc(sizeof(tAddStaParams));
2336 if (NULL == pAddStaParams)
2337 {
2338 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
2339 return eSIR_MEM_ALLOC_FAILED;
2340 }
2341 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002342
2343 if ((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||
2344 (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE) ||
2345 (limGetSystemRole(psessionEntry) == eLIM_BT_AMP_AP_ROLE) )
2346 pStaAddr = &pStaDs->staAddr;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002347#ifdef FEATURE_WLAN_TDLS
2348 /* SystemRole shouldn't be matter if staType is TDLS peer */
2349 else if(STA_ENTRY_TDLS_PEER == pStaDs->staType)
2350 {
2351 pStaAddr = &pStaDs->staAddr ;
2352 }
2353#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002354 else
2355 pStaAddr = &staMac;
2356
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302357 limLog(pMac, LOG1, FL(MAC_ADDRESS_STR": Subtype(Assoc/Reassoc): %d "),
2358 MAC_ADDR_ARRAY(*pStaAddr), pStaDs->mlmStaContext.subType);
2359
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302360 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2361 (tANI_U8 *) *pStaAddr, sizeof(tSirMacAddr));
2362 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
2363 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002364
2365 limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
2366
2367 //Copy legacy rates
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302368 vos_mem_copy ((tANI_U8*)&pAddStaParams->supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -07002369 (tANI_U8*)&pStaDs->supportedRates, sizeof(tSirSupportedRates));
2370
2371 pAddStaParams->assocId = pStaDs->assocId;
2372
2373 pAddStaParams->wmmEnabled = pStaDs->qosMode;
2374 pAddStaParams->listenInterval = pStaDs->mlmStaContext.listenInterval;
2375 pAddStaParams->shortPreambleSupported = pStaDs->shortPreambleEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07002376 if((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) && (pStaDs->mlmStaContext.subType == LIM_REASSOC))
2377 {
2378 /* TBD - need to remove this REASSOC check after fixinf rmmod issue */
2379 pAddStaParams->updateSta = pStaDs->mlmStaContext.updateContext;
2380 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002381 pStaDs->valid = 0;
2382 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
2383
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302384 limLog(pMac, LOG2, FL(" Assoc ID: %d wmmEnabled = %d listenInterval = %d"
2385 " shortPreambleSupported: %d "), pAddStaParams->assocId,
2386 pAddStaParams->wmmEnabled, pAddStaParams->listenInterval,
2387 pAddStaParams->shortPreambleSupported);
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07002388 // This will indicate HAL to "allocate" a new STA index
2389#ifdef FEATURE_WLAN_TDLS
2390 /* As there is corner case in-between add_sta and change_sta,if del_sta for other staIdx happened,
2391 * firmware return wrong staIdx (recently removed staIdx). Until we get a confirmation from the
2392 * firmware team it is now return correct staIdx for same sta_mac_addr for update case, we want
2393 * to get around it by passing valid staIdx given by add_sta time.
2394 */
2395 if((STA_ENTRY_TDLS_PEER == pStaDs->staType) &&
2396 (true == updateEntry))
2397 pAddStaParams->staIdx = pStaDs->staIndex;
2398 else
2399#endif
2400 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
Jeff Johnson295189b2012-06-20 16:38:30 -07002401 pAddStaParams->staType = pStaDs->staType;
2402
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002403 pAddStaParams->updateSta = updateEntry;
2404
Jeff Johnson295189b2012-06-20 16:38:30 -07002405 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2406 pAddStaParams->respReqd = 1;
2407 //Update HT Capability
2408
2409 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 -07002410 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002411 pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability;
Jeff Johnsone7245742012-09-05 17:12:55 -07002412#ifdef WLAN_FEATURE_11AC
2413 pAddStaParams->vhtCapable = pStaDs->mlmStaContext.vhtCapability;
2414#endif
2415 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002416#ifdef FEATURE_WLAN_TDLS
2417 /* SystemRole shouldn't be matter if staType is TDLS peer */
2418 else if(STA_ENTRY_TDLS_PEER == pStaDs->staType)
Hoonki Lee99e53782013-02-12 18:07:03 -08002419 {
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002420 pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability;
Hoonki Lee99e53782013-02-12 18:07:03 -08002421#ifdef WLAN_FEATURE_11AC
2422 pAddStaParams->vhtCapable = pStaDs->mlmStaContext.vhtCapability;
2423#endif
2424 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002425#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002426 else
Jeff Johnsone7245742012-09-05 17:12:55 -07002427 {
2428 pAddStaParams->htCapable = psessionEntry->htCapability;
2429#ifdef WLAN_FEATURE_11AC
2430 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
2431#endif
2432
2433 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302434#ifdef WLAN_FEATURE_11AC
2435 limLog(pMac, LOG2, FL("vhtCapable: %d "),pAddStaParams->vhtCapable);
2436#endif
2437 limLog(pMac, LOG2, FL(" StaIdx: %d updateSta = %d htcapable = %d "),
2438 pAddStaParams->staIdx,pAddStaParams->updateSta,
2439 pAddStaParams->htCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002440
2441 pAddStaParams->greenFieldCapable = pStaDs->htGreenfield;
2442 pAddStaParams->maxAmpduDensity= pStaDs->htAMpduDensity;
2443 pAddStaParams->maxAmpduSize = pStaDs->htMaxRxAMpduFactor;
2444 pAddStaParams->fDsssCckMode40Mhz = pStaDs->htDsssCckRate40MHzSupport;
2445 pAddStaParams->fShortGI20Mhz = pStaDs->htShortGI20Mhz;
2446 pAddStaParams->fShortGI40Mhz = pStaDs->htShortGI40Mhz;
2447 pAddStaParams->lsigTxopProtection = pStaDs->htLsigTXOPProtection;
2448 pAddStaParams->maxAmsduSize = pStaDs->htMaxAmsduLength;
2449 pAddStaParams->txChannelWidthSet = pStaDs->htSupportedChannelWidthSet;
2450 pAddStaParams->mimoPS = pStaDs->htMIMOPSState;
Jeff Johnsone7245742012-09-05 17:12:55 -07002451
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302452 limLog(pMac, LOG2, FL(" greenFieldCapable: %d maxAmpduDensity = %d "
2453 "maxAmpduDensity = %d"), pAddStaParams->greenFieldCapable,
2454 pAddStaParams->maxAmpduDensity, pAddStaParams->maxAmpduSize);
2455
2456 limLog(pMac, LOG2, FL("fDsssCckMode40Mhz: %d fShortGI20Mhz: %d "
2457 "fShortGI40Mhz: %d"), pAddStaParams->fDsssCckMode40Mhz,
2458 pAddStaParams->fShortGI20Mhz, pAddStaParams->fShortGI40Mhz);
2459
2460 limLog(pMac, LOG2, FL("lsigTxopProtection: %d maxAmsduSize: %d "
2461 "txChannelWidthSet: %d mimoPS: %d "), pAddStaParams->lsigTxopProtection,
2462 pAddStaParams->maxAmsduSize,pAddStaParams->txChannelWidthSet,
2463 pAddStaParams->mimoPS);
2464
Jeff Johnsone7245742012-09-05 17:12:55 -07002465#ifdef WLAN_FEATURE_11AC
2466 if(pAddStaParams->vhtCapable)
2467 {
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002468 pAddStaParams->vhtTxChannelWidthSet = pStaDs->vhtSupportedChannelWidthSet;
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08002469 pAddStaParams->vhtTxBFCapable =
Hoonki Lee99e53782013-02-12 18:07:03 -08002470#ifdef FEATURE_WLAN_TDLS
2471 (( STA_ENTRY_PEER == pStaDs->staType ) || (STA_ENTRY_TDLS_PEER == pStaDs->staType)) ?
2472 pStaDs->vhtBeamFormerCapable : psessionEntry->txBFIniFeatureEnabled ;
2473#else
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08002474 ( STA_ENTRY_PEER == pStaDs->staType ) ? pStaDs->vhtBeamFormerCapable :
2475 psessionEntry->txBFIniFeatureEnabled ;
Hoonki Lee99e53782013-02-12 18:07:03 -08002476#endif
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302477 limLog(pMac, LOG2, FL("vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
2478 pAddStaParams->vhtTxChannelWidthSet,pAddStaParams->vhtTxBFCapable);
Jeff Johnsone7245742012-09-05 17:12:55 -07002479 }
2480#endif
2481
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08002482#ifdef FEATURE_WLAN_TDLS
2483 if((STA_ENTRY_PEER == pStaDs->staType) ||
2484 (STA_ENTRY_TDLS_PEER == pStaDs->staType))
2485#else
2486 if (STA_ENTRY_PEER == pStaDs->staType)
2487#endif
2488 {
2489 /* peer STA get the LDPC capability from pStaDs, which populated from
2490 * HT/VHT capability*/
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08002491 if(pAddStaParams->vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP)
2492 {
2493 pAddStaParams->htLdpcCapable = 0;
2494 pAddStaParams->vhtLdpcCapable = 0;
2495 }
2496 else
2497 {
2498 pAddStaParams->htLdpcCapable = pStaDs->htLdpcCapable;
2499 pAddStaParams->vhtLdpcCapable = pStaDs->vhtLdpcCapable;
2500 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08002501 }
2502 else if( STA_ENTRY_SELF == pStaDs->staType)
2503 {
2504 /* For Self STA get the LDPC capability from config.ini*/
2505 pAddStaParams->htLdpcCapable =
2506 (psessionEntry->txLdpcIniFeatureEnabled & 0x01);
2507 pAddStaParams->vhtLdpcCapable =
2508 ((psessionEntry->txLdpcIniFeatureEnabled >> 1)& 0x01);
2509 }
2510
Jeff Johnson295189b2012-06-20 16:38:30 -07002511 /* Update PE session ID*/
2512 pAddStaParams->sessionId = psessionEntry->peSessionId;
2513
2514 if (psessionEntry->parsedAssocReq != NULL)
2515 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002516 // Get a copy of the already parsed Assoc Request
2517 pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
2518 if ( pAssocReq && pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
2519 p2pIe = limGetP2pIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
2520 }
2521 pAddStaParams->p2pCapableSta = (p2pIe != NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002522 }
2523
2524 //Disable BA. It will be set as part of ADDBA negotiation.
2525 for( i = 0; i < STACFG_MAX_TC; i++ )
2526 {
2527 pAddStaParams->staTCParams[i].txUseBA = eBA_DISABLE;
2528 pAddStaParams->staTCParams[i].rxUseBA = eBA_DISABLE;
2529 }
2530
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002531#ifdef FEATURE_WLAN_TDLS
2532 if(pStaDs->wmeEnabled && \
2533 ((eLIM_AP_ROLE == psessionEntry->limSystemRole) || (STA_ENTRY_TDLS_PEER == pStaDs->staType)) )
2534#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002535 if(pStaDs->wmeEnabled && (eLIM_AP_ROLE == psessionEntry->limSystemRole))
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002536#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002537 {
2538 pAddStaParams->uAPSD = 0;
2539 /* update UAPSD and send it to LIM to add STA */
2540 // bitmap MSB <- LSB MSB 4 bits are for
2541 // trigger enabled AC setting and LSB 4 bits
2542 // are for delivery enabled AC setting
2543 // 7 6 5 4 3 2 1 0
2544 // BE BK VI VO BE BK VI VO
2545 pAddStaParams->uAPSD |= pStaDs->qos.capability.qosInfo.acvo_uapsd;
2546 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acvi_uapsd << 1);
2547 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbk_uapsd << 2);
2548 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbe_uapsd << 3);
2549 //making delivery enabled and trigger enabled setting the same.
2550 pAddStaParams->uAPSD |= pAddStaParams->uAPSD << 4;
2551
2552 pAddStaParams->maxSPLen = pStaDs->qos.capability.qosInfo.maxSpLen;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302553 limLog( pMac, LOG1, FL("uAPSD = 0x%x, maxSpLen = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002554 pAddStaParams->uAPSD, pAddStaParams->maxSPLen);
2555 }
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002556
2557#ifdef WLAN_FEATURE_11W
2558 pAddStaParams->rmfEnabled = pStaDs->rmfEnabled;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302559 limLog( pMac, LOG1, FL( "PMF enabled %d"), pAddStaParams->rmfEnabled);
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002560#endif
2561
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302562 limLog(pMac, LOG2, FL("htLdpcCapable: %d vhtLdpcCapable: %d "
2563 "p2pCapableSta: %d"), pAddStaParams->htLdpcCapable,
2564 pAddStaParams->vhtLdpcCapable, pAddStaParams->p2pCapableSta);
2565
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002566 //we need to defer the message until we get the response back from HAL.
Jeff Johnson295189b2012-06-20 16:38:30 -07002567 if (pAddStaParams->respReqd)
2568 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07002569
2570 msgQ.type = WDA_ADD_STA_REQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07002571
2572 msgQ.reserved = 0;
2573 msgQ.bodyptr = pAddStaParams;
2574 msgQ.bodyval = 0;
2575
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002576 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_STA_REQ for assocId %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002577 pStaDs->assocId);
Jeff Johnsone7245742012-09-05 17:12:55 -07002578 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002579
2580 retCode = wdaPostCtrlMsg( pMac, &msgQ );
2581 if( eSIR_SUCCESS != retCode)
2582 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002583 if (pAddStaParams->respReqd)
2584 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002585 limLog( pMac, LOGE, FL("ADD_STA_REQ for aId %d failed (reason %X)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002586 pStaDs->assocId, retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302587 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002588 }
2589
2590 return retCode;
2591}
2592
2593
2594/**
2595 * limDelSta()
2596 *
2597 *FUNCTION:
2598 * This function is called to delete an STA context at hardware
2599 * whenever a STA is disassociated
2600 *
2601 *LOGIC:
2602 *
2603 *ASSUMPTIONS:
2604 * NA
2605 *
2606 *NOTE:
2607 * NA
2608 *
2609 * @param pMac - Pointer to Global MAC structure
2610 * @param pStaDs - Pointer to the STA datastructure created by
2611 * LIM and maintained by DPH
2612 * @param fRespReqd - flag to indicate whether the delete is synchronous (true)
2613 * or not (false)
2614 * @return retCode - Indicates success or failure return code
2615 */
2616
2617tSirRetStatus
2618limDelSta(
2619 tpAniSirGlobal pMac,
2620 tpDphHashNode pStaDs,
2621 tANI_BOOLEAN fRespReqd,
2622 tpPESession psessionEntry)
2623{
2624 tpDeleteStaParams pDelStaParams = NULL;
2625 tSirMsgQ msgQ;
2626 tSirRetStatus retCode = eSIR_SUCCESS;
2627
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302628 pDelStaParams = vos_mem_malloc(sizeof( tDeleteStaParams ));
2629 if (NULL == pDelStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07002630 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302631 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002632 return eSIR_MEM_ALLOC_FAILED;
2633 }
2634
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302635 vos_mem_set((tANI_U8 *) pDelStaParams, sizeof(tDeleteStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002636
2637 //
2638 // DPH contains the STA index only for "peer" STA entries.
2639 // LIM global contains "self" STA index
2640 // Thus,
2641 // if( STA role )
2642 // get STA index from LIM global
2643 // else
2644 // get STA index from DPH
2645 //
2646
2647#if 0
2648 /* Since we have not created any STA, no need to send msg to delete
2649 * STA to HAL */
2650 if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) {
2651 pDelStaParams->staIdx = 1; /* TODO : This is workaround. Need to find right STA Index before sending to HAL */
2652 //return retCode;
2653 }
2654#endif
2655
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002656#ifdef FEATURE_WLAN_TDLS
2657 if( ((eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) && (pStaDs->staType != STA_ENTRY_TDLS_PEER)) ||(eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) )
2658#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002659 if( (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) ||(eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) )
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002660#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002661 pDelStaParams->staIdx= psessionEntry->staId;
2662
2663 else
2664 pDelStaParams->staIdx= pStaDs->staIndex;
2665
2666 pDelStaParams->assocId = pStaDs->assocId;
2667 pStaDs->valid = 0;
2668
2669 if (! fRespReqd)
2670 pDelStaParams->respReqd = 0;
2671 else
2672 {
2673 //when limDelSta is called from processSmeAssocCnf then mlmState is already set properly.
2674 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs))
2675 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002676 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002677 SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs, eLIM_MLM_WT_DEL_STA_RSP_STATE);
2678 }
2679 if ( (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) ||
2680 (eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) )
2681 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002682 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002683
2684 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
2685
2686 }
2687 pDelStaParams->respReqd = 1;
2688 //we need to defer the message until we get the response back from HAL.
2689 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
2690 }
2691
2692 /* Update PE session ID*/
2693 pDelStaParams->sessionId = psessionEntry->peSessionId;
2694
2695 pDelStaParams->status = eHAL_STATUS_SUCCESS;
2696 msgQ.type = WDA_DELETE_STA_REQ;
2697 msgQ.reserved = 0;
2698 msgQ.bodyptr = pDelStaParams;
2699 msgQ.bodyval = 0;
2700
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302701 limLog( pMac, LOG1, FL( "Sessionid %d :Sending SIR_HAL_DELETE_STA_REQ "
2702 "for STAID: %X and AssocID: %d MAC : "MAC_ADDRESS_STR ),
2703 pDelStaParams->sessionId,
2704 pDelStaParams->staIdx, pDelStaParams->assocId,
2705 MAC_ADDR_ARRAY(pStaDs->staAddr));
2706
Jeff Johnsone7245742012-09-05 17:12:55 -07002707 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002708 retCode = wdaPostCtrlMsg( pMac, &msgQ );
2709 if( eSIR_SUCCESS != retCode)
2710 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002711 if(fRespReqd)
2712 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002713 limLog( pMac, LOGE, FL("Posting DELETE_STA_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002714 retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302715 vos_mem_free(pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002716 }
2717
2718 return retCode;
2719}
2720
2721#if defined WLAN_FEATURE_VOWIFI_11R
2722/*------------------------------------------------------------------------
2723 * limAddFTStaSelf()
2724 *
2725 * FUNCTION:
2726 *
2727 * This function is called to add a STA once we have connected with a new
2728 * AP, that we have performed an FT to.
2729 *
2730 * The Add STA Response is created and now after the ADD Bss Is Successful
2731 * we add the self sta. We update with the association id from the reassoc
2732 * response from the AP.
2733 *------------------------------------------------------------------------
2734 */
2735tSirRetStatus limAddFTStaSelf(tpAniSirGlobal pMac, tANI_U16 assocId, tpPESession psessionEntry)
2736{
2737 tpAddStaParams pAddStaParams = NULL;
2738 tSirMsgQ msgQ;
2739 tSirRetStatus retCode = eSIR_SUCCESS;
2740
2741 pAddStaParams = pMac->ft.ftPEContext.pAddStaReq;
2742 pAddStaParams->assocId = assocId;
2743
2744 msgQ.type = SIR_HAL_ADD_STA_REQ;
2745 msgQ.reserved = 0;
2746 msgQ.bodyptr = pAddStaParams;
2747 msgQ.bodyval = 0;
2748
2749
2750#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002751 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002752#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002753 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002754
2755 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002756 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_ADD_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002757 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
2758 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
2759 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002760 limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X"), retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302761 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002762 }
2763 //
2764 // Dont need it any more
2765 pMac->ft.ftPEContext.pAddStaReq = NULL;
2766 return retCode;
2767}
2768
2769#endif /* WLAN_FEATURE_VOWIFI_11R */
2770
2771/**
2772 * limAddStaSelf()
2773 *
2774 *FUNCTION:
2775 * This function is called to add an STA context at hardware
2776 * whenever a STA is (Re) Associated.
2777 *
2778 *LOGIC:
2779 *
2780 *ASSUMPTIONS:
2781 * NA
2782 *
2783 *NOTE:
2784 * NA
2785 *
2786 * @param pMac - Pointer to Global MAC structure
2787 * @param pStaDs - Pointer to the STA datastructure created by
2788 * LIM and maintained by DPH
2789 * @return retCode - Indicates success or failure return code
2790 */
2791
2792tSirRetStatus
2793limAddStaSelf(tpAniSirGlobal pMac,tANI_U16 staIdx, tANI_U8 updateSta, tpPESession psessionEntry)
2794{
2795 tpAddStaParams pAddStaParams = NULL;
2796 tSirMsgQ msgQ;
2797 tSirRetStatus retCode = eSIR_SUCCESS;
2798 tSirMacAddr staMac;
2799 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
krunal soni71343fb2013-09-16 16:16:26 -07002800 tANI_U32 shortGi20MhzSupport;
2801 tANI_U32 shortGi40MhzSupport;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002802 /*This self Sta dot 11 mode comes from the cfg and the expectation here is
2803 * that cfg carries the systemwide capability that device under
2804 * consideration can support. This capability gets plumbed into the cfg
2805 * cache at system initialization time via the .dat and .ini file override
2806 * mechanisms and will not change. If it does change, it is the
2807 * responsibility of SME to evict the selfSta and reissue a new AddStaSelf
2808 * command.*/
2809 tANI_U32 selfStaDot11Mode=0, selfTxWidth=0;
2810 wlan_cfgGetInt(pMac,WNI_CFG_DOT11_MODE,&selfStaDot11Mode);
2811 limLog( pMac, LOG1, FL("cfgDot11Mode %d"),(int)selfStaDot11Mode);
2812 wlan_cfgGetInt(pMac,WNI_CFG_HT_CAP_INFO_SUPPORTED_CHAN_WIDTH_SET,&selfTxWidth);
2813 limLog( pMac, LOG1, FL("SGI 20 %d"),(int)selfTxWidth);
2814 limLog( pMac, LOG1, FL("Roam Channel Bonding Mode %d"),(int)pMac->roam.configParam.uCfgDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002815
2816 #if 0
2817 retCode =wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg);
2818 if (retCode != eSIR_SUCCESS)
2819 {
2820 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002821 limLog(pMac, LOGP, FL("could not retrieve STA MAC"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002822 return retCode;
2823 }
2824 #endif //TO SUPPORT BT-AMP
2825 sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302826 limLog(pMac, LOG1, FL(MAC_ADDRESS_STR": "),MAC_ADDR_ARRAY(staMac));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302827 pAddStaParams = vos_mem_malloc(sizeof(tAddStaParams));
2828 if (NULL == pAddStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07002829 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302830 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002831 return eSIR_MEM_ALLOC_FAILED;
2832 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302833 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002834
2835 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302836 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2837 (tANI_U8 *) staMac, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002838
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302839 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
2840 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002841
2842 pAddStaParams->assocId = psessionEntry->limAID;
2843 pAddStaParams->staType = STA_ENTRY_SELF;
2844 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2845 pAddStaParams->respReqd = 1;
2846
2847 /* Update PE session ID */
2848 pAddStaParams->sessionId = psessionEntry->peSessionId;
2849
2850 // This will indicate HAL to "allocate" a new STA index
2851 pAddStaParams->staIdx = staIdx;
2852 pAddStaParams->updateSta = updateSta;
2853
2854 pAddStaParams->shortPreambleSupported = psessionEntry->beaconParams.fShortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -07002855
Jeff Johnsone7245742012-09-05 17:12:55 -07002856#ifdef WLAN_FEATURE_11AC
2857 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry,NULL);
2858#else
2859 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
2860#endif
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002861// if( psessionEntry->htCapability)---> old check
2862 /*We used to check if the session is htCapable before setting the htCapable
2863 * flag. The check limited us from operating */
2864 if ( IS_DOT11_MODE_HT(selfStaDot11Mode) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002865 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002866 pAddStaParams->htCapable = TRUE ;
Jeff Johnson295189b2012-06-20 16:38:30 -07002867#ifdef DISABLE_GF_FOR_INTEROP
2868 /*
2869 * To resolve the interop problem with Broadcom AP,
2870 * where TQ STA could not pass traffic with GF enabled,
2871 * TQ STA will do Greenfield only with TQ AP, for
2872 * everybody else it will be turned off.
2873 */
2874 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2875 {
2876 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
2877 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
2878 }
2879 else
2880#endif
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002881 {
2882 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
2883 pAddStaParams->txChannelWidthSet =
2884 pMac->roam.configParam.channelBondingMode5GHz;
2885 // pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
2886 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
2887 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
2888 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
2889 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
2890 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
2891 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
2892 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
2893 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
krunal soni71343fb2013-09-16 16:16:26 -07002894 /*
2895 * We will read the gShortGI20Mhz from ini file, and if it is set
2896 * to 1 then we will tell Peer that we support 40Mhz short GI
2897 */
2898 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
2899 (pMac, WNI_CFG_SHORT_GI_20MHZ,
2900 &shortGi20MhzSupport)))
2901 {
2902 if (VOS_TRUE == shortGi20MhzSupport)
2903 {
2904 pAddStaParams->fShortGI20Mhz =
2905 WNI_CFG_SHORT_GI_20MHZ_STAMAX;
2906 //pAddStaParams->fShortGI20Mhz =
2907 //limGetHTCapability(pMac, eHT_SHORT_GI_20MHZ,
2908 // psessionEntry);
2909 }
2910 else
2911 {
2912 pAddStaParams->fShortGI20Mhz = VOS_FALSE;
2913 }
2914 }
2915 else
2916 {
2917 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz"
2918 "CFG,setting value to default"));)
2919 pAddStaParams->fShortGI20Mhz = WNI_CFG_SHORT_GI_20MHZ_STADEF;
2920 }
2921
2922 /*
2923 * We will read the gShortGI40Mhz from ini file, and if it is set
2924 * to 1 then we will tell Peer that we support 40Mhz short GI
2925 */
2926 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
2927 (pMac, WNI_CFG_SHORT_GI_40MHZ,
2928 &shortGi40MhzSupport)))
2929 {
2930 if (VOS_TRUE == shortGi40MhzSupport)
2931 {
2932 pAddStaParams->fShortGI40Mhz =
2933 WNI_CFG_SHORT_GI_40MHZ_STAMAX;
2934 //pAddStaParams->fShortGI40Mhz =
2935 //limGetHTCapability(pMac, eHT_SHORT_GI_40MHZ,
2936 // psessionEntry);
2937 }
2938 else
2939 {
2940 pAddStaParams->fShortGI40Mhz = VOS_FALSE;
2941 }
2942 }
2943 else
2944 {
2945 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz"
2946 "CFG,setting value to default"));)
2947 pAddStaParams->fShortGI40Mhz = WNI_CFG_SHORT_GI_40MHZ_STADEF;
2948 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302949 limLog(pMac, LOG2, FL(" greenFieldCapable: %d maxAmpduDensity = %d "
2950 "maxAmpduSize = %d"), pAddStaParams->greenFieldCapable,
2951 pAddStaParams->maxAmpduDensity, pAddStaParams->maxAmpduSize);
2952
2953 limLog(pMac, LOG2, FL("fDsssCckMode40Mhz: %d fShortGI20Mhz: %d "
2954 "fShortGI40Mhz: %d lsigTxopProtection: %d"),
2955 pAddStaParams->fDsssCckMode40Mhz, pAddStaParams->fShortGI20Mhz,
2956 pAddStaParams->fShortGI40Mhz, pAddStaParams->lsigTxopProtection);
2957
2958 limLog(pMac, LOG2, FL(" maxAmsduSize: %d txChannelWidthSet: %d "
2959 "mimoPS: %d rifsMode %d delBASupport %d"),
2960 pAddStaParams->maxAmsduSize,
2961 pAddStaParams->txChannelWidthSet, pAddStaParams->mimoPS,
2962 pAddStaParams->rifsMode, pAddStaParams->delBASupport );
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002963 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002964 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002965#ifdef WLAN_FEATURE_11AC
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002966 pAddStaParams->vhtCapable = IS_DOT11_MODE_VHT(selfStaDot11Mode);
2967 if (pAddStaParams->vhtCapable){
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07002968 pAddStaParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002969 limLog( pMac, LOG1, FL("VHT WIDTH SET %d"),pAddStaParams->vhtTxChannelWidthSet);
2970 }
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08002971 pAddStaParams->vhtTxBFCapable = psessionEntry->txBFIniFeatureEnabled;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302972 limLog(pMac, LOG2, FL("vhtCapable: %d vhtTxBFCapable %d "),
2973 pAddStaParams->vhtCapable, pAddStaParams->vhtTxBFCapable);
Jeff Johnsone7245742012-09-05 17:12:55 -07002974#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08002975
2976 /* For Self STA get the LDPC capability from session i.e config.ini*/
2977 pAddStaParams->htLdpcCapable =
2978 (psessionEntry->txLdpcIniFeatureEnabled & 0x01);
2979 pAddStaParams->vhtLdpcCapable =
2980 ((psessionEntry->txLdpcIniFeatureEnabled >> 1)& 0x01);
2981
Jeff Johnson295189b2012-06-20 16:38:30 -07002982 if(wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002983 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002984 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
2985
Jeff Johnson295189b2012-06-20 16:38:30 -07002986 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona)
2987 {
2988 pAddStaParams->p2pCapableSta = 1;
2989 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002990
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002991 //limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
2992 pAddStaParams->supportedRates.opRateMode = limGetStaRateMode((tANI_U8)selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002993
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302994 limLog(pMac, LOG2, FL(" StaIdx: %d updateSta = %d htcapable = %d "),
2995 pAddStaParams->staIdx,pAddStaParams->updateSta,
2996 pAddStaParams->htCapable);
2997
2998 limLog(pMac, LOG2, FL("htLdpcCapable: %d vhtLdpcCapable: %d "
2999 "p2pCapableSta: %d"),
3000 pAddStaParams->htLdpcCapable,pAddStaParams->vhtLdpcCapable,
3001 pAddStaParams->p2pCapableSta);
3002
3003 limLog(pMac, LOG2, FL(" sessionid: %d Assoc ID: %d listenInterval = %d"
3004 " shortPreambleSupported: %d "), psessionEntry->smeSessionId,
3005 pAddStaParams->assocId, pAddStaParams->listenInterval,
3006 pAddStaParams->shortPreambleSupported);
3007
Jeff Johnson295189b2012-06-20 16:38:30 -07003008 msgQ.type = WDA_ADD_STA_REQ;
3009 //
3010 // FIXME_GEN4
3011 // A global counter (dialog token) is required to keep track of
3012 // all PE <-> HAL communication(s)
3013 //
3014 msgQ.reserved = 0;
3015 msgQ.bodyptr = pAddStaParams;
3016 msgQ.bodyval = 0;
3017
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303018 limLog( pMac, LOGW, FL(MAC_ADDRESS_STR":Sessionid %d : "
3019 "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ),
3020 MAC_ADDR_ARRAY(pAddStaParams->staMac),
3021 pAddStaParams->sessionId,
3022 pAddStaParams->assocId);
Jeff Johnsone7245742012-09-05 17:12:55 -07003023 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003024
3025 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
3026 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003027 limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X"), retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303028 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003029 }
3030 return retCode;
3031}
3032
3033
3034/**
3035 * limTeardownInfraBSS()
3036 *
3037 *FUNCTION:
3038 * This function is called by various LIM functions to teardown
3039 * an established Infrastructure BSS
3040 *
3041 *LOGIC:
3042 *
3043 *ASSUMPTIONS:
3044 *
3045 *NOTE:
3046 *
3047 * @param pMac - Pointer to Global MAC structure
3048 * @return None
3049 */
3050
3051void
3052limTeardownInfraBss(tpAniSirGlobal pMac,tpPESession psessionEntry)
3053{
3054 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3055
3056 /**
3057 * Send Broadcast Disassociate frame with
3058 * 'leaving BSS' reason.
3059 */
3060 limSendDisassocMgmtFrame(pMac,
3061 eSIR_MAC_DISASSOC_LEAVING_BSS_REASON,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003062 bcAddr,psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003063} /*** end limTeardownInfraBss() ***/
3064
3065
3066/**
3067 * limHandleCnfWaitTimeout()
3068 *
3069 *FUNCTION:
3070 * This function is called by limProcessMessageQueue to handle
3071 * various confirmation failure cases.
3072 *
3073 *LOGIC:
3074 *
3075 *ASSUMPTIONS:
3076 *
3077 *NOTE:
3078 *
3079 * @param pMac - Pointer to Global MAC structure
3080 * @param pStaDs - Pointer to a sta descriptor
3081 * @return None
3082 */
3083
3084void limHandleCnfWaitTimeout(tpAniSirGlobal pMac, tANI_U16 staId)
3085{
3086 tpDphHashNode pStaDs;
3087 tLimSystemRole systemRole;
3088 tpPESession psessionEntry = NULL;
3089
3090 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId))== NULL)
3091 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003092 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003093 return;
3094 }
3095 systemRole = limGetSystemRole(psessionEntry);
3096 pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable);
3097
3098 if (pStaDs == NULL)
3099 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003100 PELOGW(limLog(pMac, LOGW, FL("No STA context in SIR_LIM_CNF_WAIT_TIMEOUT."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003101 return;
3102 }
3103
3104 switch (pStaDs->mlmStaContext.mlmState) {
3105 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003106 PELOGW(limLog(pMac, LOGW, FL("Did not receive Assoc Cnf in eLIM_MLM_WT_ASSOC_CNF_STATE sta Assoc id %d"), pStaDs->assocId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003107 limPrintMacAddr(pMac, pStaDs->staAddr, LOGW);
3108
3109 if ( (systemRole == eLIM_AP_ROLE)|| (systemRole == eLIM_BT_AMP_AP_ROLE) )
3110 {
3111 limRejectAssociation(
3112 pMac,
3113 pStaDs->staAddr,
3114 pStaDs->mlmStaContext.subType,
3115 true,
3116 pStaDs->mlmStaContext.authType,
3117 pStaDs->assocId,
3118 true,
3119 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
3120 psessionEntry);
3121 }
3122 break;
3123
3124 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003125 limLog(pMac, LOGW, FL("Received CNF_WAIT_TIMEOUT in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003126 pStaDs->mlmStaContext.mlmState);
3127 }
3128}
3129
3130
3131/**
3132 * limDeleteDphHashEntry()
3133 *
3134 *FUNCTION:
3135 * This function is called whenever we need to delete
3136 * the dph hash entry
3137 *
3138 *LOGIC:
3139 *
3140 *ASSUMPTIONS:
3141 *
3142 *NOTE:
3143 *
3144 * @param pMac Pointer to Global MAC structure
3145 * @param tANI_U16 staId
3146 * @return None
3147 */
3148
3149void
3150limDeleteDphHashEntry(tpAniSirGlobal pMac, tSirMacAddr staAddr, tANI_U16 staId,tpPESession psessionEntry)
3151{
3152 tANI_U16 aid;
3153 tpDphHashNode pStaDs;
3154 tUpdateBeaconParams beaconParams;
3155 tLimSystemRole systemRole;
3156
Kaushik, Sushantfb156732014-01-07 15:36:03 +05303157 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Jeff Johnson295189b2012-06-20 16:38:30 -07003158 beaconParams.paramChangeBitmap = 0;
3159 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, staId);
3160 if (NULL == psessionEntry)
3161 {
3162 PELOGE(limLog(pMac, LOGE, FL("NULL psessionEntry"));)
3163 return;
3164 }
3165 systemRole = limGetSystemRole(psessionEntry);
3166 beaconParams.bssIdx = psessionEntry->bssIdx;
3167 pStaDs = dphLookupHashEntry(pMac, staAddr, &aid, &psessionEntry->dph.dphHashTable);
3168 if (pStaDs != NULL)
3169 {
3170 PELOGW(limLog(pMac, LOGW, FL("Deleting DPH Hash entry for STAID: %X\n "), staId);)
3171 // update the station count and perform associated actions
3172 // do this before deleting the dph hash entry
3173 limUtilCountStaDel(pMac, pStaDs, psessionEntry);
3174
3175 if((eLIM_AP_ROLE == psessionEntry->limSystemRole) ||
3176 (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole))
3177 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003178 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
3179 if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE){
3180 limDecideApProtectionOnDelete(pMac, pStaDs, &beaconParams,psessionEntry);
3181 }
3182 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003183
3184 if(eLIM_STA_IN_IBSS_ROLE == systemRole)
3185 limIbssDecideProtectionOnDelete(pMac, pStaDs, &beaconParams, psessionEntry);
3186
3187 limDecideShortPreamble(pMac, pStaDs, &beaconParams, psessionEntry);
3188 limDecideShortSlot(pMac, pStaDs, &beaconParams, psessionEntry);
3189
3190 //Send message to HAL about beacon parameter change.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003191 PELOGW(limLog(pMac, LOGW, FL("param bitmap = %d "), beaconParams.paramChangeBitmap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003192 if(beaconParams.paramChangeBitmap)
3193 {
3194 schSetFixedBeaconFields(pMac,psessionEntry);
3195 limSendBeaconParams(pMac, &beaconParams, psessionEntry );
3196 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08003197
3198#ifdef WLAN_FEATURE_11W
3199 tx_timer_delete(&pStaDs->pmfSaQueryTimer);
3200#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003201 }
3202 if (dphDeleteHashEntry(pMac, staAddr, staId, &psessionEntry->dph.dphHashTable) != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003203 limLog(pMac, LOGP, FL("error deleting hash entry"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003204 }
3205}
3206
3207
3208
3209/**
3210 * limCheckAndAnnounceJoinSuccess()
3211 *
3212 *FUNCTION:
3213 * This function is called upon receiving Beacon/Probe Response
3214 * frame in WT_JOIN_BEACON_STATE to check if the received
3215 * Beacon/Probe Response is from the BSS that we're attempting
3216 * to join.
3217 *
3218 *LOGIC:
3219 * If the Beacon/Probe Response is indeed from the BSS we're
3220 * attempting to join, join success is sent to SME.
3221 *
3222 *ASSUMPTIONS:
3223 *
3224 *NOTE:
3225 *
3226 * @param pMac Pointer to Global MAC structure
3227 * @param pBPR Pointer to received Beacon/Probe Response
3228 * @param pHdr Pointer to received Beacon/Probe Response
3229 * MAC header
3230 * @return None
3231 */
3232
3233void
3234limCheckAndAnnounceJoinSuccess(tpAniSirGlobal pMac,
3235 tSirProbeRespBeacon *pBPR,
3236 tpSirMacMgmtHdr pHdr,tpPESession psessionEntry)
3237{
3238 tSirMacSSid currentSSID;
3239 tLimMlmJoinCnf mlmJoinCnf;
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -08003240 tANI_U32 val = 0;
3241 tANI_U32 *noa1DurationFromBcn = NULL;
3242 tANI_U32 *noa2DurationFromBcn = NULL;
3243 tANI_U32 noa;
3244 tANI_U32 TotalNum_NoADesc = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003245
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303246 vos_mem_copy(currentSSID.ssId,
3247 psessionEntry->ssId.ssId,
3248 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003249
3250 currentSSID.length = (tANI_U8)psessionEntry->ssId.length ;
3251
3252 if (
3253 /* Check for SSID only in probe response. Beacons may not carry
3254 SSID information in hidden SSID case */
3255 ( (SIR_MAC_MGMT_FRAME == pHdr->fc.type) &&
3256 (SIR_MAC_MGMT_PROBE_RSP == pHdr->fc.subType) ) &&
3257 currentSSID.length &&
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303258 (!vos_mem_compare((tANI_U8 *) &pBPR->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07003259 (tANI_U8 *) &currentSSID,
3260 (tANI_U8) (1 + currentSSID.length)) ))
3261 {
3262 /**
3263 * Received SSID does not match with the one we've.
3264 * Ignore received Beacon frame
3265 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003266 PELOG1(limLog(pMac, LOG1, FL("SSID received in Beacon does not match"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003267#ifdef WLAN_DEBUG
3268 pMac->lim.gLimBcnSSIDMismatchCnt++;
3269#endif
3270 return;
3271 }
3272
3273 if( (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_STA_ROLE))
3274 {
Nirav Shahbc35fb72013-12-12 18:14:06 +05303275 limLog(pMac, LOG1, FL("Received Beacon/PR with matching BSSID"
3276 MAC_ADDRESS_STR "PESessionID %d"),
3277 MAC_ADDR_ARRAY(psessionEntry->bssId),
3278 psessionEntry->peSessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07003279 // Deactivate Join Failure timer
3280 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003281 // Deactivate Periodic Join timer
3282 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
Jeff Johnson295189b2012-06-20 16:38:30 -07003283
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -08003284 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona &&
3285 pBPR->P2PProbeRes.NoticeOfAbsence.present)
3286 {
3287
3288 noa1DurationFromBcn = (tANI_U32*)(pBPR->P2PProbeRes.NoticeOfAbsence.NoADesc + 1);
3289
3290 if(pBPR->P2PProbeRes.NoticeOfAbsence.num_NoADesc)
3291 TotalNum_NoADesc = pBPR->P2PProbeRes.NoticeOfAbsence.num_NoADesc/SIZE_OF_NOA_DESCRIPTOR;
3292
3293 noa = *noa1DurationFromBcn;
3294
3295 if(TotalNum_NoADesc > 1)
3296 {
3297 noa2DurationFromBcn = (tANI_U32*)(pBPR->P2PProbeRes.NoticeOfAbsence.NoADesc + SIZE_OF_NOA_DESCRIPTOR + 1);
3298 noa += *noa2DurationFromBcn;
3299 }
3300
3301 /*If MAX Noa exceeds 3 secs we will consider only 3 secs to
3302 * avoid arbitary values in noa duration field
3303 */
3304 noa = noa > MAX_NOA_PERIOD_IN_MICROSECS ? MAX_NOA_PERIOD_IN_MICROSECS : noa;
3305 noa = noa/1000; //Convert to ms
3306
3307 if( wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,&val) == eSIR_SUCCESS )
3308 {
3309 psessionEntry->defaultAuthFailureTimeout = val;
3310 ccmCfgSetInt(pMac,WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT ,val + noa, NULL, eANI_BOOLEAN_FALSE);
3311 }
3312 }
3313 else
3314 {
3315 psessionEntry->defaultAuthFailureTimeout = 0;
3316 }
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -08003317
Jeff Johnson295189b2012-06-20 16:38:30 -07003318 // Update Beacon Interval at CFG database
3319
3320 if ( pBPR->HTCaps.present )
3321 limUpdateStaRunTimeHTCapability( pMac, &pBPR->HTCaps );
3322 if ( pBPR->HTInfo.present )
3323 limUpdateStaRunTimeHTInfo( pMac, &pBPR->HTInfo, psessionEntry);
3324 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003325 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003326
Jeff Johnson295189b2012-06-20 16:38:30 -07003327
3328 /**
3329 * Announce join success by sending
3330 * Join confirm to SME.
3331 */
3332 mlmJoinCnf.resultCode = eSIR_SME_SUCCESS;
3333 mlmJoinCnf.protStatusCode = eSIR_MAC_SUCCESS_STATUS;
3334 /* Update PE sessionId*/
3335 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3336 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
3337 } // if ((pMac->lim.gLimSystemRole == IBSS....
3338}
3339
3340/**
3341 * limExtractApCapabilities()
3342 *
3343 *FUNCTION:
3344 * This function is called to extract all of the AP's capabilities
3345 * from the IEs received from it in Beacon/Probe Response frames
3346 *
3347 *LOGIC:
3348 * This routine mimics the limExtractApCapability() API. The difference here
3349 * is that this API returns the entire tSirProbeRespBeacon info as is. It is
3350 * left to the caller of this API to use this info as required
3351 *
3352 *ASSUMPTIONS:
3353 * NA
3354 *
3355 *NOTE:
3356 *
3357 * @param pMac Pointer to Global MAC structure
3358 * @param pIE Pointer to starting IE in Beacon/Probe Response
3359 * @param ieLen Length of all IEs combined
3360 * @param beaconStruct A pointer to tSirProbeRespBeacon that needs to be
3361 * populated
3362 * @return status A status reporting eSIR_SUCCESS or eSIR_FAILURE
3363 */
3364tSirRetStatus limExtractApCapabilities( tpAniSirGlobal pMac,
3365 tANI_U8 *pIE,
3366 tANI_U16 ieLen,
3367 tpSirProbeRespBeacon beaconStruct )
3368{
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303369 vos_mem_set((tANI_U8 *) beaconStruct, sizeof( tSirProbeRespBeacon ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003370
3371 PELOG3(limLog( pMac, LOG3,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003372 FL( "In limExtractApCapabilities: The IE's being received are:" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003373 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG3, pIE, ieLen );)
3374
3375 // Parse the Beacon IE's, Don't try to parse if we dont have anything in IE
3376 if (ieLen > 0) {
3377 if( eSIR_SUCCESS != sirParseBeaconIE( pMac, beaconStruct, pIE, (tANI_U32)ieLen ))
3378 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003379 limLog( pMac, LOGE, FL("APCapExtract: Beacon parsing error!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003380 return eSIR_FAILURE;
3381 }
3382 }
3383
3384 return eSIR_SUCCESS;
3385}
3386
3387
3388/**
3389 * limDelBss()
3390 *
3391 *FUNCTION:
3392 * This function is called to delete BSS context at hardware
3393 * whenever a STA is disassociated
3394 *
3395 *LOGIC:
3396 *
3397 *ASSUMPTIONS:
3398 * NA
3399 *
3400 *NOTE:
3401 * NA
3402 *
3403 * @param pMac - Pointer to Global MAC structure
3404 * @param pStaDs - Pointer to the STA datastructure created by
3405 * LIM and maintained by DPH
3406 * @return retCode - Indicates success or failure return code
3407 */
3408
3409tSirRetStatus
3410limDelBss(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tANI_U16 bssIdx,tpPESession psessionEntry)
3411{
3412 tpDeleteBssParams pDelBssParams = NULL;
3413 tSirMsgQ msgQ;
3414 tSirRetStatus retCode = eSIR_SUCCESS;
3415
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303416 pDelBssParams = vos_mem_malloc(sizeof(tDeleteBssParams));
3417 if (NULL == pDelBssParams)
3418 {
3419 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003420 return eSIR_MEM_ALLOC_FAILED;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303421 }
3422 vos_mem_set((tANI_U8 *) pDelBssParams, sizeof(tDeleteBssParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003423
3424
3425 pDelBssParams->sessionId = psessionEntry->peSessionId; //update PE session Id
3426
3427 //DPH was storing the AssocID in staID field,
3428 //staID is actually assigned by HAL when AddSTA message is sent.
3429 if (pStaDs != NULL)
3430 {
3431 pDelBssParams->bssIdx= pStaDs->bssId;
3432 pStaDs->valid = 0;
3433 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
3434 }
3435 else
3436 pDelBssParams->bssIdx = bssIdx;
3437 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003438 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_BSS_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003439
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07003440 if((psessionEntry->peSessionId == pMac->lim.limTimers.gLimJoinFailureTimer.sessionId) &&
3441 (VOS_TRUE == tx_timer_running(&pMac->lim.limTimers.gLimJoinFailureTimer)))
3442 {
3443 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
3444 }
3445
Jeff Johnson295189b2012-06-20 16:38:30 -07003446 pDelBssParams->status= eHAL_STATUS_SUCCESS;
3447 pDelBssParams->respReqd = 1;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303448
3449 PELOGW(limLog( pMac, LOGW, FL("Sessionid %d : Sending HAL_DELETE_BSS_REQ "
3450 "for bss idx: %X BSSID:"MAC_ADDRESS_STR), pDelBssParams->sessionId,
3451 pDelBssParams->bssIdx,
3452 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003453
3454 //we need to defer the message until we get the response back from HAL.
3455 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
3456
3457 msgQ.type = WDA_DELETE_BSS_REQ;
3458 msgQ.reserved = 0;
3459 msgQ.bodyptr = pDelBssParams;
3460 msgQ.bodyval = 0;
3461
Jeff Johnsone7245742012-09-05 17:12:55 -07003462 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003463
3464 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
3465 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003466 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003467 limLog( pMac, LOGE, FL("Posting DELETE_BSS_REQ to HAL failed, reason=%X"), retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303468 vos_mem_free(pDelBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003469 }
3470
3471 return retCode;
3472}
3473
3474
Jeff Johnson295189b2012-06-20 16:38:30 -07003475
3476/**
3477 * limSendAddBss()
3478 *
3479 *FUNCTION:
3480 *
3481 *LOGIC:
3482 * 1) LIM receives eWNI_SME_JOIN_REQ
3483 * 2) For a valid eWNI_SME_JOIN_REQ, LIM sends
3484 * SIR_HAL_ADD_BSS_REQ to HAL
3485 *
3486 *ASSUMPTIONS:
3487 * JOIN REQ parameters are saved in pMac->lim.gLimMlmJoinReq
3488 * ADD BSS parameters can be obtained from two sources:
3489 * 1) pMac->lim.gLimMlmJoinReq
3490 * 2) beaconStruct, passed as paramter
3491 * So, if a reqd parameter is found in bssDescriptions
3492 * then it is given preference over beaconStruct
3493 *
3494 *NOTE:
3495 *
3496 * @param pMac Pointer to Global MAC structure
3497 * pAssocRsp contains the structured assoc/reassoc Response got from AP
3498 * beaconstruct Has the ProbeRsp/Beacon structured details
3499 * bssDescription bssDescription passed to PE from the SME
3500 * @return None
3501 */
3502
3503tSirRetStatus limStaSendAddBss( tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,
3504 tpSchBeaconStruct pBeaconStruct, tpSirBssDescription bssDescription, tANI_U8 updateEntry,
3505 tpPESession psessionEntry)
3506
3507{
3508 tSirMsgQ msgQ;
3509 tpAddBssParams pAddBssParams = NULL;
3510 tANI_U32 retCode;
3511 tANI_U8 i;
3512 tpDphHashNode pStaDs = NULL;
3513 tANI_U8 chanWidthSupp = 0;
krunal soni71343fb2013-09-16 16:16:26 -07003514 tANI_U32 shortGi20MhzSupport;
3515 tANI_U32 shortGi40MhzSupport;
Jeff Johnson295189b2012-06-20 16:38:30 -07003516 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303517 pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
3518 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003519 {
3520 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303521 FL( "Unable to allocate memory during ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003522 retCode = eSIR_MEM_ALLOC_FAILED;
3523 goto returnFailure;
3524 }
3525 else
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303526 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003527
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303528 vos_mem_copy(pAddBssParams->bssId,bssDescription->bssId,
3529 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003530 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303531 vos_mem_copy(pAddBssParams->selfMacAddr,
3532 psessionEntry->selfMacAddr,
3533 sizeof(tSirMacAddr));
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303534
3535 limLog(pMac, LOG1, FL("sessionid: %d updateEntry = %d limsystemrole = %d "),
3536 psessionEntry->smeSessionId,updateEntry,psessionEntry->limSystemRole);
3537
3538 limLog(pMac, LOG1, FL("BSSID: "MAC_ADDRESS_STR),
3539 MAC_ADDR_ARRAY(pAddBssParams->bssId));
3540
Jeff Johnson295189b2012-06-20 16:38:30 -07003541 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3542 {
3543 pAddBssParams->bssType = eSIR_BTAMP_AP_MODE;
3544 }
3545 else
3546 {
3547 pAddBssParams->bssType = eSIR_INFRASTRUCTURE_MODE;
3548 }
3549
3550 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
3551
3552 /* Update PE session ID */
3553 pAddBssParams->sessionId = psessionEntry->peSessionId;
3554
3555 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
3556
3557 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
3558 pAddBssParams->updateBss = updateEntry;
3559
3560
3561 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
3562 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
3563 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
3564 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
3565
3566 pAddBssParams->rateSet.numRates = pAssocRsp->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303567 vos_mem_copy(pAddBssParams->rateSet.rate,
3568 pAssocRsp->supportedRates.rate, pAssocRsp->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07003569
3570 pAddBssParams->nwType = bssDescription->nwType;
3571
Jeff Johnsone7245742012-09-05 17:12:55 -07003572 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -07003573 pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
3574 pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
3575 pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
3576 pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
3577
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303578 limLog(pMac, LOG2, FL(" BSS Type %d Beacon Interval: %d dtimPeriod: %d "
3579 "cfpCount: %d"),pAddBssParams->bssType, pAddBssParams->beaconInterval,
3580 pAddBssParams->dtimPeriod, pAddBssParams->cfParamSet.cfpCount);
3581
3582 limLog(pMac, LOG2, FL(" cfpPeriod: %d cfpMaxDuration: %d cfpDurRemaining:"
3583 " %d numRates: %d "),pAddBssParams->cfParamSet.cfpPeriod,
3584 pAddBssParams->cfParamSet.cfpMaxDuration,
3585 pAddBssParams->cfParamSet.cfpDurRemaining,
3586 pAddBssParams->rateSet.numRates);
3587
3588 limLog(pMac, LOG2, FL("nwType:%d shortSlotTimeSupported: %d"
3589 "llaCoexist: %d llbCoexist: %d llgCoexist: %d ht20Coexist: %d"),
3590 pAddBssParams->nwType, pAddBssParams->shortSlotTimeSupported,
3591 pAddBssParams->llaCoexist, pAddBssParams->llbCoexist,
3592 pAddBssParams->llgCoexist, pAddBssParams->ht20Coexist);
Jeff Johnson295189b2012-06-20 16:38:30 -07003593
3594 // Use the advertised capabilities from the received beacon/PR
3595
3596
3597 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pAssocRsp->HTCaps.present ))
3598 {
3599 pAddBssParams->htCapable = pAssocRsp->HTCaps.present;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303600 limLog(pMac, LOG2, FL("htCapable: %d"),pAddBssParams->htCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07003601 if ( pBeaconStruct->HTInfo.present )
3602 {
3603 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pAssocRsp->HTInfo.opMode;
3604 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pAssocRsp->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -07003605 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003606 if( (pAssocRsp->HTCaps.supportedChannelWidthSet) &&
3607 (chanWidthSupp) )
3608 {
3609 pAddBssParams->txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
3610 pAddBssParams->currentExtChannel = pAssocRsp->HTInfo.secondaryChannelOffset;
3611 }
3612 else
3613 {
3614 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003615 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003616 }
3617 pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent;
3618 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport;
3619 pAddBssParams->fRIFSMode = pAssocRsp->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303620
3621 limLog(pMac, LOG2, FL("htOperMode: %d dualCTSProtection: %d "
3622 "txChannelWidthSet: %d currentExtChannel: %d "),
3623 pAddBssParams->htOperMode, pAddBssParams->dualCTSProtection,
3624 pAddBssParams->txChannelWidthSet,pAddBssParams->currentExtChannel);
3625
3626 limLog(pMac, LOG2, FL("llnNonGFCoexist: %d "
3627 "fLsigTXOPProtectionFullSupport: %d fRIFSMode %d"),
3628 pAddBssParams->llnNonGFCoexist,
3629 pAddBssParams->fLsigTXOPProtectionFullSupport,
3630 pAddBssParams->fRIFSMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003631 }
3632 }
3633
3634 pAddBssParams->currentOperChannel = bssDescription->channelId;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303635 limLog(pMac, LOG2, FL("currentOperChannel %d"),
3636 pAddBssParams->currentOperChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07003637#ifdef WLAN_FEATURE_11AC
3638 if (psessionEntry->vhtCapability && ( pAssocRsp->VHTCaps.present ))
3639 {
3640 pAddBssParams->vhtCapable = pAssocRsp->VHTCaps.present;
3641 pAddBssParams->vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth;
3642 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003643 pAddBssParams->currentOperChannel,
3644 pAddBssParams->currentExtChannel,
3645 psessionEntry->apCenterChan,
3646 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003647 }
3648 else
3649 {
3650 pAddBssParams->vhtCapable = 0;
3651 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303652 limLog(pMac, LOG2, FL("vhtCapable %d vhtTxChannelWidthSet %d "
3653 "currentExtChannel %d"),pAddBssParams->vhtCapable,
3654 pAddBssParams->vhtTxChannelWidthSet,
3655 pAddBssParams->currentExtChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07003656#endif
3657
3658
Jeff Johnson295189b2012-06-20 16:38:30 -07003659 // Populate the STA-related parameters here
3660 // Note that the STA here refers to the AP
3661 {
3662 /* staType = PEER*/
3663 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
3664
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303665 vos_mem_copy(pAddBssParams->staContext.bssId,
3666 bssDescription->bssId,
3667 sizeof( tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003668 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
3669
3670 /* Fill Assoc id from the dph table */
3671 pStaDs = dphLookupHashEntry(pMac, pAddBssParams->staContext.bssId,
3672 &pAddBssParams->staContext.assocId, &psessionEntry->dph.dphHashTable);
3673 if (pStaDs == NULL)
3674 {
Arif Hussain24bafea2013-11-15 15:10:03 -08003675 PELOGE(limLog(pMac, LOGE, FL("Couldn't get assoc id for "
3676 "MAC ADDR: " MAC_ADDRESS_STR),
3677 MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003678 }
3679 pAddBssParams->staContext.uAPSD = 0;
3680 pAddBssParams->staContext.maxSPLen = 0;
3681 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortPreamble;
3682 pAddBssParams->staContext.updateSta = updateEntry;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303683
3684 limLog(pMac, LOG2, FL("StaContext: "MAC_ADDRESS_STR
3685 " shortPreambleSupported: %d"),
3686 MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac),
3687 pAddBssParams->staContext.shortPreambleSupported);
3688
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003689 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && pBeaconStruct->HTCaps.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003690 {
3691 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
3692 pAddBssParams->staContext.htCapable = 1;
3693 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 )pAssocRsp->HTCaps.greenField;
3694 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 )pAssocRsp->HTCaps.lsigTXOPProtection;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303695 limLog(pMac, LOG2,FL("StaContext htCapable: %d greenFieldCapable: %d "
3696 "lsigTxopProtection: %d"), pAddBssParams->staContext.htCapable,
3697 pAddBssParams->staContext.greenFieldCapable,
3698 pAddBssParams->staContext.lsigTxopProtection);
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003699#ifdef WLAN_FEATURE_11AC
3700 if (psessionEntry->vhtCapability && pBeaconStruct->VHTCaps.present)
3701 {
3702 pAddBssParams->staContext.vhtCapable = 1;
3703 if ((pAssocRsp->VHTCaps.suBeamFormerCap ||
3704 pAssocRsp->VHTCaps.muBeamformerCap) &&
3705 psessionEntry->txBFIniFeatureEnabled)
3706 {
3707 pAddBssParams->staContext.vhtTxBFCapable = 1;
3708 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05303709 if (pAssocRsp->VHTCaps.muBeamformerCap &&
3710 psessionEntry->txMuBformee )
3711 {
3712 pAddBssParams->staContext.vhtTxMUBformeeCapable = 1;
3713 limLog(pMac, LOG1,FL("Enabling MUBformeeCapable for peer"));
3714 /* Dont allow any other MuBf session as concurrency
3715 * is not supported
3716 */
3717 pMac->isMuBfsessionexist = TRUE;
3718 }
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003719 }
3720#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003721 if( (pAssocRsp->HTCaps.supportedChannelWidthSet) &&
3722 (chanWidthSupp) )
3723 {
3724 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07003725#ifdef WLAN_FEATURE_11AC
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003726 if (pAddBssParams->staContext.vhtCapable)
Jeff Johnsone7245742012-09-05 17:12:55 -07003727 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003728 pAddBssParams->staContext.vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth; //pMac->lim.apChanWidth;
3729 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303730 limLog(pMac, LOG2,FL("StaContext vhtCapable %d "
3731 "vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
3732 pAddBssParams->staContext.vhtCapable,
3733 pAddBssParams->staContext.vhtTxChannelWidthSet,
3734 pAddBssParams->staContext.vhtTxBFCapable);
Jeff Johnsone7245742012-09-05 17:12:55 -07003735#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003736 }
3737 else
3738 {
3739 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3740 }
3741 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pAssocRsp->HTCaps.mimoPowerSave;
3742 pAddBssParams->staContext.delBASupport = ( tANI_U8 )pAssocRsp->HTCaps.delayedBA;
3743 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 )pAssocRsp->HTCaps.maximalAMSDUsize;
3744 pAddBssParams->staContext.maxAmpduDensity = pAssocRsp->HTCaps.mpduDensity;
3745 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz;
krunal soni71343fb2013-09-16 16:16:26 -07003746 /*
3747 * We will check gShortGI20Mhz and gShortGI40Mhz from ini file.
3748 * if they are set then we will use what ever Assoc response coming
3749 * from AP supports. If these values are set as 0 in ini file then
3750 * we will hardcode this values to 0.
3751 */
3752 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
3753 (pMac, WNI_CFG_SHORT_GI_20MHZ,
3754 &shortGi20MhzSupport)))
3755 {
3756 if (VOS_TRUE == shortGi20MhzSupport)
3757 {
3758 pAddBssParams->staContext.fShortGI20Mhz =
3759 (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz;
3760 }
3761 else
3762 {
3763 pAddBssParams->staContext.fShortGI20Mhz = VOS_FALSE;
3764 }
3765 }
3766 else
3767 {
3768 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz"
3769 "CFG,setting value to default"));)
3770 pAddBssParams->staContext.fShortGI20Mhz =
3771 WNI_CFG_SHORT_GI_20MHZ_STADEF;
3772 }
3773
3774 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
3775 (pMac, WNI_CFG_SHORT_GI_40MHZ,
3776 &shortGi40MhzSupport)))
3777 {
3778 if (VOS_TRUE == shortGi40MhzSupport)
3779 {
3780 pAddBssParams->staContext.fShortGI40Mhz =
3781 (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz;
3782 }
3783 else
3784 {
3785 pAddBssParams->staContext.fShortGI40Mhz = VOS_FALSE;
3786 }
3787 }
3788 else
3789 {
3790 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz"
3791 "CFG,setting value to default"));)
3792 pAddBssParams->staContext.fShortGI40Mhz =
3793 WNI_CFG_SHORT_GI_40MHZ_STADEF;
3794 }
3795
Jeff Johnson295189b2012-06-20 16:38:30 -07003796 pAddBssParams->staContext.maxAmpduSize= pAssocRsp->HTCaps.maxRxAMPDUFactor;
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08003797 if( pAddBssParams->staContext.vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP )
3798 {
3799 pAddBssParams->staContext.htLdpcCapable = 0;
3800 pAddBssParams->staContext.vhtLdpcCapable = 0;
3801 }
3802 else
3803 {
3804 pAddBssParams->staContext.htLdpcCapable = (tANI_U8)pAssocRsp->HTCaps.advCodingCap;
3805 pAddBssParams->staContext.vhtLdpcCapable = (tANI_U8)pAssocRsp->VHTCaps.ldpcCodingCap;
3806 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08003807
Jeff Johnson295189b2012-06-20 16:38:30 -07003808 if( pBeaconStruct->HTInfo.present )
3809 pAddBssParams->staContext.rifsMode = pAssocRsp->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303810
3811 limLog(pMac, LOG2, FL("StaContext txChannelWidthSet: %d mimoPS: %d"
3812 " delBASupport: %d maxAmsduSize: %d"),
3813 pAddBssParams->staContext.txChannelWidthSet,
3814 pAddBssParams->staContext.mimoPS,
3815 pAddBssParams->staContext.delBASupport,
3816 pAddBssParams->staContext.maxAmsduSize);
3817
3818 limLog(pMac, LOG2, FL("maxAmpduDensity: %d fDsssCckMode40Mhz: %d "
3819 "fShortGI20Mhz: %d "),pAddBssParams->staContext.maxAmpduDensity,
3820 pAddBssParams->staContext.fDsssCckMode40Mhz,
3821 pAddBssParams->staContext.fShortGI20Mhz);
3822
3823 limLog(pMac, LOG2, FL("fShortGI40Mh: %d maxAmpduSize: %d "
3824 "htLdpcCapable: %d vhtLdpcCapable: %d"),
3825 pAddBssParams->staContext.fShortGI40Mhz,
3826 pAddBssParams->staContext.maxAmpduSize,
3827 pAddBssParams->staContext.htLdpcCapable,
3828 pAddBssParams->staContext.vhtLdpcCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07003829 }
3830
Pratik Bhalgatb5b19b02012-11-22 16:28:19 +05303831 //If WMM IE or 802.11E IE is not present and AP is HT AP then enable WMM
3832 if ((psessionEntry->limWmeEnabled && (pAssocRsp->wmeEdcaPresent || pAddBssParams->htCapable)) ||
3833 (psessionEntry->limQosEnabled && (pAssocRsp->edcaPresent || pAddBssParams->htCapable)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003834 pAddBssParams->staContext.wmmEnabled = 1;
3835 else
3836 pAddBssParams->staContext.wmmEnabled = 0;
3837
3838 //Update the rates
3839
3840 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3841 if (pStaDs != NULL)
3842 {
3843 limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303844 vos_mem_copy((tANI_U8*)&pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -07003845 (tANI_U8*)&pStaDs->supportedRates,
3846 sizeof(tSirSupportedRates));
3847 }
3848 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003849 PELOGE(limLog(pMac, LOGE, FL("could not Update the supported rates."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003850
3851 }
3852
3853 //Disable BA. It will be set as part of ADDBA negotiation.
3854 for( i = 0; i < STACFG_MAX_TC; i++ )
3855 {
3856 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
3857 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
3858 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
3859 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
3860 }
3861
3862 pAddBssParams->staContext.encryptType = psessionEntry->encryptType;
3863
3864#if defined WLAN_FEATURE_VOWIFI
3865 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303866 limLog(pMac, LOG2,FL("maxTxPower: %d"),
3867 pAddBssParams->maxTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07003868#endif
3869 // FIXME_GEN4 - Any other value that can be used for initialization?
3870 pAddBssParams->status = eHAL_STATUS_SUCCESS;
3871 pAddBssParams->respReqd = true;
3872
3873 pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
3874
Jeff Johnson295189b2012-06-20 16:38:30 -07003875 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona)
3876 {
3877 pAddBssParams->staContext.p2pCapableSta = 1;
3878 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003879
Bansidhar Gopalacharib099ac62013-06-12 19:02:39 -07003880 pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07003881
3882#if defined WLAN_FEATURE_VOWIFI_11R
3883 pAddBssParams->extSetStaKeyParamValid = 0;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303884 limLog(pMac, LOG2,FL("extSetStaKeyParamValid: %d"),
3885 pAddBssParams->extSetStaKeyParamValid);
Jeff Johnson295189b2012-06-20 16:38:30 -07003886#endif
3887
Chet Lanctot186b5732013-03-18 10:26:30 -07003888#ifdef WLAN_FEATURE_11W
3889 if (psessionEntry->limRmfEnabled)
3890 {
3891 pAddBssParams->rmfEnabled = 1;
3892 pAddBssParams->staContext.rmfEnabled = 1;
3893 }
3894#endif
3895
Jeff Johnson295189b2012-06-20 16:38:30 -07003896 // Set a new state for MLME
3897 if( eLIM_MLM_WT_ASSOC_RSP_STATE == psessionEntry->limMlmState )
3898 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE;
3899 else
3900 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003901 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003902
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303903 limLog(pMac, LOG2, FL("staContext wmmEnabled: %d encryptType: %d "
3904 "p2pCapableSta: %d"),pAddBssParams->staContext.wmmEnabled,
3905 pAddBssParams->staContext.encryptType,
3906 pAddBssParams->staContext.p2pCapableSta);
3907
3908 limLog(pMac, LOG2, FL("bSpectrumMgtEnabled: %d halPersona: %d setting "
3909 "LimMlm state to %d"), pAddBssParams->bSpectrumMgtEnabled,
3910 pAddBssParams->halPersona, psessionEntry->limMlmState);
3911
Jeff Johnson295189b2012-06-20 16:38:30 -07003912 //we need to defer the message until we get the response back from HAL.
3913 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
3914
3915 msgQ.type = WDA_ADD_BSS_REQ;
3916 /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
3917 msgQ.reserved = 0;
3918 msgQ.bodyptr = pAddBssParams;
3919 msgQ.bodyval = 0;
3920
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303921 limLog( pMac, LOG1, FL("SessionId:%d Sending SIR_HAL_ADD_BSS_REQ" ),
3922 psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -07003923 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003924
3925 retCode = wdaPostCtrlMsg( pMac, &msgQ );
3926 if( eSIR_SUCCESS != retCode)
3927 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003928 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303929 vos_mem_free(pAddBssParams);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003930 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003931 retCode );
3932 goto returnFailure;
3933
3934 }
3935 else
3936 return retCode;
3937
3938 returnFailure:
3939 // Clean-up will be done by the caller...
3940 return retCode;
3941}
3942
3943
3944
3945
3946tSirRetStatus limStaSendAddBssPreAssoc( tpAniSirGlobal pMac, tANI_U8 updateEntry, tpPESession psessionEntry)
3947{
3948 tSirMsgQ msgQ;
3949 tpAddBssParams pAddBssParams = NULL;
3950 tANI_U32 retCode;
3951 tANI_U8 i;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003952 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -07003953 tANI_U8 chanWidthSupp = 0;
krunal soni71343fb2013-09-16 16:16:26 -07003954 tANI_U32 shortGi20MhzSupport;
3955 tANI_U32 shortGi40MhzSupport;
Jeff Johnson295189b2012-06-20 16:38:30 -07003956 tpSirBssDescription bssDescription = &psessionEntry->pLimJoinReq->bssDescription;
3957
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303958 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
3959 if (NULL == pBeaconStruct)
Jeff Johnson32d95a32012-09-10 13:15:23 -07003960 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303961 limLog(pMac, LOGE, FL("Unable to allocate memory during ADD_BSS") );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003962 return eSIR_MEM_ALLOC_FAILED;
3963 }
3964
Jeff Johnson295189b2012-06-20 16:38:30 -07003965
3966 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303967 pAddBssParams = vos_mem_malloc(sizeof(tAddBssParams));
3968 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003969 {
3970 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303971 FL( "Unable to allocate memory during ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003972 retCode = eSIR_MEM_ALLOC_FAILED;
3973 goto returnFailure;
3974 }
3975
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303976 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003977
3978
3979 limExtractApCapabilities( pMac,
3980 (tANI_U8 *) bssDescription->ieFields,
3981 limGetIElenFromBssDescription( bssDescription ),
Jeff Johnson32d95a32012-09-10 13:15:23 -07003982 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07003983
3984 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Jeff Johnson32d95a32012-09-10 13:15:23 -07003985 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303986 vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
3987 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003988
3989 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303990 vos_mem_copy(pAddBssParams->selfMacAddr,
3991 psessionEntry->selfMacAddr,
3992 sizeof(tSirMacAddr));
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303993 limLog(pMac, LOG1, FL("sessionid: %d updateEntry = %d limsystemrole = %d "),
3994 psessionEntry->smeSessionId,updateEntry,psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003995
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303996 limLog(pMac, LOG1, FL("BSSID: "MAC_ADDRESS_STR),
3997 MAC_ADDR_ARRAY(pAddBssParams->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07003998 /* Incorrect BSS Type which caused UMA Descriptor to be overwritten on
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303999 * top of an already established Infra link. This lead to issues in
Jeff Johnson295189b2012-06-20 16:38:30 -07004000 * concurrent data transfer.
4001 */
4002
4003 pAddBssParams->bssType = psessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
4004 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
4005
4006 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
4007
Jeff Johnson32d95a32012-09-10 13:15:23 -07004008 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07004009 pAddBssParams->updateBss = updateEntry;
4010
4011
Jeff Johnson32d95a32012-09-10 13:15:23 -07004012 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
4013 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
4014 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
4015 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -07004016
4017
Jeff Johnson32d95a32012-09-10 13:15:23 -07004018 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304019 vos_mem_copy(pAddBssParams->rateSet.rate,
4020 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07004021
4022 pAddBssParams->nwType = bssDescription->nwType;
4023
Jeff Johnson32d95a32012-09-10 13:15:23 -07004024 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -07004025 pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
4026 pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
4027 pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304028 pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
Jeff Johnson295189b2012-06-20 16:38:30 -07004029
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304030 limLog(pMac, LOG2, FL(" BSS Type %d Beacon Interval: %d dtimPeriod: %d "
4031 "cfpCount: %d"),pAddBssParams->bssType, pAddBssParams->beaconInterval,
4032 pAddBssParams->dtimPeriod, pAddBssParams->cfParamSet.cfpCount);
4033
4034 limLog(pMac, LOG2, FL(" cfpPeriod: %d cfpMaxDuration: %d cfpDurRemaining:"
4035 " %d numRates: %d "),pAddBssParams->cfParamSet.cfpPeriod,
4036 pAddBssParams->cfParamSet.cfpMaxDuration,
4037 pAddBssParams->cfParamSet.cfpDurRemaining,
4038 pAddBssParams->rateSet.numRates);
4039
4040 limLog(pMac, LOG2, FL("nwType:%d shortSlotTimeSupported: %d"
4041 "llaCoexist: %d llbCoexist: %d llgCoexist: %d ht20Coexist: %d"),
4042 pAddBssParams->nwType, pAddBssParams->shortSlotTimeSupported,
4043 pAddBssParams->llaCoexist, pAddBssParams->llbCoexist,
4044 pAddBssParams->llgCoexist, pAddBssParams->ht20Coexist);
Jeff Johnson295189b2012-06-20 16:38:30 -07004045 // Use the advertised capabilities from the received beacon/PR
Jeff Johnson32d95a32012-09-10 13:15:23 -07004046 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -07004047 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004048 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304049 limLog(pMac, LOG2, FL("htCapable: %d"),pAddBssParams->htCapable);
Jeff Johnson32d95a32012-09-10 13:15:23 -07004050 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07004051 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004052 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
4053 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -07004054
Jeff Johnson295189b2012-06-20 16:38:30 -07004055 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
Jeff Johnson32d95a32012-09-10 13:15:23 -07004056 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07004057 (chanWidthSupp) )
4058 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004059 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
4060 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07004061 }
4062 else
4063 {
4064 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004065 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07004066 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07004067 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
4068 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
4069 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304070
4071 limLog(pMac, LOG2, FL("htOperMode: %d dualCTSProtection: %d "
4072 "txChannelWidthSet: %d currentExtChannel: %d "),
4073 pAddBssParams->htOperMode, pAddBssParams->dualCTSProtection,
4074 pAddBssParams->txChannelWidthSet,pAddBssParams->currentExtChannel);
4075
4076 limLog(pMac, LOG2, FL("llnNonGFCoexist: %d "
4077 "fLsigTXOPProtectionFullSupport: %d fRIFSMode %d"),
4078 pAddBssParams->llnNonGFCoexist,
4079 pAddBssParams->fLsigTXOPProtectionFullSupport,
4080 pAddBssParams->fRIFSMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07004081 }
4082 }
4083
4084 pAddBssParams->currentOperChannel = bssDescription->channelId;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304085 limLog(pMac, LOG2, FL("currentOperChannel %d"),
4086 pAddBssParams->currentOperChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07004087#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07004088 if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present ))
Jeff Johnsone7245742012-09-05 17:12:55 -07004089 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004090 pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
4091 pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004092 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
4093 pAddBssParams->currentOperChannel,
4094 pAddBssParams->currentExtChannel,
4095 psessionEntry->apCenterChan,
4096 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07004097 }
4098 else
4099 {
4100 pAddBssParams->vhtCapable = 0;
4101 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304102 limLog(pMac, LOG2, FL("vhtCapable %d vhtTxChannelWidthSet %d "
4103 "currentExtChannel %d"),pAddBssParams->vhtCapable,
4104 pAddBssParams->vhtTxChannelWidthSet,
4105 pAddBssParams->currentExtChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07004106#endif
4107
Jeff Johnson295189b2012-06-20 16:38:30 -07004108 // Populate the STA-related parameters here
4109 // Note that the STA here refers to the AP
4110 {
4111 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
4112
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304113 vos_mem_copy(pAddBssParams->staContext.bssId,
4114 bssDescription->bssId,
4115 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004116 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
4117
4118 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
4119 pAddBssParams->staContext.uAPSD = 0;
4120 pAddBssParams->staContext.maxSPLen = 0;
Jeff Johnson32d95a32012-09-10 13:15:23 -07004121 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -07004122 pAddBssParams->staContext.updateSta = updateEntry;
4123
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304124 limLog(pMac, LOG2, FL("StaContext: "MAC_ADDRESS_STR
4125 " shortPreambleSupported: %d"),
4126 MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac),
4127 pAddBssParams->staContext.shortPreambleSupported);
4128
Jeff Johnson32d95a32012-09-10 13:15:23 -07004129 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -07004130 {
4131 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
4132 pAddBssParams->staContext.htCapable = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07004133 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
4134 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304135 limLog(pMac, LOG2, FL("StaContext htCapable: %d "
4136 "greenFieldCapable: %d lsigTxopProtection: %d"),
4137 pAddBssParams->staContext.htCapable,
4138 pAddBssParams->staContext.greenFieldCapable,
4139 pAddBssParams->staContext.lsigTxopProtection);
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004140#ifdef WLAN_FEATURE_11AC
4141 if (psessionEntry->vhtCapability && pBeaconStruct->VHTCaps.present)
4142 {
4143 pAddBssParams->staContext.vhtCapable = 1;
4144 if ((pBeaconStruct->VHTCaps.suBeamFormerCap ||
4145 pBeaconStruct->VHTCaps.muBeamformerCap) &&
4146 psessionEntry->txBFIniFeatureEnabled )
4147 {
4148 pAddBssParams->staContext.vhtTxBFCapable = 1;
4149 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05304150 if (pBeaconStruct->VHTCaps.muBeamformerCap &&
4151 psessionEntry->txMuBformee )
4152 {
4153 pAddBssParams->staContext.vhtTxMUBformeeCapable = 1;
4154 limLog(pMac, LOG1,FL("Enabling MUBformeeCapable for peer"));
4155 /* Dont allow any other MuBf session as concurrency
4156 * is not supported
4157 */
4158 pMac->isMuBfsessionexist = TRUE;
4159 }
4160
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004161 }
4162#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07004163 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07004164 (chanWidthSupp) )
4165 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004166 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004167#ifdef WLAN_FEATURE_11AC
4168 if (pAddBssParams->staContext.vhtCapable)
Jeff Johnsone7245742012-09-05 17:12:55 -07004169 {
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004170 pAddBssParams->staContext.vhtTxChannelWidthSet =
4171 pBeaconStruct->VHTOperation.chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -07004172 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304173 limLog(pMac, LOG2,FL("StaContext vhtCapable %d "
4174 "vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
4175 pAddBssParams->staContext.vhtCapable,
4176 pAddBssParams->staContext.vhtTxChannelWidthSet,
4177 pAddBssParams->staContext.vhtTxBFCapable);
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004178#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004179 }
4180 else
4181 {
4182 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4183 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07004184 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
4185 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
4186 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
4187 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
4188 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
krunal soni71343fb2013-09-16 16:16:26 -07004189 /*
4190 * We will check gShortGI20Mhz and gShortGI40Mhz from ini file.
4191 * if they are set then we will use what ever Beacon coming from AP
4192 * supports. If these values are set as 0 in ini file then
4193 * we will hardcode this values to 0.
4194 */
4195 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
4196 (pMac, WNI_CFG_SHORT_GI_20MHZ,
4197 &shortGi20MhzSupport)))
4198 {
4199 if (VOS_TRUE == shortGi20MhzSupport)
4200 {
4201 pAddBssParams->staContext.fShortGI20Mhz =
4202 (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
4203 }
4204 else
4205 {
4206 pAddBssParams->staContext.fShortGI20Mhz = VOS_FALSE;
4207 }
4208 }
4209 else
4210 {
4211 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz"
4212 "CFG,setting value to default"));)
4213 pAddBssParams->staContext.fShortGI20Mhz =
4214 WNI_CFG_SHORT_GI_20MHZ_STADEF;
4215 }
4216
4217 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
4218 (pMac, WNI_CFG_SHORT_GI_40MHZ,
4219 &shortGi40MhzSupport)))
4220 {
4221 if (VOS_TRUE == shortGi40MhzSupport)
4222 {
4223 pAddBssParams->staContext.fShortGI40Mhz =
4224 (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
4225 }
4226 else
4227 {
4228 pAddBssParams->staContext.fShortGI40Mhz = VOS_FALSE;
4229 }
4230 }
4231 else
4232 {
4233 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz"
4234 "CFG,setting value to default"));)
4235 pAddBssParams->staContext.fShortGI40Mhz =
4236 WNI_CFG_SHORT_GI_40MHZ_STADEF;
4237 }
4238
Jeff Johnson32d95a32012-09-10 13:15:23 -07004239 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08004240 if( pAddBssParams->staContext.vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP )
4241 {
4242 pAddBssParams->staContext.htLdpcCapable = 0;
4243 pAddBssParams->staContext.vhtLdpcCapable = 0;
4244 }
4245 else
4246 {
4247 pAddBssParams->staContext.htLdpcCapable = (tANI_U8)pBeaconStruct->HTCaps.advCodingCap;
4248 pAddBssParams->staContext.vhtLdpcCapable = (tANI_U8)pBeaconStruct->VHTCaps.ldpcCodingCap;
4249 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004250
Jeff Johnson32d95a32012-09-10 13:15:23 -07004251 if( pBeaconStruct->HTInfo.present )
4252 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304253 limLog(pMac, LOG2, FL("StaContext txChannelWidthSet: %d mimoPS: %d"
4254 " delBASupport: %d maxAmsduSize: %d"),
4255 pAddBssParams->staContext.txChannelWidthSet,
4256 pAddBssParams->staContext.mimoPS,
4257 pAddBssParams->staContext.delBASupport,
4258 pAddBssParams->staContext.maxAmsduSize);
4259
4260 limLog(pMac, LOG2, FL("maxAmpduDensity: %d fDsssCckMode40Mhz: %d "
4261 "fShortGI20Mhz: %d "),pAddBssParams->staContext.maxAmpduDensity,
4262 pAddBssParams->staContext.fDsssCckMode40Mhz,
4263 pAddBssParams->staContext.fShortGI20Mhz);
4264
4265 limLog(pMac, LOG2, FL("fShortGI40Mh: %d maxAmpduSize: %d "
4266 "htLdpcCapable: %d vhtLdpcCapable: %d"),
4267 pAddBssParams->staContext.fShortGI40Mhz,
4268 pAddBssParams->staContext.maxAmpduSize,
4269 pAddBssParams->staContext.htLdpcCapable,
4270 pAddBssParams->staContext.vhtLdpcCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07004271 }
4272
Pratik Bhalgatb5b19b02012-11-22 16:28:19 +05304273 //If WMM IE or 802.11E IE is not present and AP is HT AP then enable WMM
4274 if ((psessionEntry->limWmeEnabled && (pBeaconStruct->wmeEdcaPresent || pAddBssParams->staContext.htCapable)) ||
4275 (psessionEntry->limQosEnabled && (pBeaconStruct->edcaPresent || pAddBssParams->staContext.htCapable)))
Jeff Johnson295189b2012-06-20 16:38:30 -07004276 pAddBssParams->staContext.wmmEnabled = 1;
4277 else
4278 pAddBssParams->staContext.wmmEnabled = 0;
4279
4280 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -07004281#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07004282 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson32d95a32012-09-10 13:15:23 -07004283 pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry,
4284 &pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -07004285#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07004286 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson32d95a32012-09-10 13:15:23 -07004287 pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07004288#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004289 limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,psessionEntry);
4290
4291 }
4292
4293
4294 //Disable BA. It will be set as part of ADDBA negotiation.
4295 for( i = 0; i < STACFG_MAX_TC; i++ )
4296 {
4297 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
4298 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
4299 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
4300 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
4301 }
4302
4303 pAddBssParams->staContext.encryptType = psessionEntry->encryptType;
4304
4305#if defined WLAN_FEATURE_VOWIFI
4306 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304307 limLog(pMac, LOG2,FL("maxTxPower: %d"),
4308 pAddBssParams->maxTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07004309#endif
4310
4311 pAddBssParams->status = eHAL_STATUS_SUCCESS;
4312 pAddBssParams->respReqd = true;
4313
4314 pAddBssParams->staContext.sessionId = psessionEntry->peSessionId;
4315 pAddBssParams->sessionId = psessionEntry->peSessionId;
4316
4317 pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
4318
Bansidhar Gopalacharib099ac62013-06-12 19:02:39 -07004319 pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07004320
4321#if defined WLAN_FEATURE_VOWIFI_11R
4322 pAddBssParams->extSetStaKeyParamValid = 0;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304323 limLog(pMac, LOG2,FL("extSetStaKeyParamValid: %d"),
4324 pAddBssParams->extSetStaKeyParamValid);
Jeff Johnson295189b2012-06-20 16:38:30 -07004325#endif
4326
Chet Lanctot186b5732013-03-18 10:26:30 -07004327#ifdef WLAN_FEATURE_11W
4328 if (psessionEntry->limRmfEnabled)
4329 {
4330 pAddBssParams->rmfEnabled = 1;
4331 pAddBssParams->staContext.rmfEnabled = 1;
4332 }
4333#endif
4334
Jeff Johnson295189b2012-06-20 16:38:30 -07004335 // Set a new state for MLME
4336
4337 //pMac->lim.gLimMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
4338 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
4339
Jeff Johnsone7245742012-09-05 17:12:55 -07004340 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004341
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304342 limLog(pMac, LOG2, FL("staContext wmmEnabled: %d encryptType: %d "
4343 "p2pCapableSta: %d"),pAddBssParams->staContext.wmmEnabled,
4344 pAddBssParams->staContext.encryptType,
4345 pAddBssParams->staContext.p2pCapableSta);
4346
4347 limLog(pMac, LOG2, FL("bSpectrumMgtEnabled: %d halPersona: %d setting "
4348 "LimMlm state to %d"), pAddBssParams->bSpectrumMgtEnabled,
4349 pAddBssParams->halPersona, psessionEntry->limMlmState);
4350
Jeff Johnson295189b2012-06-20 16:38:30 -07004351 //we need to defer the message until we get the response back from HAL.
4352 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
4353
4354 msgQ.type = WDA_ADD_BSS_REQ;
4355 /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
4356 msgQ.reserved = 0;
4357 msgQ.bodyptr = pAddBssParams;
4358 msgQ.bodyval = 0;
4359
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05304360 limLog( pMac, LOG1, FL( "SessionId:%d Sending SIR_HAL_ADD_BSS_REQ" ),
4361 psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -07004362 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004363
4364 retCode = wdaPostCtrlMsg( pMac, &msgQ );
4365 if( eSIR_SUCCESS != retCode)
4366 {
Jeff Johnsone7245742012-09-05 17:12:55 -07004367 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304368 vos_mem_free(pAddBssParams);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004369 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004370 retCode );
4371 goto returnFailure;
4372
4373 }
4374 else
Jeff Johnson32d95a32012-09-10 13:15:23 -07004375 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304376 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004377 return retCode;
Jeff Johnson32d95a32012-09-10 13:15:23 -07004378 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004379
4380 returnFailure:
4381 // Clean-up will be done by the caller...
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304382 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004383 return retCode;
4384}
4385
4386
4387
4388
4389
Jeff Johnson295189b2012-06-20 16:38:30 -07004390
4391/** -------------------------------------------------------------
4392\fn limPrepareAndSendDelStaCnf
4393\brief deletes DPH entry
4394 changes the MLM mode for station.
4395 calls limSendDelStaCnf
4396\param tpAniSirGlobal pMac
4397\param tpDphHashNode pStaDs
4398\return none
4399 -------------------------------------------------------------*/
4400
4401
4402void
4403limPrepareAndSendDelStaCnf(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tSirResultCodes statusCode,tpPESession psessionEntry)
4404{
4405 tANI_U16 staDsAssocId = 0;
4406 tSirMacAddr staDsAddr;
4407 tLimMlmStaContext mlmStaContext;
4408
4409 if(pStaDs == NULL)
4410 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004411 PELOGW(limLog(pMac, LOGW, FL("pStaDs is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004412 return;
4413 }
4414 staDsAssocId = pStaDs->assocId;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304415 vos_mem_copy((tANI_U8 *)staDsAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07004416 pStaDs->staAddr,
4417 sizeof(tSirMacAddr));
4418
4419 mlmStaContext = pStaDs->mlmStaContext;
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304420 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
4421 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004422 {
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304423 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004424 }
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304425 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4426
4427 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4428 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004429 {
4430 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304431 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE,
4432 psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004433 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004434 limSendDelStaCnf(pMac, staDsAddr, staDsAssocId, mlmStaContext, statusCode,psessionEntry);
4435}
4436
4437/** -------------------------------------------------------------
4438\fn limGetStaRateMode
4439\brief Gets the Station Rate Mode.
4440\param tANI_U8 dot11Mode
4441\return none
4442 -------------------------------------------------------------*/
4443tStaRateMode limGetStaRateMode(tANI_U8 dot11Mode)
4444{
4445 switch(dot11Mode)
4446 {
4447 case WNI_CFG_DOT11_MODE_11A:
4448 return eSTA_11a;
4449 case WNI_CFG_DOT11_MODE_11B:
4450 return eSTA_11b;
4451 case WNI_CFG_DOT11_MODE_11G:
4452 return eSTA_11bg;
4453 case WNI_CFG_DOT11_MODE_11N:
4454 return eSTA_11n;
Jeff Johnsone7245742012-09-05 17:12:55 -07004455#ifdef WLAN_FEATURE_11AC
4456 case WNI_CFG_DOT11_MODE_11AC:
4457 return eSTA_11ac;
4458#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004459 case WNI_CFG_DOT11_MODE_ALL:
4460 default:
4461 return eSTA_11n;
4462
4463 }
4464}
4465
4466/** -------------------------------------------------------------
4467\fn limInitPreAuthTimerTable
4468\brief Initialize the Pre Auth Tanle and creates the timer for
4469 each node for the timeout value got from cfg.
4470\param tpAniSirGlobal pMac
4471\param tpLimPreAuthTable pPreAuthTimerTable
4472\return none
4473 -------------------------------------------------------------*/
4474void limInitPreAuthTimerTable(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable)
4475{
4476 tANI_U32 cfgValue;
4477 tANI_U32 authNodeIdx;
4478 tpLimPreAuthNode pAuthNode = pPreAuthTimerTable->pTable;
4479
4480 // Get AUTH_RSP Timers value
4481
4482 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT,
4483 &cfgValue) != eSIR_SUCCESS)
4484 {
4485 /*
4486 ** Could not get AUTH_RSP timeout value
4487 ** from CFG. Log error.
4488 **/
4489 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004490 FL("could not retrieve AUTH_RSP timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004491 return;
4492 }
4493
4494 cfgValue = SYS_MS_TO_TICKS(cfgValue);
4495 for(authNodeIdx=0; authNodeIdx<pPreAuthTimerTable->numEntry; authNodeIdx++, pAuthNode++)
4496 {
4497 if (tx_timer_create(&pAuthNode->timer,
4498 "AUTH RESPONSE TIMEOUT",
4499 limAuthResponseTimerHandler,
4500 authNodeIdx,
4501 cfgValue,
4502 0,
4503 TX_NO_ACTIVATE) != TX_SUCCESS)
4504 {
4505 // Cannot create timer. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004506 limLog(pMac, LOGP, FL("Cannot create Auth Rsp timer of Index :%d."), authNodeIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07004507 return;
4508 }
4509 pAuthNode->authNodeIdx = (tANI_U8)authNodeIdx;
4510 pAuthNode->fFree = 1;
4511 }
4512
4513}
4514
4515/** -------------------------------------------------------------
4516\fn limAcquireFreePreAuthNode
4517\brief Retrives a free Pre Auth node from Pre Auth Table.
4518\param tpAniSirGlobal pMac
4519\param tpLimPreAuthTable pPreAuthTimerTable
4520\return none
4521 -------------------------------------------------------------*/
4522tLimPreAuthNode * limAcquireFreePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable)
4523{
4524 tANI_U32 i;
4525 tLimPreAuthNode *pTempNode = pPreAuthTimerTable->pTable;
4526 for (i=0; i<pPreAuthTimerTable->numEntry; i++,pTempNode++)
4527 {
4528 if (pTempNode->fFree == 1)
4529 {
4530 pTempNode->fFree = 0;
4531 return pTempNode;
4532 }
4533 }
4534
4535 return NULL;
4536}
4537
4538/** -------------------------------------------------------------
4539\fn limGetPreAuthNodeFromIndex
4540\brief Depending on the Index this retrives the pre auth node.
4541\param tpAniSirGlobal pMac
4542\param tpLimPreAuthTable pAuthTable
4543\param tANI_U32 authNodeIdx
4544\return none
4545 -------------------------------------------------------------*/
4546tLimPreAuthNode * limGetPreAuthNodeFromIndex(tpAniSirGlobal pMac,
4547 tpLimPreAuthTable pAuthTable, tANI_U32 authNodeIdx)
4548{
4549 if ((authNodeIdx >= pAuthTable->numEntry) || (pAuthTable->pTable == NULL))
4550 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004551 limLog(pMac, LOGE, FL("Invalid Auth Timer Index : %d NumEntry : %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004552 authNodeIdx, pAuthTable->numEntry);
4553 return NULL;
4554 }
4555
4556 return pAuthTable->pTable + authNodeIdx;
4557}
4558
4559/* Util API to check if the channels supported by STA is within range */
4560tSirRetStatus limIsDot11hSupportedChannelsValid(tpAniSirGlobal pMac, tSirAssocReq *assoc)
4561{
4562 /*
4563 * Allow all the stations to join with us.
4564 * 802.11h-2003 11.6.1 => An AP may use the supported channels list for associated STAs
4565 * as an input into an algorithm used to select a new channel for the BSS.
4566 * The specification of the algorithm is beyond the scope of this amendment.
4567 */
4568
4569 return (eSIR_SUCCESS);
4570}
4571
4572/* Util API to check if the txpower supported by STA is within range */
4573tSirRetStatus limIsDot11hPowerCapabilitiesInRange(tpAniSirGlobal pMac, tSirAssocReq *assoc,tpPESession psessionEntry)
4574{
4575 tPowerdBm localMaxTxPower;
4576 tANI_U32 localPwrConstraint;
4577
4578 localMaxTxPower = cfgGetRegulatoryMaxTransmitPower(pMac, psessionEntry->currentOperChannel);
4579
4580 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004581 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004582 return eSIR_FAILURE;
4583 }
4584 localMaxTxPower -= (tPowerdBm)localPwrConstraint;
4585
4586 /**
4587 * The min Tx Power of the associating station should not be greater than (regulatory
4588 * max tx power - local power constraint configured on AP).
4589 */
4590 if(assoc->powerCapability.minTxPower > localMaxTxPower)
4591 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004592 limLog(pMac, LOGW, FL("minTxPower (STA) = %d, localMaxTxPower (AP) = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004593 assoc->powerCapability.minTxPower, localMaxTxPower);
4594 return (eSIR_FAILURE);
4595 }
4596
4597 return (eSIR_SUCCESS);
4598}
4599
4600/** -------------------------------------------------------------
4601\fn limFillRxHighestSupportedRate
4602\brief Fills in the Rx Highest Supported Data Rate field from
4603\ the 'supported MCS set' field in HT capability element.
4604\param tpAniSirGlobal pMac
4605\param tpSirSupportedRates pRates
4606\param tANI_U8* pSupportedMCSSet
4607\return none
4608 -------------------------------------------------------------*/
4609void limFillRxHighestSupportedRate(tpAniSirGlobal pMac, tANI_U16 *rxHighestRate, tANI_U8* pSupportedMCSSet)
4610{
4611 tSirMacRxHighestSupportRate *pRxHighestRate;
4612 tANI_U8 *pBuf;
4613 tANI_U16 rate=0;
4614
4615 pBuf = pSupportedMCSSet + MCS_RX_HIGHEST_SUPPORTED_RATE_BYTE_OFFSET;
4616 rate = limGetU16(pBuf);
4617
4618 pRxHighestRate = (tSirMacRxHighestSupportRate *) &rate;
4619 *rxHighestRate = pRxHighestRate->rate;
4620
4621 return;
4622}
Chet Lanctot186b5732013-03-18 10:26:30 -07004623
4624#ifdef WLAN_FEATURE_11W
4625/** -------------------------------------------------------------
4626\fn limSendSmeUnprotectedMgmtFrameInd
4627\brief Forwards the unprotected management frame to SME.
4628\param tpAniSirGlobal pMac
4629\param frameType - 802.11 frame type
4630\param frame - frame buffer
4631\param sessionId - id for the current session
4632\param psessionEntry - PE session context
4633\return none
4634 -------------------------------------------------------------*/
4635void limSendSmeUnprotectedMgmtFrameInd(
4636 tpAniSirGlobal pMac, tANI_U8 frameType,
4637 tANI_U8 *frame, tANI_U32 frameLen, tANI_U16 sessionId,
4638 tpPESession psessionEntry)
4639{
4640 tSirMsgQ mmhMsg;
4641 tSirSmeUnprotMgmtFrameInd * pSirSmeMgmtFrame = NULL;
4642 tANI_U16 length;
4643
4644 length = sizeof(tSirSmeUnprotMgmtFrameInd) + frameLen;
4645
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304646 pSirSmeMgmtFrame = vos_mem_malloc(length);
4647 if (NULL == pSirSmeMgmtFrame)
Chet Lanctot186b5732013-03-18 10:26:30 -07004648 {
4649 limLog(pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304650 FL("AllocateMemory failed for tSirSmeUnprotectedMgmtFrameInd"));
Chet Lanctot186b5732013-03-18 10:26:30 -07004651 return;
4652 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304653 vos_mem_set((void*)pSirSmeMgmtFrame, length, 0);
Chet Lanctot186b5732013-03-18 10:26:30 -07004654
4655 pSirSmeMgmtFrame->sessionId = sessionId;
4656 pSirSmeMgmtFrame->frameType = frameType;
4657
4658 vos_mem_copy(pSirSmeMgmtFrame->frameBuf, frame, frameLen);
4659 pSirSmeMgmtFrame->frameLen = frameLen;
4660
4661 mmhMsg.type = eWNI_SME_UNPROT_MGMT_FRM_IND;
4662 mmhMsg.bodyptr = pSirSmeMgmtFrame;
4663 mmhMsg.bodyval = 0;
4664
4665 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
4666 return;
4667}
4668#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004669
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004670#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004671/** -------------------------------------------------------------
4672\fn limSendSmeTsmIEInd
4673\brief Forwards the TSM IE information to SME.
4674\param tpAniSirGlobal pMac
4675\param psessionEntry - PE session context
4676\param tid - traffic id
4677\param state - tsm state (enabled/disabled)
4678\param measurementInterval - measurement interval
4679\return none
4680 -------------------------------------------------------------*/
4681void limSendSmeTsmIEInd(tpAniSirGlobal pMac, tpPESession psessionEntry,
4682 tANI_U8 tid, tANI_U8 state, tANI_U16 measInterval)
4683{
4684 tSirMsgQ mmhMsg;
4685 tpSirSmeTsmIEInd pSirSmeTsmIeInd = NULL;
4686
4687 if (!pMac || !psessionEntry)
4688 {
4689 return;
4690 }
4691 pSirSmeTsmIeInd = vos_mem_malloc(sizeof(tSirSmeTsmIEInd));
4692 if (NULL == pSirSmeTsmIeInd)
4693 {
4694 limLog(pMac, LOGP,
4695 FL("AllocateMemory failed for tSirSmeTsmIEInd"));
4696 return;
4697 }
4698 vos_mem_set((void*)pSirSmeTsmIeInd, sizeof(tSirSmeTsmIEInd), 0);
4699
4700 pSirSmeTsmIeInd->sessionId = psessionEntry->smeSessionId;
4701 pSirSmeTsmIeInd->tsmIe.tsid = tid;
4702 pSirSmeTsmIeInd->tsmIe.state= state;
4703 pSirSmeTsmIeInd->tsmIe.msmt_interval= measInterval;
4704
4705 mmhMsg.type = eWNI_SME_TSM_IE_IND;
4706 mmhMsg.bodyptr = pSirSmeTsmIeInd;
4707 mmhMsg.bodyval = 0;
4708
4709 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
4710 return;
4711}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004712#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004713
4714