blob: c7cfeb3b69f8ab762a1db3475e57cd8c9cd7f59a [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42#ifdef WLAN_FEATURE_VOWIFI_11R
43/**=========================================================================
44
45 \brief implementation for PE 11r VoWiFi FT Protocol
46
47 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
48
49 Qualcomm Confidential and Proprietary.
50
51 ========================================================================*/
52
53/* $Header$ */
54
55
56/*--------------------------------------------------------------------------
57 Include Files
58 ------------------------------------------------------------------------*/
59#include <limSendMessages.h>
60#include <limTypes.h>
61#include <limFT.h>
62#include <limFTDefs.h>
63#include <limUtils.h>
64#include <limPropExtsUtils.h>
65#include <limAssocUtils.h>
66#include <limSession.h>
67#include <limAdmitControl.h>
68#include "wmmApsd.h"
69
70#define LIM_FT_RIC_BA_SSN 1
71#define LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 248
72#define LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA 1
73
74/*--------------------------------------------------------------------------
75 Initialize the FT variables.
76 ------------------------------------------------------------------------*/
77void limFTOpen(tpAniSirGlobal pMac)
78{
79 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
80 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
81}
82
83/*--------------------------------------------------------------------------
84 Cleanup FT variables.
85 ------------------------------------------------------------------------*/
86void limFTCleanup(tpAniSirGlobal pMac)
87{
88 if (pMac->ft.ftPEContext.pFTPreAuthReq)
89 {
90#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
91 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070092 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -070093#endif
94 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
95 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
96 }
97
98 // This is the old session, should be deleted else where.
99 // We should not be cleaning it here, just set it to NULL.
100 if (pMac->ft.ftPEContext.psavedsessionEntry)
101 {
102#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
103 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700104 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700105#endif
106 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
107 }
108
109 // This is the extra session we added as part of Auth resp
110 // clean it up.
111 if (pMac->ft.ftPEContext.pftSessionEntry)
112 {
113 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
114 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState == eLIM_SME_WT_REASSOC_STATE))
115 {
116 PELOGE(limLog( pMac, LOGE, "%s: Deleting Preauth Session %d\n", __func__, ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);)
117 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
118 }
119 pMac->ft.ftPEContext.pftSessionEntry = NULL;
120#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
121 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700122 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700123#endif
124 }
125
126 if (pMac->ft.ftPEContext.pAddBssReq)
127 {
128 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
129 pMac->ft.ftPEContext.pAddBssReq = NULL;
130 }
131
132 if (pMac->ft.ftPEContext.pAddStaReq)
133 {
134 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
135 pMac->ft.ftPEContext.pAddStaReq = NULL;
136 }
137
138 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
139
140}
141
142/*--------------------------------------------------------------------------
143 Init FT variables.
144 ------------------------------------------------------------------------*/
145void limFTInit(tpAniSirGlobal pMac)
146{
147 if (pMac->ft.ftPEContext.pFTPreAuthReq)
148 {
149#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
150 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700151 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700152#endif
153 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
154 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
155 }
156
157 // This is the old session, should be deleted else where.
158 // We should not be cleaning it here, just set it to NULL.
159 if (pMac->ft.ftPEContext.psavedsessionEntry)
160 {
161#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
162 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700163 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700164#endif
165 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
166 }
167
168 // This is the extra session we added as part of Auth resp
169 // clean it up.
170 if (pMac->ft.ftPEContext.pftSessionEntry)
171 {
172 /* Cannot delete sessions across associations */
173#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
174 PELOGE(limLog( pMac, LOGE, "%s: Deleting session = %p \n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700175 __func__, pMac->ft.ftPEContext.pftSessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700176#endif
177 pMac->ft.ftPEContext.pftSessionEntry = NULL;
178 }
179
180 if (pMac->ft.ftPEContext.pAddBssReq)
181 {
182#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
183 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddBssReq = %p \n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700184 __func__, pMac->ft.ftPEContext.pAddBssReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700185#endif
186 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
187 pMac->ft.ftPEContext.pAddBssReq = NULL;
188 }
189
190
191 if (pMac->ft.ftPEContext.pAddStaReq)
192 {
193#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
194 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddStaReq = %p \n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700195 __func__, pMac->ft.ftPEContext.pAddStaReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700196#endif
197 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
198 pMac->ft.ftPEContext.pAddStaReq = NULL;
199 }
200
201 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
202
203}
204
205/*------------------------------------------------------------------
206 *
207 * This is the handler after suspending the link.
208 * We suspend the link and then now proceed to switch channel.
209 *
210 *------------------------------------------------------------------*/
211void FTPreAuthSuspendLinkHandler(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
212{
213 tpPESession psessionEntry;
214
215 // The link is suspended of not ?
216 if (status != eHAL_STATUS_SUCCESS)
217 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700218 PELOGE(limLog( pMac, LOGE, "%s: Returning \n", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700219 // Post the FT Pre Auth Response to SME
220 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, (tpPESession)data);
221
222 return;
223 }
224
225 psessionEntry = (tpPESession)data;
226 // Suspended, now move to a different channel.
227 // Perform some sanity check before proceeding.
228 if ((pMac->ft.ftPEContext.pFTPreAuthReq) && psessionEntry)
229 {
230 limChangeChannelWithCallback(pMac,
231 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum,
232 limPerformFTPreAuth, NULL, psessionEntry);
233 return;
234 }
235
236 // Else return error.
237 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
238}
239
240
241/*--------------------------------------------------------------------------
242 In this function, we process the FT Pre Auth Req.
243 We receive Pre-Auth
244 Suspend link
245 Register a call back
246 In the call back, we will need to accept frames from the new bssid
247 Send out the auth req to new AP.
248 Start timer and when the timer is done or if we receive the Auth response
249 We change channel
250 Resume link
251 ------------------------------------------------------------------------*/
252int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
253{
254 int bufConsumed = FALSE;
255 tpPESession psessionEntry;
256 tANI_U8 sessionId;
257
258 // Now we are starting fresh make sure all's cleanup.
259 limFTInit(pMac);
260 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE; // Can set it only after sending auth
261
262 // We need information from the Pre-Auth Req. Lets save that
263 pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
264
265#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700266 PELOGE(limLog( pMac, LOGE, "%s: PE Auth ft_ies_length=%02x%02x%02x\n", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700267 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
268 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
269 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
270#endif
271
272 // Get the current session entry
273 psessionEntry = peFindSessionByBssid(pMac,
274 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
275 if (psessionEntry == NULL)
276 {
277 PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700278 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
280 // Post the FT Pre Auth Response to SME
Gopichand Nakkala2d335f32013-01-04 12:24:28 -0800281 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
282 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 return TRUE;
284 }
285
286 // Dont need to suspend if APs are in same channel
287 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
288 {
289 // Need to suspend link only if the channels are different
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700290 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on different"
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700291 " channel (session %p)\n", __func__, psessionEntry);)
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700292 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 (tANI_U32 *)psessionEntry);
294 }
295 else
296 {
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700297 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on same"
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700298 " channel (session %p)\n", __func__, psessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 // We are in the same channel. Perform pre-auth
300 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
301 }
302
303 return bufConsumed;
304}
305
306/*------------------------------------------------------------------
307 * Send the Auth1
308 * Receive back Auth2
309 *------------------------------------------------------------------*/
310void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
311 tpPESession psessionEntry)
312{
313 tSirMacAuthFrameBody authFrame;
314
315 if (psessionEntry->is11Rconnection)
316 {
317 // Only 11r assoc has FT IEs.
318 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
319 {
320 PELOGE(limLog( pMac, LOGE, "%s: FTIEs for Auth Req Seq 1 is absent\n");)
321 return;
322 }
323 }
324 if (status != eHAL_STATUS_SUCCESS)
325 {
326 PELOGE(limLog( pMac, LOGE, "%s: Change channel not successful for FT pre-auth\n");)
327 return;
328 }
329 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
330
331#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700332 PELOG2(limLog(pMac,LOG2,"Entered wait auth2 state for FT"
333 " (old session %p)\n",
334 pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700335#endif
336
337
338 if (psessionEntry->is11Rconnection)
339 {
340 // Now we are on the right channel and need to send out Auth1 and
341 // receive Auth2.
342 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
343 }
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700344#if defined FEATURE_WLAN_CCX || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700345 else
346 {
347 // Will need to make isCCXconnection a enum may be for further
348 // improvements to this to match this algorithm number
349 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its CCX and 11r FT.
350 }
351#endif
352 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
353 authFrame.authStatusCode = 0;
354
355 // Start timer here to come back to operating channel.
356 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
357 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
358 {
359#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700360 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed\n", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700361#endif
362 }
363
364#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700365 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Started\n", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700366#endif
367
368 limSendAuthMgmtFrame(pMac, &authFrame,
369 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
370 LIM_NO_WEP_IN_FC, psessionEntry);
371
372 return;
373}
374
375
376/*------------------------------------------------------------------
377 *
378 * Create the new Add Bss Req to the new AP.
379 * This will be used when we are ready to FT to the new AP.
380 * The newly created ft Session entry is passed to this function
381 *
382 *------------------------------------------------------------------*/
383tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
384 tANI_U8 updateEntry, tpPESession pftSessionEntry,
385 tpSirBssDescription bssDescription )
386{
387 tpAddBssParams pAddBssParams = NULL;
388 tANI_U8 i;
389 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700390 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700391
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700392 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
393 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
394 {
395 limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating ADD_BSS\n") );
396 return eSIR_MEM_ALLOC_FAILED;
397 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700398
399 // Package SIR_HAL_ADD_BSS_REQ message parameters
400 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
401 (void **) &pAddBssParams, sizeof( tAddBssParams )))
402 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700403 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 limLog( pMac, LOGP,
405 FL( "Unable to PAL allocate memory for creating ADD_BSS\n" ));
406 return (eSIR_MEM_ALLOC_FAILED);
407 }
408
409 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
410
411
412 limExtractApCapabilities( pMac,
413 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700414 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700415
416 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700417 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700418
419 palCopyMemory( pMac->hHdd, pAddBssParams->bssId, bssDescription->bssId,
420 sizeof( tSirMacAddr ));
421
422 // Fill in tAddBssParams selfMacAddr
423 palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
424 sizeof( tSirMacAddr ));
425
426 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
427 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
428
429 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
430
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700431 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700432 pAddBssParams->updateBss = updateEntry;
433
434
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700435 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
436 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
437 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
438 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700439
440
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700441 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700442 palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700443 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700444
445 pAddBssParams->nwType = bssDescription->nwType;
446
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700447 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
449 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
450 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
451 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
452
453 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700454 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700455 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700456 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700457
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700458 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700459 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700460 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
461 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700462
463#ifdef WLAN_SOFTAP_FEATURE
464 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
465#else
466 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET);
467#endif
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700468 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 (chanWidthSupp) )
470 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700471 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
472 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 }
474 else
475 {
476 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700477 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700478 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700479 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
480 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
481 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700482 }
483 }
484
485 pAddBssParams->currentOperChannel = bssDescription->channelId;
486
487#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
488 limLog( pMac, LOGE, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
489 pAddBssParams->currentOperChannel);
490#endif
491
492
493 // Populate the STA-related parameters here
494 // Note that the STA here refers to the AP
495 {
496 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
497
498 palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId,
499 bssDescription->bssId,
500 sizeof( tSirMacAddr ));
501 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
502
503 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
504 pAddBssParams->staContext.uAPSD = 0;
505 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700506 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 pAddBssParams->staContext.updateSta = updateEntry;
508 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
509
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700510 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 {
512 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
513 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700514 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
515 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
516 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 (chanWidthSupp) )
518 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700519 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700520 }
521 else
522 {
523 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
524 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700525 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
526 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
527 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
528 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
529 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
530 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
531 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
532 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700533
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700534 if( pBeaconStruct->HTInfo.present )
535 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 }
537
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700538 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
539 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700540 pAddBssParams->staContext.wmmEnabled = 1;
541 else
542 pAddBssParams->staContext.wmmEnabled = 0;
543
544 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700545#ifdef WLAN_FEATURE_11AC
546 limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700547 pBeaconStruct->HTCaps.supportedMCSSet,
548 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700549#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
551 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700552#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,pftSessionEntry);
554
555 }
556
557
558 //Disable BA. It will be set as part of ADDBA negotiation.
559 for( i = 0; i < STACFG_MAX_TC; i++ )
560 {
561 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
562 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
563 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
564 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
565 }
566
567#if defined WLAN_FEATURE_VOWIFI
568 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
569#endif
570
571 pAddBssParams->status = eHAL_STATUS_SUCCESS;
572 pAddBssParams->respReqd = true;
573
574 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
575 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
576
577 // Set a new state for MLME
578
579 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
580
581 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
582
583 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
584
585#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
586 limLog( pMac, LOGE, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
587#endif
588
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700589 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 return 0;
591}
592
593/*------------------------------------------------------------------
594 *
595 * Setup the new session for the pre-auth AP.
596 * Return the newly created session entry.
597 *
598 *------------------------------------------------------------------*/
599tpPESession limFillFTSession(tpAniSirGlobal pMac,
600 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
601{
602 tpPESession pftSessionEntry;
603 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 tPowerdBm localPowerConstraint;
605 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700606 tSchBeaconStruct *pBeaconStruct;
607
608 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
609 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
610 {
611 limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating limFillFTSession\n") );
612 return NULL;
613 }
614
Jeff Johnson295189b2012-06-20 16:38:30 -0700615
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800616
617 /* Retrieve the session that has already been created and update the entry */
618 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700619#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 limPrintMacAddr(pMac, pbssDescription->bssId, LOGE);
621#endif
622
Jeff Johnson295189b2012-06-20 16:38:30 -0700623 pftSessionEntry->dot11mode = psessionEntry->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700624 pftSessionEntry->htCapability = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700625
626 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
627 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
628 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
629 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
630
631 // Fields to be filled later
632 pftSessionEntry->pLimJoinReq = NULL;
633 pftSessionEntry->smeSessionId = 0;
634 pftSessionEntry->transactionId = 0;
635
636 limExtractApCapabilities( pMac,
637 (tANI_U8 *) pbssDescription->ieFields,
638 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700639 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700640
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700641 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700642 palCopyMemory( pMac->hHdd, pftSessionEntry->rateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700643 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700644
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700645 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700646 palCopyMemory(pMac->hHdd, pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700647 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700648
649
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700650 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
651 palCopyMemory( pMac->hHdd, pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700652 pftSessionEntry->ssId.length);
653
654
655 // Self Mac
656 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
657 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700658#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOGE);
660#endif
661
662 /* Store beaconInterval */
663 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
664 pftSessionEntry->bssType = psessionEntry->bssType;
665
666 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
667 pftSessionEntry->nwType = pbssDescription->nwType;
668
669 /* Copy The channel Id to the session Table */
670 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
671 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
672
673
674 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
675 {
676 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
677 }
678 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
679 {
680 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
681 }
682 else
683 {
684 /* Throw an error and return and make sure to delete the session.*/
685 limLog(pMac, LOGE, FL("Invalid bss type\n"));
686 }
687
688 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
689 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700690
691 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
692 localPowerConstraint = regMax;
693 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
694 limGetIElenFromBssDescription(pbssDescription),
695 &pftSessionEntry->limCurrentBssQosCaps,
696 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700697 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700698
699 pftSessionEntry->limReassocBssQosCaps =
700 pftSessionEntry->limCurrentBssQosCaps;
701 pftSessionEntry->limReassocBssPropCap =
702 pftSessionEntry->limCurrentBssPropCap;
703
704
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800705#ifdef FEATURE_WLAN_CCX
706 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
707#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700708 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800709#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700710
711#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800712 limLog( pMac, LOGE, "%s: Regulatory max = %d, local power constraint = %d, ini tx power = %d, max tx = %d",
713 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700714#endif
715
716 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
717
718 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
719 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
720
721 pftSessionEntry->encryptType = psessionEntry->encryptType;
722
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700723 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 return pftSessionEntry;
725}
726
727/*------------------------------------------------------------------
728 *
729 * Setup the session and the add bss req for the pre-auth AP.
730 *
731 *------------------------------------------------------------------*/
732void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
733{
734 tpPESession pftSessionEntry;
735
736 // Prepare the session right now with as much as possible.
737 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
738
739 if (pftSessionEntry)
740 {
741 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
742#ifdef FEATURE_WLAN_CCX
743 pftSessionEntry->isCCXconnection = psessionEntry->isCCXconnection;
744#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700745#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
747#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700748
749#ifdef FEATURE_WLAN_LFR
750 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
751#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700752 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
753 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
754 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
755 }
756}
757
758/*------------------------------------------------------------------
759 * Resume Link Call Back
760 *------------------------------------------------------------------*/
761void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
762{
763 tpPESession psessionEntry;
764
765 psessionEntry = (tpPESession)data;
766
767 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
768 {
769 limFTSetupAuthSession(pMac, psessionEntry);
770 }
771
772 // Post the FT Pre Auth Response to SME
773 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
774 pMac->ft.ftPEContext.saved_auth_rsp,
775 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
776
777}
778
779/*------------------------------------------------------------------
780 * Resume Link Call Back
781 *------------------------------------------------------------------*/
782void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
783 tpPESession psessionEntry)
784{
785 //Set the resume channel to Any valid channel (invalid).
786 //This will instruct HAL to set it to any previous valid channel.
787 peSetResumeChannel(pMac, 0, 0);
788 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
789}
790
791tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
792 tANI_U8 *ric_ies, tANI_U32 *ieLength)
793{
794 tDot11fIERICDataDesc ricIe;
795 tDot11fFfBAStartingSequenceControl baSsnControl;
796 tDot11fFfAddBAParameterSet baParamSet;
797 tDot11fFfBATimeout baTimeout;
798
799 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
800 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
801 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
802 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
803
804 ricIe.present = 1;
805 ricIe.RICData.present = 1;
806 ricIe.RICData.resourceDescCount = 1;
807 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
808 ricIe.RICDescriptor.present = 1;
809 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
810 baParamSet.tid = tid;
811 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
812 baParamSet.bufferSize = pTrafficClass->txBufSize;
813 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
814 baSsnControl.fragNumber = 0;
815 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
816
817 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
818 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
819 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
820
821 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
822 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
823 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
824
825 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
826 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
827 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
828
829 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
830}
831
832tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
833{
834 tANI_U8 tid = 0;
835 tpDphHashNode pSta;
836 tANI_U16 numBA = 0, aid = 0;
837 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
838 tANI_U32 offset = 0, ieLength = 0;
839 tSirRetStatus status = eSIR_SUCCESS;
840
841 // First, extract the DPH entry
842 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
843 if( NULL == pSta )
844 {
845 PELOGE(limLog( pMac, LOGE,
846 FL( "STA context not found for saved session's BSSID %02x:%02x:%02x:%02x:%02x:%02x\n" ),
847 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[0],
848 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[1],
849 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[2],
850 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[3],
851 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[4],
852 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[5] );)
853 return eSIR_FAILURE;
854 }
855
856 for (tid = 0; tid < STACFG_MAX_TC; tid++)
857 {
858 if (pSta->tcCfg[tid].fUseBATx)
859 {
860 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
861 if (eSIR_SUCCESS == status)
862 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700863 // TODO RIC
864 if ( ieLength > MAX_FTIE_SIZE )
865 {
866 ieLength = 0;
867 return status;
868 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700869 offset += ieLength;
870 *ric_ies_length += ieLength;
871 numBA++;
872 }
873 else
874 {
875 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
876 }
877 }
878 }
879
880 PELOGE(limLog(pMac, LOGE, FL("Number of BA RIC IEs created = %d: Total length = %d\n"), numBA, *ric_ies_length);)
881 return status;
882}
883
884/*------------------------------------------------------------------
885 *
886 * Will post pre auth response to SME.
887 *
888 *------------------------------------------------------------------*/
889void limPostFTPreAuthRsp(tpAniSirGlobal pMac, eHalStatus status,
890 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
891 tpPESession psessionEntry)
892{
893 tpSirFTPreAuthRsp pFTPreAuthRsp;
894 tSirMsgQ mmhMsg;
895 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700896 // TODO: RIC Support
897 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700898
899 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
900 if(NULL == pFTPreAuthRsp)
901 {
902 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory\n");)
903 VOS_ASSERT(pFTPreAuthRsp != NULL);
904 return;
905 }
906 vos_mem_zero( pFTPreAuthRsp, rspLen);
907#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
908 PELOGE(limLog( pMac, LOGE, "%s: Auth Rsp = %p\n", pFTPreAuthRsp);)
909#endif
910
911 palZeroMemory(pMac, (tANI_U8*)pFTPreAuthRsp, rspLen);
912 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
913 pFTPreAuthRsp->length = (tANI_U16) rspLen;
914 pFTPreAuthRsp->status = status;
915 if (psessionEntry)
916 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
917
918 // The bssid of the AP we are sending Auth1 to.
919 if (pMac->ft.ftPEContext.pFTPreAuthReq)
920 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
921 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
922
923 // Attach the auth response now back to SME
924 pFTPreAuthRsp->ft_ies_length = 0;
925 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
926 {
927 // Only 11r assoc has FT IEs.
928 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
929 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
930 }
931
932#ifdef WLAN_FEATURE_VOWIFI_11R
933 if ((psessionEntry) && (psessionEntry->is11Rconnection))
934 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700935 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
936 /*
Jeff Johnson295189b2012-06-20 16:38:30 -0700937 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
938 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
939 if (eSIR_SUCCESS != sirStatus)
940 {
941 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
942 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700943 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700944 }
945#endif
946
947 mmhMsg.type = pFTPreAuthRsp->messageType;
948 mmhMsg.bodyptr = pFTPreAuthRsp;
949 mmhMsg.bodyval = 0;
950
951#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
952 PELOGE(limLog( pMac, LOGE, "Posted Auth Rsp to SME\n");)
953#endif
954 PELOGE(limLog( pMac, LOGE, "Posted Auth Rsp to SME with status of %d\n", status);)
955 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
956}
957
958/*------------------------------------------------------------------
959 *
960 * Send the FT Pre Auth Response to SME when ever we have a status
961 * ready to be sent to SME
962 *
963 * SME will be the one to send it up to the supplicant to receive
964 * FTIEs which will be required for Reassoc Req.
965 *
966 *------------------------------------------------------------------*/
967void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, eHalStatus status,
968 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
969 tpPESession psessionEntry)
970{
971
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800972 tpPESession pftSessionEntry;
973 tANI_U8 sessionId;
974 tpSirBssDescription pbssDescription;
975
Jeff Johnson295189b2012-06-20 16:38:30 -0700976 // Save the status of pre-auth
977 pMac->ft.ftPEContext.ftPreAuthStatus = status;
978
979 // Save the auth rsp, so we can send it to
980 // SME once we resume link.
981 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
982 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
983 {
984 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
985 auth_rsp, auth_rsp_length);
986 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
987 }
988
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800989 /* Create FT session for the re-association at this point */
990 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
991 {
992 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
993 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
994 &sessionId, pMac->lim.maxStation)) == NULL)
995 {
996 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP\n"));
997 return;
998 }
999 pftSessionEntry->peSessionId = sessionId;
1000 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1001 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1002 pftSessionEntry->bssType = psessionEntry->bssType;
1003
1004 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1005 {
1006 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1007 }
1008 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1009 {
1010 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1011 }
1012 else
1013 {
1014 limLog(pMac, LOGE, FL("Invalid bss type\n"));
1015 }
1016 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1017 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1018 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
1019 PELOGE(limLog(pMac,LOGE,"%s:created session (%p) with id = %d\n",
1020 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1021
1022 /* Update the ReAssoc BSSID of the current session */
1023 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
1024 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
1025 }
1026
Jeff Johnson295189b2012-06-20 16:38:30 -07001027 if (psessionEntry->currentOperChannel !=
1028 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1029 {
1030 // Need to move to the original AP channel
1031 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1032 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1033 }
1034 else
1035 {
1036#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
1037 PELOGE(limLog( pMac, LOGE, "Pre auth on same channel as connected AP channel %d\n",
1038 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1039#endif
1040 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1041 }
1042}
1043
1044/*------------------------------------------------------------------
1045 *
1046 * This function handles the 11R Reassoc Req from SME
1047 *
1048 *------------------------------------------------------------------*/
1049void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1050 tpPESession psessionEntry)
1051{
1052 tANI_U8 smeSessionId = 0;
1053 tANI_U16 transactionId = 0;
1054 tANI_U8 chanNum = 0;
1055 tLimMlmReassocReq *pMlmReassocReq;
1056 tANI_U16 caps;
1057 tANI_U32 val;
1058 tSirMsgQ msgQ;
1059 tSirRetStatus retCode;
1060 tANI_U32 teleBcnEn = 0;
1061
1062 chanNum = psessionEntry->currentOperChannel;
1063 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1064 psessionEntry->smeSessionId = smeSessionId;
1065 psessionEntry->transactionId = transactionId;
1066
1067
1068
1069 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocReq,
1070 sizeof(tLimMlmReassocReq)))
1071 {
1072 // Log error
1073 limLog(pMac, LOGE, FL("call to palAllocateMemory failed for mlmReassocReq\n"));
1074 return;
1075 }
1076
1077 palCopyMemory( pMac->hHdd, pMlmReassocReq->peerMacAddr,
1078 psessionEntry->bssId,
1079 sizeof(tSirMacAddr));
1080
1081 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1082 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1083 != eSIR_SUCCESS)
1084 {
1085 /**
1086 * Could not get ReassocFailureTimeout value
1087 * from CFG. Log error.
1088 */
1089 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value\n"));
1090 return;
1091 }
1092
1093 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1094 {
1095 /**
1096 * Could not get Capabilities value
1097 * from CFG. Log error.
1098 */
1099 limLog(pMac, LOGE, FL("could not retrieve Capabilities value\n"));
1100 return;
1101 }
1102 pMlmReassocReq->capabilityInfo = caps;
1103
1104 /* Update PE sessionId*/
1105 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1106
1107 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
1108 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1109 eSIR_SUCCESS)
1110 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN\n"));
1111
1112 if(teleBcnEn)
1113 {
1114 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
1115 /**
1116 * Could not get ListenInterval value
1117 * from CFG. Log error.
1118 */
1119 limLog(pMac, LOGE, FL("could not retrieve ListenInterval\n"));
1120 return;
1121 }
1122 else
1123 {
1124 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
1125 {
1126 /**
1127 * Could not get ListenInterval value
1128 * from CFG. Log error.
1129 */
1130 limLog(pMac, LOGE, FL("could not retrieve ListenInterval\n"));
1131 return;
1132 }
1133 }
1134 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
1135 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
1136 {
1137 return;
1138 }
1139
1140 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
1141 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
1142 {
1143 return;
1144 }
1145
Jeff Johnson295189b2012-06-20 16:38:30 -07001146 pMlmReassocReq->listenInterval = (tANI_U16) val;
1147
1148 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1149
1150
1151 //we need to defer the message until we get the response back from HAL.
1152 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
1153
1154 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1155 msgQ.reserved = 0;
1156 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1157 msgQ.bodyval = 0;
1158
1159
1160#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
1161 limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
1162#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001163 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001164
1165 retCode = wdaPostCtrlMsg( pMac, &msgQ );
1166 if( eSIR_SUCCESS != retCode)
1167 {
1168 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
1169 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
1170 retCode );
1171 }
1172 // Dont need this anymore
1173 pMac->ft.ftPEContext.pAddBssReq = NULL;
1174 return;
1175}
1176
1177/*------------------------------------------------------------------
1178 *
1179 * This function is called if preauth response is not received from the AP
1180 * within this timeout while FT in progress
1181 *
1182 *------------------------------------------------------------------*/
1183void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1184{
1185 tpPESession psessionEntry;
1186
1187 // We have failed pre auth. We need to resume link and get back on
1188 // home channel.
1189
1190 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1191 {
1192 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID\n"));
1193 return;
1194 }
1195
1196 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1197 // to get back.
1198 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1199}
1200
1201
1202/*------------------------------------------------------------------
1203 *
1204 * This function is called to process the update key request from SME
1205 *
1206 *------------------------------------------------------------------*/
1207tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1208{
1209 tAddBssParams * pAddBssParams;
1210 tSirFTUpdateKeyInfo * pKeyInfo;
1211 tANI_U32 val = 0;
1212
1213 /* Sanity Check */
1214 if( pMac == NULL || pMsgBuf == NULL )
1215 {
1216 return TRUE;
1217 }
1218
1219 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1220 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
1221
1222 /* Store the key information in the ADD BSS parameters */
1223 pAddBssParams->extSetStaKeyParamValid = 1;
1224 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
1225 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1226 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof( tSirKeys ));
1227 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1228 {
1229 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC\n" ));
1230 }
1231
1232 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
1233
1234 return TRUE;
1235}
1236
1237tSirRetStatus
1238limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1239{
1240 tSirMsgQ msg;
1241 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1242 tpAggrAddTsParams pAggrAddTsParam;
1243 tpPESession psessionEntry = NULL;
1244 tpLimTspecInfo tspecInfo;
1245 tANI_U8 ac;
1246 tpDphHashNode pSta;
1247 tANI_U16 aid;
1248 tANI_U8 sessionId;
1249 int i;
1250
1251 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
1252 (void **)&pAggrAddTsParam,
1253 sizeof(tAggrAddTsParams)))
1254 {
1255 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed\n"));)
1256 return eSIR_MEM_ALLOC_FAILED;
1257 }
1258
1259 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1260
1261 if (psessionEntry == NULL) {
1262 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d\n"), aggrQosReq->sessionId);)
1263 return eSIR_FAILURE;
1264 }
1265
1266 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1267 if (pSta == NULL)
1268 {
1269 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp\n"));)
1270 return eSIR_FAILURE;
1271 }
1272
1273 palZeroMemory( pMac->hHdd, (tANI_U8 *)pAggrAddTsParam,
1274 sizeof(tAggrAddTsParams));
1275 pAggrAddTsParam->staIdx = psessionEntry->staId;
1276 // Fill in the sessionId specific to PE
1277 pAggrAddTsParam->sessionId = sessionId;
1278 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1279
1280 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1281 {
1282 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1283 {
1284 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1285 /* Since AddTS response was successful, check for the PSB flag
1286 * and directional flag inside the TS Info field.
1287 * An AC is trigger enabled AC if the PSB subfield is set to 1
1288 * in the uplink direction.
1289 * An AC is delivery enabled AC if the PSB subfield is set to 1
1290 * in the downlink direction.
1291 * An AC is trigger and delivery enabled AC if the PSB subfield
1292 * is set to 1 in the bi-direction field.
1293 */
1294 if (pTspec->tsinfo.traffic.psb == 1)
1295 {
1296 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1297 }
1298 else
1299 {
1300 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1301 }
1302 /* ADDTS success, so AC is now admitted. We shall now use the default
1303 * EDCA parameters as advertised by AP and send the updated EDCA params
1304 * to HAL.
1305 */
1306 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1307 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1308 {
1309 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1310 }
1311 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1312 {
1313 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1314 }
1315 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1316 {
1317 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1318 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1319 }
1320
1321 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1322
1323 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1324 {
1325 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1326 }
1327 else
1328 {
1329 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1330 }
1331
1332 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1333 {
1334 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed \n"));)
1335 pMac->lim.gLimAddtsSent = false;
1336 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1337 }
1338
1339 // Copy the TSPEC paramters
1340 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1341 }
1342 }
1343
1344 msg.type = WDA_AGGR_QOS_REQ;
1345 msg.bodyptr = pAggrAddTsParam;
1346 msg.bodyval = 0;
1347
1348 /* We need to defer any incoming messages until we get a
1349 * WDA_AGGR_QOS_RSP from HAL.
1350 */
1351 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001352 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001353
1354 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1355 {
1356 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed\n"));)
1357 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1358 palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
1359 return eSIR_FAILURE;
1360 }
1361
1362 return eSIR_SUCCESS;
1363}
1364
1365void
1366limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1367 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1368{
1369 tpSirAggrQosRsp rsp;
1370 int i = 0;
1371
1372 if (! rspReqd)
1373 {
1374 return;
1375 }
1376
1377 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp,
1378 sizeof(tSirAggrQosRsp)))
1379 {
1380 limLog(pMac, LOGP, FL("palAllocateMemory failed for tSirAggrQosRsp"));
1381 return;
1382 }
1383
1384 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
1385 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1386 rsp->sessionId = smesessionId;
1387 rsp->length = sizeof(*rsp);
1388 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1389
1390 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1391 {
1392 if( (1 << i) & aggrQosRsp->tspecIdx )
1393 {
1394 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1395 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1396 }
1397 }
1398
1399 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1400 return;
1401}
1402
1403
1404void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1405{
1406 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1407 //tpAggrQosParams pAggrQosRspMsg = NULL;
1408 tAddTsParams addTsParam = {0};
1409 tpDphHashNode pSta = NULL;
1410 tANI_U16 assocId =0;
1411 tSirMacAddr peerMacAddr;
1412 tANI_U8 rspReqd = 1;
1413 tpPESession psessionEntry = NULL;
1414 int i = 0;
1415
1416 PELOG1(limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL\n"));)
1417
1418 /* Need to process all the deferred messages enqueued since sending the
1419 SIR_HAL_AGGR_ADD_TS_REQ */
1420 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1421
1422 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1423 if (NULL == pAggrQosRspMsg)
1424 {
1425 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1426 return;
1427 }
1428
1429 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1430 if (NULL == psessionEntry)
1431 {
1432 // Cant find session entry
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001433 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s\n"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001434 if( pAggrQosRspMsg != NULL )
1435 {
1436 palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
1437 }
1438 return;
1439 }
1440
1441 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1442 {
1443 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1444 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1445 {
1446 /* send DELTS to the station */
1447 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1448
1449 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1450 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1451 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1452 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1453
1454 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1455 &addTsParam.tspec.tsinfo,
1456 &addTsParam.tspec, psessionEntry);
1457
1458 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1459 &psessionEntry->dph.dphHashTable);
1460 if (pSta != NULL)
1461 {
1462 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1463 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1464 }
1465 }
1466 }
1467
1468 /* Send the Aggr QoS response to SME */
1469
1470 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1471 psessionEntry->smeSessionId);
1472 if( pAggrQosRspMsg != NULL )
1473 {
1474 palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
1475 }
1476 return;
1477}
1478
1479
1480/*--------------------------------------------------------------------------
1481 Determines if a session with ccx or 11r assoc is present.
1482 If present it will return TRUE else FALSE
1483 ------------------------------------------------------------------------*/
1484int limisFastTransitionRequired(tpAniSirGlobal pMac, int sessionId)
1485{
1486 if(pMac->lim.gpSession[sessionId].valid == TRUE)
1487 {
1488 // If ccx or 11r connection is found we need to return TRUE
1489 if((pMac->lim.gpSession[sessionId].bssType == eSIR_INFRASTRUCTURE_MODE) &&
1490 (((pMac->lim.gpSession[sessionId].is11Rconnection)
1491#ifdef FEATURE_WLAN_CCX
1492 || (pMac->lim.gpSession[sessionId].isCCXconnection)
1493#endif
Jeff Johnson43971f52012-07-17 12:26:56 -07001494#ifdef FEATURE_WLAN_LFR
1495 || (pMac->lim.gpSession[sessionId].isFastRoamIniFeatureEnabled)
1496#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001497 )&&
1498 pMac->lim.gpSession[sessionId].isFastTransitionEnabled))
1499 {
1500 // Make sure we have 11r/CCX and FT enabled only then we need
1501 // the values to be altered from cfg for FW RSSI Period alteration.
1502 return TRUE;
1503 }
1504 }
1505
1506 return FALSE;
1507}
1508
1509#endif /* WLAN_FEATURE_VOWIFI_11R */