blob: bde93a73ed27c5d2e47dde80cc12ec5699f049ba [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;
901
902 smesessionId = psessionEntry->smeSessionId;
903 smetransactionId = psessionEntry->transactionId;
904
905 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700906 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700907
Jeff Johnsone7245742012-09-05 17:12:55 -0700908 //if it is a reassoc failure to join new AP
Madan Mohan Koyyalamudif33324b2012-11-06 19:16:17 -0800909 if((mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE) ||
910 (mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_FAILURE))
Jeff Johnsone7245742012-09-05 17:12:55 -0700911 {
912 if(mlmStaContext.resultCode != eSIR_SME_SUCCESS )
913 {
914 peDeleteSession(pMac, psessionEntry);
915 psessionEntry = NULL;
916 }
917
918 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
919 mlmStaContext.resultCode, mlmStaContext.protStatusCode, psessionEntry,
920 smesessionId, smetransactionId);
921 }
922 else
923 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530924 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700925 psessionEntry->pLimJoinReq = NULL;
926
927 if(mlmStaContext.resultCode != eSIR_SME_SUCCESS)
928 {
929 peDeleteSession(pMac,psessionEntry);
930 psessionEntry = NULL;
931 }
932
933 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, mlmStaContext.resultCode, mlmStaContext.protStatusCode,
934 psessionEntry, smesessionId, smetransactionId);
Jeff Johnsone7245742012-09-05 17:12:55 -0700935 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700936
937 }
938
939 if((NULL != psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700940 && (eLIM_AP_ROLE != psessionEntry->limSystemRole )
Jeff Johnson295189b2012-06-20 16:38:30 -0700941 )
942 {
943 peDeleteSession(pMac,psessionEntry);
944 psessionEntry = NULL;
945 }
946}
947
948/**
949 * limRejectAssociation()
950 *
951 *FUNCTION:
952 * This function is called whenever Re/Association Request need
953 * to be rejected due to failure in assigning an AID or failure
954 * in adding STA context at Polaris or reject by applications.
955 *
956 *LOGIC:
957 * Resources allocated if any are freedup and (Re) Association
958 * Response frame is sent to requesting STA. Pre-Auth context
959 * will be added for this STA if it does not exist already
960 *
961 *ASSUMPTIONS:
962 *
963 *NOTE:
964 *
965 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
966 * @param subType - Indicates whether it is Association Request (=0) or
967 * Reassociation Request (=1) frame
968 * @param addPreAuthContext - Indicates whether pre-auth context
969 * to be added for this STA
970 * @param authType - Indicates auth type to be added
971 * @param staId - Indicates staId of the STA being rejected
972 * association
973 * @param deleteSta - Indicates whether to delete STA context
974 * at Polaris
975 * @param rCode - Indicates what reasonCode to be sent in
976 * Re/Assoc response to STA
977 *
978 * @return None
979 */
980
981void
982limRejectAssociation(tpAniSirGlobal pMac, tSirMacAddr peerAddr, tANI_U8 subType,
983 tANI_U8 addPreAuthContext, tAniAuthType authType,
984 tANI_U16 staId, tANI_U8 deleteSta, tSirResultCodes rCode, tpPESession psessionEntry )
985{
986 tpDphHashNode pStaDs;
987
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530988 limLog(pMac, LOG1, FL("Sessionid: %d authType: %d subType: %d "
989 "addPreAuthContext: %d staId: %d deleteSta: %d rCode : %d "
990 "peerAddr: "MAC_ADDRESS_STR),psessionEntry->peSessionId,
991 authType, subType, addPreAuthContext, staId, deleteSta, rCode,
992 MAC_ADDR_ARRAY(peerAddr));
993
Jeff Johnson295189b2012-06-20 16:38:30 -0700994 if (addPreAuthContext)
995 {
996 // Create entry for this STA in pre-auth list
997 struct tLimPreAuthNode *pAuthNode;
998
999 pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable);
1000
1001 if (pAuthNode)
1002 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301003 vos_mem_copy((tANI_U8 *) pAuthNode->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001004 peerAddr,
1005 sizeof(tSirMacAddr));
1006 pAuthNode->fTimerStarted = 0;
1007 pAuthNode->mlmState = eLIM_MLM_AUTHENTICATED_STATE;
1008 pAuthNode->authType = (tAniAuthType) authType;
1009 limAddPreAuthNode(pMac, pAuthNode);
1010 }
1011 }
1012
1013 if (deleteSta == true)
1014 {
1015 pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable);
1016
1017 if (pStaDs == NULL)
1018 {
1019 limLog(pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001020 FL("No STA context, yet rejecting Association"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001021
1022 return;
1023 }
1024
1025 /**
1026 * Polaris has state for this STA.
1027 * Trigger cleanup.
1028 */
1029 pStaDs->mlmStaContext.cleanupTrigger = eLIM_REASSOC_REJECT;
1030
1031 // Receive path cleanup
1032 limCleanupRxPath(pMac, pStaDs, psessionEntry);
1033
1034 // Send Re/Association Response with
1035 // status code to requesting STA.
1036 limSendAssocRspMgmtFrame(pMac,
1037 rCode,
1038 0,
1039 peerAddr,
1040 subType, 0,psessionEntry);
1041
1042 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL)
1043 {
1044 // Assoction confirmation is complete, free the copy of association request frame
1045 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
1046 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301047 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07001048 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
1049 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301050 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07001051 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
1052 }
1053 }
1054 else
1055 {
1056 limSendAssocRspMgmtFrame(pMac,
1057 eSIR_MAC_MAX_ASSOC_STA_REACHED_STATUS,
1058 1,
1059 peerAddr,
1060 subType, 0,psessionEntry);
1061 // Log error
1062 limLog(pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001063 FL("received Re/Assoc req when max associated STAs reached from "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001064 limPrintMacAddr(pMac, peerAddr, LOGW);
1065 limSendSmeMaxAssocExceededNtf(pMac, peerAddr, psessionEntry->smeSessionId);
1066 }
1067} /*** end limRejectAssociation() ***/
1068
Jeff Johnson295189b2012-06-20 16:38:30 -07001069
1070/** -------------------------------------------------------------
1071\fn limDecideApProtectionOnHt20Delete
1072\brief protection related function while HT20 station is getting deleted.
1073\param tpAniSirGlobal pMac
1074\param tpDphHashNode pStaDs
1075\param tpUpdateBeaconParams pBeaconParams
1076\return None
1077 -------------------------------------------------------------*/
1078static void
1079limDecideApProtectionOnHt20Delete(tpAniSirGlobal pMac,
1080 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1081{
1082 tANI_U32 i = 0;
1083 PELOG1( limLog(pMac, LOG1, FL("(%d) A HT 20 STA is disassociated. Addr is "),
1084 psessionEntry->gLimHt20Params.numSta);
1085 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1086 if (psessionEntry->gLimHt20Params.numSta > 0)
1087 {
1088 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1089 {
1090 if (psessionEntry->protStaCache[i].active)
1091 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301092 if (vos_mem_compare(psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001093 pStaDs->staAddr, sizeof(tSirMacAddr)))
1094 {
1095 psessionEntry->gLimHt20Params.numSta--;
1096 psessionEntry->protStaCache[i].active = false;
1097 break;
1098 }
1099 }
1100 }
1101 }
1102
1103 if (psessionEntry->gLimHt20Params.numSta == 0)
1104 {
1105 // disable protection
Nirav Shahbc35fb72013-12-12 18:14:06 +05301106 limLog(pMac, LOG1, FL("No 11B STA exists, PESessionID %d"),
1107 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001108 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
1109 }
1110}
1111/** -------------------------------------------------------------
1112\fn limDecideApProtectionOnDelete
1113\brief Decides about protection related settings when a station is getting deleted.
1114\param tpAniSirGlobal pMac
1115\param tpDphHashNode pStaDs
1116\param tpUpdateBeaconParams pBeaconParams
1117\return None
1118 -------------------------------------------------------------*/
1119void
1120limDecideApProtectionOnDelete(tpAniSirGlobal pMac,
1121 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1122{
1123 tANI_U32 phyMode;
1124 tHalBitVal erpEnabled = eHAL_CLEAR;
1125 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1126 tANI_U32 i;
1127
1128 if(NULL == pStaDs)
1129 return;
1130
1131 limGetRfBand(pMac, &rfBand, psessionEntry);
1132 if(SIR_BAND_5_GHZ == rfBand)
1133 {
1134 //we are HT. if we are 11A, then protection is not required.
Jeff Johnsone7245742012-09-05 17:12:55 -07001135 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001136 {
1137 //we are HT and 11A station is leaving.
1138 //protection consideration required.
1139 //HT station leaving ==> this case is commonly handled between both the bands below.
1140 if((psessionEntry->beaconParams.llaCoexist) &&
1141 (false == pStaDs->mlmStaContext.htCapability))
1142 {
1143 PELOG1(limLog(pMac, LOG1, FL("(%d) A 11A STA is disassociated. Addr is "),
1144 psessionEntry->gLim11aParams.numSta);
1145 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1146 if (psessionEntry->gLim11aParams.numSta > 0)
1147 {
1148 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1149 {
1150 if (psessionEntry->protStaCache[i].active)
1151 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301152 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001153 pStaDs->staAddr, sizeof(tSirMacAddr)))
1154 {
1155 psessionEntry->gLim11aParams.numSta--;
1156 psessionEntry->protStaCache[i].active = false;
1157 break;
1158 }
1159 }
1160 }
1161 }
1162
1163 if(psessionEntry->gLim11aParams.numSta == 0)
1164 {
1165 // disable protection
1166 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
1167 }
1168 }
1169 }
1170 }
1171 else if(SIR_BAND_2_4_GHZ == rfBand)
1172 {
1173 limGetPhyMode(pMac, &phyMode, psessionEntry);
1174
1175 erpEnabled = pStaDs->erpEnabled;
1176 //we are HT or 11G and 11B station is getting deleted.
1177 if (((phyMode == WNI_CFG_PHY_MODE_11G) ||
Jeff Johnsone7245742012-09-05 17:12:55 -07001178 psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001179 (erpEnabled == eHAL_CLEAR))
1180 {
1181 PELOG1(limLog(pMac, LOG1, FL("(%d) A legacy STA is disassociated. Addr is "),
1182 psessionEntry->gLim11bParams.numSta);
1183 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1184 if (psessionEntry->gLim11bParams.numSta > 0)
1185 {
1186 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1187 {
1188 if (psessionEntry->protStaCache[i].active)
1189 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301190 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001191 pStaDs->staAddr, sizeof(tSirMacAddr)))
1192 {
1193 psessionEntry->gLim11bParams.numSta--;
1194 psessionEntry->protStaCache[i].active = false;
1195 break;
1196 }
1197 }
1198 }
1199 }
1200
1201 if (psessionEntry->gLim11bParams.numSta == 0)
1202 {
1203 // disable protection
Jeff Johnson295189b2012-06-20 16:38:30 -07001204 limEnable11gProtection(pMac, false, false, pBeaconParams,psessionEntry);
1205 }
1206 }
1207 //(non-11B station is leaving) or (we are not 11G or HT AP)
Jeff Johnsone7245742012-09-05 17:12:55 -07001208 else if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001209 { //we are HT AP and non-11B station is leaving.
1210
1211 //11g station is leaving
1212 if(!pStaDs->mlmStaContext.htCapability)
1213 {
1214 PELOG1(limLog(pMac, LOG1, FL("(%d) A 11g STA is disassociated. Addr is "),
1215 psessionEntry->gLim11bParams.numSta);
1216 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1217 if (psessionEntry->gLim11gParams.numSta > 0)
1218 {
1219 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1220 {
1221 if (psessionEntry->protStaCache[i].active)
1222 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301223 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001224 pStaDs->staAddr, sizeof(tSirMacAddr)))
1225 {
1226 psessionEntry->gLim11gParams.numSta--;
1227 psessionEntry->protStaCache[i].active = false;
1228 break;
1229 }
1230 }
1231 }
1232 }
1233
1234 if (psessionEntry->gLim11gParams.numSta == 0)
1235 {
1236 // disable protection
1237 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
1238 }
1239 }
1240 }
1241 }
1242
1243 //LSIG TXOP not supporting staiton leaving. applies to 2.4 as well as 5 GHZ.
Jeff Johnsone7245742012-09-05 17:12:55 -07001244 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001245 (true == pStaDs->mlmStaContext.htCapability))
1246 {
1247 //HT non-GF leaving
1248 if(!pStaDs->htGreenfield)
1249 {
1250 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-GF STA is disassociated. Addr is "),
1251 psessionEntry->gLimNonGfParams.numSta);
1252 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1253 if (psessionEntry->gLimNonGfParams.numSta > 0)
1254 {
1255 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1256 {
1257 if (psessionEntry->protStaCache[i].active)
1258 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301259 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001260 pStaDs->staAddr, sizeof(tSirMacAddr)))
1261 {
1262 psessionEntry->gLimNonGfParams.numSta--;
1263 psessionEntry->protStaCache[i].active = false;
1264 break;
1265 }
1266 }
1267 }
1268 }
1269
1270 if (psessionEntry->gLimNonGfParams.numSta == 0)
1271 {
1272 // disable protection
1273 limEnableHTNonGfProtection(pMac, false, false, pBeaconParams,psessionEntry);
1274 }
1275 }
1276 //HT 20Mhz station leaving.
1277 if(psessionEntry->beaconParams.ht20Coexist &&
1278 (eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet))
1279 {
1280 limDecideApProtectionOnHt20Delete(pMac, pStaDs, pBeaconParams,psessionEntry);
1281 }
1282
1283 if(false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport &&
1284 (false == pStaDs->htLsigTXOPProtection))
1285 {
1286 PELOG1( limLog(pMac, LOG1, FL("(%d) A HT LSIG not supporting STA is disassociated. Addr is "),
1287 psessionEntry->gLimLsigTxopParams.numSta);
1288 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1289 if (psessionEntry->gLimLsigTxopParams.numSta > 0)
1290 {
1291 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1292 {
1293 if (psessionEntry->protStaCache[i].active)
1294 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301295 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001296 pStaDs->staAddr, sizeof(tSirMacAddr)))
1297 {
1298 psessionEntry->gLimLsigTxopParams.numSta--;
1299 psessionEntry->protStaCache[i].active = false;
1300 break;
1301 }
1302 }
1303 }
1304 }
1305
1306 if (psessionEntry->gLimLsigTxopParams.numSta == 0)
1307 {
1308 // disable protection
1309 limEnableHTLsigTxopProtection(pMac, true, false, pBeaconParams,psessionEntry);
1310 }
1311 }
1312 }
1313}
1314
Jeff Johnson295189b2012-06-20 16:38:30 -07001315
1316
1317/** -------------------------------------------------------------
1318\fn limDecideShortPreamble
1319\brief Decides about any short preamble reated change because of new station joining.
1320\param tpAniSirGlobal pMac
1321\param tpDphHashNode pStaDs
1322\param tpUpdateBeaconParams pBeaconParams
1323\return None
1324 -------------------------------------------------------------*/
1325void limDecideShortPreamble(tpAniSirGlobal pMac,
1326 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry )
1327{
1328 tANI_U32 i;
1329
1330 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
1331 {
1332 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-short preamble STA is disassociated. Addr is "),
1333 psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
1334 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1335 if (psessionEntry->gLimNoShortParams.numNonShortPreambleSta > 0)
1336 {
1337 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1338 {
1339 if (psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
1340 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301341 if (vos_mem_compare( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001342 pStaDs->staAddr, sizeof(tSirMacAddr)))
1343 {
1344 psessionEntry->gLimNoShortParams.numNonShortPreambleSta--;
1345 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = false;
1346 break;
1347 }
1348 }
1349 }
1350 }
1351
1352 if (psessionEntry->gLimNoShortParams.numNonShortPreambleSta == 0)
1353 {
1354 // enable short preamble
Jeff Johnson295189b2012-06-20 16:38:30 -07001355 //reset the cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301356 vos_mem_set((tANI_U8 *)&psessionEntry->gLimNoShortParams,
1357 sizeof(tLimNoShortParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001358 if (limEnableShortPreamble(pMac, true, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001359 PELOGE(limLog(pMac, LOGE, FL("Cannot enable short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001360 }
1361 }
1362}
1363
1364/** -------------------------------------------------------------
1365\fn limDecideShortSlot
1366\brief Decides about any short slot time related change because of station leaving the BSS.
1367\param tpAniSirGlobal pMac
1368\param tpDphHashNode pStaDs
1369\return None
1370 -------------------------------------------------------------*/
1371
1372void
1373limDecideShortSlot(tpAniSirGlobal pMac, tpDphHashNode pStaDs,
1374 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
1375{
1376 tANI_U32 i, val;
1377 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
1378 {
1379 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-short slottime STA is disassociated. Addr is "),
1380 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
1381 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1382
Jeff Johnson295189b2012-06-20 16:38:30 -07001383 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
1384 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta> 0)
1385 {
1386 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1387 {
1388 if (psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
1389 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301390 if (vos_mem_compare(psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001391 pStaDs->staAddr, sizeof(tSirMacAddr)))
1392 {
1393 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta--;
1394 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = false;
1395 break;
1396 }
1397 }
1398 }
1399 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001400 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001401 {
1402 if (pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta> 0)
1403 {
1404 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1405 {
1406 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
1407 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301408 if (vos_mem_compare(pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001409 pStaDs->staAddr, sizeof(tSirMacAddr)))
1410 {
1411 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta--;
1412 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = false;
1413 break;
1414 }
1415 }
1416 }
1417 }
1418 }
1419
1420 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
1421
Jeff Johnson295189b2012-06-20 16:38:30 -07001422 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
1423 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta == 0))
1424 {
1425 // enable short slot time
Jeff Johnson295189b2012-06-20 16:38:30 -07001426 //reset the cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301427 vos_mem_set((tANI_U8 *)&psessionEntry->gLimNoShortSlotParams,
1428 sizeof(tLimNoShortSlotParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001429 // in case of AP set SHORT_SLOT_TIME to enable
1430 if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
1431 {
1432 pBeaconParams->fShortSlotTime = true;
1433 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnsone7245742012-09-05 17:12:55 -07001434 psessionEntry->shortSlotTimeSupported = true;
Jeff Johnson295189b2012-06-20 16:38:30 -07001435 }
1436 }
1437 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001438 {
1439 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta == 0)
1440 {
1441 // enable short slot time
Jeff Johnson295189b2012-06-20 16:38:30 -07001442 //reset the cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301443 vos_mem_set((tANI_U8 *)&pMac->lim.gLimNoShortSlotParams,
1444 sizeof(tLimNoShortSlotParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001445 // in case of AP set SHORT_SLOT_TIME to enable
1446 if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
1447 {
1448 pBeaconParams->fShortSlotTime = true;
1449 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnsone7245742012-09-05 17:12:55 -07001450 psessionEntry->shortSlotTimeSupported = true;
1451 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001452 }
1453 }
1454 }
1455}
1456
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -07001457void
1458limPostReassocFailure(tpAniSirGlobal pMac,
1459 tSirResultCodes resultCode,
1460 tANI_U16 protStatusCode,tpPESession psessionEntry)
1461{
1462 tLimMlmReassocCnf mlmReassocCnf;
1463
1464 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
1465 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE));
1466
1467 // 'Change' timer for future activations
1468 limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
1469
1470 mlmReassocCnf.resultCode = resultCode;
1471 mlmReassocCnf.protStatusCode = protStatusCode;
1472 /* Update PE session Id */
1473 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
1474 limPostSmeMessage(pMac,
1475 LIM_MLM_REASSOC_CNF,
1476 (tANI_U32 *) &mlmReassocCnf);
1477} /*** end limPostReassocFailure() ***/
1478
Jeff Johnson295189b2012-06-20 16:38:30 -07001479/**
1480 * limRestorePreReassocState()
1481 *
1482 *FUNCTION:
1483 * This function is called on STA role whenever Reasociation
1484 * Response with a reject code is received from AP.
1485 *
1486 *LOGIC:
1487 * Reassociation failure timer is stopped, Old (or current) AP's
1488 * context is restored both at Polaris & software
1489 *
1490 *ASSUMPTIONS:
1491 *
1492 *NOTE:
1493 *
1494 * @param pMac - Pointer to Global MAC structure
1495 * @param resultCode - Result code that specifies why Reassociation
1496 * attemp failed
1497 *
1498 * @return None
1499 */
1500
1501void
1502limRestorePreReassocState(tpAniSirGlobal pMac,
1503 tSirResultCodes resultCode,
1504 tANI_U16 protStatusCode,tpPESession psessionEntry)
1505{
Jeff Johnsone7245742012-09-05 17:12:55 -07001506 tANI_U8 chanNum, secChanOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07001507 tLimMlmReassocCnf mlmReassocCnf;
1508
Abhishek Singhdcbd8272014-01-09 14:16:01 +05301509 limLog(pMac, LOG1, FL("sessionid: %d protStatusCode: %d resultCode: %d"),
1510 psessionEntry->smeSessionId, protStatusCode, resultCode);
1511
Jeff Johnson295189b2012-06-20 16:38:30 -07001512 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001513 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07001514
1515 // 'Change' timer for future activations
1516 limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
1517
1518 // Update BSSID at CFG database
1519 #if 0
1520 if (cfgSetStr(pMac, WNI_CFG_BSSID,
1521 pMac->lim.gLimCurrentBssId,
1522 sizeof(tSirMacAddr)) != eSIR_SUCCESS)
1523 {
1524 /// Could not update BSSID at CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001525 limLog(pMac, LOGP, FL("could not update BSSID at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001526 return;
1527 }
Madan Mohan Koyyalamudi70322d52012-10-18 20:07:33 -07001528 #endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001529
1530 // chanNum = pMac->lim.gLimCurrentChannelId;
1531
1532 /* To support BT-AMP */
1533 chanNum = psessionEntry->currentOperChannel;
Jeff Johnsone7245742012-09-05 17:12:55 -07001534 secChanOffset = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07001535
Jeff Johnsone7245742012-09-05 17:12:55 -07001536 limSetChannel(pMac, chanNum, secChanOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001537
1538 /** @ToDo : Need to Integrate the STOP the DataTransfer to the AP from 11H code */
1539
1540 mlmReassocCnf.resultCode = resultCode;
1541 mlmReassocCnf.protStatusCode = protStatusCode;
1542 /* Update PE session Id */
1543 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
1544 limPostSmeMessage(pMac,
1545 LIM_MLM_REASSOC_CNF,
1546 (tANI_U32 *) &mlmReassocCnf);
1547} /*** end limRestorePreReassocState() ***/
1548
1549
1550
1551/**
1552 * limIsReassocInProgress()
1553 *
1554 *FUNCTION:
1555 * This function is called to see if STA is in wt-reassoc-rsp state.
1556 *
1557 *LOGIC:
1558 *
1559 *ASSUMPTIONS:
1560 *
1561 *NOTE:
1562 *
1563 * @param pMac - Pointer to Global MAC structure
1564 *
1565 * @return eANI_BOOLEAN_TRUE When STA is waiting for Reassoc response from AP \n
1566 * else eANI_BOOLEAN_FALSE
1567 */
1568
1569eAniBoolean
1570limIsReassocInProgress(tpAniSirGlobal pMac,tpPESession psessionEntry)
1571{
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001572 if (psessionEntry == NULL)
1573 {
1574 return eANI_BOOLEAN_FALSE;
1575 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001576 if(((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
1577 ((psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE) ||
1578 (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_LINK_FAIL_STATE)))
1579 return eANI_BOOLEAN_TRUE;
1580
1581 return eANI_BOOLEAN_FALSE;
1582} /*** end limIsReassocInProgress() ***/
1583
Jeff Johnsone7245742012-09-05 17:12:55 -07001584#ifdef WLAN_FEATURE_11AC
1585tSirRetStatus limPopulateVhtMcsSet(tpAniSirGlobal pMac,
1586 tpSirSupportedRates pRates,
1587 tDot11fIEVHTCaps *pPeerVHTCaps,
1588 tpPESession psessionEntry)
1589{
1590 tANI_U32 val;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001591 tANI_U32 selfStaDot11Mode=0;
1592 wlan_cfgGetInt(pMac,WNI_CFG_DOT11_MODE,&selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001593
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001594// if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
1595 if (IS_DOT11_MODE_VHT(selfStaDot11Mode))
Jeff Johnsone7245742012-09-05 17:12:55 -07001596 {
1597 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_MCS_MAP,&val) !=
1598 eSIR_SUCCESS )
1599 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001600 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX MCS MAP"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001601 goto error;
1602 }
1603 pRates->vhtRxMCSMap = (tANI_U16)val;
1604
1605 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_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 TX MCS MAP"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001609 goto error;
1610 }
1611 pRates->vhtTxMCSMap = (tANI_U16)val;
1612
1613 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,&val ) !=
1614 eSIR_SUCCESS )
1615 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001616 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001617 goto error;
1618 }
1619 pRates->vhtRxHighestDataRate = (tANI_U16)val;
1620
1621 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_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->vhtTxHighestDataRate = (tANI_U16)val;
1628
1629 if( pPeerVHTCaps != NULL)
1630 {
1631 pRates->vhtTxHighestDataRate = SIR_MIN(pRates->vhtTxHighestDataRate, pPeerVHTCaps->txSupDataRate);
1632 pRates->vhtRxHighestDataRate = SIR_MIN(pRates->vhtRxHighestDataRate, pPeerVHTCaps->rxHighSupDataRate);
1633
Jeff Johnson1250df42012-12-10 14:31:52 -08001634 // Acquire PEER MCS map if we exceed.
Jeff Johnsone7245742012-09-05 17:12:55 -07001635 // We compare/update only the last 2 bits of the map as we support only single BSS.
1636 // Firmware takes care of this comparison
1637 pRates->vhtRxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap
1638 pRates->vhtRxMCSMap |= (pPeerVHTCaps->rxMCSMap & 0x3); // Updating the last 2 bits in the bitmap
1639
1640 // Firmware takes care of this comparison
1641 pRates->vhtTxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap
1642 pRates->vhtTxMCSMap |= (pPeerVHTCaps->txMCSMap & 0x3); // Updating the last 2 bits in the bitmap
1643 }
1644 }
1645 return eSIR_SUCCESS;
1646error:
1647
1648 return eSIR_FAILURE;
1649
1650}
1651#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001652
1653/**
1654 * limPopulateOwnRateSet
1655 *
1656 * FUNCTION:
1657 * This function is called by limProcessAssocRsp() or
1658 * limAddStaInIBSS()
1659 * - It creates a combined rate set of 12 rates max which
1660 * comprises the basic and extended rates read from CFG
1661 * - It sorts the combined rate Set and copy it in the
1662 * rate array of the pSTA descriptor
1663 * - It sets the erpEnabled bit of the STA descriptor
1664 *
1665 * NOTE:
1666 * ERP bit is set iff the dph PHY mode is 11G and there is at least
1667 * an A rate in the supported or extended rate sets
1668 *
1669 * @param pMac - Pointer to Global MAC structure
1670 * @param basicOnly - When passed value is true, only basic
1671 * rates are copied to DPH node else
1672 * all supported rates are copied
1673 * @return eSIR_SUCCESS or eSIR_FAILURE
1674 *
1675 */
Jeff Johnsone7245742012-09-05 17:12:55 -07001676#ifdef WLAN_FEATURE_11AC
1677tSirRetStatus
1678limPopulateOwnRateSet(tpAniSirGlobal pMac,
1679 tpSirSupportedRates pRates,
1680 tANI_U8* pSupportedMCSSet,
1681 tANI_U8 basicOnly,
1682 tpPESession psessionEntry,
1683 tDot11fIEVHTCaps *pVHTCaps)
1684#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001685tSirRetStatus
1686limPopulateOwnRateSet(tpAniSirGlobal pMac,
1687 tpSirSupportedRates pRates,
1688 tANI_U8* pSupportedMCSSet,
1689 tANI_U8 basicOnly,
1690 tpPESession psessionEntry)
Jeff Johnsone7245742012-09-05 17:12:55 -07001691#endif
1692
Jeff Johnson295189b2012-06-20 16:38:30 -07001693{
1694 tSirMacRateSet tempRateSet;
1695 tSirMacRateSet tempRateSet2;
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301696 tANI_U32 i,j,val,min,isArate;
Jeff Johnson295189b2012-06-20 16:38:30 -07001697 tANI_U32 phyMode = 0;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001698 tANI_U32 selfStaDot11Mode=0;
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301699
Jeff Johnson295189b2012-06-20 16:38:30 -07001700 isArate = 0;
1701
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001702 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001703 limGetPhyMode(pMac, &phyMode, psessionEntry);
1704
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301705 /* Include 11b rates only when the device configured in
1706 auto, 11a/b/g or 11b_only */
1707 if ( (selfStaDot11Mode == WNI_CFG_DOT11_MODE_ALL) ||
1708 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11A) ||
1709 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11AC) ||
Leela Venkata Kiran Kumar Reddy Chiralac9a10e52013-08-29 16:37:15 -07001710 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11N) ||
1711 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11G) ||
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301712 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11B) )
Jeff Johnson295189b2012-06-20 16:38:30 -07001713 {
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301714 val = WNI_CFG_SUPPORTED_RATES_11B_LEN;
1715 wlan_cfgGetStr( pMac, WNI_CFG_SUPPORTED_RATES_11B,
1716 (tANI_U8 *)&tempRateSet.rate, &val );
1717 tempRateSet.numRates = (tANI_U8) val;
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07001718 }
1719 else
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301720 tempRateSet.numRates = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001721
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301722 /* Include 11a rates when the device configured in non-11b mode */
1723 if (!IS_DOT11_MODE_11B(selfStaDot11Mode))
Jeff Johnson295189b2012-06-20 16:38:30 -07001724 {
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301725 val = WNI_CFG_SUPPORTED_RATES_11A_LEN;
1726 wlan_cfgGetStr( pMac, WNI_CFG_SUPPORTED_RATES_11A,
1727 (tANI_U8 *)&tempRateSet2.rate, &val );
Jeff Johnson295189b2012-06-20 16:38:30 -07001728 tempRateSet2.numRates = (tANI_U8) val;
Jeff Johnson295189b2012-06-20 16:38:30 -07001729 }
1730 else
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301731 tempRateSet2.numRates = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001732
1733 if ((tempRateSet.numRates + tempRateSet2.numRates) > 12)
1734 {
1735 //we are in big trouble
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001736 limLog(pMac, LOGP, FL("more than 12 rates in CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001737 //panic
1738 goto error;
1739 }
1740
Jeff Johnson295189b2012-06-20 16:38:30 -07001741 //copy all rates in tempRateSet, there are 12 rates max
1742 for (i = 0;i < tempRateSet2.numRates; i++)
1743 tempRateSet.rate[i + tempRateSet.numRates] = tempRateSet2.rate[i];
1744 tempRateSet.numRates += tempRateSet2.numRates;
1745
1746 /**
1747 * Sort rates in tempRateSet (they are likely to be already sorted)
1748 * put the result in pSupportedRates
1749 */
1750 {
1751 tANI_U8 aRateIndex = 0;
1752 tANI_U8 bRateIndex = 0;
1753
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301754 vos_mem_set((tANI_U8 *) pRates, sizeof(tSirSupportedRates), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001755 for(i = 0;i < tempRateSet.numRates; i++)
1756 {
1757 min = 0;
1758 val = 0xff;
1759 isArate = 0;
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07001760 for(j = 0; (j < tempRateSet.numRates) && (j < SIR_MAC_RATESET_EID_MAX); j++)
Jeff Johnson295189b2012-06-20 16:38:30 -07001761 {
1762 if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
1763 {
1764 val = tempRateSet.rate[j] & 0x7f;
1765 min = j;
1766 }
1767 }
1768
1769 if (sirIsArate(tempRateSet.rate[min] & 0x7f))
1770 isArate = 1;
1771
1772 /*
1773 * HAL needs to know whether the rate is basic rate or not, as it needs to
1774 * update the response rate table accordingly. e.g. if one of the 11a rates is
1775 * basic rate, then that rate can be used for sending control frames.
1776 * HAL updates the response rate table whenever basic rate set is changed.
1777 */
1778 if (basicOnly)
1779 {
1780 if (tempRateSet.rate[min] & 0x80)
1781 {
1782 if (isArate)
1783 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1784 else
1785 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1786 }
1787 }
1788 else
1789 {
1790 if (isArate)
1791 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1792 else
1793 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1794 }
1795 tempRateSet.rate[min] = 0xff;
1796 }
1797
1798 }
1799
1800
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001801 //if(IS_DOT11_MODE_HT(psessionEntry->dot11mode))
1802 if (IS_DOT11_MODE_HT(selfStaDot11Mode))
Jeff Johnson295189b2012-06-20 16:38:30 -07001803 {
1804 val = SIZE_OF_SUPPORTED_MCS_SET;
1805 if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
1806 pRates->supportedMCSSet,
1807 &val) != eSIR_SUCCESS)
1808 {
1809 /// Could not get rateset from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001810 PELOGE(limLog(pMac, LOGE, FL("could not retrieve supportedMCSSet"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001811 goto error;
1812 }
1813
1814
1815 //if supported MCS Set of the peer is passed in, then do the intersection
1816 //else use the MCS set from local CFG.
1817
1818 if(pSupportedMCSSet != NULL)
1819 {
1820 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
1821 pRates->supportedMCSSet[i] &= pSupportedMCSSet[i];
1822
1823 }
1824
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001825 PELOG2(limLog(pMac, LOG2, FL("MCS Rate Set Bitmap: "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001826 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
Abhishek Singhdcbd8272014-01-09 14:16:01 +05301827 PELOG2(limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001828 }
1829
Jeff Johnsone7245742012-09-05 17:12:55 -07001830#ifdef WLAN_FEATURE_11AC
1831 limPopulateVhtMcsSet(pMac, pRates , pVHTCaps,psessionEntry);
1832#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001833
1834 return eSIR_SUCCESS;
1835
1836 error:
1837
1838 return eSIR_FAILURE;
1839} /*** limPopulateOwnRateSet() ***/
1840
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001841#ifdef WLAN_FEATURE_11AC
1842tSirRetStatus
1843limPopulatePeerRateSet(tpAniSirGlobal pMac,
1844
1845 tpSirSupportedRates pRates,
1846 tANI_U8* pSupportedMCSSet,
1847 tANI_U8 basicOnly,
1848 tpPESession psessionEntry,
1849 tDot11fIEVHTCaps *pVHTCaps)
1850#else
1851tSirRetStatus
1852limPopulatePeerRateSet(tpAniSirGlobal pMac,
1853 tpSirSupportedRates pRates,
1854 tANI_U8* pSupportedMCSSet,
1855 tANI_U8 basicOnly,
1856 tpPESession psessionEntry)
1857#endif
1858{
1859 tSirMacRateSet tempRateSet;
1860 tSirMacRateSet tempRateSet2;
1861 tANI_U32 i,j,val,min,isArate;
1862 isArate = 0;
1863
1864 /* copy operational rate set from psessionEntry */
Praveen Kumar Sirisilla8bdfac42013-10-10 17:20:48 -07001865 if ( psessionEntry->rateSet.numRates <= SIR_MAC_RATESET_EID_MAX )
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001866 {
Kiet Lam842c3e12013-11-16 22:40:57 +05301867 vos_mem_copy((tANI_U8 *)tempRateSet.rate,
1868 (tANI_U8*)(psessionEntry->rateSet.rate),
1869 psessionEntry->rateSet.numRates);
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001870 tempRateSet.numRates = psessionEntry->rateSet.numRates;
1871 }
1872 else
1873 {
1874 limLog(pMac, LOGE, FL("more than SIR_MAC_RATESET_EID_MAX rates\n"));
1875 goto error;
1876 }
Leela Venkata Kiran Kumar Reddy Chirala891bf062013-10-03 14:30:53 -07001877 if ((psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11G) ||
1878 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11A) ||
1879 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11N))
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001880 {
1881
Praveen Kumar Sirisilla8bdfac42013-10-10 17:20:48 -07001882 if (psessionEntry->extRateSet.numRates <= SIR_MAC_RATESET_EID_MAX)
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001883 {
Kiet Lam842c3e12013-11-16 22:40:57 +05301884 vos_mem_copy((tANI_U8 *)tempRateSet2.rate,
1885 (tANI_U8*)(psessionEntry->extRateSet.rate),
1886 psessionEntry->extRateSet.numRates);
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001887 tempRateSet2.numRates = psessionEntry->extRateSet.numRates;
1888 }
1889 else {
1890 limLog(pMac, LOGE, FL("psessionEntry->extRateSet.numRates more than SIR_MAC_RATESET_EID_MAX rates\n"));
1891 goto error;
1892 }
1893 }
1894 else
1895 tempRateSet2.numRates = 0;
Praveen Kumar Sirisilla8bdfac42013-10-10 17:20:48 -07001896 if ((tempRateSet.numRates + tempRateSet2.numRates) > SIR_MAC_RATESET_EID_MAX)
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001897 {
1898 //we are in big trouble
1899 limLog(pMac, LOGP, FL("more than 12 rates in CFG"));
1900 goto error;
1901 }
1902
1903
1904 //copy all rates in tempRateSet, there are 12 rates max
1905 for (i = 0;i < tempRateSet2.numRates; i++)
1906 tempRateSet.rate[i + tempRateSet.numRates] = tempRateSet2.rate[i];
1907 tempRateSet.numRates += tempRateSet2.numRates;
1908 /**
1909 * Sort rates in tempRateSet (they are likely to be already sorted)
1910 * put the result in pSupportedRates
1911 */
1912 {
1913 tANI_U8 aRateIndex = 0;
1914 tANI_U8 bRateIndex = 0;
Kiet Lam842c3e12013-11-16 22:40:57 +05301915 vos_mem_set((tANI_U8 *) pRates, sizeof(tSirSupportedRates), 0);
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001916 for(i = 0;i < tempRateSet.numRates; i++)
1917 {
1918 min = 0;
1919 val = 0xff;
1920 isArate = 0;
1921 for(j = 0; (j < tempRateSet.numRates) && (j < SIR_MAC_RATESET_EID_MAX); j++)
1922 {
1923 if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
1924 {
1925 val = tempRateSet.rate[j] & 0x7f;
1926 min = j;
1927 }
1928 }
1929 if (sirIsArate(tempRateSet.rate[min] & 0x7f))
1930 isArate = 1;
1931 /*
1932 * HAL needs to know whether the rate is basic rate or not, as it needs to
1933 * update the response rate table accordingly. e.g. if one of the 11a rates is
1934 * basic rate, then that rate can be used for sending control frames.
1935 * HAL updates the response rate table whenever basic rate set is changed.
1936 */
1937 if (basicOnly)
1938 {
1939 if (tempRateSet.rate[min] & 0x80)
1940 {
1941 if (isArate)
1942 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1943 else
1944 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1945 }
1946 }
1947 else
1948 {
1949 if (isArate)
1950 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1951 else
1952 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1953 }
1954 tempRateSet.rate[min] = 0xff;
1955 }
1956 }
1957
1958
1959 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode))
1960 {
1961 val = SIZE_OF_SUPPORTED_MCS_SET;
1962 if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
1963 pRates->supportedMCSSet,
1964 &val) != eSIR_SUCCESS)
1965 {
1966 /// Could not get rateset from CFG. Log error.
1967 PELOGE(limLog(pMac, LOGE, FL("could not retrieve supportedMCSSet"));)
1968 goto error;
1969 }
1970 //if supported MCS Set of the peer is passed in, then do the intersection
1971 //else use the MCS set from local CFG.
1972 if(pSupportedMCSSet != NULL)
1973 {
1974 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
1975 pRates->supportedMCSSet[i] &= pSupportedMCSSet[i];
1976 }
1977 PELOG2(limLog(pMac, LOG2, FL("MCS Rate Set Bitmap: "));)
1978 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
Abhishek Singhdcbd8272014-01-09 14:16:01 +05301979 PELOG2(limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);)
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001980 }
1981#ifdef WLAN_FEATURE_11AC
1982 limPopulateVhtMcsSet(pMac, pRates , pVHTCaps,psessionEntry);
1983#endif
1984 return eSIR_SUCCESS;
1985 error:
1986 return eSIR_FAILURE;
1987} /*** limPopulatePeerRateSet() ***/
1988
Jeff Johnson295189b2012-06-20 16:38:30 -07001989/**
1990 * limPopulateMatchingRateSet
1991 * FUNCTION:
1992 * This is called at the time of Association Request
1993 * processing on AP and while adding peer's context
1994 * in IBSS role to process the CFG rate sets and
1995 * the rate sets received in the Assoc request on AP
1996 * or Beacon/Probe Response from peer in IBSS.
1997 *
1998 * LOGIC:
1999 * 1. It makes the intersection between our own rate Sat
2000 * and extemcded rate set and the ones received in the
2001 * association request.
2002 * 2. It creates a combined rate set of 12 rates max which
2003 * comprised the basic and extended rates
2004 * 3. It sorts the combined rate Set and copy it in the
2005 * rate array of the pSTA descriptor
2006 *
2007 * ASSUMPTION:
2008 * The parser has already ensured unicity of the rates in the
2009 * association request structure
2010 *
2011 * @param: pMac - Pointer to Global MAC structure
2012 * pStaDs - Pointer to DPH node
2013 * pOperRateSet - Pointer to peer's supported rateset
2014 * pExtRateSet - Pointer to peer's extended rateset
2015 *
2016 * @return: eSIR_SUCCESS or eSIR_FAILURE
2017 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002018#ifdef WLAN_FEATURE_11AC
2019tSirRetStatus
2020limPopulateMatchingRateSet(tpAniSirGlobal pMac,
2021 tpDphHashNode pStaDs,
2022 tSirMacRateSet *pOperRateSet,
2023 tSirMacRateSet *pExtRateSet,
2024 tANI_U8* pSupportedMCSSet,
2025 tSirMacPropRateSet *pAniLegRateSet,
2026 tpPESession psessionEntry,
2027 tDot11fIEVHTCaps *pVHTCaps)
Jeff Johnson295189b2012-06-20 16:38:30 -07002028
Jeff Johnsone7245742012-09-05 17:12:55 -07002029#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002030tSirRetStatus
2031limPopulateMatchingRateSet(tpAniSirGlobal pMac,
2032 tpDphHashNode pStaDs,
2033 tSirMacRateSet *pOperRateSet,
2034 tSirMacRateSet *pExtRateSet,
2035 tANI_U8* pSupportedMCSSet,
2036 tSirMacPropRateSet *pAniLegRateSet,
2037 tpPESession psessionEntry)
Jeff Johnsone7245742012-09-05 17:12:55 -07002038#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002039{
2040 tSirMacRateSet tempRateSet;
2041 tSirMacRateSet tempRateSet2;
2042 tANI_U32 i,j,val,min,isArate;
2043 tANI_U32 phyMode;
2044 tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET];
2045
2046 isArate=0;
2047
2048 // limGetPhyMode(pMac, &phyMode);
2049 limGetPhyMode(pMac, &phyMode, psessionEntry);
2050
2051 // get own rate set
2052 // val = WNI_CFG_OPERATIONAL_RATE_SET_LEN;
2053 #if 0
2054 if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
2055 (tANI_U8 *) &tempRateSet.rate,
2056 &val) != eSIR_SUCCESS)
2057 {
2058 /// Could not get rateset from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002059 limLog(pMac, LOGP, FL("could not retrieve rateset"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002060 }
2061
2062 #endif // TO SUPPORT BT-AMP
2063
2064 /* copy operational rate set from psessionEntry */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302065 vos_mem_copy((tempRateSet.rate), (psessionEntry->rateSet.rate),
2066 psessionEntry->rateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07002067 tempRateSet.numRates = (tANI_U8) psessionEntry->rateSet.numRates;
2068
2069 if (phyMode == WNI_CFG_PHY_MODE_11G)
2070 {
2071
2072 #if 0
2073 // get own extended rate set
2074 val = WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN;
2075 if (wlan_cfgGetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
2076 (tANI_U8 *) &tempRateSet2.rate,
2077 &val) != eSIR_SUCCESS)
2078 #endif
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302079 vos_mem_copy((tempRateSet2.rate), (psessionEntry->extRateSet.rate),
2080 psessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07002081 tempRateSet2.numRates = (tANI_U8) psessionEntry->extRateSet.numRates;
2082 }
2083 else
2084 tempRateSet2.numRates = 0;
2085
2086 if ((tempRateSet.numRates + tempRateSet2.numRates) > 12)
2087 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002088 PELOGE(limLog(pMac, LOGE, FL("more than 12 rates in CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002089 goto error;
2090 }
2091
2092 /**
2093 * Handling of the rate set IEs is the following:
2094 * - keep only rates that we support and that the station supports
2095 * - sort and the rates into the pSta->rate array
2096 */
2097
2098 // Copy all rates in tempRateSet, there are 12 rates max
2099 for(i = 0; i < tempRateSet2.numRates; i++)
2100 tempRateSet.rate[i + tempRateSet.numRates] =
2101 tempRateSet2.rate[i];
2102
2103 tempRateSet.numRates += tempRateSet2.numRates;
2104
2105 /**
2106 * Sort rates in tempRateSet (they are likely to be already sorted)
2107 * put the result in tempRateSet2
2108 */
2109 tempRateSet2.numRates = 0;
2110
2111 for(i = 0;i < tempRateSet.numRates; i++)
2112 {
2113 min = 0;
2114 val = 0xff;
2115
2116 for(j = 0;j < tempRateSet.numRates; j++)
2117 if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
2118 {
2119 val = tempRateSet.rate[j] & 0x7f;
2120 min = j;
2121 }
2122
2123 tempRateSet2.rate[tempRateSet2.numRates++] =
2124 tempRateSet.rate[min];
2125 tempRateSet.rate[min] = 0xff;
2126 }
2127
2128
2129 /**
2130 * Copy received rates in tempRateSet, the parser has ensured
2131 * unicity of the rates so there cannot be more than 12
2132 */
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002133 for(i = 0; (i < pOperRateSet->numRates && i < SIR_MAC_RATESET_EID_MAX) ; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07002134 {
2135 tempRateSet.rate[i] = pOperRateSet->rate[i];
2136 }
2137
2138 tempRateSet.numRates = pOperRateSet->numRates;
2139
2140 if (pExtRateSet->numRates)
2141 {
2142 if((tempRateSet.numRates + pExtRateSet->numRates) > 12 )
2143 {
2144 limLog( pMac, LOG2,
2145 "Sum of SUPPORTED and EXTENDED Rate Set (%1d) exceeds 12!",
2146 tempRateSet.numRates + pExtRateSet->numRates );
2147
2148 if( tempRateSet.numRates < 12 )
2149 {
2150 int found = 0;
2151 int tail = tempRateSet.numRates;
2152
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002153 for( i = 0; (i < pExtRateSet->numRates && i < SIR_MAC_RATESET_EID_MAX); i++ )
Jeff Johnson295189b2012-06-20 16:38:30 -07002154 {
2155 found = 0;
2156 for( j = 0; j < (tANI_U32) tail; j++ )
2157 {
2158 if((tempRateSet.rate[j] & 0x7F) ==
2159 (pExtRateSet->rate[i] & 0x7F))
2160 {
2161 found = 1;
2162 break;
2163 }
2164 }
2165
2166 if( !found )
2167 {
2168 tempRateSet.rate[tempRateSet.numRates++] =
2169 pExtRateSet->rate[i];
2170
2171 if( tempRateSet.numRates >= 12 )
2172 break;
2173 }
2174 }
2175 }
2176 else
2177 limLog( pMac, LOG2,
2178 "Relying only on the SUPPORTED Rate Set IE..." );
2179 }
2180 else
2181 {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002182 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 -07002183 tempRateSet.rate[i+j] = pExtRateSet->rate[j];
2184
2185 tempRateSet.numRates += pExtRateSet->numRates;
2186 }
2187 }
2188
2189 {
2190 tpSirSupportedRates rates = &pStaDs->supportedRates;
2191 tANI_U8 aRateIndex = 0;
2192 tANI_U8 bRateIndex = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302193 vos_mem_set((tANI_U8 *) rates, sizeof(tSirSupportedRates), 0);
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002194 for(i = 0;(i < tempRateSet2.numRates && i < SIR_MAC_RATESET_EID_MAX ); i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07002195 {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002196 for(j = 0;(j < tempRateSet.numRates && j < SIR_MAC_RATESET_EID_MAX); j++)
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 {
2198 if ((tempRateSet2.rate[i] & 0x7F) ==
2199 (tempRateSet.rate[j] & 0x7F))
2200 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 if (sirIsArate(tempRateSet2.rate[i] & 0x7f))
2202 {
2203 isArate=1;
Kiran Kumar Lokerea328bcd2013-04-22 22:02:05 -07002204 if (aRateIndex < SIR_NUM_11A_RATES)
2205 rates->llaRates[aRateIndex++] = tempRateSet2.rate[i];
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 }
2207 else
Kiran Kumar Lokerea328bcd2013-04-22 22:02:05 -07002208 {
2209 if (bRateIndex < SIR_NUM_11B_RATES)
2210 rates->llbRates[bRateIndex++] = tempRateSet2.rate[i];
2211 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 break;
2213 }
2214 }
2215 }
2216
2217
2218 //Now add the Polaris rates only when Proprietary rates are enabled.
2219 val = 0;
2220 if(wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_RATES_ENABLED, &val) != eSIR_SUCCESS)
2221 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002222 limLog(pMac, LOGP, FL("could not retrieve prop rate enabled flag from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002223 }
2224 else if(val)
2225 {
2226 for(i=0; i<pAniLegRateSet->numPropRates; i++)
2227 rates->aniLegacyRates[i] = pAniLegRateSet->propRate[i];
2228 }
2229
2230 }
2231
2232
2233 //compute the matching MCS rate set, if peer is 11n capable and self mode is 11n
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002234#ifdef FEATURE_WLAN_TDLS
2235 if(pStaDs->mlmStaContext.htCapability)
2236#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002237 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
2238 (pStaDs->mlmStaContext.htCapability))
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002239#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002240 {
2241 val = SIZE_OF_SUPPORTED_MCS_SET;
2242 if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
2243 mcsSet,
2244 &val) != eSIR_SUCCESS)
2245 {
2246 /// Could not get rateset from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002247 limLog(pMac, LOGP, FL("could not retrieve supportedMCSSet"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002248 goto error;
2249 }
2250
2251 for(i=0; i<val; i++)
2252 pStaDs->supportedRates.supportedMCSSet[i] = mcsSet[i] & pSupportedMCSSet[i];
2253
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002254 PELOG2(limLog(pMac, LOG2, FL("limPopulateMatchingRateSet: MCS Rate Set Bitmap from CFG and DPH : "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002255 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
2256 {
2257 PELOG2(limLog(pMac, LOG2,FL("%x %x "), mcsSet[i], pStaDs->supportedRates.supportedMCSSet[i]);)
2258 }
2259 }
2260
Jeff Johnsone7245742012-09-05 17:12:55 -07002261#ifdef WLAN_FEATURE_11AC
2262 limPopulateVhtMcsSet(pMac, &pStaDs->supportedRates, pVHTCaps, psessionEntry);
2263#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002264 /**
2265 * Set the erpEnabled bit iff the phy is in G mode and at least
2266 * one A rate is supported
2267 */
2268 if ((phyMode == WNI_CFG_PHY_MODE_11G) && isArate)
2269 pStaDs->erpEnabled = eHAL_SET;
2270
2271
2272
2273 return eSIR_SUCCESS;
2274
2275 error:
2276
2277 return eSIR_FAILURE;
2278} /*** limPopulateMatchingRateSet() ***/
2279
2280
2281
2282/**
2283 * limAddSta()
2284 *
2285 *FUNCTION:
2286 * This function is called to add an STA context at hardware
2287 * whenever a STA is (Re) Associated.
2288 *
2289 *LOGIC:
2290 *
2291 *ASSUMPTIONS:
2292 * NA
2293 *
2294 *NOTE:
2295 * NA
2296 *
2297 * @param pMac - Pointer to Global MAC structure
2298 * @param pStaDs - Pointer to the STA datastructure created by
2299 * LIM and maintained by DPH
2300 * @return retCode - Indicates success or failure return code
2301 */
2302
2303tSirRetStatus
2304limAddSta(
2305 tpAniSirGlobal pMac,
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002306 tpDphHashNode pStaDs, tANI_U8 updateEntry, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002307{
2308 tpAddStaParams pAddStaParams = NULL;
2309 tSirMsgQ msgQ;
2310 tSirRetStatus retCode = eSIR_SUCCESS;
2311 tSirMacAddr staMac, *pStaAddr;
2312 tANI_U8 i;
Jeff Johnson295189b2012-06-20 16:38:30 -07002313 tpSirAssocReq pAssocReq;
2314 tANI_U8 *p2pIe = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002315 #if 0
2316 retCode = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg);
2317 if (retCode != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002318 limLog(pMac, LOGP, FL("could not retrieve STA MAC"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002319 #endif //To SUPPORT BT-AMP
2320
2321
2322 sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
2323
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302324 limLog(pMac, LOG1, FL("sessionid: %d updateEntry = %d limsystemrole = %d "),
2325 psessionEntry->smeSessionId, updateEntry, psessionEntry->limSystemRole);
2326
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302327 pAddStaParams = vos_mem_malloc(sizeof(tAddStaParams));
2328 if (NULL == pAddStaParams)
2329 {
2330 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
2331 return eSIR_MEM_ALLOC_FAILED;
2332 }
2333 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002334
2335 if ((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||
2336 (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE) ||
2337 (limGetSystemRole(psessionEntry) == eLIM_BT_AMP_AP_ROLE) )
2338 pStaAddr = &pStaDs->staAddr;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002339#ifdef FEATURE_WLAN_TDLS
2340 /* SystemRole shouldn't be matter if staType is TDLS peer */
2341 else if(STA_ENTRY_TDLS_PEER == pStaDs->staType)
2342 {
2343 pStaAddr = &pStaDs->staAddr ;
2344 }
2345#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002346 else
2347 pStaAddr = &staMac;
2348
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302349 limLog(pMac, LOG1, FL(MAC_ADDRESS_STR": Subtype(Assoc/Reassoc): %d "),
2350 MAC_ADDR_ARRAY(*pStaAddr), pStaDs->mlmStaContext.subType);
2351
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302352 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2353 (tANI_U8 *) *pStaAddr, sizeof(tSirMacAddr));
2354 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
2355 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002356
2357 limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
2358
2359 //Copy legacy rates
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302360 vos_mem_copy ((tANI_U8*)&pAddStaParams->supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -07002361 (tANI_U8*)&pStaDs->supportedRates, sizeof(tSirSupportedRates));
2362
2363 pAddStaParams->assocId = pStaDs->assocId;
2364
2365 pAddStaParams->wmmEnabled = pStaDs->qosMode;
2366 pAddStaParams->listenInterval = pStaDs->mlmStaContext.listenInterval;
2367 pAddStaParams->shortPreambleSupported = pStaDs->shortPreambleEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07002368 if((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) && (pStaDs->mlmStaContext.subType == LIM_REASSOC))
2369 {
2370 /* TBD - need to remove this REASSOC check after fixinf rmmod issue */
2371 pAddStaParams->updateSta = pStaDs->mlmStaContext.updateContext;
2372 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002373 pStaDs->valid = 0;
2374 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
2375
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302376 limLog(pMac, LOG2, FL(" Assoc ID: %d wmmEnabled = %d listenInterval = %d"
2377 " shortPreambleSupported: %d "), pAddStaParams->assocId,
2378 pAddStaParams->wmmEnabled, pAddStaParams->listenInterval,
2379 pAddStaParams->shortPreambleSupported);
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07002380 // This will indicate HAL to "allocate" a new STA index
2381#ifdef FEATURE_WLAN_TDLS
2382 /* As there is corner case in-between add_sta and change_sta,if del_sta for other staIdx happened,
2383 * firmware return wrong staIdx (recently removed staIdx). Until we get a confirmation from the
2384 * firmware team it is now return correct staIdx for same sta_mac_addr for update case, we want
2385 * to get around it by passing valid staIdx given by add_sta time.
2386 */
2387 if((STA_ENTRY_TDLS_PEER == pStaDs->staType) &&
2388 (true == updateEntry))
2389 pAddStaParams->staIdx = pStaDs->staIndex;
2390 else
2391#endif
2392 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
Jeff Johnson295189b2012-06-20 16:38:30 -07002393 pAddStaParams->staType = pStaDs->staType;
2394
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002395 pAddStaParams->updateSta = updateEntry;
2396
Jeff Johnson295189b2012-06-20 16:38:30 -07002397 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2398 pAddStaParams->respReqd = 1;
2399 //Update HT Capability
2400
2401 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 -07002402 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002403 pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability;
Jeff Johnsone7245742012-09-05 17:12:55 -07002404#ifdef WLAN_FEATURE_11AC
2405 pAddStaParams->vhtCapable = pStaDs->mlmStaContext.vhtCapability;
2406#endif
2407 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002408#ifdef FEATURE_WLAN_TDLS
2409 /* SystemRole shouldn't be matter if staType is TDLS peer */
2410 else if(STA_ENTRY_TDLS_PEER == pStaDs->staType)
Hoonki Lee99e53782013-02-12 18:07:03 -08002411 {
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002412 pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability;
Hoonki Lee99e53782013-02-12 18:07:03 -08002413#ifdef WLAN_FEATURE_11AC
2414 pAddStaParams->vhtCapable = pStaDs->mlmStaContext.vhtCapability;
2415#endif
2416 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002417#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002418 else
Jeff Johnsone7245742012-09-05 17:12:55 -07002419 {
2420 pAddStaParams->htCapable = psessionEntry->htCapability;
2421#ifdef WLAN_FEATURE_11AC
2422 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
2423#endif
2424
2425 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302426#ifdef WLAN_FEATURE_11AC
2427 limLog(pMac, LOG2, FL("vhtCapable: %d "),pAddStaParams->vhtCapable);
2428#endif
2429 limLog(pMac, LOG2, FL(" StaIdx: %d updateSta = %d htcapable = %d "),
2430 pAddStaParams->staIdx,pAddStaParams->updateSta,
2431 pAddStaParams->htCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002432
2433 pAddStaParams->greenFieldCapable = pStaDs->htGreenfield;
2434 pAddStaParams->maxAmpduDensity= pStaDs->htAMpduDensity;
2435 pAddStaParams->maxAmpduSize = pStaDs->htMaxRxAMpduFactor;
2436 pAddStaParams->fDsssCckMode40Mhz = pStaDs->htDsssCckRate40MHzSupport;
2437 pAddStaParams->fShortGI20Mhz = pStaDs->htShortGI20Mhz;
2438 pAddStaParams->fShortGI40Mhz = pStaDs->htShortGI40Mhz;
2439 pAddStaParams->lsigTxopProtection = pStaDs->htLsigTXOPProtection;
2440 pAddStaParams->maxAmsduSize = pStaDs->htMaxAmsduLength;
2441 pAddStaParams->txChannelWidthSet = pStaDs->htSupportedChannelWidthSet;
2442 pAddStaParams->mimoPS = pStaDs->htMIMOPSState;
Jeff Johnsone7245742012-09-05 17:12:55 -07002443
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302444 limLog(pMac, LOG2, FL(" greenFieldCapable: %d maxAmpduDensity = %d "
2445 "maxAmpduDensity = %d"), pAddStaParams->greenFieldCapable,
2446 pAddStaParams->maxAmpduDensity, pAddStaParams->maxAmpduSize);
2447
2448 limLog(pMac, LOG2, FL("fDsssCckMode40Mhz: %d fShortGI20Mhz: %d "
2449 "fShortGI40Mhz: %d"), pAddStaParams->fDsssCckMode40Mhz,
2450 pAddStaParams->fShortGI20Mhz, pAddStaParams->fShortGI40Mhz);
2451
2452 limLog(pMac, LOG2, FL("lsigTxopProtection: %d maxAmsduSize: %d "
2453 "txChannelWidthSet: %d mimoPS: %d "), pAddStaParams->lsigTxopProtection,
2454 pAddStaParams->maxAmsduSize,pAddStaParams->txChannelWidthSet,
2455 pAddStaParams->mimoPS);
2456
Jeff Johnsone7245742012-09-05 17:12:55 -07002457#ifdef WLAN_FEATURE_11AC
2458 if(pAddStaParams->vhtCapable)
2459 {
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002460 pAddStaParams->vhtTxChannelWidthSet = pStaDs->vhtSupportedChannelWidthSet;
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08002461 pAddStaParams->vhtTxBFCapable =
Hoonki Lee99e53782013-02-12 18:07:03 -08002462#ifdef FEATURE_WLAN_TDLS
2463 (( STA_ENTRY_PEER == pStaDs->staType ) || (STA_ENTRY_TDLS_PEER == pStaDs->staType)) ?
2464 pStaDs->vhtBeamFormerCapable : psessionEntry->txBFIniFeatureEnabled ;
2465#else
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08002466 ( STA_ENTRY_PEER == pStaDs->staType ) ? pStaDs->vhtBeamFormerCapable :
2467 psessionEntry->txBFIniFeatureEnabled ;
Hoonki Lee99e53782013-02-12 18:07:03 -08002468#endif
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302469 limLog(pMac, LOG2, FL("vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
2470 pAddStaParams->vhtTxChannelWidthSet,pAddStaParams->vhtTxBFCapable);
Jeff Johnsone7245742012-09-05 17:12:55 -07002471 }
2472#endif
2473
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08002474#ifdef FEATURE_WLAN_TDLS
2475 if((STA_ENTRY_PEER == pStaDs->staType) ||
2476 (STA_ENTRY_TDLS_PEER == pStaDs->staType))
2477#else
2478 if (STA_ENTRY_PEER == pStaDs->staType)
2479#endif
2480 {
2481 /* peer STA get the LDPC capability from pStaDs, which populated from
2482 * HT/VHT capability*/
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08002483 if(pAddStaParams->vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP)
2484 {
2485 pAddStaParams->htLdpcCapable = 0;
2486 pAddStaParams->vhtLdpcCapable = 0;
2487 }
2488 else
2489 {
2490 pAddStaParams->htLdpcCapable = pStaDs->htLdpcCapable;
2491 pAddStaParams->vhtLdpcCapable = pStaDs->vhtLdpcCapable;
2492 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08002493 }
2494 else if( STA_ENTRY_SELF == pStaDs->staType)
2495 {
2496 /* For Self STA get the LDPC capability from config.ini*/
2497 pAddStaParams->htLdpcCapable =
2498 (psessionEntry->txLdpcIniFeatureEnabled & 0x01);
2499 pAddStaParams->vhtLdpcCapable =
2500 ((psessionEntry->txLdpcIniFeatureEnabled >> 1)& 0x01);
2501 }
2502
Jeff Johnson295189b2012-06-20 16:38:30 -07002503 /* Update PE session ID*/
2504 pAddStaParams->sessionId = psessionEntry->peSessionId;
2505
2506 if (psessionEntry->parsedAssocReq != NULL)
2507 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002508 // Get a copy of the already parsed Assoc Request
2509 pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
2510 if ( pAssocReq && pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
2511 p2pIe = limGetP2pIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
2512 }
2513 pAddStaParams->p2pCapableSta = (p2pIe != NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002514 }
2515
2516 //Disable BA. It will be set as part of ADDBA negotiation.
2517 for( i = 0; i < STACFG_MAX_TC; i++ )
2518 {
2519 pAddStaParams->staTCParams[i].txUseBA = eBA_DISABLE;
2520 pAddStaParams->staTCParams[i].rxUseBA = eBA_DISABLE;
2521 }
2522
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002523#ifdef FEATURE_WLAN_TDLS
2524 if(pStaDs->wmeEnabled && \
2525 ((eLIM_AP_ROLE == psessionEntry->limSystemRole) || (STA_ENTRY_TDLS_PEER == pStaDs->staType)) )
2526#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 if(pStaDs->wmeEnabled && (eLIM_AP_ROLE == psessionEntry->limSystemRole))
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002528#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002529 {
2530 pAddStaParams->uAPSD = 0;
2531 /* update UAPSD and send it to LIM to add STA */
2532 // bitmap MSB <- LSB MSB 4 bits are for
2533 // trigger enabled AC setting and LSB 4 bits
2534 // are for delivery enabled AC setting
2535 // 7 6 5 4 3 2 1 0
2536 // BE BK VI VO BE BK VI VO
2537 pAddStaParams->uAPSD |= pStaDs->qos.capability.qosInfo.acvo_uapsd;
2538 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acvi_uapsd << 1);
2539 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbk_uapsd << 2);
2540 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbe_uapsd << 3);
2541 //making delivery enabled and trigger enabled setting the same.
2542 pAddStaParams->uAPSD |= pAddStaParams->uAPSD << 4;
2543
2544 pAddStaParams->maxSPLen = pStaDs->qos.capability.qosInfo.maxSpLen;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302545 limLog( pMac, LOG1, FL("uAPSD = 0x%x, maxSpLen = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002546 pAddStaParams->uAPSD, pAddStaParams->maxSPLen);
2547 }
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002548
2549#ifdef WLAN_FEATURE_11W
2550 pAddStaParams->rmfEnabled = pStaDs->rmfEnabled;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302551 limLog( pMac, LOG1, FL( "PMF enabled %d"), pAddStaParams->rmfEnabled);
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002552#endif
2553
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302554 limLog(pMac, LOG2, FL("htLdpcCapable: %d vhtLdpcCapable: %d "
2555 "p2pCapableSta: %d"), pAddStaParams->htLdpcCapable,
2556 pAddStaParams->vhtLdpcCapable, pAddStaParams->p2pCapableSta);
2557
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002558 //we need to defer the message until we get the response back from HAL.
Jeff Johnson295189b2012-06-20 16:38:30 -07002559 if (pAddStaParams->respReqd)
2560 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07002561
2562 msgQ.type = WDA_ADD_STA_REQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07002563
2564 msgQ.reserved = 0;
2565 msgQ.bodyptr = pAddStaParams;
2566 msgQ.bodyval = 0;
2567
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002568 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_STA_REQ for assocId %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002569 pStaDs->assocId);
Jeff Johnsone7245742012-09-05 17:12:55 -07002570 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002571
2572 retCode = wdaPostCtrlMsg( pMac, &msgQ );
2573 if( eSIR_SUCCESS != retCode)
2574 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002575 if (pAddStaParams->respReqd)
2576 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002577 limLog( pMac, LOGE, FL("ADD_STA_REQ for aId %d failed (reason %X)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002578 pStaDs->assocId, retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302579 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002580 }
2581
2582 return retCode;
2583}
2584
2585
2586/**
2587 * limDelSta()
2588 *
2589 *FUNCTION:
2590 * This function is called to delete an STA context at hardware
2591 * whenever a STA is disassociated
2592 *
2593 *LOGIC:
2594 *
2595 *ASSUMPTIONS:
2596 * NA
2597 *
2598 *NOTE:
2599 * NA
2600 *
2601 * @param pMac - Pointer to Global MAC structure
2602 * @param pStaDs - Pointer to the STA datastructure created by
2603 * LIM and maintained by DPH
2604 * @param fRespReqd - flag to indicate whether the delete is synchronous (true)
2605 * or not (false)
2606 * @return retCode - Indicates success or failure return code
2607 */
2608
2609tSirRetStatus
2610limDelSta(
2611 tpAniSirGlobal pMac,
2612 tpDphHashNode pStaDs,
2613 tANI_BOOLEAN fRespReqd,
2614 tpPESession psessionEntry)
2615{
2616 tpDeleteStaParams pDelStaParams = NULL;
2617 tSirMsgQ msgQ;
2618 tSirRetStatus retCode = eSIR_SUCCESS;
2619
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302620 pDelStaParams = vos_mem_malloc(sizeof( tDeleteStaParams ));
2621 if (NULL == pDelStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07002622 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302623 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002624 return eSIR_MEM_ALLOC_FAILED;
2625 }
2626
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302627 vos_mem_set((tANI_U8 *) pDelStaParams, sizeof(tDeleteStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002628
2629 //
2630 // DPH contains the STA index only for "peer" STA entries.
2631 // LIM global contains "self" STA index
2632 // Thus,
2633 // if( STA role )
2634 // get STA index from LIM global
2635 // else
2636 // get STA index from DPH
2637 //
2638
2639#if 0
2640 /* Since we have not created any STA, no need to send msg to delete
2641 * STA to HAL */
2642 if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) {
2643 pDelStaParams->staIdx = 1; /* TODO : This is workaround. Need to find right STA Index before sending to HAL */
2644 //return retCode;
2645 }
2646#endif
2647
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002648#ifdef FEATURE_WLAN_TDLS
2649 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)) )
2650#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002651 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 -08002652#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002653 pDelStaParams->staIdx= psessionEntry->staId;
2654
2655 else
2656 pDelStaParams->staIdx= pStaDs->staIndex;
2657
2658 pDelStaParams->assocId = pStaDs->assocId;
2659 pStaDs->valid = 0;
2660
2661 if (! fRespReqd)
2662 pDelStaParams->respReqd = 0;
2663 else
2664 {
2665 //when limDelSta is called from processSmeAssocCnf then mlmState is already set properly.
2666 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs))
2667 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002668 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002669 SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs, eLIM_MLM_WT_DEL_STA_RSP_STATE);
2670 }
2671 if ( (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) ||
2672 (eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) )
2673 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002674 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002675
2676 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
2677
2678 }
2679 pDelStaParams->respReqd = 1;
2680 //we need to defer the message until we get the response back from HAL.
2681 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
2682 }
2683
2684 /* Update PE session ID*/
2685 pDelStaParams->sessionId = psessionEntry->peSessionId;
2686
2687 pDelStaParams->status = eHAL_STATUS_SUCCESS;
2688 msgQ.type = WDA_DELETE_STA_REQ;
2689 msgQ.reserved = 0;
2690 msgQ.bodyptr = pDelStaParams;
2691 msgQ.bodyval = 0;
2692
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302693 limLog( pMac, LOG1, FL( "Sessionid %d :Sending SIR_HAL_DELETE_STA_REQ "
2694 "for STAID: %X and AssocID: %d MAC : "MAC_ADDRESS_STR ),
2695 pDelStaParams->sessionId,
2696 pDelStaParams->staIdx, pDelStaParams->assocId,
2697 MAC_ADDR_ARRAY(pStaDs->staAddr));
2698
Jeff Johnsone7245742012-09-05 17:12:55 -07002699 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002700 retCode = wdaPostCtrlMsg( pMac, &msgQ );
2701 if( eSIR_SUCCESS != retCode)
2702 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002703 if(fRespReqd)
2704 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002705 limLog( pMac, LOGE, FL("Posting DELETE_STA_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002706 retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302707 vos_mem_free(pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002708 }
2709
2710 return retCode;
2711}
2712
2713#if defined WLAN_FEATURE_VOWIFI_11R
2714/*------------------------------------------------------------------------
2715 * limAddFTStaSelf()
2716 *
2717 * FUNCTION:
2718 *
2719 * This function is called to add a STA once we have connected with a new
2720 * AP, that we have performed an FT to.
2721 *
2722 * The Add STA Response is created and now after the ADD Bss Is Successful
2723 * we add the self sta. We update with the association id from the reassoc
2724 * response from the AP.
2725 *------------------------------------------------------------------------
2726 */
2727tSirRetStatus limAddFTStaSelf(tpAniSirGlobal pMac, tANI_U16 assocId, tpPESession psessionEntry)
2728{
2729 tpAddStaParams pAddStaParams = NULL;
2730 tSirMsgQ msgQ;
2731 tSirRetStatus retCode = eSIR_SUCCESS;
2732
2733 pAddStaParams = pMac->ft.ftPEContext.pAddStaReq;
2734 pAddStaParams->assocId = assocId;
2735
2736 msgQ.type = SIR_HAL_ADD_STA_REQ;
2737 msgQ.reserved = 0;
2738 msgQ.bodyptr = pAddStaParams;
2739 msgQ.bodyval = 0;
2740
2741
2742#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002743 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002744#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002745 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002746
2747 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002748 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_ADD_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002749 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
2750 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
2751 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002752 limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X"), retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302753 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002754 }
2755 //
2756 // Dont need it any more
2757 pMac->ft.ftPEContext.pAddStaReq = NULL;
2758 return retCode;
2759}
2760
2761#endif /* WLAN_FEATURE_VOWIFI_11R */
2762
2763/**
2764 * limAddStaSelf()
2765 *
2766 *FUNCTION:
2767 * This function is called to add an STA context at hardware
2768 * whenever a STA is (Re) Associated.
2769 *
2770 *LOGIC:
2771 *
2772 *ASSUMPTIONS:
2773 * NA
2774 *
2775 *NOTE:
2776 * NA
2777 *
2778 * @param pMac - Pointer to Global MAC structure
2779 * @param pStaDs - Pointer to the STA datastructure created by
2780 * LIM and maintained by DPH
2781 * @return retCode - Indicates success or failure return code
2782 */
2783
2784tSirRetStatus
2785limAddStaSelf(tpAniSirGlobal pMac,tANI_U16 staIdx, tANI_U8 updateSta, tpPESession psessionEntry)
2786{
2787 tpAddStaParams pAddStaParams = NULL;
2788 tSirMsgQ msgQ;
2789 tSirRetStatus retCode = eSIR_SUCCESS;
2790 tSirMacAddr staMac;
2791 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
krunal soni71343fb2013-09-16 16:16:26 -07002792 tANI_U32 shortGi20MhzSupport;
2793 tANI_U32 shortGi40MhzSupport;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002794 /*This self Sta dot 11 mode comes from the cfg and the expectation here is
2795 * that cfg carries the systemwide capability that device under
2796 * consideration can support. This capability gets plumbed into the cfg
2797 * cache at system initialization time via the .dat and .ini file override
2798 * mechanisms and will not change. If it does change, it is the
2799 * responsibility of SME to evict the selfSta and reissue a new AddStaSelf
2800 * command.*/
2801 tANI_U32 selfStaDot11Mode=0, selfTxWidth=0;
2802 wlan_cfgGetInt(pMac,WNI_CFG_DOT11_MODE,&selfStaDot11Mode);
2803 limLog( pMac, LOG1, FL("cfgDot11Mode %d"),(int)selfStaDot11Mode);
2804 wlan_cfgGetInt(pMac,WNI_CFG_HT_CAP_INFO_SUPPORTED_CHAN_WIDTH_SET,&selfTxWidth);
2805 limLog( pMac, LOG1, FL("SGI 20 %d"),(int)selfTxWidth);
2806 limLog( pMac, LOG1, FL("Roam Channel Bonding Mode %d"),(int)pMac->roam.configParam.uCfgDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002807
2808 #if 0
2809 retCode =wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg);
2810 if (retCode != eSIR_SUCCESS)
2811 {
2812 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002813 limLog(pMac, LOGP, FL("could not retrieve STA MAC"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002814 return retCode;
2815 }
2816 #endif //TO SUPPORT BT-AMP
2817 sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302818 limLog(pMac, LOG1, FL(MAC_ADDRESS_STR": "),MAC_ADDR_ARRAY(staMac));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302819 pAddStaParams = vos_mem_malloc(sizeof(tAddStaParams));
2820 if (NULL == pAddStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07002821 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302822 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002823 return eSIR_MEM_ALLOC_FAILED;
2824 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302825 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002826
2827 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302828 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2829 (tANI_U8 *) staMac, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002830
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302831 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
2832 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002833
2834 pAddStaParams->assocId = psessionEntry->limAID;
2835 pAddStaParams->staType = STA_ENTRY_SELF;
2836 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2837 pAddStaParams->respReqd = 1;
2838
2839 /* Update PE session ID */
2840 pAddStaParams->sessionId = psessionEntry->peSessionId;
2841
2842 // This will indicate HAL to "allocate" a new STA index
2843 pAddStaParams->staIdx = staIdx;
2844 pAddStaParams->updateSta = updateSta;
2845
2846 pAddStaParams->shortPreambleSupported = psessionEntry->beaconParams.fShortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -07002847
Jeff Johnsone7245742012-09-05 17:12:55 -07002848#ifdef WLAN_FEATURE_11AC
2849 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry,NULL);
2850#else
2851 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
2852#endif
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002853// if( psessionEntry->htCapability)---> old check
2854 /*We used to check if the session is htCapable before setting the htCapable
2855 * flag. The check limited us from operating */
2856 if ( IS_DOT11_MODE_HT(selfStaDot11Mode) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002857 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002858 pAddStaParams->htCapable = TRUE ;
Jeff Johnson295189b2012-06-20 16:38:30 -07002859#ifdef DISABLE_GF_FOR_INTEROP
2860 /*
2861 * To resolve the interop problem with Broadcom AP,
2862 * where TQ STA could not pass traffic with GF enabled,
2863 * TQ STA will do Greenfield only with TQ AP, for
2864 * everybody else it will be turned off.
2865 */
2866 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2867 {
2868 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
2869 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
2870 }
2871 else
2872#endif
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002873 {
2874 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
2875 pAddStaParams->txChannelWidthSet =
2876 pMac->roam.configParam.channelBondingMode5GHz;
2877 // pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
2878 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
2879 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
2880 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
2881 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
2882 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
2883 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
2884 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
2885 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
krunal soni71343fb2013-09-16 16:16:26 -07002886 /*
2887 * We will read the gShortGI20Mhz from ini file, and if it is set
2888 * to 1 then we will tell Peer that we support 40Mhz short GI
2889 */
2890 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
2891 (pMac, WNI_CFG_SHORT_GI_20MHZ,
2892 &shortGi20MhzSupport)))
2893 {
2894 if (VOS_TRUE == shortGi20MhzSupport)
2895 {
2896 pAddStaParams->fShortGI20Mhz =
2897 WNI_CFG_SHORT_GI_20MHZ_STAMAX;
2898 //pAddStaParams->fShortGI20Mhz =
2899 //limGetHTCapability(pMac, eHT_SHORT_GI_20MHZ,
2900 // psessionEntry);
2901 }
2902 else
2903 {
2904 pAddStaParams->fShortGI20Mhz = VOS_FALSE;
2905 }
2906 }
2907 else
2908 {
2909 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz"
2910 "CFG,setting value to default"));)
2911 pAddStaParams->fShortGI20Mhz = WNI_CFG_SHORT_GI_20MHZ_STADEF;
2912 }
2913
2914 /*
2915 * We will read the gShortGI40Mhz from ini file, and if it is set
2916 * to 1 then we will tell Peer that we support 40Mhz short GI
2917 */
2918 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
2919 (pMac, WNI_CFG_SHORT_GI_40MHZ,
2920 &shortGi40MhzSupport)))
2921 {
2922 if (VOS_TRUE == shortGi40MhzSupport)
2923 {
2924 pAddStaParams->fShortGI40Mhz =
2925 WNI_CFG_SHORT_GI_40MHZ_STAMAX;
2926 //pAddStaParams->fShortGI40Mhz =
2927 //limGetHTCapability(pMac, eHT_SHORT_GI_40MHZ,
2928 // psessionEntry);
2929 }
2930 else
2931 {
2932 pAddStaParams->fShortGI40Mhz = VOS_FALSE;
2933 }
2934 }
2935 else
2936 {
2937 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz"
2938 "CFG,setting value to default"));)
2939 pAddStaParams->fShortGI40Mhz = WNI_CFG_SHORT_GI_40MHZ_STADEF;
2940 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302941 limLog(pMac, LOG2, FL(" greenFieldCapable: %d maxAmpduDensity = %d "
2942 "maxAmpduSize = %d"), pAddStaParams->greenFieldCapable,
2943 pAddStaParams->maxAmpduDensity, pAddStaParams->maxAmpduSize);
2944
2945 limLog(pMac, LOG2, FL("fDsssCckMode40Mhz: %d fShortGI20Mhz: %d "
2946 "fShortGI40Mhz: %d lsigTxopProtection: %d"),
2947 pAddStaParams->fDsssCckMode40Mhz, pAddStaParams->fShortGI20Mhz,
2948 pAddStaParams->fShortGI40Mhz, pAddStaParams->lsigTxopProtection);
2949
2950 limLog(pMac, LOG2, FL(" maxAmsduSize: %d txChannelWidthSet: %d "
2951 "mimoPS: %d rifsMode %d delBASupport %d"),
2952 pAddStaParams->maxAmsduSize,
2953 pAddStaParams->txChannelWidthSet, pAddStaParams->mimoPS,
2954 pAddStaParams->rifsMode, pAddStaParams->delBASupport );
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002955 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002956 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002957#ifdef WLAN_FEATURE_11AC
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002958 pAddStaParams->vhtCapable = IS_DOT11_MODE_VHT(selfStaDot11Mode);
2959 if (pAddStaParams->vhtCapable){
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07002960 pAddStaParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002961 limLog( pMac, LOG1, FL("VHT WIDTH SET %d"),pAddStaParams->vhtTxChannelWidthSet);
2962 }
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08002963 pAddStaParams->vhtTxBFCapable = psessionEntry->txBFIniFeatureEnabled;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302964 limLog(pMac, LOG2, FL("vhtCapable: %d vhtTxBFCapable %d "),
2965 pAddStaParams->vhtCapable, pAddStaParams->vhtTxBFCapable);
Jeff Johnsone7245742012-09-05 17:12:55 -07002966#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08002967
2968 /* For Self STA get the LDPC capability from session i.e config.ini*/
2969 pAddStaParams->htLdpcCapable =
2970 (psessionEntry->txLdpcIniFeatureEnabled & 0x01);
2971 pAddStaParams->vhtLdpcCapable =
2972 ((psessionEntry->txLdpcIniFeatureEnabled >> 1)& 0x01);
2973
Jeff Johnson295189b2012-06-20 16:38:30 -07002974 if(wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002975 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002976 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
2977
Jeff Johnson295189b2012-06-20 16:38:30 -07002978 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona)
2979 {
2980 pAddStaParams->p2pCapableSta = 1;
2981 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002982
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002983 //limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
2984 pAddStaParams->supportedRates.opRateMode = limGetStaRateMode((tANI_U8)selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002985
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302986 limLog(pMac, LOG2, FL(" StaIdx: %d updateSta = %d htcapable = %d "),
2987 pAddStaParams->staIdx,pAddStaParams->updateSta,
2988 pAddStaParams->htCapable);
2989
2990 limLog(pMac, LOG2, FL("htLdpcCapable: %d vhtLdpcCapable: %d "
2991 "p2pCapableSta: %d"),
2992 pAddStaParams->htLdpcCapable,pAddStaParams->vhtLdpcCapable,
2993 pAddStaParams->p2pCapableSta);
2994
2995 limLog(pMac, LOG2, FL(" sessionid: %d Assoc ID: %d listenInterval = %d"
2996 " shortPreambleSupported: %d "), psessionEntry->smeSessionId,
2997 pAddStaParams->assocId, pAddStaParams->listenInterval,
2998 pAddStaParams->shortPreambleSupported);
2999
Jeff Johnson295189b2012-06-20 16:38:30 -07003000 msgQ.type = WDA_ADD_STA_REQ;
3001 //
3002 // FIXME_GEN4
3003 // A global counter (dialog token) is required to keep track of
3004 // all PE <-> HAL communication(s)
3005 //
3006 msgQ.reserved = 0;
3007 msgQ.bodyptr = pAddStaParams;
3008 msgQ.bodyval = 0;
3009
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303010 limLog( pMac, LOGW, FL(MAC_ADDRESS_STR":Sessionid %d : "
3011 "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ),
3012 MAC_ADDR_ARRAY(pAddStaParams->staMac),
3013 pAddStaParams->sessionId,
3014 pAddStaParams->assocId);
Jeff Johnsone7245742012-09-05 17:12:55 -07003015 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003016
3017 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
3018 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003019 limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X"), retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303020 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003021 }
3022 return retCode;
3023}
3024
3025
3026/**
3027 * limTeardownInfraBSS()
3028 *
3029 *FUNCTION:
3030 * This function is called by various LIM functions to teardown
3031 * an established Infrastructure BSS
3032 *
3033 *LOGIC:
3034 *
3035 *ASSUMPTIONS:
3036 *
3037 *NOTE:
3038 *
3039 * @param pMac - Pointer to Global MAC structure
3040 * @return None
3041 */
3042
3043void
3044limTeardownInfraBss(tpAniSirGlobal pMac,tpPESession psessionEntry)
3045{
3046 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3047
3048 /**
3049 * Send Broadcast Disassociate frame with
3050 * 'leaving BSS' reason.
3051 */
3052 limSendDisassocMgmtFrame(pMac,
3053 eSIR_MAC_DISASSOC_LEAVING_BSS_REASON,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003054 bcAddr,psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003055} /*** end limTeardownInfraBss() ***/
3056
3057
3058/**
3059 * limHandleCnfWaitTimeout()
3060 *
3061 *FUNCTION:
3062 * This function is called by limProcessMessageQueue to handle
3063 * various confirmation failure cases.
3064 *
3065 *LOGIC:
3066 *
3067 *ASSUMPTIONS:
3068 *
3069 *NOTE:
3070 *
3071 * @param pMac - Pointer to Global MAC structure
3072 * @param pStaDs - Pointer to a sta descriptor
3073 * @return None
3074 */
3075
3076void limHandleCnfWaitTimeout(tpAniSirGlobal pMac, tANI_U16 staId)
3077{
3078 tpDphHashNode pStaDs;
3079 tLimSystemRole systemRole;
3080 tpPESession psessionEntry = NULL;
3081
3082 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId))== NULL)
3083 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003084 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003085 return;
3086 }
3087 systemRole = limGetSystemRole(psessionEntry);
3088 pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable);
3089
3090 if (pStaDs == NULL)
3091 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003092 PELOGW(limLog(pMac, LOGW, FL("No STA context in SIR_LIM_CNF_WAIT_TIMEOUT."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003093 return;
3094 }
3095
3096 switch (pStaDs->mlmStaContext.mlmState) {
3097 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003098 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 -07003099 limPrintMacAddr(pMac, pStaDs->staAddr, LOGW);
3100
3101 if ( (systemRole == eLIM_AP_ROLE)|| (systemRole == eLIM_BT_AMP_AP_ROLE) )
3102 {
3103 limRejectAssociation(
3104 pMac,
3105 pStaDs->staAddr,
3106 pStaDs->mlmStaContext.subType,
3107 true,
3108 pStaDs->mlmStaContext.authType,
3109 pStaDs->assocId,
3110 true,
3111 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
3112 psessionEntry);
3113 }
3114 break;
3115
3116 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003117 limLog(pMac, LOGW, FL("Received CNF_WAIT_TIMEOUT in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003118 pStaDs->mlmStaContext.mlmState);
3119 }
3120}
3121
3122
3123/**
3124 * limDeleteDphHashEntry()
3125 *
3126 *FUNCTION:
3127 * This function is called whenever we need to delete
3128 * the dph hash entry
3129 *
3130 *LOGIC:
3131 *
3132 *ASSUMPTIONS:
3133 *
3134 *NOTE:
3135 *
3136 * @param pMac Pointer to Global MAC structure
3137 * @param tANI_U16 staId
3138 * @return None
3139 */
3140
3141void
3142limDeleteDphHashEntry(tpAniSirGlobal pMac, tSirMacAddr staAddr, tANI_U16 staId,tpPESession psessionEntry)
3143{
3144 tANI_U16 aid;
3145 tpDphHashNode pStaDs;
3146 tUpdateBeaconParams beaconParams;
3147 tLimSystemRole systemRole;
3148
Kaushik, Sushantfb156732014-01-07 15:36:03 +05303149 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Jeff Johnson295189b2012-06-20 16:38:30 -07003150 beaconParams.paramChangeBitmap = 0;
3151 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, staId);
3152 if (NULL == psessionEntry)
3153 {
3154 PELOGE(limLog(pMac, LOGE, FL("NULL psessionEntry"));)
3155 return;
3156 }
3157 systemRole = limGetSystemRole(psessionEntry);
3158 beaconParams.bssIdx = psessionEntry->bssIdx;
3159 pStaDs = dphLookupHashEntry(pMac, staAddr, &aid, &psessionEntry->dph.dphHashTable);
3160 if (pStaDs != NULL)
3161 {
3162 PELOGW(limLog(pMac, LOGW, FL("Deleting DPH Hash entry for STAID: %X\n "), staId);)
3163 // update the station count and perform associated actions
3164 // do this before deleting the dph hash entry
3165 limUtilCountStaDel(pMac, pStaDs, psessionEntry);
3166
3167 if((eLIM_AP_ROLE == psessionEntry->limSystemRole) ||
3168 (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole))
3169 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003170 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
3171 if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE){
3172 limDecideApProtectionOnDelete(pMac, pStaDs, &beaconParams,psessionEntry);
3173 }
3174 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003175
3176 if(eLIM_STA_IN_IBSS_ROLE == systemRole)
3177 limIbssDecideProtectionOnDelete(pMac, pStaDs, &beaconParams, psessionEntry);
3178
3179 limDecideShortPreamble(pMac, pStaDs, &beaconParams, psessionEntry);
3180 limDecideShortSlot(pMac, pStaDs, &beaconParams, psessionEntry);
3181
3182 //Send message to HAL about beacon parameter change.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003183 PELOGW(limLog(pMac, LOGW, FL("param bitmap = %d "), beaconParams.paramChangeBitmap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003184 if(beaconParams.paramChangeBitmap)
3185 {
3186 schSetFixedBeaconFields(pMac,psessionEntry);
3187 limSendBeaconParams(pMac, &beaconParams, psessionEntry );
3188 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08003189
3190#ifdef WLAN_FEATURE_11W
3191 tx_timer_delete(&pStaDs->pmfSaQueryTimer);
3192#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003193 }
3194 if (dphDeleteHashEntry(pMac, staAddr, staId, &psessionEntry->dph.dphHashTable) != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003195 limLog(pMac, LOGP, FL("error deleting hash entry"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003196 }
3197}
3198
3199
3200
3201/**
3202 * limCheckAndAnnounceJoinSuccess()
3203 *
3204 *FUNCTION:
3205 * This function is called upon receiving Beacon/Probe Response
3206 * frame in WT_JOIN_BEACON_STATE to check if the received
3207 * Beacon/Probe Response is from the BSS that we're attempting
3208 * to join.
3209 *
3210 *LOGIC:
3211 * If the Beacon/Probe Response is indeed from the BSS we're
3212 * attempting to join, join success is sent to SME.
3213 *
3214 *ASSUMPTIONS:
3215 *
3216 *NOTE:
3217 *
3218 * @param pMac Pointer to Global MAC structure
3219 * @param pBPR Pointer to received Beacon/Probe Response
3220 * @param pHdr Pointer to received Beacon/Probe Response
3221 * MAC header
3222 * @return None
3223 */
3224
3225void
3226limCheckAndAnnounceJoinSuccess(tpAniSirGlobal pMac,
3227 tSirProbeRespBeacon *pBPR,
3228 tpSirMacMgmtHdr pHdr,tpPESession psessionEntry)
3229{
3230 tSirMacSSid currentSSID;
3231 tLimMlmJoinCnf mlmJoinCnf;
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -08003232 tANI_U32 val = 0;
3233 tANI_U32 *noa1DurationFromBcn = NULL;
3234 tANI_U32 *noa2DurationFromBcn = NULL;
3235 tANI_U32 noa;
3236 tANI_U32 TotalNum_NoADesc = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003237
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303238 vos_mem_copy(currentSSID.ssId,
3239 psessionEntry->ssId.ssId,
3240 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003241
3242 currentSSID.length = (tANI_U8)psessionEntry->ssId.length ;
3243
3244 if (
3245 /* Check for SSID only in probe response. Beacons may not carry
3246 SSID information in hidden SSID case */
3247 ( (SIR_MAC_MGMT_FRAME == pHdr->fc.type) &&
3248 (SIR_MAC_MGMT_PROBE_RSP == pHdr->fc.subType) ) &&
3249 currentSSID.length &&
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303250 (!vos_mem_compare((tANI_U8 *) &pBPR->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07003251 (tANI_U8 *) &currentSSID,
3252 (tANI_U8) (1 + currentSSID.length)) ))
3253 {
3254 /**
3255 * Received SSID does not match with the one we've.
3256 * Ignore received Beacon frame
3257 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003258 PELOG1(limLog(pMac, LOG1, FL("SSID received in Beacon does not match"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003259#ifdef WLAN_DEBUG
3260 pMac->lim.gLimBcnSSIDMismatchCnt++;
3261#endif
3262 return;
3263 }
3264
3265 if( (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_STA_ROLE))
3266 {
Nirav Shahbc35fb72013-12-12 18:14:06 +05303267 limLog(pMac, LOG1, FL("Received Beacon/PR with matching BSSID"
3268 MAC_ADDRESS_STR "PESessionID %d"),
3269 MAC_ADDR_ARRAY(psessionEntry->bssId),
3270 psessionEntry->peSessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07003271 // Deactivate Join Failure timer
3272 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003273 // Deactivate Periodic Join timer
3274 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
Jeff Johnson295189b2012-06-20 16:38:30 -07003275
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -08003276 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona &&
3277 pBPR->P2PProbeRes.NoticeOfAbsence.present)
3278 {
3279
3280 noa1DurationFromBcn = (tANI_U32*)(pBPR->P2PProbeRes.NoticeOfAbsence.NoADesc + 1);
3281
3282 if(pBPR->P2PProbeRes.NoticeOfAbsence.num_NoADesc)
3283 TotalNum_NoADesc = pBPR->P2PProbeRes.NoticeOfAbsence.num_NoADesc/SIZE_OF_NOA_DESCRIPTOR;
3284
3285 noa = *noa1DurationFromBcn;
3286
3287 if(TotalNum_NoADesc > 1)
3288 {
3289 noa2DurationFromBcn = (tANI_U32*)(pBPR->P2PProbeRes.NoticeOfAbsence.NoADesc + SIZE_OF_NOA_DESCRIPTOR + 1);
3290 noa += *noa2DurationFromBcn;
3291 }
3292
3293 /*If MAX Noa exceeds 3 secs we will consider only 3 secs to
3294 * avoid arbitary values in noa duration field
3295 */
3296 noa = noa > MAX_NOA_PERIOD_IN_MICROSECS ? MAX_NOA_PERIOD_IN_MICROSECS : noa;
3297 noa = noa/1000; //Convert to ms
3298
3299 if( wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,&val) == eSIR_SUCCESS )
3300 {
3301 psessionEntry->defaultAuthFailureTimeout = val;
3302 ccmCfgSetInt(pMac,WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT ,val + noa, NULL, eANI_BOOLEAN_FALSE);
3303 }
3304 }
3305 else
3306 {
3307 psessionEntry->defaultAuthFailureTimeout = 0;
3308 }
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -08003309
Jeff Johnson295189b2012-06-20 16:38:30 -07003310 // Update Beacon Interval at CFG database
3311
3312 if ( pBPR->HTCaps.present )
3313 limUpdateStaRunTimeHTCapability( pMac, &pBPR->HTCaps );
3314 if ( pBPR->HTInfo.present )
3315 limUpdateStaRunTimeHTInfo( pMac, &pBPR->HTInfo, psessionEntry);
3316 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003317 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003318
Jeff Johnson295189b2012-06-20 16:38:30 -07003319
3320 /**
3321 * Announce join success by sending
3322 * Join confirm to SME.
3323 */
3324 mlmJoinCnf.resultCode = eSIR_SME_SUCCESS;
3325 mlmJoinCnf.protStatusCode = eSIR_MAC_SUCCESS_STATUS;
3326 /* Update PE sessionId*/
3327 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3328 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
3329 } // if ((pMac->lim.gLimSystemRole == IBSS....
3330}
3331
3332/**
3333 * limExtractApCapabilities()
3334 *
3335 *FUNCTION:
3336 * This function is called to extract all of the AP's capabilities
3337 * from the IEs received from it in Beacon/Probe Response frames
3338 *
3339 *LOGIC:
3340 * This routine mimics the limExtractApCapability() API. The difference here
3341 * is that this API returns the entire tSirProbeRespBeacon info as is. It is
3342 * left to the caller of this API to use this info as required
3343 *
3344 *ASSUMPTIONS:
3345 * NA
3346 *
3347 *NOTE:
3348 *
3349 * @param pMac Pointer to Global MAC structure
3350 * @param pIE Pointer to starting IE in Beacon/Probe Response
3351 * @param ieLen Length of all IEs combined
3352 * @param beaconStruct A pointer to tSirProbeRespBeacon that needs to be
3353 * populated
3354 * @return status A status reporting eSIR_SUCCESS or eSIR_FAILURE
3355 */
3356tSirRetStatus limExtractApCapabilities( tpAniSirGlobal pMac,
3357 tANI_U8 *pIE,
3358 tANI_U16 ieLen,
3359 tpSirProbeRespBeacon beaconStruct )
3360{
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303361 vos_mem_set((tANI_U8 *) beaconStruct, sizeof( tSirProbeRespBeacon ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003362
3363 PELOG3(limLog( pMac, LOG3,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003364 FL( "In limExtractApCapabilities: The IE's being received are:" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003365 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG3, pIE, ieLen );)
3366
3367 // Parse the Beacon IE's, Don't try to parse if we dont have anything in IE
3368 if (ieLen > 0) {
3369 if( eSIR_SUCCESS != sirParseBeaconIE( pMac, beaconStruct, pIE, (tANI_U32)ieLen ))
3370 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003371 limLog( pMac, LOGE, FL("APCapExtract: Beacon parsing error!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003372 return eSIR_FAILURE;
3373 }
3374 }
3375
3376 return eSIR_SUCCESS;
3377}
3378
3379
3380/**
3381 * limDelBss()
3382 *
3383 *FUNCTION:
3384 * This function is called to delete BSS context at hardware
3385 * whenever a STA is disassociated
3386 *
3387 *LOGIC:
3388 *
3389 *ASSUMPTIONS:
3390 * NA
3391 *
3392 *NOTE:
3393 * NA
3394 *
3395 * @param pMac - Pointer to Global MAC structure
3396 * @param pStaDs - Pointer to the STA datastructure created by
3397 * LIM and maintained by DPH
3398 * @return retCode - Indicates success or failure return code
3399 */
3400
3401tSirRetStatus
3402limDelBss(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tANI_U16 bssIdx,tpPESession psessionEntry)
3403{
3404 tpDeleteBssParams pDelBssParams = NULL;
3405 tSirMsgQ msgQ;
3406 tSirRetStatus retCode = eSIR_SUCCESS;
3407
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303408 pDelBssParams = vos_mem_malloc(sizeof(tDeleteBssParams));
3409 if (NULL == pDelBssParams)
3410 {
3411 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 return eSIR_MEM_ALLOC_FAILED;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303413 }
3414 vos_mem_set((tANI_U8 *) pDelBssParams, sizeof(tDeleteBssParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003415
3416
3417 pDelBssParams->sessionId = psessionEntry->peSessionId; //update PE session Id
3418
3419 //DPH was storing the AssocID in staID field,
3420 //staID is actually assigned by HAL when AddSTA message is sent.
3421 if (pStaDs != NULL)
3422 {
3423 pDelBssParams->bssIdx= pStaDs->bssId;
3424 pStaDs->valid = 0;
3425 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
3426 }
3427 else
3428 pDelBssParams->bssIdx = bssIdx;
3429 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003430 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_BSS_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003431
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07003432 if((psessionEntry->peSessionId == pMac->lim.limTimers.gLimJoinFailureTimer.sessionId) &&
3433 (VOS_TRUE == tx_timer_running(&pMac->lim.limTimers.gLimJoinFailureTimer)))
3434 {
3435 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
3436 }
3437
Jeff Johnson295189b2012-06-20 16:38:30 -07003438 pDelBssParams->status= eHAL_STATUS_SUCCESS;
3439 pDelBssParams->respReqd = 1;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303440
3441 PELOGW(limLog( pMac, LOGW, FL("Sessionid %d : Sending HAL_DELETE_BSS_REQ "
3442 "for bss idx: %X BSSID:"MAC_ADDRESS_STR), pDelBssParams->sessionId,
3443 pDelBssParams->bssIdx,
3444 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003445
3446 //we need to defer the message until we get the response back from HAL.
3447 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
3448
3449 msgQ.type = WDA_DELETE_BSS_REQ;
3450 msgQ.reserved = 0;
3451 msgQ.bodyptr = pDelBssParams;
3452 msgQ.bodyval = 0;
3453
Jeff Johnsone7245742012-09-05 17:12:55 -07003454 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003455
3456 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
3457 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003458 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003459 limLog( pMac, LOGE, FL("Posting DELETE_BSS_REQ to HAL failed, reason=%X"), retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303460 vos_mem_free(pDelBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003461 }
3462
3463 return retCode;
3464}
3465
3466
Jeff Johnson295189b2012-06-20 16:38:30 -07003467
3468/**
3469 * limSendAddBss()
3470 *
3471 *FUNCTION:
3472 *
3473 *LOGIC:
3474 * 1) LIM receives eWNI_SME_JOIN_REQ
3475 * 2) For a valid eWNI_SME_JOIN_REQ, LIM sends
3476 * SIR_HAL_ADD_BSS_REQ to HAL
3477 *
3478 *ASSUMPTIONS:
3479 * JOIN REQ parameters are saved in pMac->lim.gLimMlmJoinReq
3480 * ADD BSS parameters can be obtained from two sources:
3481 * 1) pMac->lim.gLimMlmJoinReq
3482 * 2) beaconStruct, passed as paramter
3483 * So, if a reqd parameter is found in bssDescriptions
3484 * then it is given preference over beaconStruct
3485 *
3486 *NOTE:
3487 *
3488 * @param pMac Pointer to Global MAC structure
3489 * pAssocRsp contains the structured assoc/reassoc Response got from AP
3490 * beaconstruct Has the ProbeRsp/Beacon structured details
3491 * bssDescription bssDescription passed to PE from the SME
3492 * @return None
3493 */
3494
3495tSirRetStatus limStaSendAddBss( tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,
3496 tpSchBeaconStruct pBeaconStruct, tpSirBssDescription bssDescription, tANI_U8 updateEntry,
3497 tpPESession psessionEntry)
3498
3499{
3500 tSirMsgQ msgQ;
3501 tpAddBssParams pAddBssParams = NULL;
3502 tANI_U32 retCode;
3503 tANI_U8 i;
3504 tpDphHashNode pStaDs = NULL;
3505 tANI_U8 chanWidthSupp = 0;
krunal soni71343fb2013-09-16 16:16:26 -07003506 tANI_U32 shortGi20MhzSupport;
3507 tANI_U32 shortGi40MhzSupport;
Jeff Johnson295189b2012-06-20 16:38:30 -07003508 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303509 pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
3510 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003511 {
3512 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303513 FL( "Unable to allocate memory during ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003514 retCode = eSIR_MEM_ALLOC_FAILED;
3515 goto returnFailure;
3516 }
3517 else
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303518 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003519
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303520 vos_mem_copy(pAddBssParams->bssId,bssDescription->bssId,
3521 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003522 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303523 vos_mem_copy(pAddBssParams->selfMacAddr,
3524 psessionEntry->selfMacAddr,
3525 sizeof(tSirMacAddr));
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303526
3527 limLog(pMac, LOG1, FL("sessionid: %d updateEntry = %d limsystemrole = %d "),
3528 psessionEntry->smeSessionId,updateEntry,psessionEntry->limSystemRole);
3529
3530 limLog(pMac, LOG1, FL("BSSID: "MAC_ADDRESS_STR),
3531 MAC_ADDR_ARRAY(pAddBssParams->bssId));
3532
Jeff Johnson295189b2012-06-20 16:38:30 -07003533 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3534 {
3535 pAddBssParams->bssType = eSIR_BTAMP_AP_MODE;
3536 }
3537 else
3538 {
3539 pAddBssParams->bssType = eSIR_INFRASTRUCTURE_MODE;
3540 }
3541
3542 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
3543
3544 /* Update PE session ID */
3545 pAddBssParams->sessionId = psessionEntry->peSessionId;
3546
3547 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
3548
3549 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
3550 pAddBssParams->updateBss = updateEntry;
3551
3552
3553 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
3554 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
3555 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
3556 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
3557
3558 pAddBssParams->rateSet.numRates = pAssocRsp->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303559 vos_mem_copy(pAddBssParams->rateSet.rate,
3560 pAssocRsp->supportedRates.rate, pAssocRsp->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07003561
3562 pAddBssParams->nwType = bssDescription->nwType;
3563
Jeff Johnsone7245742012-09-05 17:12:55 -07003564 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -07003565 pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
3566 pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
3567 pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
3568 pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
3569
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303570 limLog(pMac, LOG2, FL(" BSS Type %d Beacon Interval: %d dtimPeriod: %d "
3571 "cfpCount: %d"),pAddBssParams->bssType, pAddBssParams->beaconInterval,
3572 pAddBssParams->dtimPeriod, pAddBssParams->cfParamSet.cfpCount);
3573
3574 limLog(pMac, LOG2, FL(" cfpPeriod: %d cfpMaxDuration: %d cfpDurRemaining:"
3575 " %d numRates: %d "),pAddBssParams->cfParamSet.cfpPeriod,
3576 pAddBssParams->cfParamSet.cfpMaxDuration,
3577 pAddBssParams->cfParamSet.cfpDurRemaining,
3578 pAddBssParams->rateSet.numRates);
3579
3580 limLog(pMac, LOG2, FL("nwType:%d shortSlotTimeSupported: %d"
3581 "llaCoexist: %d llbCoexist: %d llgCoexist: %d ht20Coexist: %d"),
3582 pAddBssParams->nwType, pAddBssParams->shortSlotTimeSupported,
3583 pAddBssParams->llaCoexist, pAddBssParams->llbCoexist,
3584 pAddBssParams->llgCoexist, pAddBssParams->ht20Coexist);
Jeff Johnson295189b2012-06-20 16:38:30 -07003585
3586 // Use the advertised capabilities from the received beacon/PR
3587
3588
3589 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pAssocRsp->HTCaps.present ))
3590 {
3591 pAddBssParams->htCapable = pAssocRsp->HTCaps.present;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303592 limLog(pMac, LOG2, FL("htCapable: %d"),pAddBssParams->htCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07003593 if ( pBeaconStruct->HTInfo.present )
3594 {
3595 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pAssocRsp->HTInfo.opMode;
3596 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pAssocRsp->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -07003597 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003598 if( (pAssocRsp->HTCaps.supportedChannelWidthSet) &&
3599 (chanWidthSupp) )
3600 {
3601 pAddBssParams->txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
3602 pAddBssParams->currentExtChannel = pAssocRsp->HTInfo.secondaryChannelOffset;
3603 }
3604 else
3605 {
3606 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003607 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003608 }
3609 pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent;
3610 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport;
3611 pAddBssParams->fRIFSMode = pAssocRsp->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303612
3613 limLog(pMac, LOG2, FL("htOperMode: %d dualCTSProtection: %d "
3614 "txChannelWidthSet: %d currentExtChannel: %d "),
3615 pAddBssParams->htOperMode, pAddBssParams->dualCTSProtection,
3616 pAddBssParams->txChannelWidthSet,pAddBssParams->currentExtChannel);
3617
3618 limLog(pMac, LOG2, FL("llnNonGFCoexist: %d "
3619 "fLsigTXOPProtectionFullSupport: %d fRIFSMode %d"),
3620 pAddBssParams->llnNonGFCoexist,
3621 pAddBssParams->fLsigTXOPProtectionFullSupport,
3622 pAddBssParams->fRIFSMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003623 }
3624 }
3625
3626 pAddBssParams->currentOperChannel = bssDescription->channelId;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303627 limLog(pMac, LOG2, FL("currentOperChannel %d"),
3628 pAddBssParams->currentOperChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07003629#ifdef WLAN_FEATURE_11AC
3630 if (psessionEntry->vhtCapability && ( pAssocRsp->VHTCaps.present ))
3631 {
3632 pAddBssParams->vhtCapable = pAssocRsp->VHTCaps.present;
3633 pAddBssParams->vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth;
3634 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003635 pAddBssParams->currentOperChannel,
3636 pAddBssParams->currentExtChannel,
3637 psessionEntry->apCenterChan,
3638 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003639 }
3640 else
3641 {
3642 pAddBssParams->vhtCapable = 0;
3643 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303644 limLog(pMac, LOG2, FL("vhtCapable %d vhtTxChannelWidthSet %d "
3645 "currentExtChannel %d"),pAddBssParams->vhtCapable,
3646 pAddBssParams->vhtTxChannelWidthSet,
3647 pAddBssParams->currentExtChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07003648#endif
3649
3650
Jeff Johnson295189b2012-06-20 16:38:30 -07003651 // Populate the STA-related parameters here
3652 // Note that the STA here refers to the AP
3653 {
3654 /* staType = PEER*/
3655 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
3656
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303657 vos_mem_copy(pAddBssParams->staContext.bssId,
3658 bssDescription->bssId,
3659 sizeof( tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003660 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
3661
3662 /* Fill Assoc id from the dph table */
3663 pStaDs = dphLookupHashEntry(pMac, pAddBssParams->staContext.bssId,
3664 &pAddBssParams->staContext.assocId, &psessionEntry->dph.dphHashTable);
3665 if (pStaDs == NULL)
3666 {
Arif Hussain24bafea2013-11-15 15:10:03 -08003667 PELOGE(limLog(pMac, LOGE, FL("Couldn't get assoc id for "
3668 "MAC ADDR: " MAC_ADDRESS_STR),
3669 MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003670 }
3671 pAddBssParams->staContext.uAPSD = 0;
3672 pAddBssParams->staContext.maxSPLen = 0;
3673 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortPreamble;
3674 pAddBssParams->staContext.updateSta = updateEntry;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303675
3676 limLog(pMac, LOG2, FL("StaContext: "MAC_ADDRESS_STR
3677 " shortPreambleSupported: %d"),
3678 MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac),
3679 pAddBssParams->staContext.shortPreambleSupported);
3680
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003681 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && pBeaconStruct->HTCaps.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003682 {
3683 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
3684 pAddBssParams->staContext.htCapable = 1;
3685 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 )pAssocRsp->HTCaps.greenField;
3686 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 )pAssocRsp->HTCaps.lsigTXOPProtection;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303687 limLog(pMac, LOG2,FL("StaContext htCapable: %d greenFieldCapable: %d "
3688 "lsigTxopProtection: %d"), pAddBssParams->staContext.htCapable,
3689 pAddBssParams->staContext.greenFieldCapable,
3690 pAddBssParams->staContext.lsigTxopProtection);
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003691#ifdef WLAN_FEATURE_11AC
3692 if (psessionEntry->vhtCapability && pBeaconStruct->VHTCaps.present)
3693 {
3694 pAddBssParams->staContext.vhtCapable = 1;
3695 if ((pAssocRsp->VHTCaps.suBeamFormerCap ||
3696 pAssocRsp->VHTCaps.muBeamformerCap) &&
3697 psessionEntry->txBFIniFeatureEnabled)
3698 {
3699 pAddBssParams->staContext.vhtTxBFCapable = 1;
3700 }
3701 }
3702#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003703 if( (pAssocRsp->HTCaps.supportedChannelWidthSet) &&
3704 (chanWidthSupp) )
3705 {
3706 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07003707#ifdef WLAN_FEATURE_11AC
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003708 if (pAddBssParams->staContext.vhtCapable)
Jeff Johnsone7245742012-09-05 17:12:55 -07003709 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003710 pAddBssParams->staContext.vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth; //pMac->lim.apChanWidth;
3711 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303712 limLog(pMac, LOG2,FL("StaContext vhtCapable %d "
3713 "vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
3714 pAddBssParams->staContext.vhtCapable,
3715 pAddBssParams->staContext.vhtTxChannelWidthSet,
3716 pAddBssParams->staContext.vhtTxBFCapable);
Jeff Johnsone7245742012-09-05 17:12:55 -07003717#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003718 }
3719 else
3720 {
3721 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3722 }
3723 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pAssocRsp->HTCaps.mimoPowerSave;
3724 pAddBssParams->staContext.delBASupport = ( tANI_U8 )pAssocRsp->HTCaps.delayedBA;
3725 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 )pAssocRsp->HTCaps.maximalAMSDUsize;
3726 pAddBssParams->staContext.maxAmpduDensity = pAssocRsp->HTCaps.mpduDensity;
3727 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz;
krunal soni71343fb2013-09-16 16:16:26 -07003728 /*
3729 * We will check gShortGI20Mhz and gShortGI40Mhz from ini file.
3730 * if they are set then we will use what ever Assoc response coming
3731 * from AP supports. If these values are set as 0 in ini file then
3732 * we will hardcode this values to 0.
3733 */
3734 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
3735 (pMac, WNI_CFG_SHORT_GI_20MHZ,
3736 &shortGi20MhzSupport)))
3737 {
3738 if (VOS_TRUE == shortGi20MhzSupport)
3739 {
3740 pAddBssParams->staContext.fShortGI20Mhz =
3741 (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz;
3742 }
3743 else
3744 {
3745 pAddBssParams->staContext.fShortGI20Mhz = VOS_FALSE;
3746 }
3747 }
3748 else
3749 {
3750 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz"
3751 "CFG,setting value to default"));)
3752 pAddBssParams->staContext.fShortGI20Mhz =
3753 WNI_CFG_SHORT_GI_20MHZ_STADEF;
3754 }
3755
3756 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
3757 (pMac, WNI_CFG_SHORT_GI_40MHZ,
3758 &shortGi40MhzSupport)))
3759 {
3760 if (VOS_TRUE == shortGi40MhzSupport)
3761 {
3762 pAddBssParams->staContext.fShortGI40Mhz =
3763 (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz;
3764 }
3765 else
3766 {
3767 pAddBssParams->staContext.fShortGI40Mhz = VOS_FALSE;
3768 }
3769 }
3770 else
3771 {
3772 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz"
3773 "CFG,setting value to default"));)
3774 pAddBssParams->staContext.fShortGI40Mhz =
3775 WNI_CFG_SHORT_GI_40MHZ_STADEF;
3776 }
3777
Jeff Johnson295189b2012-06-20 16:38:30 -07003778 pAddBssParams->staContext.maxAmpduSize= pAssocRsp->HTCaps.maxRxAMPDUFactor;
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08003779 if( pAddBssParams->staContext.vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP )
3780 {
3781 pAddBssParams->staContext.htLdpcCapable = 0;
3782 pAddBssParams->staContext.vhtLdpcCapable = 0;
3783 }
3784 else
3785 {
3786 pAddBssParams->staContext.htLdpcCapable = (tANI_U8)pAssocRsp->HTCaps.advCodingCap;
3787 pAddBssParams->staContext.vhtLdpcCapable = (tANI_U8)pAssocRsp->VHTCaps.ldpcCodingCap;
3788 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08003789
Jeff Johnson295189b2012-06-20 16:38:30 -07003790 if( pBeaconStruct->HTInfo.present )
3791 pAddBssParams->staContext.rifsMode = pAssocRsp->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303792
3793 limLog(pMac, LOG2, FL("StaContext txChannelWidthSet: %d mimoPS: %d"
3794 " delBASupport: %d maxAmsduSize: %d"),
3795 pAddBssParams->staContext.txChannelWidthSet,
3796 pAddBssParams->staContext.mimoPS,
3797 pAddBssParams->staContext.delBASupport,
3798 pAddBssParams->staContext.maxAmsduSize);
3799
3800 limLog(pMac, LOG2, FL("maxAmpduDensity: %d fDsssCckMode40Mhz: %d "
3801 "fShortGI20Mhz: %d "),pAddBssParams->staContext.maxAmpduDensity,
3802 pAddBssParams->staContext.fDsssCckMode40Mhz,
3803 pAddBssParams->staContext.fShortGI20Mhz);
3804
3805 limLog(pMac, LOG2, FL("fShortGI40Mh: %d maxAmpduSize: %d "
3806 "htLdpcCapable: %d vhtLdpcCapable: %d"),
3807 pAddBssParams->staContext.fShortGI40Mhz,
3808 pAddBssParams->staContext.maxAmpduSize,
3809 pAddBssParams->staContext.htLdpcCapable,
3810 pAddBssParams->staContext.vhtLdpcCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07003811 }
3812
Pratik Bhalgatb5b19b02012-11-22 16:28:19 +05303813 //If WMM IE or 802.11E IE is not present and AP is HT AP then enable WMM
3814 if ((psessionEntry->limWmeEnabled && (pAssocRsp->wmeEdcaPresent || pAddBssParams->htCapable)) ||
3815 (psessionEntry->limQosEnabled && (pAssocRsp->edcaPresent || pAddBssParams->htCapable)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003816 pAddBssParams->staContext.wmmEnabled = 1;
3817 else
3818 pAddBssParams->staContext.wmmEnabled = 0;
3819
3820 //Update the rates
3821
3822 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3823 if (pStaDs != NULL)
3824 {
3825 limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303826 vos_mem_copy((tANI_U8*)&pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -07003827 (tANI_U8*)&pStaDs->supportedRates,
3828 sizeof(tSirSupportedRates));
3829 }
3830 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003831 PELOGE(limLog(pMac, LOGE, FL("could not Update the supported rates."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003832
3833 }
3834
3835 //Disable BA. It will be set as part of ADDBA negotiation.
3836 for( i = 0; i < STACFG_MAX_TC; i++ )
3837 {
3838 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
3839 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
3840 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
3841 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
3842 }
3843
3844 pAddBssParams->staContext.encryptType = psessionEntry->encryptType;
3845
3846#if defined WLAN_FEATURE_VOWIFI
3847 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303848 limLog(pMac, LOG2,FL("maxTxPower: %d"),
3849 pAddBssParams->maxTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07003850#endif
3851 // FIXME_GEN4 - Any other value that can be used for initialization?
3852 pAddBssParams->status = eHAL_STATUS_SUCCESS;
3853 pAddBssParams->respReqd = true;
3854
3855 pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
3856
Jeff Johnson295189b2012-06-20 16:38:30 -07003857 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona)
3858 {
3859 pAddBssParams->staContext.p2pCapableSta = 1;
3860 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003861
Bansidhar Gopalacharib099ac62013-06-12 19:02:39 -07003862 pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07003863
3864#if defined WLAN_FEATURE_VOWIFI_11R
3865 pAddBssParams->extSetStaKeyParamValid = 0;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303866 limLog(pMac, LOG2,FL("extSetStaKeyParamValid: %d"),
3867 pAddBssParams->extSetStaKeyParamValid);
Jeff Johnson295189b2012-06-20 16:38:30 -07003868#endif
3869
Chet Lanctot186b5732013-03-18 10:26:30 -07003870#ifdef WLAN_FEATURE_11W
3871 if (psessionEntry->limRmfEnabled)
3872 {
3873 pAddBssParams->rmfEnabled = 1;
3874 pAddBssParams->staContext.rmfEnabled = 1;
3875 }
3876#endif
3877
Jeff Johnson295189b2012-06-20 16:38:30 -07003878 // Set a new state for MLME
3879 if( eLIM_MLM_WT_ASSOC_RSP_STATE == psessionEntry->limMlmState )
3880 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE;
3881 else
3882 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003883 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003884
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303885 limLog(pMac, LOG2, FL("staContext wmmEnabled: %d encryptType: %d "
3886 "p2pCapableSta: %d"),pAddBssParams->staContext.wmmEnabled,
3887 pAddBssParams->staContext.encryptType,
3888 pAddBssParams->staContext.p2pCapableSta);
3889
3890 limLog(pMac, LOG2, FL("bSpectrumMgtEnabled: %d halPersona: %d setting "
3891 "LimMlm state to %d"), pAddBssParams->bSpectrumMgtEnabled,
3892 pAddBssParams->halPersona, psessionEntry->limMlmState);
3893
Jeff Johnson295189b2012-06-20 16:38:30 -07003894 //we need to defer the message until we get the response back from HAL.
3895 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
3896
3897 msgQ.type = WDA_ADD_BSS_REQ;
3898 /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
3899 msgQ.reserved = 0;
3900 msgQ.bodyptr = pAddBssParams;
3901 msgQ.bodyval = 0;
3902
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303903 limLog( pMac, LOG1, FL("SessionId:%d Sending SIR_HAL_ADD_BSS_REQ" ),
3904 psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -07003905 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003906
3907 retCode = wdaPostCtrlMsg( pMac, &msgQ );
3908 if( eSIR_SUCCESS != retCode)
3909 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003910 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303911 vos_mem_free(pAddBssParams);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003912 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003913 retCode );
3914 goto returnFailure;
3915
3916 }
3917 else
3918 return retCode;
3919
3920 returnFailure:
3921 // Clean-up will be done by the caller...
3922 return retCode;
3923}
3924
3925
3926
3927
3928tSirRetStatus limStaSendAddBssPreAssoc( tpAniSirGlobal pMac, tANI_U8 updateEntry, tpPESession psessionEntry)
3929{
3930 tSirMsgQ msgQ;
3931 tpAddBssParams pAddBssParams = NULL;
3932 tANI_U32 retCode;
3933 tANI_U8 i;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003934 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -07003935 tANI_U8 chanWidthSupp = 0;
krunal soni71343fb2013-09-16 16:16:26 -07003936 tANI_U32 shortGi20MhzSupport;
3937 tANI_U32 shortGi40MhzSupport;
Jeff Johnson295189b2012-06-20 16:38:30 -07003938 tpSirBssDescription bssDescription = &psessionEntry->pLimJoinReq->bssDescription;
3939
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303940 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
3941 if (NULL == pBeaconStruct)
Jeff Johnson32d95a32012-09-10 13:15:23 -07003942 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303943 limLog(pMac, LOGE, FL("Unable to allocate memory during ADD_BSS") );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003944 return eSIR_MEM_ALLOC_FAILED;
3945 }
3946
Jeff Johnson295189b2012-06-20 16:38:30 -07003947
3948 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303949 pAddBssParams = vos_mem_malloc(sizeof(tAddBssParams));
3950 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003951 {
3952 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303953 FL( "Unable to allocate memory during ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003954 retCode = eSIR_MEM_ALLOC_FAILED;
3955 goto returnFailure;
3956 }
3957
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303958 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003959
3960
3961 limExtractApCapabilities( pMac,
3962 (tANI_U8 *) bssDescription->ieFields,
3963 limGetIElenFromBssDescription( bssDescription ),
Jeff Johnson32d95a32012-09-10 13:15:23 -07003964 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07003965
3966 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Jeff Johnson32d95a32012-09-10 13:15:23 -07003967 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303968 vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
3969 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003970
3971 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303972 vos_mem_copy(pAddBssParams->selfMacAddr,
3973 psessionEntry->selfMacAddr,
3974 sizeof(tSirMacAddr));
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303975 limLog(pMac, LOG1, FL("sessionid: %d updateEntry = %d limsystemrole = %d "),
3976 psessionEntry->smeSessionId,updateEntry,psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003977
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303978 limLog(pMac, LOG1, FL("BSSID: "MAC_ADDRESS_STR),
3979 MAC_ADDR_ARRAY(pAddBssParams->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07003980 /* Incorrect BSS Type which caused UMA Descriptor to be overwritten on
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303981 * top of an already established Infra link. This lead to issues in
Jeff Johnson295189b2012-06-20 16:38:30 -07003982 * concurrent data transfer.
3983 */
3984
3985 pAddBssParams->bssType = psessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
3986 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
3987
3988 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
3989
Jeff Johnson32d95a32012-09-10 13:15:23 -07003990 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07003991 pAddBssParams->updateBss = updateEntry;
3992
3993
Jeff Johnson32d95a32012-09-10 13:15:23 -07003994 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
3995 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
3996 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
3997 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -07003998
3999
Jeff Johnson32d95a32012-09-10 13:15:23 -07004000 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304001 vos_mem_copy(pAddBssParams->rateSet.rate,
4002 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07004003
4004 pAddBssParams->nwType = bssDescription->nwType;
4005
Jeff Johnson32d95a32012-09-10 13:15:23 -07004006 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -07004007 pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
4008 pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
4009 pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304010 pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
Jeff Johnson295189b2012-06-20 16:38:30 -07004011
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304012 limLog(pMac, LOG2, FL(" BSS Type %d Beacon Interval: %d dtimPeriod: %d "
4013 "cfpCount: %d"),pAddBssParams->bssType, pAddBssParams->beaconInterval,
4014 pAddBssParams->dtimPeriod, pAddBssParams->cfParamSet.cfpCount);
4015
4016 limLog(pMac, LOG2, FL(" cfpPeriod: %d cfpMaxDuration: %d cfpDurRemaining:"
4017 " %d numRates: %d "),pAddBssParams->cfParamSet.cfpPeriod,
4018 pAddBssParams->cfParamSet.cfpMaxDuration,
4019 pAddBssParams->cfParamSet.cfpDurRemaining,
4020 pAddBssParams->rateSet.numRates);
4021
4022 limLog(pMac, LOG2, FL("nwType:%d shortSlotTimeSupported: %d"
4023 "llaCoexist: %d llbCoexist: %d llgCoexist: %d ht20Coexist: %d"),
4024 pAddBssParams->nwType, pAddBssParams->shortSlotTimeSupported,
4025 pAddBssParams->llaCoexist, pAddBssParams->llbCoexist,
4026 pAddBssParams->llgCoexist, pAddBssParams->ht20Coexist);
Jeff Johnson295189b2012-06-20 16:38:30 -07004027 // Use the advertised capabilities from the received beacon/PR
Jeff Johnson32d95a32012-09-10 13:15:23 -07004028 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -07004029 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004030 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304031 limLog(pMac, LOG2, FL("htCapable: %d"),pAddBssParams->htCapable);
Jeff Johnson32d95a32012-09-10 13:15:23 -07004032 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07004033 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004034 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
4035 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -07004036
Jeff Johnson295189b2012-06-20 16:38:30 -07004037 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
Jeff Johnson32d95a32012-09-10 13:15:23 -07004038 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07004039 (chanWidthSupp) )
4040 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004041 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
4042 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07004043 }
4044 else
4045 {
4046 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004047 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07004048 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07004049 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
4050 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
4051 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304052
4053 limLog(pMac, LOG2, FL("htOperMode: %d dualCTSProtection: %d "
4054 "txChannelWidthSet: %d currentExtChannel: %d "),
4055 pAddBssParams->htOperMode, pAddBssParams->dualCTSProtection,
4056 pAddBssParams->txChannelWidthSet,pAddBssParams->currentExtChannel);
4057
4058 limLog(pMac, LOG2, FL("llnNonGFCoexist: %d "
4059 "fLsigTXOPProtectionFullSupport: %d fRIFSMode %d"),
4060 pAddBssParams->llnNonGFCoexist,
4061 pAddBssParams->fLsigTXOPProtectionFullSupport,
4062 pAddBssParams->fRIFSMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07004063 }
4064 }
4065
4066 pAddBssParams->currentOperChannel = bssDescription->channelId;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304067 limLog(pMac, LOG2, FL("currentOperChannel %d"),
4068 pAddBssParams->currentOperChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07004069#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07004070 if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present ))
Jeff Johnsone7245742012-09-05 17:12:55 -07004071 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004072 pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
4073 pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004074 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
4075 pAddBssParams->currentOperChannel,
4076 pAddBssParams->currentExtChannel,
4077 psessionEntry->apCenterChan,
4078 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07004079 }
4080 else
4081 {
4082 pAddBssParams->vhtCapable = 0;
4083 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304084 limLog(pMac, LOG2, FL("vhtCapable %d vhtTxChannelWidthSet %d "
4085 "currentExtChannel %d"),pAddBssParams->vhtCapable,
4086 pAddBssParams->vhtTxChannelWidthSet,
4087 pAddBssParams->currentExtChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07004088#endif
4089
Jeff Johnson295189b2012-06-20 16:38:30 -07004090 // Populate the STA-related parameters here
4091 // Note that the STA here refers to the AP
4092 {
4093 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
4094
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304095 vos_mem_copy(pAddBssParams->staContext.bssId,
4096 bssDescription->bssId,
4097 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004098 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
4099
4100 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
4101 pAddBssParams->staContext.uAPSD = 0;
4102 pAddBssParams->staContext.maxSPLen = 0;
Jeff Johnson32d95a32012-09-10 13:15:23 -07004103 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -07004104 pAddBssParams->staContext.updateSta = updateEntry;
4105
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304106 limLog(pMac, LOG2, FL("StaContext: "MAC_ADDRESS_STR
4107 " shortPreambleSupported: %d"),
4108 MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac),
4109 pAddBssParams->staContext.shortPreambleSupported);
4110
Jeff Johnson32d95a32012-09-10 13:15:23 -07004111 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -07004112 {
4113 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
4114 pAddBssParams->staContext.htCapable = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07004115 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
4116 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304117 limLog(pMac, LOG2, FL("StaContext htCapable: %d "
4118 "greenFieldCapable: %d lsigTxopProtection: %d"),
4119 pAddBssParams->staContext.htCapable,
4120 pAddBssParams->staContext.greenFieldCapable,
4121 pAddBssParams->staContext.lsigTxopProtection);
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004122#ifdef WLAN_FEATURE_11AC
4123 if (psessionEntry->vhtCapability && pBeaconStruct->VHTCaps.present)
4124 {
4125 pAddBssParams->staContext.vhtCapable = 1;
4126 if ((pBeaconStruct->VHTCaps.suBeamFormerCap ||
4127 pBeaconStruct->VHTCaps.muBeamformerCap) &&
4128 psessionEntry->txBFIniFeatureEnabled )
4129 {
4130 pAddBssParams->staContext.vhtTxBFCapable = 1;
4131 }
4132 }
4133#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07004134 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07004135 (chanWidthSupp) )
4136 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004137 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004138#ifdef WLAN_FEATURE_11AC
4139 if (pAddBssParams->staContext.vhtCapable)
Jeff Johnsone7245742012-09-05 17:12:55 -07004140 {
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004141 pAddBssParams->staContext.vhtTxChannelWidthSet =
4142 pBeaconStruct->VHTOperation.chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -07004143 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304144 limLog(pMac, LOG2,FL("StaContext vhtCapable %d "
4145 "vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
4146 pAddBssParams->staContext.vhtCapable,
4147 pAddBssParams->staContext.vhtTxChannelWidthSet,
4148 pAddBssParams->staContext.vhtTxBFCapable);
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004149#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004150 }
4151 else
4152 {
4153 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4154 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07004155 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
4156 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
4157 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
4158 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
4159 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
krunal soni71343fb2013-09-16 16:16:26 -07004160 /*
4161 * We will check gShortGI20Mhz and gShortGI40Mhz from ini file.
4162 * if they are set then we will use what ever Beacon coming from AP
4163 * supports. If these values are set as 0 in ini file then
4164 * we will hardcode this values to 0.
4165 */
4166 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
4167 (pMac, WNI_CFG_SHORT_GI_20MHZ,
4168 &shortGi20MhzSupport)))
4169 {
4170 if (VOS_TRUE == shortGi20MhzSupport)
4171 {
4172 pAddBssParams->staContext.fShortGI20Mhz =
4173 (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
4174 }
4175 else
4176 {
4177 pAddBssParams->staContext.fShortGI20Mhz = VOS_FALSE;
4178 }
4179 }
4180 else
4181 {
4182 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz"
4183 "CFG,setting value to default"));)
4184 pAddBssParams->staContext.fShortGI20Mhz =
4185 WNI_CFG_SHORT_GI_20MHZ_STADEF;
4186 }
4187
4188 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
4189 (pMac, WNI_CFG_SHORT_GI_40MHZ,
4190 &shortGi40MhzSupport)))
4191 {
4192 if (VOS_TRUE == shortGi40MhzSupport)
4193 {
4194 pAddBssParams->staContext.fShortGI40Mhz =
4195 (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
4196 }
4197 else
4198 {
4199 pAddBssParams->staContext.fShortGI40Mhz = VOS_FALSE;
4200 }
4201 }
4202 else
4203 {
4204 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz"
4205 "CFG,setting value to default"));)
4206 pAddBssParams->staContext.fShortGI40Mhz =
4207 WNI_CFG_SHORT_GI_40MHZ_STADEF;
4208 }
4209
Jeff Johnson32d95a32012-09-10 13:15:23 -07004210 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08004211 if( pAddBssParams->staContext.vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP )
4212 {
4213 pAddBssParams->staContext.htLdpcCapable = 0;
4214 pAddBssParams->staContext.vhtLdpcCapable = 0;
4215 }
4216 else
4217 {
4218 pAddBssParams->staContext.htLdpcCapable = (tANI_U8)pBeaconStruct->HTCaps.advCodingCap;
4219 pAddBssParams->staContext.vhtLdpcCapable = (tANI_U8)pBeaconStruct->VHTCaps.ldpcCodingCap;
4220 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004221
Jeff Johnson32d95a32012-09-10 13:15:23 -07004222 if( pBeaconStruct->HTInfo.present )
4223 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304224 limLog(pMac, LOG2, FL("StaContext txChannelWidthSet: %d mimoPS: %d"
4225 " delBASupport: %d maxAmsduSize: %d"),
4226 pAddBssParams->staContext.txChannelWidthSet,
4227 pAddBssParams->staContext.mimoPS,
4228 pAddBssParams->staContext.delBASupport,
4229 pAddBssParams->staContext.maxAmsduSize);
4230
4231 limLog(pMac, LOG2, FL("maxAmpduDensity: %d fDsssCckMode40Mhz: %d "
4232 "fShortGI20Mhz: %d "),pAddBssParams->staContext.maxAmpduDensity,
4233 pAddBssParams->staContext.fDsssCckMode40Mhz,
4234 pAddBssParams->staContext.fShortGI20Mhz);
4235
4236 limLog(pMac, LOG2, FL("fShortGI40Mh: %d maxAmpduSize: %d "
4237 "htLdpcCapable: %d vhtLdpcCapable: %d"),
4238 pAddBssParams->staContext.fShortGI40Mhz,
4239 pAddBssParams->staContext.maxAmpduSize,
4240 pAddBssParams->staContext.htLdpcCapable,
4241 pAddBssParams->staContext.vhtLdpcCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07004242 }
4243
Pratik Bhalgatb5b19b02012-11-22 16:28:19 +05304244 //If WMM IE or 802.11E IE is not present and AP is HT AP then enable WMM
4245 if ((psessionEntry->limWmeEnabled && (pBeaconStruct->wmeEdcaPresent || pAddBssParams->staContext.htCapable)) ||
4246 (psessionEntry->limQosEnabled && (pBeaconStruct->edcaPresent || pAddBssParams->staContext.htCapable)))
Jeff Johnson295189b2012-06-20 16:38:30 -07004247 pAddBssParams->staContext.wmmEnabled = 1;
4248 else
4249 pAddBssParams->staContext.wmmEnabled = 0;
4250
4251 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -07004252#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07004253 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson32d95a32012-09-10 13:15:23 -07004254 pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry,
4255 &pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -07004256#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07004257 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson32d95a32012-09-10 13:15:23 -07004258 pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07004259#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004260 limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,psessionEntry);
4261
4262 }
4263
4264
4265 //Disable BA. It will be set as part of ADDBA negotiation.
4266 for( i = 0; i < STACFG_MAX_TC; i++ )
4267 {
4268 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
4269 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
4270 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
4271 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
4272 }
4273
4274 pAddBssParams->staContext.encryptType = psessionEntry->encryptType;
4275
4276#if defined WLAN_FEATURE_VOWIFI
4277 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304278 limLog(pMac, LOG2,FL("maxTxPower: %d"),
4279 pAddBssParams->maxTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07004280#endif
4281
4282 pAddBssParams->status = eHAL_STATUS_SUCCESS;
4283 pAddBssParams->respReqd = true;
4284
4285 pAddBssParams->staContext.sessionId = psessionEntry->peSessionId;
4286 pAddBssParams->sessionId = psessionEntry->peSessionId;
4287
4288 pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
4289
Bansidhar Gopalacharib099ac62013-06-12 19:02:39 -07004290 pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07004291
4292#if defined WLAN_FEATURE_VOWIFI_11R
4293 pAddBssParams->extSetStaKeyParamValid = 0;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304294 limLog(pMac, LOG2,FL("extSetStaKeyParamValid: %d"),
4295 pAddBssParams->extSetStaKeyParamValid);
Jeff Johnson295189b2012-06-20 16:38:30 -07004296#endif
4297
Chet Lanctot186b5732013-03-18 10:26:30 -07004298#ifdef WLAN_FEATURE_11W
4299 if (psessionEntry->limRmfEnabled)
4300 {
4301 pAddBssParams->rmfEnabled = 1;
4302 pAddBssParams->staContext.rmfEnabled = 1;
4303 }
4304#endif
4305
Jeff Johnson295189b2012-06-20 16:38:30 -07004306 // Set a new state for MLME
4307
4308 //pMac->lim.gLimMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
4309 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
4310
Jeff Johnsone7245742012-09-05 17:12:55 -07004311 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004312
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304313 limLog(pMac, LOG2, FL("staContext wmmEnabled: %d encryptType: %d "
4314 "p2pCapableSta: %d"),pAddBssParams->staContext.wmmEnabled,
4315 pAddBssParams->staContext.encryptType,
4316 pAddBssParams->staContext.p2pCapableSta);
4317
4318 limLog(pMac, LOG2, FL("bSpectrumMgtEnabled: %d halPersona: %d setting "
4319 "LimMlm state to %d"), pAddBssParams->bSpectrumMgtEnabled,
4320 pAddBssParams->halPersona, psessionEntry->limMlmState);
4321
Jeff Johnson295189b2012-06-20 16:38:30 -07004322 //we need to defer the message until we get the response back from HAL.
4323 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
4324
4325 msgQ.type = WDA_ADD_BSS_REQ;
4326 /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
4327 msgQ.reserved = 0;
4328 msgQ.bodyptr = pAddBssParams;
4329 msgQ.bodyval = 0;
4330
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05304331 limLog( pMac, LOG1, FL( "SessionId:%d Sending SIR_HAL_ADD_BSS_REQ" ),
4332 psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -07004333 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004334
4335 retCode = wdaPostCtrlMsg( pMac, &msgQ );
4336 if( eSIR_SUCCESS != retCode)
4337 {
Jeff Johnsone7245742012-09-05 17:12:55 -07004338 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304339 vos_mem_free(pAddBssParams);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004340 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004341 retCode );
4342 goto returnFailure;
4343
4344 }
4345 else
Jeff Johnson32d95a32012-09-10 13:15:23 -07004346 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304347 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004348 return retCode;
Jeff Johnson32d95a32012-09-10 13:15:23 -07004349 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004350
4351 returnFailure:
4352 // Clean-up will be done by the caller...
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304353 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004354 return retCode;
4355}
4356
4357
4358
4359
4360
Jeff Johnson295189b2012-06-20 16:38:30 -07004361
4362/** -------------------------------------------------------------
4363\fn limPrepareAndSendDelStaCnf
4364\brief deletes DPH entry
4365 changes the MLM mode for station.
4366 calls limSendDelStaCnf
4367\param tpAniSirGlobal pMac
4368\param tpDphHashNode pStaDs
4369\return none
4370 -------------------------------------------------------------*/
4371
4372
4373void
4374limPrepareAndSendDelStaCnf(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tSirResultCodes statusCode,tpPESession psessionEntry)
4375{
4376 tANI_U16 staDsAssocId = 0;
4377 tSirMacAddr staDsAddr;
4378 tLimMlmStaContext mlmStaContext;
4379
4380 if(pStaDs == NULL)
4381 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004382 PELOGW(limLog(pMac, LOGW, FL("pStaDs is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004383 return;
4384 }
4385 staDsAssocId = pStaDs->assocId;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304386 vos_mem_copy((tANI_U8 *)staDsAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07004387 pStaDs->staAddr,
4388 sizeof(tSirMacAddr));
4389
4390 mlmStaContext = pStaDs->mlmStaContext;
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304391 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
4392 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004393 {
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304394 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004395 }
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304396 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4397
4398 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4399 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004400 {
4401 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304402 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE,
4403 psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004404 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004405 limSendDelStaCnf(pMac, staDsAddr, staDsAssocId, mlmStaContext, statusCode,psessionEntry);
4406}
4407
4408/** -------------------------------------------------------------
4409\fn limGetStaRateMode
4410\brief Gets the Station Rate Mode.
4411\param tANI_U8 dot11Mode
4412\return none
4413 -------------------------------------------------------------*/
4414tStaRateMode limGetStaRateMode(tANI_U8 dot11Mode)
4415{
4416 switch(dot11Mode)
4417 {
4418 case WNI_CFG_DOT11_MODE_11A:
4419 return eSTA_11a;
4420 case WNI_CFG_DOT11_MODE_11B:
4421 return eSTA_11b;
4422 case WNI_CFG_DOT11_MODE_11G:
4423 return eSTA_11bg;
4424 case WNI_CFG_DOT11_MODE_11N:
4425 return eSTA_11n;
Jeff Johnsone7245742012-09-05 17:12:55 -07004426#ifdef WLAN_FEATURE_11AC
4427 case WNI_CFG_DOT11_MODE_11AC:
4428 return eSTA_11ac;
4429#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004430 case WNI_CFG_DOT11_MODE_ALL:
4431 default:
4432 return eSTA_11n;
4433
4434 }
4435}
4436
4437/** -------------------------------------------------------------
4438\fn limInitPreAuthTimerTable
4439\brief Initialize the Pre Auth Tanle and creates the timer for
4440 each node for the timeout value got from cfg.
4441\param tpAniSirGlobal pMac
4442\param tpLimPreAuthTable pPreAuthTimerTable
4443\return none
4444 -------------------------------------------------------------*/
4445void limInitPreAuthTimerTable(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable)
4446{
4447 tANI_U32 cfgValue;
4448 tANI_U32 authNodeIdx;
4449 tpLimPreAuthNode pAuthNode = pPreAuthTimerTable->pTable;
4450
4451 // Get AUTH_RSP Timers value
4452
4453 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT,
4454 &cfgValue) != eSIR_SUCCESS)
4455 {
4456 /*
4457 ** Could not get AUTH_RSP timeout value
4458 ** from CFG. Log error.
4459 **/
4460 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004461 FL("could not retrieve AUTH_RSP timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004462 return;
4463 }
4464
4465 cfgValue = SYS_MS_TO_TICKS(cfgValue);
4466 for(authNodeIdx=0; authNodeIdx<pPreAuthTimerTable->numEntry; authNodeIdx++, pAuthNode++)
4467 {
4468 if (tx_timer_create(&pAuthNode->timer,
4469 "AUTH RESPONSE TIMEOUT",
4470 limAuthResponseTimerHandler,
4471 authNodeIdx,
4472 cfgValue,
4473 0,
4474 TX_NO_ACTIVATE) != TX_SUCCESS)
4475 {
4476 // Cannot create timer. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004477 limLog(pMac, LOGP, FL("Cannot create Auth Rsp timer of Index :%d."), authNodeIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07004478 return;
4479 }
4480 pAuthNode->authNodeIdx = (tANI_U8)authNodeIdx;
4481 pAuthNode->fFree = 1;
4482 }
4483
4484}
4485
4486/** -------------------------------------------------------------
4487\fn limAcquireFreePreAuthNode
4488\brief Retrives a free Pre Auth node from Pre Auth Table.
4489\param tpAniSirGlobal pMac
4490\param tpLimPreAuthTable pPreAuthTimerTable
4491\return none
4492 -------------------------------------------------------------*/
4493tLimPreAuthNode * limAcquireFreePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable)
4494{
4495 tANI_U32 i;
4496 tLimPreAuthNode *pTempNode = pPreAuthTimerTable->pTable;
4497 for (i=0; i<pPreAuthTimerTable->numEntry; i++,pTempNode++)
4498 {
4499 if (pTempNode->fFree == 1)
4500 {
4501 pTempNode->fFree = 0;
4502 return pTempNode;
4503 }
4504 }
4505
4506 return NULL;
4507}
4508
4509/** -------------------------------------------------------------
4510\fn limGetPreAuthNodeFromIndex
4511\brief Depending on the Index this retrives the pre auth node.
4512\param tpAniSirGlobal pMac
4513\param tpLimPreAuthTable pAuthTable
4514\param tANI_U32 authNodeIdx
4515\return none
4516 -------------------------------------------------------------*/
4517tLimPreAuthNode * limGetPreAuthNodeFromIndex(tpAniSirGlobal pMac,
4518 tpLimPreAuthTable pAuthTable, tANI_U32 authNodeIdx)
4519{
4520 if ((authNodeIdx >= pAuthTable->numEntry) || (pAuthTable->pTable == NULL))
4521 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004522 limLog(pMac, LOGE, FL("Invalid Auth Timer Index : %d NumEntry : %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004523 authNodeIdx, pAuthTable->numEntry);
4524 return NULL;
4525 }
4526
4527 return pAuthTable->pTable + authNodeIdx;
4528}
4529
4530/* Util API to check if the channels supported by STA is within range */
4531tSirRetStatus limIsDot11hSupportedChannelsValid(tpAniSirGlobal pMac, tSirAssocReq *assoc)
4532{
4533 /*
4534 * Allow all the stations to join with us.
4535 * 802.11h-2003 11.6.1 => An AP may use the supported channels list for associated STAs
4536 * as an input into an algorithm used to select a new channel for the BSS.
4537 * The specification of the algorithm is beyond the scope of this amendment.
4538 */
4539
4540 return (eSIR_SUCCESS);
4541}
4542
4543/* Util API to check if the txpower supported by STA is within range */
4544tSirRetStatus limIsDot11hPowerCapabilitiesInRange(tpAniSirGlobal pMac, tSirAssocReq *assoc,tpPESession psessionEntry)
4545{
4546 tPowerdBm localMaxTxPower;
4547 tANI_U32 localPwrConstraint;
4548
4549 localMaxTxPower = cfgGetRegulatoryMaxTransmitPower(pMac, psessionEntry->currentOperChannel);
4550
4551 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004552 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004553 return eSIR_FAILURE;
4554 }
4555 localMaxTxPower -= (tPowerdBm)localPwrConstraint;
4556
4557 /**
4558 * The min Tx Power of the associating station should not be greater than (regulatory
4559 * max tx power - local power constraint configured on AP).
4560 */
4561 if(assoc->powerCapability.minTxPower > localMaxTxPower)
4562 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004563 limLog(pMac, LOGW, FL("minTxPower (STA) = %d, localMaxTxPower (AP) = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004564 assoc->powerCapability.minTxPower, localMaxTxPower);
4565 return (eSIR_FAILURE);
4566 }
4567
4568 return (eSIR_SUCCESS);
4569}
4570
4571/** -------------------------------------------------------------
4572\fn limFillRxHighestSupportedRate
4573\brief Fills in the Rx Highest Supported Data Rate field from
4574\ the 'supported MCS set' field in HT capability element.
4575\param tpAniSirGlobal pMac
4576\param tpSirSupportedRates pRates
4577\param tANI_U8* pSupportedMCSSet
4578\return none
4579 -------------------------------------------------------------*/
4580void limFillRxHighestSupportedRate(tpAniSirGlobal pMac, tANI_U16 *rxHighestRate, tANI_U8* pSupportedMCSSet)
4581{
4582 tSirMacRxHighestSupportRate *pRxHighestRate;
4583 tANI_U8 *pBuf;
4584 tANI_U16 rate=0;
4585
4586 pBuf = pSupportedMCSSet + MCS_RX_HIGHEST_SUPPORTED_RATE_BYTE_OFFSET;
4587 rate = limGetU16(pBuf);
4588
4589 pRxHighestRate = (tSirMacRxHighestSupportRate *) &rate;
4590 *rxHighestRate = pRxHighestRate->rate;
4591
4592 return;
4593}
Chet Lanctot186b5732013-03-18 10:26:30 -07004594
4595#ifdef WLAN_FEATURE_11W
4596/** -------------------------------------------------------------
4597\fn limSendSmeUnprotectedMgmtFrameInd
4598\brief Forwards the unprotected management frame to SME.
4599\param tpAniSirGlobal pMac
4600\param frameType - 802.11 frame type
4601\param frame - frame buffer
4602\param sessionId - id for the current session
4603\param psessionEntry - PE session context
4604\return none
4605 -------------------------------------------------------------*/
4606void limSendSmeUnprotectedMgmtFrameInd(
4607 tpAniSirGlobal pMac, tANI_U8 frameType,
4608 tANI_U8 *frame, tANI_U32 frameLen, tANI_U16 sessionId,
4609 tpPESession psessionEntry)
4610{
4611 tSirMsgQ mmhMsg;
4612 tSirSmeUnprotMgmtFrameInd * pSirSmeMgmtFrame = NULL;
4613 tANI_U16 length;
4614
4615 length = sizeof(tSirSmeUnprotMgmtFrameInd) + frameLen;
4616
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304617 pSirSmeMgmtFrame = vos_mem_malloc(length);
4618 if (NULL == pSirSmeMgmtFrame)
Chet Lanctot186b5732013-03-18 10:26:30 -07004619 {
4620 limLog(pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304621 FL("AllocateMemory failed for tSirSmeUnprotectedMgmtFrameInd"));
Chet Lanctot186b5732013-03-18 10:26:30 -07004622 return;
4623 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304624 vos_mem_set((void*)pSirSmeMgmtFrame, length, 0);
Chet Lanctot186b5732013-03-18 10:26:30 -07004625
4626 pSirSmeMgmtFrame->sessionId = sessionId;
4627 pSirSmeMgmtFrame->frameType = frameType;
4628
4629 vos_mem_copy(pSirSmeMgmtFrame->frameBuf, frame, frameLen);
4630 pSirSmeMgmtFrame->frameLen = frameLen;
4631
4632 mmhMsg.type = eWNI_SME_UNPROT_MGMT_FRM_IND;
4633 mmhMsg.bodyptr = pSirSmeMgmtFrame;
4634 mmhMsg.bodyval = 0;
4635
4636 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
4637 return;
4638}
4639#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004640
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004641#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004642/** -------------------------------------------------------------
4643\fn limSendSmeTsmIEInd
4644\brief Forwards the TSM IE information to SME.
4645\param tpAniSirGlobal pMac
4646\param psessionEntry - PE session context
4647\param tid - traffic id
4648\param state - tsm state (enabled/disabled)
4649\param measurementInterval - measurement interval
4650\return none
4651 -------------------------------------------------------------*/
4652void limSendSmeTsmIEInd(tpAniSirGlobal pMac, tpPESession psessionEntry,
4653 tANI_U8 tid, tANI_U8 state, tANI_U16 measInterval)
4654{
4655 tSirMsgQ mmhMsg;
4656 tpSirSmeTsmIEInd pSirSmeTsmIeInd = NULL;
4657
4658 if (!pMac || !psessionEntry)
4659 {
4660 return;
4661 }
4662 pSirSmeTsmIeInd = vos_mem_malloc(sizeof(tSirSmeTsmIEInd));
4663 if (NULL == pSirSmeTsmIeInd)
4664 {
4665 limLog(pMac, LOGP,
4666 FL("AllocateMemory failed for tSirSmeTsmIEInd"));
4667 return;
4668 }
4669 vos_mem_set((void*)pSirSmeTsmIeInd, sizeof(tSirSmeTsmIEInd), 0);
4670
4671 pSirSmeTsmIeInd->sessionId = psessionEntry->smeSessionId;
4672 pSirSmeTsmIeInd->tsmIe.tsid = tid;
4673 pSirSmeTsmIeInd->tsmIe.state= state;
4674 pSirSmeTsmIeInd->tsmIe.msmt_interval= measInterval;
4675
4676 mmhMsg.type = eWNI_SME_TSM_IE_IND;
4677 mmhMsg.bodyptr = pSirSmeTsmIeInd;
4678 mmhMsg.bodyval = 0;
4679
4680 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
4681 return;
4682}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004683#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004684
4685