blob: 02cf86fe7772607c1be64db507ea5a276faa6151 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Pankaj Singh45e66bb2020-06-11 20:42:32 +05302 * Copyright (c) 2011-2017, 2020 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
Satyanarayana Dash6f438272015-03-03 18:01:06 +053045#include "wniCfg.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;
Pankaj Singh45e66bb2020-06-11 20:42:32 +0530448 tANI_U8 i, j, match = 0, 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
Pankaj Singh45e66bb2020-06-11 20:42:32 +0530460 /* We should have only one AKM in assoc/reassoc request */
461 if (rxRSNIe.akm_suite_cnt != 1) {
462 limLog(pMac, LOG3, FL("Invalid RX akm_suite_cnt %d"),
463 rxRSNIe.akm_suite_cnt);
464 return eSIR_MAC_INVALID_AKMP_STATUS;
465 }
466 /* Check if we support the received AKM */
467 for (i = 0; i < pRSNIe->akm_suite_cnt; i++) {
468 if (vos_mem_compare(&rxRSNIe.akm_suite[0],
469 &pRSNIe->akm_suite[i],
470 sizeof(pRSNIe->akm_suite[i]))) {
471 match = 1;
472 break;
473 }
474 }
475 if (!match) {
476 limLog(pMac, LOG3, FL("Invalid RX akm_suite"));
477 return eSIR_MAC_INVALID_AKMP_STATUS;
478 }
479
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 // Check groupwise cipher suite
481 for (i = 0; i < sizeof(rxRSNIe.gp_cipher_suite); i++)
482 {
483 if (pRSNIe->gp_cipher_suite[i] != rxRSNIe.gp_cipher_suite[i])
484 {
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530485 limLog(pMac, LOG1, FL("RSN group cipher suite does not match local"
486 " %d recieved %d"),pRSNIe->gp_cipher_suite[i],
487 rxRSNIe.gp_cipher_suite[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -0700488 return eSIR_MAC_INVALID_GROUP_CIPHER_STATUS;
489 }
490 }
491
492 /*
493 * For each Pairwise cipher suite check whether we support
494 * received pairwise
495 */
496 match = 0;
497 for (i = 0; i < rxRSNIe.pwise_cipher_suite_count; i++)
498 {
499 for(j = 0; j < pRSNIe->pwise_cipher_suite_count; j++)
500 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530501 if (vos_mem_compare(&rxRSNIe.pwise_cipher_suites[i],
502 &pRSNIe->pwise_cipher_suites[j],
503 sizeof(pRSNIe->pwise_cipher_suites[j])))
Jeff Johnson295189b2012-06-20 16:38:30 -0700504 {
505 match = 1;
506 break;
507 }
508 }
509
510 if ((staIsHT)
511#ifdef ANI_LITTLE_BYTE_ENDIAN
512 &&( (rxRSNIe.pwise_cipher_suites[i][3] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP))
513#else
514 &&( (rxRSNIe.pwise_cipher_suites[i][0] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP))
515#endif
516 {
517 onlyNonHtCipher=0;
518 }
519
520 }
521
522 if ((!match) || ((staIsHT) && onlyNonHtCipher))
523 {
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530524 limLog(pMac, LOG1, FL("pairwise cipher suite does not match(%d)"
525 "staIsHT %d onlyNonHtCipher %d"),match,staIsHT,
526 onlyNonHtCipher);
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 return eSIR_MAC_INVALID_PAIRWISE_CIPHER_STATUS;
528 }
Venkata Prathyusha Kuntupalliea7098e2013-01-31 16:08:13 -0800529 /* Check RSN capabilities
530 * Bit 0 of First Byte - PreAuthentication Capability
531 */
532 if(((rxRSNIe.RSN_Cap[0] >> 0) & 0x1) == true) //this is supported by AP only
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 {
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530534 limLog(pMac, LOG1, FL("Preuthentication Capability is set"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 return eSIR_MAC_INVALID_RSN_IE_CAPABILITIES_STATUS;
536 }
537
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700538 *pmfConnection = eANI_BOOLEAN_FALSE;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800539
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700540#ifdef WLAN_FEATURE_11W
Chet Lanctot8cecea22014-02-11 19:09:36 -0800541 weArePMFCapable = pSessionEntry->pLimStartBssReq->pmfCapable;
542 weRequirePMF = pSessionEntry->pLimStartBssReq->pmfRequired;
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700543 theyArePMFCapable = (rxRSNIe.RSN_Cap[0] >> 7) & 0x1;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800544 theyRequirePMF = (rxRSNIe.RSN_Cap[0] >> 6) & 0x1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700545
Chet Lanctotec4de332013-10-11 15:42:22 -0700546 if ((theyRequirePMF && theyArePMFCapable && !weArePMFCapable) ||
547 (weRequirePMF && !theyArePMFCapable))
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700548 {
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530549 limLog(pMac, LOG1, FL("Association fail, robust management frames "
550 "policy violation theyRequirePMF =%d theyArePMFCapable %d "
551 "weArePMFCapable %d weRequirePMF %d theyArePMFCapable %d"),
552 theyRequirePMF,theyArePMFCapable,weArePMFCapable,weRequirePMF,
553 theyArePMFCapable);
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700554 return eSIR_MAC_ROBUST_MGMT_FRAMES_POLICY_VIOLATION;
555 }
556
557 if(theyArePMFCapable && weArePMFCapable)
558 *pmfConnection = eANI_BOOLEAN_TRUE;
Chet Lanctot8cecea22014-02-11 19:09:36 -0800559
560 limLog(pMac, LOG1, FL("weAreCapable %d, weRequire %d, theyAreCapable %d, "
561 "theyRequire %d, PMFconnection %d"),
562 weArePMFCapable, weRequirePMF, theyArePMFCapable, theyRequirePMF, *pmfConnection);
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700563#endif
564
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 return eSIR_SUCCESS;
566} /****** end limCheckRxRSNIeMatch() ******/
567
568/**
569 * limCheckRxWPAIeMatch()
570 *
571 *FUNCTION:
572 * This function is called during Association/Reassociation
573 * frame handling to determine whether received RSN in
574 * Assoc/Reassoc request frames include supported cipher suites or not.
575 *
576 *LOGIC:
577 *
578 *ASSUMPTIONS:
579 * NA
580 *
581 *NOTE:
582 * NA
583 *
584 * @param rxWPAIe - Received WPA IE in (Re)Assco req
585 *
586 * @return status - true if ALL BSS basic rates are present in the
587 * received rateset else false.
588 */
589
590tANI_U8
591limCheckRxWPAIeMatch(tpAniSirGlobal pMac, tDot11fIEWPA rxWPAIe,tpPESession pSessionEntry, tANI_U8 staIsHT)
592{
593 tDot11fIEWPA *pWPAIe;
Pankaj Singh45e66bb2020-06-11 20:42:32 +0530594 tANI_U8 i, j, match = 0, onlyNonHtCipher = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700595
596 // WPA IE should be received from PE
597 pWPAIe = &pSessionEntry->gStartBssWPAIe;
598
Pankaj Singh45e66bb2020-06-11 20:42:32 +0530599 /* We should have only one AKM in assoc/reassoc request */
600 if (rxWPAIe.auth_suite_count != 1) {
601 limLog(pMac, LOG1, FL("Invalid RX auth_suite_count %d"),
602 rxWPAIe.auth_suite_count);
603 return eSIR_MAC_INVALID_AKMP_STATUS;
604 }
605 /* Check if we support the received AKM */
606 for (i = 0; i < pWPAIe->auth_suite_count; i++) {
607 if (vos_mem_compare(&rxWPAIe.auth_suites[0],
608 &pWPAIe->auth_suites[i],
609 sizeof(pWPAIe->auth_suites[i]))) {
610 match = 1;
611 break;
612 }
613 }
614 if (!match) {
615 limLog(pMac, LOG1, FL("Invalid RX auth_suites"));
616 return eSIR_MAC_INVALID_AKMP_STATUS;
617 }
618
Jeff Johnson295189b2012-06-20 16:38:30 -0700619 // Check groupwise cipher suite
620 for (i = 0; i < 4; i++)
621 {
622 if (pWPAIe->multicast_cipher[i] != rxWPAIe.multicast_cipher[i])
623 {
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530624 limLog(pMac, LOG1, FL("WPA group cipher suite does not match local"
625 " %d recieved %d"),pWPAIe->multicast_cipher[i],
626 rxWPAIe.multicast_cipher[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -0700627 return eSIR_MAC_INVALID_GROUP_CIPHER_STATUS;
628 }
629 }
630
631 /*
632 * For each Pairwise cipher suite check whether we support
633 * received pairwise
634 */
635 match = 0;
636 for (i = 0; i < rxWPAIe.unicast_cipher_count; i++)
637 {
638 for(j = 0; j < pWPAIe->unicast_cipher_count; j++)
639 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530640 if (vos_mem_compare(rxWPAIe.unicast_ciphers[i],
641 pWPAIe->unicast_ciphers[j],
642 4))
Jeff Johnson295189b2012-06-20 16:38:30 -0700643 {
644 match = 1;
645 break;
646 }
647 }
648
649 if ((staIsHT)
650#ifdef ANI_LITTLE_BYTE_ENDIAN
651 &&( (rxWPAIe.unicast_ciphers[i][3] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP))
652#else
653 &&( (rxWPAIe.unicast_ciphers[i][0] & SECURITY_SUITE_TYPE_MASK) == SECURITY_SUITE_TYPE_CCMP))
654#endif
655 {
656 onlyNonHtCipher=0;
657 }
658
659 }
660
661 if ((!match) || ((staIsHT) && onlyNonHtCipher))
662 {
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530663 limLog(pMac, LOG1, FL("pairwise cipher suite does not match(%d)"
664 "staIsHT %d onlyNonHtCipher %d"),match,staIsHT,
665 onlyNonHtCipher);
Jeff Johnson295189b2012-06-20 16:38:30 -0700666 return eSIR_MAC_CIPHER_SUITE_REJECTED_STATUS;
667 }
668
669 return eSIR_SUCCESS;
670} /****** end limCheckRxWPAIeMatch() ******/
671
Jeff Johnson295189b2012-06-20 16:38:30 -0700672
673/**
674 * limCleanupRxPath()
675 *
676 *FUNCTION:
677 * This function is called to cleanup STA state at SP & RFP.
678 *
679 *LOGIC:
680 * To circumvent RFP's handling of dummy packet when it does not
681 * have an incomplete packet for the STA to be deleted, a packet
682 * with 'more framgents' bit set will be queued to RFP's WQ before
683 * queuing 'dummy packet'.
684 * A 'dummy' BD is pushed into RFP's WQ with type=00, subtype=1010
685 * (Disassociation frame) and routing flags in BD set to eCPU's
686 * Low Priority WQ.
687 * RFP cleans up its local context for the STA id mentioned in the
688 * BD and then pushes BD to eCPU's low priority WQ.
689 *
690 *ASSUMPTIONS:
691 * NA
692 *
693 *NOTE:
694 * NA
695 *
696 * @param pMac Pointer to Global MAC structure
697 * @param pStaDs Pointer to the per STA data structure
698 * initialized by LIM and maintained at DPH
699 *
700 * @return None
701 */
702
703tSirRetStatus
704limCleanupRxPath(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
705{
706 tSirRetStatus retCode = eSIR_SUCCESS;
707
708
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530709 limLog( pMac, LOG1, FL("Cleanup Rx Path for AID : %d"
710 "psessionEntry->limSmeState : %d, mlmState : %d"),
711 pStaDs->assocId, psessionEntry->limSmeState,
712 pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700713
714 limAbortBackgroundScan( pMac );
Agarwal Ashish87039eb2014-01-15 14:13:15 +0530715 psessionEntry->isCiscoVendorAP = FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700716 if (pMac->lim.gLimAddtsSent)
717 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700718 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
720 }
721
722 if (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_ASSOC_CNF_STATE)
723 {
724 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER,
725 pStaDs->assocId);
726
727 if (!pStaDs->mlmStaContext.updateContext)
728 {
729 /**
730 * There is no context at Polaris to delete.
731 * Release our assigned AID back to the free pool
732 */
kaliu24cedc42016-03-25 11:12:12 +0800733 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
Jeff Johnson295189b2012-06-20 16:38:30 -0700734 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
kaliu24cedc42016-03-25 11:12:12 +0800735 {
736 limDelSta(pMac, pStaDs, false, psessionEntry);
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800737 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700738 }
739 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 return retCode;
741 }
742 }
743
744 //delete all tspecs associated with this sta.
745 limAdmitControlDeleteSta(pMac, pStaDs->assocId);
746
Jeff Johnson295189b2012-06-20 16:38:30 -0700747
748 /**
749 * Make STA hash entry invalid at eCPU so that DPH
750 * does not process any more data packets and
751 * releases those BDs
752 */
753 pStaDs->valid = 0;
754 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
755
756 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
757 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700758 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700760 /* Deactivating probe after heart beat timer */
761 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
Leela Venkata Kiran Kumar Reddy Chiralade5d0592013-09-20 17:09:35 -0700762 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
Jeff Johnson295189b2012-06-20 16:38:30 -0700763 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
764 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
765 pMac->lim.gLastBeaconDtimCount = 0;
766 pMac->lim.gLastBeaconDtimPeriod = 0;
767
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800768#ifdef FEATURE_WLAN_ESE
769#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700770 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
771#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700772 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800773#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700774#endif
775
776 /**
777 * Update the status for PMM module
778 */
779 pmmResetPmmState(pMac);
780 }
781#ifdef WLAN_DEBUG
782 // increment a debug count
783 pMac->lim.gLimNumRxCleanup++;
784#endif
785
Abhishek Singhde7f0512015-10-23 14:31:15 +0530786 /* Do DEL BSS or DEL STA only if ADD BSS was success */
787 if (!psessionEntry->addBssfailed)
788 {
789 if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE)
790 retCode = limDelBss( pMac, pStaDs,
791 psessionEntry->bssIdx, psessionEntry);
792 else
793 retCode = limDelSta( pMac, pStaDs, true, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700794 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700795 return retCode;
796
797} /*** end limCleanupRxPath() ***/
798
799
800/**
801 * limSendDelStaCnf()
802 *
803 *FUNCTION:
804 * This function is called to send appropriate CNF message to SME
805 *
806 *LOGIC:
807 *
808 *
809 *ASSUMPTIONS:
810 * NA
811 *
812 *NOTE:
813 * NA
814 *
815 * @param pMac Pointer to Global MAC structure
816 * @param tpAniSirGlobal pMac,
817 * @param tSirMacAddr staDsAddr,
818 * @param tANI_U16 staDsAssocId,
819 * @param tLimMlmStaContext mlmStaContext,
820 * @param tSirResultCodes statusCode
821 *
822 * @return None
823 */
824
825void
826limSendDelStaCnf(tpAniSirGlobal pMac, tSirMacAddr staDsAddr,
827 tANI_U16 staDsAssocId, tLimMlmStaContext mlmStaContext, tSirResultCodes statusCode,tpPESession psessionEntry)
828{
829
830 tLimMlmDisassocCnf mlmDisassocCnf;
831 tLimMlmDeauthCnf mlmDeauthCnf;
832 tLimMlmPurgeStaInd mlmPurgeStaInd;
833
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530834 limLog(pMac, LOG1, FL("Sessionid: %d staDsAssocId: %d Trigger: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +0530835 "statusCode: %d staDsAddr: "MAC_ADDRESS_STR),psessionEntry->peSessionId,
836 staDsAssocId, mlmStaContext.cleanupTrigger, statusCode,
837 MAC_ADDR_ARRAY(staDsAddr));
838
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
840 {
841 // Set BSSID at CFG to null
842 tSirMacAddr nullAddr = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
843 #if 0
844 if (cfgSetStr(pMac, WNI_CFG_BSSID, (tANI_U8 *) &nullAddr,
845 sizeof(tSirMacAddr)) != eSIR_SUCCESS)
846 {
847 /// Could not update BSSID at CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700848 limLog(pMac, LOGP, FL("could not update BSSID at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700849
850 return;
851 }
852 #endif//TO SUPPORT BT-AMP
853
854 sirCopyMacAddr(nullAddr,psessionEntry->bssId);
855
856 // Free up buffer allocated for JoinReq held by
857 // MLM state machine
858 if (psessionEntry->pLimMlmJoinReq)
859 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530860 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700861 psessionEntry->pLimMlmJoinReq = NULL;
862 }
863
864 psessionEntry->limAID = 0;
865
Jeff Johnson295189b2012-06-20 16:38:30 -0700866 }
867
868 if ((mlmStaContext.cleanupTrigger ==
869 eLIM_HOST_DISASSOC) ||
870 (mlmStaContext.cleanupTrigger ==
Edhar, Mahesh Kumar03cf7ff2015-11-26 17:59:29 +0530871 eLIM_PROMISCUOUS_MODE_DISASSOC) ||
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 (mlmStaContext.cleanupTrigger ==
Edhar, Mahesh Kumar03cf7ff2015-11-26 17:59:29 +0530873 eLIM_LINK_MONITORING_DISASSOC))
Jeff Johnson295189b2012-06-20 16:38:30 -0700874 {
875 /**
876 * Host or LMM driven Disassociation.
877 * Issue Disassoc Confirm to SME.
878 */
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530879 limLog( pMac, LOGW, FL("Lim Posting DISASSOC_CNF to Sme.Trigger: %d"),
880 mlmStaContext.cleanupTrigger);
Jeff Johnson295189b2012-06-20 16:38:30 -0700881
882
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530883 vos_mem_copy((tANI_U8 *) &mlmDisassocCnf.peerMacAddr,
884 (tANI_U8 *) staDsAddr,
885 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700886 mlmDisassocCnf.resultCode = statusCode;
Wu Gao742b7352015-10-16 19:10:40 +0800887 mlmDisassocCnf.aid = staDsAssocId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 mlmDisassocCnf.disassocTrigger =
889 mlmStaContext.cleanupTrigger;
890 /* Update PE session Id*/
891 mlmDisassocCnf.sessionId = psessionEntry->peSessionId;
892
893 limPostSmeMessage(pMac,
894 LIM_MLM_DISASSOC_CNF,
895 (tANI_U32 *) &mlmDisassocCnf);
896 }
Edhar, Mahesh Kumar03cf7ff2015-11-26 17:59:29 +0530897 else if ((mlmStaContext.cleanupTrigger == eLIM_HOST_DEAUTH) ||
898 (mlmStaContext.cleanupTrigger == eLIM_LINK_MONITORING_DEAUTH))
Jeff Johnson295189b2012-06-20 16:38:30 -0700899 {
900 /**
901 * Host or LMM driven Deauthentication.
902 * Issue Deauth Confirm to SME.
903 */
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530904 limLog( pMac, LOGW, FL("Lim Posting DEAUTH_CNF to Sme.Trigger: %d"),
905 mlmStaContext.cleanupTrigger);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530906 vos_mem_copy((tANI_U8 *) &mlmDeauthCnf.peerMacAddr,
907 (tANI_U8 *) staDsAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700908 sizeof(tSirMacAddr));
909 mlmDeauthCnf.resultCode = statusCode;
Wu Gao742b7352015-10-16 19:10:40 +0800910 mlmDeauthCnf.aid = staDsAssocId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700911 mlmDeauthCnf.deauthTrigger =
912 mlmStaContext.cleanupTrigger;
913 /* PE session Id */
914 mlmDeauthCnf.sessionId = psessionEntry->peSessionId;
915
916 limPostSmeMessage(pMac,
917 LIM_MLM_DEAUTH_CNF,
918 (tANI_U32 *) &mlmDeauthCnf);
919 }
920 else if ((mlmStaContext.cleanupTrigger ==
921 eLIM_PEER_ENTITY_DISASSOC) ||
922 (mlmStaContext.cleanupTrigger ==
923 eLIM_PEER_ENTITY_DEAUTH))
924 {
925 /**
926 * Received Disassociation/Deauthentication from peer.
927 * Issue Purge Ind to SME.
928 */
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530929 limLog( pMac, LOGW, FL("Lim Posting PURGE_STA_IND to Sme.Trigger: %d"),
930 mlmStaContext.cleanupTrigger) ;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530931 vos_mem_copy((tANI_U8 *) &mlmPurgeStaInd.peerMacAddr,
932 (tANI_U8 *) staDsAddr,
933 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700934 mlmPurgeStaInd.reasonCode = (tANI_U8) mlmStaContext.disassocReason;
935 mlmPurgeStaInd.aid = staDsAssocId;
936 mlmPurgeStaInd.purgeTrigger = mlmStaContext.cleanupTrigger;
937 mlmPurgeStaInd.sessionId = psessionEntry->peSessionId;
938
939 limPostSmeMessage(pMac,
940 LIM_MLM_PURGE_STA_IND,
941 (tANI_U32 *) &mlmPurgeStaInd);
942 }
943 else if(mlmStaContext.cleanupTrigger == eLIM_JOIN_FAILURE)
944 {
945 //PE setup the peer entry in HW upfront, right after join is completed.
946 //If there is a failure during rest of the assoc sequence, this context needs to be cleaned up.
947 tANI_U8 smesessionId;
948 tANI_U16 smetransactionId;
Mukul Sharmaa052e3d2014-09-08 23:47:06 +0530949 tLimSmeStates tempLimSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700950
951 smesessionId = psessionEntry->smeSessionId;
952 smetransactionId = psessionEntry->transactionId;
953
Mukul Sharmaa052e3d2014-09-08 23:47:06 +0530954 tempLimSmeState = psessionEntry->limSmeState;
Jeff Johnson295189b2012-06-20 16:38:30 -0700955 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700956 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700957
Jeff Johnsone7245742012-09-05 17:12:55 -0700958 //if it is a reassoc failure to join new AP
Mukul Sharmaa052e3d2014-09-08 23:47:06 +0530959 //eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA result code is used
960 //during assoc and reassoc, so sme state req to distinguish them
Madan Mohan Koyyalamudif33324b2012-11-06 19:16:17 -0800961 if((mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE) ||
Santhosh Kumar Padmaa2291d72014-05-23 18:08:50 +0530962 (mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_FAILURE) ||
Mukul Sharmaa052e3d2014-09-08 23:47:06 +0530963 (mlmStaContext.resultCode == eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE) ||
964 (mlmStaContext.resultCode == eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA
965 && tempLimSmeState == eLIM_SME_WT_REASSOC_STATE)
966 )
Jeff Johnsone7245742012-09-05 17:12:55 -0700967 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530968 limLog( pMac, LOG1, FL("Lim Posting eWNI_SME_REASSOC_RSP to SME"
969 "resultCode: %d, statusCode: %d,"
970 "sessionId: %d"),
971 mlmStaContext.resultCode,
972 mlmStaContext.protStatusCode,
973 psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -0700974 if(mlmStaContext.resultCode != eSIR_SME_SUCCESS )
975 {
976 peDeleteSession(pMac, psessionEntry);
977 psessionEntry = NULL;
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530978 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700979 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
980 mlmStaContext.resultCode, mlmStaContext.protStatusCode, psessionEntry,
981 smesessionId, smetransactionId);
982 }
983 else
984 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530985 vos_mem_free(psessionEntry->pLimJoinReq);
986 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700987
Sachin Ahuja2fea3d12014-12-18 17:31:31 +0530988 limLog( pMac, LOG1, FL("Lim Posting eWNI_SME_JOIN_RSP to SME."
989 "resultCode: %d,statusCode: %d,"
990 "sessionId: %d"),
991 mlmStaContext.resultCode,
992 mlmStaContext.protStatusCode,
993 psessionEntry->peSessionId);
994 if(mlmStaContext.resultCode != eSIR_SME_SUCCESS)
995 {
996 peDeleteSession(pMac,psessionEntry);
997 psessionEntry = NULL;
998 }
999
1000 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, mlmStaContext.resultCode, mlmStaContext.protStatusCode,
Jeff Johnson295189b2012-06-20 16:38:30 -07001001 psessionEntry, smesessionId, smetransactionId);
Jeff Johnsone7245742012-09-05 17:12:55 -07001002 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001003
1004 }
1005
1006 if((NULL != psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001007 && (eLIM_AP_ROLE != psessionEntry->limSystemRole )
Jeff Johnson295189b2012-06-20 16:38:30 -07001008 )
1009 {
1010 peDeleteSession(pMac,psessionEntry);
1011 psessionEntry = NULL;
1012 }
1013}
1014
1015/**
1016 * limRejectAssociation()
1017 *
1018 *FUNCTION:
1019 * This function is called whenever Re/Association Request need
1020 * to be rejected due to failure in assigning an AID or failure
1021 * in adding STA context at Polaris or reject by applications.
1022 *
1023 *LOGIC:
1024 * Resources allocated if any are freedup and (Re) Association
1025 * Response frame is sent to requesting STA. Pre-Auth context
1026 * will be added for this STA if it does not exist already
1027 *
1028 *ASSUMPTIONS:
1029 *
1030 *NOTE:
1031 *
1032 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
1033 * @param subType - Indicates whether it is Association Request (=0) or
1034 * Reassociation Request (=1) frame
1035 * @param addPreAuthContext - Indicates whether pre-auth context
1036 * to be added for this STA
1037 * @param authType - Indicates auth type to be added
1038 * @param staId - Indicates staId of the STA being rejected
1039 * association
1040 * @param deleteSta - Indicates whether to delete STA context
1041 * at Polaris
1042 * @param rCode - Indicates what reasonCode to be sent in
1043 * Re/Assoc response to STA
1044 *
1045 * @return None
1046 */
1047
1048void
1049limRejectAssociation(tpAniSirGlobal pMac, tSirMacAddr peerAddr, tANI_U8 subType,
1050 tANI_U8 addPreAuthContext, tAniAuthType authType,
1051 tANI_U16 staId, tANI_U8 deleteSta, tSirResultCodes rCode, tpPESession psessionEntry )
1052{
1053 tpDphHashNode pStaDs;
Kapil Gupta956c0c42017-06-16 19:24:31 +05301054 assoc_rsp_tx_context *tx_complete_context = NULL;
1055 vos_list_node_t *pNode= NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001056
Abhishek Singhdcbd8272014-01-09 14:16:01 +05301057 limLog(pMac, LOG1, FL("Sessionid: %d authType: %d subType: %d "
1058 "addPreAuthContext: %d staId: %d deleteSta: %d rCode : %d "
1059 "peerAddr: "MAC_ADDRESS_STR),psessionEntry->peSessionId,
1060 authType, subType, addPreAuthContext, staId, deleteSta, rCode,
1061 MAC_ADDR_ARRAY(peerAddr));
1062
Jeff Johnson295189b2012-06-20 16:38:30 -07001063 if (addPreAuthContext)
1064 {
1065 // Create entry for this STA in pre-auth list
1066 struct tLimPreAuthNode *pAuthNode;
1067
1068 pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable);
1069
1070 if (pAuthNode)
1071 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301072 vos_mem_copy((tANI_U8 *) pAuthNode->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001073 peerAddr,
1074 sizeof(tSirMacAddr));
1075 pAuthNode->fTimerStarted = 0;
1076 pAuthNode->mlmState = eLIM_MLM_AUTHENTICATED_STATE;
1077 pAuthNode->authType = (tAniAuthType) authType;
Edhar, Mahesh Kumar0d82c212015-02-03 17:47:16 +05301078 pAuthNode->timestamp = vos_timer_get_system_ticks();
Jeff Johnson295189b2012-06-20 16:38:30 -07001079 limAddPreAuthNode(pMac, pAuthNode);
1080 }
1081 }
1082
1083 if (deleteSta == true)
1084 {
1085 pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable);
1086
1087 if (pStaDs == NULL)
1088 {
1089 limLog(pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001090 FL("No STA context, yet rejecting Association"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001091
1092 return;
1093 }
Kapil Gupta956c0c42017-06-16 19:24:31 +05301094 vos_list_peek_front(&pMac->assoc_rsp_completion_list, &pNode);
1095
1096 tx_complete_context = vos_mem_malloc(sizeof(*tx_complete_context));
1097 if (!tx_complete_context)
1098 {
1099 limLog(pMac, LOGW,
1100 FL("Failed to allocate memory"));
1101
1102 return;
1103 }
1104 tx_complete_context->psessionID = psessionEntry->peSessionId;
1105 tx_complete_context->staId = staId;
1106
1107 if (pNode)
1108 vos_list_insert_back(&pMac->assoc_rsp_completion_list,
1109 &tx_complete_context->node);
1110 else
1111 vos_list_insert_front(&pMac->assoc_rsp_completion_list,
1112 &tx_complete_context->node);
Jeff Johnson295189b2012-06-20 16:38:30 -07001113
1114 /**
1115 * Polaris has state for this STA.
1116 * Trigger cleanup.
1117 */
1118 pStaDs->mlmStaContext.cleanupTrigger = eLIM_REASSOC_REJECT;
Jeff Johnson295189b2012-06-20 16:38:30 -07001119 // Send Re/Association Response with
1120 // status code to requesting STA.
1121 limSendAssocRspMgmtFrame(pMac,
1122 rCode,
1123 0,
1124 peerAddr,
Kapil Gupta956c0c42017-06-16 19:24:31 +05301125 subType, 0,psessionEntry, tx_complete_context);
Jeff Johnson295189b2012-06-20 16:38:30 -07001126
1127 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL)
1128 {
1129 // Assoction confirmation is complete, free the copy of association request frame
1130 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
1131 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301132 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07001133 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
1134 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301135 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07001136 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
1137 }
Abhinav Kumara6fa29a2019-01-14 11:21:30 +05301138
Yeshwanth Sriram Guntukab14090a2019-04-12 13:18:05 +05301139 if (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_ADD_STA_RSP_STATE) {
1140 /* Delete hash entry on add sta failure */
1141 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
1142 limDeleteDphHashEntry(pMac, pStaDs->staAddr,
1143 pStaDs->assocId,psessionEntry);
1144 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001145 }
1146 else
1147 {
1148 limSendAssocRspMgmtFrame(pMac,
1149 eSIR_MAC_MAX_ASSOC_STA_REACHED_STATUS,
1150 1,
1151 peerAddr,
Kapil Gupta956c0c42017-06-16 19:24:31 +05301152 subType, 0,psessionEntry, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07001153 // Log error
1154 limLog(pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001155 FL("received Re/Assoc req when max associated STAs reached from "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001156 limPrintMacAddr(pMac, peerAddr, LOGW);
1157 limSendSmeMaxAssocExceededNtf(pMac, peerAddr, psessionEntry->smeSessionId);
1158 }
1159} /*** end limRejectAssociation() ***/
1160
Jeff Johnson295189b2012-06-20 16:38:30 -07001161
1162/** -------------------------------------------------------------
1163\fn limDecideApProtectionOnHt20Delete
1164\brief protection related function while HT20 station is getting deleted.
1165\param tpAniSirGlobal pMac
1166\param tpDphHashNode pStaDs
1167\param tpUpdateBeaconParams pBeaconParams
1168\return None
1169 -------------------------------------------------------------*/
1170static void
1171limDecideApProtectionOnHt20Delete(tpAniSirGlobal pMac,
1172 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1173{
1174 tANI_U32 i = 0;
1175 PELOG1( limLog(pMac, LOG1, FL("(%d) A HT 20 STA is disassociated. Addr is "),
1176 psessionEntry->gLimHt20Params.numSta);
1177 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1178 if (psessionEntry->gLimHt20Params.numSta > 0)
1179 {
1180 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1181 {
1182 if (psessionEntry->protStaCache[i].active)
1183 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301184 if (vos_mem_compare(psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001185 pStaDs->staAddr, sizeof(tSirMacAddr)))
1186 {
1187 psessionEntry->gLimHt20Params.numSta--;
1188 psessionEntry->protStaCache[i].active = false;
1189 break;
1190 }
1191 }
1192 }
1193 }
1194
1195 if (psessionEntry->gLimHt20Params.numSta == 0)
1196 {
1197 // disable protection
Nirav Shahbc35fb72013-12-12 18:14:06 +05301198 limLog(pMac, LOG1, FL("No 11B STA exists, PESessionID %d"),
1199 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001200 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
1201 }
1202}
1203/** -------------------------------------------------------------
1204\fn limDecideApProtectionOnDelete
1205\brief Decides about protection related settings when a station is getting deleted.
1206\param tpAniSirGlobal pMac
1207\param tpDphHashNode pStaDs
1208\param tpUpdateBeaconParams pBeaconParams
1209\return None
1210 -------------------------------------------------------------*/
1211void
1212limDecideApProtectionOnDelete(tpAniSirGlobal pMac,
1213 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1214{
1215 tANI_U32 phyMode;
1216 tHalBitVal erpEnabled = eHAL_CLEAR;
1217 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1218 tANI_U32 i;
1219
1220 if(NULL == pStaDs)
1221 return;
1222
1223 limGetRfBand(pMac, &rfBand, psessionEntry);
1224 if(SIR_BAND_5_GHZ == rfBand)
1225 {
1226 //we are HT. if we are 11A, then protection is not required.
Jeff Johnsone7245742012-09-05 17:12:55 -07001227 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001228 {
1229 //we are HT and 11A station is leaving.
1230 //protection consideration required.
1231 //HT station leaving ==> this case is commonly handled between both the bands below.
1232 if((psessionEntry->beaconParams.llaCoexist) &&
1233 (false == pStaDs->mlmStaContext.htCapability))
1234 {
1235 PELOG1(limLog(pMac, LOG1, FL("(%d) A 11A STA is disassociated. Addr is "),
1236 psessionEntry->gLim11aParams.numSta);
1237 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1238 if (psessionEntry->gLim11aParams.numSta > 0)
1239 {
1240 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1241 {
1242 if (psessionEntry->protStaCache[i].active)
1243 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301244 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001245 pStaDs->staAddr, sizeof(tSirMacAddr)))
1246 {
1247 psessionEntry->gLim11aParams.numSta--;
1248 psessionEntry->protStaCache[i].active = false;
1249 break;
1250 }
1251 }
1252 }
1253 }
1254
1255 if(psessionEntry->gLim11aParams.numSta == 0)
1256 {
1257 // disable protection
1258 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
1259 }
1260 }
1261 }
1262 }
1263 else if(SIR_BAND_2_4_GHZ == rfBand)
1264 {
1265 limGetPhyMode(pMac, &phyMode, psessionEntry);
1266
1267 erpEnabled = pStaDs->erpEnabled;
1268 //we are HT or 11G and 11B station is getting deleted.
1269 if (((phyMode == WNI_CFG_PHY_MODE_11G) ||
Jeff Johnsone7245742012-09-05 17:12:55 -07001270 psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001271 (erpEnabled == eHAL_CLEAR))
1272 {
1273 PELOG1(limLog(pMac, LOG1, FL("(%d) A legacy STA is disassociated. Addr is "),
1274 psessionEntry->gLim11bParams.numSta);
1275 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1276 if (psessionEntry->gLim11bParams.numSta > 0)
1277 {
1278 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1279 {
1280 if (psessionEntry->protStaCache[i].active)
1281 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301282 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001283 pStaDs->staAddr, sizeof(tSirMacAddr)))
1284 {
1285 psessionEntry->gLim11bParams.numSta--;
1286 psessionEntry->protStaCache[i].active = false;
1287 break;
1288 }
1289 }
1290 }
1291 }
1292
1293 if (psessionEntry->gLim11bParams.numSta == 0)
1294 {
1295 // disable protection
Jeff Johnson295189b2012-06-20 16:38:30 -07001296 limEnable11gProtection(pMac, false, false, pBeaconParams,psessionEntry);
1297 }
1298 }
1299 //(non-11B station is leaving) or (we are not 11G or HT AP)
Jeff Johnsone7245742012-09-05 17:12:55 -07001300 else if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001301 { //we are HT AP and non-11B station is leaving.
1302
1303 //11g station is leaving
1304 if(!pStaDs->mlmStaContext.htCapability)
1305 {
1306 PELOG1(limLog(pMac, LOG1, FL("(%d) A 11g STA is disassociated. Addr is "),
1307 psessionEntry->gLim11bParams.numSta);
1308 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1309 if (psessionEntry->gLim11gParams.numSta > 0)
1310 {
1311 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1312 {
1313 if (psessionEntry->protStaCache[i].active)
1314 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301315 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001316 pStaDs->staAddr, sizeof(tSirMacAddr)))
1317 {
1318 psessionEntry->gLim11gParams.numSta--;
1319 psessionEntry->protStaCache[i].active = false;
1320 break;
1321 }
1322 }
1323 }
1324 }
1325
1326 if (psessionEntry->gLim11gParams.numSta == 0)
1327 {
1328 // disable protection
1329 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
1330 }
1331 }
1332 }
1333 }
1334
1335 //LSIG TXOP not supporting staiton leaving. applies to 2.4 as well as 5 GHZ.
Jeff Johnsone7245742012-09-05 17:12:55 -07001336 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001337 (true == pStaDs->mlmStaContext.htCapability))
1338 {
1339 //HT non-GF leaving
1340 if(!pStaDs->htGreenfield)
1341 {
1342 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-GF STA is disassociated. Addr is "),
1343 psessionEntry->gLimNonGfParams.numSta);
1344 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1345 if (psessionEntry->gLimNonGfParams.numSta > 0)
1346 {
1347 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1348 {
1349 if (psessionEntry->protStaCache[i].active)
1350 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301351 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001352 pStaDs->staAddr, sizeof(tSirMacAddr)))
1353 {
1354 psessionEntry->gLimNonGfParams.numSta--;
1355 psessionEntry->protStaCache[i].active = false;
1356 break;
1357 }
1358 }
1359 }
1360 }
1361
1362 if (psessionEntry->gLimNonGfParams.numSta == 0)
1363 {
1364 // disable protection
1365 limEnableHTNonGfProtection(pMac, false, false, pBeaconParams,psessionEntry);
1366 }
1367 }
1368 //HT 20Mhz station leaving.
1369 if(psessionEntry->beaconParams.ht20Coexist &&
1370 (eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet))
1371 {
1372 limDecideApProtectionOnHt20Delete(pMac, pStaDs, pBeaconParams,psessionEntry);
1373 }
1374
1375 if(false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport &&
1376 (false == pStaDs->htLsigTXOPProtection))
1377 {
1378 PELOG1( limLog(pMac, LOG1, FL("(%d) A HT LSIG not supporting STA is disassociated. Addr is "),
1379 psessionEntry->gLimLsigTxopParams.numSta);
1380 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1381 if (psessionEntry->gLimLsigTxopParams.numSta > 0)
1382 {
1383 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1384 {
1385 if (psessionEntry->protStaCache[i].active)
1386 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301387 if (vos_mem_compare( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001388 pStaDs->staAddr, sizeof(tSirMacAddr)))
1389 {
1390 psessionEntry->gLimLsigTxopParams.numSta--;
1391 psessionEntry->protStaCache[i].active = false;
1392 break;
1393 }
1394 }
1395 }
1396 }
1397
1398 if (psessionEntry->gLimLsigTxopParams.numSta == 0)
1399 {
1400 // disable protection
1401 limEnableHTLsigTxopProtection(pMac, true, false, pBeaconParams,psessionEntry);
1402 }
1403 }
1404 }
1405}
1406
Jeff Johnson295189b2012-06-20 16:38:30 -07001407
1408
1409/** -------------------------------------------------------------
1410\fn limDecideShortPreamble
1411\brief Decides about any short preamble reated change because of new station joining.
1412\param tpAniSirGlobal pMac
1413\param tpDphHashNode pStaDs
1414\param tpUpdateBeaconParams pBeaconParams
1415\return None
1416 -------------------------------------------------------------*/
1417void limDecideShortPreamble(tpAniSirGlobal pMac,
1418 tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry )
1419{
1420 tANI_U32 i;
1421
1422 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
1423 {
1424 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-short preamble STA is disassociated. Addr is "),
1425 psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
1426 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1427 if (psessionEntry->gLimNoShortParams.numNonShortPreambleSta > 0)
1428 {
1429 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1430 {
1431 if (psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
1432 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301433 if (vos_mem_compare( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001434 pStaDs->staAddr, sizeof(tSirMacAddr)))
1435 {
1436 psessionEntry->gLimNoShortParams.numNonShortPreambleSta--;
1437 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = false;
1438 break;
1439 }
1440 }
1441 }
1442 }
1443
1444 if (psessionEntry->gLimNoShortParams.numNonShortPreambleSta == 0)
1445 {
1446 // enable short preamble
Jeff Johnson295189b2012-06-20 16:38:30 -07001447 //reset the cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301448 vos_mem_set((tANI_U8 *)&psessionEntry->gLimNoShortParams,
1449 sizeof(tLimNoShortParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001450 if (limEnableShortPreamble(pMac, true, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001451 PELOGE(limLog(pMac, LOGE, FL("Cannot enable short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001452 }
1453 }
1454}
1455
1456/** -------------------------------------------------------------
1457\fn limDecideShortSlot
1458\brief Decides about any short slot time related change because of station leaving the BSS.
1459\param tpAniSirGlobal pMac
1460\param tpDphHashNode pStaDs
1461\return None
1462 -------------------------------------------------------------*/
1463
1464void
1465limDecideShortSlot(tpAniSirGlobal pMac, tpDphHashNode pStaDs,
1466 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
1467{
1468 tANI_U32 i, val;
1469 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
1470 {
1471 PELOG1(limLog(pMac, LOG1, FL("(%d) A non-short slottime STA is disassociated. Addr is "),
1472 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
1473 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
1474
Jeff Johnson295189b2012-06-20 16:38:30 -07001475 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
1476 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta> 0)
1477 {
1478 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1479 {
1480 if (psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
1481 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301482 if (vos_mem_compare(psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001483 pStaDs->staAddr, sizeof(tSirMacAddr)))
1484 {
1485 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta--;
1486 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = false;
1487 break;
1488 }
1489 }
1490 }
1491 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001492 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001493 {
1494 if (pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta> 0)
1495 {
1496 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1497 {
1498 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
1499 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301500 if (vos_mem_compare(pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001501 pStaDs->staAddr, sizeof(tSirMacAddr)))
1502 {
1503 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta--;
1504 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = false;
1505 break;
1506 }
1507 }
1508 }
1509 }
1510 }
1511
1512 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
1513
Jeff Johnson295189b2012-06-20 16:38:30 -07001514 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
1515 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta == 0))
1516 {
1517 // enable short slot time
Jeff Johnson295189b2012-06-20 16:38:30 -07001518 //reset the cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301519 vos_mem_set((tANI_U8 *)&psessionEntry->gLimNoShortSlotParams,
1520 sizeof(tLimNoShortSlotParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001521 // in case of AP set SHORT_SLOT_TIME to enable
1522 if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
1523 {
1524 pBeaconParams->fShortSlotTime = true;
1525 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnsone7245742012-09-05 17:12:55 -07001526 psessionEntry->shortSlotTimeSupported = true;
Jeff Johnson295189b2012-06-20 16:38:30 -07001527 }
1528 }
1529 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001530 {
1531 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta == 0)
1532 {
1533 // enable short slot time
Jeff Johnson295189b2012-06-20 16:38:30 -07001534 //reset the cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301535 vos_mem_set((tANI_U8 *)&pMac->lim.gLimNoShortSlotParams,
1536 sizeof(tLimNoShortSlotParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001537 // in case of AP set SHORT_SLOT_TIME to enable
1538 if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
1539 {
1540 pBeaconParams->fShortSlotTime = true;
1541 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnsone7245742012-09-05 17:12:55 -07001542 psessionEntry->shortSlotTimeSupported = true;
1543 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001544 }
1545 }
1546 }
1547}
1548
Madan Mohan Koyyalamudi85d140a2012-10-18 20:23:01 -07001549void
1550limPostReassocFailure(tpAniSirGlobal pMac,
1551 tSirResultCodes resultCode,
1552 tANI_U16 protStatusCode,tpPESession psessionEntry)
1553{
1554 tLimMlmReassocCnf mlmReassocCnf;
1555
1556 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
1557 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE));
1558
1559 // 'Change' timer for future activations
1560 limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
1561
1562 mlmReassocCnf.resultCode = resultCode;
1563 mlmReassocCnf.protStatusCode = protStatusCode;
1564 /* Update PE session Id */
1565 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
1566 limPostSmeMessage(pMac,
1567 LIM_MLM_REASSOC_CNF,
1568 (tANI_U32 *) &mlmReassocCnf);
1569} /*** end limPostReassocFailure() ***/
1570
Jeff Johnson295189b2012-06-20 16:38:30 -07001571/**
1572 * limRestorePreReassocState()
1573 *
1574 *FUNCTION:
1575 * This function is called on STA role whenever Reasociation
1576 * Response with a reject code is received from AP.
1577 *
1578 *LOGIC:
1579 * Reassociation failure timer is stopped, Old (or current) AP's
1580 * context is restored both at Polaris & software
1581 *
1582 *ASSUMPTIONS:
1583 *
1584 *NOTE:
1585 *
1586 * @param pMac - Pointer to Global MAC structure
1587 * @param resultCode - Result code that specifies why Reassociation
1588 * attemp failed
1589 *
1590 * @return None
1591 */
1592
1593void
1594limRestorePreReassocState(tpAniSirGlobal pMac,
1595 tSirResultCodes resultCode,
1596 tANI_U16 protStatusCode,tpPESession psessionEntry)
1597{
Jeff Johnsone7245742012-09-05 17:12:55 -07001598 tANI_U8 chanNum, secChanOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07001599 tLimMlmReassocCnf mlmReassocCnf;
1600
Abhishek Singhdcbd8272014-01-09 14:16:01 +05301601 limLog(pMac, LOG1, FL("sessionid: %d protStatusCode: %d resultCode: %d"),
1602 psessionEntry->smeSessionId, protStatusCode, resultCode);
1603
Jeff Johnson295189b2012-06-20 16:38:30 -07001604 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001605 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07001606
1607 // 'Change' timer for future activations
1608 limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
1609
1610 // Update BSSID at CFG database
1611 #if 0
1612 if (cfgSetStr(pMac, WNI_CFG_BSSID,
1613 pMac->lim.gLimCurrentBssId,
1614 sizeof(tSirMacAddr)) != eSIR_SUCCESS)
1615 {
1616 /// Could not update BSSID at CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001617 limLog(pMac, LOGP, FL("could not update BSSID at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001618 return;
1619 }
Madan Mohan Koyyalamudi70322d52012-10-18 20:07:33 -07001620 #endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001621
1622 // chanNum = pMac->lim.gLimCurrentChannelId;
1623
1624 /* To support BT-AMP */
1625 chanNum = psessionEntry->currentOperChannel;
Jeff Johnsone7245742012-09-05 17:12:55 -07001626 secChanOffset = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07001627
Jeff Johnsone7245742012-09-05 17:12:55 -07001628 limSetChannel(pMac, chanNum, secChanOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001629
1630 /** @ToDo : Need to Integrate the STOP the DataTransfer to the AP from 11H code */
1631
1632 mlmReassocCnf.resultCode = resultCode;
1633 mlmReassocCnf.protStatusCode = protStatusCode;
1634 /* Update PE session Id */
1635 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
1636 limPostSmeMessage(pMac,
1637 LIM_MLM_REASSOC_CNF,
1638 (tANI_U32 *) &mlmReassocCnf);
1639} /*** end limRestorePreReassocState() ***/
1640
1641
1642
1643/**
1644 * limIsReassocInProgress()
1645 *
1646 *FUNCTION:
1647 * This function is called to see if STA is in wt-reassoc-rsp state.
1648 *
1649 *LOGIC:
1650 *
1651 *ASSUMPTIONS:
1652 *
1653 *NOTE:
1654 *
1655 * @param pMac - Pointer to Global MAC structure
1656 *
1657 * @return eANI_BOOLEAN_TRUE When STA is waiting for Reassoc response from AP \n
1658 * else eANI_BOOLEAN_FALSE
1659 */
1660
1661eAniBoolean
1662limIsReassocInProgress(tpAniSirGlobal pMac,tpPESession psessionEntry)
1663{
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001664 if (psessionEntry == NULL)
1665 {
1666 return eANI_BOOLEAN_FALSE;
1667 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001668 if(((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
1669 ((psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE) ||
1670 (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_LINK_FAIL_STATE)))
1671 return eANI_BOOLEAN_TRUE;
1672
1673 return eANI_BOOLEAN_FALSE;
1674} /*** end limIsReassocInProgress() ***/
1675
Jeff Johnsone7245742012-09-05 17:12:55 -07001676#ifdef WLAN_FEATURE_11AC
1677tSirRetStatus limPopulateVhtMcsSet(tpAniSirGlobal pMac,
1678 tpSirSupportedRates pRates,
1679 tDot11fIEVHTCaps *pPeerVHTCaps,
1680 tpPESession psessionEntry)
1681{
1682 tANI_U32 val;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001683 tANI_U32 selfStaDot11Mode=0;
1684 wlan_cfgGetInt(pMac,WNI_CFG_DOT11_MODE,&selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001685
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001686// if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
1687 if (IS_DOT11_MODE_VHT(selfStaDot11Mode))
Jeff Johnsone7245742012-09-05 17:12:55 -07001688 {
1689 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_MCS_MAP,&val) !=
1690 eSIR_SUCCESS )
1691 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001692 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX MCS MAP"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001693 goto error;
1694 }
1695 pRates->vhtRxMCSMap = (tANI_U16)val;
1696
1697 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_MCS_MAP,&val ) !=
1698 eSIR_SUCCESS )
1699 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001700 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT TX MCS MAP"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001701 goto error;
1702 }
1703 pRates->vhtTxMCSMap = (tANI_U16)val;
1704
1705 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,&val ) !=
1706 eSIR_SUCCESS )
1707 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001708 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001709 goto error;
1710 }
1711 pRates->vhtRxHighestDataRate = (tANI_U16)val;
1712
1713 if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,&val ) !=
1714 eSIR_SUCCESS )
1715 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001716 PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001717 goto error;
1718 }
1719 pRates->vhtTxHighestDataRate = (tANI_U16)val;
1720
1721 if( pPeerVHTCaps != NULL)
1722 {
1723 pRates->vhtTxHighestDataRate = SIR_MIN(pRates->vhtTxHighestDataRate, pPeerVHTCaps->txSupDataRate);
1724 pRates->vhtRxHighestDataRate = SIR_MIN(pRates->vhtRxHighestDataRate, pPeerVHTCaps->rxHighSupDataRate);
1725
Jeff Johnson1250df42012-12-10 14:31:52 -08001726 // Acquire PEER MCS map if we exceed.
Jeff Johnsone7245742012-09-05 17:12:55 -07001727 // We compare/update only the last 2 bits of the map as we support only single BSS.
1728 // Firmware takes care of this comparison
1729 pRates->vhtRxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap
1730 pRates->vhtRxMCSMap |= (pPeerVHTCaps->rxMCSMap & 0x3); // Updating the last 2 bits in the bitmap
1731
1732 // Firmware takes care of this comparison
1733 pRates->vhtTxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap
1734 pRates->vhtTxMCSMap |= (pPeerVHTCaps->txMCSMap & 0x3); // Updating the last 2 bits in the bitmap
1735 }
1736 }
1737 return eSIR_SUCCESS;
1738error:
1739
1740 return eSIR_FAILURE;
1741
1742}
1743#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001744
1745/**
1746 * limPopulateOwnRateSet
1747 *
1748 * FUNCTION:
1749 * This function is called by limProcessAssocRsp() or
1750 * limAddStaInIBSS()
1751 * - It creates a combined rate set of 12 rates max which
1752 * comprises the basic and extended rates read from CFG
1753 * - It sorts the combined rate Set and copy it in the
1754 * rate array of the pSTA descriptor
1755 * - It sets the erpEnabled bit of the STA descriptor
1756 *
1757 * NOTE:
1758 * ERP bit is set iff the dph PHY mode is 11G and there is at least
1759 * an A rate in the supported or extended rate sets
1760 *
1761 * @param pMac - Pointer to Global MAC structure
1762 * @param basicOnly - When passed value is true, only basic
1763 * rates are copied to DPH node else
1764 * all supported rates are copied
1765 * @return eSIR_SUCCESS or eSIR_FAILURE
1766 *
1767 */
Jeff Johnsone7245742012-09-05 17:12:55 -07001768#ifdef WLAN_FEATURE_11AC
1769tSirRetStatus
1770limPopulateOwnRateSet(tpAniSirGlobal pMac,
1771 tpSirSupportedRates pRates,
1772 tANI_U8* pSupportedMCSSet,
1773 tANI_U8 basicOnly,
1774 tpPESession psessionEntry,
1775 tDot11fIEVHTCaps *pVHTCaps)
1776#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001777tSirRetStatus
1778limPopulateOwnRateSet(tpAniSirGlobal pMac,
1779 tpSirSupportedRates pRates,
1780 tANI_U8* pSupportedMCSSet,
1781 tANI_U8 basicOnly,
1782 tpPESession psessionEntry)
Jeff Johnsone7245742012-09-05 17:12:55 -07001783#endif
1784
Jeff Johnson295189b2012-06-20 16:38:30 -07001785{
1786 tSirMacRateSet tempRateSet;
1787 tSirMacRateSet tempRateSet2;
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301788 tANI_U32 i,j,val,min,isArate;
Jeff Johnson295189b2012-06-20 16:38:30 -07001789 tANI_U32 phyMode = 0;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001790 tANI_U32 selfStaDot11Mode=0;
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301791
Jeff Johnson295189b2012-06-20 16:38:30 -07001792 isArate = 0;
1793
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001794 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001795 limGetPhyMode(pMac, &phyMode, psessionEntry);
1796
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301797 /* Include 11b rates only when the device configured in
1798 auto, 11a/b/g or 11b_only */
1799 if ( (selfStaDot11Mode == WNI_CFG_DOT11_MODE_ALL) ||
1800 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11A) ||
1801 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11AC) ||
Leela Venkata Kiran Kumar Reddy Chiralac9a10e52013-08-29 16:37:15 -07001802 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11N) ||
1803 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11G) ||
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301804 (selfStaDot11Mode == WNI_CFG_DOT11_MODE_11B) )
Jeff Johnson295189b2012-06-20 16:38:30 -07001805 {
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301806 val = WNI_CFG_SUPPORTED_RATES_11B_LEN;
1807 wlan_cfgGetStr( pMac, WNI_CFG_SUPPORTED_RATES_11B,
1808 (tANI_U8 *)&tempRateSet.rate, &val );
1809 tempRateSet.numRates = (tANI_U8) val;
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07001810 }
1811 else
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301812 tempRateSet.numRates = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001813
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301814 /* Include 11a rates when the device configured in non-11b mode */
1815 if (!IS_DOT11_MODE_11B(selfStaDot11Mode))
Jeff Johnson295189b2012-06-20 16:38:30 -07001816 {
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301817 val = WNI_CFG_SUPPORTED_RATES_11A_LEN;
1818 wlan_cfgGetStr( pMac, WNI_CFG_SUPPORTED_RATES_11A,
1819 (tANI_U8 *)&tempRateSet2.rate, &val );
Jeff Johnson295189b2012-06-20 16:38:30 -07001820 tempRateSet2.numRates = (tANI_U8) val;
Jeff Johnson295189b2012-06-20 16:38:30 -07001821 }
1822 else
Madan Mohan Koyyalamudi626959e2013-07-15 20:50:43 +05301823 tempRateSet2.numRates = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001824
1825 if ((tempRateSet.numRates + tempRateSet2.numRates) > 12)
1826 {
1827 //we are in big trouble
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001828 limLog(pMac, LOGP, FL("more than 12 rates in CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001829 //panic
1830 goto error;
1831 }
1832
Jeff Johnson295189b2012-06-20 16:38:30 -07001833 //copy all rates in tempRateSet, there are 12 rates max
1834 for (i = 0;i < tempRateSet2.numRates; i++)
1835 tempRateSet.rate[i + tempRateSet.numRates] = tempRateSet2.rate[i];
1836 tempRateSet.numRates += tempRateSet2.numRates;
1837
1838 /**
1839 * Sort rates in tempRateSet (they are likely to be already sorted)
1840 * put the result in pSupportedRates
1841 */
1842 {
1843 tANI_U8 aRateIndex = 0;
1844 tANI_U8 bRateIndex = 0;
1845
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301846 vos_mem_set((tANI_U8 *) pRates, sizeof(tSirSupportedRates), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001847 for(i = 0;i < tempRateSet.numRates; i++)
1848 {
1849 min = 0;
1850 val = 0xff;
1851 isArate = 0;
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07001852 for(j = 0; (j < tempRateSet.numRates) && (j < SIR_MAC_RATESET_EID_MAX); j++)
Jeff Johnson295189b2012-06-20 16:38:30 -07001853 {
1854 if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
1855 {
1856 val = tempRateSet.rate[j] & 0x7f;
1857 min = j;
1858 }
1859 }
1860
1861 if (sirIsArate(tempRateSet.rate[min] & 0x7f))
1862 isArate = 1;
1863
1864 /*
1865 * HAL needs to know whether the rate is basic rate or not, as it needs to
1866 * update the response rate table accordingly. e.g. if one of the 11a rates is
1867 * basic rate, then that rate can be used for sending control frames.
1868 * HAL updates the response rate table whenever basic rate set is changed.
1869 */
1870 if (basicOnly)
1871 {
1872 if (tempRateSet.rate[min] & 0x80)
1873 {
1874 if (isArate)
1875 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1876 else
1877 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1878 }
1879 }
1880 else
1881 {
1882 if (isArate)
1883 pRates->llaRates[aRateIndex++] = tempRateSet.rate[min];
1884 else
1885 pRates->llbRates[bRateIndex++] = tempRateSet.rate[min];
1886 }
1887 tempRateSet.rate[min] = 0xff;
1888 }
1889
1890 }
1891
1892
Gopichand Nakkala681989c2013-03-06 22:27:48 -08001893 //if(IS_DOT11_MODE_HT(psessionEntry->dot11mode))
1894 if (IS_DOT11_MODE_HT(selfStaDot11Mode))
Jeff Johnson295189b2012-06-20 16:38:30 -07001895 {
1896 val = SIZE_OF_SUPPORTED_MCS_SET;
1897 if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
1898 pRates->supportedMCSSet,
1899 &val) != eSIR_SUCCESS)
1900 {
1901 /// Could not get rateset from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001902 PELOGE(limLog(pMac, LOGE, FL("could not retrieve supportedMCSSet"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001903 goto error;
1904 }
1905
1906
1907 //if supported MCS Set of the peer is passed in, then do the intersection
1908 //else use the MCS set from local CFG.
1909
1910 if(pSupportedMCSSet != NULL)
1911 {
1912 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
1913 pRates->supportedMCSSet[i] &= pSupportedMCSSet[i];
1914
1915 }
1916
Abhishek Singh525045c2014-12-15 17:18:45 +05301917 limLog(pMac, LOG1, FL("MCS Rate Set Bitmap: "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001918 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
Sushant Kaushik0b343422015-05-25 17:15:55 +05301919 limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 }
1921
Jeff Johnsone7245742012-09-05 17:12:55 -07001922#ifdef WLAN_FEATURE_11AC
1923 limPopulateVhtMcsSet(pMac, pRates , pVHTCaps,psessionEntry);
1924#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001925
1926 return eSIR_SUCCESS;
1927
1928 error:
1929
1930 return eSIR_FAILURE;
1931} /*** limPopulateOwnRateSet() ***/
1932
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001933#ifdef WLAN_FEATURE_11AC
1934tSirRetStatus
1935limPopulatePeerRateSet(tpAniSirGlobal pMac,
1936
1937 tpSirSupportedRates pRates,
1938 tANI_U8* pSupportedMCSSet,
1939 tANI_U8 basicOnly,
1940 tpPESession psessionEntry,
1941 tDot11fIEVHTCaps *pVHTCaps)
1942#else
1943tSirRetStatus
1944limPopulatePeerRateSet(tpAniSirGlobal pMac,
1945 tpSirSupportedRates pRates,
1946 tANI_U8* pSupportedMCSSet,
1947 tANI_U8 basicOnly,
1948 tpPESession psessionEntry)
1949#endif
1950{
1951 tSirMacRateSet tempRateSet;
1952 tSirMacRateSet tempRateSet2;
Jianmin Zhue99a9392021-10-03 17:23:58 +08001953 tANI_U32 i,j,val,min;
1954 tANI_U8 aRateIndex = 0;
1955 tANI_U8 bRateIndex = 0;
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001956
1957 /* copy operational rate set from psessionEntry */
Praveen Kumar Sirisilla8bdfac42013-10-10 17:20:48 -07001958 if ( psessionEntry->rateSet.numRates <= SIR_MAC_RATESET_EID_MAX )
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001959 {
Kiet Lam842c3e12013-11-16 22:40:57 +05301960 vos_mem_copy((tANI_U8 *)tempRateSet.rate,
1961 (tANI_U8*)(psessionEntry->rateSet.rate),
1962 psessionEntry->rateSet.numRates);
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001963 tempRateSet.numRates = psessionEntry->rateSet.numRates;
1964 }
1965 else
1966 {
1967 limLog(pMac, LOGE, FL("more than SIR_MAC_RATESET_EID_MAX rates\n"));
1968 goto error;
1969 }
Leela Venkata Kiran Kumar Reddy Chirala891bf062013-10-03 14:30:53 -07001970 if ((psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11G) ||
1971 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11A) ||
1972 (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11N))
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001973 {
1974
Praveen Kumar Sirisilla8bdfac42013-10-10 17:20:48 -07001975 if (psessionEntry->extRateSet.numRates <= SIR_MAC_RATESET_EID_MAX)
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001976 {
Kiet Lam842c3e12013-11-16 22:40:57 +05301977 vos_mem_copy((tANI_U8 *)tempRateSet2.rate,
1978 (tANI_U8*)(psessionEntry->extRateSet.rate),
1979 psessionEntry->extRateSet.numRates);
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001980 tempRateSet2.numRates = psessionEntry->extRateSet.numRates;
1981 }
1982 else {
1983 limLog(pMac, LOGE, FL("psessionEntry->extRateSet.numRates more than SIR_MAC_RATESET_EID_MAX rates\n"));
1984 goto error;
1985 }
1986 }
1987 else
1988 tempRateSet2.numRates = 0;
Praveen Kumar Sirisilla8bdfac42013-10-10 17:20:48 -07001989 if ((tempRateSet.numRates + tempRateSet2.numRates) > SIR_MAC_RATESET_EID_MAX)
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001990 {
1991 //we are in big trouble
1992 limLog(pMac, LOGP, FL("more than 12 rates in CFG"));
1993 goto error;
1994 }
1995
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07001996 //copy all rates in tempRateSet, there are 12 rates max
1997 for (i = 0;i < tempRateSet2.numRates; i++)
1998 tempRateSet.rate[i + tempRateSet.numRates] = tempRateSet2.rate[i];
1999 tempRateSet.numRates += tempRateSet2.numRates;
2000 /**
2001 * Sort rates in tempRateSet (they are likely to be already sorted)
2002 * put the result in pSupportedRates
2003 */
Jianmin Zhue99a9392021-10-03 17:23:58 +08002004 vos_mem_set((tANI_U8 *) pRates, sizeof(tSirSupportedRates), 0);
2005 for (i = 0; i < tempRateSet.numRates; i++) {
2006 min = 0;
2007 val = 0xff;
2008 for (j = 0; (j < tempRateSet.numRates) &&
2009 (j < SIR_MAC_RATESET_EID_MAX); j++) {
2010 if ((tANI_U32)(tempRateSet.rate[j] & 0x7f) < val) {
2011 val = tempRateSet.rate[j] & 0x7f;
2012 min = j;
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002013 }
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002014 }
Jianmin Zhue99a9392021-10-03 17:23:58 +08002015 /*
2016 * HAL needs to know whether the rate is basic rate or not,
2017 * as it needs to update the response rate table accordingly.
2018 * e.g. if one of the 11a rates is basic rate, then that rate
2019 * can be used for sending control frames. HAL updates the
2020 * response rate table whenever basic rate set is changed.
2021 */
2022 if (basicOnly && !(tempRateSet.rate[min] & 0x80)) {
2023 limLog(pMac, LOG2, FL("Invalid basic rate"));
2024 } else if (sirIsArate(tempRateSet.rate[min] & 0x7f)) {
2025 if (aRateIndex >= SIR_NUM_11A_RATES) {
2026 limLog(pMac, LOG2, FL("OOB, aRateIndex: %d"), aRateIndex);
2027 } else if (aRateIndex >= 1 && (tempRateSet.rate[min] ==
2028 pRates->llaRates[aRateIndex - 1])) {
2029 limLog(pMac, LOG2, FL("Duplicate 11a rate: %d"),
2030 tempRateSet.rate[min]);
2031 } else {
2032 pRates->llaRates[aRateIndex++] =
2033 tempRateSet.rate[min];
2034 }
2035 } else if (sirIsBrate(tempRateSet.rate[min] & 0x7f)) {
2036 if (bRateIndex >= SIR_NUM_11B_RATES) {
2037 limLog(pMac, LOG2, FL("OOB, bRateIndex: %d"), bRateIndex);
2038 } else if (bRateIndex >= 1 && (tempRateSet.rate[min] ==
2039 pRates->llbRates[bRateIndex - 1])) {
2040 limLog(pMac, LOG2, FL("Duplicate 11b rate: %d"),
2041 tempRateSet.rate[min]);
2042 } else {
2043 pRates->llbRates[bRateIndex++] =
2044 tempRateSet.rate[min];
2045 }
2046 } else {
2047 limLog(pMac, LOG2, FL("%d is neither 11a nor 11b rate"),
2048 tempRateSet.rate[min]);
2049 }
2050 tempRateSet.rate[min] = 0xff;
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002051 }
2052
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002053 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode))
2054 {
2055 val = SIZE_OF_SUPPORTED_MCS_SET;
2056 if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
2057 pRates->supportedMCSSet,
2058 &val) != eSIR_SUCCESS)
2059 {
2060 /// Could not get rateset from CFG. Log error.
2061 PELOGE(limLog(pMac, LOGE, FL("could not retrieve supportedMCSSet"));)
2062 goto error;
2063 }
2064 //if supported MCS Set of the peer is passed in, then do the intersection
2065 //else use the MCS set from local CFG.
2066 if(pSupportedMCSSet != NULL)
2067 {
2068 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
2069 pRates->supportedMCSSet[i] &= pSupportedMCSSet[i];
2070 }
Abhishek Singh525045c2014-12-15 17:18:45 +05302071 limLog(pMac, LOG1, FL("MCS Rate Set Bitmap: "));
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002072 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
Sushant Kaushik0b343422015-05-25 17:15:55 +05302073 limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002074 }
2075#ifdef WLAN_FEATURE_11AC
2076 limPopulateVhtMcsSet(pMac, pRates , pVHTCaps,psessionEntry);
2077#endif
2078 return eSIR_SUCCESS;
2079 error:
2080 return eSIR_FAILURE;
2081} /*** limPopulatePeerRateSet() ***/
2082
Jeff Johnson295189b2012-06-20 16:38:30 -07002083/**
2084 * limPopulateMatchingRateSet
2085 * FUNCTION:
2086 * This is called at the time of Association Request
2087 * processing on AP and while adding peer's context
2088 * in IBSS role to process the CFG rate sets and
2089 * the rate sets received in the Assoc request on AP
2090 * or Beacon/Probe Response from peer in IBSS.
2091 *
2092 * LOGIC:
2093 * 1. It makes the intersection between our own rate Sat
2094 * and extemcded rate set and the ones received in the
2095 * association request.
2096 * 2. It creates a combined rate set of 12 rates max which
2097 * comprised the basic and extended rates
2098 * 3. It sorts the combined rate Set and copy it in the
2099 * rate array of the pSTA descriptor
2100 *
2101 * ASSUMPTION:
2102 * The parser has already ensured unicity of the rates in the
2103 * association request structure
2104 *
2105 * @param: pMac - Pointer to Global MAC structure
2106 * pStaDs - Pointer to DPH node
2107 * pOperRateSet - Pointer to peer's supported rateset
2108 * pExtRateSet - Pointer to peer's extended rateset
2109 *
2110 * @return: eSIR_SUCCESS or eSIR_FAILURE
2111 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002112#ifdef WLAN_FEATURE_11AC
2113tSirRetStatus
2114limPopulateMatchingRateSet(tpAniSirGlobal pMac,
2115 tpDphHashNode pStaDs,
2116 tSirMacRateSet *pOperRateSet,
2117 tSirMacRateSet *pExtRateSet,
2118 tANI_U8* pSupportedMCSSet,
2119 tSirMacPropRateSet *pAniLegRateSet,
2120 tpPESession psessionEntry,
2121 tDot11fIEVHTCaps *pVHTCaps)
Jeff Johnson295189b2012-06-20 16:38:30 -07002122
Jeff Johnsone7245742012-09-05 17:12:55 -07002123#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002124tSirRetStatus
2125limPopulateMatchingRateSet(tpAniSirGlobal pMac,
2126 tpDphHashNode pStaDs,
2127 tSirMacRateSet *pOperRateSet,
2128 tSirMacRateSet *pExtRateSet,
2129 tANI_U8* pSupportedMCSSet,
2130 tSirMacPropRateSet *pAniLegRateSet,
2131 tpPESession psessionEntry)
Jeff Johnsone7245742012-09-05 17:12:55 -07002132#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002133{
2134 tSirMacRateSet tempRateSet;
2135 tSirMacRateSet tempRateSet2;
2136 tANI_U32 i,j,val,min,isArate;
2137 tANI_U32 phyMode;
2138 tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET];
2139
2140 isArate=0;
2141
2142 // limGetPhyMode(pMac, &phyMode);
2143 limGetPhyMode(pMac, &phyMode, psessionEntry);
2144
2145 // get own rate set
2146 // val = WNI_CFG_OPERATIONAL_RATE_SET_LEN;
2147 #if 0
2148 if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
2149 (tANI_U8 *) &tempRateSet.rate,
2150 &val) != eSIR_SUCCESS)
2151 {
2152 /// Could not get rateset from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002153 limLog(pMac, LOGP, FL("could not retrieve rateset"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002154 }
2155
2156 #endif // TO SUPPORT BT-AMP
2157
2158 /* copy operational rate set from psessionEntry */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302159 vos_mem_copy((tempRateSet.rate), (psessionEntry->rateSet.rate),
2160 psessionEntry->rateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07002161 tempRateSet.numRates = (tANI_U8) psessionEntry->rateSet.numRates;
2162
2163 if (phyMode == WNI_CFG_PHY_MODE_11G)
2164 {
2165
2166 #if 0
2167 // get own extended rate set
2168 val = WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN;
2169 if (wlan_cfgGetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
2170 (tANI_U8 *) &tempRateSet2.rate,
2171 &val) != eSIR_SUCCESS)
2172 #endif
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302173 vos_mem_copy((tempRateSet2.rate), (psessionEntry->extRateSet.rate),
2174 psessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07002175 tempRateSet2.numRates = (tANI_U8) psessionEntry->extRateSet.numRates;
2176 }
2177 else
2178 tempRateSet2.numRates = 0;
2179
2180 if ((tempRateSet.numRates + tempRateSet2.numRates) > 12)
2181 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002182 PELOGE(limLog(pMac, LOGE, FL("more than 12 rates in CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002183 goto error;
2184 }
2185
2186 /**
2187 * Handling of the rate set IEs is the following:
2188 * - keep only rates that we support and that the station supports
2189 * - sort and the rates into the pSta->rate array
2190 */
2191
2192 // Copy all rates in tempRateSet, there are 12 rates max
2193 for(i = 0; i < tempRateSet2.numRates; i++)
2194 tempRateSet.rate[i + tempRateSet.numRates] =
2195 tempRateSet2.rate[i];
2196
2197 tempRateSet.numRates += tempRateSet2.numRates;
2198
2199 /**
2200 * Sort rates in tempRateSet (they are likely to be already sorted)
2201 * put the result in tempRateSet2
2202 */
2203 tempRateSet2.numRates = 0;
2204
2205 for(i = 0;i < tempRateSet.numRates; i++)
2206 {
2207 min = 0;
2208 val = 0xff;
2209
2210 for(j = 0;j < tempRateSet.numRates; j++)
2211 if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val)
2212 {
2213 val = tempRateSet.rate[j] & 0x7f;
2214 min = j;
2215 }
2216
2217 tempRateSet2.rate[tempRateSet2.numRates++] =
2218 tempRateSet.rate[min];
2219 tempRateSet.rate[min] = 0xff;
2220 }
2221
2222
2223 /**
2224 * Copy received rates in tempRateSet, the parser has ensured
2225 * unicity of the rates so there cannot be more than 12
2226 */
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002227 for(i = 0; (i < pOperRateSet->numRates && i < SIR_MAC_RATESET_EID_MAX) ; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07002228 {
2229 tempRateSet.rate[i] = pOperRateSet->rate[i];
2230 }
2231
2232 tempRateSet.numRates = pOperRateSet->numRates;
2233
2234 if (pExtRateSet->numRates)
2235 {
2236 if((tempRateSet.numRates + pExtRateSet->numRates) > 12 )
2237 {
Abhishek Singh525045c2014-12-15 17:18:45 +05302238 limLog( pMac, LOG1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002239 "Sum of SUPPORTED and EXTENDED Rate Set (%1d) exceeds 12!",
2240 tempRateSet.numRates + pExtRateSet->numRates );
2241
2242 if( tempRateSet.numRates < 12 )
2243 {
2244 int found = 0;
2245 int tail = tempRateSet.numRates;
2246
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002247 for( i = 0; (i < pExtRateSet->numRates && i < SIR_MAC_RATESET_EID_MAX); i++ )
Jeff Johnson295189b2012-06-20 16:38:30 -07002248 {
2249 found = 0;
2250 for( j = 0; j < (tANI_U32) tail; j++ )
2251 {
2252 if((tempRateSet.rate[j] & 0x7F) ==
2253 (pExtRateSet->rate[i] & 0x7F))
2254 {
2255 found = 1;
2256 break;
2257 }
2258 }
2259
2260 if( !found )
2261 {
2262 tempRateSet.rate[tempRateSet.numRates++] =
2263 pExtRateSet->rate[i];
2264
2265 if( tempRateSet.numRates >= 12 )
2266 break;
2267 }
2268 }
2269 }
2270 else
Abhishek Singh525045c2014-12-15 17:18:45 +05302271 limLog( pMac, LOG1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 "Relying only on the SUPPORTED Rate Set IE..." );
2273 }
2274 else
2275 {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002276 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 -07002277 tempRateSet.rate[i+j] = pExtRateSet->rate[j];
2278
2279 tempRateSet.numRates += pExtRateSet->numRates;
2280 }
2281 }
2282
2283 {
2284 tpSirSupportedRates rates = &pStaDs->supportedRates;
2285 tANI_U8 aRateIndex = 0;
2286 tANI_U8 bRateIndex = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302287 vos_mem_set((tANI_U8 *) rates, sizeof(tSirSupportedRates), 0);
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002288 for(i = 0;(i < tempRateSet2.numRates && i < SIR_MAC_RATESET_EID_MAX ); i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07002289 {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002290 for(j = 0;(j < tempRateSet.numRates && j < SIR_MAC_RATESET_EID_MAX); j++)
Jeff Johnson295189b2012-06-20 16:38:30 -07002291 {
2292 if ((tempRateSet2.rate[i] & 0x7F) ==
2293 (tempRateSet.rate[j] & 0x7F))
2294 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002295 if (sirIsArate(tempRateSet2.rate[i] & 0x7f))
2296 {
2297 isArate=1;
Kiran Kumar Lokerea328bcd2013-04-22 22:02:05 -07002298 if (aRateIndex < SIR_NUM_11A_RATES)
2299 rates->llaRates[aRateIndex++] = tempRateSet2.rate[i];
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 }
2301 else
Kiran Kumar Lokerea328bcd2013-04-22 22:02:05 -07002302 {
2303 if (bRateIndex < SIR_NUM_11B_RATES)
2304 rates->llbRates[bRateIndex++] = tempRateSet2.rate[i];
2305 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002306 break;
2307 }
2308 }
2309 }
2310
2311
2312 //Now add the Polaris rates only when Proprietary rates are enabled.
2313 val = 0;
2314 if(wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_RATES_ENABLED, &val) != eSIR_SUCCESS)
2315 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002316 limLog(pMac, LOGP, FL("could not retrieve prop rate enabled flag from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002317 }
2318 else if(val)
2319 {
2320 for(i=0; i<pAniLegRateSet->numPropRates; i++)
2321 rates->aniLegacyRates[i] = pAniLegRateSet->propRate[i];
2322 }
2323
2324 }
2325
2326
2327 //compute the matching MCS rate set, if peer is 11n capable and self mode is 11n
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002328#ifdef FEATURE_WLAN_TDLS
2329 if(pStaDs->mlmStaContext.htCapability)
2330#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002331 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
2332 (pStaDs->mlmStaContext.htCapability))
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002333#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002334 {
2335 val = SIZE_OF_SUPPORTED_MCS_SET;
2336 if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET,
2337 mcsSet,
2338 &val) != eSIR_SUCCESS)
2339 {
2340 /// Could not get rateset from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002341 limLog(pMac, LOGP, FL("could not retrieve supportedMCSSet"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002342 goto error;
2343 }
2344
2345 for(i=0; i<val; i++)
2346 pStaDs->supportedRates.supportedMCSSet[i] = mcsSet[i] & pSupportedMCSSet[i];
2347
Abhishek Singh525045c2014-12-15 17:18:45 +05302348 limLog(pMac, LOG1, FL(" MCS Rate Set Bitmap from CFG and DPH : "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002349 for(i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++)
2350 {
Abhishek Singh525045c2014-12-15 17:18:45 +05302351 limLog(pMac, LOG1,FL("%x %x "), mcsSet[i],
2352 pStaDs->supportedRates.supportedMCSSet[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 }
2354 }
2355
Jeff Johnsone7245742012-09-05 17:12:55 -07002356#ifdef WLAN_FEATURE_11AC
2357 limPopulateVhtMcsSet(pMac, &pStaDs->supportedRates, pVHTCaps, psessionEntry);
2358#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002359 /**
2360 * Set the erpEnabled bit iff the phy is in G mode and at least
2361 * one A rate is supported
2362 */
2363 if ((phyMode == WNI_CFG_PHY_MODE_11G) && isArate)
2364 pStaDs->erpEnabled = eHAL_SET;
2365
2366
2367
2368 return eSIR_SUCCESS;
2369
2370 error:
2371
2372 return eSIR_FAILURE;
2373} /*** limPopulateMatchingRateSet() ***/
2374
2375
2376
2377/**
2378 * limAddSta()
2379 *
2380 *FUNCTION:
2381 * This function is called to add an STA context at hardware
2382 * whenever a STA is (Re) Associated.
2383 *
2384 *LOGIC:
2385 *
2386 *ASSUMPTIONS:
2387 * NA
2388 *
2389 *NOTE:
2390 * NA
2391 *
2392 * @param pMac - Pointer to Global MAC structure
2393 * @param pStaDs - Pointer to the STA datastructure created by
2394 * LIM and maintained by DPH
2395 * @return retCode - Indicates success or failure return code
2396 */
2397
2398tSirRetStatus
2399limAddSta(
2400 tpAniSirGlobal pMac,
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002401 tpDphHashNode pStaDs, tANI_U8 updateEntry, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002402{
2403 tpAddStaParams pAddStaParams = NULL;
2404 tSirMsgQ msgQ;
2405 tSirRetStatus retCode = eSIR_SUCCESS;
2406 tSirMacAddr staMac, *pStaAddr;
2407 tANI_U8 i;
Jeff Johnson295189b2012-06-20 16:38:30 -07002408 tpSirAssocReq pAssocReq;
2409 tANI_U8 *p2pIe = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002410 #if 0
2411 retCode = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg);
2412 if (retCode != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002413 limLog(pMac, LOGP, FL("could not retrieve STA MAC"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002414 #endif //To SUPPORT BT-AMP
2415
2416
2417 sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
2418
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302419 limLog(pMac, LOG1, FL("sessionid: %d updateEntry = %d limsystemrole = %d "),
2420 psessionEntry->smeSessionId, updateEntry, psessionEntry->limSystemRole);
2421
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302422 pAddStaParams = vos_mem_malloc(sizeof(tAddStaParams));
2423 if (NULL == pAddStaParams)
2424 {
2425 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
2426 return eSIR_MEM_ALLOC_FAILED;
2427 }
2428 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002429
2430 if ((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||
2431 (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE) ||
2432 (limGetSystemRole(psessionEntry) == eLIM_BT_AMP_AP_ROLE) )
2433 pStaAddr = &pStaDs->staAddr;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002434#ifdef FEATURE_WLAN_TDLS
2435 /* SystemRole shouldn't be matter if staType is TDLS peer */
2436 else if(STA_ENTRY_TDLS_PEER == pStaDs->staType)
2437 {
2438 pStaAddr = &pStaDs->staAddr ;
2439 }
2440#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002441 else
2442 pStaAddr = &staMac;
2443
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302444 limLog(pMac, LOG1, FL(MAC_ADDRESS_STR": Subtype(Assoc/Reassoc): %d "),
2445 MAC_ADDR_ARRAY(*pStaAddr), pStaDs->mlmStaContext.subType);
2446
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302447 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2448 (tANI_U8 *) *pStaAddr, sizeof(tSirMacAddr));
2449 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
2450 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002451
2452 limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
2453
2454 //Copy legacy rates
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302455 vos_mem_copy ((tANI_U8*)&pAddStaParams->supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -07002456 (tANI_U8*)&pStaDs->supportedRates, sizeof(tSirSupportedRates));
2457
2458 pAddStaParams->assocId = pStaDs->assocId;
2459
2460 pAddStaParams->wmmEnabled = pStaDs->qosMode;
2461 pAddStaParams->listenInterval = pStaDs->mlmStaContext.listenInterval;
2462 pAddStaParams->shortPreambleSupported = pStaDs->shortPreambleEnabled;
Abhishek Singhf08a82b2014-10-07 11:00:42 +05302463 pAddStaParams->currentOperChan = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002464 if((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) && (pStaDs->mlmStaContext.subType == LIM_REASSOC))
2465 {
2466 /* TBD - need to remove this REASSOC check after fixinf rmmod issue */
2467 pAddStaParams->updateSta = pStaDs->mlmStaContext.updateContext;
2468 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002469 pStaDs->valid = 0;
2470 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
2471
Abhishek Singh525045c2014-12-15 17:18:45 +05302472 limLog(pMac, LOG1, FL(" Assoc ID: %d wmmEnabled = %d listenInterval = %d"
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302473 " shortPreambleSupported: %d "), pAddStaParams->assocId,
2474 pAddStaParams->wmmEnabled, pAddStaParams->listenInterval,
2475 pAddStaParams->shortPreambleSupported);
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07002476 // This will indicate HAL to "allocate" a new STA index
2477#ifdef FEATURE_WLAN_TDLS
2478 /* As there is corner case in-between add_sta and change_sta,if del_sta for other staIdx happened,
2479 * firmware return wrong staIdx (recently removed staIdx). Until we get a confirmation from the
2480 * firmware team it is now return correct staIdx for same sta_mac_addr for update case, we want
2481 * to get around it by passing valid staIdx given by add_sta time.
2482 */
2483 if((STA_ENTRY_TDLS_PEER == pStaDs->staType) &&
2484 (true == updateEntry))
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +05302485 {
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07002486 pAddStaParams->staIdx = pStaDs->staIndex;
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +05302487 }
Gopichand Nakkalae7cbc5d2013-03-27 21:09:23 -07002488 else
2489#endif
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05302490#ifdef SAP_AUTH_OFFLOAD
2491 if (!pMac->sap_auth_offload)
2492 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
2493 else
2494 pAddStaParams->staIdx = pStaDs->staIndex;
2495#else
2496 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
2497#endif
2498
Jeff Johnson295189b2012-06-20 16:38:30 -07002499 pAddStaParams->staType = pStaDs->staType;
2500
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002501 pAddStaParams->updateSta = updateEntry;
2502
Jeff Johnson295189b2012-06-20 16:38:30 -07002503 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2504 pAddStaParams->respReqd = 1;
2505 //Update HT Capability
2506
2507 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 -07002508 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002509 pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability;
Jeff Johnsone7245742012-09-05 17:12:55 -07002510#ifdef WLAN_FEATURE_11AC
2511 pAddStaParams->vhtCapable = pStaDs->mlmStaContext.vhtCapability;
2512#endif
2513 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002514#ifdef FEATURE_WLAN_TDLS
2515 /* SystemRole shouldn't be matter if staType is TDLS peer */
2516 else if(STA_ENTRY_TDLS_PEER == pStaDs->staType)
Hoonki Lee99e53782013-02-12 18:07:03 -08002517 {
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002518 pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability;
Hoonki Lee99e53782013-02-12 18:07:03 -08002519#ifdef WLAN_FEATURE_11AC
2520 pAddStaParams->vhtCapable = pStaDs->mlmStaContext.vhtCapability;
2521#endif
2522 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002523#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002524 else
Jeff Johnsone7245742012-09-05 17:12:55 -07002525 {
2526 pAddStaParams->htCapable = psessionEntry->htCapability;
2527#ifdef WLAN_FEATURE_11AC
2528 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
2529#endif
2530
2531 }
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302532#ifdef WLAN_FEATURE_11AC
Abhishek Singh525045c2014-12-15 17:18:45 +05302533 limLog(pMac, LOG1, FL("vhtCapable: %d "), pAddStaParams->vhtCapable);
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302534#endif
Abhishek Singh525045c2014-12-15 17:18:45 +05302535 limLog(pMac, LOG1, FL(" StaIdx: %d updateSta = %d htcapable = %d "),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302536 pAddStaParams->staIdx,pAddStaParams->updateSta,
2537 pAddStaParams->htCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002538
2539 pAddStaParams->greenFieldCapable = pStaDs->htGreenfield;
2540 pAddStaParams->maxAmpduDensity= pStaDs->htAMpduDensity;
2541 pAddStaParams->maxAmpduSize = pStaDs->htMaxRxAMpduFactor;
2542 pAddStaParams->fDsssCckMode40Mhz = pStaDs->htDsssCckRate40MHzSupport;
2543 pAddStaParams->fShortGI20Mhz = pStaDs->htShortGI20Mhz;
2544 pAddStaParams->fShortGI40Mhz = pStaDs->htShortGI40Mhz;
2545 pAddStaParams->lsigTxopProtection = pStaDs->htLsigTXOPProtection;
2546 pAddStaParams->maxAmsduSize = pStaDs->htMaxAmsduLength;
2547 pAddStaParams->txChannelWidthSet = pStaDs->htSupportedChannelWidthSet;
2548 pAddStaParams->mimoPS = pStaDs->htMIMOPSState;
Jeff Johnsone7245742012-09-05 17:12:55 -07002549
Abhishek Singh525045c2014-12-15 17:18:45 +05302550 limLog(pMac, LOG1, FL(" greenFieldCapable: %d maxAmpduDensity = %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302551 "maxAmpduDensity = %d"), pAddStaParams->greenFieldCapable,
2552 pAddStaParams->maxAmpduDensity, pAddStaParams->maxAmpduSize);
2553
Abhishek Singh525045c2014-12-15 17:18:45 +05302554 limLog(pMac, LOG1, FL("fDsssCckMode40Mhz: %d fShortGI20Mhz: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302555 "fShortGI40Mhz: %d"), pAddStaParams->fDsssCckMode40Mhz,
2556 pAddStaParams->fShortGI20Mhz, pAddStaParams->fShortGI40Mhz);
2557
Abhishek Singh525045c2014-12-15 17:18:45 +05302558 limLog(pMac, LOG1, FL("lsigTxopProtection: %d maxAmsduSize: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302559 "txChannelWidthSet: %d mimoPS: %d "), pAddStaParams->lsigTxopProtection,
2560 pAddStaParams->maxAmsduSize,pAddStaParams->txChannelWidthSet,
2561 pAddStaParams->mimoPS);
2562
Jeff Johnsone7245742012-09-05 17:12:55 -07002563#ifdef WLAN_FEATURE_11AC
2564 if(pAddStaParams->vhtCapable)
2565 {
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002566 pAddStaParams->vhtTxChannelWidthSet = pStaDs->vhtSupportedChannelWidthSet;
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08002567 pAddStaParams->vhtTxBFCapable =
Hoonki Lee99e53782013-02-12 18:07:03 -08002568#ifdef FEATURE_WLAN_TDLS
2569 (( STA_ENTRY_PEER == pStaDs->staType ) || (STA_ENTRY_TDLS_PEER == pStaDs->staType)) ?
2570 pStaDs->vhtBeamFormerCapable : psessionEntry->txBFIniFeatureEnabled ;
2571#else
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08002572 ( STA_ENTRY_PEER == pStaDs->staType ) ? pStaDs->vhtBeamFormerCapable :
2573 psessionEntry->txBFIniFeatureEnabled ;
Hoonki Lee99e53782013-02-12 18:07:03 -08002574#endif
Abhishek Singh525045c2014-12-15 17:18:45 +05302575 limLog(pMac, LOG1, FL("vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302576 pAddStaParams->vhtTxChannelWidthSet,pAddStaParams->vhtTxBFCapable);
Jeff Johnsone7245742012-09-05 17:12:55 -07002577 }
2578#endif
2579
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08002580#ifdef FEATURE_WLAN_TDLS
2581 if((STA_ENTRY_PEER == pStaDs->staType) ||
2582 (STA_ENTRY_TDLS_PEER == pStaDs->staType))
2583#else
2584 if (STA_ENTRY_PEER == pStaDs->staType)
2585#endif
2586 {
2587 /* peer STA get the LDPC capability from pStaDs, which populated from
2588 * HT/VHT capability*/
Sushant Kaushik4fb4da72015-02-20 21:37:29 +05302589 if(pAddStaParams->vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP)
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08002590 {
2591 pAddStaParams->htLdpcCapable = 0;
2592 pAddStaParams->vhtLdpcCapable = 0;
2593 }
2594 else
2595 {
Abhishek Singh2fefebd2016-01-13 14:37:49 +05302596 if (psessionEntry->txLdpcIniFeatureEnabled & 0x1)
2597 pAddStaParams->htLdpcCapable = pStaDs->htLdpcCapable;
2598 else
2599 pAddStaParams->htLdpcCapable = 0;
2600 if (psessionEntry->txLdpcIniFeatureEnabled & 0x2)
2601 pAddStaParams->vhtLdpcCapable = pStaDs->vhtLdpcCapable;
2602 else
2603 pAddStaParams->vhtLdpcCapable = 0;
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08002604 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08002605 }
2606 else if( STA_ENTRY_SELF == pStaDs->staType)
2607 {
2608 /* For Self STA get the LDPC capability from config.ini*/
2609 pAddStaParams->htLdpcCapable =
2610 (psessionEntry->txLdpcIniFeatureEnabled & 0x01);
2611 pAddStaParams->vhtLdpcCapable =
2612 ((psessionEntry->txLdpcIniFeatureEnabled >> 1)& 0x01);
2613 }
2614
Jeff Johnson295189b2012-06-20 16:38:30 -07002615 /* Update PE session ID*/
2616 pAddStaParams->sessionId = psessionEntry->peSessionId;
2617
2618 if (psessionEntry->parsedAssocReq != NULL)
2619 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002620 // Get a copy of the already parsed Assoc Request
2621 pAssocReq = (tpSirAssocReq) psessionEntry->parsedAssocReq[pStaDs->assocId];
2622 if ( pAssocReq && pAssocReq->addIEPresent && pAssocReq->addIE.length ) {
2623 p2pIe = limGetP2pIEPtr(pMac, pAssocReq->addIE.addIEdata, pAssocReq->addIE.length);
2624 }
2625 pAddStaParams->p2pCapableSta = (p2pIe != NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002626 }
2627
2628 //Disable BA. It will be set as part of ADDBA negotiation.
2629 for( i = 0; i < STACFG_MAX_TC; i++ )
2630 {
2631 pAddStaParams->staTCParams[i].txUseBA = eBA_DISABLE;
2632 pAddStaParams->staTCParams[i].rxUseBA = eBA_DISABLE;
2633 }
2634
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002635#ifdef FEATURE_WLAN_TDLS
2636 if(pStaDs->wmeEnabled && \
2637 ((eLIM_AP_ROLE == psessionEntry->limSystemRole) || (STA_ENTRY_TDLS_PEER == pStaDs->staType)) )
2638#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002639 if(pStaDs->wmeEnabled && (eLIM_AP_ROLE == psessionEntry->limSystemRole))
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002640#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002641 {
2642 pAddStaParams->uAPSD = 0;
2643 /* update UAPSD and send it to LIM to add STA */
2644 // bitmap MSB <- LSB MSB 4 bits are for
2645 // trigger enabled AC setting and LSB 4 bits
2646 // are for delivery enabled AC setting
2647 // 7 6 5 4 3 2 1 0
2648 // BE BK VI VO BE BK VI VO
2649 pAddStaParams->uAPSD |= pStaDs->qos.capability.qosInfo.acvo_uapsd;
2650 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acvi_uapsd << 1);
2651 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbk_uapsd << 2);
2652 pAddStaParams->uAPSD |= (pStaDs->qos.capability.qosInfo.acbe_uapsd << 3);
2653 //making delivery enabled and trigger enabled setting the same.
2654 pAddStaParams->uAPSD |= pAddStaParams->uAPSD << 4;
2655
2656 pAddStaParams->maxSPLen = pStaDs->qos.capability.qosInfo.maxSpLen;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302657 limLog( pMac, LOG1, FL("uAPSD = 0x%x, maxSpLen = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002658 pAddStaParams->uAPSD, pAddStaParams->maxSPLen);
2659 }
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002660
2661#ifdef WLAN_FEATURE_11W
2662 pAddStaParams->rmfEnabled = pStaDs->rmfEnabled;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302663 limLog( pMac, LOG1, FL( "PMF enabled %d"), pAddStaParams->rmfEnabled);
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002664#endif
2665
Abhishek Singh525045c2014-12-15 17:18:45 +05302666 limLog(pMac, LOG1, FL("htLdpcCapable: %d vhtLdpcCapable: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302667 "p2pCapableSta: %d"), pAddStaParams->htLdpcCapable,
2668 pAddStaParams->vhtLdpcCapable, pAddStaParams->p2pCapableSta);
2669
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05302670#ifdef SAP_AUTH_OFFLOAD
2671 if (pMac->sap_auth_offload) {
2672 pAddStaParams->dpuIndex = pStaDs->dpuIndex;
2673 pAddStaParams->bcastDpuIndex = pStaDs->bcastDpuIndex;
2674 pAddStaParams->bcastMgmtDpuIdx = pStaDs->bcastMgmtDpuIdx;
2675 pAddStaParams->ucUcastSig = pStaDs->ucUcastSig;
2676 pAddStaParams->ucBcastSig = pStaDs->ucBcastSig;
2677 pAddStaParams->ucMgmtSig = pStaDs->ucMgmtSig;
Agrawal Ashishce67f362017-01-05 20:10:58 +05302678 pAddStaParams->bssIdx = pStaDs->bssId;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05302679 }
2680#endif
2681
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002682 //we need to defer the message until we get the response back from HAL.
Jeff Johnson295189b2012-06-20 16:38:30 -07002683 if (pAddStaParams->respReqd)
2684 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07002685
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05302686#ifdef SAP_AUTH_OFFLOAD
Agrawal Ashishce4190c2017-01-04 23:41:16 +05302687 if (pMac->sap_auth_offload && LIM_IS_AP_ROLE(psessionEntry))
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05302688 msgQ.type = WDA_SAP_OFL_ADD_STA;
2689 else
2690 msgQ.type = WDA_ADD_STA_REQ;
2691#else
2692 msgQ.type = WDA_ADD_STA_REQ;
2693#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002694
2695 msgQ.reserved = 0;
2696 msgQ.bodyptr = pAddStaParams;
2697 msgQ.bodyval = 0;
2698
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002699 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_STA_REQ for assocId %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002700 pStaDs->assocId);
Jeff Johnsone7245742012-09-05 17:12:55 -07002701 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002702
2703 retCode = wdaPostCtrlMsg( pMac, &msgQ );
2704 if( eSIR_SUCCESS != retCode)
2705 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002706 if (pAddStaParams->respReqd)
2707 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002708 limLog( pMac, LOGE, FL("ADD_STA_REQ for aId %d failed (reason %X)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002709 pStaDs->assocId, retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302710 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002711 }
2712
2713 return retCode;
2714}
2715
2716
2717/**
2718 * limDelSta()
2719 *
2720 *FUNCTION:
2721 * This function is called to delete an STA context at hardware
2722 * whenever a STA is disassociated
2723 *
2724 *LOGIC:
2725 *
2726 *ASSUMPTIONS:
2727 * NA
2728 *
2729 *NOTE:
2730 * NA
2731 *
2732 * @param pMac - Pointer to Global MAC structure
2733 * @param pStaDs - Pointer to the STA datastructure created by
2734 * LIM and maintained by DPH
2735 * @param fRespReqd - flag to indicate whether the delete is synchronous (true)
2736 * or not (false)
2737 * @return retCode - Indicates success or failure return code
2738 */
2739
2740tSirRetStatus
2741limDelSta(
2742 tpAniSirGlobal pMac,
2743 tpDphHashNode pStaDs,
2744 tANI_BOOLEAN fRespReqd,
2745 tpPESession psessionEntry)
2746{
2747 tpDeleteStaParams pDelStaParams = NULL;
2748 tSirMsgQ msgQ;
2749 tSirRetStatus retCode = eSIR_SUCCESS;
Sravan Kumar Kairam18705ef2017-09-21 18:37:50 +05302750 tANI_U8 channelNum = 0;
2751 tANI_U32 cfgValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002752
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302753 pDelStaParams = vos_mem_malloc(sizeof( tDeleteStaParams ));
2754 if (NULL == pDelStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07002755 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302756 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002757 return eSIR_MEM_ALLOC_FAILED;
2758 }
2759
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302760 vos_mem_set((tANI_U8 *) pDelStaParams, sizeof(tDeleteStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002761
Sravan Kumar Kairam18705ef2017-09-21 18:37:50 +05302762 wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_PASSIVE_CON, &cfgValue);
2763
2764 channelNum = limGetCurrentOperatingChannel(pMac);
2765 limLog(pMac, LOG1, FL("Current Operating channel is %d"), channelNum);
2766 if (!cfgValue && (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) &&
2767 limIsconnectedOnDFSChannel(channelNum))
2768 {
2769 limCovertChannelScanType(pMac, channelNum, false);
2770 pMac->lim.dfschannelList.timeStamp[channelNum] = 0;
2771 }
2772
2773
Jeff Johnson295189b2012-06-20 16:38:30 -07002774 //
2775 // DPH contains the STA index only for "peer" STA entries.
2776 // LIM global contains "self" STA index
2777 // Thus,
2778 // if( STA role )
2779 // get STA index from LIM global
2780 // else
2781 // get STA index from DPH
2782 //
2783
2784#if 0
2785 /* Since we have not created any STA, no need to send msg to delete
2786 * STA to HAL */
2787 if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) {
2788 pDelStaParams->staIdx = 1; /* TODO : This is workaround. Need to find right STA Index before sending to HAL */
2789 //return retCode;
2790 }
2791#endif
2792
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002793#ifdef FEATURE_WLAN_TDLS
2794 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)) )
2795#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002796 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 -08002797#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002798 pDelStaParams->staIdx= psessionEntry->staId;
2799
2800 else
2801 pDelStaParams->staIdx= pStaDs->staIndex;
2802
2803 pDelStaParams->assocId = pStaDs->assocId;
2804 pStaDs->valid = 0;
2805
2806 if (! fRespReqd)
2807 pDelStaParams->respReqd = 0;
2808 else
2809 {
Abhinav Kumarecb0e3a2018-06-13 14:57:35 +05302810 if (pStaDs->staType != STA_ENTRY_TDLS_PEER) {
2811 /**
2812 * when limDelSta is called from processSmeAssocCnf
2813 * then mlmState is already set properly.
2814 */
2815 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE !=
2816 GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs)) {
2817 MTRACE(macTrace
2818 (pMac, TRACE_CODE_MLM_STATE,
2819 psessionEntry->peSessionId,
2820 eLIM_MLM_WT_DEL_STA_RSP_STATE));
2821 SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs,
2822 eLIM_MLM_WT_DEL_STA_RSP_STATE);
2823 }
2824 if ((eLIM_STA_ROLE ==
2825 GET_LIM_SYSTEM_ROLE(psessionEntry)) ||
2826 (eLIM_BT_AMP_STA_ROLE ==
2827 GET_LIM_SYSTEM_ROLE(psessionEntry))) {
2828 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE,
2829 psessionEntry->peSessionId,
2830 eLIM_MLM_WT_DEL_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002831
Abhinav Kumarecb0e3a2018-06-13 14:57:35 +05302832 psessionEntry->limMlmState =
2833 eLIM_MLM_WT_DEL_STA_RSP_STATE;
2834 }
2835
Jeff Johnson295189b2012-06-20 16:38:30 -07002836 }
Abhinav Kumarecb0e3a2018-06-13 14:57:35 +05302837 /**
2838 * we need to defer the message until we get the
2839 * response back from HAL.
2840 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002841 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Abhinav Kumarecb0e3a2018-06-13 14:57:35 +05302842 pDelStaParams->respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002843 }
2844
2845 /* Update PE session ID*/
2846 pDelStaParams->sessionId = psessionEntry->peSessionId;
2847
2848 pDelStaParams->status = eHAL_STATUS_SUCCESS;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05302849#ifdef SAP_AUTH_OFFLOAD
Agrawal Ashishce4190c2017-01-04 23:41:16 +05302850 if (pMac->sap_auth_offload && LIM_IS_AP_ROLE(psessionEntry))
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05302851 msgQ.type = WDA_SAP_OFL_DEL_STA;
2852 else
2853 msgQ.type = WDA_DELETE_STA_REQ;
2854#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002855 msgQ.type = WDA_DELETE_STA_REQ;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05302856#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002857 msgQ.reserved = 0;
2858 msgQ.bodyptr = pDelStaParams;
2859 msgQ.bodyval = 0;
2860
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302861 limLog( pMac, LOG1, FL( "Sessionid %d :Sending SIR_HAL_DELETE_STA_REQ "
2862 "for STAID: %X and AssocID: %d MAC : "MAC_ADDRESS_STR ),
2863 pDelStaParams->sessionId,
2864 pDelStaParams->staIdx, pDelStaParams->assocId,
2865 MAC_ADDR_ARRAY(pStaDs->staAddr));
2866
Jeff Johnsone7245742012-09-05 17:12:55 -07002867 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002868 retCode = wdaPostCtrlMsg( pMac, &msgQ );
2869 if( eSIR_SUCCESS != retCode)
2870 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002871 if(fRespReqd)
2872 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002873 limLog( pMac, LOGE, FL("Posting DELETE_STA_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002874 retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302875 vos_mem_free(pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002876 }
2877
2878 return retCode;
2879}
2880
2881#if defined WLAN_FEATURE_VOWIFI_11R
2882/*------------------------------------------------------------------------
2883 * limAddFTStaSelf()
2884 *
2885 * FUNCTION:
2886 *
2887 * This function is called to add a STA once we have connected with a new
2888 * AP, that we have performed an FT to.
2889 *
2890 * The Add STA Response is created and now after the ADD Bss Is Successful
2891 * we add the self sta. We update with the association id from the reassoc
2892 * response from the AP.
2893 *------------------------------------------------------------------------
2894 */
2895tSirRetStatus limAddFTStaSelf(tpAniSirGlobal pMac, tANI_U16 assocId, tpPESession psessionEntry)
2896{
2897 tpAddStaParams pAddStaParams = NULL;
2898 tSirMsgQ msgQ;
2899 tSirRetStatus retCode = eSIR_SUCCESS;
2900
2901 pAddStaParams = pMac->ft.ftPEContext.pAddStaReq;
2902 pAddStaParams->assocId = assocId;
2903
2904 msgQ.type = SIR_HAL_ADD_STA_REQ;
2905 msgQ.reserved = 0;
2906 msgQ.bodyptr = pAddStaParams;
2907 msgQ.bodyval = 0;
2908
2909
2910#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002911 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002912#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002913 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002914
2915 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002916 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_ADD_STA_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002917 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
2918 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
2919 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002920 limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X"), retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302921 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002922 }
2923 //
2924 // Dont need it any more
2925 pMac->ft.ftPEContext.pAddStaReq = NULL;
2926 return retCode;
2927}
2928
2929#endif /* WLAN_FEATURE_VOWIFI_11R */
2930
2931/**
2932 * limAddStaSelf()
2933 *
2934 *FUNCTION:
2935 * This function is called to add an STA context at hardware
2936 * whenever a STA is (Re) Associated.
2937 *
2938 *LOGIC:
2939 *
2940 *ASSUMPTIONS:
2941 * NA
2942 *
2943 *NOTE:
2944 * NA
2945 *
2946 * @param pMac - Pointer to Global MAC structure
2947 * @param pStaDs - Pointer to the STA datastructure created by
2948 * LIM and maintained by DPH
2949 * @return retCode - Indicates success or failure return code
2950 */
2951
2952tSirRetStatus
2953limAddStaSelf(tpAniSirGlobal pMac,tANI_U16 staIdx, tANI_U8 updateSta, tpPESession psessionEntry)
2954{
2955 tpAddStaParams pAddStaParams = NULL;
2956 tSirMsgQ msgQ;
2957 tSirRetStatus retCode = eSIR_SUCCESS;
2958 tSirMacAddr staMac;
2959 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
krunal soni71343fb2013-09-16 16:16:26 -07002960 tANI_U32 shortGi20MhzSupport;
2961 tANI_U32 shortGi40MhzSupport;
Sushant Kaushikb90b4e22015-04-14 14:29:49 +05302962 tANI_U32 val;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002963 /*This self Sta dot 11 mode comes from the cfg and the expectation here is
2964 * that cfg carries the systemwide capability that device under
2965 * consideration can support. This capability gets plumbed into the cfg
2966 * cache at system initialization time via the .dat and .ini file override
2967 * mechanisms and will not change. If it does change, it is the
2968 * responsibility of SME to evict the selfSta and reissue a new AddStaSelf
2969 * command.*/
2970 tANI_U32 selfStaDot11Mode=0, selfTxWidth=0;
2971 wlan_cfgGetInt(pMac,WNI_CFG_DOT11_MODE,&selfStaDot11Mode);
2972 limLog( pMac, LOG1, FL("cfgDot11Mode %d"),(int)selfStaDot11Mode);
2973 wlan_cfgGetInt(pMac,WNI_CFG_HT_CAP_INFO_SUPPORTED_CHAN_WIDTH_SET,&selfTxWidth);
2974 limLog( pMac, LOG1, FL("SGI 20 %d"),(int)selfTxWidth);
2975 limLog( pMac, LOG1, FL("Roam Channel Bonding Mode %d"),(int)pMac->roam.configParam.uCfgDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002976
2977 #if 0
2978 retCode =wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, staMac, &cfg);
2979 if (retCode != eSIR_SUCCESS)
2980 {
2981 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002982 limLog(pMac, LOGP, FL("could not retrieve STA MAC"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002983 return retCode;
2984 }
2985 #endif //TO SUPPORT BT-AMP
2986 sirCopyMacAddr(staMac,psessionEntry->selfMacAddr);
Abhishek Singhdcbd8272014-01-09 14:16:01 +05302987 limLog(pMac, LOG1, FL(MAC_ADDRESS_STR": "),MAC_ADDR_ARRAY(staMac));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302988 pAddStaParams = vos_mem_malloc(sizeof(tAddStaParams));
2989 if (NULL == pAddStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07002990 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302991 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002992 return eSIR_MEM_ALLOC_FAILED;
2993 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302994 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002995
2996 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302997 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2998 (tANI_U8 *) staMac, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002999
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303000 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
3001 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003002
3003 pAddStaParams->assocId = psessionEntry->limAID;
3004 pAddStaParams->staType = STA_ENTRY_SELF;
3005 pAddStaParams->status = eHAL_STATUS_SUCCESS;
3006 pAddStaParams->respReqd = 1;
Abhishek Singhf08a82b2014-10-07 11:00:42 +05303007 pAddStaParams->currentOperChan = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003008 /* Update PE session ID */
3009 pAddStaParams->sessionId = psessionEntry->peSessionId;
3010
3011 // This will indicate HAL to "allocate" a new STA index
3012 pAddStaParams->staIdx = staIdx;
3013 pAddStaParams->updateSta = updateSta;
3014
Sushant Kaushikb90b4e22015-04-14 14:29:49 +05303015 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
3016 {
3017 limLog(pMac, LOGP, FL("Get short preamble failed. Set Default value"));
3018 pAddStaParams->shortPreambleSupported = 1;
3019 }
3020 pAddStaParams->shortPreambleSupported = val;
Jeff Johnson295189b2012-06-20 16:38:30 -07003021
Jeff Johnsone7245742012-09-05 17:12:55 -07003022#ifdef WLAN_FEATURE_11AC
3023 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry,NULL);
3024#else
3025 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
3026#endif
Gopichand Nakkala681989c2013-03-06 22:27:48 -08003027// if( psessionEntry->htCapability)---> old check
3028 /*We used to check if the session is htCapable before setting the htCapable
3029 * flag. The check limited us from operating */
3030 if ( IS_DOT11_MODE_HT(selfStaDot11Mode) )
Jeff Johnson295189b2012-06-20 16:38:30 -07003031 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08003032 pAddStaParams->htCapable = TRUE ;
Jeff Johnson295189b2012-06-20 16:38:30 -07003033#ifdef DISABLE_GF_FOR_INTEROP
3034 /*
3035 * To resolve the interop problem with Broadcom AP,
3036 * where TQ STA could not pass traffic with GF enabled,
3037 * TQ STA will do Greenfield only with TQ AP, for
3038 * everybody else it will be turned off.
3039 */
3040 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
3041 {
3042 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
3043 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
3044 }
3045 else
3046#endif
Gopichand Nakkala681989c2013-03-06 22:27:48 -08003047 {
3048 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
3049 pAddStaParams->txChannelWidthSet =
Dundi Raviteja51596a12021-03-22 17:27:51 +05303050 pMac->roam.configParam.channelBondingMode5GHz ^
3051 pMac->roam.configParam.channelBondingMode24GHz;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08003052 // pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
3053 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
3054 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
3055 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
3056 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
3057 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
3058 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
3059 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
3060 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
krunal soni71343fb2013-09-16 16:16:26 -07003061 /*
3062 * We will read the gShortGI20Mhz from ini file, and if it is set
3063 * to 1 then we will tell Peer that we support 40Mhz short GI
3064 */
3065 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
3066 (pMac, WNI_CFG_SHORT_GI_20MHZ,
3067 &shortGi20MhzSupport)))
3068 {
3069 if (VOS_TRUE == shortGi20MhzSupport)
3070 {
3071 pAddStaParams->fShortGI20Mhz =
3072 WNI_CFG_SHORT_GI_20MHZ_STAMAX;
3073 //pAddStaParams->fShortGI20Mhz =
3074 //limGetHTCapability(pMac, eHT_SHORT_GI_20MHZ,
3075 // psessionEntry);
3076 }
3077 else
3078 {
3079 pAddStaParams->fShortGI20Mhz = VOS_FALSE;
3080 }
3081 }
3082 else
3083 {
3084 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz"
3085 "CFG,setting value to default"));)
3086 pAddStaParams->fShortGI20Mhz = WNI_CFG_SHORT_GI_20MHZ_STADEF;
3087 }
3088
3089 /*
3090 * We will read the gShortGI40Mhz from ini file, and if it is set
3091 * to 1 then we will tell Peer that we support 40Mhz short GI
3092 */
3093 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
3094 (pMac, WNI_CFG_SHORT_GI_40MHZ,
3095 &shortGi40MhzSupport)))
3096 {
3097 if (VOS_TRUE == shortGi40MhzSupport)
3098 {
3099 pAddStaParams->fShortGI40Mhz =
3100 WNI_CFG_SHORT_GI_40MHZ_STAMAX;
3101 //pAddStaParams->fShortGI40Mhz =
3102 //limGetHTCapability(pMac, eHT_SHORT_GI_40MHZ,
3103 // psessionEntry);
3104 }
3105 else
3106 {
3107 pAddStaParams->fShortGI40Mhz = VOS_FALSE;
3108 }
3109 }
3110 else
3111 {
3112 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz"
3113 "CFG,setting value to default"));)
3114 pAddStaParams->fShortGI40Mhz = WNI_CFG_SHORT_GI_40MHZ_STADEF;
3115 }
Abhishek Singh525045c2014-12-15 17:18:45 +05303116 limLog(pMac, LOG1, FL(" greenFieldCapable: %d maxAmpduDensity = %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303117 "maxAmpduSize = %d"), pAddStaParams->greenFieldCapable,
3118 pAddStaParams->maxAmpduDensity, pAddStaParams->maxAmpduSize);
3119
Abhishek Singh525045c2014-12-15 17:18:45 +05303120 limLog(pMac, LOG1, FL("fDsssCckMode40Mhz: %d fShortGI20Mhz: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303121 "fShortGI40Mhz: %d lsigTxopProtection: %d"),
3122 pAddStaParams->fDsssCckMode40Mhz, pAddStaParams->fShortGI20Mhz,
3123 pAddStaParams->fShortGI40Mhz, pAddStaParams->lsigTxopProtection);
3124
Abhishek Singh525045c2014-12-15 17:18:45 +05303125 limLog(pMac, LOG1, FL(" maxAmsduSize: %d txChannelWidthSet: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303126 "mimoPS: %d rifsMode %d delBASupport %d"),
3127 pAddStaParams->maxAmsduSize,
3128 pAddStaParams->txChannelWidthSet, pAddStaParams->mimoPS,
3129 pAddStaParams->rifsMode, pAddStaParams->delBASupport );
Gopichand Nakkala681989c2013-03-06 22:27:48 -08003130 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003131 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003132#ifdef WLAN_FEATURE_11AC
Gopichand Nakkala681989c2013-03-06 22:27:48 -08003133 pAddStaParams->vhtCapable = IS_DOT11_MODE_VHT(selfStaDot11Mode);
3134 if (pAddStaParams->vhtCapable){
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07003135 pAddStaParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08003136 limLog( pMac, LOG1, FL("VHT WIDTH SET %d"),pAddStaParams->vhtTxChannelWidthSet);
3137 }
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08003138 pAddStaParams->vhtTxBFCapable = psessionEntry->txBFIniFeatureEnabled;
Abhishek Singh525045c2014-12-15 17:18:45 +05303139 limLog(pMac, LOG1, FL("vhtCapable: %d vhtTxBFCapable %d "),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303140 pAddStaParams->vhtCapable, pAddStaParams->vhtTxBFCapable);
Jeff Johnsone7245742012-09-05 17:12:55 -07003141#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08003142
3143 /* For Self STA get the LDPC capability from session i.e config.ini*/
3144 pAddStaParams->htLdpcCapable =
3145 (psessionEntry->txLdpcIniFeatureEnabled & 0x01);
3146 pAddStaParams->vhtLdpcCapable =
3147 ((psessionEntry->txLdpcIniFeatureEnabled >> 1)& 0x01);
3148
Jeff Johnson295189b2012-06-20 16:38:30 -07003149 if(wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003150 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003151 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
3152
Jeff Johnson295189b2012-06-20 16:38:30 -07003153 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona)
3154 {
3155 pAddStaParams->p2pCapableSta = 1;
3156 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003157
Gopichand Nakkala681989c2013-03-06 22:27:48 -08003158 //limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
3159 pAddStaParams->supportedRates.opRateMode = limGetStaRateMode((tANI_U8)selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003160
Abhishek Singh525045c2014-12-15 17:18:45 +05303161 limLog(pMac, LOG1, FL(" StaIdx: %d updateSta = %d htcapable = %d "),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303162 pAddStaParams->staIdx,pAddStaParams->updateSta,
3163 pAddStaParams->htCapable);
3164
Abhishek Singh525045c2014-12-15 17:18:45 +05303165 limLog(pMac, LOG1, FL("htLdpcCapable: %d vhtLdpcCapable: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303166 "p2pCapableSta: %d"),
3167 pAddStaParams->htLdpcCapable,pAddStaParams->vhtLdpcCapable,
3168 pAddStaParams->p2pCapableSta);
3169
Abhishek Singh525045c2014-12-15 17:18:45 +05303170 limLog(pMac, LOG1, FL(" sessionid: %d Assoc ID: %d listenInterval = %d"
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303171 " shortPreambleSupported: %d "), psessionEntry->smeSessionId,
3172 pAddStaParams->assocId, pAddStaParams->listenInterval,
3173 pAddStaParams->shortPreambleSupported);
3174
Jeff Johnson295189b2012-06-20 16:38:30 -07003175 msgQ.type = WDA_ADD_STA_REQ;
3176 //
3177 // FIXME_GEN4
3178 // A global counter (dialog token) is required to keep track of
3179 // all PE <-> HAL communication(s)
3180 //
3181 msgQ.reserved = 0;
3182 msgQ.bodyptr = pAddStaParams;
3183 msgQ.bodyval = 0;
3184
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303185 limLog( pMac, LOGW, FL(MAC_ADDRESS_STR":Sessionid %d : "
3186 "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ),
3187 MAC_ADDR_ARRAY(pAddStaParams->staMac),
3188 pAddStaParams->sessionId,
3189 pAddStaParams->assocId);
Jeff Johnsone7245742012-09-05 17:12:55 -07003190 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003191
3192 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
3193 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003194 limLog( pMac, LOGE, FL("Posting ADD_STA_REQ to HAL failed, reason=%X"), retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303195 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003196 }
3197 return retCode;
3198}
3199
3200
3201/**
3202 * limTeardownInfraBSS()
3203 *
3204 *FUNCTION:
3205 * This function is called by various LIM functions to teardown
3206 * an established Infrastructure BSS
3207 *
3208 *LOGIC:
3209 *
3210 *ASSUMPTIONS:
3211 *
3212 *NOTE:
3213 *
3214 * @param pMac - Pointer to Global MAC structure
3215 * @return None
3216 */
3217
3218void
3219limTeardownInfraBss(tpAniSirGlobal pMac,tpPESession psessionEntry)
3220{
3221 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3222
3223 /**
3224 * Send Broadcast Disassociate frame with
3225 * 'leaving BSS' reason.
3226 */
3227 limSendDisassocMgmtFrame(pMac,
3228 eSIR_MAC_DISASSOC_LEAVING_BSS_REASON,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003229 bcAddr,psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003230} /*** end limTeardownInfraBss() ***/
3231
3232
3233/**
3234 * limHandleCnfWaitTimeout()
3235 *
3236 *FUNCTION:
3237 * This function is called by limProcessMessageQueue to handle
3238 * various confirmation failure cases.
3239 *
3240 *LOGIC:
3241 *
3242 *ASSUMPTIONS:
3243 *
3244 *NOTE:
3245 *
3246 * @param pMac - Pointer to Global MAC structure
3247 * @param pStaDs - Pointer to a sta descriptor
3248 * @return None
3249 */
3250
3251void limHandleCnfWaitTimeout(tpAniSirGlobal pMac, tANI_U16 staId)
3252{
3253 tpDphHashNode pStaDs;
3254 tLimSystemRole systemRole;
3255 tpPESession psessionEntry = NULL;
3256
3257 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId))== NULL)
3258 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003259 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003260 return;
3261 }
3262 systemRole = limGetSystemRole(psessionEntry);
3263 pStaDs = dphGetHashEntry(pMac, staId, &psessionEntry->dph.dphHashTable);
3264
3265 if (pStaDs == NULL)
3266 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003267 PELOGW(limLog(pMac, LOGW, FL("No STA context in SIR_LIM_CNF_WAIT_TIMEOUT."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003268 return;
3269 }
3270
3271 switch (pStaDs->mlmStaContext.mlmState) {
3272 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003273 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 -07003274 limPrintMacAddr(pMac, pStaDs->staAddr, LOGW);
3275
3276 if ( (systemRole == eLIM_AP_ROLE)|| (systemRole == eLIM_BT_AMP_AP_ROLE) )
3277 {
3278 limRejectAssociation(
3279 pMac,
3280 pStaDs->staAddr,
3281 pStaDs->mlmStaContext.subType,
3282 true,
3283 pStaDs->mlmStaContext.authType,
3284 pStaDs->assocId,
3285 true,
3286 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
3287 psessionEntry);
3288 }
3289 break;
3290
3291 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003292 limLog(pMac, LOGW, FL("Received CNF_WAIT_TIMEOUT in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003293 pStaDs->mlmStaContext.mlmState);
3294 }
3295}
3296
3297
3298/**
3299 * limDeleteDphHashEntry()
3300 *
3301 *FUNCTION:
3302 * This function is called whenever we need to delete
3303 * the dph hash entry
3304 *
3305 *LOGIC:
3306 *
3307 *ASSUMPTIONS:
3308 *
3309 *NOTE:
3310 *
3311 * @param pMac Pointer to Global MAC structure
3312 * @param tANI_U16 staId
3313 * @return None
3314 */
3315
3316void
3317limDeleteDphHashEntry(tpAniSirGlobal pMac, tSirMacAddr staAddr, tANI_U16 staId,tpPESession psessionEntry)
3318{
3319 tANI_U16 aid;
3320 tpDphHashNode pStaDs;
3321 tUpdateBeaconParams beaconParams;
3322 tLimSystemRole systemRole;
3323
Kaushik, Sushantfb156732014-01-07 15:36:03 +05303324 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Jeff Johnson295189b2012-06-20 16:38:30 -07003325 beaconParams.paramChangeBitmap = 0;
3326 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, staId);
3327 if (NULL == psessionEntry)
3328 {
3329 PELOGE(limLog(pMac, LOGE, FL("NULL psessionEntry"));)
3330 return;
3331 }
3332 systemRole = limGetSystemRole(psessionEntry);
3333 beaconParams.bssIdx = psessionEntry->bssIdx;
3334 pStaDs = dphLookupHashEntry(pMac, staAddr, &aid, &psessionEntry->dph.dphHashTable);
3335 if (pStaDs != NULL)
3336 {
3337 PELOGW(limLog(pMac, LOGW, FL("Deleting DPH Hash entry for STAID: %X\n "), staId);)
3338 // update the station count and perform associated actions
3339 // do this before deleting the dph hash entry
3340 limUtilCountStaDel(pMac, pStaDs, psessionEntry);
3341
3342 if((eLIM_AP_ROLE == psessionEntry->limSystemRole) ||
3343 (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole))
3344 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003345 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
3346 if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE){
3347 limDecideApProtectionOnDelete(pMac, pStaDs, &beaconParams,psessionEntry);
3348 }
3349 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003350
3351 if(eLIM_STA_IN_IBSS_ROLE == systemRole)
3352 limIbssDecideProtectionOnDelete(pMac, pStaDs, &beaconParams, psessionEntry);
3353
3354 limDecideShortPreamble(pMac, pStaDs, &beaconParams, psessionEntry);
3355 limDecideShortSlot(pMac, pStaDs, &beaconParams, psessionEntry);
3356
3357 //Send message to HAL about beacon parameter change.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003358 PELOGW(limLog(pMac, LOGW, FL("param bitmap = %d "), beaconParams.paramChangeBitmap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003359 if(beaconParams.paramChangeBitmap)
3360 {
3361 schSetFixedBeaconFields(pMac,psessionEntry);
3362 limSendBeaconParams(pMac, &beaconParams, psessionEntry );
3363 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08003364
3365#ifdef WLAN_FEATURE_11W
3366 tx_timer_delete(&pStaDs->pmfSaQueryTimer);
3367#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003368 }
3369 if (dphDeleteHashEntry(pMac, staAddr, staId, &psessionEntry->dph.dphHashTable) != eSIR_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003370 limLog(pMac, LOGP, FL("error deleting hash entry"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003371 }
3372}
3373
3374
3375
3376/**
3377 * limCheckAndAnnounceJoinSuccess()
3378 *
3379 *FUNCTION:
3380 * This function is called upon receiving Beacon/Probe Response
3381 * frame in WT_JOIN_BEACON_STATE to check if the received
3382 * Beacon/Probe Response is from the BSS that we're attempting
3383 * to join.
3384 *
3385 *LOGIC:
3386 * If the Beacon/Probe Response is indeed from the BSS we're
3387 * attempting to join, join success is sent to SME.
3388 *
3389 *ASSUMPTIONS:
3390 *
3391 *NOTE:
3392 *
3393 * @param pMac Pointer to Global MAC structure
3394 * @param pBPR Pointer to received Beacon/Probe Response
3395 * @param pHdr Pointer to received Beacon/Probe Response
3396 * MAC header
3397 * @return None
3398 */
3399
3400void
3401limCheckAndAnnounceJoinSuccess(tpAniSirGlobal pMac,
3402 tSirProbeRespBeacon *pBPR,
3403 tpSirMacMgmtHdr pHdr,tpPESession psessionEntry)
3404{
3405 tSirMacSSid currentSSID;
3406 tLimMlmJoinCnf mlmJoinCnf;
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -08003407 tANI_U32 val = 0;
3408 tANI_U32 *noa1DurationFromBcn = NULL;
3409 tANI_U32 *noa2DurationFromBcn = NULL;
3410 tANI_U32 noa;
3411 tANI_U32 TotalNum_NoADesc = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003412
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303413 vos_mem_copy(currentSSID.ssId,
3414 psessionEntry->ssId.ssId,
3415 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003416
3417 currentSSID.length = (tANI_U8)psessionEntry->ssId.length ;
3418
3419 if (
3420 /* Check for SSID only in probe response. Beacons may not carry
3421 SSID information in hidden SSID case */
3422 ( (SIR_MAC_MGMT_FRAME == pHdr->fc.type) &&
3423 (SIR_MAC_MGMT_PROBE_RSP == pHdr->fc.subType) ) &&
3424 currentSSID.length &&
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303425 (!vos_mem_compare((tANI_U8 *) &pBPR->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07003426 (tANI_U8 *) &currentSSID,
3427 (tANI_U8) (1 + currentSSID.length)) ))
3428 {
3429 /**
3430 * Received SSID does not match with the one we've.
3431 * Ignore received Beacon frame
3432 */
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303433 limLog(pMac, LOG1, FL("SSID received in Beacon does not match"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003434#ifdef WLAN_DEBUG
3435 pMac->lim.gLimBcnSSIDMismatchCnt++;
3436#endif
3437 return;
3438 }
3439
3440 if( (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_STA_ROLE))
3441 {
Nirav Shahbc35fb72013-12-12 18:14:06 +05303442 limLog(pMac, LOG1, FL("Received Beacon/PR with matching BSSID"
3443 MAC_ADDRESS_STR "PESessionID %d"),
3444 MAC_ADDR_ARRAY(psessionEntry->bssId),
3445 psessionEntry->peSessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07003446 // Deactivate Join Failure timer
3447 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003448 // Deactivate Periodic Join timer
3449 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
Jeff Johnson295189b2012-06-20 16:38:30 -07003450
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -08003451 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona &&
3452 pBPR->P2PProbeRes.NoticeOfAbsence.present)
3453 {
3454
3455 noa1DurationFromBcn = (tANI_U32*)(pBPR->P2PProbeRes.NoticeOfAbsence.NoADesc + 1);
3456
3457 if(pBPR->P2PProbeRes.NoticeOfAbsence.num_NoADesc)
3458 TotalNum_NoADesc = pBPR->P2PProbeRes.NoticeOfAbsence.num_NoADesc/SIZE_OF_NOA_DESCRIPTOR;
3459
3460 noa = *noa1DurationFromBcn;
3461
3462 if(TotalNum_NoADesc > 1)
3463 {
3464 noa2DurationFromBcn = (tANI_U32*)(pBPR->P2PProbeRes.NoticeOfAbsence.NoADesc + SIZE_OF_NOA_DESCRIPTOR + 1);
3465 noa += *noa2DurationFromBcn;
3466 }
3467
3468 /*If MAX Noa exceeds 3 secs we will consider only 3 secs to
3469 * avoid arbitary values in noa duration field
3470 */
3471 noa = noa > MAX_NOA_PERIOD_IN_MICROSECS ? MAX_NOA_PERIOD_IN_MICROSECS : noa;
3472 noa = noa/1000; //Convert to ms
3473
3474 if( wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,&val) == eSIR_SUCCESS )
3475 {
3476 psessionEntry->defaultAuthFailureTimeout = val;
3477 ccmCfgSetInt(pMac,WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT ,val + noa, NULL, eANI_BOOLEAN_FALSE);
3478 }
3479 }
3480 else
3481 {
3482 psessionEntry->defaultAuthFailureTimeout = 0;
3483 }
Madan Mohan Koyyalamudi666d33a2012-11-29 11:32:59 -08003484
Jeff Johnson295189b2012-06-20 16:38:30 -07003485 // Update Beacon Interval at CFG database
3486
3487 if ( pBPR->HTCaps.present )
3488 limUpdateStaRunTimeHTCapability( pMac, &pBPR->HTCaps );
3489 if ( pBPR->HTInfo.present )
3490 limUpdateStaRunTimeHTInfo( pMac, &pBPR->HTInfo, psessionEntry);
3491 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003492 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003493
Ganesh Kondabattiniaad38d92014-11-19 17:06:00 +05303494 /* update the capability info based on recently
3495 * received beacon/probe response frame */
3496 psessionEntry->limCurrentBssCaps = limGetU16((tANI_U8 *) &pBPR->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07003497
3498 /**
3499 * Announce join success by sending
3500 * Join confirm to SME.
3501 */
3502 mlmJoinCnf.resultCode = eSIR_SME_SUCCESS;
3503 mlmJoinCnf.protStatusCode = eSIR_MAC_SUCCESS_STATUS;
3504 /* Update PE sessionId*/
3505 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3506 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
3507 } // if ((pMac->lim.gLimSystemRole == IBSS....
Abhishek Singh74037df2017-07-20 11:08:56 +05303508
3509 /* Update HS 2.0 Information Element */
3510 sir_copy_hs20_ie(&psessionEntry->hs20vendor_ie, &pBPR->hs20vendor_ie);
Jeff Johnson295189b2012-06-20 16:38:30 -07003511}
3512
3513/**
3514 * limExtractApCapabilities()
3515 *
3516 *FUNCTION:
3517 * This function is called to extract all of the AP's capabilities
3518 * from the IEs received from it in Beacon/Probe Response frames
3519 *
3520 *LOGIC:
3521 * This routine mimics the limExtractApCapability() API. The difference here
3522 * is that this API returns the entire tSirProbeRespBeacon info as is. It is
3523 * left to the caller of this API to use this info as required
3524 *
3525 *ASSUMPTIONS:
3526 * NA
3527 *
3528 *NOTE:
3529 *
3530 * @param pMac Pointer to Global MAC structure
3531 * @param pIE Pointer to starting IE in Beacon/Probe Response
3532 * @param ieLen Length of all IEs combined
3533 * @param beaconStruct A pointer to tSirProbeRespBeacon that needs to be
3534 * populated
3535 * @return status A status reporting eSIR_SUCCESS or eSIR_FAILURE
3536 */
3537tSirRetStatus limExtractApCapabilities( tpAniSirGlobal pMac,
3538 tANI_U8 *pIE,
3539 tANI_U16 ieLen,
3540 tpSirProbeRespBeacon beaconStruct )
3541{
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303542 vos_mem_set((tANI_U8 *) beaconStruct, sizeof( tSirProbeRespBeacon ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003543
3544 PELOG3(limLog( pMac, LOG3,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003545 FL( "In limExtractApCapabilities: The IE's being received are:" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003546 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG3, pIE, ieLen );)
3547
3548 // Parse the Beacon IE's, Don't try to parse if we dont have anything in IE
3549 if (ieLen > 0) {
3550 if( eSIR_SUCCESS != sirParseBeaconIE( pMac, beaconStruct, pIE, (tANI_U32)ieLen ))
3551 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003552 limLog( pMac, LOGE, FL("APCapExtract: Beacon parsing error!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003553 return eSIR_FAILURE;
3554 }
3555 }
3556
3557 return eSIR_SUCCESS;
3558}
3559
3560
3561/**
3562 * limDelBss()
3563 *
3564 *FUNCTION:
3565 * This function is called to delete BSS context at hardware
3566 * whenever a STA is disassociated
3567 *
3568 *LOGIC:
3569 *
3570 *ASSUMPTIONS:
3571 * NA
3572 *
3573 *NOTE:
3574 * NA
3575 *
3576 * @param pMac - Pointer to Global MAC structure
3577 * @param pStaDs - Pointer to the STA datastructure created by
3578 * LIM and maintained by DPH
3579 * @return retCode - Indicates success or failure return code
3580 */
3581
3582tSirRetStatus
3583limDelBss(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tANI_U16 bssIdx,tpPESession psessionEntry)
3584{
3585 tpDeleteBssParams pDelBssParams = NULL;
3586 tSirMsgQ msgQ;
3587 tSirRetStatus retCode = eSIR_SUCCESS;
3588
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303589 pDelBssParams = vos_mem_malloc(sizeof(tDeleteBssParams));
3590 if (NULL == pDelBssParams)
3591 {
3592 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003593 return eSIR_MEM_ALLOC_FAILED;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303594 }
3595 vos_mem_set((tANI_U8 *) pDelBssParams, sizeof(tDeleteBssParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003596
3597
3598 pDelBssParams->sessionId = psessionEntry->peSessionId; //update PE session Id
3599
3600 //DPH was storing the AssocID in staID field,
3601 //staID is actually assigned by HAL when AddSTA message is sent.
3602 if (pStaDs != NULL)
3603 {
3604 pDelBssParams->bssIdx= pStaDs->bssId;
3605 pStaDs->valid = 0;
3606 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
3607 }
3608 else
3609 pDelBssParams->bssIdx = bssIdx;
3610 psessionEntry->limMlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003611 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_BSS_RSP_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003612
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07003613 if((psessionEntry->peSessionId == pMac->lim.limTimers.gLimJoinFailureTimer.sessionId) &&
3614 (VOS_TRUE == tx_timer_running(&pMac->lim.limTimers.gLimJoinFailureTimer)))
3615 {
3616 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
3617 }
3618
Jeff Johnson295189b2012-06-20 16:38:30 -07003619 pDelBssParams->status= eHAL_STATUS_SUCCESS;
3620 pDelBssParams->respReqd = 1;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303621
3622 PELOGW(limLog( pMac, LOGW, FL("Sessionid %d : Sending HAL_DELETE_BSS_REQ "
3623 "for bss idx: %X BSSID:"MAC_ADDRESS_STR), pDelBssParams->sessionId,
3624 pDelBssParams->bssIdx,
3625 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003626
3627 //we need to defer the message until we get the response back from HAL.
3628 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
3629
3630 msgQ.type = WDA_DELETE_BSS_REQ;
3631 msgQ.reserved = 0;
3632 msgQ.bodyptr = pDelBssParams;
3633 msgQ.bodyval = 0;
3634
Jeff Johnsone7245742012-09-05 17:12:55 -07003635 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003636
3637 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
3638 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003639 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07003640 limLog( pMac, LOGE, FL("Posting DELETE_BSS_REQ to HAL failed, reason=%X"), retCode );
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303641 vos_mem_free(pDelBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003642 }
3643
3644 return retCode;
3645}
3646
3647
Jeff Johnson295189b2012-06-20 16:38:30 -07003648
3649/**
3650 * limSendAddBss()
3651 *
3652 *FUNCTION:
3653 *
3654 *LOGIC:
3655 * 1) LIM receives eWNI_SME_JOIN_REQ
3656 * 2) For a valid eWNI_SME_JOIN_REQ, LIM sends
3657 * SIR_HAL_ADD_BSS_REQ to HAL
3658 *
3659 *ASSUMPTIONS:
3660 * JOIN REQ parameters are saved in pMac->lim.gLimMlmJoinReq
3661 * ADD BSS parameters can be obtained from two sources:
3662 * 1) pMac->lim.gLimMlmJoinReq
3663 * 2) beaconStruct, passed as paramter
3664 * So, if a reqd parameter is found in bssDescriptions
3665 * then it is given preference over beaconStruct
3666 *
3667 *NOTE:
3668 *
3669 * @param pMac Pointer to Global MAC structure
3670 * pAssocRsp contains the structured assoc/reassoc Response got from AP
3671 * beaconstruct Has the ProbeRsp/Beacon structured details
3672 * bssDescription bssDescription passed to PE from the SME
3673 * @return None
3674 */
3675
3676tSirRetStatus limStaSendAddBss( tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,
3677 tpSchBeaconStruct pBeaconStruct, tpSirBssDescription bssDescription, tANI_U8 updateEntry,
3678 tpPESession psessionEntry)
3679
3680{
3681 tSirMsgQ msgQ;
3682 tpAddBssParams pAddBssParams = NULL;
3683 tANI_U32 retCode;
3684 tANI_U8 i;
3685 tpDphHashNode pStaDs = NULL;
3686 tANI_U8 chanWidthSupp = 0;
krunal soni71343fb2013-09-16 16:16:26 -07003687 tANI_U32 shortGi20MhzSupport;
3688 tANI_U32 shortGi40MhzSupport;
Jeff Johnson295189b2012-06-20 16:38:30 -07003689 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303690 pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
3691 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003692 {
3693 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303694 FL( "Unable to allocate memory during ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003695 retCode = eSIR_MEM_ALLOC_FAILED;
3696 goto returnFailure;
3697 }
3698 else
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303699 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003700
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303701 vos_mem_copy(pAddBssParams->bssId,bssDescription->bssId,
3702 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003703 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303704 vos_mem_copy(pAddBssParams->selfMacAddr,
3705 psessionEntry->selfMacAddr,
3706 sizeof(tSirMacAddr));
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303707
3708 limLog(pMac, LOG1, FL("sessionid: %d updateEntry = %d limsystemrole = %d "),
3709 psessionEntry->smeSessionId,updateEntry,psessionEntry->limSystemRole);
3710
3711 limLog(pMac, LOG1, FL("BSSID: "MAC_ADDRESS_STR),
3712 MAC_ADDR_ARRAY(pAddBssParams->bssId));
3713
Jeff Johnson295189b2012-06-20 16:38:30 -07003714 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3715 {
3716 pAddBssParams->bssType = eSIR_BTAMP_AP_MODE;
3717 }
3718 else
3719 {
3720 pAddBssParams->bssType = eSIR_INFRASTRUCTURE_MODE;
3721 }
3722
3723 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
3724
3725 /* Update PE session ID */
3726 pAddBssParams->sessionId = psessionEntry->peSessionId;
3727
3728 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
3729
3730 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
3731 pAddBssParams->updateBss = updateEntry;
3732
3733
3734 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
3735 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
3736 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
3737 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
3738
3739 pAddBssParams->rateSet.numRates = pAssocRsp->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303740 vos_mem_copy(pAddBssParams->rateSet.rate,
3741 pAssocRsp->supportedRates.rate, pAssocRsp->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07003742
3743 pAddBssParams->nwType = bssDescription->nwType;
3744
Jeff Johnsone7245742012-09-05 17:12:55 -07003745 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -07003746 pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
3747 pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
3748 pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
3749 pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
3750
Abhishek Singh525045c2014-12-15 17:18:45 +05303751 limLog(pMac, LOG1, FL(" BSS Type %d Beacon Interval: %d dtimPeriod: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303752 "cfpCount: %d"),pAddBssParams->bssType, pAddBssParams->beaconInterval,
3753 pAddBssParams->dtimPeriod, pAddBssParams->cfParamSet.cfpCount);
3754
Abhishek Singh525045c2014-12-15 17:18:45 +05303755 limLog(pMac, LOG1, FL(" cfpPeriod: %d cfpMaxDuration: %d cfpDurRemaining:"
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303756 " %d numRates: %d "),pAddBssParams->cfParamSet.cfpPeriod,
3757 pAddBssParams->cfParamSet.cfpMaxDuration,
3758 pAddBssParams->cfParamSet.cfpDurRemaining,
3759 pAddBssParams->rateSet.numRates);
3760
Abhishek Singh525045c2014-12-15 17:18:45 +05303761 limLog(pMac, LOG1, FL("nwType:%d shortSlotTimeSupported: %d"
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303762 "llaCoexist: %d llbCoexist: %d llgCoexist: %d ht20Coexist: %d"),
3763 pAddBssParams->nwType, pAddBssParams->shortSlotTimeSupported,
3764 pAddBssParams->llaCoexist, pAddBssParams->llbCoexist,
3765 pAddBssParams->llgCoexist, pAddBssParams->ht20Coexist);
Jeff Johnson295189b2012-06-20 16:38:30 -07003766
3767 // Use the advertised capabilities from the received beacon/PR
3768
3769
3770 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pAssocRsp->HTCaps.present ))
3771 {
3772 pAddBssParams->htCapable = pAssocRsp->HTCaps.present;
Abhishek Singh525045c2014-12-15 17:18:45 +05303773 limLog(pMac, LOG1, FL("htCapable: %d"),pAddBssParams->htCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07003774 if ( pBeaconStruct->HTInfo.present )
3775 {
3776 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pAssocRsp->HTInfo.opMode;
3777 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pAssocRsp->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -07003778 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003779 if( (pAssocRsp->HTCaps.supportedChannelWidthSet) &&
3780 (chanWidthSupp) )
3781 {
3782 pAddBssParams->txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
3783 pAddBssParams->currentExtChannel = pAssocRsp->HTInfo.secondaryChannelOffset;
3784 }
3785 else
3786 {
3787 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003788 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003789 }
3790 pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent;
3791 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport;
3792 pAddBssParams->fRIFSMode = pAssocRsp->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303793
Abhishek Singh525045c2014-12-15 17:18:45 +05303794 limLog(pMac, LOG1, FL("htOperMode: %d dualCTSProtection: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303795 "txChannelWidthSet: %d currentExtChannel: %d "),
3796 pAddBssParams->htOperMode, pAddBssParams->dualCTSProtection,
3797 pAddBssParams->txChannelWidthSet,pAddBssParams->currentExtChannel);
3798
Abhishek Singh525045c2014-12-15 17:18:45 +05303799 limLog(pMac, LOG1, FL("llnNonGFCoexist: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303800 "fLsigTXOPProtectionFullSupport: %d fRIFSMode %d"),
3801 pAddBssParams->llnNonGFCoexist,
3802 pAddBssParams->fLsigTXOPProtectionFullSupport,
3803 pAddBssParams->fRIFSMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003804 }
3805 }
3806
3807 pAddBssParams->currentOperChannel = bssDescription->channelId;
Abhishek Singh525045c2014-12-15 17:18:45 +05303808 limLog(pMac, LOG1, FL("currentOperChannel %d"),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303809 pAddBssParams->currentOperChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07003810#ifdef WLAN_FEATURE_11AC
3811 if (psessionEntry->vhtCapability && ( pAssocRsp->VHTCaps.present ))
3812 {
3813 pAddBssParams->vhtCapable = pAssocRsp->VHTCaps.present;
3814 pAddBssParams->vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth;
3815 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003816 pAddBssParams->currentOperChannel,
3817 pAddBssParams->currentExtChannel,
3818 psessionEntry->apCenterChan,
3819 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003820 }
3821 else
3822 {
3823 pAddBssParams->vhtCapable = 0;
3824 }
Abhishek Singh525045c2014-12-15 17:18:45 +05303825 limLog(pMac, LOG1, FL("vhtCapable %d vhtTxChannelWidthSet %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303826 "currentExtChannel %d"),pAddBssParams->vhtCapable,
3827 pAddBssParams->vhtTxChannelWidthSet,
3828 pAddBssParams->currentExtChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07003829#endif
3830
3831
Jeff Johnson295189b2012-06-20 16:38:30 -07003832 // Populate the STA-related parameters here
3833 // Note that the STA here refers to the AP
3834 {
3835 /* staType = PEER*/
3836 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
3837
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05303838 vos_mem_copy(pAddBssParams->staContext.bssId,
3839 bssDescription->bssId,
3840 sizeof( tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003841 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
3842
3843 /* Fill Assoc id from the dph table */
3844 pStaDs = dphLookupHashEntry(pMac, pAddBssParams->staContext.bssId,
3845 &pAddBssParams->staContext.assocId, &psessionEntry->dph.dphHashTable);
3846 if (pStaDs == NULL)
3847 {
Arif Hussain24bafea2013-11-15 15:10:03 -08003848 PELOGE(limLog(pMac, LOGE, FL("Couldn't get assoc id for "
3849 "MAC ADDR: " MAC_ADDRESS_STR),
3850 MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003851 }
3852 pAddBssParams->staContext.uAPSD = 0;
3853 pAddBssParams->staContext.maxSPLen = 0;
Sushant Kaushikb90b4e22015-04-14 14:29:49 +05303854 pAddBssParams->staContext.shortPreambleSupported =
3855 psessionEntry->beaconParams.fShortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -07003856 pAddBssParams->staContext.updateSta = updateEntry;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303857
Abhishek Singh525045c2014-12-15 17:18:45 +05303858 limLog(pMac, LOG1, FL("StaContext: "MAC_ADDRESS_STR
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303859 " shortPreambleSupported: %d"),
3860 MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac),
3861 pAddBssParams->staContext.shortPreambleSupported);
3862
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003863 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && pBeaconStruct->HTCaps.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003864 {
3865 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
3866 pAddBssParams->staContext.htCapable = 1;
3867 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 )pAssocRsp->HTCaps.greenField;
3868 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 )pAssocRsp->HTCaps.lsigTXOPProtection;
Abhishek Singh525045c2014-12-15 17:18:45 +05303869 limLog(pMac, LOG1,FL("StaContext htCapable: %d greenFieldCapable: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303870 "lsigTxopProtection: %d"), pAddBssParams->staContext.htCapable,
3871 pAddBssParams->staContext.greenFieldCapable,
3872 pAddBssParams->staContext.lsigTxopProtection);
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003873#ifdef WLAN_FEATURE_11AC
Kanchanapally, Vidyullatha3f3b6542015-08-21 14:38:49 +05303874 if (psessionEntry->vhtCapability &&
3875 IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps))
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003876 {
3877 pAddBssParams->staContext.vhtCapable = 1;
3878 if ((pAssocRsp->VHTCaps.suBeamFormerCap ||
3879 pAssocRsp->VHTCaps.muBeamformerCap) &&
3880 psessionEntry->txBFIniFeatureEnabled)
3881 {
3882 pAddBssParams->staContext.vhtTxBFCapable = 1;
3883 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05303884 if (pAssocRsp->VHTCaps.muBeamformerCap &&
3885 psessionEntry->txMuBformee )
3886 {
3887 pAddBssParams->staContext.vhtTxMUBformeeCapable = 1;
3888 limLog(pMac, LOG1,FL("Enabling MUBformeeCapable for peer"));
3889 /* Dont allow any other MuBf session as concurrency
3890 * is not supported
3891 */
3892 pMac->isMuBfsessionexist = TRUE;
3893 }
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003894 }
3895#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003896 if( (pAssocRsp->HTCaps.supportedChannelWidthSet) &&
3897 (chanWidthSupp) )
3898 {
3899 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
Jeff Johnsone7245742012-09-05 17:12:55 -07003900#ifdef WLAN_FEATURE_11AC
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07003901 if (pAddBssParams->staContext.vhtCapable)
Jeff Johnsone7245742012-09-05 17:12:55 -07003902 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003903 pAddBssParams->staContext.vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth; //pMac->lim.apChanWidth;
3904 }
Abhishek Singh525045c2014-12-15 17:18:45 +05303905 limLog(pMac, LOG1,FL("StaContext vhtCapable %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303906 "vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
3907 pAddBssParams->staContext.vhtCapable,
3908 pAddBssParams->staContext.vhtTxChannelWidthSet,
3909 pAddBssParams->staContext.vhtTxBFCapable);
Jeff Johnsone7245742012-09-05 17:12:55 -07003910#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003911 }
3912 else
3913 {
3914 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3915 }
3916 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pAssocRsp->HTCaps.mimoPowerSave;
3917 pAddBssParams->staContext.delBASupport = ( tANI_U8 )pAssocRsp->HTCaps.delayedBA;
3918 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 )pAssocRsp->HTCaps.maximalAMSDUsize;
3919 pAddBssParams->staContext.maxAmpduDensity = pAssocRsp->HTCaps.mpduDensity;
3920 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz;
krunal soni71343fb2013-09-16 16:16:26 -07003921 /*
3922 * We will check gShortGI20Mhz and gShortGI40Mhz from ini file.
3923 * if they are set then we will use what ever Assoc response coming
3924 * from AP supports. If these values are set as 0 in ini file then
3925 * we will hardcode this values to 0.
3926 */
3927 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
3928 (pMac, WNI_CFG_SHORT_GI_20MHZ,
3929 &shortGi20MhzSupport)))
3930 {
3931 if (VOS_TRUE == shortGi20MhzSupport)
3932 {
3933 pAddBssParams->staContext.fShortGI20Mhz =
3934 (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz;
3935 }
3936 else
3937 {
3938 pAddBssParams->staContext.fShortGI20Mhz = VOS_FALSE;
3939 }
3940 }
3941 else
3942 {
3943 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz"
3944 "CFG,setting value to default"));)
3945 pAddBssParams->staContext.fShortGI20Mhz =
3946 WNI_CFG_SHORT_GI_20MHZ_STADEF;
3947 }
3948
3949 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
3950 (pMac, WNI_CFG_SHORT_GI_40MHZ,
3951 &shortGi40MhzSupport)))
3952 {
3953 if (VOS_TRUE == shortGi40MhzSupport)
3954 {
3955 pAddBssParams->staContext.fShortGI40Mhz =
3956 (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz;
3957 }
3958 else
3959 {
3960 pAddBssParams->staContext.fShortGI40Mhz = VOS_FALSE;
3961 }
3962 }
3963 else
3964 {
3965 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz"
3966 "CFG,setting value to default"));)
3967 pAddBssParams->staContext.fShortGI40Mhz =
3968 WNI_CFG_SHORT_GI_40MHZ_STADEF;
3969 }
3970
Jeff Johnson295189b2012-06-20 16:38:30 -07003971 pAddBssParams->staContext.maxAmpduSize= pAssocRsp->HTCaps.maxRxAMPDUFactor;
Sushant Kaushik4fb4da72015-02-20 21:37:29 +05303972 if( pAddBssParams->staContext.vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP )
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08003973 {
3974 pAddBssParams->staContext.htLdpcCapable = 0;
3975 pAddBssParams->staContext.vhtLdpcCapable = 0;
3976 }
3977 else
3978 {
Abhishek Singh2fefebd2016-01-13 14:37:49 +05303979 if (psessionEntry->txLdpcIniFeatureEnabled & 0x1)
3980 pAddBssParams->staContext.htLdpcCapable =
3981 (tANI_U8)pAssocRsp->HTCaps.advCodingCap;
3982 else
3983 pAddBssParams->staContext.htLdpcCapable = 0;
3984 if (psessionEntry->txLdpcIniFeatureEnabled & 0x2)
3985 pAddBssParams->staContext.vhtLdpcCapable =
3986 (tANI_U8)pAssocRsp->VHTCaps.ldpcCodingCap;
3987 else
3988 pAddBssParams->staContext.vhtLdpcCapable = 0;
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08003989 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08003990
Jeff Johnson295189b2012-06-20 16:38:30 -07003991 if( pBeaconStruct->HTInfo.present )
3992 pAddBssParams->staContext.rifsMode = pAssocRsp->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303993
Abhishek Singh525045c2014-12-15 17:18:45 +05303994 limLog(pMac, LOG1, FL("StaContext txChannelWidthSet: %d mimoPS: %d"
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303995 " delBASupport: %d maxAmsduSize: %d"),
3996 pAddBssParams->staContext.txChannelWidthSet,
3997 pAddBssParams->staContext.mimoPS,
3998 pAddBssParams->staContext.delBASupport,
3999 pAddBssParams->staContext.maxAmsduSize);
4000
Abhishek Singh525045c2014-12-15 17:18:45 +05304001 limLog(pMac, LOG1, FL("maxAmpduDensity: %d fDsssCckMode40Mhz: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304002 "fShortGI20Mhz: %d "),pAddBssParams->staContext.maxAmpduDensity,
4003 pAddBssParams->staContext.fDsssCckMode40Mhz,
4004 pAddBssParams->staContext.fShortGI20Mhz);
4005
Abhishek Singh525045c2014-12-15 17:18:45 +05304006 limLog(pMac, LOG1, FL("fShortGI40Mh: %d maxAmpduSize: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304007 "htLdpcCapable: %d vhtLdpcCapable: %d"),
4008 pAddBssParams->staContext.fShortGI40Mhz,
4009 pAddBssParams->staContext.maxAmpduSize,
4010 pAddBssParams->staContext.htLdpcCapable,
4011 pAddBssParams->staContext.vhtLdpcCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07004012 }
4013
Pratik Bhalgatb5b19b02012-11-22 16:28:19 +05304014 //If WMM IE or 802.11E IE is not present and AP is HT AP then enable WMM
4015 if ((psessionEntry->limWmeEnabled && (pAssocRsp->wmeEdcaPresent || pAddBssParams->htCapable)) ||
4016 (psessionEntry->limQosEnabled && (pAssocRsp->edcaPresent || pAddBssParams->htCapable)))
Jeff Johnson295189b2012-06-20 16:38:30 -07004017 pAddBssParams->staContext.wmmEnabled = 1;
4018 else
4019 pAddBssParams->staContext.wmmEnabled = 0;
4020
4021 //Update the rates
4022
4023 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4024 if (pStaDs != NULL)
4025 {
4026 limFillSupportedRatesInfo(pMac, pStaDs, &pStaDs->supportedRates,psessionEntry);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304027 vos_mem_copy((tANI_U8*)&pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -07004028 (tANI_U8*)&pStaDs->supportedRates,
4029 sizeof(tSirSupportedRates));
4030 }
4031 else
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004032 PELOGE(limLog(pMac, LOGE, FL("could not Update the supported rates."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004033
4034 }
4035
4036 //Disable BA. It will be set as part of ADDBA negotiation.
4037 for( i = 0; i < STACFG_MAX_TC; i++ )
4038 {
4039 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
4040 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
4041 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
4042 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
4043 }
4044
4045 pAddBssParams->staContext.encryptType = psessionEntry->encryptType;
4046
4047#if defined WLAN_FEATURE_VOWIFI
4048 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
Abhishek Singh525045c2014-12-15 17:18:45 +05304049 limLog(pMac, LOG1,FL("maxTxPower: %d"),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304050 pAddBssParams->maxTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07004051#endif
4052 // FIXME_GEN4 - Any other value that can be used for initialization?
4053 pAddBssParams->status = eHAL_STATUS_SUCCESS;
4054 pAddBssParams->respReqd = true;
4055
4056 pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
4057
Jeff Johnson295189b2012-06-20 16:38:30 -07004058 if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona)
4059 {
4060 pAddBssParams->staContext.p2pCapableSta = 1;
4061 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004062
Bansidhar Gopalacharib099ac62013-06-12 19:02:39 -07004063 pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07004064
4065#if defined WLAN_FEATURE_VOWIFI_11R
4066 pAddBssParams->extSetStaKeyParamValid = 0;
Abhishek Singh525045c2014-12-15 17:18:45 +05304067 limLog(pMac, LOG1,FL("extSetStaKeyParamValid: %d"),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304068 pAddBssParams->extSetStaKeyParamValid);
Jeff Johnson295189b2012-06-20 16:38:30 -07004069#endif
4070
Chet Lanctot186b5732013-03-18 10:26:30 -07004071#ifdef WLAN_FEATURE_11W
4072 if (psessionEntry->limRmfEnabled)
4073 {
4074 pAddBssParams->rmfEnabled = 1;
4075 pAddBssParams->staContext.rmfEnabled = 1;
4076 }
4077#endif
4078
Jeff Johnson295189b2012-06-20 16:38:30 -07004079 // Set a new state for MLME
4080 if( eLIM_MLM_WT_ASSOC_RSP_STATE == psessionEntry->limMlmState )
4081 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE;
4082 else
4083 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE;
Abhishek Singh2fefebd2016-01-13 14:37:49 +05304084
Jeff Johnsone7245742012-09-05 17:12:55 -07004085 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004086
Abhishek Singh525045c2014-12-15 17:18:45 +05304087 limLog(pMac, LOG1, FL("staContext wmmEnabled: %d encryptType: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304088 "p2pCapableSta: %d"),pAddBssParams->staContext.wmmEnabled,
4089 pAddBssParams->staContext.encryptType,
4090 pAddBssParams->staContext.p2pCapableSta);
4091
Abhishek Singh525045c2014-12-15 17:18:45 +05304092 limLog(pMac, LOG1, FL("bSpectrumMgtEnabled: %d halPersona: %d setting "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304093 "LimMlm state to %d"), pAddBssParams->bSpectrumMgtEnabled,
4094 pAddBssParams->halPersona, psessionEntry->limMlmState);
4095
Jeff Johnson295189b2012-06-20 16:38:30 -07004096 //we need to defer the message until we get the response back from HAL.
4097 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
4098
4099 msgQ.type = WDA_ADD_BSS_REQ;
4100 /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
4101 msgQ.reserved = 0;
4102 msgQ.bodyptr = pAddBssParams;
4103 msgQ.bodyval = 0;
4104
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05304105 limLog( pMac, LOG1, FL("SessionId:%d Sending SIR_HAL_ADD_BSS_REQ" ),
4106 psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -07004107 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004108
4109 retCode = wdaPostCtrlMsg( pMac, &msgQ );
4110 if( eSIR_SUCCESS != retCode)
4111 {
Jeff Johnsone7245742012-09-05 17:12:55 -07004112 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304113 vos_mem_free(pAddBssParams);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004114 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004115 retCode );
4116 goto returnFailure;
4117
4118 }
4119 else
4120 return retCode;
4121
4122 returnFailure:
4123 // Clean-up will be done by the caller...
4124 return retCode;
4125}
4126
4127
4128
4129
4130tSirRetStatus limStaSendAddBssPreAssoc( tpAniSirGlobal pMac, tANI_U8 updateEntry, tpPESession psessionEntry)
4131{
4132 tSirMsgQ msgQ;
4133 tpAddBssParams pAddBssParams = NULL;
4134 tANI_U32 retCode;
4135 tANI_U8 i;
Jeff Johnson32d95a32012-09-10 13:15:23 -07004136 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -07004137 tANI_U8 chanWidthSupp = 0;
krunal soni71343fb2013-09-16 16:16:26 -07004138 tANI_U32 shortGi20MhzSupport;
4139 tANI_U32 shortGi40MhzSupport;
Jeff Johnson295189b2012-06-20 16:38:30 -07004140 tpSirBssDescription bssDescription = &psessionEntry->pLimJoinReq->bssDescription;
4141
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304142 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
4143 if (NULL == pBeaconStruct)
Jeff Johnson32d95a32012-09-10 13:15:23 -07004144 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304145 limLog(pMac, LOGE, FL("Unable to allocate memory during ADD_BSS") );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004146 return eSIR_MEM_ALLOC_FAILED;
4147 }
4148
Jeff Johnson295189b2012-06-20 16:38:30 -07004149
4150 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304151 pAddBssParams = vos_mem_malloc(sizeof(tAddBssParams));
4152 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07004153 {
4154 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304155 FL( "Unable to allocate memory during ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004156 retCode = eSIR_MEM_ALLOC_FAILED;
4157 goto returnFailure;
4158 }
4159
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304160 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004161
4162
4163 limExtractApCapabilities( pMac,
4164 (tANI_U8 *) bssDescription->ieFields,
Abhishek Singhbad2b322016-10-21 11:22:33 +05304165 GET_IE_LEN_IN_BSS(bssDescription->length),
Jeff Johnson32d95a32012-09-10 13:15:23 -07004166 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004167
4168 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Jeff Johnson32d95a32012-09-10 13:15:23 -07004169 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304170 vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
4171 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004172
4173 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304174 vos_mem_copy(pAddBssParams->selfMacAddr,
4175 psessionEntry->selfMacAddr,
4176 sizeof(tSirMacAddr));
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304177 limLog(pMac, LOG1, FL("sessionid: %d updateEntry = %d limsystemrole = %d "),
4178 psessionEntry->smeSessionId,updateEntry,psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07004179
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304180 limLog(pMac, LOG1, FL("BSSID: "MAC_ADDRESS_STR),
4181 MAC_ADDR_ARRAY(pAddBssParams->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07004182 /* Incorrect BSS Type which caused UMA Descriptor to be overwritten on
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304183 * top of an already established Infra link. This lead to issues in
Jeff Johnson295189b2012-06-20 16:38:30 -07004184 * concurrent data transfer.
4185 */
4186
4187 pAddBssParams->bssType = psessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
4188 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
4189
4190 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
4191
Jeff Johnson32d95a32012-09-10 13:15:23 -07004192 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07004193 pAddBssParams->updateBss = updateEntry;
4194
4195
Jeff Johnson32d95a32012-09-10 13:15:23 -07004196 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
4197 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
4198 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
4199 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -07004200
4201
Jeff Johnson32d95a32012-09-10 13:15:23 -07004202 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304203 vos_mem_copy(pAddBssParams->rateSet.rate,
4204 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07004205
4206 pAddBssParams->nwType = bssDescription->nwType;
4207
Jeff Johnson32d95a32012-09-10 13:15:23 -07004208 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -07004209 pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
4210 pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
4211 pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304212 pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist;
Jeff Johnson295189b2012-06-20 16:38:30 -07004213
Abhishek Singh525045c2014-12-15 17:18:45 +05304214 limLog(pMac, LOG1, FL(" BSS Type %d Beacon Interval: %d dtimPeriod: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304215 "cfpCount: %d"),pAddBssParams->bssType, pAddBssParams->beaconInterval,
4216 pAddBssParams->dtimPeriod, pAddBssParams->cfParamSet.cfpCount);
4217
Abhishek Singh525045c2014-12-15 17:18:45 +05304218 limLog(pMac, LOG1, FL(" cfpPeriod: %d cfpMaxDuration: %d cfpDurRemaining:"
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304219 " %d numRates: %d "),pAddBssParams->cfParamSet.cfpPeriod,
4220 pAddBssParams->cfParamSet.cfpMaxDuration,
4221 pAddBssParams->cfParamSet.cfpDurRemaining,
4222 pAddBssParams->rateSet.numRates);
4223
Abhishek Singh525045c2014-12-15 17:18:45 +05304224 limLog(pMac, LOG1, FL("nwType:%d shortSlotTimeSupported: %d"
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304225 "llaCoexist: %d llbCoexist: %d llgCoexist: %d ht20Coexist: %d"),
4226 pAddBssParams->nwType, pAddBssParams->shortSlotTimeSupported,
4227 pAddBssParams->llaCoexist, pAddBssParams->llbCoexist,
4228 pAddBssParams->llgCoexist, pAddBssParams->ht20Coexist);
Jeff Johnson295189b2012-06-20 16:38:30 -07004229 // Use the advertised capabilities from the received beacon/PR
Jeff Johnson32d95a32012-09-10 13:15:23 -07004230 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -07004231 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004232 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Abhishek Singh525045c2014-12-15 17:18:45 +05304233 limLog(pMac, LOG1, FL("htCapable: %d"),pAddBssParams->htCapable);
Jeff Johnson32d95a32012-09-10 13:15:23 -07004234 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07004235 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004236 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
4237 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -07004238
Jeff Johnson295189b2012-06-20 16:38:30 -07004239 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
Jeff Johnson32d95a32012-09-10 13:15:23 -07004240 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07004241 (chanWidthSupp) )
4242 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004243 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
4244 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07004245 }
4246 else
4247 {
4248 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004249 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07004250 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07004251 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
4252 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
4253 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304254
Abhishek Singh525045c2014-12-15 17:18:45 +05304255 limLog(pMac, LOG1, FL("htOperMode: %d dualCTSProtection: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304256 "txChannelWidthSet: %d currentExtChannel: %d "),
4257 pAddBssParams->htOperMode, pAddBssParams->dualCTSProtection,
4258 pAddBssParams->txChannelWidthSet,pAddBssParams->currentExtChannel);
4259
Abhishek Singh525045c2014-12-15 17:18:45 +05304260 limLog(pMac, LOG1, FL("llnNonGFCoexist: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304261 "fLsigTXOPProtectionFullSupport: %d fRIFSMode %d"),
4262 pAddBssParams->llnNonGFCoexist,
4263 pAddBssParams->fLsigTXOPProtectionFullSupport,
4264 pAddBssParams->fRIFSMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07004265 }
4266 }
4267
4268 pAddBssParams->currentOperChannel = bssDescription->channelId;
Abhishek Singh525045c2014-12-15 17:18:45 +05304269 limLog(pMac, LOG1, FL("currentOperChannel %d"),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304270 pAddBssParams->currentOperChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07004271#ifdef WLAN_FEATURE_11AC
Kanchanapally, Vidyullatha3f3b6542015-08-21 14:38:49 +05304272 if (psessionEntry->vhtCapability &&
4273 IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps))
Jeff Johnsone7245742012-09-05 17:12:55 -07004274 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004275 pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
4276 pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004277 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
4278 pAddBssParams->currentOperChannel,
4279 pAddBssParams->currentExtChannel,
4280 psessionEntry->apCenterChan,
4281 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07004282 }
4283 else
4284 {
4285 pAddBssParams->vhtCapable = 0;
4286 }
Abhishek Singh525045c2014-12-15 17:18:45 +05304287 limLog(pMac, LOG1, FL("vhtCapable %d vhtTxChannelWidthSet %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304288 "currentExtChannel %d"),pAddBssParams->vhtCapable,
4289 pAddBssParams->vhtTxChannelWidthSet,
4290 pAddBssParams->currentExtChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07004291#endif
4292
Jeff Johnson295189b2012-06-20 16:38:30 -07004293 // Populate the STA-related parameters here
4294 // Note that the STA here refers to the AP
4295 {
4296 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
4297
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304298 vos_mem_copy(pAddBssParams->staContext.bssId,
4299 bssDescription->bssId,
4300 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004301 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
4302
4303 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
4304 pAddBssParams->staContext.uAPSD = 0;
4305 pAddBssParams->staContext.maxSPLen = 0;
Jeff Johnson32d95a32012-09-10 13:15:23 -07004306 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -07004307 pAddBssParams->staContext.updateSta = updateEntry;
4308
Abhishek Singh525045c2014-12-15 17:18:45 +05304309 limLog(pMac, LOG1, FL("StaContext: "MAC_ADDRESS_STR
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304310 " shortPreambleSupported: %d"),
4311 MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac),
4312 pAddBssParams->staContext.shortPreambleSupported);
4313
Jeff Johnson32d95a32012-09-10 13:15:23 -07004314 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -07004315 {
4316 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
4317 pAddBssParams->staContext.htCapable = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07004318 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
4319 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
Abhishek Singh525045c2014-12-15 17:18:45 +05304320 limLog(pMac, LOG1, FL("StaContext htCapable: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304321 "greenFieldCapable: %d lsigTxopProtection: %d"),
4322 pAddBssParams->staContext.htCapable,
4323 pAddBssParams->staContext.greenFieldCapable,
4324 pAddBssParams->staContext.lsigTxopProtection);
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004325#ifdef WLAN_FEATURE_11AC
Kanchanapally, Vidyullatha3f3b6542015-08-21 14:38:49 +05304326 if (psessionEntry->vhtCapability &&
4327 IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps))
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004328 {
4329 pAddBssParams->staContext.vhtCapable = 1;
4330 if ((pBeaconStruct->VHTCaps.suBeamFormerCap ||
4331 pBeaconStruct->VHTCaps.muBeamformerCap) &&
4332 psessionEntry->txBFIniFeatureEnabled )
4333 {
4334 pAddBssParams->staContext.vhtTxBFCapable = 1;
4335 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05304336 if (pBeaconStruct->VHTCaps.muBeamformerCap &&
4337 psessionEntry->txMuBformee )
4338 {
4339 pAddBssParams->staContext.vhtTxMUBformeeCapable = 1;
4340 limLog(pMac, LOG1,FL("Enabling MUBformeeCapable for peer"));
4341 /* Dont allow any other MuBf session as concurrency
4342 * is not supported
4343 */
4344 pMac->isMuBfsessionexist = TRUE;
4345 }
4346
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004347 }
4348#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07004349 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07004350 (chanWidthSupp) )
4351 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07004352 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004353#ifdef WLAN_FEATURE_11AC
4354 if (pAddBssParams->staContext.vhtCapable)
Jeff Johnsone7245742012-09-05 17:12:55 -07004355 {
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004356 pAddBssParams->staContext.vhtTxChannelWidthSet =
4357 pBeaconStruct->VHTOperation.chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -07004358 }
Abhishek Singh525045c2014-12-15 17:18:45 +05304359 limLog(pMac, LOG1,FL("StaContext vhtCapable %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304360 "vhtTxChannelWidthSet: %d vhtTxBFCapable: %d"),
4361 pAddBssParams->staContext.vhtCapable,
4362 pAddBssParams->staContext.vhtTxChannelWidthSet,
4363 pAddBssParams->staContext.vhtTxBFCapable);
Kiran Kumar Lokereeb7f2352013-06-18 16:22:55 -07004364#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004365 }
4366 else
4367 {
4368 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4369 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07004370 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
4371 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
4372 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
4373 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
4374 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
krunal soni71343fb2013-09-16 16:16:26 -07004375 /*
4376 * We will check gShortGI20Mhz and gShortGI40Mhz from ini file.
4377 * if they are set then we will use what ever Beacon coming from AP
4378 * supports. If these values are set as 0 in ini file then
4379 * we will hardcode this values to 0.
4380 */
4381 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
4382 (pMac, WNI_CFG_SHORT_GI_20MHZ,
4383 &shortGi20MhzSupport)))
4384 {
4385 if (VOS_TRUE == shortGi20MhzSupport)
4386 {
4387 pAddBssParams->staContext.fShortGI20Mhz =
4388 (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
4389 }
4390 else
4391 {
4392 pAddBssParams->staContext.fShortGI20Mhz = VOS_FALSE;
4393 }
4394 }
4395 else
4396 {
4397 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz"
4398 "CFG,setting value to default"));)
4399 pAddBssParams->staContext.fShortGI20Mhz =
4400 WNI_CFG_SHORT_GI_20MHZ_STADEF;
4401 }
4402
4403 if (HAL_STATUS_SUCCESS(ccmCfgGetInt
4404 (pMac, WNI_CFG_SHORT_GI_40MHZ,
4405 &shortGi40MhzSupport)))
4406 {
4407 if (VOS_TRUE == shortGi40MhzSupport)
4408 {
4409 pAddBssParams->staContext.fShortGI40Mhz =
4410 (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
4411 }
4412 else
4413 {
4414 pAddBssParams->staContext.fShortGI40Mhz = VOS_FALSE;
4415 }
4416 }
4417 else
4418 {
4419 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz"
4420 "CFG,setting value to default"));)
4421 pAddBssParams->staContext.fShortGI40Mhz =
4422 WNI_CFG_SHORT_GI_40MHZ_STADEF;
4423 }
4424
Jeff Johnson32d95a32012-09-10 13:15:23 -07004425 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Sushant Kaushik4fb4da72015-02-20 21:37:29 +05304426 if( pAddBssParams->staContext.vhtTxBFCapable && pMac->lim.disableLDPCWithTxbfAP )
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08004427 {
4428 pAddBssParams->staContext.htLdpcCapable = 0;
4429 pAddBssParams->staContext.vhtLdpcCapable = 0;
4430 }
4431 else
4432 {
Abhishek Singh2fefebd2016-01-13 14:37:49 +05304433 if (psessionEntry->txLdpcIniFeatureEnabled & 0x1)
4434 pAddBssParams->staContext.htLdpcCapable =
4435 (tANI_U8)pBeaconStruct->HTCaps.advCodingCap;
4436 else
4437 pAddBssParams->staContext.htLdpcCapable = 0;
4438 if (psessionEntry->txLdpcIniFeatureEnabled & 0x2)
4439 pAddBssParams->staContext.vhtLdpcCapable =
4440 (tANI_U8)pBeaconStruct->VHTCaps.ldpcCodingCap;
4441 else
4442 pAddBssParams->staContext.vhtLdpcCapable = 0;
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -08004443 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004444
Jeff Johnson32d95a32012-09-10 13:15:23 -07004445 if( pBeaconStruct->HTInfo.present )
4446 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Abhishek Singh525045c2014-12-15 17:18:45 +05304447 limLog(pMac, LOG1, FL("StaContext txChannelWidthSet: %d mimoPS: %d"
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304448 " delBASupport: %d maxAmsduSize: %d"),
4449 pAddBssParams->staContext.txChannelWidthSet,
4450 pAddBssParams->staContext.mimoPS,
4451 pAddBssParams->staContext.delBASupport,
4452 pAddBssParams->staContext.maxAmsduSize);
4453
Abhishek Singh525045c2014-12-15 17:18:45 +05304454 limLog(pMac, LOG1, FL("maxAmpduDensity: %d fDsssCckMode40Mhz: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304455 "fShortGI20Mhz: %d "),pAddBssParams->staContext.maxAmpduDensity,
4456 pAddBssParams->staContext.fDsssCckMode40Mhz,
4457 pAddBssParams->staContext.fShortGI20Mhz);
4458
Abhishek Singh525045c2014-12-15 17:18:45 +05304459 limLog(pMac, LOG1, FL("fShortGI40Mh: %d maxAmpduSize: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304460 "htLdpcCapable: %d vhtLdpcCapable: %d"),
4461 pAddBssParams->staContext.fShortGI40Mhz,
4462 pAddBssParams->staContext.maxAmpduSize,
4463 pAddBssParams->staContext.htLdpcCapable,
4464 pAddBssParams->staContext.vhtLdpcCapable);
Jeff Johnson295189b2012-06-20 16:38:30 -07004465 }
4466
Pratik Bhalgatb5b19b02012-11-22 16:28:19 +05304467 //If WMM IE or 802.11E IE is not present and AP is HT AP then enable WMM
4468 if ((psessionEntry->limWmeEnabled && (pBeaconStruct->wmeEdcaPresent || pAddBssParams->staContext.htCapable)) ||
4469 (psessionEntry->limQosEnabled && (pBeaconStruct->edcaPresent || pAddBssParams->staContext.htCapable)))
Jeff Johnson295189b2012-06-20 16:38:30 -07004470 pAddBssParams->staContext.wmmEnabled = 1;
4471 else
4472 pAddBssParams->staContext.wmmEnabled = 0;
4473
4474 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -07004475#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07004476 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson32d95a32012-09-10 13:15:23 -07004477 pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry,
4478 &pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -07004479#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07004480 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson32d95a32012-09-10 13:15:23 -07004481 pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07004482#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004483 limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,psessionEntry);
4484
4485 }
4486
4487
4488 //Disable BA. It will be set as part of ADDBA negotiation.
4489 for( i = 0; i < STACFG_MAX_TC; i++ )
4490 {
4491 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
4492 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
4493 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
4494 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
4495 }
4496
4497 pAddBssParams->staContext.encryptType = psessionEntry->encryptType;
4498
4499#if defined WLAN_FEATURE_VOWIFI
4500 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
Abhishek Singh525045c2014-12-15 17:18:45 +05304501 limLog(pMac, LOG1,FL("maxTxPower: %d"),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304502 pAddBssParams->maxTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07004503#endif
4504
4505 pAddBssParams->status = eHAL_STATUS_SUCCESS;
4506 pAddBssParams->respReqd = true;
4507
4508 pAddBssParams->staContext.sessionId = psessionEntry->peSessionId;
4509 pAddBssParams->sessionId = psessionEntry->peSessionId;
4510
4511 pAddBssParams->halPersona = (tANI_U8)psessionEntry->pePersona; //update persona
4512
Bansidhar Gopalacharib099ac62013-06-12 19:02:39 -07004513 pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07004514
4515#if defined WLAN_FEATURE_VOWIFI_11R
4516 pAddBssParams->extSetStaKeyParamValid = 0;
Abhishek Singh525045c2014-12-15 17:18:45 +05304517 limLog(pMac, LOG1,FL("extSetStaKeyParamValid: %d"),
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304518 pAddBssParams->extSetStaKeyParamValid);
Jeff Johnson295189b2012-06-20 16:38:30 -07004519#endif
4520
Chet Lanctot186b5732013-03-18 10:26:30 -07004521#ifdef WLAN_FEATURE_11W
4522 if (psessionEntry->limRmfEnabled)
4523 {
4524 pAddBssParams->rmfEnabled = 1;
4525 pAddBssParams->staContext.rmfEnabled = 1;
4526 }
4527#endif
4528
Jeff Johnson295189b2012-06-20 16:38:30 -07004529 // Set a new state for MLME
4530
4531 //pMac->lim.gLimMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
4532 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
4533
Jeff Johnsone7245742012-09-05 17:12:55 -07004534 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004535
Abhishek Singh525045c2014-12-15 17:18:45 +05304536 limLog(pMac, LOG1, FL("staContext wmmEnabled: %d encryptType: %d "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304537 "p2pCapableSta: %d"),pAddBssParams->staContext.wmmEnabled,
4538 pAddBssParams->staContext.encryptType,
4539 pAddBssParams->staContext.p2pCapableSta);
4540
Abhishek Singh525045c2014-12-15 17:18:45 +05304541 limLog(pMac, LOG1, FL("bSpectrumMgtEnabled: %d halPersona: %d setting "
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304542 "LimMlm state to %d"), pAddBssParams->bSpectrumMgtEnabled,
4543 pAddBssParams->halPersona, psessionEntry->limMlmState);
4544
Jeff Johnson295189b2012-06-20 16:38:30 -07004545 //we need to defer the message until we get the response back from HAL.
4546 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
4547
4548 msgQ.type = WDA_ADD_BSS_REQ;
4549 /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/
4550 msgQ.reserved = 0;
4551 msgQ.bodyptr = pAddBssParams;
4552 msgQ.bodyval = 0;
4553
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05304554 limLog( pMac, LOG1, FL( "SessionId:%d Sending SIR_HAL_ADD_BSS_REQ" ),
4555 psessionEntry->peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -07004556 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004557
4558 retCode = wdaPostCtrlMsg( pMac, &msgQ );
4559 if( eSIR_SUCCESS != retCode)
4560 {
Jeff Johnsone7245742012-09-05 17:12:55 -07004561 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304562 vos_mem_free(pAddBssParams);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004563 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004564 retCode );
4565 goto returnFailure;
4566
4567 }
4568 else
Jeff Johnson32d95a32012-09-10 13:15:23 -07004569 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304570 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004571 return retCode;
Jeff Johnson32d95a32012-09-10 13:15:23 -07004572 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004573
4574 returnFailure:
4575 // Clean-up will be done by the caller...
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304576 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004577 return retCode;
4578}
4579
4580
4581
4582
4583
Jeff Johnson295189b2012-06-20 16:38:30 -07004584
4585/** -------------------------------------------------------------
4586\fn limPrepareAndSendDelStaCnf
4587\brief deletes DPH entry
4588 changes the MLM mode for station.
4589 calls limSendDelStaCnf
4590\param tpAniSirGlobal pMac
4591\param tpDphHashNode pStaDs
4592\return none
4593 -------------------------------------------------------------*/
4594
4595
4596void
4597limPrepareAndSendDelStaCnf(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tSirResultCodes statusCode,tpPESession psessionEntry)
4598{
4599 tANI_U16 staDsAssocId = 0;
4600 tSirMacAddr staDsAddr;
4601 tLimMlmStaContext mlmStaContext;
4602
4603 if(pStaDs == NULL)
4604 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004605 PELOGW(limLog(pMac, LOGW, FL("pStaDs is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004606 return;
4607 }
4608 staDsAssocId = pStaDs->assocId;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304609 vos_mem_copy((tANI_U8 *)staDsAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07004610 pStaDs->staAddr,
4611 sizeof(tSirMacAddr));
4612
4613 mlmStaContext = pStaDs->mlmStaContext;
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304614 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
4615 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004616 {
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304617 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004618 }
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304619 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4620
4621 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4622 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004623 {
4624 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Madan Mohan Koyyalamudie3830c42013-08-08 20:38:47 +05304625 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE,
4626 psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004627 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004628 limSendDelStaCnf(pMac, staDsAddr, staDsAssocId, mlmStaContext, statusCode,psessionEntry);
4629}
4630
4631/** -------------------------------------------------------------
4632\fn limGetStaRateMode
4633\brief Gets the Station Rate Mode.
4634\param tANI_U8 dot11Mode
4635\return none
4636 -------------------------------------------------------------*/
4637tStaRateMode limGetStaRateMode(tANI_U8 dot11Mode)
4638{
4639 switch(dot11Mode)
4640 {
4641 case WNI_CFG_DOT11_MODE_11A:
4642 return eSTA_11a;
4643 case WNI_CFG_DOT11_MODE_11B:
4644 return eSTA_11b;
4645 case WNI_CFG_DOT11_MODE_11G:
4646 return eSTA_11bg;
4647 case WNI_CFG_DOT11_MODE_11N:
4648 return eSTA_11n;
Jeff Johnsone7245742012-09-05 17:12:55 -07004649#ifdef WLAN_FEATURE_11AC
4650 case WNI_CFG_DOT11_MODE_11AC:
4651 return eSTA_11ac;
4652#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004653 case WNI_CFG_DOT11_MODE_ALL:
4654 default:
4655 return eSTA_11n;
4656
4657 }
4658}
4659
4660/** -------------------------------------------------------------
4661\fn limInitPreAuthTimerTable
4662\brief Initialize the Pre Auth Tanle and creates the timer for
4663 each node for the timeout value got from cfg.
4664\param tpAniSirGlobal pMac
4665\param tpLimPreAuthTable pPreAuthTimerTable
4666\return none
4667 -------------------------------------------------------------*/
4668void limInitPreAuthTimerTable(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable)
4669{
4670 tANI_U32 cfgValue;
4671 tANI_U32 authNodeIdx;
4672 tpLimPreAuthNode pAuthNode = pPreAuthTimerTable->pTable;
4673
4674 // Get AUTH_RSP Timers value
4675
4676 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT,
4677 &cfgValue) != eSIR_SUCCESS)
4678 {
4679 /*
4680 ** Could not get AUTH_RSP timeout value
4681 ** from CFG. Log error.
4682 **/
4683 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004684 FL("could not retrieve AUTH_RSP timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004685 return;
4686 }
4687
4688 cfgValue = SYS_MS_TO_TICKS(cfgValue);
4689 for(authNodeIdx=0; authNodeIdx<pPreAuthTimerTable->numEntry; authNodeIdx++, pAuthNode++)
4690 {
4691 if (tx_timer_create(&pAuthNode->timer,
4692 "AUTH RESPONSE TIMEOUT",
4693 limAuthResponseTimerHandler,
4694 authNodeIdx,
4695 cfgValue,
4696 0,
4697 TX_NO_ACTIVATE) != TX_SUCCESS)
4698 {
4699 // Cannot create timer. Log error.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004700 limLog(pMac, LOGP, FL("Cannot create Auth Rsp timer of Index :%d."), authNodeIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07004701 return;
4702 }
4703 pAuthNode->authNodeIdx = (tANI_U8)authNodeIdx;
4704 pAuthNode->fFree = 1;
4705 }
4706
4707}
4708
4709/** -------------------------------------------------------------
4710\fn limAcquireFreePreAuthNode
4711\brief Retrives a free Pre Auth node from Pre Auth Table.
4712\param tpAniSirGlobal pMac
4713\param tpLimPreAuthTable pPreAuthTimerTable
4714\return none
4715 -------------------------------------------------------------*/
4716tLimPreAuthNode * limAcquireFreePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthTable pPreAuthTimerTable)
4717{
4718 tANI_U32 i;
4719 tLimPreAuthNode *pTempNode = pPreAuthTimerTable->pTable;
4720 for (i=0; i<pPreAuthTimerTable->numEntry; i++,pTempNode++)
4721 {
4722 if (pTempNode->fFree == 1)
4723 {
4724 pTempNode->fFree = 0;
4725 return pTempNode;
4726 }
4727 }
4728
4729 return NULL;
4730}
4731
4732/** -------------------------------------------------------------
4733\fn limGetPreAuthNodeFromIndex
4734\brief Depending on the Index this retrives the pre auth node.
4735\param tpAniSirGlobal pMac
4736\param tpLimPreAuthTable pAuthTable
4737\param tANI_U32 authNodeIdx
4738\return none
4739 -------------------------------------------------------------*/
4740tLimPreAuthNode * limGetPreAuthNodeFromIndex(tpAniSirGlobal pMac,
4741 tpLimPreAuthTable pAuthTable, tANI_U32 authNodeIdx)
4742{
4743 if ((authNodeIdx >= pAuthTable->numEntry) || (pAuthTable->pTable == NULL))
4744 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004745 limLog(pMac, LOGE, FL("Invalid Auth Timer Index : %d NumEntry : %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004746 authNodeIdx, pAuthTable->numEntry);
4747 return NULL;
4748 }
4749
4750 return pAuthTable->pTable + authNodeIdx;
4751}
4752
4753/* Util API to check if the channels supported by STA is within range */
4754tSirRetStatus limIsDot11hSupportedChannelsValid(tpAniSirGlobal pMac, tSirAssocReq *assoc)
4755{
4756 /*
4757 * Allow all the stations to join with us.
4758 * 802.11h-2003 11.6.1 => An AP may use the supported channels list for associated STAs
4759 * as an input into an algorithm used to select a new channel for the BSS.
4760 * The specification of the algorithm is beyond the scope of this amendment.
4761 */
4762
4763 return (eSIR_SUCCESS);
4764}
4765
4766/* Util API to check if the txpower supported by STA is within range */
4767tSirRetStatus limIsDot11hPowerCapabilitiesInRange(tpAniSirGlobal pMac, tSirAssocReq *assoc,tpPESession psessionEntry)
4768{
4769 tPowerdBm localMaxTxPower;
4770 tANI_U32 localPwrConstraint;
4771
4772 localMaxTxPower = cfgGetRegulatoryMaxTransmitPower(pMac, psessionEntry->currentOperChannel);
4773
4774 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004775 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004776 return eSIR_FAILURE;
4777 }
4778 localMaxTxPower -= (tPowerdBm)localPwrConstraint;
4779
4780 /**
4781 * The min Tx Power of the associating station should not be greater than (regulatory
4782 * max tx power - local power constraint configured on AP).
4783 */
4784 if(assoc->powerCapability.minTxPower > localMaxTxPower)
4785 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07004786 limLog(pMac, LOGW, FL("minTxPower (STA) = %d, localMaxTxPower (AP) = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004787 assoc->powerCapability.minTxPower, localMaxTxPower);
4788 return (eSIR_FAILURE);
4789 }
4790
4791 return (eSIR_SUCCESS);
4792}
4793
4794/** -------------------------------------------------------------
4795\fn limFillRxHighestSupportedRate
4796\brief Fills in the Rx Highest Supported Data Rate field from
4797\ the 'supported MCS set' field in HT capability element.
4798\param tpAniSirGlobal pMac
4799\param tpSirSupportedRates pRates
4800\param tANI_U8* pSupportedMCSSet
4801\return none
4802 -------------------------------------------------------------*/
4803void limFillRxHighestSupportedRate(tpAniSirGlobal pMac, tANI_U16 *rxHighestRate, tANI_U8* pSupportedMCSSet)
4804{
4805 tSirMacRxHighestSupportRate *pRxHighestRate;
4806 tANI_U8 *pBuf;
4807 tANI_U16 rate=0;
4808
4809 pBuf = pSupportedMCSSet + MCS_RX_HIGHEST_SUPPORTED_RATE_BYTE_OFFSET;
4810 rate = limGetU16(pBuf);
4811
4812 pRxHighestRate = (tSirMacRxHighestSupportRate *) &rate;
4813 *rxHighestRate = pRxHighestRate->rate;
4814
4815 return;
4816}
Chet Lanctot186b5732013-03-18 10:26:30 -07004817
4818#ifdef WLAN_FEATURE_11W
4819/** -------------------------------------------------------------
4820\fn limSendSmeUnprotectedMgmtFrameInd
4821\brief Forwards the unprotected management frame to SME.
4822\param tpAniSirGlobal pMac
4823\param frameType - 802.11 frame type
4824\param frame - frame buffer
4825\param sessionId - id for the current session
4826\param psessionEntry - PE session context
4827\return none
4828 -------------------------------------------------------------*/
4829void limSendSmeUnprotectedMgmtFrameInd(
4830 tpAniSirGlobal pMac, tANI_U8 frameType,
4831 tANI_U8 *frame, tANI_U32 frameLen, tANI_U16 sessionId,
4832 tpPESession psessionEntry)
4833{
4834 tSirMsgQ mmhMsg;
4835 tSirSmeUnprotMgmtFrameInd * pSirSmeMgmtFrame = NULL;
4836 tANI_U16 length;
4837
4838 length = sizeof(tSirSmeUnprotMgmtFrameInd) + frameLen;
4839
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304840 pSirSmeMgmtFrame = vos_mem_malloc(length);
4841 if (NULL == pSirSmeMgmtFrame)
Chet Lanctot186b5732013-03-18 10:26:30 -07004842 {
4843 limLog(pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304844 FL("AllocateMemory failed for tSirSmeUnprotectedMgmtFrameInd"));
Chet Lanctot186b5732013-03-18 10:26:30 -07004845 return;
4846 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05304847 vos_mem_set((void*)pSirSmeMgmtFrame, length, 0);
Chet Lanctot186b5732013-03-18 10:26:30 -07004848
4849 pSirSmeMgmtFrame->sessionId = sessionId;
4850 pSirSmeMgmtFrame->frameType = frameType;
4851
4852 vos_mem_copy(pSirSmeMgmtFrame->frameBuf, frame, frameLen);
4853 pSirSmeMgmtFrame->frameLen = frameLen;
4854
4855 mmhMsg.type = eWNI_SME_UNPROT_MGMT_FRM_IND;
4856 mmhMsg.bodyptr = pSirSmeMgmtFrame;
4857 mmhMsg.bodyval = 0;
4858
4859 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
4860 return;
4861}
4862#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004863
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004864#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004865/** -------------------------------------------------------------
4866\fn limSendSmeTsmIEInd
4867\brief Forwards the TSM IE information to SME.
4868\param tpAniSirGlobal pMac
4869\param psessionEntry - PE session context
4870\param tid - traffic id
4871\param state - tsm state (enabled/disabled)
4872\param measurementInterval - measurement interval
4873\return none
4874 -------------------------------------------------------------*/
4875void limSendSmeTsmIEInd(tpAniSirGlobal pMac, tpPESession psessionEntry,
4876 tANI_U8 tid, tANI_U8 state, tANI_U16 measInterval)
4877{
4878 tSirMsgQ mmhMsg;
4879 tpSirSmeTsmIEInd pSirSmeTsmIeInd = NULL;
4880
4881 if (!pMac || !psessionEntry)
4882 {
4883 return;
4884 }
4885 pSirSmeTsmIeInd = vos_mem_malloc(sizeof(tSirSmeTsmIEInd));
4886 if (NULL == pSirSmeTsmIeInd)
4887 {
4888 limLog(pMac, LOGP,
4889 FL("AllocateMemory failed for tSirSmeTsmIEInd"));
4890 return;
4891 }
4892 vos_mem_set((void*)pSirSmeTsmIeInd, sizeof(tSirSmeTsmIEInd), 0);
4893
4894 pSirSmeTsmIeInd->sessionId = psessionEntry->smeSessionId;
4895 pSirSmeTsmIeInd->tsmIe.tsid = tid;
4896 pSirSmeTsmIeInd->tsmIe.state= state;
4897 pSirSmeTsmIeInd->tsmIe.msmt_interval= measInterval;
4898
4899 mmhMsg.type = eWNI_SME_TSM_IE_IND;
4900 mmhMsg.bodyptr = pSirSmeTsmIeInd;
4901 mmhMsg.bodyval = 0;
4902
4903 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
4904 return;
4905}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004906#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004907
4908