blob: 3f36251cf23dff86f55da80b1bce3787fcbea875 [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;
Abhishek Singhf08a82b2014-10-07 11:00:42 +05302376 pAddStaParams->currentOperChan = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002377 if((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) && (pStaDs->mlmStaContext.subType == LIM_REASSOC))
2378 {
2379 /* TBD - need to remove this REASSOC check after fixinf rmmod issue */
2380 pAddStaParams->updateSta = pStaDs->mlmStaContext.updateContext;
2381 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002382 pStaDs->valid = 0;
2383 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
2384
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302385 limLog(pMac, LOG2, FL(" Assoc ID: %d wmmEnabled = %d listenInterval = %d"
2386 " shortPreambleSupported: %d "), pAddStaParams->assocId,
2387 pAddStaParams->wmmEnabled, pAddStaParams->listenInterval,
2388 pAddStaParams->shortPreambleSupported);
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07002389 // This will indicate HAL to "allocate" a new STA index
2390#ifdef FEATURE_WLAN_TDLS
2391 /* As there is corner case in-between add_sta and change_sta,if del_sta for other staIdx happened,
2392 * firmware return wrong staIdx (recently removed staIdx). Until we get a confirmation from the
2393 * firmware team it is now return correct staIdx for same sta_mac_addr for update case, we want
2394 * to get around it by passing valid staIdx given by add_sta time.
2395 */
2396 if((STA_ENTRY_TDLS_PEER == pStaDs->staType) &&
2397 (true == updateEntry))
2398 pAddStaParams->staIdx = pStaDs->staIndex;
2399 else
2400#endif
2401 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
Jeff Johnson295189b2012-06-20 16:38:30 -07002402 pAddStaParams->staType = pStaDs->staType;
2403
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002404 pAddStaParams->updateSta = updateEntry;
2405
Jeff Johnson295189b2012-06-20 16:38:30 -07002406 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2407 pAddStaParams->respReqd = 1;
2408 //Update HT Capability
2409
2410 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 -07002411 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002412 pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability;
Jeff Johnsone7245742012-09-05 17:12:55 -07002413#ifdef WLAN_FEATURE_11AC
2414 pAddStaParams->vhtCapable = pStaDs->mlmStaContext.vhtCapability;
2415#endif
2416 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002417#ifdef FEATURE_WLAN_TDLS
2418 /* SystemRole shouldn't be matter if staType is TDLS peer */
2419 else if(STA_ENTRY_TDLS_PEER == pStaDs->staType)
Hoonki Lee99e53782013-02-12 18:07:03 -08002420 {
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002421 pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability;
Hoonki Lee99e53782013-02-12 18:07:03 -08002422#ifdef WLAN_FEATURE_11AC
2423 pAddStaParams->vhtCapable = pStaDs->mlmStaContext.vhtCapability;
2424#endif
2425 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002426#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002427 else
Jeff Johnsone7245742012-09-05 17:12:55 -07002428 {
2429 pAddStaParams->htCapable = psessionEntry->htCapability;
2430#ifdef WLAN_FEATURE_11AC
2431 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
2432#endif
2433
2434 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302435#ifdef WLAN_FEATURE_11AC
2436 limLog(pMac, LOG2, FL("vhtCapable: %d "),pAddStaParams->vhtCapable);
2437#endif
2438 limLog(pMac, LOG2, FL(" StaIdx: %d updateSta = %d htcapable = %d "),
2439 pAddStaParams->staIdx,pAddStaParams->updateSta,
2440 pAddStaParams->htCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002441
2442 pAddStaParams->greenFieldCapable = pStaDs->htGreenfield;
2443 pAddStaParams->maxAmpduDensity= pStaDs->htAMpduDensity;
2444 pAddStaParams->maxAmpduSize = pStaDs->htMaxRxAMpduFactor;
2445 pAddStaParams->fDsssCckMode40Mhz = pStaDs->htDsssCckRate40MHzSupport;
2446 pAddStaParams->fShortGI20Mhz = pStaDs->htShortGI20Mhz;
2447 pAddStaParams->fShortGI40Mhz = pStaDs->htShortGI40Mhz;
2448 pAddStaParams->lsigTxopProtection = pStaDs->htLsigTXOPProtection;
2449 pAddStaParams->maxAmsduSize = pStaDs->htMaxAmsduLength;
2450 pAddStaParams->txChannelWidthSet = pStaDs->htSupportedChannelWidthSet;
2451 pAddStaParams->mimoPS = pStaDs->htMIMOPSState;
Jeff Johnsone7245742012-09-05 17:12:55 -07002452
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302453 limLog(pMac, LOG2, FL(" greenFieldCapable: %d maxAmpduDensity = %d "
2454 "maxAmpduDensity = %d"), pAddStaParams->greenFieldCapable,
2455 pAddStaParams->maxAmpduDensity, pAddStaParams->maxAmpduSize);
2456
2457 limLog(pMac, LOG2, FL("fDsssCckMode40Mhz: %d fShortGI20Mhz: %d "
2458 "fShortGI40Mhz: %d"), pAddStaParams->fDsssCckMode40Mhz,
2459 pAddStaParams->fShortGI20Mhz, pAddStaParams->fShortGI40Mhz);
2460
2461 limLog(pMac, LOG2, FL("lsigTxopProtection: %d maxAmsduSize: %d "
2462 "txChannelWidthSet: %d mimoPS: %d "), pAddStaParams->lsigTxopProtection,
2463 pAddStaParams->maxAmsduSize,pAddStaParams->txChannelWidthSet,
2464 pAddStaParams->mimoPS);
2465
Jeff Johnsone7245742012-09-05 17:12:55 -07002466#ifdef WLAN_FEATURE_11AC
2467 if(pAddStaParams->vhtCapable)
2468 {
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002469 pAddStaParams->vhtTxChannelWidthSet = pStaDs->vhtSupportedChannelWidthSet;
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08002470 pAddStaParams->vhtTxBFCapable =
Hoonki Lee99e53782013-02-12 18:07:03 -08002471#ifdef FEATURE_WLAN_TDLS
2472 (( STA_ENTRY_PEER == pStaDs->staType ) || (STA_ENTRY_TDLS_PEER == pStaDs->staType)) ?
2473 pStaDs->vhtBeamFormerCapable : psessionEntry->txBFIniFeatureEnabled ;
2474#else
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08002475 ( STA_ENTRY_PEER == pStaDs->staType ) ? pStaDs->vhtBeamFormerCapable :
2476 psessionEntry->txBFIniFeatureEnabled ;
Hoonki Lee99e53782013-02-12 18:07:03 -08002477#endif
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302478 limLog(pMac, LOG2, FL("vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
2479 pAddStaParams->vhtTxChannelWidthSet,pAddStaParams->vhtTxBFCapable);
Jeff Johnsone7245742012-09-05 17:12:55 -07002480 }
2481#endif
2482
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08002483#ifdef FEATURE_WLAN_TDLS
2484 if((STA_ENTRY_PEER == pStaDs->staType) ||
2485 (STA_ENTRY_TDLS_PEER == pStaDs->staType))
2486#else
2487 if (STA_ENTRY_PEER == pStaDs->staType)
2488#endif
2489 {
2490 /* peer STA get the LDPC capability from pStaDs, which populated from
2491 * HT/VHT capability*/
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08002492 if(pAddStaParams->vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP)
2493 {
2494 pAddStaParams->htLdpcCapable = 0;
2495 pAddStaParams->vhtLdpcCapable = 0;
2496 }
2497 else
2498 {
2499 pAddStaParams->htLdpcCapable = pStaDs->htLdpcCapable;
2500 pAddStaParams->vhtLdpcCapable = pStaDs->vhtLdpcCapable;
2501 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08002502 }
2503 else if( STA_ENTRY_SELF == pStaDs->staType)
2504 {
2505 /* For Self STA get the LDPC capability from config.ini*/
2506 pAddStaParams->htLdpcCapable =
2507 (psessionEntry->txLdpcIniFeatureEnabled & 0x01);
2508 pAddStaParams->vhtLdpcCapable =
2509 ((psessionEntry->txLdpcIniFeatureEnabled >> 1)& 0x01);
2510 }
2511
Jeff Johnson295189b2012-06-20 16:38:30 -07002512 /* Update PE session ID*/
2513 pAddStaParams->sessionId = psessionEntry->peSessionId;
2514
2515 if (psessionEntry->parsedAssocReq != NULL)
2516 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002517 // Get a copy of the already parsed Assoc Request
2518 pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
2519 if ( pAssocReq && pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
2520 p2pIe = limGetP2pIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
2521 }
2522 pAddStaParams->p2pCapableSta = (p2pIe != NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002523 }
2524
2525 //Disable BA. It will be set as part of ADDBA negotiation.
2526 for( i = 0; i < STACFG_MAX_TC; i++ )
2527 {
2528 pAddStaParams->staTCParams[i].txUseBA = eBA_DISABLE;
2529 pAddStaParams->staTCParams[i].rxUseBA = eBA_DISABLE;
2530 }
2531
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002532#ifdef FEATURE_WLAN_TDLS
2533 if(pStaDs->wmeEnabled && \
2534 ((eLIM_AP_ROLE == psessionEntry->limSystemRole) || (STA_ENTRY_TDLS_PEER == pStaDs->staType)) )
2535#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002536 if(pStaDs->wmeEnabled && (eLIM_AP_ROLE == psessionEntry->limSystemRole))
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002537#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002538 {
2539 pAddStaParams->uAPSD = 0;
2540 /* update UAPSD and send it to LIM to add STA */
2541 // bitmap MSB <- LSB MSB 4 bits are for
2542 // trigger enabled AC setting and LSB 4 bits
2543 // are for delivery enabled AC setting
2544 // 7 6 5 4 3 2 1 0
2545 // BE BK VI VO BE BK VI VO
2546 pAddStaParams->uAPSD |= pStaDs->qos.capability.qosInfo.acvo_uapsd;
2547 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acvi_uapsd << 1);
2548 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbk_uapsd << 2);
2549 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbe_uapsd << 3);
2550 //making delivery enabled and trigger enabled setting the same.
2551 pAddStaParams->uAPSD |= pAddStaParams->uAPSD << 4;
2552
2553 pAddStaParams->maxSPLen = pStaDs->qos.capability.qosInfo.maxSpLen;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302554 limLog( pMac, LOG1, FL("uAPSD = 0x%x, maxSpLen = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002555 pAddStaParams->uAPSD, pAddStaParams->maxSPLen);
2556 }
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002557
2558#ifdef WLAN_FEATURE_11W
2559 pAddStaParams->rmfEnabled = pStaDs->rmfEnabled;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302560 limLog( pMac, LOG1, FL( "PMF enabled %d"), pAddStaParams->rmfEnabled);
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002561#endif
2562
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302563 limLog(pMac, LOG2, FL("htLdpcCapable: %d vhtLdpcCapable: %d "
2564 "p2pCapableSta: %d"), pAddStaParams->htLdpcCapable,
2565 pAddStaParams->vhtLdpcCapable, pAddStaParams->p2pCapableSta);
2566
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002567 //we need to defer the message until we get the response back from HAL.
Jeff Johnson295189b2012-06-20 16:38:30 -07002568 if (pAddStaParams->respReqd)
2569 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07002570
2571 msgQ.type = WDA_ADD_STA_REQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07002572
2573 msgQ.reserved = 0;
2574 msgQ.bodyptr = pAddStaParams;
2575 msgQ.bodyval = 0;
2576
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002577 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_STA_REQ for assocId %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002578 pStaDs->assocId);
Jeff Johnsone7245742012-09-05 17:12:55 -07002579 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002580
2581 retCode = wdaPostCtrlMsg( pMac, &msgQ );
2582 if( eSIR_SUCCESS != retCode)
2583 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002584 if (pAddStaParams->respReqd)
2585 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002586 limLog( pMac, LOGE, FL("ADD_STA_REQ for aId %d failed (reason %X)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002587 pStaDs->assocId, retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302588 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002589 }
2590
2591 return retCode;
2592}
2593
2594
2595/**
2596 * limDelSta()
2597 *
2598 *FUNCTION:
2599 * This function is called to delete an STA context at hardware
2600 * whenever a STA is disassociated
2601 *
2602 *LOGIC:
2603 *
2604 *ASSUMPTIONS:
2605 * NA
2606 *
2607 *NOTE:
2608 * NA
2609 *
2610 * @param pMac - Pointer to Global MAC structure
2611 * @param pStaDs - Pointer to the STA datastructure created by
2612 * LIM and maintained by DPH
2613 * @param fRespReqd - flag to indicate whether the delete is synchronous (true)
2614 * or not (false)
2615 * @return retCode - Indicates success or failure return code
2616 */
2617
2618tSirRetStatus
2619limDelSta(
2620 tpAniSirGlobal pMac,
2621 tpDphHashNode pStaDs,
2622 tANI_BOOLEAN fRespReqd,
2623 tpPESession psessionEntry)
2624{
2625 tpDeleteStaParams pDelStaParams = NULL;
2626 tSirMsgQ msgQ;
2627 tSirRetStatus retCode = eSIR_SUCCESS;
2628
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302629 pDelStaParams = vos_mem_malloc(sizeof( tDeleteStaParams ));
2630 if (NULL == pDelStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07002631 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302632 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002633 return eSIR_MEM_ALLOC_FAILED;
2634 }
2635
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302636 vos_mem_set((tANI_U8 *) pDelStaParams, sizeof(tDeleteStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002637
2638 //
2639 // DPH contains the STA index only for "peer" STA entries.
2640 // LIM global contains "self" STA index
2641 // Thus,
2642 // if( STA role )
2643 // get STA index from LIM global
2644 // else
2645 // get STA index from DPH
2646 //
2647
2648#if 0
2649 /* Since we have not created any STA, no need to send msg to delete
2650 * STA to HAL */
2651 if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) {
2652 pDelStaParams->staIdx = 1; /* TODO : This is workaround. Need to find right STA Index before sending to HAL */
2653 //return retCode;
2654 }
2655#endif
2656
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002657#ifdef FEATURE_WLAN_TDLS
2658 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)) )
2659#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002660 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 -08002661#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002662 pDelStaParams->staIdx= psessionEntry->staId;
2663
2664 else
2665 pDelStaParams->staIdx= pStaDs->staIndex;
2666
2667 pDelStaParams->assocId = pStaDs->assocId;
2668 pStaDs->valid = 0;
2669
2670 if (! fRespReqd)
2671 pDelStaParams->respReqd = 0;
2672 else
2673 {
2674 //when limDelSta is called from processSmeAssocCnf then mlmState is already set properly.
2675 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs))
2676 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002677 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002678 SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs, eLIM_MLM_WT_DEL_STA_RSP_STATE);
2679 }
2680 if ( (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) ||
2681 (eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) )
2682 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002683 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002684
2685 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
2686
2687 }
2688 pDelStaParams->respReqd = 1;
2689 //we need to defer the message until we get the response back from HAL.
2690 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
2691 }
2692
2693 /* Update PE session ID*/
2694 pDelStaParams->sessionId = psessionEntry->peSessionId;
2695
2696 pDelStaParams->status = eHAL_STATUS_SUCCESS;
2697 msgQ.type = WDA_DELETE_STA_REQ;
2698 msgQ.reserved = 0;
2699 msgQ.bodyptr = pDelStaParams;
2700 msgQ.bodyval = 0;
2701
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302702 limLog( pMac, LOG1, FL( "Sessionid %d :Sending SIR_HAL_DELETE_STA_REQ "
2703 "for STAID: %X and AssocID: %d MAC : "MAC_ADDRESS_STR ),
2704 pDelStaParams->sessionId,
2705 pDelStaParams->staIdx, pDelStaParams->assocId,
2706 MAC_ADDR_ARRAY(pStaDs->staAddr));
2707
Jeff Johnsone7245742012-09-05 17:12:55 -07002708 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002709 retCode = wdaPostCtrlMsg( pMac, &msgQ );
2710 if( eSIR_SUCCESS != retCode)
2711 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002712 if(fRespReqd)
2713 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002714 limLog( pMac, LOGE, FL("Posting DELETE_STA_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002715 retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302716 vos_mem_free(pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002717 }
2718
2719 return retCode;
2720}
2721
2722#if defined WLAN_FEATURE_VOWIFI_11R
2723/*------------------------------------------------------------------------
2724 * limAddFTStaSelf()
2725 *
2726 * FUNCTION:
2727 *
2728 * This function is called to add a STA once we have connected with a new
2729 * AP, that we have performed an FT to.
2730 *
2731 * The Add STA Response is created and now after the ADD Bss Is Successful
2732 * we add the self sta. We update with the association id from the reassoc
2733 * response from the AP.
2734 *------------------------------------------------------------------------
2735 */
2736tSirRetStatus limAddFTStaSelf(tpAniSirGlobal pMac, tANI_U16 assocId, tpPESession psessionEntry)
2737{
2738 tpAddStaParams pAddStaParams = NULL;
2739 tSirMsgQ msgQ;
2740 tSirRetStatus retCode = eSIR_SUCCESS;
2741
2742 pAddStaParams = pMac->ft.ftPEContext.pAddStaReq;
2743 pAddStaParams->assocId = assocId;
2744
2745 msgQ.type = SIR_HAL_ADD_STA_REQ;
2746 msgQ.reserved = 0;
2747 msgQ.bodyptr = pAddStaParams;
2748 msgQ.bodyval = 0;
2749
2750
2751#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002752 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002753#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002754 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002755
2756 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002757 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_ADD_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002758 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
2759 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
2760 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002761 limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X"), retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302762 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002763 }
2764 //
2765 // Dont need it any more
2766 pMac->ft.ftPEContext.pAddStaReq = NULL;
2767 return retCode;
2768}
2769
2770#endif /* WLAN_FEATURE_VOWIFI_11R */
2771
2772/**
2773 * limAddStaSelf()
2774 *
2775 *FUNCTION:
2776 * This function is called to add an STA context at hardware
2777 * whenever a STA is (Re) Associated.
2778 *
2779 *LOGIC:
2780 *
2781 *ASSUMPTIONS:
2782 * NA
2783 *
2784 *NOTE:
2785 * NA
2786 *
2787 * @param pMac - Pointer to Global MAC structure
2788 * @param pStaDs - Pointer to the STA datastructure created by
2789 * LIM and maintained by DPH
2790 * @return retCode - Indicates success or failure return code
2791 */
2792
2793tSirRetStatus
2794limAddStaSelf(tpAniSirGlobal pMac,tANI_U16 staIdx, tANI_U8 updateSta, tpPESession psessionEntry)
2795{
2796 tpAddStaParams pAddStaParams = NULL;
2797 tSirMsgQ msgQ;
2798 tSirRetStatus retCode = eSIR_SUCCESS;
2799 tSirMacAddr staMac;
2800 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
krunal soni71343fb2013-09-16 16:16:26 -07002801 tANI_U32 shortGi20MhzSupport;
2802 tANI_U32 shortGi40MhzSupport;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002803 /*This self Sta dot 11 mode comes from the cfg and the expectation here is
2804 * that cfg carries the systemwide capability that device under
2805 * consideration can support. This capability gets plumbed into the cfg
2806 * cache at system initialization time via the .dat and .ini file override
2807 * mechanisms and will not change. If it does change, it is the
2808 * responsibility of SME to evict the selfSta and reissue a new AddStaSelf
2809 * command.*/
2810 tANI_U32 selfStaDot11Mode=0, selfTxWidth=0;
2811 wlan_cfgGetInt(pMac,WNI_CFG_DOT11_MODE,&selfStaDot11Mode);
2812 limLog( pMac, LOG1, FL("cfgDot11Mode %d"),(int)selfStaDot11Mode);
2813 wlan_cfgGetInt(pMac,WNI_CFG_HT_CAP_INFO_SUPPORTED_CHAN_WIDTH_SET,&selfTxWidth);
2814 limLog( pMac, LOG1, FL("SGI 20 %d"),(int)selfTxWidth);
2815 limLog( pMac, LOG1, FL("Roam Channel Bonding Mode %d"),(int)pMac->roam.configParam.uCfgDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002816
2817 #if 0
2818 retCode =wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg);
2819 if (retCode != eSIR_SUCCESS)
2820 {
2821 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002822 limLog(pMac, LOGP, FL("could not retrieve STA MAC"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002823 return retCode;
2824 }
2825 #endif //TO SUPPORT BT-AMP
2826 sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302827 limLog(pMac, LOG1, FL(MAC_ADDRESS_STR": "),MAC_ADDR_ARRAY(staMac));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302828 pAddStaParams = vos_mem_malloc(sizeof(tAddStaParams));
2829 if (NULL == pAddStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07002830 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302831 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002832 return eSIR_MEM_ALLOC_FAILED;
2833 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302834 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002835
2836 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302837 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2838 (tANI_U8 *) staMac, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002839
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302840 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
2841 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002842
2843 pAddStaParams->assocId = psessionEntry->limAID;
2844 pAddStaParams->staType = STA_ENTRY_SELF;
2845 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2846 pAddStaParams->respReqd = 1;
Abhishek Singhf08a82b2014-10-07 11:00:42 +05302847 pAddStaParams->currentOperChan = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002848 /* Update PE session ID */
2849 pAddStaParams->sessionId = psessionEntry->peSessionId;
2850
2851 // This will indicate HAL to "allocate" a new STA index
2852 pAddStaParams->staIdx = staIdx;
2853 pAddStaParams->updateSta = updateSta;
2854
2855 pAddStaParams->shortPreambleSupported = psessionEntry->beaconParams.fShortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -07002856
Jeff Johnsone7245742012-09-05 17:12:55 -07002857#ifdef WLAN_FEATURE_11AC
2858 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry,NULL);
2859#else
2860 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
2861#endif
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002862// if( psessionEntry->htCapability)---> old check
2863 /*We used to check if the session is htCapable before setting the htCapable
2864 * flag. The check limited us from operating */
2865 if ( IS_DOT11_MODE_HT(selfStaDot11Mode) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002866 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002867 pAddStaParams->htCapable = TRUE ;
Jeff Johnson295189b2012-06-20 16:38:30 -07002868#ifdef DISABLE_GF_FOR_INTEROP
2869 /*
2870 * To resolve the interop problem with Broadcom AP,
2871 * where TQ STA could not pass traffic with GF enabled,
2872 * TQ STA will do Greenfield only with TQ AP, for
2873 * everybody else it will be turned off.
2874 */
2875 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2876 {
2877 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
2878 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
2879 }
2880 else
2881#endif
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002882 {
2883 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
2884 pAddStaParams->txChannelWidthSet =
2885 pMac->roam.configParam.channelBondingMode5GHz;
2886 // pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
2887 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
2888 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
2889 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
2890 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
2891 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
2892 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
2893 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
2894 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
krunal soni71343fb2013-09-16 16:16:26 -07002895 /*
2896 * We will read the gShortGI20Mhz from ini file, and if it is set
2897 * to 1 then we will tell Peer that we support 40Mhz short GI
2898 */
2899 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
2900 (pMac, WNI_CFG_SHORT_GI_20MHZ,
2901 &shortGi20MhzSupport)))
2902 {
2903 if (VOS_TRUE == shortGi20MhzSupport)
2904 {
2905 pAddStaParams->fShortGI20Mhz =
2906 WNI_CFG_SHORT_GI_20MHZ_STAMAX;
2907 //pAddStaParams->fShortGI20Mhz =
2908 //limGetHTCapability(pMac, eHT_SHORT_GI_20MHZ,
2909 // psessionEntry);
2910 }
2911 else
2912 {
2913 pAddStaParams->fShortGI20Mhz = VOS_FALSE;
2914 }
2915 }
2916 else
2917 {
2918 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz"
2919 "CFG,setting value to default"));)
2920 pAddStaParams->fShortGI20Mhz = WNI_CFG_SHORT_GI_20MHZ_STADEF;
2921 }
2922
2923 /*
2924 * We will read the gShortGI40Mhz from ini file, and if it is set
2925 * to 1 then we will tell Peer that we support 40Mhz short GI
2926 */
2927 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
2928 (pMac, WNI_CFG_SHORT_GI_40MHZ,
2929 &shortGi40MhzSupport)))
2930 {
2931 if (VOS_TRUE == shortGi40MhzSupport)
2932 {
2933 pAddStaParams->fShortGI40Mhz =
2934 WNI_CFG_SHORT_GI_40MHZ_STAMAX;
2935 //pAddStaParams->fShortGI40Mhz =
2936 //limGetHTCapability(pMac, eHT_SHORT_GI_40MHZ,
2937 // psessionEntry);
2938 }
2939 else
2940 {
2941 pAddStaParams->fShortGI40Mhz = VOS_FALSE;
2942 }
2943 }
2944 else
2945 {
2946 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz"
2947 "CFG,setting value to default"));)
2948 pAddStaParams->fShortGI40Mhz = WNI_CFG_SHORT_GI_40MHZ_STADEF;
2949 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302950 limLog(pMac, LOG2, FL(" greenFieldCapable: %d maxAmpduDensity = %d "
2951 "maxAmpduSize = %d"), pAddStaParams->greenFieldCapable,
2952 pAddStaParams->maxAmpduDensity, pAddStaParams->maxAmpduSize);
2953
2954 limLog(pMac, LOG2, FL("fDsssCckMode40Mhz: %d fShortGI20Mhz: %d "
2955 "fShortGI40Mhz: %d lsigTxopProtection: %d"),
2956 pAddStaParams->fDsssCckMode40Mhz, pAddStaParams->fShortGI20Mhz,
2957 pAddStaParams->fShortGI40Mhz, pAddStaParams->lsigTxopProtection);
2958
2959 limLog(pMac, LOG2, FL(" maxAmsduSize: %d txChannelWidthSet: %d "
2960 "mimoPS: %d rifsMode %d delBASupport %d"),
2961 pAddStaParams->maxAmsduSize,
2962 pAddStaParams->txChannelWidthSet, pAddStaParams->mimoPS,
2963 pAddStaParams->rifsMode, pAddStaParams->delBASupport );
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002964 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002965 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002966#ifdef WLAN_FEATURE_11AC
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002967 pAddStaParams->vhtCapable = IS_DOT11_MODE_VHT(selfStaDot11Mode);
2968 if (pAddStaParams->vhtCapable){
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07002969 pAddStaParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002970 limLog( pMac, LOG1, FL("VHT WIDTH SET %d"),pAddStaParams->vhtTxChannelWidthSet);
2971 }
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08002972 pAddStaParams->vhtTxBFCapable = psessionEntry->txBFIniFeatureEnabled;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302973 limLog(pMac, LOG2, FL("vhtCapable: %d vhtTxBFCapable %d "),
2974 pAddStaParams->vhtCapable, pAddStaParams->vhtTxBFCapable);
Jeff Johnsone7245742012-09-05 17:12:55 -07002975#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08002976
2977 /* For Self STA get the LDPC capability from session i.e config.ini*/
2978 pAddStaParams->htLdpcCapable =
2979 (psessionEntry->txLdpcIniFeatureEnabled & 0x01);
2980 pAddStaParams->vhtLdpcCapable =
2981 ((psessionEntry->txLdpcIniFeatureEnabled >> 1)& 0x01);
2982
Jeff Johnson295189b2012-06-20 16:38:30 -07002983 if(wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002984 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002985 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
2986
Jeff Johnson295189b2012-06-20 16:38:30 -07002987 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona)
2988 {
2989 pAddStaParams->p2pCapableSta = 1;
2990 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002991
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002992 //limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
2993 pAddStaParams->supportedRates.opRateMode = limGetStaRateMode((tANI_U8)selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002994
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302995 limLog(pMac, LOG2, FL(" StaIdx: %d updateSta = %d htcapable = %d "),
2996 pAddStaParams->staIdx,pAddStaParams->updateSta,
2997 pAddStaParams->htCapable);
2998
2999 limLog(pMac, LOG2, FL("htLdpcCapable: %d vhtLdpcCapable: %d "
3000 "p2pCapableSta: %d"),
3001 pAddStaParams->htLdpcCapable,pAddStaParams->vhtLdpcCapable,
3002 pAddStaParams->p2pCapableSta);
3003
3004 limLog(pMac, LOG2, FL(" sessionid: %d Assoc ID: %d listenInterval = %d"
3005 " shortPreambleSupported: %d "), psessionEntry->smeSessionId,
3006 pAddStaParams->assocId, pAddStaParams->listenInterval,
3007 pAddStaParams->shortPreambleSupported);
3008
Jeff Johnson295189b2012-06-20 16:38:30 -07003009 msgQ.type = WDA_ADD_STA_REQ;
3010 //
3011 // FIXME_GEN4
3012 // A global counter (dialog token) is required to keep track of
3013 // all PE <-> HAL communication(s)
3014 //
3015 msgQ.reserved = 0;
3016 msgQ.bodyptr = pAddStaParams;
3017 msgQ.bodyval = 0;
3018
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303019 limLog( pMac, LOGW, FL(MAC_ADDRESS_STR":Sessionid %d : "
3020 "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ),
3021 MAC_ADDR_ARRAY(pAddStaParams->staMac),
3022 pAddStaParams->sessionId,
3023 pAddStaParams->assocId);
Jeff Johnsone7245742012-09-05 17:12:55 -07003024 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003025
3026 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
3027 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003028 limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X"), retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303029 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003030 }
3031 return retCode;
3032}
3033
3034
3035/**
3036 * limTeardownInfraBSS()
3037 *
3038 *FUNCTION:
3039 * This function is called by various LIM functions to teardown
3040 * an established Infrastructure BSS
3041 *
3042 *LOGIC:
3043 *
3044 *ASSUMPTIONS:
3045 *
3046 *NOTE:
3047 *
3048 * @param pMac - Pointer to Global MAC structure
3049 * @return None
3050 */
3051
3052void
3053limTeardownInfraBss(tpAniSirGlobal pMac,tpPESession psessionEntry)
3054{
3055 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3056
3057 /**
3058 * Send Broadcast Disassociate frame with
3059 * 'leaving BSS' reason.
3060 */
3061 limSendDisassocMgmtFrame(pMac,
3062 eSIR_MAC_DISASSOC_LEAVING_BSS_REASON,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003063 bcAddr,psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003064} /*** end limTeardownInfraBss() ***/
3065
3066
3067/**
3068 * limHandleCnfWaitTimeout()
3069 *
3070 *FUNCTION:
3071 * This function is called by limProcessMessageQueue to handle
3072 * various confirmation failure cases.
3073 *
3074 *LOGIC:
3075 *
3076 *ASSUMPTIONS:
3077 *
3078 *NOTE:
3079 *
3080 * @param pMac - Pointer to Global MAC structure
3081 * @param pStaDs - Pointer to a sta descriptor
3082 * @return None
3083 */
3084
3085void limHandleCnfWaitTimeout(tpAniSirGlobal pMac, tANI_U16 staId)
3086{
3087 tpDphHashNode pStaDs;
3088 tLimSystemRole systemRole;
3089 tpPESession psessionEntry = NULL;
3090
3091 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId))== NULL)
3092 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003093 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003094 return;
3095 }
3096 systemRole = limGetSystemRole(psessionEntry);
3097 pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable);
3098
3099 if (pStaDs == NULL)
3100 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003101 PELOGW(limLog(pMac, LOGW, FL("No STA context in SIR_LIM_CNF_WAIT_TIMEOUT."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003102 return;
3103 }
3104
3105 switch (pStaDs->mlmStaContext.mlmState) {
3106 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003107 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 -07003108 limPrintMacAddr(pMac, pStaDs->staAddr, LOGW);
3109
3110 if ( (systemRole == eLIM_AP_ROLE)|| (systemRole == eLIM_BT_AMP_AP_ROLE) )
3111 {
3112 limRejectAssociation(
3113 pMac,
3114 pStaDs->staAddr,
3115 pStaDs->mlmStaContext.subType,
3116 true,
3117 pStaDs->mlmStaContext.authType,
3118 pStaDs->assocId,
3119 true,
3120 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
3121 psessionEntry);
3122 }
3123 break;
3124
3125 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003126 limLog(pMac, LOGW, FL("Received CNF_WAIT_TIMEOUT in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003127 pStaDs->mlmStaContext.mlmState);
3128 }
3129}
3130
3131
3132/**
3133 * limDeleteDphHashEntry()
3134 *
3135 *FUNCTION:
3136 * This function is called whenever we need to delete
3137 * the dph hash entry
3138 *
3139 *LOGIC:
3140 *
3141 *ASSUMPTIONS:
3142 *
3143 *NOTE:
3144 *
3145 * @param pMac Pointer to Global MAC structure
3146 * @param tANI_U16 staId
3147 * @return None
3148 */
3149
3150void
3151limDeleteDphHashEntry(tpAniSirGlobal pMac, tSirMacAddr staAddr, tANI_U16 staId,tpPESession psessionEntry)
3152{
3153 tANI_U16 aid;
3154 tpDphHashNode pStaDs;
3155 tUpdateBeaconParams beaconParams;
3156 tLimSystemRole systemRole;
3157
Kaushik, Sushantfb156732014-01-07 15:36:03 +05303158 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Jeff Johnson295189b2012-06-20 16:38:30 -07003159 beaconParams.paramChangeBitmap = 0;
3160 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, staId);
3161 if (NULL == psessionEntry)
3162 {
3163 PELOGE(limLog(pMac, LOGE, FL("NULL psessionEntry"));)
3164 return;
3165 }
3166 systemRole = limGetSystemRole(psessionEntry);
3167 beaconParams.bssIdx = psessionEntry->bssIdx;
3168 pStaDs = dphLookupHashEntry(pMac, staAddr, &aid, &psessionEntry->dph.dphHashTable);
3169 if (pStaDs != NULL)
3170 {
3171 PELOGW(limLog(pMac, LOGW, FL("Deleting DPH Hash entry for STAID: %X\n "), staId);)
3172 // update the station count and perform associated actions
3173 // do this before deleting the dph hash entry
3174 limUtilCountStaDel(pMac, pStaDs, psessionEntry);
3175
3176 if((eLIM_AP_ROLE == psessionEntry->limSystemRole) ||
3177 (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole))
3178 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003179 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
3180 if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE){
3181 limDecideApProtectionOnDelete(pMac, pStaDs, &beaconParams,psessionEntry);
3182 }
3183 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003184
3185 if(eLIM_STA_IN_IBSS_ROLE == systemRole)
3186 limIbssDecideProtectionOnDelete(pMac, pStaDs, &beaconParams, psessionEntry);
3187
3188 limDecideShortPreamble(pMac, pStaDs, &beaconParams, psessionEntry);
3189 limDecideShortSlot(pMac, pStaDs, &beaconParams, psessionEntry);
3190
3191 //Send message to HAL about beacon parameter change.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003192 PELOGW(limLog(pMac, LOGW, FL("param bitmap = %d "), beaconParams.paramChangeBitmap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003193 if(beaconParams.paramChangeBitmap)
3194 {
3195 schSetFixedBeaconFields(pMac,psessionEntry);
3196 limSendBeaconParams(pMac, &beaconParams, psessionEntry );
3197 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08003198
3199#ifdef WLAN_FEATURE_11W
3200 tx_timer_delete(&pStaDs->pmfSaQueryTimer);
3201#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003202 }
3203 if (dphDeleteHashEntry(pMac, staAddr, staId, &psessionEntry->dph.dphHashTable) != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003204 limLog(pMac, LOGP, FL("error deleting hash entry"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003205 }
3206}
3207
3208
3209
3210/**
3211 * limCheckAndAnnounceJoinSuccess()
3212 *
3213 *FUNCTION:
3214 * This function is called upon receiving Beacon/Probe Response
3215 * frame in WT_JOIN_BEACON_STATE to check if the received
3216 * Beacon/Probe Response is from the BSS that we're attempting
3217 * to join.
3218 *
3219 *LOGIC:
3220 * If the Beacon/Probe Response is indeed from the BSS we're
3221 * attempting to join, join success is sent to SME.
3222 *
3223 *ASSUMPTIONS:
3224 *
3225 *NOTE:
3226 *
3227 * @param pMac Pointer to Global MAC structure
3228 * @param pBPR Pointer to received Beacon/Probe Response
3229 * @param pHdr Pointer to received Beacon/Probe Response
3230 * MAC header
3231 * @return None
3232 */
3233
3234void
3235limCheckAndAnnounceJoinSuccess(tpAniSirGlobal pMac,
3236 tSirProbeRespBeacon *pBPR,
3237 tpSirMacMgmtHdr pHdr,tpPESession psessionEntry)
3238{
3239 tSirMacSSid currentSSID;
3240 tLimMlmJoinCnf mlmJoinCnf;
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -08003241 tANI_U32 val = 0;
3242 tANI_U32 *noa1DurationFromBcn = NULL;
3243 tANI_U32 *noa2DurationFromBcn = NULL;
3244 tANI_U32 noa;
3245 tANI_U32 TotalNum_NoADesc = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003246
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303247 vos_mem_copy(currentSSID.ssId,
3248 psessionEntry->ssId.ssId,
3249 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003250
3251 currentSSID.length = (tANI_U8)psessionEntry->ssId.length ;
3252
3253 if (
3254 /* Check for SSID only in probe response. Beacons may not carry
3255 SSID information in hidden SSID case */
3256 ( (SIR_MAC_MGMT_FRAME == pHdr->fc.type) &&
3257 (SIR_MAC_MGMT_PROBE_RSP == pHdr->fc.subType) ) &&
3258 currentSSID.length &&
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303259 (!vos_mem_compare((tANI_U8 *) &pBPR->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07003260 (tANI_U8 *) &currentSSID,
3261 (tANI_U8) (1 + currentSSID.length)) ))
3262 {
3263 /**
3264 * Received SSID does not match with the one we've.
3265 * Ignore received Beacon frame
3266 */
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303267 limLog(pMac, LOG1, FL("SSID received in Beacon does not match"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003268#ifdef WLAN_DEBUG
3269 pMac->lim.gLimBcnSSIDMismatchCnt++;
3270#endif
3271 return;
3272 }
3273
3274 if( (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_STA_ROLE))
3275 {
Nirav Shahbc35fb72013-12-12 18:14:06 +05303276 limLog(pMac, LOG1, FL("Received Beacon/PR with matching BSSID"
3277 MAC_ADDRESS_STR "PESessionID %d"),
3278 MAC_ADDR_ARRAY(psessionEntry->bssId),
3279 psessionEntry->peSessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07003280 // Deactivate Join Failure timer
3281 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003282 // Deactivate Periodic Join timer
3283 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
Jeff Johnson295189b2012-06-20 16:38:30 -07003284
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -08003285 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona &&
3286 pBPR->P2PProbeRes.NoticeOfAbsence.present)
3287 {
3288
3289 noa1DurationFromBcn = (tANI_U32*)(pBPR->P2PProbeRes.NoticeOfAbsence.NoADesc + 1);
3290
3291 if(pBPR->P2PProbeRes.NoticeOfAbsence.num_NoADesc)
3292 TotalNum_NoADesc = pBPR->P2PProbeRes.NoticeOfAbsence.num_NoADesc/SIZE_OF_NOA_DESCRIPTOR;
3293
3294 noa = *noa1DurationFromBcn;
3295
3296 if(TotalNum_NoADesc > 1)
3297 {
3298 noa2DurationFromBcn = (tANI_U32*)(pBPR->P2PProbeRes.NoticeOfAbsence.NoADesc + SIZE_OF_NOA_DESCRIPTOR + 1);
3299 noa += *noa2DurationFromBcn;
3300 }
3301
3302 /*If MAX Noa exceeds 3 secs we will consider only 3 secs to
3303 * avoid arbitary values in noa duration field
3304 */
3305 noa = noa > MAX_NOA_PERIOD_IN_MICROSECS ? MAX_NOA_PERIOD_IN_MICROSECS : noa;
3306 noa = noa/1000; //Convert to ms
3307
3308 if( wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,&val) == eSIR_SUCCESS )
3309 {
3310 psessionEntry->defaultAuthFailureTimeout = val;
3311 ccmCfgSetInt(pMac,WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT ,val + noa, NULL, eANI_BOOLEAN_FALSE);
3312 }
3313 }
3314 else
3315 {
3316 psessionEntry->defaultAuthFailureTimeout = 0;
3317 }
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -08003318
Jeff Johnson295189b2012-06-20 16:38:30 -07003319 // Update Beacon Interval at CFG database
3320
3321 if ( pBPR->HTCaps.present )
3322 limUpdateStaRunTimeHTCapability( pMac, &pBPR->HTCaps );
3323 if ( pBPR->HTInfo.present )
3324 limUpdateStaRunTimeHTInfo( pMac, &pBPR->HTInfo, psessionEntry);
3325 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003326 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003327
Ganesh Kondabattiniaad38d92014-11-19 17:06:00 +05303328 /* update the capability info based on recently
3329 * received beacon/probe response frame */
3330 psessionEntry->limCurrentBssCaps = limGetU16((tANI_U8 *) &pBPR->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07003331
3332 /**
3333 * Announce join success by sending
3334 * Join confirm to SME.
3335 */
3336 mlmJoinCnf.resultCode = eSIR_SME_SUCCESS;
3337 mlmJoinCnf.protStatusCode = eSIR_MAC_SUCCESS_STATUS;
3338 /* Update PE sessionId*/
3339 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3340 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
3341 } // if ((pMac->lim.gLimSystemRole == IBSS....
3342}
3343
3344/**
3345 * limExtractApCapabilities()
3346 *
3347 *FUNCTION:
3348 * This function is called to extract all of the AP's capabilities
3349 * from the IEs received from it in Beacon/Probe Response frames
3350 *
3351 *LOGIC:
3352 * This routine mimics the limExtractApCapability() API. The difference here
3353 * is that this API returns the entire tSirProbeRespBeacon info as is. It is
3354 * left to the caller of this API to use this info as required
3355 *
3356 *ASSUMPTIONS:
3357 * NA
3358 *
3359 *NOTE:
3360 *
3361 * @param pMac Pointer to Global MAC structure
3362 * @param pIE Pointer to starting IE in Beacon/Probe Response
3363 * @param ieLen Length of all IEs combined
3364 * @param beaconStruct A pointer to tSirProbeRespBeacon that needs to be
3365 * populated
3366 * @return status A status reporting eSIR_SUCCESS or eSIR_FAILURE
3367 */
3368tSirRetStatus limExtractApCapabilities( tpAniSirGlobal pMac,
3369 tANI_U8 *pIE,
3370 tANI_U16 ieLen,
3371 tpSirProbeRespBeacon beaconStruct )
3372{
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303373 vos_mem_set((tANI_U8 *) beaconStruct, sizeof( tSirProbeRespBeacon ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003374
3375 PELOG3(limLog( pMac, LOG3,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003376 FL( "In limExtractApCapabilities: The IE's being received are:" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003377 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG3, pIE, ieLen );)
3378
3379 // Parse the Beacon IE's, Don't try to parse if we dont have anything in IE
3380 if (ieLen > 0) {
3381 if( eSIR_SUCCESS != sirParseBeaconIE( pMac, beaconStruct, pIE, (tANI_U32)ieLen ))
3382 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003383 limLog( pMac, LOGE, FL("APCapExtract: Beacon parsing error!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003384 return eSIR_FAILURE;
3385 }
3386 }
3387
3388 return eSIR_SUCCESS;
3389}
3390
3391
3392/**
3393 * limDelBss()
3394 *
3395 *FUNCTION:
3396 * This function is called to delete BSS context at hardware
3397 * whenever a STA is disassociated
3398 *
3399 *LOGIC:
3400 *
3401 *ASSUMPTIONS:
3402 * NA
3403 *
3404 *NOTE:
3405 * NA
3406 *
3407 * @param pMac - Pointer to Global MAC structure
3408 * @param pStaDs - Pointer to the STA datastructure created by
3409 * LIM and maintained by DPH
3410 * @return retCode - Indicates success or failure return code
3411 */
3412
3413tSirRetStatus
3414limDelBss(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tANI_U16 bssIdx,tpPESession psessionEntry)
3415{
3416 tpDeleteBssParams pDelBssParams = NULL;
3417 tSirMsgQ msgQ;
3418 tSirRetStatus retCode = eSIR_SUCCESS;
3419
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303420 pDelBssParams = vos_mem_malloc(sizeof(tDeleteBssParams));
3421 if (NULL == pDelBssParams)
3422 {
3423 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003424 return eSIR_MEM_ALLOC_FAILED;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303425 }
3426 vos_mem_set((tANI_U8 *) pDelBssParams, sizeof(tDeleteBssParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003427
3428
3429 pDelBssParams->sessionId = psessionEntry->peSessionId; //update PE session Id
3430
3431 //DPH was storing the AssocID in staID field,
3432 //staID is actually assigned by HAL when AddSTA message is sent.
3433 if (pStaDs != NULL)
3434 {
3435 pDelBssParams->bssIdx= pStaDs->bssId;
3436 pStaDs->valid = 0;
3437 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
3438 }
3439 else
3440 pDelBssParams->bssIdx = bssIdx;
3441 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003442 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_BSS_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003443
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07003444 if((psessionEntry->peSessionId == pMac->lim.limTimers.gLimJoinFailureTimer.sessionId) &&
3445 (VOS_TRUE == tx_timer_running(&pMac->lim.limTimers.gLimJoinFailureTimer)))
3446 {
3447 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
3448 }
3449
Jeff Johnson295189b2012-06-20 16:38:30 -07003450 pDelBssParams->status= eHAL_STATUS_SUCCESS;
3451 pDelBssParams->respReqd = 1;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303452
3453 PELOGW(limLog( pMac, LOGW, FL("Sessionid %d : Sending HAL_DELETE_BSS_REQ "
3454 "for bss idx: %X BSSID:"MAC_ADDRESS_STR), pDelBssParams->sessionId,
3455 pDelBssParams->bssIdx,
3456 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003457
3458 //we need to defer the message until we get the response back from HAL.
3459 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
3460
3461 msgQ.type = WDA_DELETE_BSS_REQ;
3462 msgQ.reserved = 0;
3463 msgQ.bodyptr = pDelBssParams;
3464 msgQ.bodyval = 0;
3465
Jeff Johnsone7245742012-09-05 17:12:55 -07003466 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003467
3468 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
3469 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003470 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003471 limLog( pMac, LOGE, FL("Posting DELETE_BSS_REQ to HAL failed, reason=%X"), retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303472 vos_mem_free(pDelBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003473 }
3474
3475 return retCode;
3476}
3477
3478
Jeff Johnson295189b2012-06-20 16:38:30 -07003479
3480/**
3481 * limSendAddBss()
3482 *
3483 *FUNCTION:
3484 *
3485 *LOGIC:
3486 * 1) LIM receives eWNI_SME_JOIN_REQ
3487 * 2) For a valid eWNI_SME_JOIN_REQ, LIM sends
3488 * SIR_HAL_ADD_BSS_REQ to HAL
3489 *
3490 *ASSUMPTIONS:
3491 * JOIN REQ parameters are saved in pMac->lim.gLimMlmJoinReq
3492 * ADD BSS parameters can be obtained from two sources:
3493 * 1) pMac->lim.gLimMlmJoinReq
3494 * 2) beaconStruct, passed as paramter
3495 * So, if a reqd parameter is found in bssDescriptions
3496 * then it is given preference over beaconStruct
3497 *
3498 *NOTE:
3499 *
3500 * @param pMac Pointer to Global MAC structure
3501 * pAssocRsp contains the structured assoc/reassoc Response got from AP
3502 * beaconstruct Has the ProbeRsp/Beacon structured details
3503 * bssDescription bssDescription passed to PE from the SME
3504 * @return None
3505 */
3506
3507tSirRetStatus limStaSendAddBss( tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,
3508 tpSchBeaconStruct pBeaconStruct, tpSirBssDescription bssDescription, tANI_U8 updateEntry,
3509 tpPESession psessionEntry)
3510
3511{
3512 tSirMsgQ msgQ;
3513 tpAddBssParams pAddBssParams = NULL;
3514 tANI_U32 retCode;
3515 tANI_U8 i;
3516 tpDphHashNode pStaDs = NULL;
3517 tANI_U8 chanWidthSupp = 0;
krunal soni71343fb2013-09-16 16:16:26 -07003518 tANI_U32 shortGi20MhzSupport;
3519 tANI_U32 shortGi40MhzSupport;
Jeff Johnson295189b2012-06-20 16:38:30 -07003520 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303521 pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
3522 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003523 {
3524 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303525 FL( "Unable to allocate memory during ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003526 retCode = eSIR_MEM_ALLOC_FAILED;
3527 goto returnFailure;
3528 }
3529 else
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303530 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003531
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303532 vos_mem_copy(pAddBssParams->bssId,bssDescription->bssId,
3533 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003534 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303535 vos_mem_copy(pAddBssParams->selfMacAddr,
3536 psessionEntry->selfMacAddr,
3537 sizeof(tSirMacAddr));
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303538
3539 limLog(pMac, LOG1, FL("sessionid: %d updateEntry = %d limsystemrole = %d "),
3540 psessionEntry->smeSessionId,updateEntry,psessionEntry->limSystemRole);
3541
3542 limLog(pMac, LOG1, FL("BSSID: "MAC_ADDRESS_STR),
3543 MAC_ADDR_ARRAY(pAddBssParams->bssId));
3544
Jeff Johnson295189b2012-06-20 16:38:30 -07003545 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3546 {
3547 pAddBssParams->bssType = eSIR_BTAMP_AP_MODE;
3548 }
3549 else
3550 {
3551 pAddBssParams->bssType = eSIR_INFRASTRUCTURE_MODE;
3552 }
3553
3554 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
3555
3556 /* Update PE session ID */
3557 pAddBssParams->sessionId = psessionEntry->peSessionId;
3558
3559 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
3560
3561 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
3562 pAddBssParams->updateBss = updateEntry;
3563
3564
3565 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
3566 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
3567 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
3568 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
3569
3570 pAddBssParams->rateSet.numRates = pAssocRsp->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303571 vos_mem_copy(pAddBssParams->rateSet.rate,
3572 pAssocRsp->supportedRates.rate, pAssocRsp->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07003573
3574 pAddBssParams->nwType = bssDescription->nwType;
3575
Jeff Johnsone7245742012-09-05 17:12:55 -07003576 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -07003577 pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
3578 pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
3579 pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
3580 pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
3581
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303582 limLog(pMac, LOG2, FL(" BSS Type %d Beacon Interval: %d dtimPeriod: %d "
3583 "cfpCount: %d"),pAddBssParams->bssType, pAddBssParams->beaconInterval,
3584 pAddBssParams->dtimPeriod, pAddBssParams->cfParamSet.cfpCount);
3585
3586 limLog(pMac, LOG2, FL(" cfpPeriod: %d cfpMaxDuration: %d cfpDurRemaining:"
3587 " %d numRates: %d "),pAddBssParams->cfParamSet.cfpPeriod,
3588 pAddBssParams->cfParamSet.cfpMaxDuration,
3589 pAddBssParams->cfParamSet.cfpDurRemaining,
3590 pAddBssParams->rateSet.numRates);
3591
3592 limLog(pMac, LOG2, FL("nwType:%d shortSlotTimeSupported: %d"
3593 "llaCoexist: %d llbCoexist: %d llgCoexist: %d ht20Coexist: %d"),
3594 pAddBssParams->nwType, pAddBssParams->shortSlotTimeSupported,
3595 pAddBssParams->llaCoexist, pAddBssParams->llbCoexist,
3596 pAddBssParams->llgCoexist, pAddBssParams->ht20Coexist);
Jeff Johnson295189b2012-06-20 16:38:30 -07003597
3598 // Use the advertised capabilities from the received beacon/PR
3599
3600
3601 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pAssocRsp->HTCaps.present ))
3602 {
3603 pAddBssParams->htCapable = pAssocRsp->HTCaps.present;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303604 limLog(pMac, LOG2, FL("htCapable: %d"),pAddBssParams->htCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07003605 if ( pBeaconStruct->HTInfo.present )
3606 {
3607 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pAssocRsp->HTInfo.opMode;
3608 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pAssocRsp->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -07003609 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003610 if( (pAssocRsp->HTCaps.supportedChannelWidthSet) &&
3611 (chanWidthSupp) )
3612 {
3613 pAddBssParams->txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
3614 pAddBssParams->currentExtChannel = pAssocRsp->HTInfo.secondaryChannelOffset;
3615 }
3616 else
3617 {
3618 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003619 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003620 }
3621 pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent;
3622 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport;
3623 pAddBssParams->fRIFSMode = pAssocRsp->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303624
3625 limLog(pMac, LOG2, FL("htOperMode: %d dualCTSProtection: %d "
3626 "txChannelWidthSet: %d currentExtChannel: %d "),
3627 pAddBssParams->htOperMode, pAddBssParams->dualCTSProtection,
3628 pAddBssParams->txChannelWidthSet,pAddBssParams->currentExtChannel);
3629
3630 limLog(pMac, LOG2, FL("llnNonGFCoexist: %d "
3631 "fLsigTXOPProtectionFullSupport: %d fRIFSMode %d"),
3632 pAddBssParams->llnNonGFCoexist,
3633 pAddBssParams->fLsigTXOPProtectionFullSupport,
3634 pAddBssParams->fRIFSMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003635 }
3636 }
3637
3638 pAddBssParams->currentOperChannel = bssDescription->channelId;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303639 limLog(pMac, LOG2, FL("currentOperChannel %d"),
3640 pAddBssParams->currentOperChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07003641#ifdef WLAN_FEATURE_11AC
3642 if (psessionEntry->vhtCapability && ( pAssocRsp->VHTCaps.present ))
3643 {
3644 pAddBssParams->vhtCapable = pAssocRsp->VHTCaps.present;
3645 pAddBssParams->vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth;
3646 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003647 pAddBssParams->currentOperChannel,
3648 pAddBssParams->currentExtChannel,
3649 psessionEntry->apCenterChan,
3650 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003651 }
3652 else
3653 {
3654 pAddBssParams->vhtCapable = 0;
3655 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303656 limLog(pMac, LOG2, FL("vhtCapable %d vhtTxChannelWidthSet %d "
3657 "currentExtChannel %d"),pAddBssParams->vhtCapable,
3658 pAddBssParams->vhtTxChannelWidthSet,
3659 pAddBssParams->currentExtChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07003660#endif
3661
3662
Jeff Johnson295189b2012-06-20 16:38:30 -07003663 // Populate the STA-related parameters here
3664 // Note that the STA here refers to the AP
3665 {
3666 /* staType = PEER*/
3667 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
3668
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303669 vos_mem_copy(pAddBssParams->staContext.bssId,
3670 bssDescription->bssId,
3671 sizeof( tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003672 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
3673
3674 /* Fill Assoc id from the dph table */
3675 pStaDs = dphLookupHashEntry(pMac, pAddBssParams->staContext.bssId,
3676 &pAddBssParams->staContext.assocId, &psessionEntry->dph.dphHashTable);
3677 if (pStaDs == NULL)
3678 {
Arif Hussain24bafea2013-11-15 15:10:03 -08003679 PELOGE(limLog(pMac, LOGE, FL("Couldn't get assoc id for "
3680 "MAC ADDR: " MAC_ADDRESS_STR),
3681 MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003682 }
3683 pAddBssParams->staContext.uAPSD = 0;
3684 pAddBssParams->staContext.maxSPLen = 0;
3685 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortPreamble;
3686 pAddBssParams->staContext.updateSta = updateEntry;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303687
3688 limLog(pMac, LOG2, FL("StaContext: "MAC_ADDRESS_STR
3689 " shortPreambleSupported: %d"),
3690 MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac),
3691 pAddBssParams->staContext.shortPreambleSupported);
3692
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003693 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && pBeaconStruct->HTCaps.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003694 {
3695 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
3696 pAddBssParams->staContext.htCapable = 1;
3697 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 )pAssocRsp->HTCaps.greenField;
3698 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 )pAssocRsp->HTCaps.lsigTXOPProtection;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303699 limLog(pMac, LOG2,FL("StaContext htCapable: %d greenFieldCapable: %d "
3700 "lsigTxopProtection: %d"), pAddBssParams->staContext.htCapable,
3701 pAddBssParams->staContext.greenFieldCapable,
3702 pAddBssParams->staContext.lsigTxopProtection);
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003703#ifdef WLAN_FEATURE_11AC
3704 if (psessionEntry->vhtCapability && pBeaconStruct->VHTCaps.present)
3705 {
3706 pAddBssParams->staContext.vhtCapable = 1;
3707 if ((pAssocRsp->VHTCaps.suBeamFormerCap ||
3708 pAssocRsp->VHTCaps.muBeamformerCap) &&
3709 psessionEntry->txBFIniFeatureEnabled)
3710 {
3711 pAddBssParams->staContext.vhtTxBFCapable = 1;
3712 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05303713 if (pAssocRsp->VHTCaps.muBeamformerCap &&
3714 psessionEntry->txMuBformee )
3715 {
3716 pAddBssParams->staContext.vhtTxMUBformeeCapable = 1;
3717 limLog(pMac, LOG1,FL("Enabling MUBformeeCapable for peer"));
3718 /* Dont allow any other MuBf session as concurrency
3719 * is not supported
3720 */
3721 pMac->isMuBfsessionexist = TRUE;
3722 }
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003723 }
3724#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003725 if( (pAssocRsp->HTCaps.supportedChannelWidthSet) &&
3726 (chanWidthSupp) )
3727 {
3728 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07003729#ifdef WLAN_FEATURE_11AC
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003730 if (pAddBssParams->staContext.vhtCapable)
Jeff Johnsone7245742012-09-05 17:12:55 -07003731 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003732 pAddBssParams->staContext.vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth; //pMac->lim.apChanWidth;
3733 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303734 limLog(pMac, LOG2,FL("StaContext vhtCapable %d "
3735 "vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
3736 pAddBssParams->staContext.vhtCapable,
3737 pAddBssParams->staContext.vhtTxChannelWidthSet,
3738 pAddBssParams->staContext.vhtTxBFCapable);
Jeff Johnsone7245742012-09-05 17:12:55 -07003739#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003740 }
3741 else
3742 {
3743 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3744 }
3745 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pAssocRsp->HTCaps.mimoPowerSave;
3746 pAddBssParams->staContext.delBASupport = ( tANI_U8 )pAssocRsp->HTCaps.delayedBA;
3747 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 )pAssocRsp->HTCaps.maximalAMSDUsize;
3748 pAddBssParams->staContext.maxAmpduDensity = pAssocRsp->HTCaps.mpduDensity;
3749 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz;
krunal soni71343fb2013-09-16 16:16:26 -07003750 /*
3751 * We will check gShortGI20Mhz and gShortGI40Mhz from ini file.
3752 * if they are set then we will use what ever Assoc response coming
3753 * from AP supports. If these values are set as 0 in ini file then
3754 * we will hardcode this values to 0.
3755 */
3756 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
3757 (pMac, WNI_CFG_SHORT_GI_20MHZ,
3758 &shortGi20MhzSupport)))
3759 {
3760 if (VOS_TRUE == shortGi20MhzSupport)
3761 {
3762 pAddBssParams->staContext.fShortGI20Mhz =
3763 (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz;
3764 }
3765 else
3766 {
3767 pAddBssParams->staContext.fShortGI20Mhz = VOS_FALSE;
3768 }
3769 }
3770 else
3771 {
3772 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz"
3773 "CFG,setting value to default"));)
3774 pAddBssParams->staContext.fShortGI20Mhz =
3775 WNI_CFG_SHORT_GI_20MHZ_STADEF;
3776 }
3777
3778 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
3779 (pMac, WNI_CFG_SHORT_GI_40MHZ,
3780 &shortGi40MhzSupport)))
3781 {
3782 if (VOS_TRUE == shortGi40MhzSupport)
3783 {
3784 pAddBssParams->staContext.fShortGI40Mhz =
3785 (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz;
3786 }
3787 else
3788 {
3789 pAddBssParams->staContext.fShortGI40Mhz = VOS_FALSE;
3790 }
3791 }
3792 else
3793 {
3794 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz"
3795 "CFG,setting value to default"));)
3796 pAddBssParams->staContext.fShortGI40Mhz =
3797 WNI_CFG_SHORT_GI_40MHZ_STADEF;
3798 }
3799
Jeff Johnson295189b2012-06-20 16:38:30 -07003800 pAddBssParams->staContext.maxAmpduSize= pAssocRsp->HTCaps.maxRxAMPDUFactor;
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08003801 if( pAddBssParams->staContext.vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP )
3802 {
3803 pAddBssParams->staContext.htLdpcCapable = 0;
3804 pAddBssParams->staContext.vhtLdpcCapable = 0;
3805 }
3806 else
3807 {
3808 pAddBssParams->staContext.htLdpcCapable = (tANI_U8)pAssocRsp->HTCaps.advCodingCap;
3809 pAddBssParams->staContext.vhtLdpcCapable = (tANI_U8)pAssocRsp->VHTCaps.ldpcCodingCap;
3810 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08003811
Jeff Johnson295189b2012-06-20 16:38:30 -07003812 if( pBeaconStruct->HTInfo.present )
3813 pAddBssParams->staContext.rifsMode = pAssocRsp->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303814
3815 limLog(pMac, LOG2, FL("StaContext txChannelWidthSet: %d mimoPS: %d"
3816 " delBASupport: %d maxAmsduSize: %d"),
3817 pAddBssParams->staContext.txChannelWidthSet,
3818 pAddBssParams->staContext.mimoPS,
3819 pAddBssParams->staContext.delBASupport,
3820 pAddBssParams->staContext.maxAmsduSize);
3821
3822 limLog(pMac, LOG2, FL("maxAmpduDensity: %d fDsssCckMode40Mhz: %d "
3823 "fShortGI20Mhz: %d "),pAddBssParams->staContext.maxAmpduDensity,
3824 pAddBssParams->staContext.fDsssCckMode40Mhz,
3825 pAddBssParams->staContext.fShortGI20Mhz);
3826
3827 limLog(pMac, LOG2, FL("fShortGI40Mh: %d maxAmpduSize: %d "
3828 "htLdpcCapable: %d vhtLdpcCapable: %d"),
3829 pAddBssParams->staContext.fShortGI40Mhz,
3830 pAddBssParams->staContext.maxAmpduSize,
3831 pAddBssParams->staContext.htLdpcCapable,
3832 pAddBssParams->staContext.vhtLdpcCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07003833 }
3834
Pratik Bhalgatb5b19b02012-11-22 16:28:19 +05303835 //If WMM IE or 802.11E IE is not present and AP is HT AP then enable WMM
3836 if ((psessionEntry->limWmeEnabled && (pAssocRsp->wmeEdcaPresent || pAddBssParams->htCapable)) ||
3837 (psessionEntry->limQosEnabled && (pAssocRsp->edcaPresent || pAddBssParams->htCapable)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003838 pAddBssParams->staContext.wmmEnabled = 1;
3839 else
3840 pAddBssParams->staContext.wmmEnabled = 0;
3841
3842 //Update the rates
3843
3844 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3845 if (pStaDs != NULL)
3846 {
3847 limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303848 vos_mem_copy((tANI_U8*)&pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -07003849 (tANI_U8*)&pStaDs->supportedRates,
3850 sizeof(tSirSupportedRates));
3851 }
3852 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003853 PELOGE(limLog(pMac, LOGE, FL("could not Update the supported rates."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003854
3855 }
3856
3857 //Disable BA. It will be set as part of ADDBA negotiation.
3858 for( i = 0; i < STACFG_MAX_TC; i++ )
3859 {
3860 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
3861 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
3862 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
3863 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
3864 }
3865
3866 pAddBssParams->staContext.encryptType = psessionEntry->encryptType;
3867
3868#if defined WLAN_FEATURE_VOWIFI
3869 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303870 limLog(pMac, LOG2,FL("maxTxPower: %d"),
3871 pAddBssParams->maxTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07003872#endif
3873 // FIXME_GEN4 - Any other value that can be used for initialization?
3874 pAddBssParams->status = eHAL_STATUS_SUCCESS;
3875 pAddBssParams->respReqd = true;
3876
3877 pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
3878
Jeff Johnson295189b2012-06-20 16:38:30 -07003879 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona)
3880 {
3881 pAddBssParams->staContext.p2pCapableSta = 1;
3882 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003883
Bansidhar Gopalacharib099ac62013-06-12 19:02:39 -07003884 pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07003885
3886#if defined WLAN_FEATURE_VOWIFI_11R
3887 pAddBssParams->extSetStaKeyParamValid = 0;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303888 limLog(pMac, LOG2,FL("extSetStaKeyParamValid: %d"),
3889 pAddBssParams->extSetStaKeyParamValid);
Jeff Johnson295189b2012-06-20 16:38:30 -07003890#endif
3891
Chet Lanctot186b5732013-03-18 10:26:30 -07003892#ifdef WLAN_FEATURE_11W
3893 if (psessionEntry->limRmfEnabled)
3894 {
3895 pAddBssParams->rmfEnabled = 1;
3896 pAddBssParams->staContext.rmfEnabled = 1;
3897 }
3898#endif
3899
Jeff Johnson295189b2012-06-20 16:38:30 -07003900 // Set a new state for MLME
3901 if( eLIM_MLM_WT_ASSOC_RSP_STATE == psessionEntry->limMlmState )
3902 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE;
3903 else
3904 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003905 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003906
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303907 limLog(pMac, LOG2, FL("staContext wmmEnabled: %d encryptType: %d "
3908 "p2pCapableSta: %d"),pAddBssParams->staContext.wmmEnabled,
3909 pAddBssParams->staContext.encryptType,
3910 pAddBssParams->staContext.p2pCapableSta);
3911
3912 limLog(pMac, LOG2, FL("bSpectrumMgtEnabled: %d halPersona: %d setting "
3913 "LimMlm state to %d"), pAddBssParams->bSpectrumMgtEnabled,
3914 pAddBssParams->halPersona, psessionEntry->limMlmState);
3915
Jeff Johnson295189b2012-06-20 16:38:30 -07003916 //we need to defer the message until we get the response back from HAL.
3917 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
3918
3919 msgQ.type = WDA_ADD_BSS_REQ;
3920 /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
3921 msgQ.reserved = 0;
3922 msgQ.bodyptr = pAddBssParams;
3923 msgQ.bodyval = 0;
3924
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303925 limLog( pMac, LOG1, FL("SessionId:%d Sending SIR_HAL_ADD_BSS_REQ" ),
3926 psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -07003927 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003928
3929 retCode = wdaPostCtrlMsg( pMac, &msgQ );
3930 if( eSIR_SUCCESS != retCode)
3931 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003932 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303933 vos_mem_free(pAddBssParams);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003934 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003935 retCode );
3936 goto returnFailure;
3937
3938 }
3939 else
3940 return retCode;
3941
3942 returnFailure:
3943 // Clean-up will be done by the caller...
3944 return retCode;
3945}
3946
3947
3948
3949
3950tSirRetStatus limStaSendAddBssPreAssoc( tpAniSirGlobal pMac, tANI_U8 updateEntry, tpPESession psessionEntry)
3951{
3952 tSirMsgQ msgQ;
3953 tpAddBssParams pAddBssParams = NULL;
3954 tANI_U32 retCode;
3955 tANI_U8 i;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003956 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -07003957 tANI_U8 chanWidthSupp = 0;
krunal soni71343fb2013-09-16 16:16:26 -07003958 tANI_U32 shortGi20MhzSupport;
3959 tANI_U32 shortGi40MhzSupport;
Jeff Johnson295189b2012-06-20 16:38:30 -07003960 tpSirBssDescription bssDescription = &psessionEntry->pLimJoinReq->bssDescription;
3961
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303962 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
3963 if (NULL == pBeaconStruct)
Jeff Johnson32d95a32012-09-10 13:15:23 -07003964 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303965 limLog(pMac, LOGE, FL("Unable to allocate memory during ADD_BSS") );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003966 return eSIR_MEM_ALLOC_FAILED;
3967 }
3968
Jeff Johnson295189b2012-06-20 16:38:30 -07003969
3970 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303971 pAddBssParams = vos_mem_malloc(sizeof(tAddBssParams));
3972 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003973 {
3974 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303975 FL( "Unable to allocate memory during ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003976 retCode = eSIR_MEM_ALLOC_FAILED;
3977 goto returnFailure;
3978 }
3979
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303980 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003981
3982
3983 limExtractApCapabilities( pMac,
3984 (tANI_U8 *) bssDescription->ieFields,
3985 limGetIElenFromBssDescription( bssDescription ),
Jeff Johnson32d95a32012-09-10 13:15:23 -07003986 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07003987
3988 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Jeff Johnson32d95a32012-09-10 13:15:23 -07003989 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303990 vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
3991 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003992
3993 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303994 vos_mem_copy(pAddBssParams->selfMacAddr,
3995 psessionEntry->selfMacAddr,
3996 sizeof(tSirMacAddr));
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303997 limLog(pMac, LOG1, FL("sessionid: %d updateEntry = %d limsystemrole = %d "),
3998 psessionEntry->smeSessionId,updateEntry,psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003999
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304000 limLog(pMac, LOG1, FL("BSSID: "MAC_ADDRESS_STR),
4001 MAC_ADDR_ARRAY(pAddBssParams->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07004002 /* Incorrect BSS Type which caused UMA Descriptor to be overwritten on
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304003 * top of an already established Infra link. This lead to issues in
Jeff Johnson295189b2012-06-20 16:38:30 -07004004 * concurrent data transfer.
4005 */
4006
4007 pAddBssParams->bssType = psessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
4008 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
4009
4010 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
4011
Jeff Johnson32d95a32012-09-10 13:15:23 -07004012 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07004013 pAddBssParams->updateBss = updateEntry;
4014
4015
Jeff Johnson32d95a32012-09-10 13:15:23 -07004016 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
4017 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
4018 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
4019 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -07004020
4021
Jeff Johnson32d95a32012-09-10 13:15:23 -07004022 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304023 vos_mem_copy(pAddBssParams->rateSet.rate,
4024 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07004025
4026 pAddBssParams->nwType = bssDescription->nwType;
4027
Jeff Johnson32d95a32012-09-10 13:15:23 -07004028 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -07004029 pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
4030 pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
4031 pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304032 pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
Jeff Johnson295189b2012-06-20 16:38:30 -07004033
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304034 limLog(pMac, LOG2, FL(" BSS Type %d Beacon Interval: %d dtimPeriod: %d "
4035 "cfpCount: %d"),pAddBssParams->bssType, pAddBssParams->beaconInterval,
4036 pAddBssParams->dtimPeriod, pAddBssParams->cfParamSet.cfpCount);
4037
4038 limLog(pMac, LOG2, FL(" cfpPeriod: %d cfpMaxDuration: %d cfpDurRemaining:"
4039 " %d numRates: %d "),pAddBssParams->cfParamSet.cfpPeriod,
4040 pAddBssParams->cfParamSet.cfpMaxDuration,
4041 pAddBssParams->cfParamSet.cfpDurRemaining,
4042 pAddBssParams->rateSet.numRates);
4043
4044 limLog(pMac, LOG2, FL("nwType:%d shortSlotTimeSupported: %d"
4045 "llaCoexist: %d llbCoexist: %d llgCoexist: %d ht20Coexist: %d"),
4046 pAddBssParams->nwType, pAddBssParams->shortSlotTimeSupported,
4047 pAddBssParams->llaCoexist, pAddBssParams->llbCoexist,
4048 pAddBssParams->llgCoexist, pAddBssParams->ht20Coexist);
Jeff Johnson295189b2012-06-20 16:38:30 -07004049 // Use the advertised capabilities from the received beacon/PR
Jeff Johnson32d95a32012-09-10 13:15:23 -07004050 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -07004051 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004052 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304053 limLog(pMac, LOG2, FL("htCapable: %d"),pAddBssParams->htCapable);
Jeff Johnson32d95a32012-09-10 13:15:23 -07004054 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07004055 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004056 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
4057 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -07004058
Jeff Johnson295189b2012-06-20 16:38:30 -07004059 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
Jeff Johnson32d95a32012-09-10 13:15:23 -07004060 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07004061 (chanWidthSupp) )
4062 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004063 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
4064 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07004065 }
4066 else
4067 {
4068 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004069 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07004070 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07004071 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
4072 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
4073 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304074
4075 limLog(pMac, LOG2, FL("htOperMode: %d dualCTSProtection: %d "
4076 "txChannelWidthSet: %d currentExtChannel: %d "),
4077 pAddBssParams->htOperMode, pAddBssParams->dualCTSProtection,
4078 pAddBssParams->txChannelWidthSet,pAddBssParams->currentExtChannel);
4079
4080 limLog(pMac, LOG2, FL("llnNonGFCoexist: %d "
4081 "fLsigTXOPProtectionFullSupport: %d fRIFSMode %d"),
4082 pAddBssParams->llnNonGFCoexist,
4083 pAddBssParams->fLsigTXOPProtectionFullSupport,
4084 pAddBssParams->fRIFSMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07004085 }
4086 }
4087
4088 pAddBssParams->currentOperChannel = bssDescription->channelId;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304089 limLog(pMac, LOG2, FL("currentOperChannel %d"),
4090 pAddBssParams->currentOperChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07004091#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07004092 if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present ))
Jeff Johnsone7245742012-09-05 17:12:55 -07004093 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004094 pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
4095 pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004096 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
4097 pAddBssParams->currentOperChannel,
4098 pAddBssParams->currentExtChannel,
4099 psessionEntry->apCenterChan,
4100 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07004101 }
4102 else
4103 {
4104 pAddBssParams->vhtCapable = 0;
4105 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304106 limLog(pMac, LOG2, FL("vhtCapable %d vhtTxChannelWidthSet %d "
4107 "currentExtChannel %d"),pAddBssParams->vhtCapable,
4108 pAddBssParams->vhtTxChannelWidthSet,
4109 pAddBssParams->currentExtChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07004110#endif
4111
Jeff Johnson295189b2012-06-20 16:38:30 -07004112 // Populate the STA-related parameters here
4113 // Note that the STA here refers to the AP
4114 {
4115 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
4116
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304117 vos_mem_copy(pAddBssParams->staContext.bssId,
4118 bssDescription->bssId,
4119 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004120 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
4121
4122 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
4123 pAddBssParams->staContext.uAPSD = 0;
4124 pAddBssParams->staContext.maxSPLen = 0;
Jeff Johnson32d95a32012-09-10 13:15:23 -07004125 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -07004126 pAddBssParams->staContext.updateSta = updateEntry;
4127
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304128 limLog(pMac, LOG2, FL("StaContext: "MAC_ADDRESS_STR
4129 " shortPreambleSupported: %d"),
4130 MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac),
4131 pAddBssParams->staContext.shortPreambleSupported);
4132
Jeff Johnson32d95a32012-09-10 13:15:23 -07004133 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -07004134 {
4135 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
4136 pAddBssParams->staContext.htCapable = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07004137 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
4138 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304139 limLog(pMac, LOG2, FL("StaContext htCapable: %d "
4140 "greenFieldCapable: %d lsigTxopProtection: %d"),
4141 pAddBssParams->staContext.htCapable,
4142 pAddBssParams->staContext.greenFieldCapable,
4143 pAddBssParams->staContext.lsigTxopProtection);
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004144#ifdef WLAN_FEATURE_11AC
4145 if (psessionEntry->vhtCapability && pBeaconStruct->VHTCaps.present)
4146 {
4147 pAddBssParams->staContext.vhtCapable = 1;
4148 if ((pBeaconStruct->VHTCaps.suBeamFormerCap ||
4149 pBeaconStruct->VHTCaps.muBeamformerCap) &&
4150 psessionEntry->txBFIniFeatureEnabled )
4151 {
4152 pAddBssParams->staContext.vhtTxBFCapable = 1;
4153 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05304154 if (pBeaconStruct->VHTCaps.muBeamformerCap &&
4155 psessionEntry->txMuBformee )
4156 {
4157 pAddBssParams->staContext.vhtTxMUBformeeCapable = 1;
4158 limLog(pMac, LOG1,FL("Enabling MUBformeeCapable for peer"));
4159 /* Dont allow any other MuBf session as concurrency
4160 * is not supported
4161 */
4162 pMac->isMuBfsessionexist = TRUE;
4163 }
4164
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004165 }
4166#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07004167 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07004168 (chanWidthSupp) )
4169 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004170 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004171#ifdef WLAN_FEATURE_11AC
4172 if (pAddBssParams->staContext.vhtCapable)
Jeff Johnsone7245742012-09-05 17:12:55 -07004173 {
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004174 pAddBssParams->staContext.vhtTxChannelWidthSet =
4175 pBeaconStruct->VHTOperation.chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -07004176 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304177 limLog(pMac, LOG2,FL("StaContext vhtCapable %d "
4178 "vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
4179 pAddBssParams->staContext.vhtCapable,
4180 pAddBssParams->staContext.vhtTxChannelWidthSet,
4181 pAddBssParams->staContext.vhtTxBFCapable);
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004182#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004183 }
4184 else
4185 {
4186 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4187 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07004188 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
4189 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
4190 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
4191 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
4192 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
krunal soni71343fb2013-09-16 16:16:26 -07004193 /*
4194 * We will check gShortGI20Mhz and gShortGI40Mhz from ini file.
4195 * if they are set then we will use what ever Beacon coming from AP
4196 * supports. If these values are set as 0 in ini file then
4197 * we will hardcode this values to 0.
4198 */
4199 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
4200 (pMac, WNI_CFG_SHORT_GI_20MHZ,
4201 &shortGi20MhzSupport)))
4202 {
4203 if (VOS_TRUE == shortGi20MhzSupport)
4204 {
4205 pAddBssParams->staContext.fShortGI20Mhz =
4206 (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
4207 }
4208 else
4209 {
4210 pAddBssParams->staContext.fShortGI20Mhz = VOS_FALSE;
4211 }
4212 }
4213 else
4214 {
4215 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz"
4216 "CFG,setting value to default"));)
4217 pAddBssParams->staContext.fShortGI20Mhz =
4218 WNI_CFG_SHORT_GI_20MHZ_STADEF;
4219 }
4220
4221 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
4222 (pMac, WNI_CFG_SHORT_GI_40MHZ,
4223 &shortGi40MhzSupport)))
4224 {
4225 if (VOS_TRUE == shortGi40MhzSupport)
4226 {
4227 pAddBssParams->staContext.fShortGI40Mhz =
4228 (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
4229 }
4230 else
4231 {
4232 pAddBssParams->staContext.fShortGI40Mhz = VOS_FALSE;
4233 }
4234 }
4235 else
4236 {
4237 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz"
4238 "CFG,setting value to default"));)
4239 pAddBssParams->staContext.fShortGI40Mhz =
4240 WNI_CFG_SHORT_GI_40MHZ_STADEF;
4241 }
4242
Jeff Johnson32d95a32012-09-10 13:15:23 -07004243 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08004244 if( pAddBssParams->staContext.vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP )
4245 {
4246 pAddBssParams->staContext.htLdpcCapable = 0;
4247 pAddBssParams->staContext.vhtLdpcCapable = 0;
4248 }
4249 else
4250 {
4251 pAddBssParams->staContext.htLdpcCapable = (tANI_U8)pBeaconStruct->HTCaps.advCodingCap;
4252 pAddBssParams->staContext.vhtLdpcCapable = (tANI_U8)pBeaconStruct->VHTCaps.ldpcCodingCap;
4253 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004254
Jeff Johnson32d95a32012-09-10 13:15:23 -07004255 if( pBeaconStruct->HTInfo.present )
4256 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304257 limLog(pMac, LOG2, FL("StaContext txChannelWidthSet: %d mimoPS: %d"
4258 " delBASupport: %d maxAmsduSize: %d"),
4259 pAddBssParams->staContext.txChannelWidthSet,
4260 pAddBssParams->staContext.mimoPS,
4261 pAddBssParams->staContext.delBASupport,
4262 pAddBssParams->staContext.maxAmsduSize);
4263
4264 limLog(pMac, LOG2, FL("maxAmpduDensity: %d fDsssCckMode40Mhz: %d "
4265 "fShortGI20Mhz: %d "),pAddBssParams->staContext.maxAmpduDensity,
4266 pAddBssParams->staContext.fDsssCckMode40Mhz,
4267 pAddBssParams->staContext.fShortGI20Mhz);
4268
4269 limLog(pMac, LOG2, FL("fShortGI40Mh: %d maxAmpduSize: %d "
4270 "htLdpcCapable: %d vhtLdpcCapable: %d"),
4271 pAddBssParams->staContext.fShortGI40Mhz,
4272 pAddBssParams->staContext.maxAmpduSize,
4273 pAddBssParams->staContext.htLdpcCapable,
4274 pAddBssParams->staContext.vhtLdpcCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07004275 }
4276
Pratik Bhalgatb5b19b02012-11-22 16:28:19 +05304277 //If WMM IE or 802.11E IE is not present and AP is HT AP then enable WMM
4278 if ((psessionEntry->limWmeEnabled && (pBeaconStruct->wmeEdcaPresent || pAddBssParams->staContext.htCapable)) ||
4279 (psessionEntry->limQosEnabled && (pBeaconStruct->edcaPresent || pAddBssParams->staContext.htCapable)))
Jeff Johnson295189b2012-06-20 16:38:30 -07004280 pAddBssParams->staContext.wmmEnabled = 1;
4281 else
4282 pAddBssParams->staContext.wmmEnabled = 0;
4283
4284 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -07004285#ifdef WLAN_FEATURE_11AC
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,
4288 &pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -07004289#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07004290 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson32d95a32012-09-10 13:15:23 -07004291 pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07004292#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004293 limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,psessionEntry);
4294
4295 }
4296
4297
4298 //Disable BA. It will be set as part of ADDBA negotiation.
4299 for( i = 0; i < STACFG_MAX_TC; i++ )
4300 {
4301 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
4302 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
4303 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
4304 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
4305 }
4306
4307 pAddBssParams->staContext.encryptType = psessionEntry->encryptType;
4308
4309#if defined WLAN_FEATURE_VOWIFI
4310 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304311 limLog(pMac, LOG2,FL("maxTxPower: %d"),
4312 pAddBssParams->maxTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07004313#endif
4314
4315 pAddBssParams->status = eHAL_STATUS_SUCCESS;
4316 pAddBssParams->respReqd = true;
4317
4318 pAddBssParams->staContext.sessionId = psessionEntry->peSessionId;
4319 pAddBssParams->sessionId = psessionEntry->peSessionId;
4320
4321 pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
4322
Bansidhar Gopalacharib099ac62013-06-12 19:02:39 -07004323 pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07004324
4325#if defined WLAN_FEATURE_VOWIFI_11R
4326 pAddBssParams->extSetStaKeyParamValid = 0;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304327 limLog(pMac, LOG2,FL("extSetStaKeyParamValid: %d"),
4328 pAddBssParams->extSetStaKeyParamValid);
Jeff Johnson295189b2012-06-20 16:38:30 -07004329#endif
4330
Chet Lanctot186b5732013-03-18 10:26:30 -07004331#ifdef WLAN_FEATURE_11W
4332 if (psessionEntry->limRmfEnabled)
4333 {
4334 pAddBssParams->rmfEnabled = 1;
4335 pAddBssParams->staContext.rmfEnabled = 1;
4336 }
4337#endif
4338
Jeff Johnson295189b2012-06-20 16:38:30 -07004339 // Set a new state for MLME
4340
4341 //pMac->lim.gLimMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
4342 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
4343
Jeff Johnsone7245742012-09-05 17:12:55 -07004344 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004345
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304346 limLog(pMac, LOG2, FL("staContext wmmEnabled: %d encryptType: %d "
4347 "p2pCapableSta: %d"),pAddBssParams->staContext.wmmEnabled,
4348 pAddBssParams->staContext.encryptType,
4349 pAddBssParams->staContext.p2pCapableSta);
4350
4351 limLog(pMac, LOG2, FL("bSpectrumMgtEnabled: %d halPersona: %d setting "
4352 "LimMlm state to %d"), pAddBssParams->bSpectrumMgtEnabled,
4353 pAddBssParams->halPersona, psessionEntry->limMlmState);
4354
Jeff Johnson295189b2012-06-20 16:38:30 -07004355 //we need to defer the message until we get the response back from HAL.
4356 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
4357
4358 msgQ.type = WDA_ADD_BSS_REQ;
4359 /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
4360 msgQ.reserved = 0;
4361 msgQ.bodyptr = pAddBssParams;
4362 msgQ.bodyval = 0;
4363
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05304364 limLog( pMac, LOG1, FL( "SessionId:%d Sending SIR_HAL_ADD_BSS_REQ" ),
4365 psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -07004366 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004367
4368 retCode = wdaPostCtrlMsg( pMac, &msgQ );
4369 if( eSIR_SUCCESS != retCode)
4370 {
Jeff Johnsone7245742012-09-05 17:12:55 -07004371 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304372 vos_mem_free(pAddBssParams);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004373 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004374 retCode );
4375 goto returnFailure;
4376
4377 }
4378 else
Jeff Johnson32d95a32012-09-10 13:15:23 -07004379 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304380 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004381 return retCode;
Jeff Johnson32d95a32012-09-10 13:15:23 -07004382 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004383
4384 returnFailure:
4385 // Clean-up will be done by the caller...
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304386 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004387 return retCode;
4388}
4389
4390
4391
4392
4393
Jeff Johnson295189b2012-06-20 16:38:30 -07004394
4395/** -------------------------------------------------------------
4396\fn limPrepareAndSendDelStaCnf
4397\brief deletes DPH entry
4398 changes the MLM mode for station.
4399 calls limSendDelStaCnf
4400\param tpAniSirGlobal pMac
4401\param tpDphHashNode pStaDs
4402\return none
4403 -------------------------------------------------------------*/
4404
4405
4406void
4407limPrepareAndSendDelStaCnf(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tSirResultCodes statusCode,tpPESession psessionEntry)
4408{
4409 tANI_U16 staDsAssocId = 0;
4410 tSirMacAddr staDsAddr;
4411 tLimMlmStaContext mlmStaContext;
4412
4413 if(pStaDs == NULL)
4414 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004415 PELOGW(limLog(pMac, LOGW, FL("pStaDs is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004416 return;
4417 }
4418 staDsAssocId = pStaDs->assocId;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304419 vos_mem_copy((tANI_U8 *)staDsAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07004420 pStaDs->staAddr,
4421 sizeof(tSirMacAddr));
4422
4423 mlmStaContext = pStaDs->mlmStaContext;
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304424 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
4425 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004426 {
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304427 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004428 }
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304429 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4430
4431 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4432 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004433 {
4434 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304435 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE,
4436 psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004437 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004438 limSendDelStaCnf(pMac, staDsAddr, staDsAssocId, mlmStaContext, statusCode,psessionEntry);
4439}
4440
4441/** -------------------------------------------------------------
4442\fn limGetStaRateMode
4443\brief Gets the Station Rate Mode.
4444\param tANI_U8 dot11Mode
4445\return none
4446 -------------------------------------------------------------*/
4447tStaRateMode limGetStaRateMode(tANI_U8 dot11Mode)
4448{
4449 switch(dot11Mode)
4450 {
4451 case WNI_CFG_DOT11_MODE_11A:
4452 return eSTA_11a;
4453 case WNI_CFG_DOT11_MODE_11B:
4454 return eSTA_11b;
4455 case WNI_CFG_DOT11_MODE_11G:
4456 return eSTA_11bg;
4457 case WNI_CFG_DOT11_MODE_11N:
4458 return eSTA_11n;
Jeff Johnsone7245742012-09-05 17:12:55 -07004459#ifdef WLAN_FEATURE_11AC
4460 case WNI_CFG_DOT11_MODE_11AC:
4461 return eSTA_11ac;
4462#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004463 case WNI_CFG_DOT11_MODE_ALL:
4464 default:
4465 return eSTA_11n;
4466
4467 }
4468}
4469
4470/** -------------------------------------------------------------
4471\fn limInitPreAuthTimerTable
4472\brief Initialize the Pre Auth Tanle and creates the timer for
4473 each node for the timeout value got from cfg.
4474\param tpAniSirGlobal pMac
4475\param tpLimPreAuthTable pPreAuthTimerTable
4476\return none
4477 -------------------------------------------------------------*/
4478void limInitPreAuthTimerTable(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable)
4479{
4480 tANI_U32 cfgValue;
4481 tANI_U32 authNodeIdx;
4482 tpLimPreAuthNode pAuthNode = pPreAuthTimerTable->pTable;
4483
4484 // Get AUTH_RSP Timers value
4485
4486 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT,
4487 &cfgValue) != eSIR_SUCCESS)
4488 {
4489 /*
4490 ** Could not get AUTH_RSP timeout value
4491 ** from CFG. Log error.
4492 **/
4493 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004494 FL("could not retrieve AUTH_RSP timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004495 return;
4496 }
4497
4498 cfgValue = SYS_MS_TO_TICKS(cfgValue);
4499 for(authNodeIdx=0; authNodeIdx<pPreAuthTimerTable->numEntry; authNodeIdx++, pAuthNode++)
4500 {
4501 if (tx_timer_create(&pAuthNode->timer,
4502 "AUTH RESPONSE TIMEOUT",
4503 limAuthResponseTimerHandler,
4504 authNodeIdx,
4505 cfgValue,
4506 0,
4507 TX_NO_ACTIVATE) != TX_SUCCESS)
4508 {
4509 // Cannot create timer. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004510 limLog(pMac, LOGP, FL("Cannot create Auth Rsp timer of Index :%d."), authNodeIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07004511 return;
4512 }
4513 pAuthNode->authNodeIdx = (tANI_U8)authNodeIdx;
4514 pAuthNode->fFree = 1;
4515 }
4516
4517}
4518
4519/** -------------------------------------------------------------
4520\fn limAcquireFreePreAuthNode
4521\brief Retrives a free Pre Auth node from Pre Auth Table.
4522\param tpAniSirGlobal pMac
4523\param tpLimPreAuthTable pPreAuthTimerTable
4524\return none
4525 -------------------------------------------------------------*/
4526tLimPreAuthNode * limAcquireFreePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable)
4527{
4528 tANI_U32 i;
4529 tLimPreAuthNode *pTempNode = pPreAuthTimerTable->pTable;
4530 for (i=0; i<pPreAuthTimerTable->numEntry; i++,pTempNode++)
4531 {
4532 if (pTempNode->fFree == 1)
4533 {
4534 pTempNode->fFree = 0;
4535 return pTempNode;
4536 }
4537 }
4538
4539 return NULL;
4540}
4541
4542/** -------------------------------------------------------------
4543\fn limGetPreAuthNodeFromIndex
4544\brief Depending on the Index this retrives the pre auth node.
4545\param tpAniSirGlobal pMac
4546\param tpLimPreAuthTable pAuthTable
4547\param tANI_U32 authNodeIdx
4548\return none
4549 -------------------------------------------------------------*/
4550tLimPreAuthNode * limGetPreAuthNodeFromIndex(tpAniSirGlobal pMac,
4551 tpLimPreAuthTable pAuthTable, tANI_U32 authNodeIdx)
4552{
4553 if ((authNodeIdx >= pAuthTable->numEntry) || (pAuthTable->pTable == NULL))
4554 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004555 limLog(pMac, LOGE, FL("Invalid Auth Timer Index : %d NumEntry : %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004556 authNodeIdx, pAuthTable->numEntry);
4557 return NULL;
4558 }
4559
4560 return pAuthTable->pTable + authNodeIdx;
4561}
4562
4563/* Util API to check if the channels supported by STA is within range */
4564tSirRetStatus limIsDot11hSupportedChannelsValid(tpAniSirGlobal pMac, tSirAssocReq *assoc)
4565{
4566 /*
4567 * Allow all the stations to join with us.
4568 * 802.11h-2003 11.6.1 => An AP may use the supported channels list for associated STAs
4569 * as an input into an algorithm used to select a new channel for the BSS.
4570 * The specification of the algorithm is beyond the scope of this amendment.
4571 */
4572
4573 return (eSIR_SUCCESS);
4574}
4575
4576/* Util API to check if the txpower supported by STA is within range */
4577tSirRetStatus limIsDot11hPowerCapabilitiesInRange(tpAniSirGlobal pMac, tSirAssocReq *assoc,tpPESession psessionEntry)
4578{
4579 tPowerdBm localMaxTxPower;
4580 tANI_U32 localPwrConstraint;
4581
4582 localMaxTxPower = cfgGetRegulatoryMaxTransmitPower(pMac, psessionEntry->currentOperChannel);
4583
4584 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004585 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004586 return eSIR_FAILURE;
4587 }
4588 localMaxTxPower -= (tPowerdBm)localPwrConstraint;
4589
4590 /**
4591 * The min Tx Power of the associating station should not be greater than (regulatory
4592 * max tx power - local power constraint configured on AP).
4593 */
4594 if(assoc->powerCapability.minTxPower > localMaxTxPower)
4595 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004596 limLog(pMac, LOGW, FL("minTxPower (STA) = %d, localMaxTxPower (AP) = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004597 assoc->powerCapability.minTxPower, localMaxTxPower);
4598 return (eSIR_FAILURE);
4599 }
4600
4601 return (eSIR_SUCCESS);
4602}
4603
4604/** -------------------------------------------------------------
4605\fn limFillRxHighestSupportedRate
4606\brief Fills in the Rx Highest Supported Data Rate field from
4607\ the 'supported MCS set' field in HT capability element.
4608\param tpAniSirGlobal pMac
4609\param tpSirSupportedRates pRates
4610\param tANI_U8* pSupportedMCSSet
4611\return none
4612 -------------------------------------------------------------*/
4613void limFillRxHighestSupportedRate(tpAniSirGlobal pMac, tANI_U16 *rxHighestRate, tANI_U8* pSupportedMCSSet)
4614{
4615 tSirMacRxHighestSupportRate *pRxHighestRate;
4616 tANI_U8 *pBuf;
4617 tANI_U16 rate=0;
4618
4619 pBuf = pSupportedMCSSet + MCS_RX_HIGHEST_SUPPORTED_RATE_BYTE_OFFSET;
4620 rate = limGetU16(pBuf);
4621
4622 pRxHighestRate = (tSirMacRxHighestSupportRate *) &rate;
4623 *rxHighestRate = pRxHighestRate->rate;
4624
4625 return;
4626}
Chet Lanctot186b5732013-03-18 10:26:30 -07004627
4628#ifdef WLAN_FEATURE_11W
4629/** -------------------------------------------------------------
4630\fn limSendSmeUnprotectedMgmtFrameInd
4631\brief Forwards the unprotected management frame to SME.
4632\param tpAniSirGlobal pMac
4633\param frameType - 802.11 frame type
4634\param frame - frame buffer
4635\param sessionId - id for the current session
4636\param psessionEntry - PE session context
4637\return none
4638 -------------------------------------------------------------*/
4639void limSendSmeUnprotectedMgmtFrameInd(
4640 tpAniSirGlobal pMac, tANI_U8 frameType,
4641 tANI_U8 *frame, tANI_U32 frameLen, tANI_U16 sessionId,
4642 tpPESession psessionEntry)
4643{
4644 tSirMsgQ mmhMsg;
4645 tSirSmeUnprotMgmtFrameInd * pSirSmeMgmtFrame = NULL;
4646 tANI_U16 length;
4647
4648 length = sizeof(tSirSmeUnprotMgmtFrameInd) + frameLen;
4649
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304650 pSirSmeMgmtFrame = vos_mem_malloc(length);
4651 if (NULL == pSirSmeMgmtFrame)
Chet Lanctot186b5732013-03-18 10:26:30 -07004652 {
4653 limLog(pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304654 FL("AllocateMemory failed for tSirSmeUnprotectedMgmtFrameInd"));
Chet Lanctot186b5732013-03-18 10:26:30 -07004655 return;
4656 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304657 vos_mem_set((void*)pSirSmeMgmtFrame, length, 0);
Chet Lanctot186b5732013-03-18 10:26:30 -07004658
4659 pSirSmeMgmtFrame->sessionId = sessionId;
4660 pSirSmeMgmtFrame->frameType = frameType;
4661
4662 vos_mem_copy(pSirSmeMgmtFrame->frameBuf, frame, frameLen);
4663 pSirSmeMgmtFrame->frameLen = frameLen;
4664
4665 mmhMsg.type = eWNI_SME_UNPROT_MGMT_FRM_IND;
4666 mmhMsg.bodyptr = pSirSmeMgmtFrame;
4667 mmhMsg.bodyval = 0;
4668
4669 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
4670 return;
4671}
4672#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004673
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004674#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004675/** -------------------------------------------------------------
4676\fn limSendSmeTsmIEInd
4677\brief Forwards the TSM IE information to SME.
4678\param tpAniSirGlobal pMac
4679\param psessionEntry - PE session context
4680\param tid - traffic id
4681\param state - tsm state (enabled/disabled)
4682\param measurementInterval - measurement interval
4683\return none
4684 -------------------------------------------------------------*/
4685void limSendSmeTsmIEInd(tpAniSirGlobal pMac, tpPESession psessionEntry,
4686 tANI_U8 tid, tANI_U8 state, tANI_U16 measInterval)
4687{
4688 tSirMsgQ mmhMsg;
4689 tpSirSmeTsmIEInd pSirSmeTsmIeInd = NULL;
4690
4691 if (!pMac || !psessionEntry)
4692 {
4693 return;
4694 }
4695 pSirSmeTsmIeInd = vos_mem_malloc(sizeof(tSirSmeTsmIEInd));
4696 if (NULL == pSirSmeTsmIeInd)
4697 {
4698 limLog(pMac, LOGP,
4699 FL("AllocateMemory failed for tSirSmeTsmIEInd"));
4700 return;
4701 }
4702 vos_mem_set((void*)pSirSmeTsmIeInd, sizeof(tSirSmeTsmIEInd), 0);
4703
4704 pSirSmeTsmIeInd->sessionId = psessionEntry->smeSessionId;
4705 pSirSmeTsmIeInd->tsmIe.tsid = tid;
4706 pSirSmeTsmIeInd->tsmIe.state= state;
4707 pSirSmeTsmIeInd->tsmIe.msmt_interval= measInterval;
4708
4709 mmhMsg.type = eWNI_SME_TSM_IE_IND;
4710 mmhMsg.bodyptr = pSirSmeTsmIeInd;
4711 mmhMsg.bodyval = 0;
4712
4713 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
4714 return;
4715}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004716#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004717
4718